Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
feat!: complete ui overhaul (#1108)
Miguel Ribeiro11eaf402e841
diff --git a/.dockerignore b/.dockerignoreindex 9cd6448..bb235ce 100644--- a/.dockerignore+++ b/.dockerignore@@ -7,4 +7,7 @@*.md.gitignore-.dockerignore\ No newline at end of file+.dockerignore++# README screenshots and capture script; not used at runtime+/screenshots/\ No newline at end of filediff --git a/README.md b/README.mdindex 2d4aa69..2af0df0 100644--- a/README.md+++ b/README.md@@ -199,6 +199,12 @@ If you want to trigger an Update of the exchange rates, change your main currenc++++++@@ -207,6 +213,8 @@ If you want to trigger an Update of the exchange rates, change your main currenc ++ ## OIDCdiff --git a/about.php b/about.phpindex 6353bc3..7602f1c 100644--- a/about.php+++ b/about.php@@ -94,10 +94,10 @@ if (!is_null($settings['latest_version'])) {</span></div><div>- <h3>Chart.js</h3>+ <h3>ApexCharts</h3><span>- https://www.chartjs.org/- <a href="https://www.chartjs.org/" target="_blank" title="<?= translate('external_url', $i18n) ?>"+ https://apexcharts.com/+ <a href="https://apexcharts.com/" target="_blank" title="<?= translate('external_url', $i18n) ?>"rel="noreferrer"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>diff --git a/admin.php b/admin.phpindex 0fa901b..0d6fb39 100644--- a/admin.php+++ b/admin.php@@ -57,7 +57,7 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;</p><p><i class="fa-solid fa-circle-info"></i>- By enabling user registrations, the setting to disable login will be unavailable.+ <?= translate('registrations_disable_login_info', $i18n) ?></p></div><div class="form-group-inline">@@ -101,11 +101,11 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;</div><div class="settings-notes"><p>- <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>+ <i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i><?= translate('disable_login_info', $i18n) ?></p><p>- <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>+ <i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i><?= translate('disable_login_info2', $i18n) ?></p></div>diff --git a/api/admin/get_admin_settings.php b/api/admin/get_admin_settings.phpindex e59f416..eb6f40b 100644--- a/api/admin/get_admin_settings.php+++ b/api/admin/get_admin_settings.php@@ -2,7 +2,7 @@/*This API Endpoint accepts both POST and GET requests.It receives the following parameters:-- api_key: the API key of the user.+- api_key: the API key of the user (must be user ID 1 / admin).It returns a JSON object with the following properties:- success: whether the request was successful (boolean).@@ -27,7 +27,9 @@ Example response:"encryption": "tls","login_disabled": 0,"latest_version": "v1.0.0",- "update_notification": 1+ "update_notification": 1,+ "oidc_oauth_enabled": 0,+ "local_webhook_notifications_allowlist": "localhost,127.0.0.1"},"notes": []}diff --git a/api/admin/set_admin_settings.php b/api/admin/set_admin_settings.phpnew file mode 100644index 0000000..2f5ab3e--- /dev/null+++ b/api/admin/set_admin_settings.php@@ -0,0 +1,226 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (must be user ID 1 / admin).+- registrations_open: (optional) '1' or '0' (allow new signups).+- max_users: (optional) maximum allowed users (integer).+- require_email_verification: (optional) '1' or '0'.+- server_url: (optional) url of this wallos instance.+- smtp_address: (optional) SMTP server address.+- smtp_port: (optional) SMTP port (integer).+- smtp_username: (optional) SMTP login username.+- smtp_password: (optional) SMTP login password.+- from_email: (optional) outgoing email address.+- encryption: (optional) 'tls' or 'ssl'.+- login_disabled: (optional) '1' or '0' (disable standard login).+- update_notification: (optional) '1' or '0' (check for wallos updates).+- oidc_oauth_enabled: (optional) '1' or '0' (enable OIDC login).+- local_webhook_notifications_allowlist: (optional) comma-separated IP/hosts allowlist.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).++Example response:+{+ "success": true,+ "title": "Admin settings saved",+ "message": "Global admin settings have been updated successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/ssrf_helper.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];++// Must be Admin user (ID 1)+if ($userId !== 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Forbidden',+ 'message' => 'Only the admin user (user ID 1) can update global settings.'+ ]);+ exit;+}++// Fetch current admin settings+$adminSql = "SELECT * FROM 'admin' WHERE id = 1";+$adminResult = $db->query($adminSql);+$adminSettings = $adminResult->fetchArray(SQLITE3_ASSOC);++if (!$adminSettings) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Configuration error',+ 'message' => 'Settings row not found in the database.'+ ]);+ exit;+}++// Validation & Checks+$registrations_open = isset($_POST['registrations_open']) ? intval($_POST['registrations_open']) : intval($adminSettings['registrations_open']);+$login_disabled = isset($_POST['login_disabled']) ? intval($_POST['login_disabled']) : intval($adminSettings['login_disabled']);++if ($login_disabled === 1) {+ if ($registrations_open === 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Validation error',+ 'message' => 'Registrations cannot be open if password login is disabled.'+ ]);+ exit;+ }++ $userCount = $db->querySingle("SELECT COUNT(*) FROM user");+ if ($userCount > 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Validation error',+ 'message' => 'Password login cannot be disabled if there is more than one user.'+ ]);+ exit;+ }+}++$require_email_verification = isset($_POST['require_email_verification']) ? intval($_POST['require_email_verification']) : intval($adminSettings['require_email_verification']);+$server_url = isset($_POST['server_url']) ? trim($_POST['server_url']) : $adminSettings['server_url'];++if ($require_email_verification === 1 && empty($server_url)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Validation error',+ 'message' => 'Email verification requires a server URL.'+ ]);+ exit;+}++// SMTP checks+$smtp_address = $_POST['smtp_address'] ?? $adminSettings['smtp_address'];+$smtp_port = $_POST['smtp_port'] ?? $adminSettings['smtp_port'];++if (!empty($smtp_address) && !empty($smtp_port)) {+ $smtp_port_int = intval($smtp_port);+ if ($smtp_port_int < 1 || $smtp_port_int > 65535) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Validation error',+ 'message' => 'SMTP port must be a valid number between 1 and 65535.'+ ]);+ exit;+ }++ if (!validate_smtp_host($smtp_address, $smtp_port_int, $db)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Security Block',+ 'message' => 'Security Error: SMTP host must not target link-local or loopback addresses.'+ ]);+ exit;+ }+}++// Build Update Query+$fields = [];+$params = [];++$columnsMap = [+ 'registrations_open' => SQLITE3_INTEGER,+ 'max_users' => SQLITE3_INTEGER,+ 'require_email_verification' => SQLITE3_INTEGER,+ 'server_url' => SQLITE3_TEXT,+ 'smtp_address' => SQLITE3_TEXT,+ 'smtp_port' => SQLITE3_INTEGER,+ 'smtp_username' => SQLITE3_TEXT,+ 'smtp_password' => SQLITE3_TEXT,+ 'from_email' => SQLITE3_TEXT,+ 'encryption' => SQLITE3_TEXT,+ 'login_disabled' => SQLITE3_INTEGER,+ 'update_notification' => SQLITE3_INTEGER,+ 'oidc_oauth_enabled' => SQLITE3_INTEGER,+ 'local_webhook_notifications_allowlist' => SQLITE3_TEXT+];++foreach ($columnsMap as $postKey => $dataType) {+ if (isset($_POST[$postKey])) {+ $fields[] = "$postKey = :$postKey";+ if ($dataType === SQLITE3_INTEGER) {+ $params[$postKey] = [+ 'val' => intval($_POST[$postKey]),+ 'type' => SQLITE3_INTEGER+ ];+ } else {+ $params[$postKey] = [+ 'val' => $_POST[$postKey],+ 'type' => SQLITE3_TEXT+ ];+ }+ }+}++if (!empty($fields)) {+ $sqlUpdate = "UPDATE admin SET " . implode(', ', $fields) . " WHERE id = 1";+ $stmtUpdate = $db->prepare($sqlUpdate);+ foreach ($params as $key => $data) {+ $stmtUpdate->bindValue(':' . $key, $data['val'], $data['type']);+ }+ $resultUpdate = $stmtUpdate->execute();++ if (!$resultUpdate) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to save admin settings.'+ ]);+ exit;+ }+}++echo json_encode([+ 'success' => true,+ 'title' => 'Admin settings saved',+ 'message' => 'Global admin settings have been updated successfully.'+]);++$db->close();+?>diff --git a/api/admin/set_oidc_settings.php b/api/admin/set_oidc_settings.phpnew file mode 100644index 0000000..e50dc17--- /dev/null+++ b/api/admin/set_oidc_settings.php@@ -0,0 +1,224 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (must be user ID 1 / admin).+- oidc_enabled: (optional) '1' to enable OIDC logins, '0' to disable.+- name: (optional) provider name.+- client_id: (optional) OAuth client ID.+- client_secret: (optional) OAuth client secret.+- authorization_url: (optional) authorization endpoint.+- token_url: (optional) token endpoint.+- user_info_url: (optional) userinfo endpoint.+- redirect_url: (optional) callback/redirect URL.+- logout_url: (optional) logout/end-session URL.+- user_identifier_field: (optional) field identifier (e.g. sub).+- scopes: (optional) scope list.+- auth_style: (optional) authentication style (auto/header/params).+- auto_create_user: (optional) '1' to auto-register new OIDC users, '0' otherwise.+- password_login_disabled: (optional) '1' to disable password logins, '0' otherwise.+- require_email_verified: (optional) '1' to reject unverified emails, '0' otherwise.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).++Example response:+{+ "success": true,+ "title": "OIDC settings saved",+ "message": "OIDC configurations have been saved successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/ssrf_helper.php';+require_once '../../includes/oidc_settings.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];++// Must be Admin user (ID 1)+if ($userId !== 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Forbidden',+ 'message' => 'Only the admin user (user ID 1) can update OIDC configurations.'+ ]);+ exit;+}++// 1. Handle OIDC Enabled Toggle+if (isset($_POST['oidc_enabled'])) {+ if (wallos_has_oidc_env_value('OIDC_ENABLED')) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Environment override',+ 'message' => 'OIDC enablement is managed by the OIDC_ENABLED environment variable.'+ ]);+ exit;+ }++ $oidcEnabled = ($_POST['oidc_enabled'] === '1' || $_POST['oidc_enabled'] === 1) ? 1 : 0;+ $stmtEnabled = $db->prepare('UPDATE admin SET oidc_oauth_enabled = :oidcEnabled WHERE id = 1');+ $stmtEnabled->bindParam(':oidcEnabled', $oidcEnabled, SQLITE3_INTEGER);+ $stmtEnabled->execute();+}++// 2. Handle OIDC detailed configurations+$oidcConfiguration = wallos_get_effective_oidc_configuration($db);+$managedFields = $oidcConfiguration['managed_fields'];+$dbSettings = wallos_get_db_oidc_settings($db);++$incomingMapping = [+ 'name' => $_POST['name'] ?? null,+ 'client_id' => $_POST['client_id'] ?? null,+ 'client_secret' => $_POST['client_secret'] ?? null,+ 'authorization_url' => $_POST['authorization_url'] ?? null,+ 'token_url' => $_POST['token_url'] ?? null,+ 'user_info_url' => $_POST['user_info_url'] ?? null,+ 'redirect_url' => $_POST['redirect_url'] ?? null,+ 'logout_url' => $_POST['logout_url'] ?? null,+ 'user_identifier_field' => $_POST['user_identifier_field'] ?? null,+ 'scopes' => $_POST['scopes'] ?? null,+ 'auth_style' => $_POST['auth_style'] ?? null,+ 'auto_create_user' => isset($_POST['auto_create_user']) ? intval($_POST['auto_create_user']) : null,+ 'password_login_disabled' => isset($_POST['password_login_disabled']) ? intval($_POST['password_login_disabled']) : null,+ 'require_email_verified' => isset($_POST['require_email_verified']) ? intval($_POST['require_email_verified']) : null,+];++// Merge if not managed by environment+$hasConfigChange = false;+foreach ($incomingMapping as $field => $value) {+ if ($value !== null) {+ if (isset($managedFields[$field])) {+ // Cannot modify field overridden by environment variables+ continue;+ }+ $dbSettings[$field] = $value;+ $hasConfigChange = true;+ }+}++if ($hasConfigChange) {+ // SSRF validations+ if ($dbSettings['token_url'] && validate_oidc_endpoint_url($dbSettings['token_url'], $db) === false) {+ echo json_encode([+ "success" => false,+ "title" => "Security Error",+ "message" => "Security Error: Token URL must not target link-local or loopback addresses."+ ]);+ exit;+ }++ if ($dbSettings['user_info_url'] && validate_oidc_endpoint_url($dbSettings['user_info_url'], $db) === false) {+ echo json_encode([+ "success" => false,+ "title" => "Security Error",+ "message" => "Security Error: User Info URL must not target link-local or loopback addresses."+ ]);+ exit;+ }++ // Save to oauth_settings table+ $checkStmt = $db->prepare('SELECT COUNT(*) as count FROM oauth_settings WHERE id = 1');+ $resultCheck = $checkStmt->execute();+ $rowCheck = $resultCheck->fetchArray(SQLITE3_ASSOC);++ if ($rowCheck['count'] > 0) {+ $stmtSave = $db->prepare('UPDATE oauth_settings SET+ name = :oidcName,+ client_id = :oidcClientId,+ client_secret = :oidcClientSecret,+ authorization_url = :oidcAuthUrl,+ token_url = :oidcTokenUrl,+ user_info_url = :oidcUserInfoUrl,+ redirect_url = :oidcRedirectUrl,+ logout_url = :oidcLogoutUrl,+ user_identifier_field = :oidcUserIdentifierField,+ scopes = :oidcScopes,+ auth_style = :oidcAuthStyle,+ auto_create_user = :oidcAutoCreateUser,+ password_login_disabled = :oidcPasswordLoginDisabled,+ require_email_verified = :oidcRequireEmailVerified+ WHERE id = 1');+ } else {+ $stmtSave = $db->prepare('INSERT INTO oauth_settings (+ id, name, client_id, client_secret, authorization_url, token_url, user_info_url, redirect_url, logout_url, user_identifier_field, scopes, auth_style, auto_create_user, password_login_disabled, require_email_verified+ ) VALUES (+ 1, :oidcName, :oidcClientId, :oidcClientSecret, :oidcAuthUrl, :oidcTokenUrl, :oidcUserInfoUrl, :oidcRedirectUrl, :oidcLogoutUrl, :oidcUserIdentifierField, :oidcScopes, :oidcAuthStyle, :oidcAutoCreateUser, :oidcPasswordLoginDisabled, :oidcRequireEmailVerified+ )');+ }++ $stmtSave->bindValue(':oidcName', $dbSettings['name'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcClientId', $dbSettings['client_id'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcClientSecret', $dbSettings['client_secret'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcAuthUrl', $dbSettings['authorization_url'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcTokenUrl', $dbSettings['token_url'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcUserInfoUrl', $dbSettings['user_info_url'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcRedirectUrl', $dbSettings['redirect_url'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcLogoutUrl', $dbSettings['logout_url'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcUserIdentifierField', $dbSettings['user_identifier_field'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcScopes', $dbSettings['scopes'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcAuthStyle', $dbSettings['auth_style'], SQLITE3_TEXT);+ $stmtSave->bindValue(':oidcAutoCreateUser', $dbSettings['auto_create_user'], SQLITE3_INTEGER);+ $stmtSave->bindValue(':oidcPasswordLoginDisabled', $dbSettings['password_login_disabled'], SQLITE3_INTEGER);+ $stmtSave->bindValue(':oidcRequireEmailVerified', $dbSettings['require_email_verified'], SQLITE3_INTEGER);++ $resultSave = $stmtSave->execute();+ if (!$resultSave) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to save OIDC configurations.'+ ]);+ exit;+ }+}++echo json_encode([+ 'success' => true,+ 'title' => 'OIDC settings saved',+ 'message' => 'OIDC configurations have been saved successfully.'+]);++$db->close();+?>diff --git a/api/categories/set_categories.php b/api/categories/set_categories.phpnew file mode 100644index 0000000..59982d5--- /dev/null+++ b/api/categories/set_categories.php@@ -0,0 +1,260 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user.+- action: the action to perform ('add', 'edit', 'delete').+- name: (required for 'add' and 'edit') the name of the category.+- id / categoryId: (required for 'edit' and 'delete') the ID of the category.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).+- categoryId: (only for successful 'add' action) the ID of the newly created category (integer).++Example response:+{+ "success": true,+ "title": "Category added",+ "categoryId": 4,+ "message": "Category added successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$action = $_POST['action'] ?? null;++if (!$action || !in_array($action, ['add', 'edit', 'delete'], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid action',+ 'message' => 'Action must be "add", "edit", or "delete".'+ ]);+ exit;+}++switch ($action) {+ case 'add':+ $name = $_POST['name'] ?? null;+ if (!$name || trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "name" is required and cannot be empty.'+ ]);+ exit;+ }+ $name = validate($name);++ // Get next order sequence+ $stmtOrder = $db->prepare('SELECT MAX("order") as maxOrder FROM categories WHERE user_id = :userId');+ $stmtOrder->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultOrder = $stmtOrder->execute();+ $rowOrder = $resultOrder->fetchArray(SQLITE3_ASSOC);+ $maxOrder = $rowOrder['maxOrder'] ?? 0;+ $order = $maxOrder + 1;++ // Insert+ $sqlInsert = 'INSERT INTO categories ("name", "order", "user_id") VALUES (:name, :order, :userId)';+ $stmtInsert = $db->prepare($sqlInsert);+ $stmtInsert->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtInsert->bindParam(':order', $order, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultInsert = $stmtInsert->execute();++ if ($resultInsert) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Category added',+ 'categoryId' => $db->lastInsertRowID(),+ 'message' => 'Category added successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to add category.'+ ]);+ }+ break;++ case 'edit':+ $categoryId = $_POST['categoryId'] ?? $_POST['id'] ?? null;+ $name = $_POST['name'] ?? null;++ if (!$categoryId || !$name || trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameters',+ 'message' => 'Parameters "id" (or "categoryId") and "name" are required.'+ ]);+ exit;+ }+ $name = validate($name);+ $categoryId = intval($categoryId);++ // Check ownership+ $checkSql = "SELECT * FROM categories WHERE id = :categoryId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':categoryId', $categoryId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $category = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$category) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Category not found or does not belong to you.'+ ]);+ exit;+ }++ // Update+ $sqlEdit = "UPDATE categories SET name = :name WHERE id = :categoryId AND user_id = :userId";+ $stmtEdit = $db->prepare($sqlEdit);+ $stmtEdit->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtEdit->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);+ $stmtEdit->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultEdit = $stmtEdit->execute();++ if ($resultEdit) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Category updated',+ 'message' => 'Category updated successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to update category.'+ ]);+ }+ break;++ case 'delete':+ $categoryId = $_POST['categoryId'] ?? $_POST['id'] ?? null;++ if (!$categoryId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "categoryId") is required.'+ ]);+ exit;+ }+ $categoryId = intval($categoryId);++ // Cannot delete category 1 (default fallback)+ if ($categoryId === 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Cannot delete category',+ 'message' => 'The default category cannot be deleted.'+ ]);+ exit;+ }++ // Check ownership+ $checkSql = "SELECT * FROM categories WHERE id = :categoryId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':categoryId', $categoryId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $category = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$category) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Category not found or does not belong to you.'+ ]);+ exit;+ }++ // Check if category is in use+ $checkUseSql = "SELECT COUNT(*) FROM subscriptions WHERE category_id = :categoryId AND user_id = :userId";+ $checkUseStmt = $db->prepare($checkUseSql);+ $checkUseStmt->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);+ $checkUseStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $checkUseResult = $checkUseStmt->execute();+ $row = $checkUseResult->fetchArray();+ $count = $row[0] ?? 0;++ if ($count > 0) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Category in use',+ 'message' => 'This category cannot be deleted because it is in use by one or more subscriptions.'+ ]);+ exit;+ }++ // Delete+ $sqlDelete = "DELETE FROM categories WHERE id = :categoryId AND user_id = :userId";+ $stmtDelete = $db->prepare($sqlDelete);+ $stmtDelete->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);+ $stmtDelete->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultDelete = $stmtDelete->execute();++ if ($resultDelete) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Category deleted',+ 'message' => 'Category deleted successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to delete category.'+ ]);+ }+ break;+}++$db->close();+?>diff --git a/api/currencies/set_currencies.php b/api/currencies/set_currencies.phpnew file mode 100644index 0000000..9823fe0--- /dev/null+++ b/api/currencies/set_currencies.php@@ -0,0 +1,282 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user.+- action: the action to perform ('add', 'edit', 'delete').+- name: (required for 'add' and 'edit') the name of the currency.+- symbol: (required for 'add' and 'edit') the symbol of the currency (e.g. $, €).+- code: (required for 'add' and 'edit') the currency code (e.g. USD, EUR).+- rate: (optional for 'add' and 'edit') the exchange rate (default: 1.0).+- id / currencyId: (required for 'edit' and 'delete') the ID of the currency.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).+- currencyId: (only for successful 'add' action) the ID of the newly created currency (integer).++Example response:+{+ "success": true,+ "title": "Currency added",+ "currencyId": 5,+ "message": "Currency added successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$action = $_POST['action'] ?? null;++if (!$action || !in_array($action, ['add', 'edit', 'delete'], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid action',+ 'message' => 'Action must be "add", "edit", or "delete".'+ ]);+ exit;+}++switch ($action) {+ case 'add':+ $name = $_POST['name'] ?? null;+ $symbol = $_POST['symbol'] ?? null;+ $code = $_POST['code'] ?? null;+ $rate = $_POST['rate'] ?? 1.0;++ if (!$name || trim($name) === '' || !$symbol || trim($symbol) === '' || !$code || trim($code) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameters',+ 'message' => 'Parameters "name", "symbol", and "code" are required.'+ ]);+ exit;+ }++ $name = validate($name);+ $symbol = validate($symbol);+ $code = validate($code);+ $rate = floatval($rate);++ // Insert+ $sqlInsert = "INSERT INTO currencies (name, symbol, code, rate, user_id) VALUES (:name, :symbol, :code, :rate, :userId)";+ $stmtInsert = $db->prepare($sqlInsert);+ $stmtInsert->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtInsert->bindParam(':symbol', $symbol, SQLITE3_TEXT);+ $stmtInsert->bindParam(':code', $code, SQLITE3_TEXT);+ $stmtInsert->bindParam(':rate', $rate, SQLITE3_FLOAT);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultInsert = $stmtInsert->execute();++ if ($resultInsert) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Currency added',+ 'currencyId' => $db->lastInsertRowID(),+ 'message' => 'Currency added successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to add currency.'+ ]);+ }+ break;++ case 'edit':+ $currencyId = $_POST['currencyId'] ?? $_POST['id'] ?? null;+ $name = $_POST['name'] ?? null;+ $symbol = $_POST['symbol'] ?? null;+ $code = $_POST['code'] ?? null;++ if (!$currencyId || !$name || trim($name) === '' || !$symbol || trim($symbol) === '' || !$code || trim($code) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameters',+ 'message' => 'Parameters "id" (or "currencyId"), "name", "symbol", and "code" are required.'+ ]);+ exit;+ }++ $currencyId = intval($currencyId);+ $name = validate($name);+ $symbol = validate($symbol);+ $code = validate($code);++ // Check ownership+ $checkSql = "SELECT * FROM currencies WHERE id = :currencyId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':currencyId', $currencyId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $currency = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$currency) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Currency not found or does not belong to you.'+ ]);+ exit;+ }++ // Build Update Query+ if (isset($_POST['rate'])) {+ $rate = floatval($_POST['rate']);+ $sqlUpdate = "UPDATE currencies SET name = :name, symbol = :symbol, code = :code, rate = :rate WHERE id = :currencyId AND user_id = :userId";+ } else {+ $sqlUpdate = "UPDATE currencies SET name = :name, symbol = :symbol, code = :code WHERE id = :currencyId AND user_id = :userId";+ }++ $stmtUpdate = $db->prepare($sqlUpdate);+ $stmtUpdate->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':symbol', $symbol, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':code', $code, SQLITE3_TEXT);+ if (isset($_POST['rate'])) {+ $stmtUpdate->bindParam(':rate', $rate, SQLITE3_FLOAT);+ }+ $stmtUpdate->bindParam(':currencyId', $currencyId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultUpdate = $stmtUpdate->execute();++ if ($resultUpdate) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Currency updated',+ 'message' => 'Currency updated successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to update currency.'+ ]);+ }+ break;++ case 'delete':+ $currencyId = $_POST['currencyId'] ?? $_POST['id'] ?? null;++ if (!$currencyId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "currencyId") is required.'+ ]);+ exit;+ }+ $currencyId = intval($currencyId);++ // Check ownership+ $checkSql = "SELECT * FROM currencies WHERE id = :currencyId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':currencyId', $currencyId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $currency = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$currency) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Currency not found or does not belong to you.'+ ]);+ exit;+ }++ // Cannot delete main currency+ $mainCurrencyId = intval($user['main_currency']);+ if ($currencyId === $mainCurrencyId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Cannot delete currency',+ 'message' => 'This is your main currency and cannot be deleted.'+ ]);+ exit;+ }++ // Check if in use+ $checkUseSql = "SELECT COUNT(*) FROM subscriptions WHERE currency_id = :currencyId AND user_id = :userId";+ $checkUseStmt = $db->prepare($checkUseSql);+ $checkUseStmt->bindParam(':currencyId', $currencyId, SQLITE3_INTEGER);+ $checkUseStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $checkUseResult = $checkUseStmt->execute();+ $row = $checkUseResult->fetchArray();+ $count = $row[0] ?? 0;++ if ($count > 0) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Currency in use',+ 'message' => 'This currency cannot be deleted because it is in use by one or more subscriptions.'+ ]);+ exit;+ }++ // Delete+ $sqlDelete = "DELETE FROM currencies WHERE id = :currencyId AND user_id = :userId";+ $stmtDelete = $db->prepare($sqlDelete);+ $stmtDelete->bindParam(':currencyId', $currencyId, SQLITE3_INTEGER);+ $stmtDelete->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultDelete = $stmtDelete->execute();++ if ($resultDelete) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Currency deleted',+ 'message' => 'Currency deleted successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to delete currency.'+ ]);+ }+ break;+}++$db->close();+?>diff --git a/api/fixer/set_fixer.php b/api/fixer/set_fixer.phpnew file mode 100644index 0000000..0c8abcc--- /dev/null+++ b/api/fixer/set_fixer.php@@ -0,0 +1,187 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (for Wallos authentication).+- fixer_api_key: the Fixer.io or APILayer API key to save (optional; if empty/omitted, clears the key).+- provider: the provider type (optional; '0' for Fixer.io, '1' for APILayer.com, defaults to '0').++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).++Example response:+{+ "success": true,+ "title": "Fixer settings updated",+ "message": "Fixer API key has been saved."+}+*/++require_once '../../includes/connect_endpoint.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$fixerApiKey = isset($_POST['fixer_api_key']) ? trim($_POST['fixer_api_key']) : '';+$provider = $_POST['provider'] ?? '0';++if (!in_array($provider, ['0', '1', 0, 1], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid provider',+ 'message' => 'Provider must be 0 (Fixer.io) or 1 (APILayer.com).'+ ]);+ exit;+}+$provider = intval($provider);++// If key is empty, clear the settings+if ($fixerApiKey === '') {+ $removeSql = "DELETE FROM fixer WHERE user_id = :userId";+ $removeStmt = $db->prepare($removeSql);+ $removeStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $removeResult = $removeStmt->execute();++ if ($removeResult) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Fixer settings cleared',+ 'message' => 'Fixer API key has been removed.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to remove Fixer API settings.'+ ]);+ }+ $db->close();+ exit;+}++// Validate the API key against the provider+if ($provider === 1) {+ $testKeyUrl = "https://api.apilayer.com/fixer/latest?base=USD&symbols=EUR";+ $context = stream_context_create([+ 'http' => [+ 'method' => 'GET',+ 'header' => 'apikey: ' . $fixerApiKey,+ 'ignore_errors' => true+ ]+ ]);+ $response = @file_get_contents($testKeyUrl, false, $context);+} else {+ $testKeyUrl = "http://data.fixer.io/api/latest?access_key=" . urlencode($fixerApiKey);+ $response = @file_get_contents($testKeyUrl);+}++if ($response === false) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Validation error',+ 'message' => 'Failed to connect to the currency rate provider for verification.'+ ]);+ exit;+}++// Parse headers for APILayer limit info+$usageLimit = null;+$usageRemaining = null;+if ($provider === 1 && isset($http_response_header)) {+ foreach ($http_response_header as $header) {+ if (stripos($header, 'x-ratelimit-limit-month:') === 0) {+ $usageLimit = (int) trim(substr($header, strlen('x-ratelimit-limit-month:')));+ } elseif (stripos($header, 'x-ratelimit-remaining-month:') === 0) {+ $usageRemaining = (int) trim(substr($header, strlen('x-ratelimit-remaining-month:')));+ }+ }+}++$apiData = json_decode($response, true);+if (isset($apiData['success']) && $apiData['success'] == true) {+ // Delete existing settings first+ $removeSql = "DELETE FROM fixer WHERE user_id = :userId";+ $removeStmt = $db->prepare($removeSql);+ $removeStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $removeStmt->execute();++ // Insert new settings+ $insertSql = "INSERT INTO fixer (api_key, provider, user_id) VALUES (:api_key, :provider, :userId)";+ $stmtInsert = $db->prepare($insertSql);+ $stmtInsert->bindParam(':api_key', $fixerApiKey, SQLITE3_TEXT);+ $stmtInsert->bindParam(':provider', $provider, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultInsert = $stmtInsert->execute();++ if ($resultInsert) {+ // If usage limits are parsed and supported by the db schema+ if ($usageLimit !== null && $usageRemaining !== null+ && $db->querySingle("SELECT COUNT(*) FROM pragma_table_info('fixer') WHERE name='usage_used'") > 0) {+ $usageStmt = $db->prepare("UPDATE fixer SET usage_used = :used, usage_limit = :limit, usage_updated_at = :updatedAt WHERE user_id = :userId");+ $usageStmt->bindValue(':used', $usageLimit - $usageRemaining, SQLITE3_INTEGER);+ $usageStmt->bindValue(':limit', $usageLimit, SQLITE3_INTEGER);+ $usageStmt->bindValue(':updatedAt', date('Y-m-d H:i:s'), SQLITE3_TEXT);+ $usageStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $usageStmt->execute();+ }++ echo json_encode([+ 'success' => true,+ 'title' => 'Fixer settings updated',+ 'message' => 'Fixer API settings have been saved successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to save Fixer API settings.'+ ]);+ }+} else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid Fixer API key',+ 'message' => 'The provided Fixer API key is invalid.'+ ]);+}++$db->close();+?>diff --git a/api/household/set_household.php b/api/household/set_household.phpnew file mode 100644index 0000000..2616f24--- /dev/null+++ b/api/household/set_household.php@@ -0,0 +1,261 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user.+- action: the action to perform ('add', 'edit', 'delete').+- name: (required for 'add' and 'edit') the name of the household member.+- email: (optional for 'add' and 'edit') the email of the household member.+- id / memberId: (required for 'edit' and 'delete') the ID of the household member.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).+- memberId: (only for successful 'add' action) the ID of the newly created member (integer).++Example response:+{+ "success": true,+ "title": "Member added",+ "memberId": 3,+ "message": "Household member added successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$action = $_POST['action'] ?? null;++if (!$action || !in_array($action, ['add', 'edit', 'delete'], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid action',+ 'message' => 'Action must be "add", "edit", or "delete".'+ ]);+ exit;+}++switch ($action) {+ case 'add':+ $name = $_POST['name'] ?? null;+ $email = $_POST['email'] ?? '';++ if (!$name || trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "name" is required and cannot be empty.'+ ]);+ exit;+ }++ $name = validate($name);+ $email = validate($email);++ // Insert+ $sqlInsert = "INSERT INTO household (name, email, user_id) VALUES (:name, :email, :userId)";+ $stmtInsert = $db->prepare($sqlInsert);+ $stmtInsert->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtInsert->bindParam(':email', $email, SQLITE3_TEXT);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultInsert = $stmtInsert->execute();++ if ($resultInsert) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Member added',+ 'memberId' => $db->lastInsertRowID(),+ 'message' => 'Household member added successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to add household member.'+ ]);+ }+ break;++ case 'edit':+ $memberId = $_POST['memberId'] ?? $_POST['id'] ?? null;+ $name = $_POST['name'] ?? null;+ $email = $_POST['email'] ?? '';++ if (!$memberId || !$name || trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameters',+ 'message' => 'Parameters "id" (or "memberId") and "name" are required.'+ ]);+ exit;+ }++ $memberId = intval($memberId);+ $name = validate($name);+ $email = validate($email);++ // Check ownership+ $checkSql = "SELECT * FROM household WHERE id = :memberId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':memberId', $memberId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $member = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$member) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Household member not found or does not belong to you.'+ ]);+ exit;+ }++ // Update+ $sqlUpdate = "UPDATE household SET name = :name, email = :email WHERE id = :memberId AND user_id = :userId";+ $stmtUpdate = $db->prepare($sqlUpdate);+ $stmtUpdate->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':email', $email, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':memberId', $memberId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultUpdate = $stmtUpdate->execute();++ if ($resultUpdate) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Member updated',+ 'message' => 'Household member updated successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to update household member.'+ ]);+ }+ break;++ case 'delete':+ $memberId = $_POST['memberId'] ?? $_POST['id'] ?? null;++ if (!$memberId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "memberId") is required.'+ ]);+ exit;+ }+ $memberId = intval($memberId);++ // Cannot delete member 1 (default user member)+ if ($memberId === 1) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Cannot delete member',+ 'message' => 'The default household member cannot be deleted.'+ ]);+ exit;+ }++ // Check ownership+ $checkSql = "SELECT * FROM household WHERE id = :memberId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':memberId', $memberId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $member = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$member) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Household member not found or does not belong to you.'+ ]);+ exit;+ }++ // Check if in use+ $checkUseSql = "SELECT COUNT(*) FROM subscriptions WHERE payer_user_id = :memberId AND user_id = :userId";+ $checkUseStmt = $db->prepare($checkUseSql);+ $checkUseStmt->bindParam(':memberId', $memberId, SQLITE3_INTEGER);+ $checkUseStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $checkUseResult = $checkUseStmt->execute();+ $row = $checkUseResult->fetchArray();+ $count = $row[0] ?? 0;++ if ($count > 0) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Member in use',+ 'message' => 'This household member cannot be deleted because they are in use by one or more subscriptions.'+ ]);+ exit;+ }++ // Delete+ $sqlDelete = "DELETE FROM household WHERE id = :memberId AND user_id = :userId";+ $stmtDelete = $db->prepare($sqlDelete);+ $stmtDelete->bindParam(':memberId', $memberId, SQLITE3_INTEGER);+ $stmtDelete->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $resultDelete = $stmtDelete->execute();++ if ($resultDelete) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Member deleted',+ 'message' => 'Household member deleted successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to delete household member.'+ ]);+ }+ break;+}++$db->close();+?>diff --git a/api/notifications/get_notification_settings.php b/api/notifications/get_notification_settings.phpindex b968896..f2509cb 100644--- a/api/notifications/get_notification_settings.php+++ b/api/notifications/get_notification_settings.php@@ -15,6 +15,8 @@ Example response:"success": true,"title": "notification_settings","notification_settings": {+ "id": 1,+ "days": 1,"email_notifications": {"enabled": 1,"smtp_address": "smtp.example.com",@@ -25,11 +27,44 @@ Example response:"encryption": "tls","other_emails": "[email protected]"},+ "discord_notifications": {+ "enabled": 1,+ "webhook_url": "https://discord.com/api/webhooks/..."+ },+ "gotify_notifications": {+ "enabled": 1,+ "host": "https://gotify.example.com",+ "token": "********",+ "priority": 5+ },"ntfy_notifications": {"enabled": 0,"host": "http://notify.example.com","topic": "example_topic",+ "headers": "********",+ "priority": 3+ },+ "pushover_notifications": {+ "enabled": 1,+ "token": "********",+ "user_key": "userkey123",+ "title": "Wallos",+ "priority": 0,+ "sound": "pushover"+ },+ "telegram_notifications": {+ "enabled": 1,+ "bot_token": "********",+ "chat_id": "12345678"+ },+ "webhook_notifications": {+ "enabled": 1,+ "url": "https://example.com/webhook","headers": "********"+ },+ "serverchan_notifications": {+ "enabled": 1,+ "sendkey": "********"}},"notes": []diff --git a/api/payment_methods/set_payment_methods.php b/api/payment_methods/set_payment_methods.phpnew file mode 100644index 0000000..48f8d16--- /dev/null+++ b/api/payment_methods/set_payment_methods.php@@ -0,0 +1,499 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (for Wallos authentication).+- action: the action to perform ('add', 'edit', 'delete').+- name: (required for 'add', optional for 'edit') the name of the payment method.+- enabled: (optional for 'add' and 'edit'; '1' for enabled, '0' for disabled).+- icon_url: (optional for 'add' and 'edit') the URL of the icon to fetch.+- paymenticon: (optional for 'add' and 'edit') the uploaded image file.+- id / paymentId: (required for 'edit' and 'delete') the ID of the payment method.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).+- paymentId: (only for successful 'add' action) the ID of the newly created payment method (integer).++Example response:+{+ "success": true,+ "title": "Payment method added",+ "paymentId": 32,+ "message": "Payment method added successfully."+}+*/++error_reporting(E_ERROR | E_PARSE);+require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';+require_once '../../includes/ssrf_helper.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$action = $_POST['action'] ?? null;++if (!$action || !in_array($action, ['add', 'edit', 'delete'], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid action',+ 'message' => 'Action must be "add", "edit", or "delete".'+ ]);+ exit;+}++// Load user settings now that user is authenticated+require_once '../../includes/getsettings.php';++if (!file_exists('../../images/uploads/logos')) {+ mkdir('../../images/uploads/logos', 0777, true);+ mkdir('../../images/uploads/logos/avatars', 0777, true);+}++// Image Helper Functions+function sanitizeFilename($filename)+{+ $filename = preg_replace("/[^a-zA-Z0-9\s]/", "", $filename);+ $filename = str_replace(" ", "-", $filename);+ $filename = str_replace(".", "", $filename);+ return $filename;+}++function validateFileExtension($fileExtension)+{+ $allowedExtensions = ['png', 'jpg', 'jpeg', 'gif', 'jtif', 'webp'];+ return in_array($fileExtension, $allowedExtensions);+}++function getLogoFromUrl($url, $uploadDir, $name, $settings)+{+ $currentUrl = $url;+ $maxRedirects = 3;++ for ($i = 0; $i <= $maxRedirects; $i++) {+ if (!filter_var($currentUrl, FILTER_VALIDATE_URL) || !preg_match('/^https?:\/\//i', $currentUrl)) {+ return ["success" => false, "message" => "Invalid URL format."];+ }++ $host = parse_url($currentUrl, PHP_URL_HOST);+ $port = parse_url($currentUrl, PHP_URL_PORT) ?: (parse_url($currentUrl, PHP_URL_SCHEME) === 'https' ? 443 : 80);+ $ip = gethostbyname($host);++ $is_private = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false+ || is_cgnat_ip($ip);++ if ($is_private) {+ return ["success" => false, "message" => "Invalid IP Address."];+ }++ $ch = curl_init($currentUrl);+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);+ curl_setopt($ch, CURLOPT_TIMEOUT, 5);+ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Wallos/1.0');+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);+ curl_setopt($ch, CURLOPT_RESOLVE, ["{$host}:{$port}:{$ip}"]);++ $imageData = curl_exec($ch);+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);++ if ($httpCode >= 300 && $httpCode < 400) {+ $redirectUrl = curl_getinfo($ch, CURLINFO_REDIRECT_URL);+ curl_close($ch);+ if (!$redirectUrl) break;+ $currentUrl = $redirectUrl;+ continue;+ }++ if ($imageData !== false && $httpCode === 200) {+ $timestamp = time();+ $fileName = $timestamp . '-payments-' . sanitizeFilename($name) . '.png';+ $uploadFile = rtrim($uploadDir, '/') . '/' . $fileName;++ if (saveLogo($imageData, $uploadFile, $name, $settings)) {+ unset($ch);+ return $fileName;+ }+ }++ unset($ch);+ break;+ }++ return "";+}++function saveLogo($imageData, $uploadFile, $name, $settings)+{+ $image = imagecreatefromstring($imageData);+ $removeBackground = isset($settings['removeBackground']) && $settings['removeBackground'] === 'true';+ if ($image !== false) {+ $tempFile = tempnam(sys_get_temp_dir(), 'logo');+ imagepng($image, $tempFile);+ imagedestroy($image);++ if (extension_loaded('imagick')) {+ $imagick = new Imagick($tempFile);+ if ($removeBackground) {+ $fuzz = Imagick::getQuantum() * 0.1; // 10%+ $imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);+ }+ $imagick->trimImage(0);+ $imagick->setImagePage(0, 0, 0, 0);+ $imagick->borderImage(new ImagickPixel('transparent'), 2, 2);+ $imagick->setImageFormat('png');+ $imagick->writeImage($uploadFile);+ $imagick->clear();+ $imagick->destroy();+ } else {+ $newImage = imagecreatefrompng($tempFile);+ if ($removeBackground) {+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ gdRemoveBackgroundColor($newImage, 247, 247, 247);+ }+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $newImage = gdCropTransparent($newImage, 2);+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ }+ unlink($tempFile);+ return true;+ }+ return false;+}++function resizeAndUploadLogo($uploadedFile, $uploadDir, $name)+{+ $targetWidth = 70;+ $targetHeight = 48;++ $timestamp = time();+ $originalFileName = $uploadedFile['name'];+ $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);+ $fileExtension = validateFileExtension($fileExtension) ? $fileExtension : 'png';+ $fileName = $timestamp . '-payments-' . sanitizeFilename($name) . '.' . $fileExtension;+ $uploadFile = $uploadDir . $fileName;++ if (move_uploaded_file($uploadedFile['tmp_name'], $uploadFile)) {+ $fileInfo = getimagesize($uploadFile);++ if ($fileInfo !== false) {+ $width = $fileInfo[0];+ $height = $fileInfo[1];++ if ($fileExtension === 'png') {+ $image = imagecreatefrompng($uploadFile);+ } elseif ($fileExtension === 'jpg' || $fileExtension === 'jpeg') {+ $image = imagecreatefromjpeg($uploadFile);+ } elseif ($fileExtension === 'gif') {+ $image = imagecreatefromgif($uploadFile);+ } elseif ($fileExtension === 'webp') {+ $image = imagecreatefromwebp($uploadFile);+ } else {+ return "";+ }++ if ($fileExtension === 'png') {+ imagesavealpha($image, true);+ }++ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $image = gdCropTransparent($image, 2);+ $width = imagesx($image);+ $height = imagesy($image);++ $newWidth = $width;+ $newHeight = $height;++ if ($width > $targetWidth) {+ $newWidth = (int) $targetWidth;+ $newHeight = (int) (($targetWidth / $width) * $height);+ }++ if ($newHeight > $targetHeight) {+ $newWidth = (int) (($targetHeight / $newHeight) * $newWidth);+ $newHeight = (int) $targetHeight;+ }++ $resizedImage = imagecreatetruecolor($newWidth, $newHeight);+ imagesavealpha($resizedImage, true);+ $transparency = imagecolorallocatealpha($resizedImage, 0, 0, 0, 127);+ imagefill($resizedImage, 0, 0, $transparency);+ imagecopyresampled($resizedImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);++ if ($fileExtension === 'png') {+ imagepng($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'jpg' || $fileExtension === 'jpeg') {+ imagejpeg($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'gif') {+ imagegif($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'webp') {+ imagewebp($resizedImage, $uploadFile);+ } else {+ return "";+ }++ imagedestroy($image);+ imagedestroy($resizedImage);+ return $fileName;+ }+ }+ return "";+}++switch ($action) {+ case 'add':+ $name = $_POST['name'] ?? null;+ $enabled = $_POST['enabled'] ?? '1';+ $iconUrl = $_POST['icon_url'] ?? $_POST['icon-url'] ?? '';++ if (!$name || trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "name" is required and cannot be empty.'+ ]);+ exit;+ }++ $name = validate($name);+ $enabled = ($enabled === '0' || $enabled === 0) ? 0 : 1;++ $icon = "";+ if ($iconUrl !== "") {+ $icon = getLogoFromUrl($iconUrl, '../../images/uploads/logos/', $name, $settings);+ } elseif (!empty($_FILES['paymenticon']['name'])) {+ $fileType = mime_content_type($_FILES['paymenticon']['tmp_name']);+ if (strpos($fileType, 'image') === false) {+ echo json_encode([+ "success" => false,+ "title" => "Invalid file type",+ "message" => "The uploaded file must be an image."+ ]);+ exit();+ }+ $icon = resizeAndUploadLogo($_FILES['paymenticon'], '../../images/uploads/logos/', $name);+ }++ // Get the maximum existing ID+ $stmtMax = $db->prepare("SELECT MAX(id) as maxID FROM payment_methods");+ $resultMax = $stmtMax->execute();+ $rowMax = $resultMax->fetchArray(SQLITE3_ASSOC);+ $maxID = $rowMax['maxID'] ?? 0;++ // Ensure custom ID is >= 32+ $newID = max($maxID + 1, 32);++ // Insert+ $sqlInsert = "INSERT INTO payment_methods (id, name, icon, enabled, user_id) VALUES (:id, :name, :icon, :enabled, :userId)";+ $stmtInsert = $db->prepare($sqlInsert);+ $stmtInsert->bindParam(':id', $newID, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtInsert->bindParam(':icon', $icon, SQLITE3_TEXT);+ $stmtInsert->bindParam(':enabled', $enabled, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmtInsert->execute()) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Payment method added',+ 'paymentId' => $newID,+ 'message' => 'Payment method added successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to add payment method: ' . $db->lastErrorMsg()+ ]);+ }+ break;++ case 'edit':+ $paymentId = $_POST['paymentId'] ?? $_POST['id'] ?? null;+ if (!$paymentId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "paymentId") is required.'+ ]);+ exit;+ }+ $paymentId = intval($paymentId);++ // Check ownership+ $checkSql = "SELECT * FROM payment_methods WHERE id = :paymentId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':paymentId', $paymentId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $paymentMethod = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$paymentMethod) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Payment method not found or does not belong to you.'+ ]);+ exit;+ }++ // Get current values+ $name = $_POST['name'] ?? $paymentMethod['name'];+ $name = validate($name);++ $enabled = $paymentMethod['enabled'];+ if (isset($_POST['enabled'])) {+ $enabled = ($_POST['enabled'] === '0' || $_POST['enabled'] === 0) ? 0 : 1;+ }++ $icon = $paymentMethod['icon'];+ $iconUrl = $_POST['icon_url'] ?? $_POST['icon-url'] ?? '';++ if ($iconUrl !== "") {+ $icon = getLogoFromUrl($iconUrl, '../../images/uploads/logos/', $name, $settings);+ } elseif (!empty($_FILES['paymenticon']['name'])) {+ $fileType = mime_content_type($_FILES['paymenticon']['tmp_name']);+ if (strpos($fileType, 'image') === false) {+ echo json_encode([+ "success" => false,+ "title" => "Invalid file type",+ "message" => "The uploaded file must be an image."+ ]);+ exit();+ }+ $icon = resizeAndUploadLogo($_FILES['paymenticon'], '../../images/uploads/logos/', $name);+ }++ // Update+ $sqlUpdate = "UPDATE payment_methods SET name = :name, icon = :icon, enabled = :enabled WHERE id = :paymentId AND user_id = :userId";+ $stmtUpdate = $db->prepare($sqlUpdate);+ $stmtUpdate->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':icon', $icon, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':enabled', $enabled, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':paymentId', $paymentId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmtUpdate->execute()) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Payment method updated',+ 'message' => 'Payment method updated successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to update payment method: ' . $db->lastErrorMsg()+ ]);+ }+ break;++ case 'delete':+ $paymentId = $_POST['paymentId'] ?? $_POST['id'] ?? null;+ if (!$paymentId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "paymentId") is required.'+ ]);+ exit;+ }+ $paymentId = intval($paymentId);++ // Check ownership+ $checkSql = "SELECT * FROM payment_methods WHERE id = :paymentId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':paymentId', $paymentId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $paymentMethod = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$paymentMethod) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized or Not Found',+ 'message' => 'Payment method not found or does not belong to you.'+ ]);+ exit;+ }++ // Check if in use in subscriptions+ $checkUseSql = "SELECT COUNT(*) FROM subscriptions WHERE payment_method_id = :paymentId AND user_id = :userId";+ $checkUseStmt = $db->prepare($checkUseSql);+ $checkUseStmt->bindParam(':paymentId', $paymentId, SQLITE3_INTEGER);+ $checkUseStmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $checkUseResult = $checkUseStmt->execute();+ $row = $checkUseResult->fetchArray();+ $count = $row[0] ?? 0;++ if ($count > 0) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Payment method in use',+ 'message' => 'This payment method cannot be deleted because it is in use by one or more subscriptions.'+ ]);+ exit;+ }++ // Delete+ $sqlDelete = "DELETE FROM payment_methods WHERE id = :paymentId AND user_id = :userId";+ $stmtDelete = $db->prepare($sqlDelete);+ $stmtDelete->bindParam(':paymentId', $paymentId, SQLITE3_INTEGER);+ $stmtDelete->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmtDelete->execute()) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Payment method deleted',+ 'message' => 'Payment method deleted successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to delete payment method: ' . $db->lastErrorMsg()+ ]);+ }+ break;+}++$db->close();+?>diff --git a/api/settings/get_settings.php b/api/settings/get_settings.phpindex 4817078..b172830 100644--- a/api/settings/get_settings.php+++ b/api/settings/get_settings.php@@ -24,8 +24,16 @@ Example response:"disabled_to_bottom": 1,"show_original_price": 0,"mobile_nav": 1,+ "show_subscription_progress": 0,+ "week_starts_sunday": 0,+ "square_icons": 0,+ "custom_colors": {+ "main_color": "#0000ff",+ "accent_color": "#00ffff",+ "hover_color": "#00008b"+ },"custom_css": {- "css": ""+ "css": "body { background: #000; }"}},"notes": []diff --git a/api/settings/set_settings.php b/api/settings/set_settings.phpnew file mode 100644index 0000000..8c5a732--- /dev/null+++ b/api/settings/set_settings.php@@ -0,0 +1,246 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (for Wallos authentication).+- dark_theme: (optional) '0' (light), '1' (dark), or '2' (automatic).+- color_theme: (optional) 'blue', 'green', 'red', 'yellow', 'purple', or 'custom'.+- monthly_price: (optional) '1' or '0' (show monthly prices).+- convert_currency: (optional) '1' or '0' (convert to main currency).+- show_original_price: (optional) '1' or '0' (show original prices next to converted).+- mobile_nav: (optional) '1' or '0' (use mobile navigation menu).+- show_subscription_progress: (optional) '1' or '0' (show subscription progress bars).+- week_starts_sunday: (optional) '1' or '0' (start calendar weeks on Sunday).+- disabled_to_bottom: (optional) '1' or '0' (move disabled subscriptions to bottom).+- hide_disabled: (optional) '1' or '0' (hide disabled subscriptions).+- remove_background: (optional) '1' or '0' (remove background from logos).+- square_icons: (optional) '1' or '0' (use square icon frames).+- main_color: (optional) Custom theme primary color (hex format, e.g. #0000ff).+- accent_color: (optional) Custom theme accent color (hex format, e.g. #00ffff).+- hover_color: (optional) Custom theme hover color (hex format, e.g. #00008b).+- css: (optional) Custom CSS styling rules to apply to the web interface.++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).++Example response:+{+ "success": true,+ "title": "Settings updated",+ "message": "User settings have been saved successfully."+}+*/++require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];++// 1. Process Custom CSS+if (isset($_POST['css'])) {+ $customCss = $_POST['css'];++ $stmtDelCss = $db->prepare('DELETE FROM custom_css_style WHERE user_id = :userId');+ $stmtDelCss->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $stmtDelCss->execute();++ $stmtInsCss = $db->prepare('INSERT INTO custom_css_style (css, user_id) VALUES (:customCss, :userId)');+ $stmtInsCss->bindValue(':customCss', $customCss, SQLITE3_TEXT);+ $stmtInsCss->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $stmtInsCss->execute();+}++// 2. Process Custom Colors+if (isset($_POST['main_color']) || isset($_POST['accent_color']) || isset($_POST['hover_color']) ||+ isset($_POST['mainColor']) || isset($_POST['accentColor']) || isset($_POST['hoverColor'])) {++ // Fetch current custom colors to allow partial updates+ $colorSql = "SELECT * FROM custom_colors WHERE user_id = :userId";+ $colorStmt = $db->prepare($colorSql);+ $colorStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $colorResult = $colorStmt->execute();+ $currentColor = $colorResult->fetchArray(SQLITE3_ASSOC) ?: [+ 'main_color' => '#0000ff',+ 'accent_color' => '#00ffff',+ 'hover_color' => '#00008b'+ ];++ $main_color = $_POST['main_color'] ?? $_POST['mainColor'] ?? $currentColor['main_color'];+ $accent_color = $_POST['accent_color'] ?? $_POST['accentColor'] ?? $currentColor['accent_color'];+ $hover_color = $_POST['hover_color'] ?? $_POST['hoverColor'] ?? $currentColor['hover_color'];++ // Validate colors+ if (!preg_match('/^#[0-9A-Fa-f]{6}$/', $main_color) ||+ !preg_match('/^#[0-9A-Fa-f]{6}$/', $accent_color) ||+ !preg_match('/^#[0-9A-Fa-f]{6}$/', $hover_color)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid colors',+ 'message' => 'Custom colors must be in #RRGGBB format.'+ ]);+ exit;+ }+ if ($main_color === $accent_color) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Color validation failed',+ 'message' => 'Main color and accent color cannot be the same.'+ ]);+ exit;+ }++ // Delete & Insert+ $delColors = $db->prepare('DELETE FROM custom_colors WHERE user_id = :userId');+ $delColors->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $delColors->execute();++ $insColors = $db->prepare('INSERT INTO custom_colors (main_color, accent_color, hover_color, user_id) VALUES (:main_color, :accent_color, :hover_color, :userId)');+ $insColors->bindValue(':main_color', $main_color, SQLITE3_TEXT);+ $insColors->bindValue(':accent_color', $accent_color, SQLITE3_TEXT);+ $insColors->bindValue(':hover_color', $hover_color, SQLITE3_TEXT);+ $insColors->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $insColors->execute();+}++// 3. Process Settings table updates+$updateFields = [];+$params = [];++$binarySettings = [+ 'monthly_price' => 'monthly_price',+ 'convert_currency' => 'convert_currency',+ 'remove_background' => 'remove_background',+ 'hide_disabled' => 'hide_disabled',+ 'disabled_to_bottom' => 'disabled_to_bottom',+ 'show_original_price' => 'show_original_price',+ 'mobile_nav' => 'mobile_nav',+ 'show_subscription_progress' => 'show_subscription_progress',+ 'week_starts_sunday' => 'week_starts_sunday',+ 'square_icons' => 'square_icons'+];++foreach ($binarySettings as $postKey => $dbCol) {+ if (isset($_POST[$postKey])) {+ $val = $_POST[$postKey];+ if ($val === '1' || $val === '0' || $val === 1 || $val === 0) {+ $updateFields[] = "`$dbCol` = :$postKey";+ $params[$postKey] = [+ 'val' => ($val === '1' || $val === 1) ? 1 : 0,+ 'type' => SQLITE3_INTEGER+ ];+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid parameter',+ 'message' => "Parameter '$postKey' must be 0 or 1."+ ]);+ exit;+ }+ }+}++if (isset($_POST['dark_theme'])) {+ $darkTheme = $_POST['dark_theme'];+ if (in_array($darkTheme, ['0', '1', '2', 0, 1, 2], true)) {+ $updateFields[] = "`dark_theme` = :dark_theme";+ $params['dark_theme'] = [+ 'val' => intval($darkTheme),+ 'type' => SQLITE3_INTEGER+ ];+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid parameter',+ 'message' => "Parameter 'dark_theme' must be 0 (light), 1 (dark), or 2 (automatic)."+ ]);+ exit;+ }+}++if (isset($_POST['color_theme'])) {+ $colorTheme = $_POST['color_theme'];+ $allowedThemes = ['blue', 'green', 'red', 'yellow', 'purple', 'custom'];+ if (in_array($colorTheme, $allowedThemes, true)) {+ $updateFields[] = "`color_theme` = :color_theme";+ $params['color_theme'] = [+ 'val' => $colorTheme,+ 'type' => SQLITE3_TEXT+ ];+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid parameter',+ 'message' => "Parameter 'color_theme' must be one of: " . implode(', ', $allowedThemes) . "."+ ]);+ exit;+ }+}++// Perform update if fields were specified+if (!empty($updateFields)) {+ $sqlUpdate = "UPDATE settings SET " . implode(', ', $updateFields) . " WHERE user_id = :userId";+ $stmtUpdate = $db->prepare($sqlUpdate);+ $stmtUpdate->bindValue(':userId', $userId, SQLITE3_INTEGER);+ foreach ($params as $paramKey => $paramData) {+ $stmtUpdate->bindValue(':' . $paramKey, $paramData['val'], $paramData['type']);+ }+ $resultUpdate = $stmtUpdate->execute();++ if (!$resultUpdate) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to save settings to the database.'+ ]);+ exit;+ }+}++echo json_encode([+ 'success' => true,+ 'title' => 'Settings updated',+ 'message' => 'User settings have been saved successfully.'+]);++$db->close();+?>diff --git a/api/subscriptions/get_ical_feed.php b/api/subscriptions/get_ical_feed.phpindex 5e4c88f..ca1a113 100644--- a/api/subscriptions/get_ical_feed.php+++ b/api/subscriptions/get_ical_feed.php@@ -9,6 +9,7 @@ It returns a downloadable VCAL file with the active subscriptions*/require_once '../../includes/connect_endpoint.php';+require_once '../../includes/ical_helper.php';header('Content-Type: application/json; charset=UTF-8');@@ -173,12 +174,16 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET$subscription['price'] = number_format($subscription['price'], 2);$uid = 'wallos-subscription-' . $subscription['id'] . '@wallos';- $summary = html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8');- $description = "Price: {$subscription['currency']}{$subscription['price']}\\nCategory: {$subscription['category']}\\nPayment Method: {$subscription['payment_method']}\\nPayer: {$subscription['payer_user']}\\nNotes: {$subscription['notes']}";+ $summary = icalEscape(html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8'));+ $notes = icalEscape(html_entity_decode($subscription['notes'], ENT_QUOTES, 'UTF-8'));+ $category = icalEscape($subscription['category']);+ $paymentMethod = icalEscape($subscription['payment_method']);+ $payer = icalEscape($subscription['payer_user']);+ $description = "Price: {$subscription['currency']}{$subscription['price']}\\nCategory: {$category}\\nPayment Method: {$paymentMethod}\\nPayer: {$payer}\\nNotes: {$notes}";$dtstamp = gmdate('Ymd\THis\Z');$dtstart = (new DateTime($subscription['next_payment']))->format('Ymd');$dtend = (new DateTime($subscription['next_payment']))->format('Ymd');- $location = isset($subscription['url']) ? $subscription['url'] : '';+ $location = icalEscape(isset($subscription['url']) ? $subscription['url'] : '');$alarm_trigger = '-P' . $subscription['trigger'] . 'D';$icsContent .= <<<ICSdiff --git a/api/subscriptions/get_subscription.php b/api/subscriptions/get_subscription.phpnew file mode 100644index 0000000..66e268c--- /dev/null+++ b/api/subscriptions/get_subscription.php@@ -0,0 +1,169 @@+<?php+/*+This API Endpoint accepts both POST and GET requests.+It receives the following parameters:+- api_key: the API key of the user (string, required).+- id / subscription_id: the ID of the subscription to retrieve (integer, required).+- convert_currency: whether to convert the price to the user's main currency (boolean, default false).++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- subscription: an object containing the subscription details.+- notes: warning messages or additional information (array).++Example response:+{+ "success": true,+ "title": "subscription",+ "subscription": {+ "id": 1,+ "name": "Netflix",+ "logo": "1719827361-payments-netflix.png",+ "price": 15.99,+ "currency_id": 1,+ "start_date": "2026-01-01",+ "next_payment": "2026-08-01",+ "cycle": 3,+ "frequency": 1,+ "auto_renew": 1,+ "notes": "Premium plan",+ "payment_method_id": 2,+ "payer_user_id": 1,+ "category_id": 3,+ "notify": 1,+ "url": "https://netflix.com",+ "inactive": 0,+ "notify_days_before": 2,+ "user_id": 1,+ "cancelation_date": null,+ "cancellation_date": "",+ "category_name": "Entertainment",+ "payer_user_name": "John Doe",+ "payment_method_name": "PayPal"+ },+ "notes": []+}+*/++require_once '../../includes/connect_endpoint.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER["REQUEST_METHOD"] === "POST" || $_SERVER["REQUEST_METHOD"] === "GET") {+ $apiKey = $_REQUEST['api_key'] ?? $_REQUEST['apiKey'] ?? null;+ $subscriptionId = $_REQUEST['id'] ?? $_REQUEST['subscription_id'] ?? $_REQUEST['subscriptionId'] ?? null;++ if (!$apiKey || !$subscriptionId) {+ echo json_encode([+ "success" => false,+ "title" => "Missing parameters",+ "message" => "Both API key and subscription ID are required."+ ]);+ exit;+ }++ $subscriptionId = intval($subscriptionId);++ // Authenticate user+ $sql = "SELECT * FROM user WHERE api_key = :apiKey";+ $stmt = $db->prepare($sql);+ $stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+ $result = $stmt->execute();+ $user = $result->fetchArray(SQLITE3_ASSOC);++ if (!$user) {+ echo json_encode([+ "success" => false,+ "title" => "Invalid API key",+ "message" => "Unauthorized access."+ ]);+ exit;+ }++ $userId = $user['id'];+ $userCurrencyId = $user['main_currency'];++ // Retrieve subscription and check ownership+ $subSql = "SELECT * FROM subscriptions WHERE id = :subscriptionId AND user_id = :userId";+ $subStmt = $db->prepare($subSql);+ $subStmt->bindValue(':subscriptionId', $subscriptionId, SQLITE3_INTEGER);+ $subStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $subResult = $subStmt->execute();+ $subscription = $subResult->fetchArray(SQLITE3_ASSOC);++ if (!$subscription) {+ echo json_encode([+ "success" => false,+ "title" => "Subscription not found",+ "message" => "Subscription not found or does not belong to you."+ ]);+ exit;+ }++ // Resolve Category Name+ $catSql = "SELECT name FROM categories WHERE id = :categoryId AND user_id = :userId";+ $catStmt = $db->prepare($catSql);+ $catStmt->bindValue(':categoryId', $subscription['category_id'], SQLITE3_INTEGER);+ $catStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $catResult = $catStmt->execute();+ $categoryRow = $catResult->fetchArray(SQLITE3_ASSOC);+ $subscription['category_name'] = $categoryRow ? $categoryRow['name'] : 'No category';++ // Resolve Payer Name+ $payerSql = "SELECT name FROM household WHERE id = :payerId AND user_id = :userId";+ $payerStmt = $db->prepare($payerSql);+ $payerStmt->bindValue(':payerId', $subscription['payer_user_id'], SQLITE3_INTEGER);+ $payerStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $payerResult = $payerStmt->execute();+ $payerRow = $payerResult->fetchArray(SQLITE3_ASSOC);+ $subscription['payer_user_name'] = $payerRow ? $payerRow['name'] : 'Unknown member';++ // Resolve Payment Method Name+ $pmSql = "SELECT name FROM payment_methods WHERE id = :pmId AND (user_id = :userId OR user_id = 0 OR user_id IS NULL)";+ $pmStmt = $db->prepare($pmSql);+ $pmStmt->bindValue(':pmId', $subscription['payment_method_id'], SQLITE3_INTEGER);+ $pmStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $pmResult = $pmStmt->execute();+ $pmRow = $pmResult->fetchArray(SQLITE3_ASSOC);+ $subscription['payment_method_name'] = $pmRow ? $pmRow['name'] : 'Unknown payment method';++ // Optional Currency Conversion+ if (isset($_REQUEST['convert_currency']) && $_REQUEST['convert_currency'] === 'true' && $subscription['currency_id'] != $userCurrencyId) {+ $updateSql = "SELECT * FROM last_exchange_update WHERE user_id = :userId";+ $updateStmt = $db->prepare($updateSql);+ $updateStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $updateResult = $updateStmt->execute();+ $lastExchangeUpdate = $updateResult->fetchArray(SQLITE3_ASSOC);+ $canConvertCurrency = !empty($lastExchangeUpdate['date']);++ if ($canConvertCurrency) {+ $currSql = "SELECT rate FROM currencies WHERE id = :currencyId AND user_id = :userId";+ $currStmt = $db->prepare($currSql);+ $currStmt->bindValue(':currencyId', $subscription['currency_id'], SQLITE3_INTEGER);+ $currStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $currResult = $currStmt->execute();+ $subCurrency = $currResult->fetchArray(SQLITE3_ASSOC);++ if ($subCurrency) {+ $subscription['price'] = $subscription['price'] / $subCurrency['rate'];+ }+ }+ }++ echo json_encode([+ "success" => true,+ "title" => "subscription",+ "subscription" => $subscription,+ "notes" => []+ ]);++ $db->close();+} else {+ echo json_encode([+ "success" => false,+ "title" => "Invalid request method",+ "message" => "Only GET and POST requests are supported."+ ]);+}+?>diff --git a/api/subscriptions/set_subscriptions.php b/api/subscriptions/set_subscriptions.phpnew file mode 100644index 0000000..26ae205--- /dev/null+++ b/api/subscriptions/set_subscriptions.php@@ -0,0 +1,918 @@+<?php+/*+This API Endpoint accepts POST requests only.+It receives the following parameters:+- api_key: the API key of the user (for Wallos authentication).+- action: the action to perform ('add', 'edit', 'delete').+- id / subscription_id: (required for 'edit' and 'delete') the ID of the subscription.++For 'add' and 'edit' actions (all optional for 'edit'):+- name: the name of the subscription.+- price: the price of the subscription (float).+- currency_id: the currency ID of the subscription (integer).+- frequency: the payment frequency (integer).+- cycle: the payment cycle (integer: 1-days, 2-weeks, 3-months, 4-years).+- next_payment: the next payment date (YYYY-MM-DD).+- start_date: the start date of the subscription (YYYY-MM-DD).+- auto_renew: whether the subscription auto renews (1 or 0, default 1).+- payment_method_id: the payment method ID (integer).+- payer_user_id: the household member payer ID (integer).+- category_id: the category ID (integer).+- notes: subscription notes (string).+- url: subscription URL (string).+- logo_url: an image URL to download as the logo (string).+- logo: direct image file upload for the logo.+- notify / notifications: whether to send payment notifications (1 or 0).+- notify_days_before: how many days before to send notification (integer).+- inactive: whether the subscription is inactive (1 or 0).+- cancellation_date: the cancellation date (YYYY-MM-DD).+- replacement_subscription_id: the ID of the replacement subscription (integer).++It returns a JSON object with the following properties:+- success: whether the request was successful (boolean).+- title: the title of the response (string).+- message: detailed information or error message (string).+- subscriptionId: (only for successful 'add' action) the ID of the newly created subscription (integer).++Example response:+{+ "success": true,+ "title": "Subscription added",+ "subscriptionId": 55,+ "message": "Subscription added successfully."+}+*/++error_reporting(E_ERROR | E_PARSE);+require_once '../../includes/connect_endpoint.php';+require_once '../../includes/inputvalidation.php';+require_once '../../includes/ssrf_helper.php';++header('Content-Type: application/json; charset=UTF-8');++if ($_SERVER['REQUEST_METHOD'] !== 'POST') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid request method',+ 'message' => 'Only POST requests are allowed.'+ ]);+ exit;+}++$apiKey = $_POST['api_key'] ?? $_POST['apiKey'] ?? null;++// Authenticate user first+if (!$apiKey) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing API key',+ 'message' => 'API key is required.'+ ]);+ exit;+}++$sql = "SELECT * FROM user WHERE api_key = :apiKey";+$stmt = $db->prepare($sql);+$stmt->bindValue(':apiKey', $apiKey, SQLITE3_TEXT);+$result = $stmt->execute();+$user = $result->fetchArray(SQLITE3_ASSOC);++if (!$user) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Unauthorized',+ 'message' => 'Invalid API key.'+ ]);+ exit;+}++$userId = $user['id'];+$action = $_POST['action'] ?? null;++if (!$action || !in_array($action, ['add', 'edit', 'delete'], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid action',+ 'message' => 'Action must be "add", "edit", or "delete".'+ ]);+ exit;+}++// Load user settings now that user is authenticated+require_once '../../includes/getsettings.php';++if (!file_exists('../../images/uploads/logos')) {+ mkdir('../../images/uploads/logos', 0777, true);+ mkdir('../../images/uploads/logos/avatars', 0777, true);+}++// Image Helper Functions+function sanitizeFilename($filename)+{+ $filename = preg_replace("/[^a-zA-Z0-9\s]/", "", $filename);+ $filename = str_replace(" ", "-", $filename);+ $filename = str_replace(".", "", $filename);+ return $filename;+}++function validateFileExtension($fileExtension)+{+ $allowedExtensions = ['png', 'jpg', 'jpeg', 'gif', 'webp'];+ return in_array($fileExtension, $allowedExtensions);+}++function getLogoFromUrl($url, $uploadDir, $name, $settings)+{+ $maxRedirects = 3;+ $currentUrl = $url;++ for ($i = 0; $i <= $maxRedirects; $i++) {+ if (!filter_var($currentUrl, FILTER_VALIDATE_URL) || !preg_match('/^https?:\/\//i', $currentUrl)) {+ return ['success' => false, 'message' => 'Invalid URL format.'];+ }++ $parts = parse_url($currentUrl);+ $host = $parts['host'];+ $port = $parts['port'] ?? ($parts['scheme'] === 'https' ? 443 : 80);+ $ip = gethostbyname($host);++ if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false+ || is_cgnat_ip($ip)) {+ return ['success' => false, 'message' => 'Invalid IP Address.'];+ }++ $ch = curl_init($currentUrl);+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);+ curl_setopt($ch, CURLOPT_TIMEOUT, 5);+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);+ curl_setopt($ch, CURLOPT_RESOLVE, ["$host:$port:$ip"]);++ $imageData = curl_exec($ch);+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);++ if ($httpCode >= 300 && $httpCode < 400) {+ $redirectUrl = curl_getinfo($ch, CURLINFO_REDIRECT_URL);+ unset($ch);+ if (!$redirectUrl) {+ break;+ }+ $currentUrl = $redirectUrl;+ continue;+ }++ if ($imageData !== false && $httpCode === 200) {+ $timestamp = time();+ $fileName = $timestamp . '-' . sanitizeFilename($name) . '.png';+ $uploadFile = $uploadDir . $fileName;++ if (saveLogo($imageData, $uploadFile, $name, $settings)) {+ unset($ch);+ return ['success' => true, 'filename' => $fileName];+ }+ }++ unset($ch);+ break;+ }++ return ['success' => false, 'message' => 'Failed to fetch image.'];+}++function saveLogo($imageData, $uploadFile, $name, $settings)+{+ $image = imagecreatefromstring($imageData);+ $removeBackground = isset($settings['removeBackground']) && $settings['removeBackground'] === 'true';++ if ($image !== false) {+ $tempFile = tempnam(sys_get_temp_dir(), 'logo');+ imagealphablending($image, false);+ imagesavealpha($image, true);+ imagepng($image, $tempFile);+ imagedestroy($image);++ if (extension_loaded('imagick')) {+ $imagick = new Imagick($tempFile);++ if ($removeBackground) {+ $imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_ACTIVATE);+ $pixel = $imagick->getImagePixelColor(0, 0);+ $color = $pixel->getColor();+ if ($color['a'] > 0) {+ $bgColor = "rgb({$color['r']},{$color['g']},{$color['b']})";+ $fuzz = Imagick::getQuantum() * 0.1;+ $imagick->transparentPaintImage($bgColor, 0, $fuzz, false);+ }+ }++ $imagick->trimImage(0);+ $imagick->setImagePage(0, 0, 0, 0);+ $imagick->borderImage(new ImagickPixel('transparent'), 2, 2);+ $imagick->setImageFormat('png');+ $imagick->writeImage($uploadFile);+ $imagick->clear();+ $imagick->destroy();+ } else {+ $newImage = imagecreatefrompng($tempFile);+ if ($newImage !== false) {+ imagealphablending($newImage, false);+ imagesavealpha($newImage, true);++ if ($removeBackground) {+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ if (!imageistruecolor($newImage)) {+ imagepalettetotruecolor($newImage);+ imagealphablending($newImage, false);+ imagesavealpha($newImage, true);+ }+ $corner = imagecolorat($newImage, 0, 0);+ if ((($corner >> 24) & 0x7F) !== 127) {+ gdRemoveBackgroundColor($newImage, ($corner >> 16) & 0xFF, ($corner >> 8) & 0xFF, $corner & 0xFF);+ }+ }++ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $newImage = gdCropTransparent($newImage, 2);+ imagepng($newImage, $uploadFile);+ imagedestroy($newImage);+ } else {+ unlink($tempFile);+ return false;+ }+ }++ unlink($tempFile);+ return true;+ }+ return false;+}++function resizeAndUploadLogo($uploadedFile, $uploadDir, $name, $settings)+{+ $targetWidth = 135;+ $targetHeight = 42;++ $timestamp = time();+ $originalFileName = $uploadedFile['name'];+ $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);+ $fileExtension = validateFileExtension($fileExtension) ? $fileExtension : 'png';+ $fileName = $timestamp . '-' . sanitizeFilename($name) . '.' . $fileExtension;+ $uploadFile = $uploadDir . $fileName;++ if (move_uploaded_file($uploadedFile['tmp_name'], $uploadFile)) {+ $fileInfo = getimagesize($uploadFile);++ if ($fileInfo !== false) {+ $width = $fileInfo[0];+ $height = $fileInfo[1];++ if ($fileExtension === 'png') {+ $image = imagecreatefrompng($uploadFile);+ } elseif ($fileExtension === 'jpg' || $fileExtension === 'jpeg') {+ $image = imagecreatefromjpeg($uploadFile);+ } elseif ($fileExtension === 'gif') {+ $image = imagecreatefromgif($uploadFile);+ } elseif ($fileExtension === 'webp') {+ $image = imagecreatefromwebp($uploadFile);+ } else {+ return "";+ }++ if ($fileExtension === 'png') {+ imagesavealpha($image, true);+ }++ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $image = gdCropTransparent($image, 2);+ $width = imagesx($image);+ $height = imagesy($image);++ $newWidth = $width;+ $newHeight = $height;++ if ($width > $targetWidth) {+ $newWidth = (int) $targetWidth;+ $newHeight = (int) (($targetWidth / $width) * $height);+ }++ if ($newHeight > $targetHeight) {+ $newWidth = (int) (($targetHeight / $newHeight) * $newWidth);+ $newHeight = (int) $targetHeight;+ }++ $resizedImage = imagecreatetruecolor($newWidth, $newHeight);+ imagesavealpha($resizedImage, true);+ $transparency = imagecolorallocatealpha($resizedImage, 0, 0, 0, 127);+ imagefill($resizedImage, 0, 0, $transparency);+ imagecopyresampled($resizedImage, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);++ if ($fileExtension === 'png') {+ imagepng($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'jpg' || $fileExtension === 'jpeg') {+ imagejpeg($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'gif') {+ imagegif($resizedImage, $uploadFile);+ } elseif ($fileExtension === 'webp') {+ imagewebp($resizedImage, $uploadFile);+ } else {+ return "";+ }++ imagedestroy($image);+ imagedestroy($resizedImage);+ return $fileName;+ }+ }+ return "";+}++function validateDate($date, $format = 'Y-m-d') {+ $d = DateTime::createFromFormat($format, $date);+ return $d && $d->format($format) === $date;+}++switch ($action) {+ case 'add':+ $name = $_POST['name'] ?? null;+ $price = $_POST['price'] ?? null;+ $currencyId = $_POST['currency_id'] ?? null;+ $frequency = $_POST['frequency'] ?? null;+ $cycle = $_POST['cycle'] ?? null;+ $nextPayment = $_POST['next_payment'] ?? null;+ $startDate = $_POST['start_date'] ?? date('Y-m-d');++ $autoRenew = $_POST['auto_renew'] ?? '1';+ $autoRenew = ($autoRenew === '0' || $autoRenew === 0) ? 0 : 1;++ $paymentMethodId = $_POST['payment_method_id'] ?? null;+ $payerUserId = $_POST['payer_user_id'] ?? null;+ $categoryId = $_POST['category_id'] ?? null;++ $notes = isset($_POST['notes']) ? validate($_POST['notes']) : '';+ $url = isset($_POST['url']) ? validate($_POST['url']) : '';++ $notify = $_POST['notify'] ?? $_POST['notifications'] ?? '0';+ $notify = ($notify === '1' || $notify === 1) ? 1 : 0;+ $notifyDaysBefore = isset($_POST['notify_days_before']) ? ($_POST['notify_days_before'] === '' ? null : intval($_POST['notify_days_before'])) : null;++ $inactive = $_POST['inactive'] ?? '0';+ $inactive = ($inactive === '1' || $inactive === 1) ? 1 : 0;++ $cancellationDate = $_POST['cancellation_date'] ?? null;+ if ($cancellationDate === '') {+ $cancellationDate = null;+ }++ $replacementSubscriptionId = $_POST['replacement_subscription_id'] ?? null;+ if ($replacementSubscriptionId === '0' || $replacementSubscriptionId === 0 || $replacementSubscriptionId === '' || $inactive === 0) {+ $replacementSubscriptionId = null;+ }++ // Validate required fields+ if (!$name || trim($name) === '' || $price === null || !$currencyId || !$frequency || !$cycle || !$nextPayment) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameters',+ 'message' => 'Parameters "name", "price", "currency_id", "frequency", "cycle", and "next_payment" are required.'+ ]);+ exit;+ }++ $name = validate($name);+ $price = floatval($price);+ $currencyId = intval($currencyId);+ $frequency = intval($frequency);+ $cycle = intval($cycle);++ if (!in_array($cycle, [1, 2, 3, 4], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid parameter',+ 'message' => 'Parameter "cycle" must be 1 (Days), 2 (Weeks), 3 (Months), or 4 (Years).'+ ]);+ exit;+ }++ // Validate Dates+ if (!validateDate($nextPayment)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "next_payment" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }+ if ($startDate && !validateDate($startDate)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "start_date" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }+ if ($cancellationDate && !validateDate($cancellationDate)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "cancellation_date" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }++ // Validate Foreign Keys+ // Currency+ $currStmt = $db->prepare("SELECT id FROM currencies WHERE id = :id AND user_id = :userId");+ $currStmt->bindValue(':id', $currencyId, SQLITE3_INTEGER);+ $currStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $currRes = $currStmt->execute()->fetchArray();+ if (!$currRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid currency ID',+ 'message' => 'The specified currency does not exist or does not belong to you.'+ ]);+ exit;+ }++ // Category+ if ($categoryId !== null) {+ $categoryId = intval($categoryId);+ $catStmt = $db->prepare("SELECT id FROM categories WHERE id = :id AND user_id = :userId");+ $catStmt->bindValue(':id', $categoryId, SQLITE3_INTEGER);+ $catStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $catRes = $catStmt->execute()->fetchArray();+ if (!$catRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid category ID',+ 'message' => 'The specified category does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Payer user+ if ($payerUserId !== null) {+ $payerUserId = intval($payerUserId);+ $payerStmt = $db->prepare("SELECT id FROM household WHERE id = :id AND user_id = :userId");+ $payerStmt->bindValue(':id', $payerUserId, SQLITE3_INTEGER);+ $payerStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $payerRes = $payerStmt->execute()->fetchArray();+ if (!$payerRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid payer ID',+ 'message' => 'The specified household member does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Payment Method+ if ($paymentMethodId !== null) {+ $paymentMethodId = intval($paymentMethodId);+ $pmStmt = $db->prepare("SELECT id FROM payment_methods WHERE id = :id AND (user_id = :userId OR user_id = 0 OR user_id IS NULL)");+ $pmStmt->bindValue(':id', $paymentMethodId, SQLITE3_INTEGER);+ $pmStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $pmRes = $pmStmt->execute()->fetchArray();+ if (!$pmRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid payment method ID',+ 'message' => 'The specified payment method does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Replacement Subscription+ if ($replacementSubscriptionId !== null) {+ $replacementSubscriptionId = intval($replacementSubscriptionId);+ $repStmt = $db->prepare("SELECT id FROM subscriptions WHERE id = :id AND user_id = :userId");+ $repStmt->bindValue(':id', $replacementSubscriptionId, SQLITE3_INTEGER);+ $repStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $repRes = $repStmt->execute()->fetchArray();+ if (!$repRes) {+ $replacementSubscriptionId = null;+ }+ }++ // Process Logo+ $logo = '';+ $logoUrl = $_POST['logo_url'] ?? $_POST['logo-url'] ?? '';+ if ($logoUrl !== "") {+ $resLogo = getLogoFromUrl($logoUrl, '../../images/uploads/logos/', $name, $settings);+ if ($resLogo['success']) {+ $logo = $resLogo['filename'];+ }+ } elseif (!empty($_FILES['logo']['name'])) {+ $fileType = mime_content_type($_FILES['logo']['tmp_name']);+ if (strpos($fileType, 'image') !== false) {+ $logo = resizeAndUploadLogo($_FILES['logo'], '../../images/uploads/logos/', $name, $settings);+ }+ }++ // Insert+ $sqlInsert = "INSERT INTO subscriptions (+ name, logo, price, currency_id, next_payment, cycle, frequency, notes,+ payment_method_id, payer_user_id, category_id, notify, inactive, url,+ notify_days_before, user_id, cancellation_date, replacement_subscription_id,+ auto_renew, start_date+ ) VALUES (+ :name, :logo, :price, :currencyId, :nextPayment, :cycle, :frequency, :notes,+ :paymentMethodId, :payerUserId, :categoryId, :notify, :inactive, :url,+ :notifyDaysBefore, :userId, :cancellationDate, :replacement_subscription_id,+ :autoRenew, :startDate+ )";+ $stmtInsert = $db->prepare($sqlInsert);+ $stmtInsert->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtInsert->bindParam(':logo', $logo, SQLITE3_TEXT);+ $stmtInsert->bindParam(':price', $price, SQLITE3_FLOAT);+ $stmtInsert->bindParam(':currencyId', $currencyId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':nextPayment', $nextPayment, SQLITE3_TEXT);+ $stmtInsert->bindParam(':cycle', $cycle, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':frequency', $frequency, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':notes', $notes, SQLITE3_TEXT);+ $stmtInsert->bindParam(':paymentMethodId', $paymentMethodId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':payerUserId', $payerUserId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':notify', $notify, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':inactive', $inactive, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':url', $url, SQLITE3_TEXT);+ $stmtInsert->bindParam(':notifyDaysBefore', $notifyDaysBefore, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':cancellationDate', $cancellationDate, SQLITE3_TEXT);+ $stmtInsert->bindParam(':replacement_subscription_id', $replacementSubscriptionId, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':autoRenew', $autoRenew, SQLITE3_INTEGER);+ $stmtInsert->bindParam(':startDate', $startDate, SQLITE3_TEXT);++ if ($stmtInsert->execute()) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Subscription added',+ 'subscriptionId' => $db->lastInsertRowID(),+ 'message' => 'Subscription added successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to add subscription: ' . $db->lastErrorMsg()+ ]);+ }+ break;++ case 'edit':+ $subscriptionId = $_POST['subscriptionId'] ?? $_POST['id'] ?? $_POST['subscription_id'] ?? null;+ if (!$subscriptionId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "subscriptionId") is required.'+ ]);+ exit;+ }+ $subscriptionId = intval($subscriptionId);++ // Fetch current subscription+ $subSql = "SELECT * FROM subscriptions WHERE id = :subId AND user_id = :userId";+ $subStmt = $db->prepare($subSql);+ $subStmt->bindValue(':subId', $subscriptionId, SQLITE3_INTEGER);+ $subStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $subResult = $subStmt->execute();+ $subscription = $subResult->fetchArray(SQLITE3_ASSOC);++ if (!$subscription) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Subscription not found',+ 'message' => 'Subscription not found or does not belong to you.'+ ]);+ exit;+ }++ // Merge existing values with incoming POST parameters+ $name = isset($_POST['name']) ? validate($_POST['name']) : $subscription['name'];+ $price = isset($_POST['price']) ? floatval($_POST['price']) : $subscription['price'];+ $currencyId = isset($_POST['currency_id']) ? intval($_POST['currency_id']) : $subscription['currency_id'];+ $frequency = isset($_POST['frequency']) ? intval($_POST['frequency']) : $subscription['frequency'];+ $cycle = isset($_POST['cycle']) ? intval($_POST['cycle']) : $subscription['cycle'];+ $nextPayment = isset($_POST['next_payment']) ? $_POST['next_payment'] : $subscription['next_payment'];++ $autoRenew = $subscription['auto_renew'];+ if (isset($_POST['auto_renew'])) {+ $autoRenew = ($_POST['auto_renew'] === '0' || $_POST['auto_renew'] === 0) ? 0 : 1;+ }++ $startDate = isset($_POST['start_date']) ? $_POST['start_date'] : $subscription['start_date'];++ $paymentMethodId = $subscription['payment_method_id'];+ if (isset($_POST['payment_method_id'])) {+ $paymentMethodId = $_POST['payment_method_id'] === '' ? null : intval($_POST['payment_method_id']);+ }++ $payerUserId = $subscription['payer_user_id'];+ if (isset($_POST['payer_user_id'])) {+ $payerUserId = $_POST['payer_user_id'] === '' ? null : intval($_POST['payer_user_id']);+ }++ $categoryId = $subscription['category_id'];+ if (isset($_POST['category_id'])) {+ $categoryId = $_POST['category_id'] === '' ? null : intval($_POST['category_id']);+ }++ $notes = isset($_POST['notes']) ? validate($_POST['notes']) : $subscription['notes'];+ $url = isset($_POST['url']) ? validate($_POST['url']) : $subscription['url'];++ $notify = $subscription['notify'];+ if (isset($_POST['notify']) || isset($_POST['notifications'])) {+ $valNotify = $_POST['notify'] ?? $_POST['notifications'];+ $notify = ($valNotify === '1' || $valNotify === 1) ? 1 : 0;+ }++ $notifyDaysBefore = $subscription['notify_days_before'];+ if (isset($_POST['notify_days_before'])) {+ $notifyDaysBefore = $_POST['notify_days_before'] === '' ? null : intval($_POST['notify_days_before']);+ }++ $inactive = $subscription['inactive'];+ if (isset($_POST['inactive'])) {+ $inactive = ($_POST['inactive'] === '1' || $_POST['inactive'] === 1) ? 1 : 0;+ }++ $cancellationDate = $subscription['cancellation_date'];+ if (isset($_POST['cancellation_date'])) {+ $cancellationDate = $_POST['cancellation_date'] === '' ? null : $_POST['cancellation_date'];+ }++ $replacementSubscriptionId = $subscription['replacement_subscription_id'];+ if (isset($_POST['replacement_subscription_id'])) {+ $replacementSubscriptionId = ($_POST['replacement_subscription_id'] === '' || $_POST['replacement_subscription_id'] === '0' || $_POST['replacement_subscription_id'] === 0) ? null : intval($_POST['replacement_subscription_id']);+ }++ if ($replacementSubscriptionId == 0 || $inactive == 0) {+ $replacementSubscriptionId = null;+ }++ // Validate values+ if (trim($name) === '') {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid name',+ 'message' => 'Subscription name cannot be empty.'+ ]);+ exit;+ }++ if (!in_array($cycle, [1, 2, 3, 4], true)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid cycle',+ 'message' => 'Parameter "cycle" must be 1 (Days), 2 (Weeks), 3 (Months), or 4 (Years).'+ ]);+ exit;+ }++ // Validate Dates+ if (!validateDate($nextPayment)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "next_payment" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }+ if ($startDate && !validateDate($startDate)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "start_date" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }+ if ($cancellationDate && !validateDate($cancellationDate)) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid date',+ 'message' => 'Parameter "cancellation_date" must be a valid date in YYYY-MM-DD format.'+ ]);+ exit;+ }++ // Validate Foreign Keys+ // Currency+ $currStmt = $db->prepare("SELECT id FROM currencies WHERE id = :id AND user_id = :userId");+ $currStmt->bindValue(':id', $currencyId, SQLITE3_INTEGER);+ $currStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $currRes = $currStmt->execute()->fetchArray();+ if (!$currRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid currency ID',+ 'message' => 'The specified currency does not exist or does not belong to you.'+ ]);+ exit;+ }++ // Category+ if ($categoryId !== null) {+ $catStmt = $db->prepare("SELECT id FROM categories WHERE id = :id AND user_id = :userId");+ $catStmt->bindValue(':id', $categoryId, SQLITE3_INTEGER);+ $catStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $catRes = $catStmt->execute()->fetchArray();+ if (!$catRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid category ID',+ 'message' => 'The specified category does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Payer+ if ($payerUserId !== null) {+ $payerStmt = $db->prepare("SELECT id FROM household WHERE id = :id AND user_id = :userId");+ $payerStmt->bindValue(':id', $payerUserId, SQLITE3_INTEGER);+ $payerStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $payerRes = $payerStmt->execute()->fetchArray();+ if (!$payerRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid payer ID',+ 'message' => 'The specified household member does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Payment Method+ if ($paymentMethodId !== null) {+ $pmStmt = $db->prepare("SELECT id FROM payment_methods WHERE id = :id AND (user_id = :userId OR user_id = 0 OR user_id IS NULL)");+ $pmStmt->bindValue(':id', $paymentMethodId, SQLITE3_INTEGER);+ $pmStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $pmRes = $pmStmt->execute()->fetchArray();+ if (!$pmRes) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid payment method ID',+ 'message' => 'The specified payment method does not exist or does not belong to you.'+ ]);+ exit;+ }+ }++ // Replacement Subscription+ if ($replacementSubscriptionId !== null) {+ if ($replacementSubscriptionId === $subscriptionId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Invalid replacement ID',+ 'message' => 'A subscription cannot be replaced by itself.'+ ]);+ exit;+ }+ $repStmt = $db->prepare("SELECT id FROM subscriptions WHERE id = :id AND user_id = :userId");+ $repStmt->bindValue(':id', $replacementSubscriptionId, SQLITE3_INTEGER);+ $repStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $repRes = $repStmt->execute()->fetchArray();+ if (!$repRes) {+ $replacementSubscriptionId = null;+ }+ }++ // Process Logo+ $logo = $subscription['logo'];+ $logoUrl = $_POST['logo_url'] ?? $_POST['logo-url'] ?? '';+ if ($logoUrl !== "") {+ $resLogo = getLogoFromUrl($logoUrl, '../../images/uploads/logos/', $name, $settings);+ if ($resLogo['success']) {+ $logo = $resLogo['filename'];+ }+ } elseif (!empty($_FILES['logo']['name'])) {+ $fileType = mime_content_type($_FILES['logo']['tmp_name']);+ if (strpos($fileType, 'image') !== false) {+ $logo = resizeAndUploadLogo($_FILES['logo'], '../../images/uploads/logos/', $name, $settings);+ }+ }++ // Update+ $sqlUpdate = "UPDATE subscriptions SET+ name = :name,+ logo = :logo,+ price = :price,+ currency_id = :currencyId,+ next_payment = :nextPayment,+ auto_renew = :autoRenew,+ start_date = :startDate,+ cycle = :cycle,+ frequency = :frequency,+ notes = :notes,+ payment_method_id = :paymentMethodId,+ payer_user_id = :payerUserId,+ category_id = :categoryId,+ notify = :notify,+ inactive = :inactive,+ url = :url,+ notify_days_before = :notifyDaysBefore,+ cancellation_date = :cancellationDate,+ replacement_subscription_id = :replacement_subscription_id+ WHERE id = :id AND user_id = :userId";++ $stmtUpdate = $db->prepare($sqlUpdate);+ $stmtUpdate->bindParam(':name', $name, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':logo', $logo, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':price', $price, SQLITE3_FLOAT);+ $stmtUpdate->bindParam(':currencyId', $currencyId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':nextPayment', $nextPayment, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':autoRenew', $autoRenew, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':startDate', $startDate, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':cycle', $cycle, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':frequency', $frequency, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':notes', $notes, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':paymentMethodId', $paymentMethodId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':payerUserId', $payerUserId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':notify', $notify, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':inactive', $inactive, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':url', $url, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':notifyDaysBefore', $notifyDaysBefore, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':cancellationDate', $cancellationDate, SQLITE3_TEXT);+ $stmtUpdate->bindParam(':replacement_subscription_id', $replacementSubscriptionId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':id', $subscriptionId, SQLITE3_INTEGER);+ $stmtUpdate->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmtUpdate->execute()) {+ echo json_encode([+ 'success' => true,+ 'title' => 'Subscription updated',+ 'message' => 'Subscription updated successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to update subscription: ' . $db->lastErrorMsg()+ ]);+ }+ break;++ case 'delete':+ $subscriptionId = $_POST['subscriptionId'] ?? $_POST['id'] ?? $_POST['subscription_id'] ?? null;+ if (!$subscriptionId) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Missing parameter',+ 'message' => 'Parameter "id" (or "subscriptionId") is required.'+ ]);+ exit;+ }+ $subscriptionId = intval($subscriptionId);++ // Check ownership+ $checkSql = "SELECT * FROM subscriptions WHERE id = :subId AND user_id = :userId";+ $checkStmt = $db->prepare($checkSql);+ $checkStmt->bindValue(':subId', $subscriptionId, SQLITE3_INTEGER);+ $checkStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $checkResult = $checkStmt->execute();+ $subscription = $checkResult->fetchArray(SQLITE3_ASSOC);++ if (!$subscription) {+ echo json_encode([+ 'success' => false,+ 'title' => 'Subscription not found',+ 'message' => 'Subscription not found or does not belong to you.'+ ]);+ exit;+ }++ // Delete+ $sqlDelete = "DELETE FROM subscriptions WHERE id = :subId AND user_id = :userId";+ $stmtDelete = $db->prepare($sqlDelete);+ $stmtDelete->bindParam(':subId', $subscriptionId, SQLITE3_INTEGER);+ $stmtDelete->bindParam(':userId', $userId, SQLITE3_INTEGER);++ if ($stmtDelete->execute()) {+ // Nullify replacement_subscription_id references pointing to this subscription+ $queryCascade = "UPDATE subscriptions SET replacement_subscription_id = NULL WHERE replacement_subscription_id = :subId AND user_id = :userId";+ $stmtCascade = $db->prepare($queryCascade);+ $stmtCascade->bindParam(':subId', $subscriptionId, SQLITE3_INTEGER);+ $stmtCascade->bindParam(':userId', $userId, SQLITE3_INTEGER);+ $stmtCascade->execute();++ echo json_encode([+ 'success' => true,+ 'title' => 'Subscription deleted',+ 'message' => 'Subscription deleted successfully.'+ ]);+ } else {+ echo json_encode([+ 'success' => false,+ 'title' => 'Database error',+ 'message' => 'Failed to delete subscription.'+ ]);+ }+ break;+}++$db->close();+?>diff --git a/calendar.php b/calendar.phpindex 908ccc5..813c014 100644--- a/calendar.php+++ b/calendar.php@@ -134,12 +134,32 @@ if ($weekStartsSunday) {}?><div class="split-header">- <h2>- <?= translate('calendar', $i18n) ?>- <button class="button export-ical" onClick="showExportPopup()" title="<?= translate('export_icalendar', $i18n) ?>">- <?php require_once 'images/siteicons/svg/export_ical.php'; ?>- </button>- </h2>+ <div class="calendar-title">+ <h2><?= translate('month-' . $calendarMonth, $i18n) ?> <?= $calendarYear ?></h2>+ <div class="calendar-nav">+ <button class="button secondary-button" id="prev"+ onclick="prevMonth(<?= $calendarMonth ?>, <?= $calendarYear ?>)" <?= $sameAsCurrent ? 'disabled' : '' ?>>+ <i class="fa-solid fa-chevron-left"></i>+ </button>+ <button class="button secondary-button" id="next"+ onclick="nextMonth(<?= $calendarMonth ?>, <?= $calendarYear ?>)">+ <i class="fa-solid fa-chevron-right"></i>+ </button>+ <?php+ if (!$sameAsCurrent) {+ ?>+ <button class="button secondary-button" onClick="currentMoth()" title="<?= translate('reset', $i18n) ?>">+ <i class="fa-solid fa-calendar-day"></i>+ </button>+ <?php+ }+ ?>+ </div>+ </div>+ <button class="button secondary-button export-ical" onClick="showExportPopup()"+ title="<?= translate('export_icalendar', $i18n) ?>" aria-label="<?= translate('export_icalendar', $i18n) ?>">+ <?php require_once 'images/siteicons/svg/export_ical.php'; ?>+ </button><div id="subscriptions_calendar" class="subscription-modal"><div class="modal-header"><h3><?= translate('export_icalendar', $i18n) ?></h3>@@ -151,22 +171,6 @@ if ($weekStartsSunday) {<button onclick="copyToClipboard()" class="button tiny"> <?= translate('copy_to_clipboard', $i18n) ?> </button></div></div>-- <div class="calendar-nav">- <?php- if (!$sameAsCurrent) {- ?>- <button class="button secondary-button tiny" onClick="currentMoth()" title="<?= translate('reset', $i18n) ?>"><i- class="fa-solid fa-calendar-day"></i></button>- <button class="button tiny" id="prev" onclick="prevMonth(<?= $calendarMonth ?>, <?= $calendarYear ?>)"><i- class="fa-solid fa-chevron-left"></i></button>- <?php- }- ?>- <span id="month" class="month"><?= translate('month-' . $calendarMonth, $i18n) ?> <?= $calendarYear ?></span>- <button class="button tiny" id="next" onclick="nextMonth(<?= $calendarMonth ?>, <?= $calendarYear ?>)"><i- class="fa-solid fa-chevron-right"></i></button>- </div></div><div><?php@@ -176,17 +180,76 @@ if ($weekStartsSunday) {if ($weekStartsSunday) {$firstDayOfWeek = ($firstDayOfWeek + 1) % 7;}- $dayOfWeek = 0;- $day = 1;- $days = 1;- $week = 1;- $today = date('Y-m-d');- $today = explode('-', $today);- $todayYear = $today[0];- $todayMonth = $today[1];- $todayDay = $today[2];- $today = $todayYear . '-' . $todayMonth . '-' . $todayDay;- $today = strtotime($today);+ $today = strtotime(date('Y-m-d'));+ $todayDay = (int) date('j');+ $todayMonth = date('m');+ $todayYear = date('Y');++ // Project every payment occurrence into this month once, before rendering.+ $monthKey = $calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT);+ $startOfMonth = strtotime($monthKey . '-01');+ $paymentsByDay = [];++ $registerPayment = function ($date, $subscription) use (&$paymentsByDay, &$totalCostThisMonth, &$numberOfSubscriptionsToPayThisMonth, &$amountDueThisMonth, $today, $db, $userId) {+ $paymentsByDay[(int) date('j', $date)][] = $subscription;+ $convertedPrice = getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);+ $totalCostThisMonth += $convertedPrice;+ $numberOfSubscriptionsToPayThisMonth++;+ if ($date >= $today) {+ $amountDueThisMonth += $convertedPrice;+ }+ };++ foreach ($subscriptions as $subscription) {+ $nextPaymentDate = strtotime($subscription['next_payment']);+ $subscriptionStartDate = !empty($subscription['start_date'])+ ? strtotime($subscription['start_date'])+ : $nextPaymentDate;+ $cycle = $subscription['cycle'];+ $frequency = $subscription['frequency'];++ if ($cycle == 5) {+ // One-time purchase: only shown on its exact payment date+ if (date('Y-m', $nextPaymentDate) == $monthKey) {+ $registerPayment($nextPaymentDate, $subscription);+ }+ continue;+ }++ switch ($cycle) {+ case 1: // Days+ $incrementString = "+{$frequency} days";+ break;+ case 2: // Weeks+ $incrementString = "+{$frequency} weeks";+ break;+ case 3: // Months+ $incrementString = "+{$frequency} months";+ break;+ case 4: // Years+ $incrementString = "+{$frequency} years";+ break;+ default:+ $incrementString = "+{$frequency} months";+ }++ $endDate = strtotime("+" . $yearsToLoad . " years", $nextPaymentDate);++ // Find the first payment date of the month by moving backwards+ $startDate = $nextPaymentDate;+ while ($startDate > $startOfMonth) {+ $startDate = strtotime("-" . $incrementString, $startDate);+ }++ for ($date = $startDate; $date <= $endDate; $date = strtotime($incrementString, $date)) {+ if ($date < $subscriptionStartDate) {+ continue;+ }+ if (date('Y-m', $date) == $monthKey) {+ $registerPayment($date, $subscription);+ }+ }+ }?><div class="calendar">@@ -198,202 +261,35 @@ if ($weekStartsSunday) {<div class="calendar-body"><div class="week calendar-row"><?php+ $dayOfWeek = 0;for ($i = 0; $i < $firstDayOfWeek; $i++) {- ?>- <div class="calendar-cell empty">- <div class="calendar-cell-header">- <span class="day"> </span>- </div>- <div class="calendar-cell-content"></div>- </div>- <?php- }- for ($i = $firstDayOfWeek; $i < 7; $i++) {- if ($day <= $daysInMonth) {- $dayClass = ($day == $todayDay && $calendarMonth == $todayMonth && $calendarYear == $todayYear) ? "today" : "";- ?>- <div class="calendar-cell <?= $dayClass ?>">- <div class="calendar-cell-header">- <span class="day"><?= $day ?></span>- </div>- <div class="calendar-cell-content">- <?php- foreach ($subscriptions as $subscription) {- $nextPaymentDate = strtotime($subscription['next_payment']);- $subscriptionStartDate = !empty($subscription['start_date'])- ? strtotime($subscription['start_date'])- : $nextPaymentDate;- $cycle = $subscription['cycle']; // Integer from 1 to 4- $frequency = $subscription['frequency'];-- if ($cycle == 5) {- // One-time purchase: only show on its exact payment date- if (date('Y-m', $nextPaymentDate) == $calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT) && date('d', $nextPaymentDate) == $day) {- ?>- <div class="calendar-subscription-title" onClick="openSubscriptionModal(<?= $subscription['id'] ?>)">- <?= htmlspecialchars($subscription['name']) ?>- </div>- <?php- }- continue;- }-- $endDate = strtotime("+" . $yearsToLoad . " years", $nextPaymentDate);-- // Determine the strtotime increment string based on cycle- switch ($cycle) {- case 1: // Days- $incrementString = "+{$frequency} days";- break;- case 2: // Weeks- $incrementString = "+{$frequency} weeks";- break;- case 3: // Months- $incrementString = "+{$frequency} months";- break;- case 4: // Years- $incrementString = "+{$frequency} years";- break;- default:- $incrementString = "+{$frequency} months";- }-- // Calculate the start of the month- $startOfMonth = strtotime($calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT) . '-01');-- // Find the first payment date of the month by moving backwards- $startDate = $nextPaymentDate;- while ($startDate > $startOfMonth) {- $startDate = strtotime("-" . $incrementString, $startDate);- }-- for ($date = $startDate; $date <= $endDate; $date = strtotime($incrementString, $date)) {- if ($date < $subscriptionStartDate) {- continue;- }- if (date('Y-m', $date) == $calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT)) {- if (date('d', $date) == $day) {- $totalCostThisMonth += getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);- $numberOfSubscriptionsToPayThisMonth++;- if ($date > $today) {- $amountDueThisMonth += getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);- }- ?>- <div class="calendar-subscription-title" onClick="openSubscriptionModal(<?= $subscription['id'] ?>)">- <?= htmlspecialchars($subscription['name']) ?>- </div>- <?php- }- }- }- }- ?>- </div>- </div>- <?php- $day++;- }+ echo '<div class="calendar-cell empty"></div>';+ $dayOfWeek++;}- while ($day <= $daysInMonth) {- if ($dayOfWeek % 7 == 0) {- ?>- </div>- <div class="week calendar-row">- <?php+ for ($day = 1; $day <= $daysInMonth; $day++) {+ if ($dayOfWeek > 0 && $dayOfWeek % 7 == 0) {+ echo '</div><div class="week calendar-row">';}- $dayClass = ($day == $todayDay && $calendarMonth == $todayMonth && $calendarYear == $todayYear) ? "today" : "";+ $isToday = $day == $todayDay && $calendarMonth == $todayMonth && $calendarYear == $todayYear;?>- <div class="calendar-cell <?= $dayClass ?>">- <div class="calendar-cell-header">- <span class="day"><?= $day ?></span>- </div>- <div class="calendar-cell-content">- <?php- foreach ($subscriptions as $subscription) {- $nextPaymentDate = strtotime($subscription['next_payment']);- $subscriptionStartDate = !empty($subscription['start_date'])- ? strtotime($subscription['start_date'])- : $nextPaymentDate;- $cycle = $subscription['cycle']; // Integer from 1 to 4- $frequency = $subscription['frequency'];-- if ($cycle == 5) {- // One-time purchase: only show on its exact payment date- if (date('Y-m', $nextPaymentDate) == $calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT) && date('d', $nextPaymentDate) == $day) {- ?>- <div class="calendar-subscription-title" onClick="openSubscriptionModal(<?= $subscription['id'] ?>)">- <?= htmlspecialchars($subscription['name']) ?>- </div>- <?php- }- continue;- }-- $endDate = strtotime("+" . $yearsToLoad . " years", $nextPaymentDate);-- // Determine the strtotime increment string based on cycle- switch ($cycle) {- case 1: // Days- $incrementString = "+{$frequency} days";- break;- case 2: // Weeks- $incrementString = "+{$frequency} weeks";- break;- case 3: // Months- $incrementString = "+{$frequency} months";- break;- case 4: // Years- $incrementString = "+{$frequency} years";- break;- default:- $incrementString = "+{$frequency} months";- }-- // Calculate the start of the month- $startOfMonth = strtotime($calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT) . '-01');-- // Find the first payment date of the month by moving backwards- $startDate = $nextPaymentDate;- while ($startDate > $startOfMonth) {- $startDate = strtotime("-" . $incrementString, $startDate);- }-- for ($date = $startDate; $date <= $endDate; $date = strtotime($incrementString, $date)) {- if ($date < $subscriptionStartDate) {- continue;- }- if (date('Y-m', $date) == $calendarYear . '-' . str_pad($calendarMonth, 2, '0', STR_PAD_LEFT)) {- if (date('d', $date) == $day) {- $totalCostThisMonth += getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);- $numberOfSubscriptionsToPayThisMonth++;- if ($date > $today) {- $amountDueThisMonth += getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);- }- ?>- <div class="calendar-subscription-title" onClick="openSubscriptionModal(<?= $subscription['id'] ?>)">- <?= htmlspecialchars($subscription['name']) ?>- </div>- <?php- }- }- }- }- ?>- </div>+ <div class="calendar-cell<?= $isToday ? ' today' : '' ?>">+ <span class="day"><?= $day ?></span>+ <?php if (!empty($paymentsByDay[$day])) { ?>+ <div class="calendar-cell-content">+ <?php foreach ($paymentsByDay[$day] as $payment) { ?>+ <div class="calendar-event" onClick="showSubscriptionDetails(event, <?= $payment['id'] ?>)"+ title="<?= htmlspecialchars($payment['name']) ?>">+ <?= htmlspecialchars($payment['name']) ?>+ </div>+ <?php } ?>+ </div>+ <?php } ?></div><?php- $day++;$dayOfWeek++;}- while ($dayOfWeek % 7 != 0) { // Fill the rest of the week with empty cells- ?>- <div class="calendar-cell empty">- <div class="calendar-cell-header">- <span class="day"> </span>- </div>- <div class="calendar-cell-content"></div>- </div>- <?php+ while ($dayOfWeek % 7 != 0) {+ echo '<div class="calendar-cell empty"></div>';$dayOfWeek++;}?>@@ -407,8 +303,8 @@ if ($weekStartsSunday) {$overBudgetAmount = CurrencyFormatter::format($overBudgetAmount, $code);?><div class="over-budget">- <i class="fa-solid fa-exclamation-triangle"></i>- <?= translate('over_budget_warning', $i18n) ?> (<?= $overBudgetAmount ?>)+ <i class="fa-solid fa-triangle-exclamation"></i>+ <span><?= translate('over_budget_warning', $i18n) ?> <strong>(<?= $overBudgetAmount ?>)</strong></span></div><?php}@@ -437,12 +333,7 @@ if ($weekStartsSunday) {</section>-<div id="subscriptionModal" class="subscription-modal">- <div class="modal-content">- <div id="subscriptionModalContent"></div>- </div>-</div>-+<?php require_once 'includes/subscription_details_popup.php'; ?><script src="scripts/calendar.js?<?= $version ?>"></script><?phprequire_once 'includes/footer.php';diff --git a/endpoints/ai/generate_recommendations.php b/endpoints/ai/generate_recommendations.phpindex 87b2b94..5fb3867 100644--- a/endpoints/ai/generate_recommendations.php+++ b/endpoints/ai/generate_recommendations.php@@ -3,6 +3,7 @@ set_time_limit(300);require_once '../../includes/connect_endpoint.php';require_once '../../includes/validate_endpoint.php';require_once '../../includes/ssrf_helper.php';+require_once '../../includes/ai_client.php';function getPricePerMonth($cycle, $frequency, $price){@@ -34,59 +35,13 @@ function describeCurrency($currencyId, $currencies)}// Load AI settings-$stmt = $db->prepare("SELECT * FROM ai_settings WHERE user_id = ?");-$stmt->bindValue(1, $userId, SQLITE3_INTEGER);-$result = $stmt->execute();-$aiSettings = $result->fetchArray(SQLITE3_ASSOC);-$stmt->close();+$aiSettings = ai_load_settings($db, $userId);if (!$aiSettings) {echo json_encode(["success" => false, "message" => translate('error', $i18n)]);exit;}-$type = $aiSettings['type'] ?? '';-$enabled = !empty($aiSettings['enabled']);-$model = $aiSettings['model'] ?? '';-$host = $aiSettings['url'] ?? '';-$apiKey = $aiSettings['api_key'] ?? '';--if (!in_array($type, ['chatgpt', 'gemini', 'openrouter', 'ollama', 'openai-compatible']) || !$enabled || empty($model)) {- echo json_encode(["success" => false, "message" => translate('error', $i18n)]);- exit;-}--$ssrf = null;--// Host-based providers-if (in_array($type, ['ollama', 'openai-compatible'])) {- if (empty($host)) {- echo json_encode(["success" => false, "message" => translate('invalid_host', $i18n)]);- exit;- }-- $parsedUrl = parse_url($host);- if (- !isset($parsedUrl['scheme']) ||- !in_array(strtolower($parsedUrl['scheme']), ['http', 'https']) ||- !filter_var($host, FILTER_VALIDATE_URL)- ) {- echo json_encode(["success" => false, "message" => translate('invalid_host', $i18n)]);- exit;- }-- $ssrf = validate_webhook_url_for_ssrf($host, $db, $i18n, $userId);-- if ($type === 'ollama') {- $apiKey = '';- }-} else {- if (empty($apiKey)) {- echo json_encode(["success" => false, "message" => translate('invalid_api_key', $i18n)]);- exit;- }-}-// Categories$stmt = $db->prepare("SELECT * FROM categories WHERE user_id = :user_id");$stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);@@ -199,111 +154,17 @@ PROMPT;$prompt .= "\n\n" . json_encode($subscriptionsForAI, JSON_PRETTY_PRINT);-// cURL request-$ch = curl_init();--if ($type === 'ollama') {- curl_setopt($ch, CURLOPT_URL, rtrim($host, '/') . '/api/generate');- curl_setopt($ch, CURLOPT_RESOLVE, ["{$ssrf['host']}:{$ssrf['port']}:{$ssrf['ip']}"]);- curl_setopt($ch, CURLOPT_POST, true);- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'model' => $model,- 'prompt' => $prompt,- 'stream' => false,- ]));-} elseif ($type === 'openai-compatible') {- $headers = ['Content-Type: application/json'];- if (!empty($apiKey)) {- $headers[] = 'Authorization: Bearer ' . $apiKey;- }-- curl_setopt($ch, CURLOPT_URL, rtrim($host, '/') . '/chat/completions');- curl_setopt($ch, CURLOPT_POST, true);- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'model' => $model,- 'messages' => [['role' => 'user', 'content' => $prompt]],- ]));- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);+// Run the completion against the configured provider+$aiResult = ai_complete($aiSettings, $prompt, $db, $i18n, $userId);- if ($ssrf) {- curl_setopt($ch, CURLOPT_RESOLVE, ["{$ssrf['host']}:{$ssrf['port']}:{$ssrf['ip']}"]);- }-} else {- $headers = ['Content-Type: application/json'];-- if ($type === 'chatgpt') {- $headers[] = 'Authorization: Bearer ' . $apiKey;- curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/chat/completions');- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'model' => $model,- 'messages' => [['role' => 'user', 'content' => $prompt]],- ]));- } elseif ($type === 'gemini') {- curl_setopt(- $ch,- CURLOPT_URL,- 'https://generativelanguage.googleapis.com/v1beta/models/' .- urlencode($model) . ':generateContent?key=' . urlencode($apiKey)- );- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'contents' => [[- 'parts' => [['text' => $prompt]],- ]],- ]));- } elseif ($type === 'openrouter') {- $headers[] = 'Authorization: Bearer ' . $apiKey;- curl_setopt($ch, CURLOPT_URL, 'https://openrouter.ai/api/v1/chat/completions');- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([- 'model' => $model,- 'messages' => [['role' => 'user', 'content' => $prompt]],- ]));- }-- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);-}--curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);-curl_setopt($ch, CURLOPT_TIMEOUT, 300);--$reply = curl_exec($ch);--if (curl_errno($ch)) {- echo json_encode(["success" => false, "message" => curl_error($ch)]);+if (!$aiResult['success']) {+ echo json_encode($aiResult);exit;}-unset($ch);--// Decode AI reply-$replyData = json_decode($reply, true);-$recommendations = null;--if (in_array($type, ['chatgpt', 'openrouter', 'openai-compatible'])- && isset($replyData['choices'][0]['message']['content'])) {-- $recommendationsJson = $replyData['choices'][0]['message']['content'];- // Strip ```json or ``` fences if present- $recommendationsJson = preg_replace('/^```json\s*|\s*```$/m', '', $recommendationsJson);- $recommendationsJson = preg_replace('/^```\s*|\s*```$/m', '', $recommendationsJson);- $recommendationsJson = trim($recommendationsJson);-- $recommendations = json_decode($recommendationsJson, true);--} elseif ($type === 'gemini'- && isset($replyData['candidates'][0]['content']['parts'][0]['text'])) {-- $recommendationsJson = $replyData['candidates'][0]['content']['parts'][0]['text'];- $recommendationsJson = preg_replace('/^```json\s*|\s*```$/m', '', $recommendationsJson);- $recommendationsJson = preg_replace('/^```\s*|\s*```$/m', '', $recommendationsJson);- $recommendationsJson = trim($recommendationsJson);-- $recommendations = json_decode($recommendationsJson, true);--} elseif ($type === 'ollama') {- $recommendations = json_decode($replyData['response'] ?? '', true);-}+$recommendations = ai_extract_json($aiResult['content']);-if (json_last_error() === JSON_ERROR_NONE && is_array($recommendations)) {+if (is_array($recommendations)) {// Clear old recommendations$stmt = $db->prepare("DELETE FROM ai_recommendations WHERE user_id = :user_id");$stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);diff --git a/endpoints/ai/translate_categories.php b/endpoints/ai/translate_categories.phpnew file mode 100644index 0000000..4e69839--- /dev/null+++ b/endpoints/ai/translate_categories.php@@ -0,0 +1,114 @@+<?php+set_time_limit(300);+require_once '../../includes/connect_endpoint.php';+require_once '../../includes/validate_endpoint.php';+require_once '../../includes/ssrf_helper.php';+require_once '../../includes/ai_client.php';++// Load AI settings+$aiSettings = ai_load_settings($db, $userId);++if (!$aiSettings) {+ echo json_encode(["success" => false, "message" => translate('error', $i18n)]);+ exit;+}++// User language+$stmt = $db->prepare("SELECT language FROM user WHERE id = :user_id");+$stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+$userLanguage = $result->fetchArray(SQLITE3_ASSOC)['language'] ?? 'en';++if ($userLanguage === 'en') {+ echo json_encode(["success" => false, "message" => translate('error', $i18n)]);+ exit;+}++// Language name+require_once '../../includes/i18n/languages.php';+$userLanguageName = $languages[$userLanguage]['name'] ?? 'English';++// Categories (id 1 is the untranslatable "No category" placeholder)+$stmt = $db->prepare("SELECT id, name FROM categories WHERE user_id = :user_id AND id != 1");+$stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();++$categoriesToTranslate = [];+while ($row = $result->fetchArray(SQLITE3_ASSOC)) {+ $categoriesToTranslate[] = ['id' => (int) $row['id'], 'name' => $row['name']];+}++if (empty($categoriesToTranslate)) {+ echo json_encode(["success" => true, "message" => translate('success', $i18n), "translations" => new stdClass()]);+ exit;+}++$prompt = <<<PROMPT+You are a translation assistant.++Translate the following subscription category names into {$userLanguageName}.++Follow these guidelines:+- Keep translations short and natural — these are category labels in a subscription tracker.+- Keep brand names, proper nouns, and abbreviations unchanged.+- If a name is already in {$userLanguageName}, return it unchanged.+- Preserve the capitalization style of each name.++Return the result as a JSON array. Each item in the array must have:+- "id": the category id, unchanged+- "name": the translated category name++Do not include any other text, just the JSON output. Absolutely no additional comments or explanations.++Here are the categories:+PROMPT;++$prompt .= "\n\n" . json_encode($categoriesToTranslate, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);++// Run the completion against the configured provider+$aiResult = ai_complete($aiSettings, $prompt, $db, $i18n, $userId);++if (!$aiResult['success']) {+ echo json_encode($aiResult);+ exit;+}++$translated = ai_extract_json($aiResult['content']);++if (!is_array($translated)) {+ echo json_encode([+ "success" => false,+ "message" => translate('error', $i18n),+ "json_error" => json_last_error_msg(),+ ]);+ exit;+}++$validIds = array_column($categoriesToTranslate, 'id');+$translations = [];++$update = $db->prepare("UPDATE categories SET name = :name WHERE id = :id AND user_id = :user_id");++foreach ($translated as $item) {+ $categoryId = (int) ($item['id'] ?? 0);+ $categoryName = trim($item['name'] ?? '');++ if (!in_array($categoryId, $validIds) || $categoryName === '' || mb_strlen($categoryName) > 100) {+ continue;+ }++ $update->bindValue(':name', $categoryName, SQLITE3_TEXT);+ $update->bindValue(':id', $categoryId, SQLITE3_INTEGER);+ $update->bindValue(':user_id', $userId, SQLITE3_INTEGER);+ $update->execute();+ $update->reset();++ $translations[$categoryId] = $categoryName;+}++echo json_encode([+ "success" => true,+ "message" => translate('success', $i18n),+ "translations" => $translations ?: new stdClass(),+]);+exit;diff --git a/endpoints/cronjobs/sendcancellationnotifications.php b/endpoints/cronjobs/sendcancellationnotifications.phpindex a23512e..9eba9e7 100644--- a/endpoints/cronjobs/sendcancellationnotifications.php+++ b/endpoints/cronjobs/sendcancellationnotifications.php@@ -204,70 +204,75 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {// Email notifications if enabledif ($emailNotificationsEnabled) {+ // Re-validate at send time: a save-time check alone is bypassable via+ // DNS rebinding between when the host was saved and when the cron fires.+ if (!validate_smtp_host($email['smtpAddress'], (int) $email['smtpPort'], $db)) {+ echo "SSRF attempt detected for SMTP host. Email notifications not sent.<br />";+ } else {+ $stmt = $db->prepare('SELECT * FROM user WHERE id = :user_id');+ $stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $defaultUser = $result->fetchArray(SQLITE3_ASSOC);+ $defaultEmail = $defaultUser['email'];+ $defaultName = $defaultUser['username'];- $stmt = $db->prepare('SELECT * FROM user WHERE id = :user_id');- $stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);- $result = $stmt->execute();- $defaultUser = $result->fetchArray(SQLITE3_ASSOC);- $defaultEmail = $defaultUser['email'];- $defaultName = $defaultUser['username'];-- foreach ($notify as $userId => $perUser) {- $message = "The following subscriptions are up for cancellation:\n";+ foreach ($notify as $userId => $perUser) {+ $message = "The following subscriptions are up for cancellation:\n";- foreach ($perUser as $subscription) {- $message .= $subscription['name'] . " for " . $subscription['price'] ."\n";- }+ foreach ($perUser as $subscription) {+ $message .= $subscription['name'] . " for " . $subscription['price'] ."\n";+ }- $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");+ $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");- $mail = new PHPMailer(true);- $mail->CharSet = "UTF-8";- $mail->isSMTP();+ $mail = new PHPMailer(true);+ $mail->CharSet = "UTF-8";+ $mail->isSMTP();- $mail->Host = $email['smtpAddress'];- $mail->SMTPAuth = $smtpAuth;- if ($smtpAuth) {- $mail->Username = $email['smtpUsername'];- $mail->Password = $email['smtpPassword'];- }- if ($email['encryption'] != "none") {- $mail->SMTPSecure = $email['encryption'];- }- $mail->Port = $email['smtpPort'];+ $mail->Host = $email['smtpAddress'];+ $mail->SMTPAuth = $smtpAuth;+ if ($smtpAuth) {+ $mail->Username = $email['smtpUsername'];+ $mail->Password = $email['smtpPassword'];+ }+ if ($email['encryption'] != "none") {+ $mail->SMTPSecure = $email['encryption'];+ }+ $mail->Port = $email['smtpPort'];- $stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');- $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);- $result = $stmt->execute();- $user = $result->fetchArray(SQLITE3_ASSOC);+ $stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $user = $result->fetchArray(SQLITE3_ASSOC);- $emailaddress = !empty($user['email']) ? $user['email'] : $defaultEmail;- $name = !empty($user['name']) ? $user['name'] : $defaultName;+ $emailaddress = !empty($user['email']) ? $user['email'] : $defaultEmail;+ $name = !empty($user['name']) ? $user['name'] : $defaultName;- $mail->setFrom($email['fromEmail'], 'Wallos App');- $mail->addAddress($emailaddress, $name);+ $mail->setFrom($email['fromEmail'], 'Wallos App');+ $mail->addAddress($emailaddress, $name);- if (!empty($email['otherEmails'])) {- $list = explode(';', $email['otherEmails']);+ if (!empty($email['otherEmails'])) {+ $list = explode(';', $email['otherEmails']);- // Avoid duplicate emails- $list = array_unique($list);- $list = array_filter($list, function ($value) use ($emailaddress) {- return $value !== $emailaddress;- });+ // Avoid duplicate emails+ $list = array_unique($list);+ $list = array_filter($list, function ($value) use ($emailaddress) {+ return $value !== $emailaddress;+ });- foreach($list as $value) {- $mail->addCC(trim($value));+ foreach($list as $value) {+ $mail->addCC(trim($value));+ }}- }- $mail->Subject = 'Wallos Cancellation Notification';- $mail->Body = $message;+ $mail->Subject = 'Wallos Cancellation Notification';+ $mail->Body = $message;- if ($mail->send()) {- echo "Email Notifications sent<br />";- } else {- echo "Error sending notifications: " . $mail->ErrorInfo . "<br />";+ if ($mail->send()) {+ echo "Email Notifications sent<br />";+ } else {+ echo "Error sending notifications: " . $mail->ErrorInfo . "<br />";+ }}}}diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.phpindex c9e91eb..f4a9d2f 100644--- a/endpoints/cronjobs/sendnotifications.php+++ b/endpoints/cronjobs/sendnotifications.php@@ -300,77 +300,82 @@ while ($userToNotify = $usersToNotify->fetchArray(SQLITE3_ASSOC)) {// Email notifications if enabledif ($emailNotificationsEnabled) {+ // Re-validate at send time: a save-time check alone is bypassable via+ // DNS rebinding between when the host was saved and when the cron fires.+ if (!validate_smtp_host($email['smtpAddress'], (int) $email['smtpPort'], $db)) {+ echo "SSRF attempt detected for SMTP host. Email notifications not sent.<br />";+ } else {+ $stmt = $db->prepare('SELECT * FROM user WHERE id = :user_id');+ $stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $defaultUser = $result->fetchArray(SQLITE3_ASSOC);+ $defaultEmail = $defaultUser['email'];+ $defaultName = $defaultUser['username'];- $stmt = $db->prepare('SELECT * FROM user WHERE id = :user_id');- $stmt->bindValue(':user_id', $userId, SQLITE3_INTEGER);- $result = $stmt->execute();- $defaultUser = $result->fetchArray(SQLITE3_ASSOC);- $defaultEmail = $defaultUser['email'];- $defaultName = $defaultUser['username'];-- foreach ($notify as $userId => $perUser) {- $message = "The following subscriptions are up for renewal:\n";+ foreach ($notify as $userId => $perUser) {+ $message = "The following subscriptions are up for renewal:\n";- foreach ($perUser as $subscription) {- $dayText = getDaysText($subscription['days']);- $message .= $subscription['name'] . " for " . $subscription['formatted_price'] . " (" . $dayText . ")\n";- }+ foreach ($perUser as $subscription) {+ $dayText = getDaysText($subscription['days']);+ $message .= $subscription['name'] . " for " . $subscription['formatted_price'] . " (" . $dayText . ")\n";+ }- $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");+ $smtpAuth = (isset($email["smtpUsername"]) && $email["smtpUsername"] != "") || (isset($email["smtpPassword"]) && $email["smtpPassword"] != "");- $mail = new PHPMailer(true);- $mail->CharSet = "UTF-8";- $mail->isSMTP();+ $mail = new PHPMailer(true);+ $mail->CharSet = "UTF-8";+ $mail->isSMTP();- $mail->Host = $email['smtpAddress'];- $mail->SMTPAuth = $smtpAuth;+ $mail->Host = $email['smtpAddress'];+ $mail->SMTPAuth = $smtpAuth;- if ($smtpAuth) {- $mail->Username = $email['smtpUsername'];- $mail->Password = $email['smtpPassword'];- }+ if ($smtpAuth) {+ $mail->Username = $email['smtpUsername'];+ $mail->Password = $email['smtpPassword'];+ }- if ($email['encryption'] != "none") {- $mail->SMTPSecure = $email['encryption'];- } else {- $mail->SMTPSecure = false;- $mail->SMTPAutoTLS = false;- }+ if ($email['encryption'] != "none") {+ $mail->SMTPSecure = $email['encryption'];+ } else {+ $mail->SMTPSecure = false;+ $mail->SMTPAutoTLS = false;+ }- $mail->Port = $email['smtpPort'];+ $mail->Port = $email['smtpPort'];- $stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');- $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);- $result = $stmt->execute();- $user = $result->fetchArray(SQLITE3_ASSOC);+ $stmt = $db->prepare('SELECT * FROM household WHERE id = :userId');+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $user = $result->fetchArray(SQLITE3_ASSOC);- $emailaddress = !empty($user['email']) ? $user['email'] : $defaultEmail;- $name = !empty($user['name']) ? $user['name'] : $defaultName;+ $emailaddress = !empty($user['email']) ? $user['email'] : $defaultEmail;+ $name = !empty($user['name']) ? $user['name'] : $defaultName;- $mail->setFrom($email['fromEmail'], 'Wallos App');- $mail->addAddress($emailaddress, $name);+ $mail->setFrom($email['fromEmail'], 'Wallos App');+ $mail->addAddress($emailaddress, $name);- if (!empty($email['otherEmails'])) {- $list = explode(';', $email['otherEmails']);+ if (!empty($email['otherEmails'])) {+ $list = explode(';', $email['otherEmails']);- // Avoid duplicate emails- $list = array_unique($list);- $list = array_filter($list, function ($value) use ($emailaddress) {- return $value !== $emailaddress;- });+ // Avoid duplicate emails+ $list = array_unique($list);+ $list = array_filter($list, function ($value) use ($emailaddress) {+ return $value !== $emailaddress;+ });- foreach ($list as $value) {- $mail->addCC(trim($value));+ foreach ($list as $value) {+ $mail->addCC(trim($value));+ }}- }- $mail->Subject = 'Wallos Notification';- $mail->Body = $message;+ $mail->Subject = 'Wallos Notification';+ $mail->Body = $message;- if ($mail->send()) {- echo "Email Notifications sent<br />";- } else {- echo "Error sending notifications: " . $mail->ErrorInfo . "<br />";+ if ($mail->send()) {+ echo "Email Notifications sent<br />";+ } else {+ echo "Error sending notifications: " . $mail->ErrorInfo . "<br />";+ }}}}diff --git a/endpoints/cronjobs/storetotalyearlycost.php b/endpoints/cronjobs/storetotalyearlycost.phpindex 8deeba6..65d21b7 100644--- a/endpoints/cronjobs/storetotalyearlycost.php+++ b/endpoints/cronjobs/storetotalyearlycost.php@@ -1,5 +1,5 @@<?php-+require_once 'validate.php';require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php';require 'settimezone.php';diff --git a/endpoints/currency/fixer_api_key.php b/endpoints/currency/fixer_api_key.phpindex 5059d16..65ed59b 100644--- a/endpoints/currency/fixer_api_key.php+++ b/endpoints/currency/fixer_api_key.php@@ -24,6 +24,19 @@ if ($provider == 1) {$response = file_get_contents($testKeyUrl);}+// apilayer reports the monthly quota in its response headers; keep it for the settings usage bar+$usageLimit = null;+$usageRemaining = null;+if ($provider == 1 && isset($http_response_header)) {+ foreach ($http_response_header as $header) {+ if (stripos($header, 'x-ratelimit-limit-month:') === 0) {+ $usageLimit = (int) trim(substr($header, strlen('x-ratelimit-limit-month:')));+ } elseif (stripos($header, 'x-ratelimit-remaining-month:') === 0) {+ $usageRemaining = (int) trim(substr($header, strlen('x-ratelimit-remaining-month:')));+ }+ }+}+$apiData = json_decode($response, true);if ($apiData['success'] && $apiData['success'] == 1) {if (!empty($newApiKey)) {@@ -34,6 +47,15 @@ if ($apiData['success'] && $apiData['success'] == 1) {$stmt->bindParam(":userId", $userId, SQLITE3_INTEGER);$result = $stmt->execute();if ($result) {+ if ($usageLimit !== null && $usageRemaining !== null+ && $db->querySingle("SELECT COUNT(*) FROM pragma_table_info('fixer') WHERE name='usage_used'") > 0) {+ $usageStmt = $db->prepare("UPDATE fixer SET usage_used = :used, usage_limit = :limit, usage_updated_at = :updatedAt WHERE user_id = :userId");+ $usageStmt->bindValue(':used', $usageLimit - $usageRemaining, SQLITE3_INTEGER);+ $usageStmt->bindValue(':limit', $usageLimit, SQLITE3_INTEGER);+ $usageStmt->bindValue(':updatedAt', date('Y-m-d H:i:s'), SQLITE3_TEXT);+ $usageStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $usageStmt->execute();+ }echo json_encode(["success" => true, "message" => translate('api_key_saved', $i18n)]);} else {$response = [diff --git a/endpoints/currency/update_exchange.php b/endpoints/currency/update_exchange.phpindex f44a6e1..a97d5c5 100644--- a/endpoints/currency/update_exchange.php+++ b/endpoints/currency/update_exchange.php@@ -64,6 +64,29 @@ if ($result) {]]);$response = file_get_contents($api_url, false, $context);++ // Piggyback on this request to record the monthly quota apilayer+ // reports in its response headers (shown on the settings page).+ if (isset($http_response_header)) {+ $usageLimit = null;+ $usageRemaining = null;+ foreach ($http_response_header as $header) {+ if (stripos($header, 'x-ratelimit-limit-month:') === 0) {+ $usageLimit = (int) trim(substr($header, strlen('x-ratelimit-limit-month:')));+ } elseif (stripos($header, 'x-ratelimit-remaining-month:') === 0) {+ $usageRemaining = (int) trim(substr($header, strlen('x-ratelimit-remaining-month:')));+ }+ }+ if ($usageLimit !== null && $usageRemaining !== null+ && $db->querySingle("SELECT COUNT(*) FROM pragma_table_info('fixer') WHERE name='usage_used'") > 0) {+ $usageStmt = $db->prepare("UPDATE fixer SET usage_used = :used, usage_limit = :limit, usage_updated_at = :updatedAt WHERE user_id = :userId");+ $usageStmt->bindValue(':used', $usageLimit - $usageRemaining, SQLITE3_INTEGER);+ $usageStmt->bindValue(':limit', $usageLimit, SQLITE3_INTEGER);+ $usageStmt->bindValue(':updatedAt', date('Y-m-d H:i:s'), SQLITE3_TEXT);+ $usageStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $usageStmt->execute();+ }+ }} else {$api_url = "http://data.fixer.io/api/latest?access_key=" . $apiKey . "&base=EUR&symbols=" . $codes;$response = file_get_contents($api_url);diff --git a/endpoints/logos/google_search.php b/endpoints/logos/google_search.phpnew file mode 100644index 0000000..4220574--- /dev/null+++ b/endpoints/logos/google_search.php@@ -0,0 +1,89 @@+<?php+/*+ Logo search returning Google Images results via SerpAPI.+ Requires the user to store a SerpAPI key (settings page); the Google+ section only shows up in the search popup when it is configured.+ Returns the same JSON shape as search.php: {"results": [{thumbnail, image, ...}]}.+*/+require_once '../../includes/connect_endpoint.php';++header('Content-Type: application/json');++if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {+ echo json_encode(['error' => 'Session expired.']);+ exit;+}++if (!isset($_GET['search']) || trim($_GET['search']) === '') {+ echo json_encode(['error' => 'Invalid request.']);+ exit;+}++$apiKey = '';+if ($db->querySingle("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='google_search'") > 0) {+ $stmt = $db->prepare("SELECT api_key FROM google_search WHERE user_id = :userId");+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ if ($result && ($row = $result->fetchArray(SQLITE3_ASSOC))) {+ $apiKey = $row['api_key'];+ }+}++if ($apiKey === '') {+ echo json_encode(['error' => 'Google search is not configured.']);+ exit;+}++// Cache successful responses: repeat searches shouldn't burn SerpAPI quota (100/month free)+$cacheFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR+ . 'wallos-logo-search-google-' . md5(strtolower(trim($_GET['search']))) . '.json';+if (file_exists($cacheFile) && (time() - filemtime($cacheFile)) < 86400) {+ echo file_get_contents($cacheFile);+ exit;+}++$query = http_build_query([+ 'engine' => 'google_images',+ 'q' => trim($_GET['search']) . ' logo',+ 'api_key' => $apiKey,+ 'safe' => 'active',+ 'imgar' => 'w',+]);++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://serpapi.com/search.json?' . $query);+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_TIMEOUT, 20);+curl_setopt($ch, CURLOPT_USERAGENT, 'Wallos');+$response = curl_exec($ch);+$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);+unset($ch);++if ($response === false) {+ echo json_encode(['error' => 'Failed to reach SerpAPI.']);+ exit;+}++$data = json_decode($response, true);++if ($status !== 200 || isset($data['error'])) {+ echo json_encode(['error' => $data['error'] ?? 'SerpAPI request failed.']);+ exit;+}++$results = [];+foreach (array_slice($data['images_results'] ?? [], 0, 12) as $item) {+ if (empty($item['original']) && empty($item['thumbnail'])) {+ continue;+ }+ $results[] = [+ 'thumbnail' => $item['thumbnail'] ?? $item['original'],+ 'image' => $item['original'] ?? $item['thumbnail'],+ 'width' => $item['original_width'] ?? null,+ 'height' => $item['original_height'] ?? null,+ ];+}++$payload = json_encode(['results' => $results]);+file_put_contents($cacheFile, $payload);+echo $payload;diff --git a/endpoints/logos/icon_search.php b/endpoints/logos/icon_search.phpnew file mode 100644index 0000000..a33e0b0--- /dev/null+++ b/endpoints/logos/icon_search.php@@ -0,0 +1,149 @@+<?php+/*+ Icon search backed by the selfh.st and Dashboard Icons (homarr-labs) collections.+ Both are GitHub-backed icon sets served over jsDelivr with a machine-readable index,+ so this endpoint just filters cached indexes — no scraping involved.+ Returns the same JSON shape as search.php: {"results": [{thumbnail, image, ...}]}.+*/++const ICON_SEARCH_CACHE_TTL = 86400; // one day+const ICON_SEARCH_MAX_RESULTS = 24;++function iconIndexFetch($url)+{+ $ch = curl_init();+ curl_setopt($ch, CURLOPT_URL, $url);+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);+ curl_setopt($ch, CURLOPT_TIMEOUT, 20);+ curl_setopt($ch, CURLOPT_USERAGENT, 'Wallos');++ $response = curl_exec($ch);+ $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);+ unset($ch);++ return ($response !== false && $status === 200) ? $response : null;+}++// Fetches an index JSON with a temp-file cache so we don't pull it on every search.+function iconIndexGetCached($name, $url)+{+ $cacheFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wallos-icon-index-' . $name . '.json';++ if (file_exists($cacheFile) && (time() - filemtime($cacheFile)) < ICON_SEARCH_CACHE_TTL) {+ $cached = file_get_contents($cacheFile);+ if ($cached !== false && $cached !== '') {+ return json_decode($cached, true);+ }+ }++ $fresh = iconIndexFetch($url);+ if ($fresh === null) {+ // Network failed: fall back to a stale cache if one exists+ if (file_exists($cacheFile)) {+ $cached = file_get_contents($cacheFile);+ if ($cached !== false && $cached !== '') {+ return json_decode($cached, true);+ }+ }+ return null;+ }++ file_put_contents($cacheFile, $fresh);+ return json_decode($fresh, true);+}++function searchSelfhstIcons($searchTerm)+{+ $index = iconIndexGetCached('selfhst', 'https://cdn.jsdelivr.net/gh/selfhst/icons/index.json');+ if (!is_array($index)) {+ return [];+ }++ $results = [];+ foreach ($index as $icon) {+ $name = $icon['Name'] ?? '';+ $slug = $icon['Reference'] ?? '';+ if ($slug === '' || ($icon['PNG'] ?? '') !== 'Yes') {+ continue;+ }+ if (stripos($name, $searchTerm) === false && stripos($slug, $searchTerm) === false) {+ continue;+ }++ $url = "https://cdn.jsdelivr.net/gh/selfhst/icons/png/{$slug}.png";+ $results[] = [+ 'thumbnail' => $url,+ 'image' => $url,+ 'width' => null,+ 'height' => null,+ ];+ }++ return $results;+}++function searchDashboardIcons($searchTerm)+{+ $index = iconIndexGetCached('dashboard-icons', 'https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/tree.json');+ if (!is_array($index) || !isset($index['png'])) {+ return [];+ }++ $results = [];+ foreach ($index['png'] as $file) {+ $slug = preg_replace('/\.png$/', '', $file);+ // Skip theme variants; the base icon is enough for search results+ if (preg_match('/-(light|dark)$/', $slug)) {+ continue;+ }+ if (stripos($slug, $searchTerm) === false) {+ continue;+ }++ $url = "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/{$file}";+ $results[] = [+ 'thumbnail' => $url,+ 'image' => $url,+ 'width' => null,+ 'height' => null,+ ];+ }++ return $results;+}++// --- Main flow ---++header('Content-Type: application/json');++if (!isset($_GET['search']) || trim($_GET['search']) === '') {+ echo json_encode(['error' => 'Invalid request.']);+ exit;+}++$searchTerm = trim($_GET['search']);+$source = $_GET['source'] ?? 'all';++if ($source === 'selfhst') {+ $results = searchSelfhstIcons($searchTerm);+} elseif ($source === 'dashboardicons') {+ $results = searchDashboardIcons($searchTerm);+} else {+ $results = array_merge(searchSelfhstIcons($searchTerm), searchDashboardIcons($searchTerm));+}++// Prefer shorter (closer) matches and de-duplicate by URL+usort($results, fn($a, $b) => strlen($a['image']) <=> strlen($b['image']));+$seen = [];+$results = array_values(array_filter($results, function ($result) use (&$seen) {+ if (isset($seen[$result['image']])) {+ return false;+ }+ $seen[$result['image']] = true;+ return true;+}));++$results = array_slice($results, 0, ICON_SEARCH_MAX_RESULTS);++echo json_encode(['results' => $results]);diff --git a/endpoints/logos/search.php b/endpoints/logos/search.phpindex d2f2f10..b9d7b7e 100644--- a/endpoints/logos/search.php+++ b/endpoints/logos/search.php@@ -5,15 +5,24 @@ if (isset($_GET['search'])) {$searchTerm = urlencode($_GET['search'] . " logo");function applyProxy($ch) {+ // Only the lowercase POSIX-style proxy env vars are honored here.+ // The uppercase HTTP_PROXY/HTTPS_PROXY/ALL_PROXY variants must never+ // be trusted: under common nginx+php-fpm setups, a client-supplied+ // "Proxy:" request header is forwarded as the HTTP_PROXY environment+ // variable (the "httpoxy" vulnerability class), which would let any+ // caller of this endpoint redirect the outbound request through an+ // attacker-controlled proxy and bypass the IP-pinning/private-IP+ // checks below.$proxy = getenv('https_proxy')- ?: getenv('HTTPS_PROXY')?: getenv('http_proxy')- ?: getenv('HTTP_PROXY')+ ?: getenv('all_proxy')?: null;if ($proxy) {curl_setopt($ch, CURLOPT_PROXY, $proxy);+ return true;}+ return false;}@@ -36,14 +45,14 @@ if (isset($_GET['search'])) {curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36');- curl_setopt($ch, CURLOPT_PROXY, '');- curl_setopt($ch, CURLOPT_NOPROXY, '*');-if (!empty($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);-+curl_setopt($ch, CURLOPT_RESOLVE, ["{$host}:{$port}:{$ip}"]);- applyProxy($ch);+ if (!applyProxy($ch)) {+ curl_setopt($ch, CURLOPT_PROXY, '');+ curl_setopt($ch, CURLOPT_NOPROXY, '*');+ }$response = curl_exec($ch);unset($ch);return $response ?: null;@@ -99,32 +108,54 @@ if (isset($_GET['search'])) {if (!$html) return null;- $doc = new DOMDocument();- @$doc->loadHTML($html);+ // Brave renders results client-side now, so there are no <img> tags to parse.+ // The image proxy URLs are still embedded in the page's JS payload.+ if (!preg_match_all('~https://imgs\.search\.brave\.com/[A-Za-z0-9_-]+/rs:fit:[0-9:]+/[^"\'\\\\\s]+~', $html, $matches)) {+ return null;+ }$imageUrls = [];- $imgTags = $doc->getElementsByTagName('img');- foreach ($imgTags as $imgTag) {- $src = $imgTag->getAttribute('src');- $class = $imgTag->getAttribute('class');-- if (str_contains($class, 'favicon') || str_contains($class, 'logo')) continue;- if (!filter_var($src, FILTER_VALIDATE_URL)) continue;- if (str_contains($src, 'cdn.search.brave.com')) continue; // filter Brave UI assets-+ foreach (array_unique($matches[0]) as $src) {+ // Skip favicon-sized proxy entries (rs:fit:WIDTH:HEIGHT:...)+ if (preg_match('~/rs:fit:(\d+):(\d+)~', $src, $fit)) {+ $largestSide = max((int) $fit[1], (int) $fit[2]);+ if ($largestSide > 0 && $largestSide <= 64) {+ continue;+ }+ }$imageUrls[] = $src;}+ $imageUrls = array_slice($imageUrls, 0, 30);+return !empty($imageUrls) ? $imageUrls : null;}// --- Main flow ---- // Try DuckDuckGo first- $vqd = getVqdToken($searchTerm);- $results = $vqd ? fetchDDGImages($searchTerm, $vqd) : null;+ // source=duckduckgo or source=brave queries a single engine (used by the+ // parallel search sections); without it the original fallback chain runs.+ $source = $_GET['source'] ?? 'all';- if (!$results) {+ header('Content-Type: application/json');++ // Cache successful responses: repeat searches are common while filling the+ // form, and both engines rate-limit aggressively (Brave after ~2 requests).+ $cacheFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR+ . 'wallos-logo-search-' . md5($source . '|' . strtolower(urldecode($searchTerm))) . '.json';+ if (file_exists($cacheFile) && (time() - filemtime($cacheFile)) < 3600) {+ echo file_get_contents($cacheFile);+ exit;+ }++ $results = null;++ if ($source === 'duckduckgo' || $source === 'all') {+ $vqd = getVqdToken($searchTerm);+ $results = $vqd ? fetchDDGImages($searchTerm, $vqd) : null;+ }++ if (!$results && ($source === 'brave' || $source === 'all')) {$braveUrls = fetchBraveImages($searchTerm);if ($braveUrls) {$results = array_map(function($url) {@@ -138,10 +169,14 @@ if (isset($_GET['search'])) {}}- header('Content-Type: application/json');-if ($results) {- echo json_encode(['results' => $results]);+ $payload = json_encode(['results' => $results]);+ file_put_contents($cacheFile, $payload);+ echo $payload;+ } elseif ($source === 'brave') {+ echo json_encode(['error' => 'Brave returned no results or rate-limited the request. Try again in a minute.']);+ } elseif ($source === 'duckduckgo') {+ echo json_encode(['error' => 'DuckDuckGo returned no results or rate-limited the request.']);} else {echo json_encode(['error' => 'Failed to fetch images from both DuckDuckGo and Brave.']);}diff --git a/endpoints/notifications/saveemailnotifications.php b/endpoints/notifications/saveemailnotifications.phpindex e090726..bf17382 100644--- a/endpoints/notifications/saveemailnotifications.php+++ b/endpoints/notifications/saveemailnotifications.php@@ -1,6 +1,7 @@<?phprequire_once '../../includes/connect_endpoint.php';require_once '../../includes/validate_endpoint.php';+require_once '../../includes/ssrf_helper.php';$postData = file_get_contents("php://input");$data = json_decode($postData, true);@@ -27,6 +28,13 @@ if ($fromEmail = $data["fromemail"];$otherEmails = $data["otheremails"];+ if (!validate_smtp_host($smtpAddress, (int) $smtpPort, $db)) {+ die(json_encode([+ "success" => false,+ "message" => "Security Error: SMTP host must not target link-local or loopback addresses."+ ]));+ }+$query = "SELECT COUNT(*) FROM email_notifications WHERE user_id = :userId";$stmt = $db->prepare($query);$stmt->bindParam(":userId", $userId, SQLITE3_INTEGER);diff --git a/endpoints/payments/add.php b/endpoints/payments/add.phpindex 4724104..96a59c4 100644--- a/endpoints/payments/add.php+++ b/endpoints/payments/add.php@@ -102,6 +102,11 @@ function saveLogo($imageData, $uploadFile, $name, $settings)$fuzz = Imagick::getQuantum() * 0.1; // 10%$imagick->transparentPaintImage("rgb(247, 247, 247)", 0, $fuzz, false);}+ // Crop/trim transparent margins (with 2px transparent padding added back to avoid touching the borders)+ $imagick->trimImage(0);+ $imagick->setImagePage(0, 0, 0, 0);+ $imagick->borderImage(new ImagickPixel('transparent'), 2, 2);+$imagick->setImageFormat('png');$imagick->writeImage($uploadFile);@@ -111,13 +116,14 @@ function saveLogo($imageData, $uploadFile, $name, $settings)// Alternative method if Imagick is not available$newImage = imagecreatefrompng($tempFile);if ($removeBackground) {- imagealphablending($newImage, false);- imagesavealpha($newImage, true);- $transparent = imagecolorallocatealpha($newImage, 0, 0, 0, 127);- imagefill($newImage, 0, 0, $transparent); // Fill the entire image with transparency- imagepng($newImage, $uploadFile);- imagedestroy($newImage);+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ // Match the Imagick branch: paint out the same near-white background with ~10% fuzz+ gdRemoveBackgroundColor($newImage, 247, 247, 247);}+ // Crop/trim transparent margins+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $newImage = gdCropTransparent($newImage, 2);+imagepng($newImage, $uploadFile);imagedestroy($newImage);}@@ -167,6 +173,12 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name)imagesavealpha($image, true);}+ // Crop/trim transparent margins (ensure we update dimensions after cropping)+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $image = gdCropTransparent($image, 2);+ $width = imagesx($image);+ $height = imagesy($image);+$newWidth = $width;$newHeight = $height;diff --git a/endpoints/payments/search.php b/endpoints/payments/search.phpindex 121bf26..351c0f1 100644--- a/endpoints/payments/search.php+++ b/endpoints/payments/search.php@@ -3,15 +3,24 @@ require_once '../../includes/ssrf_helper.php';if (isset($_GET['search'])) {function applyProxy($ch) {+ // Only the lowercase POSIX-style proxy env vars are honored here.+ // The uppercase HTTP_PROXY/HTTPS_PROXY/ALL_PROXY variants must never+ // be trusted: under common nginx+php-fpm setups, a client-supplied+ // "Proxy:" request header is forwarded as the HTTP_PROXY environment+ // variable (the "httpoxy" vulnerability class), which would let any+ // caller of this endpoint redirect the outbound request through an+ // attacker-controlled proxy and bypass the IP-pinning/private-IP+ // checks below.$proxy = getenv('https_proxy')- ?: getenv('HTTPS_PROXY')?: getenv('http_proxy')- ?: getenv('HTTP_PROXY')+ ?: getenv('all_proxy')?: null;if ($proxy) {curl_setopt($ch, CURLOPT_PROXY, $proxy);+ return true;}+ return false;}function curlGet($url, $headers = []) {@@ -48,7 +57,10 @@ if (isset($_GET['search'])) {curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);}- applyProxy($ch);+ if (!applyProxy($ch)) {+ curl_setopt($ch, CURLOPT_PROXY, '');+ curl_setopt($ch, CURLOPT_NOPROXY, '*');+ }$response = curl_exec($ch);unset($ch);diff --git a/endpoints/settings/fixer_usage.php b/endpoints/settings/fixer_usage.phpnew file mode 100644index 0000000..9210dfc--- /dev/null+++ b/endpoints/settings/fixer_usage.php@@ -0,0 +1,29 @@+<?php+require_once '../../includes/connect_endpoint.php';++header('Content-Type: application/json');++if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {+ die(json_encode(["success" => false]));+}++// Usage is only available for the apilayer provider; it is captured from the+// response headers of rate updates, so this endpoint never calls the API.+if ($db->querySingle("SELECT COUNT(*) FROM pragma_table_info('fixer') WHERE name='usage_used'") == 0) {+ die(json_encode(["success" => false]));+}++$stmt = $db->prepare("SELECT provider, usage_used, usage_limit FROM fixer WHERE user_id = :userId");+$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+$row = $result ? $result->fetchArray(SQLITE3_ASSOC) : false;++if (!$row || (int) $row['provider'] !== 1 || $row['usage_used'] === null || !$row['usage_limit']) {+ die(json_encode(["success" => false]));+}++die(json_encode([+ "success" => true,+ "used" => (int) $row['usage_used'],+ "total" => (int) $row['usage_limit'],+]));diff --git a/endpoints/settings/google_search.php b/endpoints/settings/google_search.phpnew file mode 100644index 0000000..e619d6a--- /dev/null+++ b/endpoints/settings/google_search.php@@ -0,0 +1,54 @@+<?php+require_once '../../includes/connect_endpoint.php';+require_once '../../includes/validate_endpoint.php';++$apiKey = isset($_POST['api_key']) ? trim($_POST['api_key']) : '';++$removeOldCredentials = "DELETE FROM google_search WHERE user_id = :userId";+$stmt = $db->prepare($removeOldCredentials);+$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+$stmt->execute();++// An empty field clears the key and disables the Google section+if ($apiKey === '') {+ die(json_encode([+ "success" => true,+ "message" => translate('success', $i18n)+ ]));+}++// Validate the key against the SerpAPI account endpoint (doesn't spend a search)+$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://serpapi.com/account?api_key=' . urlencode($apiKey));+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_TIMEOUT, 20);+curl_setopt($ch, CURLOPT_USERAGENT, 'Wallos');+$response = curl_exec($ch);+$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);+unset($ch);++$apiData = json_decode($response ?: '', true);++if ($status !== 200 || isset($apiData['error'])) {+ die(json_encode([+ "success" => false,+ "message" => translate('invalid_api_key', $i18n)+ ]));+}++$insertCredentials = "INSERT INTO google_search (api_key, user_id) VALUES (:api_key, :userId)";+$stmt = $db->prepare($insertCredentials);+$stmt->bindParam(':api_key', $apiKey, SQLITE3_TEXT);+$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);++if ($stmt->execute()) {+ die(json_encode([+ "success" => true,+ "message" => translate('api_key_saved', $i18n)+ ]));+}++die(json_encode([+ "success" => false,+ "message" => translate('failed_to_store_api_key', $i18n)+]));diff --git a/endpoints/settings/google_search_usage.php b/endpoints/settings/google_search_usage.phpnew file mode 100644index 0000000..c9f5217--- /dev/null+++ b/endpoints/settings/google_search_usage.php@@ -0,0 +1,44 @@+<?php+require_once '../../includes/connect_endpoint.php';++header('Content-Type: application/json');++if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {+ die(json_encode(["success" => false]));+}++$apiKey = '';+if ($db->querySingle("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='google_search'") > 0) {+ $stmt = $db->prepare("SELECT api_key FROM google_search WHERE user_id = :userId");+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ if ($result && ($row = $result->fetchArray(SQLITE3_ASSOC))) {+ $apiKey = $row['api_key'];+ }+}++if ($apiKey === '') {+ die(json_encode(["success" => false]));+}++$ch = curl_init();+curl_setopt($ch, CURLOPT_URL, 'https://serpapi.com/account?api_key=' . urlencode($apiKey));+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+curl_setopt($ch, CURLOPT_TIMEOUT, 15);+curl_setopt($ch, CURLOPT_USERAGENT, 'Wallos');+$response = curl_exec($ch);+$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);+unset($ch);++$data = json_decode($response ?: '', true);++if ($status !== 200 || !is_array($data) || isset($data['error'])) {+ die(json_encode(["success" => false]));+}++die(json_encode([+ "success" => true,+ "used" => (int) ($data['this_month_usage'] ?? 0),+ "total" => (int) ($data['searches_per_month'] ?? 0),+ "left" => (int) ($data['plan_searches_left'] ?? 0),+]));diff --git a/endpoints/subscription/add.php b/endpoints/subscription/add.phpindex b7e0a23..f4c83ab 100644--- a/endpoints/subscription/add.php+++ b/endpoints/subscription/add.php@@ -115,6 +115,11 @@ function saveLogo($imageData, $uploadFile, $name, $settings)}}+ // Crop/trim transparent margins (with 2px transparent padding added back to avoid touching the borders)+ $imagick->trimImage(0);+ $imagick->setImagePage(0, 0, 0, 0);+ $imagick->borderImage(new ImagickPixel('transparent'), 2, 2);+$imagick->setImageFormat('png');$imagick->writeImage($uploadFile);$imagick->clear();@@ -127,10 +132,24 @@ function saveLogo($imageData, $uploadFile, $name, $settings)imagesavealpha($newImage, true);if ($removeBackground) {- $transparent = imagecolorallocatealpha($newImage, 0, 0, 0, 127);- imagefill($newImage, 0, 0, $transparent);+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ // On palette images imagecolorat() returns palette indexes, not RGB values+ if (!imageistruecolor($newImage)) {+ imagepalettetotruecolor($newImage);+ imagealphablending($newImage, false);+ imagesavealpha($newImage, true);+ }+ // Match the Imagick branch: paint out the corner color with ~10% fuzz+ $corner = imagecolorat($newImage, 0, 0);+ if ((($corner >> 24) & 0x7F) !== 127) {+ gdRemoveBackgroundColor($newImage, ($corner >> 16) & 0xFF, ($corner >> 8) & 0xFF, $corner & 0xFF);+ }}+ // Crop/trim transparent margins+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $newImage = gdCropTransparent($newImage, 2);+imagepng($newImage, $uploadFile);imagedestroy($newImage);} else {@@ -181,6 +200,12 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name, $settings)imagesavealpha($image, true);}+ // Crop/trim transparent margins (ensure we update dimensions after cropping)+ require_once __DIR__ . '/../../includes/gd_background_removal.php';+ $image = gdCropTransparent($image, 2);+ $width = imagesx($image);+ $height = imagesy($image);+$newWidth = $width;$newHeight = $height;diff --git a/endpoints/subscription/exportcalendar.php b/endpoints/subscription/exportcalendar.phpindex b680dca..ed5ed79 100644--- a/endpoints/subscription/exportcalendar.php+++ b/endpoints/subscription/exportcalendar.php@@ -2,6 +2,7 @@require_once '../../includes/connect_endpoint.php';require_once '../../includes/validate_endpoint.php';require_once '../../includes/getdbkeys.php';+require_once '../../includes/ical_helper.php';$postData = file_get_contents("php://input");$data = json_decode($postData, true);@@ -32,13 +33,17 @@ if ($subscription) {// Create ICS from subscription information$uid = 'wallos-subscription-' . $subscription['id'] . '@wallos';- $summary = html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8');- $description = "Price: {$subscription['currency']}{$subscription['price']}\nCategory: {$subscription['category']}\nPayment Method: {$subscription['payment_method']}\nPayer: {$subscription['payer_user']}\n\nNotes: {$subscription['notes']}";+ $summary = icalEscape(html_entity_decode($subscription['name'], ENT_QUOTES, 'UTF-8'));+ $notes = icalEscape(html_entity_decode($subscription['notes'], ENT_QUOTES, 'UTF-8'));+ $category = icalEscape($subscription['category']);+ $paymentMethod = icalEscape($subscription['payment_method']);+ $payer = icalEscape($subscription['payer_user']);+ $description = "Price: {$subscription['currency']}{$subscription['price']}\\nCategory: {$category}\\nPayment Method: {$paymentMethod}\\nPayer: {$payer}\\n\\nNotes: {$notes}";$dtstamp = gmdate('Ymd\THis\Z');$dtstart = (new DateTime($subscription['next_payment']))->format('Ymd');$dtend = (new DateTime($subscription['next_payment']))->format('Ymd');- $location = isset($subscription['url']) ? $subscription['url'] : '';+ $location = icalEscape(isset($subscription['url']) ? $subscription['url'] : '');$alarm_trigger = '-P' . $subscription['trigger'] . 'D';$icsContent = <<<ICSdiff --git a/images/siteicons/svg/category.php b/images/siteicons/svg/category.phpdeleted file mode 100644index d65f4b1..0000000--- a/images/siteicons/svg/category.php+++ /dev/null@@ -1,7 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Page-Setting--Streamline-Plump.svg" height="48" width="48">- <desc>Page Setting Streamline Icon: https://streamlinehq.com</desc>- <g id="page-setting--page-setting-square-triangle-circle-line-combination-variation">- <path id="Union" class="main-color" fill-rule="evenodd" d="M28 27a2 2 0 1 0 0 4h16a2 2 0 1 0 0 -4H28Zm-2 9a2 2 0 0 1 2 -2h16a2 2 0 1 1 0 4H28a2 2 0 0 1 -2 -2Zm0 7a2 2 0 0 1 2 -2h16a2 2 0 1 1 0 4H28a2 2 0 0 1 -2 -2Z" clip-rule="evenodd" stroke-width="1"></path>- <path id="Union_2" class="accent-color" fill-rule="evenodd" d="M18.122 1.829C16.724 1.646 14.748 1.5 12 1.5c-2.748 0 -4.724 0.146 -6.122 0.329 -2.5 0.326 -4.097 2.314 -4.24 4.677C1.56 7.776 1.5 9.55 1.5 12c0 2.45 0.06 4.225 0.137 5.494 0.144 2.363 1.742 4.351 4.241 4.677 1.398 0.183 3.374 0.329 6.122 0.329 2.748 0 4.724 -0.146 6.122 -0.329 2.5 -0.326 4.097 -2.314 4.24 -4.677 0.078 -1.27 0.138 -3.044 0.138 -5.494 0 -2.45 -0.06 -4.225 -0.137 -5.494 -0.144 -2.363 -1.742 -4.351 -4.241 -4.677ZM1.5 36c0 -5.799 4.701 -10.5 10.5 -10.5S22.5 30.201 22.5 36 17.799 46.5 12 46.5 1.5 41.799 1.5 36ZM32.793 3.45a4.02 4.02 0 0 1 6.384 0 51.43 51.43 0 0 1 4.057 5.997 51.492 51.492 0 0 1 3.165 6.51 4.021 4.021 0 0 1 -3.193 5.53c-1.83 0.261 -4.338 0.513 -7.22 0.513a51.48 51.48 0 0 1 -7.22 -0.514 4.02 4.02 0 0 1 -3.193 -5.529 51.447 51.447 0 0 1 3.165 -6.51 51.494 51.494 0 0 1 4.055 -5.996Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>diff --git a/images/siteicons/svg/check.php b/images/siteicons/svg/check.phpindex 8e399ac..a9d64c2 100644--- a/images/siteicons/svg/check.php+++ b/images/siteicons/svg/check.php@@ -1,10 +1,10 @@-<?php-header('Content-Type: image/svg+xml');-echo '-<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="-0.5 -0.5 16 16" id="Check-Thick--Streamline-Plump.svg" height="16" width="16">- <desc>Check Thick Streamline Icon: https://streamlinehq.com</desc>- <g id="check-thick--check-form-validation-checkmark-success-add-addition-1-tick">- <path id="Union" fill="currentColor" d="M6.320125 7.069593749999999C6.423687500000001 7.188750000000001 6.516437499999999 7.296375 6.59834375 7.3925C6.787875 7.11834375 7.0450937499999995 6.747062499999999 7.36459375 6.289125C8.392468749999999 4.815781250000001 9.428374999999999 3.3480937500000003 10.472312500000001 1.8861249999999998C10.985093749999999 1.1675625 11.975093750000001 0.74753125 12.868593749999999 1.2433750000000001C13.4003125 1.5385312500000001 14.034593749999999 1.9957812499999998 14.53415625 2.67675C15.02965625 3.35196875 14.883781250000002 4.20115625 14.49759375 4.786031250000001C11.599375 9.17684375 9.50771875 11.851 8.34309375 13.24271875C7.5815624999999995 14.1531875 6.2510625 14.216125 5.3961250000000005 13.4051875C3.6985312500000003 11.7910625 2.10321875 10.072656250000001 0.61946875 8.259968749999999C0.09556250000000001 7.61825 -0.05946875 6.6445 0.5169374999999999 5.90565625C0.8909374999999999 5.426375 1.3136562500000002 5.0205625 1.6896875 4.70309375C2.5205937499999997 4.00146875 3.6814999999999998 4.1906875 4.36959375 4.91971875C5.03440625 5.6230625 5.68471875 6.3399375000000004 6.320125 7.0699375Z" stroke-width="1"></path>- </g>-</svg>';+<?php+header('Content-Type: image/svg+xml');+echo '+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="Check-Thick--Streamline-Plump.svg" height="16" width="16">+ <desc>Check Thick Streamline Icon: https://streamlinehq.com</desc>+ <g id="check-thick--check-form-validation-checkmark-success-add-addition-1-tick">+ <path fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M3 8.5L6 11.5L13.5 4" />+ </g>+</svg>';?>\ No newline at end of filediff --git a/images/siteicons/svg/clone.php b/images/siteicons/svg/clone.phpdeleted file mode 100644index 4024ff6..0000000--- a/images/siteicons/svg/clone.php+++ /dev/null@@ -1,7 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" height="48" width="48">- <g id="add-layer-2--layer-add-design-plus-layers-square-box">- <path id="Union" class="main-color" d="M28.5 1.5c5.166 0 8.966 0.172 11.56 0.357 3.3 0.236 5.847 2.782 6.083 6.084 0.185 2.593 0.357 6.393 0.357 11.559 0 5.166 -0.172 8.966 -0.357 11.56 -0.236 3.3 -2.782 5.847 -6.084 6.083 -2.593 0.185 -6.393 0.357 -11.559 0.357 -5.166 0 -8.966 -0.172 -11.56 -0.357 -3.3 -0.236 -5.847 -2.782 -6.083 -6.084 -0.185 -2.593 -0.357 -6.393 -0.357 -11.559 0 -5.166 0.172 -8.966 0.357 -11.56 0.236 -3.3 2.782 -5.847 6.084 -6.083C19.534 1.672 23.334 1.5 28.5 1.5Z" stroke-width="1"/>- <path id="Union_2" class="accent-color" d="M19.5 10.5c5.166 0 8.966 0.172 11.56 0.357 3.3 0.236 5.847 2.782 6.083 6.084 0.185 2.593 0.357 6.393 0.357 11.559 0 5.166 -0.172 8.966 -0.357 11.56 -0.236 3.3 -2.782 5.847 -6.084 6.083 -2.593 0.185 -6.393 0.357 -11.559 0.357 -5.166 0 -8.966 -0.172 -11.56 -0.357 -3.3 -0.236 -5.847 -2.782 -6.083 -6.084C1.672 37.466 1.5 33.666 1.5 28.5c0 -5.166 0.172 -8.966 0.357 -11.56 0.236 -3.3 2.782 -5.847 6.084 -6.083 2.593 -0.185 6.393 -0.357 11.559 -0.357Z" stroke-width="1"/>- <path id="Subtract" class="main-color" fill-rule="evenodd" d="M16.113 21.628c0.047 -1.067 0.733 -1.95 1.795 -2.055 0.436 -0.043 0.963 -0.073 1.592 -0.073 0.628 0 1.156 0.03 1.592 0.073 1.062 0.106 1.748 0.988 1.795 2.055 0.034 0.788 0.068 1.89 0.09 3.395 1.504 0.022 2.607 0.056 3.395 0.09 1.067 0.047 1.95 0.733 2.055 1.795 0.043 0.436 0.073 0.963 0.073 1.592 0 0.628 -0.03 1.156 -0.073 1.592 -0.106 1.062 -0.989 1.748 -2.055 1.795 -0.788 0.034 -1.89 0.068 -3.395 0.09a119.605 119.605 0 0 1 -0.09 3.395c-0.047 1.066 -0.733 1.95 -1.795 2.055 -0.436 0.043 -0.963 0.073 -1.592 0.073 -0.628 0 -1.156 -0.03 -1.592 -0.073 -1.062 -0.106 -1.748 -0.989 -1.795 -2.055 -0.034 -0.788 -0.068 -1.89 -0.09 -3.395a119.605 119.605 0 0 1 -3.395 -0.09c-1.066 -0.047 -1.95 -0.733 -2.055 -1.795A16.127 16.127 0 0 1 10.5 28.5c0 -0.628 0.03 -1.156 0.073 -1.592 0.106 -1.062 0.989 -1.748 2.055 -1.795 0.788 -0.034 1.89 -0.068 3.395 -0.09 0.022 -1.504 0.056 -2.607 0.09 -3.395Z" clip-rule="evenodd" stroke-width="1"/>- </g>-</svg>diff --git a/images/siteicons/svg/delete.php b/images/siteicons/svg/delete.phpdeleted file mode 100644index 17599ac..0000000--- a/images/siteicons/svg/delete.php+++ /dev/null@@ -1,8 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Recycle-Bin-2--Streamline-Plump.svg" height="48" width="48">- <g id="recycle-bin-2--remove-delete-empty-bin-trash-garbage">- <path id="Union" class="accent-color" d="M43.318 15.934a1.5 1.5 0 0 0 -1.618 -1.591c-3.016 0.246 -8.46 0.52 -17.721 0.52 -9.215 0 -14.65 -0.271 -17.675 -0.516a1.5 1.5 0 0 0 -1.618 1.59c0.888 13.84 1.74 21.07 2.253 24.547 0.332 2.252 1.85 4.217 4.226 4.788 2.445 0.588 6.55 1.227 12.837 1.227 6.286 0 10.392 -0.64 12.837 -1.227 2.375 -0.57 3.894 -2.536 4.226 -4.788 0.513 -3.477 1.365 -10.708 2.253 -24.55Z" stroke-width="1"/>- <path id="Union_2" class="main-color" d="M23.37 1a8 8 0 0 0 -7.034 4.188c-3.411 0.072 -6 0.182 -7.814 0.282 -2.312 0.127 -4.692 1.242 -5.7 3.605 -0.244 0.57 -0.475 1.212 -0.663 1.919 -0.68 2.548 1.302 4.622 3.657 4.822 3.057 0.258 8.614 0.548 18.161 0.548 9.549 0 15.106 -0.29 18.162 -0.549 2.374 -0.2 4.291 -2.261 3.751 -4.785a16.68 16.68 0 0 0 -0.294 -1.167c-0.824 -2.831 -3.517 -4.277 -6.188 -4.411a260.66 260.66 0 0 0 -7.744 -0.264A8 8 0 0 0 24.631 1H23.37Z" stroke-width="1"/>- <path id="Vector_831_Stroke" class="main-color" fill-rule="evenodd" d="M17.8 23.01a2 2 0 0 1 2.19 1.791l1 10a2 2 0 0 1 -3.98 0.398l-1 -10a2 2 0 0 1 1.79 -2.189Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Vector_832_Stroke" class="main-color" fill-rule="evenodd" d="M30.2 23.01a2 2 0 0 0 -2.19 1.791l-1 10a2 2 0 0 0 3.98 0.398l1 -10a2 2 0 0 0 -1.79 -2.189Z" clip-rule="evenodd" stroke-width="1"/>- </g>-</svg>diff --git a/images/siteicons/svg/edit.php b/images/siteicons/svg/edit.phpdeleted file mode 100644index 2d2a4f0..0000000--- a/images/siteicons/svg/edit.php+++ /dev/null@@ -1,8 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Pencil-Square--Streamline-Plump.svg" height="48" width="48">- <desc>Pencil Square Streamline Icon: https://streamlinehq.com</desc>- <g id="pencil-square--change-document-edit-modify-paper-pencil-write-writing">- <path id="Rectangle_1098" class="main-color" d="M44.42 14.557c1.546 -1.546 2.146 -3.798 0.937 -5.62 -0.655 -0.986 -1.574 -2.156 -2.856 -3.438 -1.282 -1.282 -2.452 -2.201 -3.438 -2.856 -1.822 -1.21 -4.074 -0.61 -5.62 0.937L16.198 20.825c-0.578 0.578 -0.974 1.312 -1.053 2.126 -0.133 1.381 -0.256 3.962 0.024 7.967a2.063 2.063 0 0 0 1.913 1.913c4.005 0.28 6.586 0.157 7.967 0.024 0.814 -0.079 1.548 -0.475 2.126 -1.053L44.42 14.557Z" stroke-width="1"/>- <path id="Subtract" class="accent-color" d="m29.206 3.574 -15.13 15.13c-0.982 0.982 -1.76 2.337 -1.917 3.958 -0.15 1.562 -0.273 4.31 0.018 8.465a5.063 5.063 0 0 0 4.695 4.696c4.156 0.29 6.904 0.169 8.465 0.018 1.622 -0.157 2.977 -0.935 3.96 -1.918l15.129 -15.13c0.046 1.854 0.074 3.92 0.074 6.207 0 6.899 -0.254 11.783 -0.502 14.91 -0.261 3.291 -2.797 5.827 -6.087 6.088 -3.128 0.248 -8.012 0.502 -14.911 0.502 -6.899 0 -11.783 -0.254 -14.91 -0.502 -3.291 -0.261 -5.827 -2.797 -6.088 -6.087C1.754 36.782 1.5 31.898 1.5 25c0 -6.899 0.254 -11.783 0.502 -14.91 0.261 -3.291 2.797 -5.827 6.087 -6.088C11.217 3.754 16.101 3.5 23 3.5c2.287 0 4.352 0.028 6.206 0.074Z" stroke-width="1"/>- <path id="Intersect" class="accent-color" d="M43.775 15.202c-1.083 -1.72 -2.654 -3.79 -4.92 -6.057 -2.267 -2.266 -4.337 -3.838 -6.057 -4.92L29.15 7.873c1.516 0.84 3.668 2.307 6.169 4.808 2.5 2.5 3.967 4.653 4.808 6.169l3.648 -3.648Z" stroke-width="1"/>- </g>-</svg>diff --git a/images/siteicons/svg/notes.php b/images/siteicons/svg/notes.phpdeleted file mode 100644index 3ad502d..0000000--- a/images/siteicons/svg/notes.php+++ /dev/null@@ -1,10 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Notepad-Text--Streamline-Plump.svg" height="48" width="48">- <desc>Notepad Text Streamline Icon: https://streamlinehq.com</desc>- <g id="notepad-text--content-notes-book-notepad-notebook">- <path id="Union" class="accent-color" d="M24 5.531c-7.4 0 -12.588 0.252 -15.855 0.492 -3.277 0.241 -5.853 2.735 -6.135 6.033 -0.256 2.984 -0.51 7.566 -0.51 13.975 0 6.41 0.254 10.991 0.51 13.976 0.282 3.297 2.858 5.791 6.135 6.032 3.267 0.24 8.455 0.492 15.855 0.492s12.588 -0.251 15.855 -0.492c3.277 -0.24 5.853 -2.735 6.135 -6.032 0.256 -2.985 0.51 -7.567 0.51 -13.976 0 -6.409 -0.254 -10.99 -0.51 -13.975 -0.282 -3.298 -2.858 -5.792 -6.135 -6.033 -3.267 -0.24 -8.455 -0.492 -15.855 -0.492Z" stroke-width="1"/>- <path id="Subtract" class="main-color" fill-rule="evenodd" d="M12.75 24A2.25 2.25 0 0 1 15 21.75h18a2.25 2.25 0 0 1 0 4.5H15A2.25 2.25 0 0 1 12.75 24ZM15 32.75a2.25 2.25 0 0 0 0 4.5h9a2.25 2.25 0 0 0 0 -4.5h-9Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Union_2" class="main-color" d="M13 12.531c-0.35 0 -0.665 -0.009 -0.944 -0.025 -1.58 -0.09 -2.465 -1.399 -2.513 -2.83a79.157 79.157 0 0 1 0 -5.29c0.048 -1.43 0.933 -2.74 2.513 -2.83a17.564 17.564 0 0 1 1.888 0c1.58 0.09 2.465 1.4 2.513 2.83a78.983 78.983 0 0 1 0 5.29c-0.048 1.431 -0.933 2.74 -2.513 2.83 -0.28 0.016 -0.593 0.025 -0.944 0.025Z" stroke-width="1"/>- <path id="Union_3" class="main-color" d="M24 12.531c-0.35 0 -0.665 -0.009 -0.944 -0.025 -1.58 -0.09 -2.465 -1.399 -2.513 -2.83a78.983 78.983 0 0 1 0 -5.29c0.048 -1.43 0.933 -2.74 2.513 -2.83a17.564 17.564 0 0 1 1.888 0c1.58 0.09 2.465 1.4 2.513 2.83a78.983 78.983 0 0 1 0 5.29c-0.048 1.431 -0.933 2.74 -2.513 2.83 -0.28 0.016 -0.593 0.025 -0.944 0.025Z" stroke-width="1"/>- <path id="Union_4" class="main-color" d="M35 12.531c-0.35 0 -0.665 -0.009 -0.944 -0.025 -1.58 -0.09 -2.465 -1.399 -2.513 -2.83a78.983 78.983 0 0 1 0 -5.29c0.048 -1.43 0.933 -2.74 2.513 -2.83a17.564 17.564 0 0 1 1.888 0c1.58 0.09 2.465 1.4 2.513 2.83a78.983 78.983 0 0 1 0 5.29c-0.048 1.431 -0.933 2.74 -2.513 2.83 -0.28 0.016 -0.593 0.025 -0.944 0.025Z" stroke-width="1"/>- </g>-</svg>diff --git a/images/siteicons/svg/payment.php b/images/siteicons/svg/payment.phpdeleted file mode 100644index 7cc5b69..0000000--- a/images/siteicons/svg/payment.php+++ /dev/null@@ -1,12 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Payment-Recieve-7--Streamline-Plump.svg" height="48" width="48">- <desc>Payment Recieve 7 Streamline Icon: https://streamlinehq.com</desc>- <g id="payment-recieve-7--deposit-payment-finance-atm-withdraw-dollar">- <path id="Union" class="accent-color" fill="#8fbffa" d="M24 47.52C16.1987 47.52 10.7556 47.3224 7.3573 47.1364C4.0247 46.9545 1.2421 44.5335 0.9034 41.0985C0.6765 38.7988 0.48 35.575 0.48 31.3173C0.48 27.0597 0.6765 23.8359 0.9034 21.5362C1.2421 18.1001 4.0247 15.6802 7.3573 15.4983C10.7546 15.3122 16.1987 15.1147 24 15.1147C31.8013 15.1147 37.2444 15.3122 40.6428 15.4983C43.9753 15.6802 46.758 18.1012 47.0966 21.5362C47.3235 23.8359 47.52 27.0597 47.52 31.3173C47.52 35.575 47.3235 38.7988 47.0966 41.0985C46.758 44.5345 43.9753 46.9545 40.6428 47.1364C37.2454 47.3224 31.8013 47.52 24 47.52Z" stroke-width="1"/>- <path id="Vector_1565_Stroke" class="main-color" fill="#2859c5" fill-rule="evenodd" d="M23.4773 10.9333C24.6319 10.9333 25.568 9.9973 25.568 8.8427V2.5707C25.5715 0.9613 23.8315 -0.0484 22.436 0.7532C21.7855 1.1269 21.385 1.8205 21.3867 2.5707V8.8427C21.3867 9.9973 22.3227 10.9333 23.4773 10.9333Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Vector_1566_Stroke" class="main-color" fill="#2859c5" fill-rule="evenodd" d="M31.84 13.024C32.9946 13.0239 33.9307 12.0879 33.9307 10.9333V5.7067C33.9342 4.0973 32.1942 3.0876 30.7986 3.8892C30.1481 4.2629 29.7477 4.9565 29.7493 5.7067V10.9333C29.7493 12.088 30.6853 13.0241 31.84 13.024Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Vector_1567_Stroke" class="main-color" fill="#2859c5" fill-rule="evenodd" d="M15.1147 13.024C13.96 13.024 13.024 12.088 13.024 10.9333V5.7067C13.0205 4.0973 14.7605 3.0876 16.156 3.8892C16.8065 4.2629 17.207 4.9565 17.2053 5.7067V10.9333C17.2053 12.0879 16.2693 13.024 15.1147 13.024Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Subtract" class="main-color" fill="#2859c5" fill-rule="evenodd" d="M25.0453 22.432C25.0453 21.2249 23.7387 20.4705 22.6933 21.0741C22.2082 21.3542 21.9093 21.8718 21.9093 22.432V23.5725C20.8692 23.7502 19.8145 24.1139 18.9542 24.7704C17.9015 25.5732 17.2053 26.7733 17.2053 28.312C17.2053 29.1984 17.4165 29.9992 17.8503 30.6891C18.2778 31.3706 18.8622 31.8494 19.4653 32.1933C20.5629 32.8205 21.9428 33.1153 23.031 33.3484L23.1491 33.3735C24.3972 33.6401 25.3067 33.8512 25.9339 34.2098C26.2119 34.3687 26.3625 34.5202 26.4492 34.6593C26.5297 34.7868 26.6133 34.9938 26.6133 35.368C26.6133 35.8551 26.4335 36.1604 26.098 36.4165C25.7039 36.7175 25.0568 36.9611 24.1965 37.0614C23.327 37.1554 22.448 37.1081 21.5936 36.9214C20.7354 36.7332 20.102 36.4405 19.7559 36.1614C18.8149 35.405 17.4078 35.951 17.2233 37.1442C17.1377 37.698 17.354 38.2554 17.7907 38.6064C18.6468 39.2932 19.7894 39.7364 20.9215 39.9852C21.2424 40.0553 21.5727 40.1117 21.9093 40.1546V41.248C21.9093 42.455 23.216 43.2094 24.2613 42.6059C24.7465 42.3258 25.0453 41.8082 25.0453 41.248V40.1075C26.0854 39.9309 27.1402 39.5661 28.0005 38.9096C29.0531 38.1068 29.7493 36.9067 29.7493 35.368C29.7493 34.4816 29.5392 33.6808 29.1054 32.9899C28.6768 32.3094 28.0914 31.8306 27.4893 31.4867C26.3917 30.8595 25.0119 30.5647 23.9237 30.3316L23.8056 30.3065C22.5585 30.0389 21.648 29.8288 21.0218 29.4702C20.7427 29.3113 20.5922 29.1598 20.5055 29.0207C20.425 28.8932 20.3413 28.6862 20.3413 28.312C20.3413 27.8249 20.5211 27.5196 20.8567 27.2635C21.2508 26.9625 21.8978 26.7189 22.7581 26.6186C23.628 26.5246 24.5073 26.5719 25.3621 26.7586C26.2192 26.9468 26.8527 27.2395 27.1998 27.5186C28.1409 28.2746 29.5475 27.7283 29.7316 26.5353C29.8171 25.9816 29.6007 25.4244 29.164 25.0736C28.3078 24.3868 27.1653 23.9435 26.0332 23.6948C25.7066 23.6236 25.377 23.5671 25.0453 23.5254V22.432Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Subtract_2" class="main-color" fill="#2859c5" d="M11.9787 31.84C11.9787 30.6854 11.0426 29.7494 9.888 29.7493H8.8427C7.2333 29.7458 6.2236 31.4858 7.0252 32.8814C7.3989 33.5319 8.0925 33.9323 8.8427 33.9307H9.888C11.0426 33.9307 11.9787 32.9946 11.9787 31.84Z" stroke-width="1"/>- <path id="Subtract_3" class="main-color" fill="#2859c5" d="M37.0667 29.7493C35.4573 29.7458 34.4476 31.4858 35.2492 32.8814C35.6229 33.5319 36.3165 33.9323 37.0667 33.9307H38.112C39.7214 33.9342 40.7311 32.1942 39.9294 30.7986C39.5557 30.1481 38.8622 29.7477 38.112 29.7493H37.0667Z" stroke-width="1"/>- </g>-</svg>diff --git a/images/siteicons/svg/renew.php b/images/siteicons/svg/renew.phpdeleted file mode 100644index c548c0d..0000000--- a/images/siteicons/svg/renew.php+++ /dev/null@@ -1,5 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Rotate-Left--Streamline-Plump" height="48" width="48">- <g id="rotate-left">- <path id="Union" class="accent-color" fill-rule="evenodd" d="M46.002 24.252C46.002 12.235 36.277 2 24.282 2c-6.843 0 -13.34 2.924 -17.495 7.768A73.686 73.686 0 0 0 4.274 8.47c-1.207 -0.59 -2.41 0.295 -2.262 1.632 0.58 5.209 1.925 8.672 2.66 10.248 0.289 0.62 0.912 0.98 1.594 0.92 1.73 -0.15 5.397 -0.715 10.19 -2.817 1.23 -0.54 1.396 -2.022 0.283 -2.774a71.485 71.485 0 0 0 -2.14 -1.383c2.48 -2.629 5.77 -4.384 9.682 -4.384 8.18 0 14.81 6.147 14.81 14.34 0 3.568 -1.258 6.842 -3.354 9.401 -0.626 0.765 -0.74 1.858 -0.167 2.664l1.758 2.474c0.687 0.967 2.067 1.13 2.874 0.26a21.7 21.7 0 0 0 5.8 -14.8ZM20.105 43.407c-0.165 1.149 -1.276 1.925 -2.377 1.558a19.778 19.778 0 0 1 -7.423 -4.488c-0.798 -0.763 -0.698 -2.034 0.138 -2.755l1.74 -1.501c0.738 -0.636 1.82 -0.638 2.63 -0.095A17.801 17.801 0 0 0 19 38.193c0.99 0.335 1.668 1.298 1.52 2.332l-0.415 2.882ZM8.891 35.146c-0.92 0.793 -2.335 0.591 -2.885 -0.492a23.216 23.216 0 0 1 -1.433 -3.517c-0.473 -1.499 0.722 -2.93 2.294 -2.93 1.132 0 2.102 0.77 2.573 1.8 0.223 0.489 0.48 0.965 0.765 1.426 0.573 0.927 0.485 2.16 -0.34 2.873l-0.974 0.84Zm25.595 8.315c0.998 -0.53 1.232 -1.82 0.578 -2.74l-1.711 -2.408c-0.618 -0.87 -1.806 -1.088 -2.772 -0.634a14.894 14.894 0 0 1 -5.063 1.354c-1.019 0.086 -1.907 0.81 -2.053 1.823l-0.427 2.972c-0.165 1.148 0.681 2.205 1.841 2.171a21.847 21.847 0 0 0 9.607 -2.538Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>\ No newline at end of filediff --git a/images/siteicons/svg/save.php b/images/siteicons/svg/save.phpdeleted file mode 100644index 8053db6..0000000--- a/images/siteicons/svg/save.php+++ /dev/null@@ -1,9 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="File-Check-Alternate--Streamline-Plump.svg" height="48" width="48">- <desc>File Check Alternate Streamline Icon: https://streamlinehq.com</desc>- <g id="file-check-alternate--file-common-check">- <path id="Subtract" class="accent-color" d="M13.582 2.137C16.326 1.823 20.685 1.5 27 1.5a165 165 0 0 1 5.13 0.077 1.5 1.5 0 0 1 0.4 0.068c1.098 0.343 4.029 1.564 8.123 5.578 3.862 3.787 5.195 6.563 5.63 7.781a1.5 1.5 0 0 1 0.087 0.45c0.08 2.153 0.13 4.655 0.13 7.546 0 7.57 -0.343 12.478 -0.669 15.432 -0.32 2.9 -2.518 5.1 -5.413 5.431 -2.744 0.314 -7.103 0.637 -13.418 0.637 -1.044 0 -2.035 -0.009 -2.974 -0.025A14.458 14.458 0 0 0 28.5 34c0 -8.008 -6.492 -14.5 -14.5 -14.5a14.44 14.44 0 0 0 -6.492 1.531c0.053 -6.464 0.364 -10.773 0.66 -13.463 0.32 -2.9 2.519 -5.1 5.414 -5.431Z" stroke-width="1"></path>- <path id="Intersect" class="main-color" d="M46.348 15.25c-2.42 -0.001 -6.57 -0.04 -8.948 -0.268 -2.598 -0.249 -4.641 -2.321 -4.896 -4.975 -0.214 -2.233 -0.253 -5.99 -0.254 -8.421 0.095 0.01 0.188 0.03 0.28 0.059 1.098 0.343 4.029 1.564 8.123 5.578 3.862 3.787 5.195 6.563 5.63 7.781 0.029 0.08 0.05 0.163 0.065 0.246Z" stroke-width="1"></path>- <path id="Subtract_2" class="main-color" fill-rule="evenodd" d="M14 46c6.627 0 12 -5.373 12 -12s-5.373 -12 -12 -12S2 27.373 2 34s5.373 12 12 12Z" clip-rule="evenodd" stroke-width="1"></path>- <path id="Subtract_3" class="accent-color" fill-rule="evenodd" d="M20.611 31.185a2 2 0 1 0 -3.222 -2.37l-4.413 6.002L10.5 32.01a2 2 0 0 0 -3 2.647l4.118 4.666a2 2 0 0 0 3.111 -0.138l5.882 -8Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>diff --git a/images/siteicons/svg/subscription.php b/images/siteicons/svg/subscription.phpdeleted file mode 100644index 6e65569..0000000--- a/images/siteicons/svg/subscription.php+++ /dev/null@@ -1,8 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Layers-1--Streamline-Plump.svg" height="48" width="48">- <desc>Layers 1 Streamline Icon: https://streamlinehq.com</desc>- <g id="layers-1--design-layer-layers-pile-stack-align">- <path id="Union" class="accent-color" d="M25.65 22.818a7.074 7.074 0 0 0 -3.3 0c-2.005 0.48 -6.01 1.62 -10.995 3.994 -3.882 1.848 -6.57 3.453 -8.228 4.542 -1.945 1.28 -1.945 4.012 0 5.29 1.657 1.09 4.346 2.695 8.228 4.543 4.984 2.373 8.99 3.514 10.995 3.994 1.087 0.26 2.212 0.26 3.3 0 2.005 -0.48 6.01 -1.62 10.995 -3.994 3.881 -1.848 6.57 -3.453 8.228 -4.543 1.945 -1.278 1.945 -4.01 0 -5.29 -1.658 -1.09 -4.346 -2.694 -8.228 -4.542 -4.985 -2.374 -8.99 -3.515 -10.995 -3.994Z" stroke-width="1"></path>- <path id="Union_2" class="main-color" d="M25.65 12.818a7.074 7.074 0 0 0 -3.3 0c-2.005 0.48 -6.01 1.62 -10.995 3.994 -3.882 1.848 -6.57 3.453 -8.228 4.542 -1.945 1.28 -1.945 4.012 0 5.29 1.657 1.09 4.346 2.695 8.228 4.543 4.984 2.373 8.99 3.514 10.995 3.994 1.087 0.26 2.212 0.26 3.3 0 2.005 -0.48 6.01 -1.62 10.995 -3.994 3.881 -1.849 6.57 -3.453 8.228 -4.543 1.945 -1.278 1.945 -4.01 0 -5.29 -1.658 -1.09 -4.346 -2.694 -8.228 -4.542 -4.985 -2.374 -8.99 -3.515 -10.995 -3.994Z" stroke-width="1"></path>- <path id="Union_3" class="accent-color" d="M25.65 2.818a7.076 7.076 0 0 0 -3.3 0c-2.005 0.48 -6.01 1.62 -10.995 3.994 -3.882 1.848 -6.57 3.453 -8.228 4.542 -1.945 1.28 -1.945 4.012 0 5.29 1.658 1.09 4.346 2.695 8.228 4.543 4.984 2.373 8.99 3.514 10.995 3.993 1.088 0.26 2.212 0.26 3.3 0 2.005 -0.479 6.01 -1.62 10.995 -3.993 3.882 -1.849 6.57 -3.453 8.228 -4.543 1.945 -1.278 1.945 -4.01 0 -5.29 -1.658 -1.09 -4.346 -2.694 -8.228 -4.542 -4.984 -2.374 -8.99 -3.514 -10.995 -3.994Z" stroke-width="1"></path>- </g>-</svg>\ No newline at end of filediff --git a/images/siteicons/svg/web.php b/images/siteicons/svg/web.phpdeleted file mode 100644index 6a40ce5..0000000--- a/images/siteicons/svg/web.php+++ /dev/null@@ -1,7 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Web--Streamline-Plump.svg" height="48" width="48">- <desc>Web Streamline Icon: https://streamlinehq.com</desc>- <g id="web--server-world-internet-earth-www-globe-worldwide-web-network">- <path id="Union" class="accent-color" d="M24 1.5C11.574 1.5 1.5 11.574 1.5 24S11.574 46.5 24 46.5 46.5 36.426 46.5 24 36.426 1.5 24 1.5Z" stroke-width="1"></path>- <path id="Intersect" class="main-color" fill-rule="evenodd" d="M17.091 32.5c0.443 3.068 1.116 5.815 1.952 8.076 0.779 2.106 1.67 3.713 2.585 4.765 0.486 0.558 0.94 0.92 1.355 1.137a22.473 22.473 0 0 1 -4.769 -0.729c-0.75 -1.184 -1.412 -2.584 -1.985 -4.133 -0.957 -2.589 -1.7 -5.694 -2.167 -9.116H3.16a22.332 22.332 0 0 1 -0.984 -3H13.73a64.97 64.97 0 0 1 -0.23 -5.5c0 -1.881 0.08 -3.722 0.231 -5.5H2.177c0.259 -1.03 0.588 -2.032 0.984 -3h10.903c0.469 -3.422 1.214 -6.527 2.173 -9.116 0.574 -1.55 1.237 -2.951 1.988 -4.136a22.475 22.475 0 0 1 4.764 -0.726c-0.413 0.217 -0.866 0.579 -1.352 1.137 -0.914 1.053 -1.807 2.66 -2.587 4.766 -0.837 2.262 -1.512 5.008 -1.957 8.075h13.813c-0.445 -3.067 -1.12 -5.813 -1.957 -8.075 -0.78 -2.106 -1.672 -3.713 -2.587 -4.766 -0.485 -0.558 -0.938 -0.92 -1.352 -1.137 1.64 0.073 3.234 0.32 4.764 0.726 0.751 1.185 1.415 2.585 1.989 4.136 0.958 2.589 1.703 5.694 2.172 9.116H44.84c0.395 0.968 0.725 1.97 0.984 3H34.268c0.152 1.778 0.232 3.619 0.232 5.5 0 1.881 -0.08 3.723 -0.231 5.5h11.554a22.319 22.319 0 0 1 -0.984 3H33.938c-0.468 3.422 -1.21 6.527 -2.167 9.116 -0.573 1.549 -1.236 2.95 -1.986 4.133a22.473 22.473 0 0 1 -4.769 0.729c0.416 -0.218 0.87 -0.58 1.355 -1.137 0.915 -1.052 1.807 -2.659 2.586 -4.765 0.836 -2.261 1.508 -5.008 1.951 -8.076H17.091ZM31.5 24c0 -1.894 -0.085 -3.736 -0.244 -5.5H16.743A61.529 61.529 0 0 0 16.5 24a61.8 61.8 0 0 0 0.242 5.5h14.516A61.8 61.8 0 0 0 31.5 24Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>diff --git a/images/siteicons/svg/websearch.php b/images/siteicons/svg/websearch.phpdeleted file mode 100644index dc180da..0000000--- a/images/siteicons/svg/websearch.php+++ /dev/null@@ -1,8 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Search-Visual--Streamline-Plump.svg" height="48" width="48">- <desc>Search Visual Streamline Icon: https://streamlinehq.com</desc>- <g id="search-visual">- <path id="Subtract" class="main-color" fill-rule="evenodd" d="M35 22c0 2.542 -0.73 4.913 -1.99 6.916l0.55 0.456c1.205 1 2.393 1.984 3.564 3.078 1.158 1.082 1.302 2.718 0.207 3.863a32.717 32.717 0 0 1 -1.018 1.018c-1.145 1.095 -2.781 0.951 -3.863 -0.207 -1.094 -1.171 -2.078 -2.358 -3.078 -3.565l-0.456 -0.55A12.939 12.939 0 0 1 22 35c-7.18 0 -13 -5.82 -13 -13S14.82 9 22 9s13 5.82 13 13Z" clip-rule="evenodd" stroke-width="1"></path>- <path id="Subtract_2" class="accent-color" fill-rule="evenodd" d="M14.5 22a7.5 7.5 0 1 1 15 0 7.5 7.5 0 0 1 -15 0Z" clip-rule="evenodd" stroke-width="1"></path>- <path id="Union" class="accent-color" fill-rule="evenodd" d="M13.924 1.501a2.5 2.5 0 1 1 0.152 4.998l-6.31 0.192A1.159 1.159 0 0 0 6.69 7.765l-0.19 6.311a2.5 2.5 0 1 1 -4.998 -0.152l0.194 -6.357 0.003 -0.072a6.16 6.16 0 0 1 5.87 -5.8l6.356 -0.194Zm27.577 32.423a2.5 2.5 0 1 1 4.998 0.152l-0.194 6.357 -0.003 0.072a6.16 6.16 0 0 1 -5.87 5.8l-6.356 0.194a2.5 2.5 0 0 1 -0.152 -4.998l6.31 -0.192a1.158 1.158 0 0 0 1.075 -1.074l0.192 -6.311ZM3.924 31.5a2.5 2.5 0 0 1 2.575 2.423l0.192 6.311a1.159 1.159 0 0 0 1.074 1.074l6.311 0.192a2.5 2.5 0 1 1 -0.152 4.998l-6.356 -0.194 -0.072 -0.003a6.16 6.16 0 0 1 -5.801 -5.87L1.5 34.077a2.5 2.5 0 0 1 2.423 -2.575ZM31.5 3.924a2.5 2.5 0 0 1 2.575 -2.423l6.356 0.194 0.072 0.003a6.16 6.16 0 0 1 5.801 5.87l0.194 6.356a2.5 2.5 0 0 1 -4.998 0.152l-0.192 -6.311a1.158 1.158 0 0 0 -1.074 -1.074l-6.311 -0.192A2.5 2.5 0 0 1 31.5 3.924Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>\ No newline at end of filediff --git a/includes/ai_client.php b/includes/ai_client.phpnew file mode 100644index 0000000..ef5fe62--- /dev/null+++ b/includes/ai_client.php@@ -0,0 +1,166 @@+<?php+/*+ Shared AI provider client for the endpoints in endpoints/ai/.+ Callers must have loaded connect_endpoint.php (for $db) and ssrf_helper.php.+*/++function ai_load_settings($db, $userId)+{+ $stmt = $db->prepare("SELECT * FROM ai_settings WHERE user_id = ?");+ $stmt->bindValue(1, $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ $aiSettings = $result->fetchArray(SQLITE3_ASSOC);+ $stmt->close();++ return $aiSettings ?: null;+}++/*+ Validates the settings and runs one completion request against the configured provider.+ Returns ["success" => true, "content" => string]+ or ["success" => false, "message" => string].+*/+function ai_complete($aiSettings, $prompt, $db, $i18n, $userId)+{+ $type = $aiSettings['type'] ?? '';+ $enabled = !empty($aiSettings['enabled']);+ $model = $aiSettings['model'] ?? '';+ $host = $aiSettings['url'] ?? '';+ $apiKey = $aiSettings['api_key'] ?? '';++ if (!in_array($type, ['chatgpt', 'gemini', 'openrouter', 'ollama', 'openai-compatible']) || !$enabled || empty($model)) {+ return ["success" => false, "message" => translate('error', $i18n)];+ }++ $ssrf = null;++ // Host-based providers+ if (in_array($type, ['ollama', 'openai-compatible'])) {+ if (empty($host)) {+ return ["success" => false, "message" => translate('invalid_host', $i18n)];+ }++ $parsedUrl = parse_url($host);+ if (+ !isset($parsedUrl['scheme']) ||+ !in_array(strtolower($parsedUrl['scheme']), ['http', 'https']) ||+ !filter_var($host, FILTER_VALIDATE_URL)+ ) {+ return ["success" => false, "message" => translate('invalid_host', $i18n)];+ }++ $ssrf = validate_webhook_url_for_ssrf($host, $db, $i18n, $userId);++ if ($type === 'ollama') {+ $apiKey = '';+ }+ } else {+ if (empty($apiKey)) {+ return ["success" => false, "message" => translate('invalid_api_key', $i18n)];+ }+ }++ $ch = curl_init();++ if ($type === 'ollama') {+ curl_setopt($ch, CURLOPT_URL, rtrim($host, '/') . '/api/generate');+ curl_setopt($ch, CURLOPT_RESOLVE, ["{$ssrf['host']}:{$ssrf['port']}:{$ssrf['ip']}"]);+ curl_setopt($ch, CURLOPT_POST, true);+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'model' => $model,+ 'prompt' => $prompt,+ 'stream' => false,+ ]));+ } elseif ($type === 'openai-compatible') {+ $headers = ['Content-Type: application/json'];+ if (!empty($apiKey)) {+ $headers[] = 'Authorization: Bearer ' . $apiKey;+ }++ curl_setopt($ch, CURLOPT_URL, rtrim($host, '/') . '/chat/completions');+ curl_setopt($ch, CURLOPT_POST, true);+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'model' => $model,+ 'messages' => [['role' => 'user', 'content' => $prompt]],+ ]));+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);++ if ($ssrf) {+ curl_setopt($ch, CURLOPT_RESOLVE, ["{$ssrf['host']}:{$ssrf['port']}:{$ssrf['ip']}"]);+ }+ } else {+ $headers = ['Content-Type: application/json'];++ if ($type === 'chatgpt') {+ $headers[] = 'Authorization: Bearer ' . $apiKey;+ curl_setopt($ch, CURLOPT_URL, 'https://api.openai.com/v1/chat/completions');+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'model' => $model,+ 'messages' => [['role' => 'user', 'content' => $prompt]],+ ]));+ } elseif ($type === 'gemini') {+ curl_setopt(+ $ch,+ CURLOPT_URL,+ 'https://generativelanguage.googleapis.com/v1beta/models/' .+ urlencode($model) . ':generateContent?key=' . urlencode($apiKey)+ );+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'contents' => [[+ 'parts' => [['text' => $prompt]],+ ]],+ ]));+ } elseif ($type === 'openrouter') {+ $headers[] = 'Authorization: Bearer ' . $apiKey;+ curl_setopt($ch, CURLOPT_URL, 'https://openrouter.ai/api/v1/chat/completions');+ curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([+ 'model' => $model,+ 'messages' => [['role' => 'user', 'content' => $prompt]],+ ]));+ }++ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);+ }++ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);+ curl_setopt($ch, CURLOPT_TIMEOUT, 300);++ $reply = curl_exec($ch);++ if (curl_errno($ch)) {+ return ["success" => false, "message" => curl_error($ch)];+ }++ unset($ch);++ $replyData = json_decode($reply, true);+ $content = null;++ if (in_array($type, ['chatgpt', 'openrouter', 'openai-compatible'])+ && isset($replyData['choices'][0]['message']['content'])) {+ $content = $replyData['choices'][0]['message']['content'];+ } elseif ($type === 'gemini'+ && isset($replyData['candidates'][0]['content']['parts'][0]['text'])) {+ $content = $replyData['candidates'][0]['content']['parts'][0]['text'];+ } elseif ($type === 'ollama') {+ $content = $replyData['response'] ?? null;+ }++ if ($content === null) {+ return ["success" => false, "message" => translate('error', $i18n)];+ }++ return ["success" => true, "content" => $content];+}++/*+ Strips markdown code fences and decodes the model's JSON reply.+ Returns the decoded value, or null when it isn't valid JSON.+*/+function ai_extract_json($content)+{+ $content = preg_replace('/^```json\s*|\s*```$/m', '', $content);+ $content = preg_replace('/^```\s*|\s*```$/m', '', $content);++ return json_decode(trim($content), true);+}diff --git a/includes/gd_background_removal.php b/includes/gd_background_removal.phpnew file mode 100644index 0000000..b7f0375--- /dev/null+++ b/includes/gd_background_removal.php@@ -0,0 +1,103 @@+<?php+/*+ GD fallback equivalent of Imagick::transparentPaintImage() with fuzz:+ makes every pixel within the tolerance of the given color fully transparent.+ Used by the logo/icon upload endpoints when the imagick extension is missing.+*/+function gdRemoveBackgroundColor($image, $backgroundRed, $backgroundGreen, $backgroundBlue, $fuzz = 0.1)+{+ // On palette images imagecolorat() returns palette indexes, not RGB values+ if (!imageistruecolor($image)) {+ imagepalettetotruecolor($image);+ }++ $width = imagesx($image);+ $height = imagesy($image);++ imagealphablending($image, false);+ imagesavealpha($image, true);++ $transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);+ $maxChannelDelta = (int) round(255 * $fuzz);+ $maxDistanceSquared = 3 * $maxChannelDelta * $maxChannelDelta;++ for ($y = 0; $y < $height; $y++) {+ for ($x = 0; $x < $width; $x++) {+ $color = imagecolorat($image, $x, $y);+ $red = ($color >> 16) & 0xFF;+ $green = ($color >> 8) & 0xFF;+ $blue = $color & 0xFF;++ $distanceSquared = ($red - $backgroundRed) ** 2+ + ($green - $backgroundGreen) ** 2+ + ($blue - $backgroundBlue) ** 2;++ if ($distanceSquared <= $maxDistanceSquared) {+ imagesetpixel($image, $x, $y, $transparent);+ }+ }+ }+}++function gdCropTransparent($image, $padding = 2)+{+ if (!imageistruecolor($image)) {+ imagepalettetotruecolor($image);+ }++ $width = imagesx($image);+ $height = imagesy($image);++ $top = null;+ $bottom = null;+ $left = null;+ $right = null;++ for ($y = 0; $y < $height; $y++) {+ for ($x = 0; $x < $width; $x++) {+ $color = imagecolorat($image, $x, $y);+ $alpha = ($color >> 24) & 0x7F; // 0 is fully opaque, 127 is fully transparent+ if ($alpha < 125) { // Pixel is not fully transparent (threshold 125 out of 127)+ if ($top === null) {+ $top = $y;+ }+ $bottom = $y;+ if ($left === null || $x < $left) {+ $left = $x;+ }+ if ($right === null || $x > $right) {+ $right = $x;+ }+ }+ }+ }++ if ($top === null) {+ // Image is completely transparent, do nothing+ return $image;+ }++ $newWidth = $right - $left + 1;+ $newHeight = $bottom - $top + 1;++ $left = max(0, $left - $padding);+ $top = max(0, $top - $padding);+ $newWidth = min($width - $left, $newWidth + ($padding * 2));+ $newHeight = min($height - $top, $newHeight + ($padding * 2));++ $cropped = imagecrop($image, [+ 'x' => $left,+ 'y' => $top,+ 'width' => $newWidth,+ 'height' => $newHeight+ ]);++ if ($cropped !== false) {+ imagealphablending($cropped, false);+ imagesavealpha($cropped, true);+ imagedestroy($image);+ return $cropped;+ }++ return $image;+}diff --git a/includes/header.php b/includes/header.phpindex de79151..4a28bc6 100644--- a/includes/header.php+++ b/includes/header.php@@ -85,7 +85,7 @@ $mobileNavigation = $settings['mobile_nav'] ? "mobile-navigation" : "";<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Wallos - Subscription Tracker</title><meta name="apple-mobile-web-app-title" content="Wallos">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" id="theme-color" /><meta name="referrer" content="no-referrer"><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16"><link rel="apple-touch-icon" href="images/icon/apple-touch-icon.png">@@ -151,6 +151,7 @@ $mobileNavigation = $settings['mobile_nav'] ? "mobile-navigation" : "";?><script type="text/javascript" src="scripts/i18n/<?= $lang ?>.js?<?= $version ?>"></script><script type="text/javascript" src="scripts/i18n/getlang.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/password-toggle.js?<?= $version ?>"></script><script>if ('serviceWorker' in navigator && navigator.serviceWorker.controller) {if (!sessionStorage.getItem('sw_prefetched')) {diff --git a/includes/i18n/ca.php b/includes/i18n/ca.phpindex b8b9117..351519f 100644--- a/includes/i18n/ca.php+++ b/includes/i18n/ca.php@@ -163,7 +163,7 @@ $i18n = ["file_type_error" => "El fitxer ha de ser una imatge en format PNG, JPG, WEBP o SVG","user_details" => "Detalls de l'Usuari","two_factor_authentication" => "Autenticació de Dos Factors",- "two_factor_info" => "L'autenticació de dos factors afegeix una capa addicional de seguretat al teu compte, <br> Necessitaràs una aplicació d’autenticació com Google Authenticator, Authy o Ente Auth per escanejar en codi QR.",+ "two_factor_info" => "L'autenticació de dos factors afegeix una capa addicional de seguretat al teu compte, <br> Necessitaràs una aplicació d’autenticació com Google Authenticator, Authy o Ente Auth per escanejar el codi QR.","two_factor_enabled_info" => "El teu compte està segur amb l'autenticació de dos factors. Pots desactivar-la fent clic al botó de dalt.","enable_two_factor_authentication" => "Activar Autenticació de Dos Factors","2fa_already_enabled" => "L'autenticació de dos factors ja està activada",@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Ometre l'inici de sessió. Si executes el teu servidor en una xarxa local, sense accés extern, pots desactivar l'inici de sessió. Això farà que s'iniciï automàticament la sessió de l'usuari administrador.","disable_login_info2" => "Només pots activar aquesta opció si el registre d'usuaris està desactivat i només hi ha el compte de l'usuari administrador.","max_users_info" => "0 per il·limitat",+ "registrations_disable_login_info" => "Al activar el registre d'usuaris, l'opció per desactivar l'inici de sessió no estarà disponible.","user_management" => "Gestió d'Usuaris","delete_user" => "Eliminar Usuari","delete_user_info" => "Al eliminar un usuari també s'eliminen totes les seves subscripcions i configuracions.",@@ -442,6 +443,38 @@ $i18n = ["insert_totp_code" => "Introdueix el codi TOTP",+ "auth_tagline" => "Sàpigues on van els teus diners.",+ "auth_tagline_sub" => "Controla les teves subscripcions, consulta les teves despeses i no et perdis cap renovació.",+ "overview" => "Resum",+ "trends_and_forecast" => "Tendències i previsió",+ "history_and_lifetime" => "Historial i total",+ "cost_per_day" => "Cost per dia",+ "median_monthly_cost" => "Mediana del cost mensual de subscripció",+ "cheapest_subscription" => "Subscripció més barata",+ "vs_last_month" => "vs el mes passat",+ "heaviest_month" => "Mes vinent més car",+ "months_over_budget" => "Mesos per sobre del pressupost (propers 12)",+ "manual_renewals" => "Renovacions manuals",+ "all_time_spend" => "Despesa total (est.)",+ "oldest_subscription" => "Subscripció més antiga (anys)",+ "average_subscription_age" => "Antiguitat mitjana de les subscripcions (anys)",+ "projected_cost" => "Cost projectat (propers 12 mesos)",+ "lifetime_spend" => "Despesa acumulada (Top 10, est.)",+ "billing_cycle_split" => "Distribució per cicle de facturació",+ "currency_split" => "Distribució per moneda",+ "price_distribution" => "Distribució de preus",+ "subscriptions_count" => "Subscripcions",+ "new_subscriptions_per_year" => "Subscripcions noves per any",+ "estimated_from_current_prices" => "Estimat a partir dels preus actuals",+ "translate_categories" => "Tradueix amb IA",+ "week_starts_on_sunday" => "Comença la setmana en diumenge al calendari",+ "list_view" => "Vista de llista",+ "grid_view" => "Vista de graella",+ "no_account_yet" => "Encara no tens un compte?",+ "already_have_account" => "Ja tens un compte?",+ "google_search_info" => "Afegeix resultats d'imatges de Google (via SerpAPI) com a font addicional a la cerca de logotips. Crea un compte gratuït de SerpAPI i enganxa aquí la teva clau API.",+ "monthly_searches_used" => "Cerques utilitzades aquest mes",+ "monthly_requests_used" => "Peticions d'API utilitzades aquest mes",];diff --git a/includes/i18n/cs.php b/includes/i18n/cs.phpindex 4fca584..254ad40 100644--- a/includes/i18n/cs.php+++ b/includes/i18n/cs.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Obejít přihlášení. Pokud provozujete server pouze v místní síti bez přístupu zvenčí, můžete přihlášení zakázat. Tím se automaticky přihlásí uživatel administrátor.","disable_login_info2" => "Toto nastavení můžete povolit pouze v případě, že je registrace uživatelů zakázána a že existuje pouze uživatelský účet administrátora.","max_users_info" => "0 znamená neomezeně",+ "registrations_disable_login_info" => "Povolením registrace uživatelů nebude nastavení pro zakázání přihlášení k dispozici.","user_management" => "Správa uživatelů","delete_user" => "Odstranit uživatele","delete_user_info" => "Odstraněním uživatele se odstraní také všechna jeho předplatná a nastavení.",@@ -442,6 +443,38 @@ $i18n = ["insert_totp_code" => "Vložte kód TOTP",+ "auth_tagline" => "Vězte, kam jdou vaše peníze.",+ "auth_tagline_sub" => "Sledujte svá předplatná, mějte přehled o výdajích a nezmeškejte žádné obnovení.",+ "overview" => "Přehled",+ "trends_and_forecast" => "Trendy a předpověď",+ "history_and_lifetime" => "Historie a celkem",+ "cost_per_day" => "Náklady na den",+ "median_monthly_cost" => "Medián měsíčních nákladů na předplatné",+ "cheapest_subscription" => "Nejlevnější předplatné",+ "vs_last_month" => "oproti minulému měsíci",+ "heaviest_month" => "Nejnákladnější nadcházející měsíc",+ "months_over_budget" => "Měsíce nad rozpočet (příštích 12)",+ "manual_renewals" => "Ruční obnovení",+ "all_time_spend" => "Celkové výdaje (odhad)",+ "oldest_subscription" => "Nejstarší předplatné (roky)",+ "average_subscription_age" => "Průměrné stáří předplatných (roky)",+ "projected_cost" => "Předpokládané náklady (příštích 12 měsíců)",+ "lifetime_spend" => "Celkové výdaje (Top 10, odhad)",+ "billing_cycle_split" => "Rozdělení podle fakturačního cyklu",+ "currency_split" => "Rozdělení podle měny",+ "price_distribution" => "Rozložení cen",+ "subscriptions_count" => "Předplatná",+ "new_subscriptions_per_year" => "Nová předplatná za rok",+ "estimated_from_current_prices" => "Odhad podle aktuálních cen",+ "translate_categories" => "Přeložit pomocí AI",+ "week_starts_on_sunday" => "Začínat týden v kalendáři nedělí",+ "list_view" => "Zobrazení seznamu",+ "grid_view" => "Zobrazení mřížky",+ "no_account_yet" => "Ještě nemáte účet?",+ "already_have_account" => "Už máte účet?",+ "google_search_info" => "Přidá výsledky obrázků Google (přes SerpAPI) jako další zdroj při vyhledávání log. Vytvořte si bezplatný účet SerpAPI a vložte sem svůj API klíč.",+ "monthly_searches_used" => "Vyhledávání použitá tento měsíc",+ "monthly_requests_used" => "API požadavky použité tento měsíc",];diff --git a/includes/i18n/da.php b/includes/i18n/da.phpindex cb59310..1cdac47 100644--- a/includes/i18n/da.php+++ b/includes/i18n/da.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Omgå login. Hvis din server kun kører på et lokalt netværk uden ekstern adgang, kan du deaktivere login. Dette logger automatisk admin-brugeren ind.","disable_login_info2" => "Du kan kun aktivere denne indstilling, hvis brugerregistrering er deaktiveret, og der ikke er mere end én (admin) brugerkonto.","max_users_info" => "0 betyder ubegrænset",+ "registrations_disable_login_info" => "Ved at aktivere brugerregistrering vil indstillingen for at deaktivere login ikke være tilgængelig.","user_management" => "Brugeradministration","delete_user" => "Slet bruger","delete_user_info" => "Sletning af en bruger vil også slette alle deres abonnementer og indstillinger.",@@ -441,5 +442,37 @@ $i18n = ["over_budget_warning" => "Du er over budget",// TOTP Page"insert_totp_code" => "Indtast TOTP-kode",+ "auth_tagline" => "Vid, hvor dine penge går hen.",+ "auth_tagline_sub" => "Hold styr på dine abonnementer, se dit forbrug, og gå aldrig glip af en fornyelse.",+ "overview" => "Overblik",+ "trends_and_forecast" => "Tendenser og prognose",+ "history_and_lifetime" => "Historik og samlet",+ "cost_per_day" => "Omkostning pr. dag",+ "median_monthly_cost" => "Median månedlig abonnementsudgift",+ "cheapest_subscription" => "Billigste abonnement",+ "vs_last_month" => "ift. sidste måned",+ "heaviest_month" => "Dyreste kommende måned",+ "months_over_budget" => "Måneder over budget (næste 12)",+ "manual_renewals" => "Manuelle fornyelser",+ "all_time_spend" => "Samlet forbrug (est.)",+ "oldest_subscription" => "Ældste abonnement (år)",+ "average_subscription_age" => "Gennemsnitlig abonnementsalder (år)",+ "projected_cost" => "Forventet udgift (næste 12 måneder)",+ "lifetime_spend" => "Samlet forbrug (top 10, est.)",+ "billing_cycle_split" => "Fordeling efter betalingscyklus",+ "currency_split" => "Fordeling efter valuta",+ "price_distribution" => "Prisfordeling",+ "subscriptions_count" => "Abonnementer",+ "new_subscriptions_per_year" => "Nye abonnementer pr. år",+ "estimated_from_current_prices" => "Estimeret ud fra aktuelle priser",+ "translate_categories" => "Oversæt med AI",+ "week_starts_on_sunday" => "Start ugen med søndag i kalenderen",+ "list_view" => "Listevisning",+ "grid_view" => "Gittervisning",+ "no_account_yet" => "Har du ikke en konto endnu?",+ "already_have_account" => "Har du allerede en konto?",+ "google_search_info" => "Tilføjer Google-billedresultater (via SerpAPI) som ekstra kilde i logosøgningen. Opret en gratis SerpAPI-konto, og indsæt din API-nøgle her.",+ "monthly_searches_used" => "Søgninger brugt denne måned",+ "monthly_requests_used" => "API-forespørgsler brugt denne måned",];?>diff --git a/includes/i18n/de.php b/includes/i18n/de.phpindex 93b9086..5fac00a 100644--- a/includes/i18n/de.php+++ b/includes/i18n/de.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Anmeldung umgehen. Wenn Sie Ihren Server nur in einem lokalen Netzwerk betreiben, ohne Zugriff von außen, können Sie die Anmeldung deaktivieren. Dadurch wird automatisch der Admin-Benutzer angemeldet.","disable_login_info2" => "Sie können diese Einstellung nur aktivieren, wenn die Benutzerregistrierung ausgeschaltet ist und es nicht mehr als ein Admin-Benutzerkonto gibt.","max_users_info" => "0 für unbegrenzte Anzahl an Benutzern",+ "registrations_disable_login_info" => "Wenn Sie die Benutzerregistrierung aktivieren, ist die Einstellung zum Deaktivieren der Anmeldung nicht verfügbar.","user_management" => "Benutzerverwaltung","delete_user" => "Benutzer löschen","delete_user_info" => "Durch das Löschen eines Benutzers werden auch alle seine Abonnements und Einstellungen gelöscht.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Bitte geben Sie den TOTP-Code ein",+ "auth_tagline" => "Wissen Sie, wohin Ihr Geld fließt.",+ "auth_tagline_sub" => "Behalten Sie Ihre Abonnements im Blick, sehen Sie Ihre Ausgaben und verpassen Sie keine Verlängerung.",+ "overview" => "Übersicht",+ "trends_and_forecast" => "Trends & Prognose",+ "history_and_lifetime" => "Verlauf & Gesamt",+ "cost_per_day" => "Kosten pro Tag",+ "median_monthly_cost" => "Median der monatlichen Abo-Kosten",+ "cheapest_subscription" => "Günstigstes Abonnement",+ "vs_last_month" => "ggü. Vormonat",+ "heaviest_month" => "Teuerster kommender Monat",+ "months_over_budget" => "Monate über Budget (nächste 12)",+ "manual_renewals" => "Manuelle Verlängerungen",+ "all_time_spend" => "Gesamtausgaben (geschätzt)",+ "oldest_subscription" => "Ältestes Abonnement (Jahre)",+ "average_subscription_age" => "Durchschnittliches Abo-Alter (Jahre)",+ "projected_cost" => "Prognostizierte Kosten (nächste 12 Monate)",+ "lifetime_spend" => "Gesamtausgaben (Top 10, geschätzt)",+ "billing_cycle_split" => "Verteilung nach Abrechnungszyklus",+ "currency_split" => "Verteilung nach Währung",+ "price_distribution" => "Preisverteilung",+ "subscriptions_count" => "Abonnements",+ "new_subscriptions_per_year" => "Neue Abonnements pro Jahr",+ "estimated_from_current_prices" => "Geschätzt anhand aktueller Preise",+ "translate_categories" => "Mit KI übersetzen",+ "week_starts_on_sunday" => "Woche im Kalender mit Sonntag beginnen",+ "list_view" => "Listenansicht",+ "grid_view" => "Rasteransicht",+ "daily" => "Tag(e)",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Noch kein Konto?",+ "already_have_account" => "Sie haben bereits ein Konto?",+ "google_search_info" => "Fügt Google-Bildergebnisse (über SerpAPI) als zusätzliche Quelle in der Logo-Suche hinzu. Erstellen Sie ein kostenloses SerpAPI-Konto und fügen Sie hier Ihren API-Schlüssel ein.",+ "monthly_searches_used" => "Diesen Monat verbrauchte Suchanfragen",+ "monthly_requests_used" => "Diesen Monat verbrauchte API-Anfragen",];diff --git a/includes/i18n/el.php b/includes/i18n/el.phpindex 82b7291..3b33626 100644--- a/includes/i18n/el.php+++ b/includes/i18n/el.php@@ -384,6 +384,7 @@ $i18n = ["disable_login_info" => "Παράκαμψη σύνδεσης. Εάν εκτελείτε το διακομιστή σας μόνο σε τοπικό δίκτυο, χωρίς εξωτερική πρόσβαση, μπορείτε να απενεργοποιήσετε τη σύνδεση. Αυτό θα πραγματοποιήσει αυτόματα την είσοδο του χρήστη διαχειριστή.","disable_login_info2" => "Μπορείτε να ενεργοποιήσετε αυτή τη ρύθμιση μόνο εάν η εγγραφή χρηστών είναι απενεργοποιημένη και δεν υπάρχουν περισσότεροι από το λογαριασμό χρήστη διαχειριστή.","max_users_info" => "Ο μέγιστος αριθμός χρηστών που μπορούν να εγγραφούν. Αν η τιμή είναι 0, δεν υπάρχει όριο.",+ "registrations_disable_login_info" => "Ενεργοποιώντας τις εγγραφές χρηστών, η ρύθμιση απενεργοποίησης της σύνδεσης δεν θα είναι διαθέσιμη.","user_management" => "Διαχείριση χρηστών","delete_user" => "Διαγραφή χρήστη","delete_user_info" => "Η διαγραφή ενός χρήστη θα διαγράψει επίσης όλες τις συνδρομές και τις ρυθμίσεις του.",@@ -438,6 +439,42 @@ $i18n = [// TOTP Page"insert_totp_code" => "Εισάγετε τον κωδικό TOTP",+ "auth_tagline" => "Μάθετε πού πάνε τα χρήματά σας.",+ "auth_tagline_sub" => "Παρακολουθήστε τις συνδρομές σας, δείτε τα έξοδά σας και μην χάσετε καμία ανανέωση.",+ "overview" => "Επισκόπηση",+ "trends_and_forecast" => "Τάσεις & Πρόβλεψη",+ "history_and_lifetime" => "Ιστορικό & Σύνολο",+ "cost_per_day" => "Κόστος ανά ημέρα",+ "median_monthly_cost" => "Διάμεσο μηνιαίο κόστος συνδρομής",+ "cheapest_subscription" => "Φθηνότερη συνδρομή",+ "vs_last_month" => "σε σχέση με τον προηγούμενο μήνα",+ "heaviest_month" => "Ακριβότερος επερχόμενος μήνας",+ "months_over_budget" => "Μήνες πάνω από τον προϋπολογισμό (επόμενοι 12)",+ "manual_renewals" => "Χειροκίνητες ανανεώσεις",+ "all_time_spend" => "Συνολικές δαπάνες (εκτ.)",+ "oldest_subscription" => "Παλαιότερη συνδρομή (έτη)",+ "average_subscription_age" => "Μέση ηλικία συνδρομών (έτη)",+ "projected_cost" => "Προβλεπόμενο κόστος (επόμενοι 12 μήνες)",+ "lifetime_spend" => "Συνολικές δαπάνες (Top 10, εκτ.)",+ "billing_cycle_split" => "Κατανομή ανά κύκλο χρέωσης",+ "currency_split" => "Κατανομή ανά νόμισμα",+ "price_distribution" => "Κατανομή τιμών",+ "subscriptions_count" => "Συνδρομές",+ "new_subscriptions_per_year" => "Νέες συνδρομές ανά έτος",+ "estimated_from_current_prices" => "Εκτίμηση βάσει τρεχουσών τιμών",+ "translate_categories" => "Μετάφραση με AI",+ "week_starts_on_sunday" => "Έναρξη εβδομάδας από Κυριακή στο ημερολόγιο",+ "list_view" => "Προβολή λίστας",+ "grid_view" => "Προβολή πλέγματος",+ "daily" => "Ημέρα(-ες)",+ "reminder" => "Υπενθύμιση",+ "cancellation" => "Ακύρωση",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Δεν έχετε ακόμη λογαριασμό;",+ "already_have_account" => "Έχετε ήδη λογαριασμό;",+ "google_search_info" => "Προσθέτει αποτελέσματα εικόνων Google (μέσω SerpAPI) ως επιπλέον πηγή στην αναζήτηση λογοτύπων. Δημιουργήστε δωρεάν λογαριασμό SerpAPI και επικολλήστε εδώ το κλειδί API σας.",+ "monthly_searches_used" => "Αναζητήσεις που χρησιμοποιήθηκαν αυτόν τον μήνα",+ "monthly_requests_used" => "Αιτήματα API που χρησιμοποιήθηκαν αυτόν τον μήνα",];diff --git a/includes/i18n/en.php b/includes/i18n/en.phpindex 9a17e96..f510a46 100644--- a/includes/i18n/en.php+++ b/includes/i18n/en.php@@ -1,449 +1,481 @@-<?php--$i18n = [- // Registration page- "create_account" => "You need to create an account before you're able to login",- "username" => "Username",- "password" => "Password",- "firstname" => "First name",- "lastname" => "Last name",- "email" => "Email",- "confirm_password" => "Confirm Password",- "main_currency" => "Main Currency",- "language" => "Language",- "passwords_dont_match" => "Passwords do not match",- "username_exists" => "Username already exists",- "email_exists" => "Email already exists",- "registration_failed" => "Registration failed, please try again.",- "register" => "Register",- "restore_database" => "Restore Database",- "setup_token" => "Setup Token",- "restore_database_info" => "A setup token is required to restore a backup. Retrieve it using one of the methods below:",- "setup_token_docker" => "Docker: run docker logs <container-name> and look for \"Setup token for database restore\"",- "setup_token_file" => "Bare metal: read the file db/setup_token.db on your server",- "select_backup_file" => "Select Backup File",- // Login Page- "please_login" => "Please login",- "stay_logged_in" => "Stay logged in (30 days)",- "login" => "Login",- "login_with" => "Login with",- "or" => "or",- "login_failed" => "Login details are incorrect",- "registration_successful" => "Registration successful",- "user_email_waiting_verification" => "Your email needs to be verified. Please check your email.",- // Password Reset Page- "forgot_password" => "Forgot Password",- "reset_password" => "Reset Password",- "reset_sent_check_email" => "Reset email sent. Please check your email.",- "password_reset_successful" => "Password reset successful",- // Header- "profile" => "Profile",- "dashboard" => "Dashboard",- "subscriptions" => "Subscriptions",- "stats" => "Statistics",- "settings" => "Settings",- "admin" => "Admin",- "about" => "About",- "logout" => "Logout",- // Dashboard- "hello" => "Hello",- "upcoming_payments" => "Upcoming Payments",- "no_upcoming_payments" => "You don't have any upcoming payments",- "overdue_renewals" => "Overdue Renewals",- "ai_recommendations" => "AI Recommendations",- "your_budget" => "Your Budget",- "budget" => "Budget",- "budget_used" => "Budget Used",- "over_budget" => "Over Budget",- "your_subscriptions" => "Your Subscriptions",- "your_savings" => "Your Savings",- // Subscriptions page- "subscription" => "Subscription",- "no_subscriptions_yet" => "You don't have any subscriptions yet",- "add_first_subscription" => "Add first subscription",- "new_subscription" => "New Subscription",- "search" => "Search",- "state" => "State",- "alphanumeric" => "Alphanumeric",- "sort" => "Sort",- "name" => "Name",- "last_added" => "Last Added",- "price" => "Price",- "next_payment" => "Next Payment",- "renewal_type" => "Renewal Type",- "auto_renewal" => "Auto Renewal",- "automatically_renews" => "Automatically renews",- "manual_renewal" => "Manual Renewal",- "start_date" => "Start Date",- "inactive" => "Disable Subscription",- "replaced_with" => "Replaced with",- "none" => "None",- "reminder" => "Reminder",- "cancellation" => "Cancellation",- "member" => "Member",- "category" => "Category",- "payment_method" => "Payment Method",- "Daily" => "Daily",- "Weekly" => "Weekly",- "Monthly" => "Monthly",- "Yearly" => "Yearly",- "One-time" => "One-time",- "lifetime_purchases" => "Lifetime Purchases",- "daily" => "Day(s)",- "weekly" => "Week(s)",- "monthly" => "Month(s)",- "yearly" => "Year(s)",- "one-time" => "One-time",- "payment_date" => "Payment Date",- "days" => "days",- "weeks" => "weeks",- "months" => "months",- "years" => "years",- "external_url" => "Visit External URL",- "empty_page" => "Empty Page",- "clear_filters" => "Clear Filters",- "no_matching_subscriptions" => "No matching subscriptions",- "clone" => "Clone",- "renew" => "Renew",- "calculate_next_payment_date" => "Calculate Next Payment Date",- // Subscription form- "add_subscription" => "Add subscription",- "edit_subscription" => "Edit subscription",- "subscription_name" => "Subscription name",- "logo_preview" => "Logo Preview",- "search_logo" => "Search logo on the web",- "web_search" => "Web search",- "currency" => "Currency",- "payment_every" => "Payment every",- "frequency" => "Frequency",- "cycle" => "Cycle",- "no_category" => "No category",- "paid_by" => "Paid by",- "url" => "URL",- "notes" => "Notes",- "enable_notifications" => "Enable Notifications for this subscription",- "default_value_from_settings" => "Default value from settings",- "cancellation_notification" => "Cancellation Notification",- "delete" => "Delete",- "cancel" => "Cancel",- "upload_logo" => "Upload Logo",- // Statistics page- "cant_convert_currency" => "You are using multiple currencies on your subscriptions. To have valid and accurate statistics, please set a Fixer API Key on the settings page.",- "general_statistics" => "General Statistics",- "active_subscriptions" => "Active Subscriptions",- "inactive_subscriptions" => "Inactive Subscriptions",- "monthly_cost" => "Monthly Cost",- "yearly_cost" => "Yearly Cost",- "average_monthly" => "Average Monthly Subscription Cost",- "most_expensive" => "Most Expensive Subscription Cost",- "amount_due" => "Amount due this month",- "percentage_budget_used" => "Percentage of budget used",- "budget_remaining" => "Budget Remaining",- "amount_over_budget" => "Amount over budget",- "monthly_savings" => "Monthly Savings (on inactive subscriptions)",- "yearly_savings" => "Yearly Savings (on inactive subscriptions)",- "split_views" => "Split Views",- "category_split" => "Category Split",- "household_split" => "Household Split",- "payment_method_split" => "Payment Method Split",- "total_cost_trend" => "Total Cost Trend",- "cost_vs_budget" => "Cost vs Budget",- // About page- "about_and_credits" => "About and Credits",- "credits" => "Credits",- "license" => "License",- "release_notes" => "Release Notes",- "update_available" => "Update Available",- "issues_and_requests" => "Issues and Requests",- "the_author" => "The author",- "icons" => "Icons",- "payment_icons" => "Payment Icons",- // Profile page- "upload_avatar" => "Upload Avatar",- "file_type_error" => "The file type supplied is not supported.",- "user_details" => "User Details",- "two_factor_authentication" => "Two Factor Authentication",- "two_factor_info" => "Two Factor Authentication adds an extra layer of security to your account.<br>You will need an authenticator app like Google Authenticator, Authy or Ente Auth to scan the QR code.",- "two_factor_enabled_info" => "Your account is secure with Two Factor Authentication. You can disable it by clicking the button above.",- "enable_two_factor_authentication" => "Enable Two Factor Authentication",- "2fa_already_enabled" => "Two Factor Authentication is already enabled",- "totp_code_incorrect" => "TOTP code is incorrect",- "backup_codes" => "Backup Codes",- "download_backup_codes" => "Download Backup Codes",- "copy_to_clipboard" => "Copy to clipboard",- "totp_backup_codes_info" => "These codes can be used to login if you lose access to your authenticator app.",- "disable_two_factor_authentication" => "Disable Two Factor Authentication",- "totp_code" => "TOTP Code",- "api_key" => "API Key",- "regenerate" => "Regenerate",- "api_key_info" => "The API key is used to access the API. Keep it secret.",- // Settings page- "monthly_budget" => "Monthly Budget",- "budget_info" => "Monthly budget is used to calculate statistics",- "household" => "Household",- "save_member" => "Save Member",- "delete_member" => "Delete Member",- "cant_delete_member" => "Can't delete main member",- "cant_delete_member_in_use" => "Can't delete member in use in subscription",- "household_info" => "Email field allows for household members to be notified of subscriptions about to expire.",- "notifications" => "Notifications",- "enable_email_notifications" => "Enable email notifications",- "notify_me" => "Notify me",- "day_before" => "day before",- "on_due_date" => "On due date",- "days_before" => "days before",- "smtp_address" => "SMTP Address",- "port" => "Port",- "tls" => "TLS",- "ssl" => "SSL",- "smtp_username" => "SMTP Username",- "smtp_password" => "SMTP Password",- "from_email" => "From email (Optional)",- "send_to_other_emails" => "Also send notifications to the following email addresses (use ; to separate them):",- "other_emails_placeholder" => "[email protected];[email protected]",- "smtp_info" => "SMTP Password is transmitted and stored in plaintext. For security, please create an account just for this.",- "telegram" => "Telegram",- "telegram_bot_token" => "Telegram Bot Token",- "telegram_chat_id" => "Telegram Chat ID",- "pushplus" => "Pushplus",- "pushplus_token" => "Pushplus Token",- "serverchan" => "Serverchan",- "serverchan_sendkey" => "Serverchan SendKey",- "mattermost" => "Mattermost",- "mattermost_webhook_url" => "WebHook URL",- "mattermost_bot_username" => "Bot Username",- "mattermost_bot_icon_emoji" => "Bot Icon Emoji",- "webhook" => "Webhook",- "webhook_url" => "Webhook URL",- "request_method" => "Request Method",- "custom_headers" => "Custom Headers",- "webhook_payload" => "Webhook Payload",- "payment_notifications_payload" => "Payment Notification Payload",- "cancelation_notification_payload" => "Cancelation Notification Payload",- "variables_available" => "Variables available",- "gotify" => "Gotify",- "token" => "Token",- "discord" => "Discord",- "discord_bot_username" => "Discord Bot Username",- "discord_bot_avatar_url" => "Discord Bot Avatar URL",- "pushover" => "Pushover",- "pushover_user_key" => "Pushover User Key",- "host" => "Host",- "topic" => "Topic",- "ignore_ssl_errors" => "Ignore SSL Errors",- "categories" => "Categories",- "save_category" => "Save Category",- "delete_category" => "Delete Category",- "cant_delete_category_in_use" => "Can't delete category in use in subscription",- "currencies" => "Currencies",- "save_currency" => "Save currency",- "delete_currency" => "Delete currency",- "cant_delete_main_currency" => "Can't delete main currency",- "cant_delete_currency_in_use" => "Can't delete currency in use in subscription",- "exchange_update" => "Exchange rates last updated on",- "currency_info" => "Find the supported currencies and correct currency codes on",- "currency_performance" => "For improved performance keep only the currencies you use.",- "fixer_api_key" => "Fixer API Key",- "provider" => "Provider",- "fixer_info" => "If you use multiple currencies, and want accurate statistics and sorting on the subscriptions, a FREE API Key from Fixer is necessary.",- "get_key" => "Get your key at",- "get_free_fixer_api_key" => "Get free Fixer API Key",- "get_key_alternative" => "Alternatively, you can get a free fixer api key from",- "ai_model" => "AI Model",- "select_ai_model" => "Select AI Model",- "run_schedule" => "Run Schedule",- "manually" => "Manually",- "coming_soon" => "Coming Soon",- "invalid_host" => "Invalid Host",- "ai_recommendations_info" => "AI Recommendations are generated based on your subscriptions and household members.",- "may_take_time" => "Depending on the provider, model and number of subscriptions, recommendations generation may take some time.",- "recommendations_visible_on_dashboard" => "Recommendations will be visible on the dashboard.",- "generate_recommendations" => "Generate Recommendations",- "display_settings" => "Display Settings",- "theme_settings" => "Theme Settings",- "colors" => "Colors",- "custom_colors" => "Custom Colors",- "theme" => "Theme",- "dark_theme" => "Dark Theme",- "light_theme" => "Light Theme",- "automatic"=> "Automatic",- "main_color" => "Main Color",- "accent_color" => "Accent Color",- "hover_color" => "Hover Color",- "save_custom_colors" => "Save Custom Colors",- "reset_custom_colors" => "Reset Custom Colors",- "custom_css" => "Custom CSS",- "save_custom_css" => "Save Custom CSS",- "calculate_monthly_price" => "Calculate and show monthly price for all subscriptions",- "convert_prices" => "Always convert and show prices on my main currency (slower)",- "show_original_price" => "Also show original price when conversions or calculations are made",- "experience" => "Experience",- "show_subscription_progress" => "Show subscription progress",- "week_starts_on_sunday" => "Start week on Sunday in calendar",- "disabled_subscriptions" => "Disabled Subscriptions",- "hide_disabled_subscriptions" => "Hide disabled subscriptions",- "show_disabled_subscriptions_at_the_bottom" => "Show disabled subscriptions at the bottom",- "experimental_settings" => "Experimental Settings",- "remove_background" => "Attempt to remove background of logos from image search",- "use_mobile_navigation_bar" => "Use mobile navigation bar",- "experimental_info" => "Experimental settings will probably not work perfectly.",- "payment_methods" => "Payment Methods",- "payment_methods_info" => "Click a payment method to disable / enable it.",- "rename_payment_methods_info" => "Click the name on a payment method to rename it.",- "cant_delete_payment_method_in_use" => "Can't disable used payment method",- "add_custom_payment" => "Add Custom Payment Method",- "payment_method_name" => "Payment Method Name",- "payment_method_added_successfuly" => "Payment method added successfully",- "payment_method_removed" => "Payment method removed",- "disable" => "Disable",- "enable" => "Enable",- "rename_payment_method" => "Rename Payment Method",- "payment_renamed" => "Payment method renamed",- "payment_not_renamed" => "Payment method not renamed",- "test" => "Test",- "add" => "Add",- "save" => "Save",- "reset" => "Reset",- "main_accent_color_error" => "Main and accent color can't be the same",- "backup_and_restore" => "Backup and Restore",- "backup" => "Backup",- "restore" => "Restore",- "restore_info" => "Restoring the database will override all current data. You will be signed out after the restore.",- "account" => "Account",- "export_subscriptions" => "Export Subscriptions",- "export_as_json" => "Export as JSON",- "export_as_csv" => "Export as CSV",- "danger_zone" => "Danger Zone",- "delete_account" => "Delete Account",- "delete_account_info" => "Deleting your account will also delete all your subscriptions and settings.",- // Filters menu- "filter" => "Filter",- "clear" => "Clear",- // Toast- "success" => "Success",- // Endpoint responses- "session_expired" => "Your session expired. Please login again",- "fields_missing" => "Some fields are missing",- "fill_all_fields" => "Please fill all fields",- "fill_mandatory_fields" => "Please fill all mandatory fields",- "error" => "Error",- // Category- "failed_add_category" => "Failed to add category",- "failed_edit_category" => "Failed to edit category",- "category_in_use" => "Category is in use in subscriptions and can't be removed",- "failed_remove_category" => "Failed to remove category",- "category_saved" => "Category saved",- "category_removed" => "Category removed",- "sort_order_saved" => "Sort order saved",- // Currency- "currency_saved" => "was saved.",- "error_adding_currency" => "Error adding currency entry.",- "failed_to_store_currency" => "Failed to store Currency on the Database.",- "currency_in_use" => "Currency is in use in subscriptions and can't be deleted.",- "currency_is_main" => "Currency is set as main currency and can't be deleted.",- "failed_to_remove_currency" => "Failed to remove currency from the Database.",- "failed_to_store_api_key" => "Failed to store API Key on the Database.",- "invalid_api_key" => "Invalid API Key.",- "api_key_saved" => "API key saved successfully",- "currency_removed" => "Currency removed",- // Household- "failed_add_household" => "Failed to add household member",- "failed_edit_household" => "Failed to edit household member",- "failed_remove_household" => "Failed to remove household member",- "household_in_use" => "Household member is in use in subscriptions and can't be removed",- "member_saved" => "Member saved",- "member_removed" => "Member removed",- // Notifications- "error_saving_notifications" => "Error saving notifications data.",- "wallos_notification" => "Wallos Notification",- "test_notification" => "This is a test notification. If you're seeing this, the configuration is correct.",- "email_error" => "Error sending email",- "notification_sent_successfuly" => "Notification sent successfully",- "notifications_settings_saved" => "Notification settings saved successfully.",- "notification_failed" => "Notification failed",- // Payments- "payment_in_use" => "Can't disable used payment method",- "failed_update_payment" => "Failed to update payment method in the database",- "enabled" => "enabled",- "disabled" => "disabled",- // Subscription- "error_fetching_image" => "Error fetching image",- "subscription_updated_successfuly" => "Subscription updated successfully",- "subscription_added_successfuly" => "Subscription added successfully",- "error_deleting_subscription" => "Error deleting subscription.",- "invalid_request_method" => "Invalid request method.",- // User- "error_updating_user_data" => "Error updating user data.",- "user_details_saved" => "User details saved",- // Admin Page- "registrations" => "Registrations",- "enable_user_registrations" => "Enable user registrations",- "maximum_number_users" => "Maximum number of users",- "require_email_verification" => "Require email verification",- "configure_smtp_settings_to_enable" => "Configure SMTP settings to enable",- "server_url" => "Server URL",- "server_url_info" => "Used for email verification and password recovery. Must be a valid public URL.",- "server_url_password_reset" => "If set will also enable password reset functionality.",- "disable_login" => "Disable login",- "disable_login_info" => "Bypass login. If you run your server on a local network only, without external access you can disable the login. This will automatically login the admin user.",- "disable_login_info2" => "You can only enable this setting if user registration is disabled and there are no more than the admin user account.",- "max_users_info" => "0 means unlimited",- "user_management" => "User Management",- "delete_user" => "Delete User",- "delete_user_info" => "Deleting a user will also delete all their subscriptions and settings.",- "create_user" => "Create User",- "oidc_settings" => "OIDC Settings",- "oidc_oauth_enabled" => "Enable OIDC/OAuth",- "create_user_automatically" => "Create user automatically",- "disable_password_login" => "Disable password login",- "require_email_verified_linking" => "Require verified email for account linking",- "oidc_email_not_verified" => "Login failed: your email address has not been verified by the identity provider.",- "smtp_settings" => "SMTP Settings",- "smtp_usage_info" => "Will be used for password recovery and other system emails.",- "security_settings" => "Security Settings",- "ssrf_protection_info" => "To prevent Server-Side Request Forgery (SSRF) attacks, Wallos blocks webhook notifications to private or internal network addresses by default.",- "local_webhook_info" => "If you need to send webhooks to local services (like Home Assistant, Gotify, or Node-RED), enter their IP addresses or hostnames above as a comma-separated list (e.g., <code>192.168.1.100,192.168.1.101</code>).",- "maintenance_tasks" => "Maintenance Tasks",- "orphaned_logos" => "Orphaned Logos",- "update" => "Update",- "new_version_available" => "A new version of Wallos is available",- "current_version" => "Current Version",- "latest_version" => "Latest Version",- "on_current_version" => "You're running the latest version of Wallos.",- "show_update_notification" => "Show notification for updates on the dashboard",- "cronjobs" => "Cronjobs",- // Email Verification- "email_verified" => "Email verified successfully",- "email_verification_failed" => "Email verification failed",- // Calendar- "calendar" => "Calendar",- "sun" => "Sun",- "mon" => "Mon",- "tue" => "Tue",- "wed" => "Wed",- "thu" => "Thu",- "fri" => "Fri",- "sat" => "Sat",- "month-01" => "January",- "month-02" => "February",- "month-03" => "March",- "month-04" => "April",- "month-05" => "May",- "month-06" => "June",- "month-07" => "July",- "month-08" => "August",- "month-09" => "September",- "month-10" => "October",- "month-11" => "November",- "month-12" => "December",- "total_cost" => "Total Cost",- "export_icalendar" => "Export iCalendar",- "over_budget_warning" => "You're over budget",- // TOTP Page- "insert_totp_code" => "Insert TOTP code",---];---?>+<?php++$i18n = [+ // Registration page+ "auth_tagline" => "Know where your money goes.",+ "auth_tagline_sub" => "Track your subscriptions, see your spending, and never miss a renewal.",+ "create_account" => "You need to create an account before you're able to login",+ "username" => "Username",+ "password" => "Password",+ "firstname" => "First name",+ "lastname" => "Last name",+ "email" => "Email",+ "confirm_password" => "Confirm Password",+ "main_currency" => "Main Currency",+ "language" => "Language",+ "passwords_dont_match" => "Passwords do not match",+ "username_exists" => "Username already exists",+ "email_exists" => "Email already exists",+ "registration_failed" => "Registration failed, please try again.",+ "register" => "Register",+ "restore_database" => "Restore Database",+ "setup_token" => "Setup Token",+ "restore_database_info" => "A setup token is required to restore a backup. Retrieve it using one of the methods below:",+ "setup_token_docker" => "Docker: run docker logs <container-name> and look for \"Setup token for database restore\"",+ "setup_token_file" => "Bare metal: read the file db/setup_token.db on your server",+ "select_backup_file" => "Select Backup File",+ // Login Page+ "please_login" => "Please login",+ "stay_logged_in" => "Stay logged in (30 days)",+ "login" => "Login",+ "login_with" => "Login with",+ "or" => "or",+ "login_failed" => "Login details are incorrect",+ "registration_successful" => "Registration successful",+ "user_email_waiting_verification" => "Your email needs to be verified. Please check your email.",+ // Password Reset Page+ "forgot_password" => "Forgot Password",+ "reset_password" => "Reset Password",+ "reset_sent_check_email" => "Reset email sent. Please check your email.",+ "password_reset_successful" => "Password reset successful",+ // Header+ "profile" => "Profile",+ "dashboard" => "Dashboard",+ "subscriptions" => "Subscriptions",+ "stats" => "Statistics",+ "settings" => "Settings",+ "admin" => "Admin",+ "about" => "About",+ "logout" => "Logout",+ // Dashboard+ "hello" => "Hello",+ "upcoming_payments" => "Upcoming Payments",+ "no_upcoming_payments" => "You don't have any upcoming payments",+ "overdue_renewals" => "Overdue Renewals",+ "ai_recommendations" => "AI Recommendations",+ "your_budget" => "Your Budget",+ "budget" => "Budget",+ "budget_used" => "Budget Used",+ "over_budget" => "Over Budget",+ "your_subscriptions" => "Your Subscriptions",+ "your_savings" => "Your Savings",+ // Subscriptions page+ "subscription" => "Subscription",+ "no_subscriptions_yet" => "You don't have any subscriptions yet",+ "add_first_subscription" => "Add first subscription",+ "new_subscription" => "New Subscription",+ "search" => "Search",+ "state" => "State",+ "alphanumeric" => "Alphanumeric",+ "sort" => "Sort",+ "name" => "Name",+ "last_added" => "Last Added",+ "price" => "Price",+ "next_payment" => "Next Payment",+ "renewal_type" => "Renewal Type",+ "auto_renewal" => "Auto Renewal",+ "automatically_renews" => "Automatically renews",+ "manual_renewal" => "Manual Renewal",+ "start_date" => "Start Date",+ "inactive" => "Disable Subscription",+ "replaced_with" => "Replaced with",+ "none" => "None",+ "reminder" => "Reminder",+ "cancellation" => "Cancellation",+ "member" => "Member",+ "category" => "Category",+ "payment_method" => "Payment Method",+ "Daily" => "Daily",+ "Weekly" => "Weekly",+ "Monthly" => "Monthly",+ "Yearly" => "Yearly",+ "One-time" => "One-time",+ "lifetime_purchases" => "Lifetime Purchases",+ "daily" => "Day(s)",+ "weekly" => "Week(s)",+ "monthly" => "Month(s)",+ "yearly" => "Year(s)",+ "one-time" => "One-time",+ "payment_date" => "Payment Date",+ "days" => "days",+ "weeks" => "weeks",+ "months" => "months",+ "years" => "years",+ "external_url" => "Visit External URL",+ "empty_page" => "Empty Page",+ "clear_filters" => "Clear Filters",+ "no_matching_subscriptions" => "No matching subscriptions",+ "clone" => "Clone",+ "renew" => "Renew",+ "calculate_next_payment_date" => "Calculate Next Payment Date",+ // Subscription form+ "add_subscription" => "Add subscription",+ "edit_subscription" => "Edit subscription",+ "subscription_name" => "Subscription name",+ "logo_preview" => "Logo Preview",+ "search_logo" => "Search logo on the web",+ "web_search" => "Web search",+ "currency" => "Currency",+ "payment_every" => "Payment every",+ "frequency" => "Frequency",+ "cycle" => "Cycle",+ "no_category" => "No category",+ "paid_by" => "Paid by",+ "url" => "URL",+ "notes" => "Notes",+ "enable_notifications" => "Enable Notifications for this subscription",+ "default_value_from_settings" => "Default value from settings",+ "cancellation_notification" => "Cancellation Notification",+ "delete" => "Delete",+ "cancel" => "Cancel",+ "upload_logo" => "Upload Logo",+ // Statistics page+ "cant_convert_currency" => "You are using multiple currencies on your subscriptions. To have valid and accurate statistics, please set a Fixer API Key on the settings page.",+ "general_statistics" => "General Statistics",+ "active_subscriptions" => "Active Subscriptions",+ "inactive_subscriptions" => "Inactive Subscriptions",+ "monthly_cost" => "Monthly Cost",+ "yearly_cost" => "Yearly Cost",+ "average_monthly" => "Average Monthly Subscription Cost",+ "most_expensive" => "Most Expensive Subscription Cost",+ "amount_due" => "Amount due this month",+ "percentage_budget_used" => "Percentage of budget used",+ "budget_remaining" => "Budget Remaining",+ "amount_over_budget" => "Amount over budget",+ "monthly_savings" => "Monthly Savings (on inactive subscriptions)",+ "yearly_savings" => "Yearly Savings (on inactive subscriptions)",+ "split_views" => "Split Views",+ "category_split" => "Category Split",+ "household_split" => "Household Split",+ "payment_method_split" => "Payment Method Split",+ "total_cost_trend" => "Total Cost Trend",+ "cost_vs_budget" => "Cost vs Budget",+ "overview" => "Overview",+ "trends_and_forecast" => "Trends & Forecast",+ "history_and_lifetime" => "History & Lifetime",+ "cost_per_day" => "Cost per Day",+ "median_monthly_cost" => "Median Monthly Subscription Cost",+ "cheapest_subscription" => "Cheapest Subscription Cost",+ "vs_last_month" => "vs Last Month",+ "heaviest_month" => "Heaviest Upcoming Month",+ "months_over_budget" => "Months Over Budget (Next 12)",+ "manual_renewals" => "Manual Renewals",+ "all_time_spend" => "All-Time Spend (est.)",+ "oldest_subscription" => "Oldest Subscription (Years)",+ "average_subscription_age" => "Average Subscription Age (Years)",+ "projected_cost" => "Projected Cost (Next 12 Months)",+ "lifetime_spend" => "Lifetime Spend (Top 10, est.)",+ "billing_cycle_split" => "Billing Cycle Split",+ "currency_split" => "Currency Split",+ "price_distribution" => "Price Distribution",+ "subscriptions_count" => "Subscriptions",+ "new_subscriptions_per_year" => "New Subscriptions per Year",+ "estimated_from_current_prices" => "Estimated from current prices",+ // About page+ "about_and_credits" => "About and Credits",+ "credits" => "Credits",+ "license" => "License",+ "release_notes" => "Release Notes",+ "update_available" => "Update Available",+ "issues_and_requests" => "Issues and Requests",+ "the_author" => "The author",+ "icons" => "Icons",+ "payment_icons" => "Payment Icons",+ // Profile page+ "upload_avatar" => "Upload Avatar",+ "file_type_error" => "The file type supplied is not supported.",+ "user_details" => "User Details",+ "two_factor_authentication" => "Two Factor Authentication",+ "two_factor_info" => "Two Factor Authentication adds an extra layer of security to your account.<br>You will need an authenticator app like Google Authenticator, Authy or Ente Auth to scan the QR code.",+ "two_factor_enabled_info" => "Your account is secure with Two Factor Authentication. You can disable it by clicking the button above.",+ "enable_two_factor_authentication" => "Enable Two Factor Authentication",+ "2fa_already_enabled" => "Two Factor Authentication is already enabled",+ "totp_code_incorrect" => "TOTP code is incorrect",+ "backup_codes" => "Backup Codes",+ "download_backup_codes" => "Download Backup Codes",+ "copy_to_clipboard" => "Copy to clipboard",+ "totp_backup_codes_info" => "These codes can be used to login if you lose access to your authenticator app.",+ "disable_two_factor_authentication" => "Disable Two Factor Authentication",+ "totp_code" => "TOTP Code",+ "api_key" => "API Key",+ "regenerate" => "Regenerate",+ "api_key_info" => "The API key is used to access the API. Keep it secret.",+ // Settings page+ "monthly_budget" => "Monthly Budget",+ "budget_info" => "Monthly budget is used to calculate statistics",+ "household" => "Household",+ "save_member" => "Save Member",+ "delete_member" => "Delete Member",+ "cant_delete_member" => "Can't delete main member",+ "cant_delete_member_in_use" => "Can't delete member in use in subscription",+ "household_info" => "Email field allows for household members to be notified of subscriptions about to expire.",+ "notifications" => "Notifications",+ "enable_email_notifications" => "Enable email notifications",+ "notify_me" => "Notify me",+ "day_before" => "day before",+ "on_due_date" => "On due date",+ "days_before" => "days before",+ "smtp_address" => "SMTP Address",+ "port" => "Port",+ "tls" => "TLS",+ "ssl" => "SSL",+ "smtp_username" => "SMTP Username",+ "smtp_password" => "SMTP Password",+ "from_email" => "From email (Optional)",+ "send_to_other_emails" => "Also send notifications to the following email addresses (use ; to separate them):",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "smtp_info" => "SMTP Password is transmitted and stored in plaintext. For security, please create an account just for this.",+ "telegram" => "Telegram",+ "telegram_bot_token" => "Telegram Bot Token",+ "telegram_chat_id" => "Telegram Chat ID",+ "pushplus" => "Pushplus",+ "pushplus_token" => "Pushplus Token",+ "serverchan" => "Serverchan",+ "serverchan_sendkey" => "Serverchan SendKey",+ "mattermost" => "Mattermost",+ "mattermost_webhook_url" => "WebHook URL",+ "mattermost_bot_username" => "Bot Username",+ "mattermost_bot_icon_emoji" => "Bot Icon Emoji",+ "webhook" => "Webhook",+ "webhook_url" => "Webhook URL",+ "request_method" => "Request Method",+ "custom_headers" => "Custom Headers",+ "webhook_payload" => "Webhook Payload",+ "payment_notifications_payload" => "Payment Notification Payload",+ "cancelation_notification_payload" => "Cancelation Notification Payload",+ "variables_available" => "Variables available",+ "gotify" => "Gotify",+ "token" => "Token",+ "discord" => "Discord",+ "discord_bot_username" => "Discord Bot Username",+ "discord_bot_avatar_url" => "Discord Bot Avatar URL",+ "pushover" => "Pushover",+ "pushover_user_key" => "Pushover User Key",+ "host" => "Host",+ "topic" => "Topic",+ "ignore_ssl_errors" => "Ignore SSL Errors",+ "categories" => "Categories",+ "translate_categories" => "Translate with AI",+ "save_category" => "Save Category",+ "delete_category" => "Delete Category",+ "cant_delete_category_in_use" => "Can't delete category in use in subscription",+ "currencies" => "Currencies",+ "save_currency" => "Save currency",+ "delete_currency" => "Delete currency",+ "cant_delete_main_currency" => "Can't delete main currency",+ "cant_delete_currency_in_use" => "Can't delete currency in use in subscription",+ "exchange_update" => "Exchange rates last updated on",+ "currency_info" => "Find the supported currencies and correct currency codes on",+ "currency_performance" => "For improved performance keep only the currencies you use.",+ "fixer_api_key" => "Fixer API Key",+ "provider" => "Provider",+ "fixer_info" => "If you use multiple currencies, and want accurate statistics and sorting on the subscriptions, a FREE API Key from Fixer is necessary.",+ "get_key" => "Get your key at",+ "get_free_fixer_api_key" => "Get free Fixer API Key",+ "get_key_alternative" => "Alternatively, you can get a free fixer api key from",+ "ai_model" => "AI Model",+ "select_ai_model" => "Select AI Model",+ "run_schedule" => "Run Schedule",+ "manually" => "Manually",+ "coming_soon" => "Coming Soon",+ "invalid_host" => "Invalid Host",+ "ai_recommendations_info" => "AI Recommendations are generated based on your subscriptions and household members.",+ "may_take_time" => "Depending on the provider, model and number of subscriptions, recommendations generation may take some time.",+ "recommendations_visible_on_dashboard" => "Recommendations will be visible on the dashboard.",+ "generate_recommendations" => "Generate Recommendations",+ "display_settings" => "Display Settings",+ "theme_settings" => "Theme Settings",+ "colors" => "Colors",+ "custom_colors" => "Custom Colors",+ "theme" => "Theme",+ "dark_theme" => "Dark Theme",+ "light_theme" => "Light Theme",+ "automatic"=> "Automatic",+ "main_color" => "Main Color",+ "accent_color" => "Accent Color",+ "hover_color" => "Hover Color",+ "save_custom_colors" => "Save Custom Colors",+ "reset_custom_colors" => "Reset Custom Colors",+ "custom_css" => "Custom CSS",+ "save_custom_css" => "Save Custom CSS",+ "calculate_monthly_price" => "Calculate and show monthly price for all subscriptions",+ "convert_prices" => "Always convert and show prices on my main currency (slower)",+ "show_original_price" => "Also show original price when conversions or calculations are made",+ "experience" => "Experience",+ "show_subscription_progress" => "Show subscription progress",+ "week_starts_on_sunday" => "Start week on Sunday in calendar",+ "disabled_subscriptions" => "Disabled Subscriptions",+ "hide_disabled_subscriptions" => "Hide disabled subscriptions",+ "show_disabled_subscriptions_at_the_bottom" => "Show disabled subscriptions at the bottom",+ "experimental_settings" => "Experimental Settings",+ "remove_background" => "Attempt to remove background of logos from image search",+ "use_mobile_navigation_bar" => "Use mobile navigation bar",+ "experimental_info" => "Experimental settings will probably not work perfectly.",+ "payment_methods" => "Payment Methods",+ "payment_methods_info" => "Click a payment method to disable / enable it.",+ "rename_payment_methods_info" => "Click the name on a payment method to rename it.",+ "cant_delete_payment_method_in_use" => "Can't disable used payment method",+ "add_custom_payment" => "Add Custom Payment Method",+ "payment_method_name" => "Payment Method Name",+ "payment_method_added_successfuly" => "Payment method added successfully",+ "payment_method_removed" => "Payment method removed",+ "disable" => "Disable",+ "enable" => "Enable",+ "rename_payment_method" => "Rename Payment Method",+ "payment_renamed" => "Payment method renamed",+ "payment_not_renamed" => "Payment method not renamed",+ "test" => "Test",+ "add" => "Add",+ "save" => "Save",+ "reset" => "Reset",+ "main_accent_color_error" => "Main and accent color can't be the same",+ "backup_and_restore" => "Backup and Restore",+ "backup" => "Backup",+ "restore" => "Restore",+ "restore_info" => "Restoring the database will override all current data. You will be signed out after the restore.",+ "account" => "Account",+ "export_subscriptions" => "Export Subscriptions",+ "export_as_json" => "Export as JSON",+ "export_as_csv" => "Export as CSV",+ "danger_zone" => "Danger Zone",+ "delete_account" => "Delete Account",+ "delete_account_info" => "Deleting your account will also delete all your subscriptions and settings.",+ // Filters menu+ "filter" => "Filter",+ "list_view" => "List view",+ "grid_view" => "Grid view",+ "clear" => "Clear",+ // Toast+ "success" => "Success",+ // Endpoint responses+ "session_expired" => "Your session expired. Please login again",+ "fields_missing" => "Some fields are missing",+ "fill_all_fields" => "Please fill all fields",+ "fill_mandatory_fields" => "Please fill all mandatory fields",+ "error" => "Error",+ // Category+ "failed_add_category" => "Failed to add category",+ "failed_edit_category" => "Failed to edit category",+ "category_in_use" => "Category is in use in subscriptions and can't be removed",+ "failed_remove_category" => "Failed to remove category",+ "category_saved" => "Category saved",+ "category_removed" => "Category removed",+ "sort_order_saved" => "Sort order saved",+ // Currency+ "currency_saved" => "was saved.",+ "error_adding_currency" => "Error adding currency entry.",+ "failed_to_store_currency" => "Failed to store Currency on the Database.",+ "currency_in_use" => "Currency is in use in subscriptions and can't be deleted.",+ "currency_is_main" => "Currency is set as main currency and can't be deleted.",+ "failed_to_remove_currency" => "Failed to remove currency from the Database.",+ "failed_to_store_api_key" => "Failed to store API Key on the Database.",+ "invalid_api_key" => "Invalid API Key.",+ "api_key_saved" => "API key saved successfully",+ "currency_removed" => "Currency removed",+ // Household+ "failed_add_household" => "Failed to add household member",+ "failed_edit_household" => "Failed to edit household member",+ "failed_remove_household" => "Failed to remove household member",+ "household_in_use" => "Household member is in use in subscriptions and can't be removed",+ "member_saved" => "Member saved",+ "member_removed" => "Member removed",+ // Notifications+ "error_saving_notifications" => "Error saving notifications data.",+ "wallos_notification" => "Wallos Notification",+ "test_notification" => "This is a test notification. If you're seeing this, the configuration is correct.",+ "email_error" => "Error sending email",+ "notification_sent_successfuly" => "Notification sent successfully",+ "notifications_settings_saved" => "Notification settings saved successfully.",+ "notification_failed" => "Notification failed",+ // Payments+ "payment_in_use" => "Can't disable used payment method",+ "failed_update_payment" => "Failed to update payment method in the database",+ "enabled" => "enabled",+ "disabled" => "disabled",+ // Subscription+ "error_fetching_image" => "Error fetching image",+ "subscription_updated_successfuly" => "Subscription updated successfully",+ "subscription_added_successfuly" => "Subscription added successfully",+ "error_deleting_subscription" => "Error deleting subscription.",+ "invalid_request_method" => "Invalid request method.",+ // User+ "error_updating_user_data" => "Error updating user data.",+ "user_details_saved" => "User details saved",+ // Admin Page+ "registrations" => "Registrations",+ "enable_user_registrations" => "Enable user registrations",+ "maximum_number_users" => "Maximum number of users",+ "require_email_verification" => "Require email verification",+ "configure_smtp_settings_to_enable" => "Configure SMTP settings to enable",+ "server_url" => "Server URL",+ "server_url_info" => "Used for email verification and password recovery. Must be a valid public URL.",+ "server_url_password_reset" => "If set will also enable password reset functionality.",+ "disable_login" => "Disable login",+ "disable_login_info" => "Bypass login. If you run your server on a local network only, without external access you can disable the login. This will automatically login the admin user.",+ "disable_login_info2" => "You can only enable this setting if user registration is disabled and there are no more than the admin user account.",+ "max_users_info" => "0 means unlimited",+ "registrations_disable_login_info" => "By enabling user registrations, the setting to disable login will be unavailable.",+ "user_management" => "User Management",+ "delete_user" => "Delete User",+ "delete_user_info" => "Deleting a user will also delete all their subscriptions and settings.",+ "create_user" => "Create User",+ "oidc_settings" => "OIDC Settings",+ "oidc_oauth_enabled" => "Enable OIDC/OAuth",+ "create_user_automatically" => "Create user automatically",+ "disable_password_login" => "Disable password login",+ "require_email_verified_linking" => "Require verified email for account linking",+ "oidc_email_not_verified" => "Login failed: your email address has not been verified by the identity provider.",+ "smtp_settings" => "SMTP Settings",+ "smtp_usage_info" => "Will be used for password recovery and other system emails.",+ "security_settings" => "Security Settings",+ "ssrf_protection_info" => "To prevent Server-Side Request Forgery (SSRF) attacks, Wallos blocks webhook notifications to private or internal network addresses by default.",+ "local_webhook_info" => "If you need to send webhooks to local services (like Home Assistant, Gotify, or Node-RED), enter their IP addresses or hostnames above as a comma-separated list (e.g., <code>192.168.1.100,192.168.1.101</code>).",+ "maintenance_tasks" => "Maintenance Tasks",+ "orphaned_logos" => "Orphaned Logos",+ "update" => "Update",+ "new_version_available" => "A new version of Wallos is available",+ "current_version" => "Current Version",+ "latest_version" => "Latest Version",+ "on_current_version" => "You're running the latest version of Wallos.",+ "show_update_notification" => "Show notification for updates on the dashboard",+ "cronjobs" => "Cronjobs",+ // Email Verification+ "email_verified" => "Email verified successfully",+ "email_verification_failed" => "Email verification failed",+ // Calendar+ "calendar" => "Calendar",+ "sun" => "Sun",+ "mon" => "Mon",+ "tue" => "Tue",+ "wed" => "Wed",+ "thu" => "Thu",+ "fri" => "Fri",+ "sat" => "Sat",+ "month-01" => "January",+ "month-02" => "February",+ "month-03" => "March",+ "month-04" => "April",+ "month-05" => "May",+ "month-06" => "June",+ "month-07" => "July",+ "month-08" => "August",+ "month-09" => "September",+ "month-10" => "October",+ "month-11" => "November",+ "month-12" => "December",+ "total_cost" => "Total Cost",+ "export_icalendar" => "Export iCalendar",+ "over_budget_warning" => "You're over budget",+ // TOTP Page+ "insert_totp_code" => "Insert TOTP code",+++ "no_account_yet" => "Don't have an account yet?",+ "already_have_account" => "Already have an account?",+ "google_search_info" => "Adds Google image results (via SerpAPI) as an additional source in the subscription logo search. Create a free SerpAPI account and paste your API key here.",+ "monthly_searches_used" => "Searches used this month",+ "monthly_requests_used" => "API requests used this month",+];+++?>diff --git a/includes/i18n/es.php b/includes/i18n/es.phpindex d03d6b2..870b272 100644--- a/includes/i18n/es.php+++ b/includes/i18n/es.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Omitir el inicio de sesión. Si ejecuta su servidor sólo en una red local, sin acceso externo, puede desactivar el inicio de sesión. Esto iniciará automáticamente la sesión del usuario administrador.","disable_login_info2" => "Sólo puede activar esta configuración si el registro de usuarios está desactivado y no hay más que la cuenta de usuario admin.","max_users_info" => "0 para ilimitado",+ "registrations_disable_login_info" => "Al activar los registros de usuarios, la opción para desactivar el inicio de sesión no estará disponible.","user_management" => "Gestión de Usuarios","delete_user" => "Eliminar Usuario","delete_user_info" => "Al eliminar un usuario, también se eliminarán todas sus suscripciones y configuraciones.",@@ -440,6 +441,39 @@ $i18n = [// TOTP Page"insert_totp_code" => "Introduce el código TOTP",+ "auth_tagline" => "Sepa a dónde va su dinero.",+ "auth_tagline_sub" => "Controle sus suscripciones, consulte sus gastos y no se pierda ninguna renovación.",+ "overview" => "Resumen",+ "trends_and_forecast" => "Tendencias y previsión",+ "history_and_lifetime" => "Historial y total",+ "cost_per_day" => "Coste por día",+ "median_monthly_cost" => "Mediana del coste mensual de suscripción",+ "cheapest_subscription" => "Suscripción más barata",+ "vs_last_month" => "vs mes anterior",+ "heaviest_month" => "Próximo mes más caro",+ "months_over_budget" => "Meses por encima del presupuesto (próximos 12)",+ "manual_renewals" => "Renovaciones manuales",+ "all_time_spend" => "Gasto total (est.)",+ "oldest_subscription" => "Suscripción más antigua (años)",+ "average_subscription_age" => "Antigüedad media de las suscripciones (años)",+ "projected_cost" => "Coste proyectado (próximos 12 meses)",+ "lifetime_spend" => "Gasto acumulado (Top 10, est.)",+ "billing_cycle_split" => "Distribución por ciclo de facturación",+ "currency_split" => "Distribución por moneda",+ "price_distribution" => "Distribución de precios",+ "subscriptions_count" => "Suscripciones",+ "new_subscriptions_per_year" => "Nuevas suscripciones por año",+ "estimated_from_current_prices" => "Estimado según los precios actuales",+ "translate_categories" => "Traducir con IA",+ "week_starts_on_sunday" => "Comenzar la semana en domingo en el calendario",+ "list_view" => "Vista de lista",+ "grid_view" => "Vista de cuadrícula",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "¿Aún no tiene una cuenta?",+ "already_have_account" => "¿Ya tiene una cuenta?",+ "google_search_info" => "Añade resultados de imágenes de Google (a través de SerpAPI) como fuente adicional en la búsqueda de logotipos. Cree una cuenta gratuita de SerpAPI y pegue aquí su clave API.",+ "monthly_searches_used" => "Búsquedas utilizadas este mes",+ "monthly_requests_used" => "Solicitudes de API utilizadas este mes",];diff --git a/includes/i18n/fr.php b/includes/i18n/fr.phpindex 93b55b2..c401d5e 100644--- a/includes/i18n/fr.php+++ b/includes/i18n/fr.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Contourner le login. Si vous utilisez votre serveur sur un réseau local uniquement, sans accès externe, vous pouvez désactiver le login. L'utilisateur admin se connectera automatiquement.","disable_login_info2" => "Vous ne pouvez activer ce paramètre que si l'enregistrement des utilisateurs est désactivé et qu'il n'y a pas d'autre compte utilisateur que celui de l'administrateur.","max_users_info" => "0 signifie un nombre illimité d'utilisateurs",+ "registrations_disable_login_info" => "En activant les inscriptions des utilisateurs, le paramètre permettant de désactiver la connexion ne sera plus disponible.","user_management" => "Gestion des utilisateurs","delete_user" => "Supprimer l'utilisateur","delete_user_info" => "La suppression d'un utilisateur supprimera également tous ses abonnements et paramètres.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Veuillez insérer le code TOTP",+ "auth_tagline" => "Sachez où va votre argent.",+ "auth_tagline_sub" => "Suivez vos abonnements, visualisez vos dépenses et ne manquez aucun renouvellement.",+ "overview" => "Vue d'ensemble",+ "trends_and_forecast" => "Tendances et prévisions",+ "history_and_lifetime" => "Historique et cumul",+ "cost_per_day" => "Coût par jour",+ "median_monthly_cost" => "Coût mensuel médian des abonnements",+ "cheapest_subscription" => "Abonnement le moins cher",+ "vs_last_month" => "vs le mois dernier",+ "heaviest_month" => "Mois à venir le plus coûteux",+ "months_over_budget" => "Mois au-dessus du budget (12 prochains)",+ "manual_renewals" => "Renouvellements manuels",+ "all_time_spend" => "Dépenses totales (est.)",+ "oldest_subscription" => "Abonnement le plus ancien (années)",+ "average_subscription_age" => "Âge moyen des abonnements (années)",+ "projected_cost" => "Coût projeté (12 prochains mois)",+ "lifetime_spend" => "Dépenses cumulées (Top 10, est.)",+ "billing_cycle_split" => "Répartition par cycle de facturation",+ "currency_split" => "Répartition par devise",+ "price_distribution" => "Répartition des prix",+ "subscriptions_count" => "Abonnements",+ "new_subscriptions_per_year" => "Nouveaux abonnements par an",+ "estimated_from_current_prices" => "Estimé à partir des prix actuels",+ "translate_categories" => "Traduire avec l'IA",+ "week_starts_on_sunday" => "Commencer la semaine le dimanche dans le calendrier",+ "list_view" => "Vue liste",+ "grid_view" => "Vue grille",+ "oidc_oauth_enabled" => "Activer OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Pas encore de compte ?",+ "already_have_account" => "Vous avez déjà un compte ?",+ "google_search_info" => "Ajoute les résultats d'images Google (via SerpAPI) comme source supplémentaire dans la recherche de logos. Créez un compte SerpAPI gratuit et collez ici votre clé API.",+ "monthly_searches_used" => "Recherches utilisées ce mois-ci",+ "monthly_requests_used" => "Requêtes API utilisées ce mois-ci",];diff --git a/includes/i18n/hu.php b/includes/i18n/hu.phpindex 5d22035..6fb6fbb 100644--- a/includes/i18n/hu.php+++ b/includes/i18n/hu.php@@ -386,7 +386,8 @@ $i18n = ["disable_login" => "Bejelentkezés letiltása","disable_login_info" => "Bejelentkezés megkerülése. Ha szerverét csak helyi hálózaton, külső hozzáférés nélkül üzemelteti, letilthatja a bejelentkezést. Ez automatikusan bejelentkezteti az admin felhasználót.","disable_login_info2" => "Ezt a beállítást csak akkor engedélyezheti, ha a felhasználói regisztráció le van tiltva, és nincs több fiók az admin felhasználónál.",- "max_users_info" => "A 0 korlátlant jelent",+ "max_users_info" => "A 0 korlátlant jelent",+ "registrations_disable_login_info" => "A felhasználói regisztrációk engedélyezésével a bejelentkezés letiltásának beállítása nem lesz elérhető.","user_management" => "Felhasználókezelés","delete_user" => "Felhasználó törlése","delete_user_info" => "Egy felhasználó törlésével az összes előfizetése és beállítása is törlődik.",@@ -442,6 +443,38 @@ $i18n = ["insert_totp_code" => "Írja be a TOTP kódot",+ "auth_tagline" => "Tudd, hová megy a pénzed.",+ "auth_tagline_sub" => "Kövesd az előfizetéseidet, lásd a kiadásaidat, és ne maradj le egyetlen megújításról sem.",+ "overview" => "Áttekintés",+ "trends_and_forecast" => "Trendek és előrejelzés",+ "history_and_lifetime" => "Előzmények és összesítés",+ "cost_per_day" => "Napi költség",+ "median_monthly_cost" => "Havi előfizetési költség mediánja",+ "cheapest_subscription" => "Legolcsóbb előfizetés",+ "vs_last_month" => "az előző hónaphoz képest",+ "heaviest_month" => "Legdrágább közelgő hónap",+ "months_over_budget" => "Költségkeret feletti hónapok (következő 12)",+ "manual_renewals" => "Kézi megújítások",+ "all_time_spend" => "Összes kiadás (becsült)",+ "oldest_subscription" => "Legrégebbi előfizetés (év)",+ "average_subscription_age" => "Előfizetések átlagos kora (év)",+ "projected_cost" => "Várható költség (következő 12 hónap)",+ "lifetime_spend" => "Összes kiadás (Top 10, becsült)",+ "billing_cycle_split" => "Megoszlás számlázási ciklus szerint",+ "currency_split" => "Megoszlás pénznem szerint",+ "price_distribution" => "Ármegoszlás",+ "subscriptions_count" => "Előfizetések",+ "new_subscriptions_per_year" => "Új előfizetések évente",+ "estimated_from_current_prices" => "A jelenlegi árak alapján becsülve",+ "translate_categories" => "Fordítás MI-vel",+ "week_starts_on_sunday" => "A hét vasárnappal kezdődjön a naptárban",+ "list_view" => "Listanézet",+ "grid_view" => "Rácsnézet",+ "no_account_yet" => "Még nincs fiókod?",+ "already_have_account" => "Már van fiókod?",+ "google_search_info" => "A Google képtalálatait (SerpAPI-n keresztül) további forrásként adja hozzá a logókereséshez. Hozz létre egy ingyenes SerpAPI-fiókot, és illeszd be ide az API-kulcsodat.",+ "monthly_searches_used" => "Ebben a hónapban felhasznált keresések",+ "monthly_requests_used" => "Ebben a hónapban felhasznált API-kérések",];diff --git a/includes/i18n/id.php b/includes/i18n/id.phpindex 52b5d2e..fa33afc 100644--- a/includes/i18n/id.php+++ b/includes/i18n/id.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Lewati masuk. Jika Anda menjalankan server Anda di jaringan lokal saja, tanpa akses eksternal Anda dapat menonaktifkan proses masuk. Ini akan secara otomatis memasukkan pengguna admin.","disable_login_info2" => "Anda hanya dapat mengaktifkan pengaturan ini jika pendaftaran pengguna dinonaktifkan dan tidak ada lebih dari akun pengguna admin.","max_users_info" => "0 berarti tidak terbatas",+ "registrations_disable_login_info" => "Dengan mengaktifkan pendaftaran pengguna, pengaturan untuk menonaktifkan proses masuk tidak akan tersedia.","user_management" => "Manajemen Pengguna","delete_user" => "Hapus Pengguna","delete_user_info" => "Menghapus pengguna juga akan menghapus semua langganan dan pengaturan mereka.",@@ -440,6 +441,38 @@ $i18n = ["over_budget_warning" => "Anda melebihi anggaran",// TOTP Page"insert_totp_code" => "Masukkan kode TOTP",+ "auth_tagline" => "Ketahui ke mana uang Anda pergi.",+ "auth_tagline_sub" => "Pantau langganan Anda, lihat pengeluaran Anda, dan jangan pernah lewatkan perpanjangan.",+ "overview" => "Ringkasan",+ "trends_and_forecast" => "Tren & Perkiraan",+ "history_and_lifetime" => "Riwayat & Total",+ "cost_per_day" => "Biaya per Hari",+ "median_monthly_cost" => "Median Biaya Langganan Bulanan",+ "cheapest_subscription" => "Langganan Termurah",+ "vs_last_month" => "vs Bulan Lalu",+ "heaviest_month" => "Bulan Mendatang Termahal",+ "months_over_budget" => "Bulan Melebihi Anggaran (12 Berikutnya)",+ "manual_renewals" => "Perpanjangan Manual",+ "all_time_spend" => "Total Pengeluaran (perkiraan)",+ "oldest_subscription" => "Langganan Terlama (Tahun)",+ "average_subscription_age" => "Rata-rata Usia Langganan (Tahun)",+ "projected_cost" => "Proyeksi Biaya (12 Bulan ke Depan)",+ "lifetime_spend" => "Pengeluaran Seumur Hidup (10 Teratas, perkiraan)",+ "billing_cycle_split" => "Pembagian Siklus Penagihan",+ "currency_split" => "Pembagian Mata Uang",+ "price_distribution" => "Distribusi Harga",+ "subscriptions_count" => "Langganan",+ "new_subscriptions_per_year" => "Langganan Baru per Tahun",+ "estimated_from_current_prices" => "Diperkirakan dari harga saat ini",+ "translate_categories" => "Terjemahkan dengan AI",+ "week_starts_on_sunday" => "Mulai minggu pada hari Minggu di kalender",+ "list_view" => "Tampilan daftar",+ "grid_view" => "Tampilan kisi",+ "no_account_yet" => "Belum punya akun?",+ "already_have_account" => "Sudah punya akun?",+ "google_search_info" => "Menambahkan hasil gambar Google (melalui SerpAPI) sebagai sumber tambahan dalam pencarian logo. Buat akun SerpAPI gratis dan tempel kunci API Anda di sini.",+ "monthly_searches_used" => "Pencarian yang digunakan bulan ini",+ "monthly_requests_used" => "Permintaan API yang digunakan bulan ini",];?>diff --git a/includes/i18n/it.php b/includes/i18n/it.phpindex 6bfbcdd..bd8f595 100644--- a/includes/i18n/it.php+++ b/includes/i18n/it.php@@ -403,6 +403,7 @@ $i18n = ["disable_login_info" => "Bypassare il login. Se si gestisce il server solo su una rete locale, senza accesso esterno, è possibile disabilitare il login. In questo modo, l'utente amministratore effettuerà automaticamente il login.","disable_login_info2" => "Questa impostazione può essere attivata solo se la registrazione degli utenti è disattivata e non ci sono più account utente oltre a quello dell'amministratore.","max_users_info" => "Impostare a 0 per un numero illimitato di utenti",+ "registrations_disable_login_info" => "Abilitando le registrazioni degli utenti, l'impostazione per disabilitare il login non sarà disponibile.","user_management" => "Gestione utenti","delete_user" => "Elimina utente","delete_user_info" => "L'eliminazione di un utente eliminerà anche tutte le sue iscrizioni e impostazioni.",@@ -459,6 +460,43 @@ $i18n = [// TOTP Page"insert_totp_code" => "Inserisci il codice TOTP",+ "auth_tagline" => "Scopri dove vanno i tuoi soldi.",+ "auth_tagline_sub" => "Tieni traccia dei tuoi abbonamenti, controlla le tue spese e non perdere mai un rinnovo.",+ "overview" => "Panoramica",+ "trends_and_forecast" => "Tendenze e previsioni",+ "history_and_lifetime" => "Cronologia e totale",+ "cost_per_day" => "Costo al giorno",+ "median_monthly_cost" => "Costo mensile mediano degli abbonamenti",+ "cheapest_subscription" => "Abbonamento più economico",+ "vs_last_month" => "vs mese scorso",+ "heaviest_month" => "Prossimo mese più costoso",+ "months_over_budget" => "Mesi oltre il budget (prossimi 12)",+ "manual_renewals" => "Rinnovi manuali",+ "all_time_spend" => "Spesa totale (stima)",+ "oldest_subscription" => "Abbonamento più vecchio (anni)",+ "average_subscription_age" => "Età media degli abbonamenti (anni)",+ "projected_cost" => "Costo previsto (prossimi 12 mesi)",+ "lifetime_spend" => "Spesa complessiva (Top 10, stima)",+ "billing_cycle_split" => "Ripartizione per ciclo di fatturazione",+ "currency_split" => "Ripartizione per valuta",+ "price_distribution" => "Distribuzione dei prezzi",+ "subscriptions_count" => "Abbonamenti",+ "new_subscriptions_per_year" => "Nuovi abbonamenti all'anno",+ "estimated_from_current_prices" => "Stima basata sui prezzi attuali",+ "translate_categories" => "Traduci con IA",+ "week_starts_on_sunday" => "Inizia la settimana di domenica nel calendario",+ "list_view" => "Vista elenco",+ "grid_view" => "Vista griglia",+ "reminder" => "Promemoria",+ "cancellation" => "Cancellazione",+ "send_to_other_emails" => "Invia le notifiche anche ai seguenti indirizzi email (usa ; per separarli):",+ "oidc_oauth_enabled" => "Abilita OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Non hai ancora un account?",+ "already_have_account" => "Hai già un account?",+ "google_search_info" => "Aggiunge i risultati immagini di Google (tramite SerpAPI) come fonte aggiuntiva nella ricerca dei loghi. Crea un account SerpAPI gratuito e incolla qui la tua chiave API.",+ "monthly_searches_used" => "Ricerche utilizzate questo mese",+ "monthly_requests_used" => "Richieste API utilizzate questo mese",];?>diff --git a/includes/i18n/ja.php b/includes/i18n/ja.phpindex 0a65a63..8bb94de 100644--- a/includes/i18n/ja.php+++ b/includes/i18n/ja.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "ログインをバイパスします。サーバーをローカルネットワークのみで運用し、外部からのアクセスがない場合、ログインを無効にすることができます。これにより、管理者ユーザが自動的にログインします。","disable_login_info2" => "この設定を有効にできるのは、ユーザー登録がオフで、管理者以上のユーザーアカウントが存在しない場合のみです。","max_users_info" => "0に設定すると無制限になります",+ "registrations_disable_login_info" => "ユーザー登録を有効にすると、ログインを無効にする設定は利用できなくなります。","user_management" => "ユーザー管理","delete_user" => "ユーザーを削除","delete_user_info" => "ユーザーを削除すると、そのユーザーのサブスクリプションと設定もすべて削除されます。",@@ -442,6 +443,39 @@ $i18n = ["insert_totp_code" => "TOTPコードを入力してください",+ "auth_tagline" => "お金の行き先を把握しましょう。",+ "auth_tagline_sub" => "サブスクリプションを管理し、支出を確認し、更新を見逃さないようにしましょう。",+ "overview" => "概要",+ "trends_and_forecast" => "傾向と予測",+ "history_and_lifetime" => "履歴と累計",+ "cost_per_day" => "1日あたりのコスト",+ "median_monthly_cost" => "月額サブスクリプション費用の中央値",+ "cheapest_subscription" => "最も安いサブスクリプション",+ "vs_last_month" => "前月比",+ "heaviest_month" => "今後最も高額な月",+ "months_over_budget" => "予算超過の月(今後12か月)",+ "manual_renewals" => "手動更新",+ "all_time_spend" => "累計支出(推定)",+ "oldest_subscription" => "最も古いサブスクリプション(年)",+ "average_subscription_age" => "サブスクリプションの平均利用年数(年)",+ "projected_cost" => "予測コスト(今後12か月)",+ "lifetime_spend" => "累計支出(上位10件、推定)",+ "billing_cycle_split" => "請求サイクル別の内訳",+ "currency_split" => "通貨別の内訳",+ "price_distribution" => "価格分布",+ "subscriptions_count" => "サブスクリプション数",+ "new_subscriptions_per_year" => "年間の新規サブスクリプション",+ "estimated_from_current_prices" => "現在の価格に基づく推定",+ "translate_categories" => "AIで翻訳",+ "week_starts_on_sunday" => "カレンダーの週を日曜日から開始",+ "list_view" => "リスト表示",+ "grid_view" => "グリッド表示",+ "oidc_oauth_enabled" => "OIDC/OAuthを有効にする",+ "no_account_yet" => "アカウントをお持ちではありませんか?",+ "already_have_account" => "すでにアカウントをお持ちですか?",+ "google_search_info" => "Google画像検索の結果(SerpAPI経由)をロゴ検索の追加ソースとして加えます。無料のSerpAPIアカウントを作成し、APIキーをここに貼り付けてください。",+ "monthly_searches_used" => "今月の使用済み検索回数",+ "monthly_requests_used" => "今月の使用済みAPIリクエスト数",];diff --git a/includes/i18n/ko.php b/includes/i18n/ko.phpindex a94ac3c..a16ca7d 100644--- a/includes/i18n/ko.php+++ b/includes/i18n/ko.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "로그인 우회. 외부 액세스 없이 로컬 네트워크에서만 서버를 실행하는 경우 로그인을 비활성화할 수 있습니다. 그러면 관리자 사용자가 자동으로 로그인됩니다.","disable_login_info2" => "이 설정은 사용자 등록이 해제되어 있고 관리자 사용자 계정이 없는 경우에만 활성화할 수 있습니다.","max_users_info" => "0으로 설정하면 무제한으로 설정됩니다.",+ "registrations_disable_login_info" => "사용자 등록을 활성화하면 로그인 비활성화 설정을 사용할 수 없습니다.","user_management" => "유저 관리","delete_user" => "유저 삭제","delete_user_info" => "사용자를 삭제하면 모든 구독 및 설정도 삭제됩니다.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "2단계 인증 코드를 입력하세요",+ "auth_tagline" => "돈이 어디로 가는지 파악하세요.",+ "auth_tagline_sub" => "구독을 관리하고 지출을 확인하며 갱신을 놓치지 마세요.",+ "overview" => "개요",+ "trends_and_forecast" => "추세 및 예측",+ "history_and_lifetime" => "기록 및 누적",+ "cost_per_day" => "일일 비용",+ "median_monthly_cost" => "월 구독 비용 중앙값",+ "cheapest_subscription" => "가장 저렴한 구독",+ "vs_last_month" => "지난달 대비",+ "heaviest_month" => "가장 비싼 다가오는 달",+ "months_over_budget" => "예산 초과 월 (향후 12개월)",+ "manual_renewals" => "수동 갱신",+ "all_time_spend" => "전체 지출 (추정)",+ "oldest_subscription" => "가장 오래된 구독 (년)",+ "average_subscription_age" => "평균 구독 기간 (년)",+ "projected_cost" => "예상 비용 (향후 12개월)",+ "lifetime_spend" => "누적 지출 (상위 10개, 추정)",+ "billing_cycle_split" => "결제 주기별 분포",+ "currency_split" => "통화별 분포",+ "price_distribution" => "가격 분포",+ "subscriptions_count" => "구독",+ "new_subscriptions_per_year" => "연간 신규 구독",+ "estimated_from_current_prices" => "현재 가격 기준 추정",+ "translate_categories" => "AI로 번역",+ "week_starts_on_sunday" => "캘린더에서 일요일부터 주 시작",+ "list_view" => "목록 보기",+ "grid_view" => "그리드 보기",+ "oidc_oauth_enabled" => "OIDC/OAuth 사용",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "아직 계정이 없으신가요?",+ "already_have_account" => "이미 계정이 있으신가요?",+ "google_search_info" => "Google 이미지 결과(SerpAPI 경유)를 로고 검색의 추가 소스로 더합니다. 무료 SerpAPI 계정을 만들고 API 키를 여기에 붙여넣으세요.",+ "monthly_searches_used" => "이번 달 사용한 검색 수",+ "monthly_requests_used" => "이번 달 사용한 API 요청 수",];diff --git a/includes/i18n/nl.php b/includes/i18n/nl.phpindex ed1e506..9c57780 100644--- a/includes/i18n/nl.php+++ b/includes/i18n/nl.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Login overslaan. Als je server alleen in een lokaal netwerk draait, zonder externe toegang, kun je het inloggen uitschakelen. Dit zal automatisch de beheerder inloggen.","disable_login_info2" => "Je kunt deze instelling alleen inschakelen als gebruikersregistratie is uitgeschakeld en er niet meer dan het beheerdersaccount is.","max_users_info" => "0 betekent onbeperkt",+ "registrations_disable_login_info" => "Door gebruikersregistraties in te schakelen, is de instelling om inloggen uit te schakelen niet beschikbaar.","user_management" => "Gebruikersbeheer","delete_user" => "Gebruiker verwijderen","delete_user_info" => "Het verwijderen van een gebruiker zal ook al hun abonnementen en instellingen verwijderen.",@@ -442,6 +443,38 @@ $i18n = ["insert_totp_code" => "Voer TOTP code in",+ "auth_tagline" => "Weet waar je geld naartoe gaat.",+ "auth_tagline_sub" => "Volg je abonnementen, bekijk je uitgaven en mis nooit een verlenging.",+ "overview" => "Overzicht",+ "trends_and_forecast" => "Trends & prognose",+ "history_and_lifetime" => "Geschiedenis & totaal",+ "cost_per_day" => "Kosten per dag",+ "median_monthly_cost" => "Mediane maandelijkse abonnementskosten",+ "cheapest_subscription" => "Goedkoopste abonnement",+ "vs_last_month" => "t.o.v. vorige maand",+ "heaviest_month" => "Duurste komende maand",+ "months_over_budget" => "Maanden boven budget (komende 12)",+ "manual_renewals" => "Handmatige verlengingen",+ "all_time_spend" => "Totale uitgaven (gesch.)",+ "oldest_subscription" => "Oudste abonnement (jaren)",+ "average_subscription_age" => "Gemiddelde abonnementsleeftijd (jaren)",+ "projected_cost" => "Verwachte kosten (komende 12 maanden)",+ "lifetime_spend" => "Totale uitgaven (top 10, gesch.)",+ "billing_cycle_split" => "Verdeling per factureringscyclus",+ "currency_split" => "Verdeling per valuta",+ "price_distribution" => "Prijsverdeling",+ "subscriptions_count" => "Abonnementen",+ "new_subscriptions_per_year" => "Nieuwe abonnementen per jaar",+ "estimated_from_current_prices" => "Geschat op basis van huidige prijzen",+ "translate_categories" => "Vertalen met AI",+ "week_starts_on_sunday" => "Week op zondag laten beginnen in de kalender",+ "list_view" => "Lijstweergave",+ "grid_view" => "Rasterweergave",+ "no_account_yet" => "Nog geen account?",+ "already_have_account" => "Heb je al een account?",+ "google_search_info" => "Voegt Google-afbeeldingsresultaten (via SerpAPI) toe als extra bron bij het zoeken naar logo's. Maak een gratis SerpAPI-account en plak hier je API-sleutel.",+ "monthly_searches_used" => "Zoekopdrachten gebruikt deze maand",+ "monthly_requests_used" => "API-verzoeken gebruikt deze maand",];diff --git a/includes/i18n/pl.php b/includes/i18n/pl.phpindex 8093bf8..cda8d6f 100644--- a/includes/i18n/pl.php+++ b/includes/i18n/pl.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Obejście logowania. Jeśli serwer działa tylko w sieci lokalnej, bez dostępu z zewnątrz, można wyłączyć logowanie. Spowoduje to automatyczne zalogowanie użytkownika admin.","disable_login_info2" => "To ustawienie można włączyć tylko wtedy, gdy rejestracja użytkowników jest wyłączona i nie ma więcej niż konto administratora.","max_users_info" => "Jeśli ustawisz 0, nie będzie limitu użytkowników.",+ "registrations_disable_login_info" => "Po włączeniu rejestracji użytkowników opcja wyłączenia logowania będzie niedostępna.","user_management" => "Zarządzanie użytkownikami","delete_user" => "Usuń użytkownika","delete_user_info" => "Usunięcie użytkownika spowoduje również usunięcie wszystkich jego subskrypcji i ustawień.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Wprowadź kod TOTP",+ "auth_tagline" => "Wiedz, na co idą twoje pieniądze.",+ "auth_tagline_sub" => "Śledź swoje subskrypcje, kontroluj wydatki i nie przegap żadnego odnowienia.",+ "overview" => "Przegląd",+ "trends_and_forecast" => "Trendy i prognoza",+ "history_and_lifetime" => "Historia i suma",+ "cost_per_day" => "Koszt dzienny",+ "median_monthly_cost" => "Mediana miesięcznego kosztu subskrypcji",+ "cheapest_subscription" => "Najtańsza subskrypcja",+ "vs_last_month" => "względem poprzedniego miesiąca",+ "heaviest_month" => "Najdroższy nadchodzący miesiąc",+ "months_over_budget" => "Miesiące powyżej budżetu (następne 12)",+ "manual_renewals" => "Ręczne odnowienia",+ "all_time_spend" => "Łączne wydatki (szac.)",+ "oldest_subscription" => "Najstarsza subskrypcja (lata)",+ "average_subscription_age" => "Średni wiek subskrypcji (lata)",+ "projected_cost" => "Prognozowany koszt (następne 12 miesięcy)",+ "lifetime_spend" => "Łączne wydatki (Top 10, szac.)",+ "billing_cycle_split" => "Podział według cyklu rozliczeniowego",+ "currency_split" => "Podział według waluty",+ "price_distribution" => "Rozkład cen",+ "subscriptions_count" => "Subskrypcje",+ "new_subscriptions_per_year" => "Nowe subskrypcje rocznie",+ "estimated_from_current_prices" => "Oszacowano na podstawie aktualnych cen",+ "translate_categories" => "Przetłumacz z AI",+ "week_starts_on_sunday" => "Rozpoczynaj tydzień w niedzielę w kalendarzu",+ "list_view" => "Widok listy",+ "grid_view" => "Widok siatki",+ "oidc_oauth_enabled" => "Włącz OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Nie masz jeszcze konta?",+ "already_have_account" => "Masz już konto?",+ "google_search_info" => "Dodaje wyniki wyszukiwania obrazów Google (przez SerpAPI) jako dodatkowe źródło w wyszukiwaniu logo. Utwórz darmowe konto SerpAPI i wklej tutaj swój klucz API.",+ "monthly_searches_used" => "Wyszukiwania wykorzystane w tym miesiącu",+ "monthly_requests_used" => "Żądania API wykorzystane w tym miesiącu",];diff --git a/includes/i18n/pt.php b/includes/i18n/pt.phpindex 0862a3a..fc92a9c 100644--- a/includes/i18n/pt.php+++ b/includes/i18n/pt.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Ultrapassar o início de sessão. Se o seu servidor funciona apenas numa rede local, sem acesso externo, pode desativar o início de sessão. Isto irá iniciar automaticamente a sessão do utilizador administrador.","disable_login_info2" => "Só pode ativar esta definição se o registo de utilizadores estiver desativado e se não houver mais do que a conta de utilizador administrador.","max_users_info" => "0 para ilimitado",+ "registrations_disable_login_info" => "Ao ativar os registos de utilizadores, a definição para desativar o início de sessão ficará indisponível.","user_management" => "Gestão de Utilizadores","delete_user" => "Apagar Utilizador","delete_user_info" => "Apagar utilizador irá remover todas as suas subscrições e dados associados.",@@ -440,6 +441,42 @@ $i18n = [// TOTP Page"insert_totp_code" => "Insira o código TOTP",+ "auth_tagline" => "Saiba para onde vai o seu dinheiro.",+ "auth_tagline_sub" => "Acompanhe as suas subscrições, veja os seus gastos e nunca perca uma renovação.",+ "overview" => "Visão geral",+ "trends_and_forecast" => "Tendências e previsão",+ "history_and_lifetime" => "Histórico e total",+ "cost_per_day" => "Custo por dia",+ "median_monthly_cost" => "Mediana do custo mensal das subscrições",+ "cheapest_subscription" => "Subscrição mais barata",+ "vs_last_month" => "vs mês anterior",+ "heaviest_month" => "Próximo mês mais caro",+ "months_over_budget" => "Meses acima do orçamento (próximos 12)",+ "manual_renewals" => "Renovações manuais",+ "all_time_spend" => "Gasto total (est.)",+ "oldest_subscription" => "Subscrição mais antiga (anos)",+ "average_subscription_age" => "Idade média das subscrições (anos)",+ "projected_cost" => "Custo projetado (próximos 12 meses)",+ "lifetime_spend" => "Gasto acumulado (Top 10, est.)",+ "billing_cycle_split" => "Distribuição por ciclo de faturação",+ "currency_split" => "Distribuição por moeda",+ "price_distribution" => "Distribuição de preços",+ "subscriptions_count" => "Subscrições",+ "new_subscriptions_per_year" => "Novas subscrições por ano",+ "estimated_from_current_prices" => "Estimado com base nos preços atuais",+ "translate_categories" => "Traduzir com IA",+ "week_starts_on_sunday" => "Começar a semana ao domingo no calendário",+ "list_view" => "Vista de lista",+ "grid_view" => "Vista de grelha",+ "cycle" => "Ciclo",+ "cronjobs" => "Cronjobs",+ "oidc_oauth_enabled" => "Ativar OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Ainda não tem conta?",+ "already_have_account" => "Já tem conta?",+ "google_search_info" => "Adiciona resultados de imagens do Google (via SerpAPI) como fonte adicional na pesquisa de logótipos. Crie uma conta gratuita na SerpAPI e cole aqui a sua chave API.",+ "monthly_searches_used" => "Pesquisas utilizadas este mês",+ "monthly_requests_used" => "Pedidos de API utilizados este mês",];?>diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.phpindex 75d8641..db12449 100644--- a/includes/i18n/pt_br.php+++ b/includes/i18n/pt_br.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Ignorar login. Se você executar o servidor somente em uma rede local, sem acesso externo, poderá desativar o login. Isso fará o login automático do usuário administrador.","disable_login_info2" => "Só é possível ativar essa configuração se o registro de usuário estiver desativado e não houver mais do que a conta de usuário administrador.","max_users_info" => "0 para ilimitado",+ "registrations_disable_login_info" => "Ao ativar os registros de usuários, a configuração para desativar o login ficará indisponível.","user_management" => "Gerenciamento de usuários","delete_user" => "Excluir usuário","delete_user_info" => "Excluir um usuário também excluirá todas as assinaturas e dados associados",@@ -440,6 +441,41 @@ $i18n = [// TOTP Page"insert_totp_code" => "Insira o código TOTP",+ "auth_tagline" => "Saiba para onde vai o seu dinheiro.",+ "auth_tagline_sub" => "Acompanhe suas assinaturas, veja seus gastos e nunca perca uma renovação.",+ "overview" => "Visão geral",+ "trends_and_forecast" => "Tendências e previsão",+ "history_and_lifetime" => "Histórico e total",+ "cost_per_day" => "Custo por dia",+ "median_monthly_cost" => "Mediana do custo mensal das assinaturas",+ "cheapest_subscription" => "Assinatura mais barata",+ "vs_last_month" => "vs mês anterior",+ "heaviest_month" => "Próximo mês mais caro",+ "months_over_budget" => "Meses acima do orçamento (próximos 12)",+ "manual_renewals" => "Renovações manuais",+ "all_time_spend" => "Gasto total (est.)",+ "oldest_subscription" => "Assinatura mais antiga (anos)",+ "average_subscription_age" => "Idade média das assinaturas (anos)",+ "projected_cost" => "Custo projetado (próximos 12 meses)",+ "lifetime_spend" => "Gasto acumulado (Top 10, est.)",+ "billing_cycle_split" => "Distribuição por ciclo de cobrança",+ "currency_split" => "Distribuição por moeda",+ "price_distribution" => "Distribuição de preços",+ "subscriptions_count" => "Assinaturas",+ "new_subscriptions_per_year" => "Novas assinaturas por ano",+ "estimated_from_current_prices" => "Estimado com base nos preços atuais",+ "translate_categories" => "Traduzir com IA",+ "week_starts_on_sunday" => "Começar a semana no domingo no calendário",+ "list_view" => "Visualização em lista",+ "grid_view" => "Visualização em grade",+ "cronjobs" => "Cronjobs",+ "oidc_oauth_enabled" => "Ativar OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Ainda não tem uma conta?",+ "already_have_account" => "Já tem uma conta?",+ "google_search_info" => "Adiciona resultados de imagens do Google (via SerpAPI) como fonte adicional na busca de logos. Crie uma conta gratuita na SerpAPI e cole aqui a sua chave de API.",+ "monthly_searches_used" => "Pesquisas usadas neste mês",+ "monthly_requests_used" => "Requisições de API usadas neste mês",];diff --git a/includes/i18n/ro.php b/includes/i18n/ro.phpindex 408d5c0..8b7f103 100644--- a/includes/i18n/ro.php+++ b/includes/i18n/ro.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Omite autentificarea. Dacă rulezi serverul într-o rețea locală, fără acces extern, poți dezactiva autentificarea. Acest lucru va autentifica automat utilizatorul administrator.","disable_login_info2" => "Poți activa această setare numai dacă înregistrarea utilizatorilor este dezactivată și nu există alt cont decât cel de administrator.","max_users_info" => "0 înseamnă nelimitat",+ "registrations_disable_login_info" => "Prin activarea înregistrării utilizatorilor, opțiunea de dezactivare a autentificării nu va fi disponibilă.","user_management" => "Management utilizatori","delete_user" => "Șterge utilizator","delete_user_info" => "Ștergerea unui utilizator va șterge implicit toate abonamentele și setările acestuia.",@@ -442,6 +443,38 @@ $i18n = ["insert_totp_code" => "Inserează codul TOTP",+ "auth_tagline" => "Aflați unde se duc banii dumneavoastră.",+ "auth_tagline_sub" => "Urmăriți-vă abonamentele, vedeți cheltuielile și nu ratați nicio reînnoire.",+ "overview" => "Prezentare generală",+ "trends_and_forecast" => "Tendințe și prognoză",+ "history_and_lifetime" => "Istoric și total",+ "cost_per_day" => "Cost pe zi",+ "median_monthly_cost" => "Costul lunar median al abonamentelor",+ "cheapest_subscription" => "Cel mai ieftin abonament",+ "vs_last_month" => "față de luna trecută",+ "heaviest_month" => "Cea mai scumpă lună viitoare",+ "months_over_budget" => "Luni peste buget (următoarele 12)",+ "manual_renewals" => "Reînnoiri manuale",+ "all_time_spend" => "Cheltuieli totale (est.)",+ "oldest_subscription" => "Cel mai vechi abonament (ani)",+ "average_subscription_age" => "Vârsta medie a abonamentelor (ani)",+ "projected_cost" => "Cost estimat (următoarele 12 luni)",+ "lifetime_spend" => "Cheltuieli cumulate (Top 10, est.)",+ "billing_cycle_split" => "Repartizare după ciclul de facturare",+ "currency_split" => "Repartizare după monedă",+ "price_distribution" => "Distribuția prețurilor",+ "subscriptions_count" => "Abonamente",+ "new_subscriptions_per_year" => "Abonamente noi pe an",+ "estimated_from_current_prices" => "Estimat pe baza prețurilor actuale",+ "translate_categories" => "Traduceți cu AI",+ "week_starts_on_sunday" => "Începeți săptămâna duminica în calendar",+ "list_view" => "Vizualizare listă",+ "grid_view" => "Vizualizare grilă",+ "no_account_yet" => "Nu aveți încă un cont?",+ "already_have_account" => "Aveți deja un cont?",+ "google_search_info" => "Adaugă rezultatele de imagini Google (prin SerpAPI) ca sursă suplimentară în căutarea de logo-uri. Creați un cont SerpAPI gratuit și lipiți aici cheia API.",+ "monthly_searches_used" => "Căutări utilizate luna aceasta",+ "monthly_requests_used" => "Cereri API utilizate luna aceasta",];diff --git a/includes/i18n/ru.php b/includes/i18n/ru.phpindex b0657b5..104393c 100644--- a/includes/i18n/ru.php+++ b/includes/i18n/ru.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Обход входа в систему. Если вы используете свой сервер только в локальной сети, без доступа извне, вы можете отключить вход в систему. При этом будет автоматически входить пользователь admin.","disable_login_info2" => "Этот параметр можно включить только в том случае, если регистрация пользователей отключена и их количество не превышает учетную запись администратора.","max_users_info" => "Установите 0 для неограниченного количества пользователей.",+ "registrations_disable_login_info" => "Если включить регистрацию пользователей, настройка отключения входа станет недоступной.","user_management" => "Управление пользователями","delete_user" => "Удалить пользователя","delete_user_info" => "Удаление пользователя также приведет к удалению всех его подписок и настроек.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Введите код TOTP",+ "auth_tagline" => "Знайте, куда уходят ваши деньги.",+ "auth_tagline_sub" => "Отслеживайте подписки, следите за расходами и не пропускайте продления.",+ "overview" => "Обзор",+ "trends_and_forecast" => "Тренды и прогноз",+ "history_and_lifetime" => "История и итоги",+ "cost_per_day" => "Стоимость в день",+ "median_monthly_cost" => "Медианная месячная стоимость подписки",+ "cheapest_subscription" => "Самая дешёвая подписка",+ "vs_last_month" => "к прошлому месяцу",+ "heaviest_month" => "Самый дорогой предстоящий месяц",+ "months_over_budget" => "Месяцы сверх бюджета (следующие 12)",+ "manual_renewals" => "Ручные продления",+ "all_time_spend" => "Расходы за всё время (оценка)",+ "oldest_subscription" => "Самая старая подписка (лет)",+ "average_subscription_age" => "Средний возраст подписок (лет)",+ "projected_cost" => "Прогнозируемые расходы (следующие 12 месяцев)",+ "lifetime_spend" => "Суммарные расходы (Топ-10, оценка)",+ "billing_cycle_split" => "Распределение по циклам оплаты",+ "currency_split" => "Распределение по валютам",+ "price_distribution" => "Распределение цен",+ "subscriptions_count" => "Подписки",+ "new_subscriptions_per_year" => "Новые подписки за год",+ "estimated_from_current_prices" => "Оценка по текущим ценам",+ "translate_categories" => "Перевести с помощью ИИ",+ "week_starts_on_sunday" => "Начинать неделю с воскресенья в календаре",+ "list_view" => "Список",+ "grid_view" => "Сетка",+ "oidc_oauth_enabled" => "Включить OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Ещё нет аккаунта?",+ "already_have_account" => "Уже есть аккаунт?",+ "google_search_info" => "Добавляет результаты поиска изображений Google (через SerpAPI) как дополнительный источник при поиске логотипов. Создайте бесплатную учётную запись SerpAPI и вставьте сюда свой ключ API.",+ "monthly_searches_used" => "Использовано поисков в этом месяце",+ "monthly_requests_used" => "Использовано API-запросов в этом месяце",];diff --git a/includes/i18n/sl.php b/includes/i18n/sl.phpindex 580a442..15eaed0 100644--- a/includes/i18n/sl.php+++ b/includes/i18n/sl.php@@ -379,6 +379,7 @@ $i18n = ["disable_login_info" => "Obidite prijavo. Če strežnik uporabljate samo v lokalnem omrežju brez zunanjega dostopa, lahko onemogočite prijavo. Tako se bo samodejno prijavil uporabnik administrator.","disable_login_info2" => "To nastavitev lahko omogočite le, če je registracija uporabnikov izklopljena in če ni več uporabniških računov, razen uporabniškega računa upravitelja.","max_users_info" => "0 pomeni neomejeno",+ "registrations_disable_login_info" => "Če omogočite registracijo uporabnikov, nastavitev za onemogočanje prijave ne bo na voljo.","user_management" => "Upravljanje uporabnikov","delete_user" => "Izbriši uporabnika","delete_user_info" => "Če izbrišete uporabnika, boste izbrisali tudi vse njegove naročnine in nastavitve.",@@ -433,6 +434,47 @@ $i18n = [// TOTP Page"insert_totp_code" => "Vnesite kodo TOTP",+ "auth_tagline" => "Vedite, kam gre vaš denar.",+ "auth_tagline_sub" => "Spremljajte svoje naročnine, preglejte porabo in nikoli ne zamudite podaljšanja.",+ "overview" => "Pregled",+ "trends_and_forecast" => "Trendi in napoved",+ "history_and_lifetime" => "Zgodovina in skupno",+ "cost_per_day" => "Strošek na dan",+ "median_monthly_cost" => "Mediana mesečnih stroškov naročnin",+ "cheapest_subscription" => "Najcenejša naročnina",+ "vs_last_month" => "glede na prejšnji mesec",+ "heaviest_month" => "Najdražji prihajajoči mesec",+ "months_over_budget" => "Meseci nad proračunom (naslednjih 12)",+ "manual_renewals" => "Ročna podaljšanja",+ "all_time_spend" => "Skupna poraba (ocena)",+ "oldest_subscription" => "Najstarejša naročnina (leta)",+ "average_subscription_age" => "Povprečna starost naročnin (leta)",+ "projected_cost" => "Predvideni stroški (naslednjih 12 mesecev)",+ "lifetime_spend" => "Skupna poraba (Top 10, ocena)",+ "billing_cycle_split" => "Razdelitev po obračunskem ciklu",+ "currency_split" => "Razdelitev po valuti",+ "price_distribution" => "Porazdelitev cen",+ "subscriptions_count" => "Naročnine",+ "new_subscriptions_per_year" => "Nove naročnine na leto",+ "estimated_from_current_prices" => "Ocenjeno na podlagi trenutnih cen",+ "translate_categories" => "Prevedi z AI",+ "week_starts_on_sunday" => "Začni teden z nedeljo v koledarju",+ "list_view" => "Pogled seznama",+ "grid_view" => "Mrežni pogled",+ "account" => "Račun",+ "export_subscriptions" => "Izvozi naročnine",+ "export_as_json" => "Izvozi kot JSON",+ "export_as_csv" => "Izvozi kot CSV",+ "danger_zone" => "Nevarno območje",+ "delete_account" => "Izbriši račun",+ "delete_account_info" => "Z izbrisom računa boste izbrisali tudi vse svoje naročnine in nastavitve.",+ "oidc_oauth_enabled" => "Omogoči OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Še nimate računa?",+ "already_have_account" => "Že imate račun?",+ "google_search_info" => "Doda rezultate slik Google (prek SerpAPI) kot dodaten vir pri iskanju logotipov. Ustvarite brezplačen račun SerpAPI in sem prilepite svoj ključ API.",+ "monthly_searches_used" => "Porabljena iskanja ta mesec",+ "monthly_requests_used" => "Porabljene zahteve API ta mesec",];diff --git a/includes/i18n/sr.php b/includes/i18n/sr.phpindex a3fd2da..db9999f 100644--- a/includes/i18n/sr.php+++ b/includes/i18n/sr.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Заобиђите пријаву. Ако свој сервер покрећете само на локалној мрежи, без спољног приступа можете да онемогућите пријаву. Ово ће аутоматски пријавити корисника администратора.","disable_login_info2" => "Ово подешавање се може омогућити само ако је регистрација корисника затворена и број корисничких налога не прелази администраторске налоге.","max_users_info" => "Максималан број корисника који могу бити регистровани. 0 за неограничено.",+ "registrations_disable_login_info" => "Омогућавањем регистрације корисника, подешавање за онемогућавање пријаве неће бити доступно.","user_management" => "Управљање корисницима","delete_user" => "Обриши корисника","delete_user_info" => "Брисање корисника ће такође обрисати све његове претплате и податке.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Унесите ТОТП код",+ "auth_tagline" => "Знајте где иде ваш новац.",+ "auth_tagline_sub" => "Пратите своје претплате, погледајте трошкове и никада не пропустите обнову.",+ "overview" => "Преглед",+ "trends_and_forecast" => "Трендови и прогноза",+ "history_and_lifetime" => "Историја и укупно",+ "cost_per_day" => "Трошак по дану",+ "median_monthly_cost" => "Медијана месечних трошкова претплата",+ "cheapest_subscription" => "Најјефтинија претплата",+ "vs_last_month" => "у односу на прошли месец",+ "heaviest_month" => "Најскупљи предстојећи месец",+ "months_over_budget" => "Месеци преко буџета (наредних 12)",+ "manual_renewals" => "Ручне обнове",+ "all_time_spend" => "Укупна потрошња (процена)",+ "oldest_subscription" => "Најстарија претплата (године)",+ "average_subscription_age" => "Просечна старост претплата (године)",+ "projected_cost" => "Пројектовани трошак (наредних 12 месеци)",+ "lifetime_spend" => "Укупна потрошња (Топ 10, процена)",+ "billing_cycle_split" => "Подела по циклусу наплате",+ "currency_split" => "Подела по валути",+ "price_distribution" => "Расподела цена",+ "subscriptions_count" => "Претплате",+ "new_subscriptions_per_year" => "Нове претплате годишње",+ "estimated_from_current_prices" => "Процењено на основу тренутних цена",+ "translate_categories" => "Преведи помоћу AI",+ "week_starts_on_sunday" => "Почни седмицу недељом у календару",+ "list_view" => "Приказ листе",+ "grid_view" => "Приказ мреже",+ "oidc_oauth_enabled" => "Омогући OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Још немате налог?",+ "already_have_account" => "Већ имате налог?",+ "google_search_info" => "Додаје резултате Google слика (преко SerpAPI) као додатни извор при претрази логотипа. Направите бесплатан SerpAPI налог и налепите овде свој API кључ.",+ "monthly_searches_used" => "Искоришћене претраге овог месеца",+ "monthly_requests_used" => "Искоришћени API захтеви овог месеца",];diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.phpindex 2047fbf..ccf94be 100644--- a/includes/i18n/sr_lat.php+++ b/includes/i18n/sr_lat.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Zaobiđite prijavu. Ako svoj server pokrećete samo na lokalnoj mreži, bez spoljnog pristupa možete da onemogućite prijavu. Ovo će automatski prijaviti korisnika administratora.","disable_login_info2" => "Ovo podešavanje se može omogućiti samo ako je registracija korisnika zatvorena i broj korisničkih naloga ne prelazi administratorske naloge.","max_users_info" => "0 za neograničen broj korisnika",+ "registrations_disable_login_info" => "Omogućavanjem registracije korisnika, podešavanje za onemogućavanje prijave neće biti dostupno.","user_management" => "Upravljanje korisnicima","delete_user" => "Izbriši korisnika","delete_user_info" => "Brisanjem korisnika izbrisaće se i sve njegove pretplate i podešavanja.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Unesite TOTP kod",+ "auth_tagline" => "Znajte gde ide vaš novac.",+ "auth_tagline_sub" => "Pratite svoje pretplate, pogledajte troškove i nikada ne propustite obnovu.",+ "overview" => "Pregled",+ "trends_and_forecast" => "Trendovi i prognoza",+ "history_and_lifetime" => "Istorija i ukupno",+ "cost_per_day" => "Trošak po danu",+ "median_monthly_cost" => "Medijana mesečnih troškova pretplata",+ "cheapest_subscription" => "Najjeftinija pretplata",+ "vs_last_month" => "u odnosu na prošli mesec",+ "heaviest_month" => "Najskuplji predstojeći mesec",+ "months_over_budget" => "Meseci preko budžeta (narednih 12)",+ "manual_renewals" => "Ručne obnove",+ "all_time_spend" => "Ukupna potrošnja (procena)",+ "oldest_subscription" => "Najstarija pretplata (godine)",+ "average_subscription_age" => "Prosečna starost pretplata (godine)",+ "projected_cost" => "Projektovani trošak (narednih 12 meseci)",+ "lifetime_spend" => "Ukupna potrošnja (Top 10, procena)",+ "billing_cycle_split" => "Podela po ciklusu naplate",+ "currency_split" => "Podela po valuti",+ "price_distribution" => "Raspodela cena",+ "subscriptions_count" => "Pretplate",+ "new_subscriptions_per_year" => "Nove pretplate godišnje",+ "estimated_from_current_prices" => "Procenjeno na osnovu trenutnih cena",+ "translate_categories" => "Prevedi pomoću AI",+ "week_starts_on_sunday" => "Počni sedmicu nedeljom u kalendaru",+ "list_view" => "Prikaz liste",+ "grid_view" => "Prikaz mreže",+ "oidc_oauth_enabled" => "Omogući OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Još nemate nalog?",+ "already_have_account" => "Već imate nalog?",+ "google_search_info" => "Dodaje rezultate Google slika (preko SerpAPI) kao dodatni izvor pri pretrazi logotipa. Napravite besplatan SerpAPI nalog i nalepite ovde svoj API ključ.",+ "monthly_searches_used" => "Iskorišćene pretrage ovog meseca",+ "monthly_requests_used" => "Iskorišćeni API zahtevi ovog meseca",];diff --git a/includes/i18n/tr.php b/includes/i18n/tr.phpindex e2a7362..f53cfa9 100644--- a/includes/i18n/tr.php+++ b/includes/i18n/tr.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Girişi atlayın. Sunucunuzu yalnızca yerel bir ağ üzerinde, harici erişim olmadan çalıştırıyorsanız, oturum açmayı devre dışı bırakabilirsiniz. Bu, yönetici kullanıcıyı otomatik olarak oturum açacaktır.","disable_login_info2" => "Bu ayarı yalnızca kullanıcı kaydı kapalıysa ve yönetici kullanıcı hesabından başka kullanıcı yoksa etkinleştirebilirsiniz.","max_users_info" => "0 veya boş bırakıldığında sınırsız kullanıcı sayısı",+ "registrations_disable_login_info" => "Kullanıcı kayıtlarını etkinleştirerek, girişi devre dışı bırakma ayarı kullanılamayacaktır.","user_management" => "Kullanıcı Yönetimi","delete_user" => "Kullanıcıyı Sil","delete_user_info" => "Bir kullanıcının silinmesi aynı zamanda tüm aboneliklerinin ve ayarlarının da silinmesine neden olur.",@@ -440,6 +441,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "Lütfen TOTP kodunuzu girin",+ "auth_tagline" => "Paranızın nereye gittiğini bilin.",+ "auth_tagline_sub" => "Aboneliklerinizi takip edin, harcamalarınızı görün ve hiçbir yenilemeyi kaçırmayın.",+ "overview" => "Genel Bakış",+ "trends_and_forecast" => "Eğilimler ve Tahmin",+ "history_and_lifetime" => "Geçmiş ve Toplam",+ "cost_per_day" => "Günlük Maliyet",+ "median_monthly_cost" => "Aylık Abonelik Maliyeti Medyanı",+ "cheapest_subscription" => "En Ucuz Abonelik",+ "vs_last_month" => "geçen aya göre",+ "heaviest_month" => "En Pahalı Yaklaşan Ay",+ "months_over_budget" => "Bütçeyi Aşan Aylar (Sonraki 12)",+ "manual_renewals" => "Manuel Yenilemeler",+ "all_time_spend" => "Toplam Harcama (tahmini)",+ "oldest_subscription" => "En Eski Abonelik (Yıl)",+ "average_subscription_age" => "Ortalama Abonelik Yaşı (Yıl)",+ "projected_cost" => "Öngörülen Maliyet (Sonraki 12 Ay)",+ "lifetime_spend" => "Toplam Harcama (İlk 10, tahmini)",+ "billing_cycle_split" => "Fatura Döngüsüne Göre Dağılım",+ "currency_split" => "Para Birimine Göre Dağılım",+ "price_distribution" => "Fiyat Dağılımı",+ "subscriptions_count" => "Abonelikler",+ "new_subscriptions_per_year" => "Yılda Yeni Abonelik",+ "estimated_from_current_prices" => "Mevcut fiyatlara göre tahmin edilmiştir",+ "translate_categories" => "Yapay zekâ ile çevir",+ "week_starts_on_sunday" => "Takvimde haftayı pazar günü başlat",+ "list_view" => "Liste görünümü",+ "grid_view" => "Izgara görünümü",+ "oidc_oauth_enabled" => "OIDC/OAuth'u etkinleştir",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Henüz hesabınız yok mu?",+ "already_have_account" => "Zaten hesabınız var mı?",+ "google_search_info" => "Google görsel sonuçlarını (SerpAPI üzerinden) logo aramasına ek kaynak olarak ekler. Ücretsiz bir SerpAPI hesabı oluşturun ve API anahtarınızı buraya yapıştırın.",+ "monthly_searches_used" => "Bu ay kullanılan aramalar",+ "monthly_requests_used" => "Bu ay kullanılan API istekleri",];diff --git a/includes/i18n/uk.php b/includes/i18n/uk.phpindex 9a8d2c0..9d3cc21 100644--- a/includes/i18n/uk.php+++ b/includes/i18n/uk.php@@ -386,6 +386,7 @@ $i18n = ["disable_login_info" => "Обхід входу в систему. Якщо ви використовуєте свій сервер тільки в локальній мережі, без доступу ззовні, ви можете відключити вхід в систему. При цьому буде автоматично входити користувач admin.","disable_login_info2" => "Цей параметр можна увімкнути тільки в тому випадку, якщо реєстрація користувачів відключена і їх кількість не перевищує обліковий запис адміністратора.","max_users_info" => "Встановіть 0 для необмеженої кількості користувачів.",+ "registrations_disable_login_info" => "Якщо увімкнути реєстрацію користувачів, налаштування вимкнення входу стане недоступним.","user_management" => "Управління користувачами","delete_user" => "Видалити користувача","delete_user_info" => "Видалення користувача також призведе до видалення всіх його підписок та налаштувань.",@@ -440,6 +441,41 @@ $i18n = [// TOTP Page"insert_totp_code" => "Введіть код TOTP",+ "auth_tagline" => "Знайте, куди йдуть ваші гроші.",+ "auth_tagline_sub" => "Відстежуйте підписки, переглядайте витрати й ніколи не пропускайте поновлення.",+ "overview" => "Огляд",+ "trends_and_forecast" => "Тренди та прогноз",+ "history_and_lifetime" => "Історія та підсумки",+ "cost_per_day" => "Вартість на день",+ "median_monthly_cost" => "Медіанна місячна вартість підписки",+ "cheapest_subscription" => "Найдешевша підписка",+ "vs_last_month" => "порівняно з минулим місяцем",+ "heaviest_month" => "Найдорожчий наступний місяць",+ "months_over_budget" => "Місяці понад бюджет (наступні 12)",+ "manual_renewals" => "Ручні поновлення",+ "all_time_spend" => "Витрати за весь час (оцінка)",+ "oldest_subscription" => "Найстаріша підписка (років)",+ "average_subscription_age" => "Середній вік підписок (років)",+ "projected_cost" => "Прогнозовані витрати (наступні 12 місяців)",+ "lifetime_spend" => "Сумарні витрати (Топ-10, оцінка)",+ "billing_cycle_split" => "Розподіл за циклом оплати",+ "currency_split" => "Розподіл за валютою",+ "price_distribution" => "Розподіл цін",+ "subscriptions_count" => "Підписки",+ "new_subscriptions_per_year" => "Нові підписки за рік",+ "estimated_from_current_prices" => "Оцінка за поточними цінами",+ "translate_categories" => "Перекласти за допомогою ШІ",+ "week_starts_on_sunday" => "Починати тиждень з неділі в календарі",+ "list_view" => "Список",+ "grid_view" => "Сітка",+ "cant_delete_payment_method_in_use" => "Неможливо вимкнути спосіб оплати, що використовується",+ "oidc_oauth_enabled" => "Увімкнути OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "Ще не маєте облікового запису?",+ "already_have_account" => "Вже маєте обліковий запис?",+ "google_search_info" => "Додає результати пошуку зображень Google (через SerpAPI) як додаткове джерело в пошуку логотипів. Створіть безкоштовний обліковий запис SerpAPI і вставте сюди свій ключ API.",+ "monthly_searches_used" => "Використано пошуків цього місяця",+ "monthly_requests_used" => "Використано API-запитів цього місяця",];?>diff --git a/includes/i18n/vi.php b/includes/i18n/vi.phpindex 77c57be..a859b60 100644--- a/includes/i18n/vi.php+++ b/includes/i18n/vi.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "Bỏ qua đăng nhập. Nếu bạn chạy máy chủ của mình trên mạng cục bộ mà không có quyền truy cập từ bên ngoài, bạn có thể vô hiệu hóa đăng nhập. Điều này sẽ tự động đăng nhập người dùng quản trị.","disable_login_info2" => "Bạn chỉ có thể bật cài đặt này nếu việc đăng ký người dùng bị vô hiệu hóa và không có tài khoản người dùng nào ngoài tài khoản quản trị viên.","max_users_info" => "0 có nghĩa là không giới hạn",+ "registrations_disable_login_info" => "Khi bật đăng ký người dùng, tùy chọn vô hiệu hóa đăng nhập sẽ không khả dụng.","user_management" => "Quản lý người dùng","delete_user" => "Xóa người dùng","delete_user_info" => "Xóa một người dùng cũng sẽ xóa tất cả các đăng ký và cài đặt của họ.",@@ -440,6 +441,39 @@ $i18n = ["over_budget_warning" => "Bạn đang vượt quá ngân sách",// TOTP Page"insert_totp_code" => "Nhập mã TOTP",+ "auth_tagline" => "Biết tiền của bạn đi đâu.",+ "auth_tagline_sub" => "Theo dõi các gói đăng ký, xem chi tiêu và không bao giờ bỏ lỡ lần gia hạn nào.",+ "overview" => "Tổng quan",+ "trends_and_forecast" => "Xu hướng & Dự báo",+ "history_and_lifetime" => "Lịch sử & Tổng cộng",+ "cost_per_day" => "Chi phí mỗi ngày",+ "median_monthly_cost" => "Chi phí đăng ký hằng tháng trung vị",+ "cheapest_subscription" => "Gói đăng ký rẻ nhất",+ "vs_last_month" => "so với tháng trước",+ "heaviest_month" => "Tháng sắp tới đắt nhất",+ "months_over_budget" => "Số tháng vượt ngân sách (12 tháng tới)",+ "manual_renewals" => "Gia hạn thủ công",+ "all_time_spend" => "Tổng chi tiêu (ước tính)",+ "oldest_subscription" => "Gói đăng ký lâu nhất (năm)",+ "average_subscription_age" => "Tuổi trung bình của gói đăng ký (năm)",+ "projected_cost" => "Chi phí dự kiến (12 tháng tới)",+ "lifetime_spend" => "Tổng chi tiêu (Top 10, ước tính)",+ "billing_cycle_split" => "Phân bổ theo chu kỳ thanh toán",+ "currency_split" => "Phân bổ theo tiền tệ",+ "price_distribution" => "Phân bố giá",+ "subscriptions_count" => "Gói đăng ký",+ "new_subscriptions_per_year" => "Gói đăng ký mới mỗi năm",+ "estimated_from_current_prices" => "Ước tính theo giá hiện tại",+ "translate_categories" => "Dịch bằng AI",+ "week_starts_on_sunday" => "Bắt đầu tuần vào Chủ nhật trong lịch",+ "list_view" => "Chế độ danh sách",+ "grid_view" => "Chế độ lưới",+ "oidc_oauth_enabled" => "Bật OIDC/OAuth",+ "no_account_yet" => "Chưa có tài khoản?",+ "already_have_account" => "Đã có tài khoản?",+ "google_search_info" => "Thêm kết quả hình ảnh Google (qua SerpAPI) làm nguồn bổ sung khi tìm logo. Tạo tài khoản SerpAPI miễn phí và dán khóa API của bạn vào đây.",+ "monthly_searches_used" => "Số lượt tìm kiếm đã dùng trong tháng",+ "monthly_requests_used" => "Số yêu cầu API đã dùng trong tháng",];?>diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.phpindex 15b7156..1d7e14c 100644--- a/includes/i18n/zh_cn.php+++ b/includes/i18n/zh_cn.php@@ -404,6 +404,7 @@ $i18n = ["disable_login_info" => "旁路登录。如果服务器只在本地网络上运行,没有外部访问,则可以禁用登录。这会自动登录管理员用户。","disable_login_info2" => "只有在用户注册关闭且用户账户数不超过管理员账户时,才能启用此设置。","max_users_info" => "设置为 0 以无限制用户数",+ "registrations_disable_login_info" => "启用用户注册后,禁用登录的设置将不可用。","user_management" => "用户管理","delete_user" => "删除用户","delete_user_info" => "删除用户也会删除其所有订阅和设置。",@@ -461,6 +462,40 @@ $i18n = [// TOTP Page"insert_totp_code" => "请输入 TOTP 代码",+ "auth_tagline" => "清楚您的钱花在哪里。",+ "auth_tagline_sub" => "跟踪您的订阅,查看支出,绝不错过任何续订。",+ "overview" => "概览",+ "trends_and_forecast" => "趋势与预测",+ "history_and_lifetime" => "历史与累计",+ "cost_per_day" => "每日成本",+ "median_monthly_cost" => "月订阅费用中位数",+ "cheapest_subscription" => "最便宜的订阅",+ "vs_last_month" => "与上月相比",+ "heaviest_month" => "即将到来的最高支出月份",+ "months_over_budget" => "超出预算的月份(未来12个月)",+ "manual_renewals" => "手动续订",+ "all_time_spend" => "累计支出(估算)",+ "oldest_subscription" => "最早的订阅(年)",+ "average_subscription_age" => "订阅平均时长(年)",+ "projected_cost" => "预计支出(未来12个月)",+ "lifetime_spend" => "累计支出(前10名,估算)",+ "billing_cycle_split" => "按计费周期分布",+ "currency_split" => "按货币分布",+ "price_distribution" => "价格分布",+ "subscriptions_count" => "订阅",+ "new_subscriptions_per_year" => "每年新增订阅",+ "estimated_from_current_prices" => "根据当前价格估算",+ "translate_categories" => "使用AI翻译",+ "week_starts_on_sunday" => "日历中一周从周日开始",+ "list_view" => "列表视图",+ "grid_view" => "网格视图",+ "oidc_oauth_enabled" => "启用 OIDC/OAuth",+ "other_emails_placeholder" => "[email protected];[email protected]",+ "no_account_yet" => "还没有账户?",+ "already_have_account" => "已经有账户?",+ "google_search_info" => "将Google图片结果(通过SerpAPI)添加为Logo搜索的额外来源。创建免费的SerpAPI账户并在此粘贴您的API密钥。",+ "monthly_searches_used" => "本月已用搜索次数",+ "monthly_requests_used" => "本月已用API请求数",];?>diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.phpindex c8db05c..a470444 100644--- a/includes/i18n/zh_tw.php+++ b/includes/i18n/zh_tw.php@@ -387,6 +387,7 @@ $i18n = ["disable_login_info" => "略過登入。如果您的伺服器只在區域網路中執行且無外部存取,可以停用登入。這將自動以管理員身分登入。","disable_login_info2" => "只有在停用使用者註冊且使用者數不超過管理員帳號時,才能啟用此設定。","max_users_info" => "0 表示無限制",+ "registrations_disable_login_info" => "啟用使用者註冊後,停用登入的設定將無法使用。","user_management" => "使用者管理","delete_user" => "刪除使用者","delete_user_info" => "刪除使用者也會刪除其所有訂閱和設定。",@@ -442,6 +443,39 @@ $i18n = ["insert_totp_code" => "請輸入 TOTP 驗證碼",+ "auth_tagline" => "清楚您的錢花在哪裡。",+ "auth_tagline_sub" => "追蹤您的訂閱、檢視支出,絕不錯過任何續訂。",+ "overview" => "總覽",+ "trends_and_forecast" => "趨勢與預測",+ "history_and_lifetime" => "歷史與累計",+ "cost_per_day" => "每日成本",+ "median_monthly_cost" => "每月訂閱費用中位數",+ "cheapest_subscription" => "最便宜的訂閱",+ "vs_last_month" => "與上月相比",+ "heaviest_month" => "即將到來的最高支出月份",+ "months_over_budget" => "超出預算的月份(未來12個月)",+ "manual_renewals" => "手動續訂",+ "all_time_spend" => "累計支出(估算)",+ "oldest_subscription" => "最早的訂閱(年)",+ "average_subscription_age" => "訂閱平均時長(年)",+ "projected_cost" => "預計支出(未來12個月)",+ "lifetime_spend" => "累計支出(前10名,估算)",+ "billing_cycle_split" => "按計費週期分佈",+ "currency_split" => "按貨幣分佈",+ "price_distribution" => "價格分佈",+ "subscriptions_count" => "訂閱",+ "new_subscriptions_per_year" => "每年新增訂閱",+ "estimated_from_current_prices" => "根據目前價格估算",+ "translate_categories" => "使用AI翻譯",+ "week_starts_on_sunday" => "行事曆中一週從週日開始",+ "list_view" => "清單檢視",+ "grid_view" => "網格檢視",+ "oidc_oauth_enabled" => "啟用 OIDC/OAuth",+ "no_account_yet" => "還沒有帳戶?",+ "already_have_account" => "已經有帳戶?",+ "google_search_info" => "將Google圖片結果(透過SerpAPI)新增為Logo搜尋的額外來源。建立免費的SerpAPI帳戶並在此貼上您的API金鑰。",+ "monthly_searches_used" => "本月已用搜尋次數",+ "monthly_requests_used" => "本月已用API請求數",];diff --git a/includes/ical_helper.php b/includes/ical_helper.phpnew file mode 100644index 0000000..4610f14--- /dev/null+++ b/includes/ical_helper.php@@ -0,0 +1,23 @@+<?php++/**+ * Escapes a value for safe embedding in an iCalendar (RFC 5545) property value.+ *+ * Backslash must be escaped first, before the other substitutions introduce+ * new backslashes. Raw CRLF/LF are converted to a literal two-character+ * "\n" escape sequence — never leave a real newline in the output, since+ * iCalendar treats CRLF as a property delimiter: an unescaped newline lets+ * user-supplied text (e.g. a subscription name or notes) terminate the+ * current property and inject arbitrary calendar content (CWE-93).+ */+function icalEscape($value)+{+ $value = (string) $value;+ $value = str_replace('\\', '\\\\', $value);+ $value = str_replace(["\r\n", "\r", "\n"], '\\n', $value);+ $value = str_replace(',', '\\,', $value);+ $value = str_replace(';', '\\;', $value);+ return $value;+}++?>diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.phpindex d8ef7d4..eca4301 100644--- a/includes/list_subscriptions.php+++ b/includes/list_subscriptions.php@@ -258,7 +258,7 @@ function printSubscriptions($subscriptions, $sort, $categories, $members, $i18n,?><div class="subscription<?= $subscriptionExtraClasses ?>"- onClick="toggleOpenSubscription(<?= $subscription['id'] ?>)" data-id="<?= $subscription['id'] ?>"+ onClick="showSubscriptionDetails(event, <?= $subscription['id'] ?>)" data-id="<?= $subscription['id'] ?>"data-name="<?= $subscription['name'] ?>"><div class="subscription-main"><span class="logo <?= !$hasLogo ? 'hideOnMobile' : '' ?>">@@ -345,41 +345,42 @@ function printSubscriptions($subscriptions, $sort, $categories, $members, $i18n,?></ul></div>- <div class="subscription-secondary">- <span- class="name"><i class="fa-solid fa-tag"></i><?= $subscription['name'] ?></span>- <span class="payer_user"- title="<?= translate('paid_by', $i18n) ?>"><i class="fa-solid fa-wallet"></i><?= $members[$subscription['payer_user_id']]['name'] ?></span>- <span class="category"- title="<?= translate('category', $i18n) ?>"><i class="fa-solid fa-layer-group"></i><?= $categories[$subscription['category_id']]['name'] ?></span>+ <div class="subscription-back" aria-hidden="true">+ <button type="button" class="subscription-back-close"+ onClick="event.stopPropagation(); unflipCard(<?= $subscription['id'] ?>)"+ title="<?= translate('cancel', $i18n) ?>">+ <i class="fa-solid fa-xmark"></i>+ </button>+ <button type="button" class="back-action"+ onClick="unflipCard(<?= $subscription['id'] ?>); openEditSubscription(event, <?= $subscription['id'] ?>)">+ <i class="fa-solid fa-pen-to-square"></i>+ <?= translate('edit_subscription', $i18n) ?>+ </button>+ <button type="button" class="back-action"+ onClick="unflipCard(<?= $subscription['id'] ?>); cloneSubscription(event, <?= $subscription['id'] ?>)">+ <i class="fa-solid fa-copy"></i>+ <?= translate('clone', $i18n) ?>+ </button><?php- if ($subscription['url'] != "") {- $url = $subscription['url'];- if (!preg_match('/^https?:\/\//', $url)) {- $url = "https://" . $url;- }+ if ($subscription['auto_renew'] != 1 && !$subscription['one_time']) {?>- <span class="url" title="<?= translate('external_url', $i18n) ?>"><a href="<?= $url ?>" target="_blank"- rel="noreferrer"><i class="fa-solid fa-globe"></i></a></span>+ <button type="button" class="back-action"+ onClick="unflipCard(<?= $subscription['id'] ?>); renewSubscription(event, <?= $subscription['id'] ?>)">+ <i class="fa-solid fa-rotate-right"></i>+ <?= translate('renew', $i18n) ?>+ </button><?php}?>+ <button type="button" class="back-action delete"+ onClick="unflipCard(<?= $subscription['id'] ?>); deleteSubscription(event, <?= $subscription['id'] ?>)">+ <i class="fa-solid fa-trash-can"></i>+ <?= translate('delete', $i18n) ?>+ </button></div>- <?php- if ($subscription['notes'] != "") {- ?>- <div class="subscription-notes">- <span class="notes">- <i class="fa-solid fa-note-sticky"></i>- <?= $subscription['notes'] ?>- </span>- </div>- <?php- }- ?></div><?php- if ($showSubscriptionProgress === 'true') {+ if ($showSubscriptionProgress === 'true' && !$subscription['inactive']) {$progress = $subscription['progress'] > 100 ? 100 : $subscription['progress'];?><div class="subscription-progress-container">diff --git a/includes/stats_calculations.php b/includes/stats_calculations.phpindex 760cac3..b7d9200 100644--- a/includes/stats_calculations.php+++ b/includes/stats_calculations.php@@ -115,7 +115,7 @@ $totalSavingsPerMonth = 0;$totalCostsInReplacementsPerMonth = 0;$statsSubtitleParts = [];-$query = "SELECT name, price, logo, frequency, cycle, currency_id, next_payment, payer_user_id, category_id, payment_method_id, inactive, replacement_subscription_id FROM subscriptions";+$query = "SELECT name, price, logo, frequency, cycle, currency_id, next_payment, payer_user_id, category_id, payment_method_id, inactive, replacement_subscription_id, start_date, auto_renew FROM subscriptions";$conditions = [];$params = [];@@ -212,12 +212,12 @@ if ($result) {if ($cycle != 5) {// Calculate ammount due this month$nextPaymentDate = DateTime::createFromFormat('Y-m-d', trim($next_payment));- $tomorrow = new DateTime('tomorrow');+ $todayVal = new DateTime('today');$endOfMonth = new DateTime('last day of this month');- if ($nextPaymentDate >= $tomorrow && $nextPaymentDate <= $endOfMonth) {+ if ($nextPaymentDate >= $todayVal && $nextPaymentDate <= $endOfMonth) {$timesToPay = 1;- $daysInMonth = $endOfMonth->diff($tomorrow)->days + 1;+ $daysInMonth = $endOfMonth->diff($todayVal)->days + 1;$daysRemaining = $endOfMonth->diff($nextPaymentDate)->days + 1;if ($cycle == 1) {$timesToPay = $daysRemaining / $frequency;diff --git a/includes/stats_extra_calculations.php b/includes/stats_extra_calculations.phpnew file mode 100644index 0000000..64b93a5--- /dev/null+++ b/includes/stats_extra_calculations.php@@ -0,0 +1,226 @@+<?php+// Wallos v5 — additional statistics for stats.php.+// Requires stats_calculations.php to have run first ($subscriptions, $db, $userId, $userData, $i18n, $lang).+// All monetary values are converted to the main currency. Lifetime figures assume current prices.++$monthLabelFormatter = null;+try {+ $monthLabelFormatter = new IntlDateFormatter($lang, IntlDateFormatter::SHORT, IntlDateFormatter::NONE, null, null, 'MMM yy');+} catch (Throwable $e) {+ $monthLabelFormatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::NONE, null, null, 'MMM yy');+}++// Currency codes for the currency exposure split+$currencyCodesById = [];+$stmt = $db->prepare("SELECT id, code FROM currencies WHERE user_id = :userId");+$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+while ($row = $result->fetchArray(SQLITE3_ASSOC)) {+ $currencyCodesById[$row['id']] = $row['code'];+}++// 12 projection buckets, starting next month+$projectionBuckets = [];+$projectionStart = new DateTime('first day of next month');+$projectionEnd = (clone $projectionStart)->modify('+12 months');+for ($i = 0; $i < 12; $i++) {+ $bucketDate = (clone $projectionStart)->modify("+$i months");+ $projectionBuckets[$bucketDate->format('Y-m')] = [+ 'label' => $monthLabelFormatter->format($bucketDate),+ 'total' => 0,+ ];+}++$cycleStepUnits = [1 => 'days', 2 => 'weeks', 3 => 'months', 4 => 'years'];++$activeMonthlyPrices = [];+$cheapestSubscription = null;+$manualRenewalsCount = 0;+$cycleSpend = [];+$currencySpend = [];+$paymentMethodCost = [];+$lifetimeSpends = [];+$totalLifetimeSpend = 0;+$oldestSubscription = null;+$subscriptionAges = [];+$newSubscriptionsPerYear = [];+$now = new DateTime('today');++if (isset($subscriptions)) {+ foreach ($subscriptions as $subscription) {+ $cycle = (int) $subscription['cycle'];+ $frequency = max(1, (int) $subscription['frequency']);+ $convertedPrice = getPriceConverted($subscription['price'], $subscription['currency_id'], $db, $userId);+ $monthlyPrice = getPricePerMonth($cycle, $frequency, $convertedPrice);++ // New subscriptions per year (all subscriptions, active or not)+ $startDate = null;+ if (!empty($subscription['start_date'])) {+ $startTimestamp = strtotime($subscription['start_date']);+ if ($startTimestamp !== false) {+ $startDate = (new DateTime())->setTimestamp($startTimestamp);+ $startYear = $startDate->format('Y');+ $newSubscriptionsPerYear[$startYear] = ($newSubscriptionsPerYear[$startYear] ?? 0) + 1;+ }+ }++ if ($subscription['inactive']) {+ continue;+ }++ // Split views over active spend+ if ($monthlyPrice > 0) {+ $cycleSpend[$cycle] = ($cycleSpend[$cycle] ?? 0) + $monthlyPrice;+ $currencyCode = $currencyCodesById[$subscription['currency_id']] ?? '?';+ $currencySpend[$currencyCode] = ($currencySpend[$currencyCode] ?? 0) + $monthlyPrice;+ $paymentMethodCost[$subscription['payment_method_id']] = ($paymentMethodCost[$subscription['payment_method_id']] ?? 0) + $monthlyPrice;+ }++ if ($cycle !== 5) {+ $activeMonthlyPrices[] = $monthlyPrice;++ if ($cheapestSubscription === null || $monthlyPrice < $cheapestSubscription['price']) {+ $cheapestSubscription = [+ 'price' => $monthlyPrice,+ 'name' => $subscription['name'],+ 'logo' => $subscription['logo'],+ ];+ }++ if ((int) $subscription['auto_renew'] !== 1) {+ $manualRenewalsCount++;+ }++ // Projection: walk renewals forward into the buckets+ $paymentTimestamp = strtotime($subscription['next_payment'] ?? '');+ if ($paymentTimestamp !== false && isset($cycleStepUnits[$cycle])) {+ $paymentDate = (new DateTime())->setTimestamp($paymentTimestamp);+ $safety = 0;+ while ($paymentDate < $projectionEnd && $safety < 1000) {+ if ($paymentDate >= $projectionStart) {+ $bucketKey = $paymentDate->format('Y-m');+ if (isset($projectionBuckets[$bucketKey])) {+ $projectionBuckets[$bucketKey]['total'] += $convertedPrice;+ }+ }+ $paymentDate->modify("+{$frequency} {$cycleStepUnits[$cycle]}");+ $safety++;+ }+ }++ // Lifetime spend and age (recurring subscriptions with a start date)+ if ($startDate !== null && $startDate <= $now) {+ $daysActive = $startDate->diff($now)->days;+ $ageYears = $daysActive / 365.25;+ $subscriptionAges[] = $ageYears;+ $lifetimeSpend = $monthlyPrice * ($daysActive / 30.44);+ $totalLifetimeSpend += $lifetimeSpend;+ $lifetimeSpends[] = [+ 'label' => html_entity_decode($subscription['name']),+ 'y' => round($lifetimeSpend, 2),+ ];++ if ($oldestSubscription === null || $ageYears > $oldestSubscription['years']) {+ $oldestSubscription = [+ 'years' => $ageYears,+ 'name' => $subscription['name'],+ 'logo' => $subscription['logo'],+ ];+ }+ }+ }+ }+}++// --- Tiles ---++$costPerDay = $totalCostPerMonth > 0 ? ($totalCostPerMonth * 12) / 365.25 : 0;++$averageSubscriptionAge = count($subscriptionAges) > 0 ? array_sum($subscriptionAges) / count($subscriptionAges) : null;++// Month-over-month delta from the recorded cost trend+$monthOverMonthDelta = null;+$monthOverMonthPercentage = null;+if (isset($totalMonthlyCostDataPoints) && count($totalMonthlyCostDataPoints) >= 2) {+ $lastPoint = $totalMonthlyCostDataPoints[count($totalMonthlyCostDataPoints) - 1]['y'];+ $previousPoint = $totalMonthlyCostDataPoints[count($totalMonthlyCostDataPoints) - 2]['y'];+ $monthOverMonthDelta = $lastPoint - $previousPoint;+ if ($previousPoint > 0) {+ $monthOverMonthPercentage = ($monthOverMonthDelta / $previousPoint) * 100;+ }+}++// Projection-derived tiles+$projectionDataPoints = [];+$heaviestMonth = null;+$monthsOverBudget = null;+foreach ($projectionBuckets as $bucket) {+ $bucketTotal = round($bucket['total'], 2);+ $projectionDataPoints[] = ['label' => $bucket['label'], 'y' => $bucketTotal];+ if ($heaviestMonth === null || $bucketTotal > $heaviestMonth['total']) {+ $heaviestMonth = ['label' => $bucket['label'], 'total' => $bucketTotal];+ }+}+$showProjectionGraph = $activeSubscriptions > 0 && $heaviestMonth !== null && $heaviestMonth['total'] > 0;+if (isset($budget) && $budget > 0 && $showProjectionGraph) {+ $monthsOverBudget = count(array_filter($projectionDataPoints, fn($point) => $point['y'] > $budget));+}++// --- Graph datasets ---++usort($lifetimeSpends, fn($a, $b) => $b['y'] <=> $a['y']);+$lifetimeDataPoints = array_slice($lifetimeSpends, 0, 10);+$showLifetimeGraph = count($lifetimeDataPoints) >= 2;++$cycleDataPoints = [];+foreach ($cycleSpend as $cycleId => $spend) {+ if ($cycleId === 5 || $spend <= 0) {+ continue;+ }+ $cycleNames = [1 => 'Daily', 2 => 'Weekly', 3 => 'Monthly', 4 => 'Yearly'];+ $cycleDataPoints[] = [+ 'label' => translate($cycleNames[$cycleId], $i18n),+ 'y' => round($spend, 2),+ ];+}+usort($cycleDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);+$showCycleGraph = count($cycleDataPoints) > 1;++$currencyDataPoints = [];+foreach ($currencySpend as $currencyCode => $spend) {+ if ($spend > 0) {+ $currencyDataPoints[] = ['label' => $currencyCode, 'y' => round($spend, 2)];+ }+}+usort($currencyDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);+$showCurrencyGraph = count($currencyDataPoints) > 1;++$histogramBoundaries = [5, 10, 20, 50];+$histogramCounts = array_fill(0, count($histogramBoundaries) + 1, 0);+foreach ($activeMonthlyPrices as $monthlyPrice) {+ $bucketIndex = count($histogramBoundaries);+ foreach ($histogramBoundaries as $index => $boundary) {+ if ($monthlyPrice < $boundary) {+ $bucketIndex = $index;+ break;+ }+ }+ $histogramCounts[$bucketIndex]++;+}+$histogramDataPoints = [];+$previousBoundary = 0;+foreach ($histogramBoundaries as $index => $boundary) {+ $histogramDataPoints[] = ['label' => "{$previousBoundary}–{$boundary}", 'y' => $histogramCounts[$index]];+ $previousBoundary = $boundary;+}+$histogramDataPoints[] = ['label' => "{$previousBoundary}+", 'y' => $histogramCounts[count($histogramBoundaries)]];+$showHistogramGraph = count($activeMonthlyPrices) >= 3;++ksort($newSubscriptionsPerYear);+$newPerYearDataPoints = [];+foreach ($newSubscriptionsPerYear as $year => $yearCount) {+ $newPerYearDataPoints[] = ['label' => (string) $year, 'y' => $yearCount];+}+$showYearlyNewGraph = count($newPerYearDataPoints) >= 2;++?>diff --git a/includes/subscription_details_popup.php b/includes/subscription_details_popup.phpnew file mode 100644index 0000000..eec0eb6--- /dev/null+++ b/includes/subscription_details_popup.php@@ -0,0 +1,138 @@+<?php+/*+ Shared subscription details popup (backdrop + dialog + lookups).+ Include once near the end of the page, before the page's own scripts.+ Requires: $i18n, $version, $subscriptions, and the getdbkeys.php arrays.+ Runs no queries of its own — on some pages $db is already closed here.+*/+require_once __DIR__ . '/getdbkeys.php';+?>++<div class="details-backdrop" id="details-backdrop" onClick="closeSubscriptionDetails()"></div>+<section class="subscription-details" id="subscription-details" role="dialog" aria-modal="true"+ aria-labelledby="details-name">+ <button type="button" class="details-close" onClick="closeSubscriptionDetails()"+ title="<?= translate('cancel', $i18n) ?>">+ <i class="fa-solid fa-xmark"></i>+ </button>+ <header class="details-hero">+ <div class="details-heading">+ <span class="details-logo" id="details-logo"></span>+ <div class="details-chips" id="details-chips"></div>+ </div>+ <h3 id="details-name"></h3>+ </header>+ <div class="details-price-row">+ <span class="details-price" id="details-price"></span>+ <span class="details-cycle" id="details-billing-cycle"></span>+ <button type="button" class="button secondary-button details-action-button details-export-button"+ id="details-export-button" title="<?= translate('export_icalendar', $i18n) ?>"+ aria-label="<?= translate('export_icalendar', $i18n) ?>">+ <i class="fa-solid fa-calendar-plus"></i>+ </button>+ <a class="button secondary-button details-action-button hide" id="details-url-button" href="#" target="_blank"+ rel="noreferrer" title="<?= translate('external_url', $i18n) ?>"+ aria-label="<?= translate('external_url', $i18n) ?>">+ <i class="fa-solid fa-globe"></i>+ </a>+ </div>+ <div class="details-progress-track" id="details-progress-track">+ <span class="details-progress" id="details-progress"></span>+ </div>+ <dl class="details-grid">+ <div class="details-item">+ <dt><?= translate('next_payment', $i18n) ?></dt>+ <dd id="details-next-payment"></dd>+ </div>+ <div class="details-item">+ <dt><?= translate('start_date', $i18n) ?></dt>+ <dd id="details-start-date"></dd>+ </div>+ <div class="details-item">+ <dt><?= translate('category', $i18n) ?></dt>+ <dd id="details-category"></dd>+ </div>+ <div class="details-item">+ <dt><?= translate('paid_by', $i18n) ?></dt>+ <dd id="details-payer"></dd>+ </div>+ <div class="details-item">+ <dt><?= translate('payment_method', $i18n) ?></dt>+ <dd id="details-payment-method">+ <img id="details-payment-icon" src="" alt="">+ <span id="details-payment-name"></span>+ </dd>+ </div>+ <div class="details-item">+ <dt><?= translate('notifications', $i18n) ?></dt>+ <dd id="details-notifications"></dd>+ </div>+ <div class="details-item hide" id="details-cancellation-item">+ <dt><?= translate('cancellation_notification', $i18n) ?></dt>+ <dd id="details-cancellation"></dd>+ </div>+ <div class="details-item hide" id="details-replacement-item">+ <dt><?= translate('replaced_with', $i18n) ?></dt>+ <dd id="details-replacement"></dd>+ </div>+ </dl>+ <div class="details-notes hide" id="details-notes-item">+ <i class="fa-solid fa-note-sticky"></i>+ <span id="details-notes"></span>+ </div>+</section>++<?php+$detailsLookups = [+ 'categories' => new stdClass(),+ 'members' => new stdClass(),+ 'paymentMethods' => new stdClass(),+ 'currencies' => new stdClass(),+ 'subscriptionNames' => new stdClass(),+ 'cycles' => [+ 1 => ['one' => translate('Daily', $i18n), 'many' => translate('days', $i18n)],+ 2 => ['one' => translate('Weekly', $i18n), 'many' => translate('weeks', $i18n)],+ 3 => ['one' => translate('Monthly', $i18n), 'many' => translate('months', $i18n)],+ 4 => ['one' => translate('Yearly', $i18n), 'many' => translate('years', $i18n)],+ 5 => ['one' => translate('One-time', $i18n), 'many' => translate('One-time', $i18n)],+ ],+ 'i18n' => [+ 'automatic' => translate('automatic', $i18n),+ 'manual_renewal' => translate('manual_renewal', $i18n),+ 'inactive' => translate('disabled', $i18n),+ 'one_time' => translate('One-time', $i18n),+ 'enabled' => translate('enabled', $i18n),+ 'disabled' => translate('disabled', $i18n),+ 'on_due_date' => translate('on_due_date', $i18n),+ 'day_before' => translate('day_before', $i18n),+ 'days_before' => translate('days_before', $i18n),+ 'none' => translate('none', $i18n),+ ],+];+foreach ($categories as $categoryId => $category) {+ $detailsLookups['categories']->{$categoryId} = $category['name'];+}+foreach ($members as $memberId => $member) {+ $detailsLookups['members']->{$memberId} = $member['name'];+}+foreach ($payment_methods as $paymentMethodId => $paymentMethod) {+ $paymentIconFolder = (strpos($paymentMethod['icon'], 'images/uploads/icons/') !== false) ? "" : "images/uploads/logos/";+ $detailsLookups['paymentMethods']->{$paymentMethodId} = [+ 'name' => $paymentMethod['name'],+ 'icon' => $paymentIconFolder . $paymentMethod['icon'],+ ];+}+foreach ($currencies as $currencyId => $currency) {+ $detailsLookups['currencies']->{$currencyId} = [+ 'code' => $currency['code'],+ 'symbol' => $currency['symbol'],+ ];+}+foreach ($subscriptions as $detailsSubscription) {+ $detailsLookups['subscriptionNames']->{$detailsSubscription['id']} = $detailsSubscription['name'];+}+?>+<script>+ window.subscriptionLookups = <?= json_encode($detailsLookups, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) ?>;+</script>+<script src="scripts/subscription-details.js?<?= $version ?>"></script>diff --git a/includes/version.php b/includes/version.phpindex 9115832..5f2453b 100644--- a/includes/version.php+++ b/includes/version.php@@ -1,3 +1,3 @@<?php-$version = "v4.9.6";+$version = "v5.0.0";?>diff --git a/index.php b/index.phpindex ca51cd0..d23ba55 100644--- a/index.php+++ b/index.php@@ -152,7 +152,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {$subscriptionDisplayPrice = formatPrice($subscriptionPrice, $currencies[$subscriptionCurrency]['code'], $currencies);?>- <div class="subscription-item">+ <div class="subscription-item" onClick="showSubscriptionDetails(event, <?= $subscription['id'] ?>)" data-id="<?= $subscription['id'] ?>"><?phpif (empty($subscription['logo'])) {?>@@ -201,7 +201,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {$subscriptionDisplayPrice = formatPrice($subscriptionPrice, $currencies[$subscriptionCurrency]['code'], $currencies);?>- <div class="subscription-item">+ <div class="subscription-item" onClick="showSubscriptionDetails(event, <?= $subscription['id'] ?>)" data-id="<?= $subscription['id'] ?>"><?phpif (empty($subscription['logo'])) {?>@@ -396,6 +396,18 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {</section>+<?php+// Get all subscriptions for user details lookup+$query = 'SELECT * FROM subscriptions WHERE user_id = :userId';+$stmt = $db->prepare($query);+$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+$subscriptions = [];+while ($row = $result->fetchArray(SQLITE3_ASSOC)) {+ $subscriptions[] = $row;+}+require_once 'includes/subscription_details_popup.php';+?><script src="scripts/dashboard.js?<?= $version ?>"></script>diff --git a/login.php b/login.phpindex 71301e6..3502026 100644--- a/login.php+++ b/login.php@@ -304,7 +304,7 @@ if (isset($_GET['error'])) {<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" id="theme-color" /><meta name="apple-mobile-web-app-title" content="Wallos"><title>Wallos - Subscription Tracker</title><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">@@ -326,10 +326,26 @@ if (isset($_GET['error'])) {window.color_theme = "<?= $colorTheme ?>";</script><script type="text/javascript" src="scripts/login.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/auth-theme.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/password-toggle.js?<?= $version ?>"></script></head><body class="<?= $languages[$lang]['dir'] ?>">- <div class="content">+ <button type="button" class="theme-toggle" id="theme-toggle" title="<?= translate('theme', $i18n) ?>"+ aria-label="<?= translate('theme', $i18n) ?>">+ <i class="fa-solid <?= $theme == "dark" ? "fa-sun" : "fa-moon" ?>"></i>+ </button>+ <div class="content auth-split">+ <aside class="auth-brand" aria-hidden="true">+ <div class="auth-brand-logo">+ <?php include "images/siteicons/svg/logo.php"; ?>+ </div>+ <div class="auth-brand-text">+ <h1><?= translate('auth_tagline', $i18n) ?></h1>+ <p><?= translate('auth_tagline_sub', $i18n) ?></p>+ </div>+ <div class="auth-brand-footer">Wallos — Subscription Tracker</div>+ </aside><section class="container"><header><div class="logo-image" title="Wallos - Subscription Tracker">@@ -437,9 +453,9 @@ if (isset($_GET['error'])) {<?phpif ($registrations) {?>- <div class="separator">- <input type="button" class="secondary-button" onclick="openRegitrationPage()"- value="<?= translate('register', $i18n) ?>"></input>+ <div class="login-form-link account-switch">+ <span><?= translate('no_account_yet', $i18n) ?></span>+ <a href="registration.php"><?= translate('register', $i18n) ?></a></div><?php}@@ -447,11 +463,6 @@ if (isset($_GET['error'])) {</form></section></div>- <script type="text/javascript">- function openRegitrationPage() {- window.location.href = "registration.php";- }- </script></body></html>diff --git a/migrations/000050.php b/migrations/000050.phpnew file mode 100644index 0000000..205fc40--- /dev/null+++ b/migrations/000050.php@@ -0,0 +1,14 @@+<?php+// This migration adds the "google_search" table, holding the optional+// SerpAPI key used to add Google image results to the subscription logo search.++$tableQuery = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='google_search'");+$tableRequired = $tableQuery->fetchArray(SQLITE3_ASSOC) === false;++if ($tableRequired) {+ $db->exec("CREATE TABLE google_search (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ user_id INTEGER NOT NULL,+ api_key TEXT NOT NULL DEFAULT ''+ )");+}diff --git a/migrations/000051.php b/migrations/000051.phpnew file mode 100644index 0000000..82f644d--- /dev/null+++ b/migrations/000051.php@@ -0,0 +1,13 @@+<?php+// This migration adds usage columns to the fixer table. They store the monthly+// quota reported by apilayer response headers (captured during rate updates),+// so the settings page can show usage without spending extra API requests.++$columnQuery = $db->query("SELECT * FROM pragma_table_info('fixer') where name='usage_used'");+$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;++if ($columnRequired) {+ $db->exec("ALTER TABLE fixer ADD COLUMN usage_used INTEGER DEFAULT NULL");+ $db->exec("ALTER TABLE fixer ADD COLUMN usage_limit INTEGER DEFAULT NULL");+ $db->exec("ALTER TABLE fixer ADD COLUMN usage_updated_at TEXT DEFAULT NULL");+}diff --git a/passwordreset.php b/passwordreset.phpindex 0ec16c4..484e6c8 100644--- a/passwordreset.php+++ b/passwordreset.php@@ -139,7 +139,7 @@ if (isset($_POST['password']) && $_POST['password'] != "" && isset($_POST['confi<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" /><meta name="apple-mobile-web-app-title" content="Wallos"><title>Wallos - Subscription Tracker</title><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">@@ -156,10 +156,26 @@ if (isset($_POST['password']) && $_POST['password'] != "" && isset($_POST['confi<link rel="stylesheet" href="styles/font-awesome.min.css"><link rel="stylesheet" href="styles/barlow.css"><link rel="stylesheet" href="styles/login-dark-theme.css?<?= $version ?>" id="dark-theme" <?= $theme == "light" ? "disabled" : "" ?>>+ <script type="text/javascript" src="scripts/auth-theme.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/password-toggle.js?<?= $version ?>"></script></head><body class="<?= $languages[$lang]['dir'] ?>">- <div class="content">+ <button type="button" class="theme-toggle" id="theme-toggle" title="<?= translate('theme', $i18n) ?>"+ aria-label="<?= translate('theme', $i18n) ?>">+ <i class="fa-solid <?= $theme == "dark" ? "fa-sun" : "fa-moon" ?>"></i>+ </button>+ <div class="content auth-split">+ <aside class="auth-brand" aria-hidden="true">+ <div class="auth-brand-logo">+ <?php include "images/siteicons/svg/logo.php"; ?>+ </div>+ <div class="auth-brand-text">+ <h1><?= translate('auth_tagline', $i18n) ?></h1>+ <p><?= translate('auth_tagline_sub', $i18n) ?></p>+ </div>+ <div class="auth-brand-footer">Wallos — Subscription Tracker</div>+ </aside><section class="container"><header><div class="logo-image" title="Wallos - Subscription Tracker">@@ -254,4 +270,4 @@ if (isset($_POST['password']) && $_POST['password'] != "" && isset($_POST['confi</script></body>-</html>\ No newline at end of file+</html>\ No newline at end of filediff --git a/registration.php b/registration.phpindex a85212e..1ebd0a2 100644--- a/registration.php+++ b/registration.php@@ -327,7 +327,7 @@ if (isset($_POST['username'])) {<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" id="theme-color" /><meta name="apple-mobile-web-app-title" content="Wallos"><title>Wallos - Subscription Tracker</title><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">@@ -349,11 +349,27 @@ if (isset($_POST['username'])) {window.colorTheme = "<?= $colorTheme ?>";</script><script type="text/javascript" src="scripts/registration.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/auth-theme.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/password-toggle.js?<?= $version ?>"></script></head><body class="<?= $languages[$lang]['dir'] ?>">- <div class="content">- <section class="container">+ <button type="button" class="theme-toggle" id="theme-toggle" title="<?= translate('theme', $i18n) ?>"+ aria-label="<?= translate('theme', $i18n) ?>">+ <i class="fa-solid <?= $theme == "dark" ? "fa-sun" : "fa-moon" ?>"></i>+ </button>+ <div class="content auth-split">+ <aside class="auth-brand" aria-hidden="true">+ <div class="auth-brand-logo">+ <?php include "images/siteicons/svg/logo.php"; ?>+ </div>+ <div class="auth-brand-text">+ <h1><?= translate('auth_tagline', $i18n) ?></h1>+ <p><?= translate('auth_tagline_sub', $i18n) ?></p>+ </div>+ <div class="auth-brand-footer">Wallos — Subscription Tracker</div>+ </aside>+ <section class="container wide"><header><div class="logo-image" title="Wallos - Subscription Tracker"><?php include "images/siteicons/svg/logo.php"; ?>@@ -362,7 +378,7 @@ if (isset($_POST['username'])) {<?= translate('create_account', $i18n) ?></p></header>- <form action="registration.php" method="post">+ <form action="registration.php" method="post" class="registration-form"><div class="form-group"><label for="username"><?= translate('username', $i18n) ?>:</label><input type="text" id="username" name="username" autocomplete="username" required>@@ -467,8 +483,9 @@ if (isset($_POST['username'])) {<?php} else {?>- <div class="separator">- <input id="goToLoginButton" type="button" class="secondary-button" value="<?= translate('login', $i18n) ?>">+ <div class="login-form-link account-switch">+ <span><?= translate('already_have_account', $i18n) ?></span>+ <a href="login.php"><?= translate('login', $i18n) ?></a></div><?php}diff --git a/screenshots/capture_screenshots.py b/screenshots/capture_screenshots.pynew file mode 100644index 0000000..acc2fcd--- /dev/null+++ b/screenshots/capture_screenshots.py@@ -0,0 +1,192 @@+"""+Regenerates the README screenshots against a running Wallos instance.++Requires: pip install playwright && playwright install chromium++Usage:+ WALLOS_URL=http://172.26.64.1/wallos \+ WALLOS_USERNAME=ellite \+ WALLOS_PASSWORD=screenshots \+ python3 capture_screenshots.py++WALLOS_URL defaults to http://172.26.64.1/wallos, which is the default+gateway address XAMPP on Windows is reachable at from WSL2.++Expects a test account with curated subscriptions (including one named+"Vodafone") and logos/display settings already set up the way we want+them screenshotted.+"""++import os+from pathlib import Path+from playwright.sync_api import sync_playwright++BASE = os.environ.get("WALLOS_URL", "http://172.26.64.1/wallos")+USERNAME = os.environ["WALLOS_USERNAME"]+PASSWORD = os.environ["WALLOS_PASSWORD"]+OUT = Path(__file__).resolve().parent++DESKTOP_VIEWPORT = {"width": 1280, "height": 1100}+++def login(page):+ page.goto(f"{BASE}/login.php")+ page.fill('#username', USERNAME)+ page.fill('#password', PASSWORD)+ page.click('input[type="submit"]')+ page.wait_for_load_state('networkidle')+++def set_theme(page, which):+ """which: 'light' or 'dark'"""+ page.goto(f"{BASE}/settings.php")+ page.click(f'#theme-{which}')+ page.wait_for_timeout(800)+++def set_view(page, which):+ """which: 'list' or 'grid'. Persisted via cookie, so it carries over+ to the mobile context through storage_state."""+ page.goto(f"{BASE}/subscriptions.php")+ page.wait_for_load_state('networkidle')+ page.click(f'#view-{which}-button')+ page.wait_for_timeout(500)+++def shot(page, path):+ page.wait_for_timeout(300)+ page.screenshot(path=str(OUT / path))+ print("saved", path)+++def open_vodafone_popup(page):+ page.goto(f"{BASE}/subscriptions.php")+ page.wait_for_load_state('networkidle')+ card = page.locator('.subscription', has_text="Vodafone").first+ card.click(position={"x": 20, "y": 20})+ page.wait_for_timeout(500)+++def close_popup(page):+ page.keyboard.press("Escape")+ page.wait_for_timeout(300)+++def open_add_form(page):+ page.goto(f"{BASE}/subscriptions.php")+ page.wait_for_load_state('networkidle')+ page.click('button[onclick="addSubscription()"]')+ page.wait_for_timeout(500)+ page.fill('#name', 'HBO Max')+ page.fill('#price', '9.99')+++def capture_desktop(page, dark):+ suffix = "dark" if dark else "light"++ page.goto(f"{BASE}/index.php")+ page.wait_for_load_state('networkidle')+ shot(page, f"wallos-dashboard-{suffix}.png")++ page.goto(f"{BASE}/subscriptions.php")+ page.wait_for_load_state('networkidle')+ shot(page, f"wallos-subscriptions-{suffix}.png")++ if not dark:+ page.goto(f"{BASE}/stats.php")+ page.wait_for_load_state('networkidle')+ page.evaluate("window.scrollTo(0, 200)")+ page.wait_for_timeout(200)+ shot(page, "wallos-stats.png")++ page.goto(f"{BASE}/calendar.php")+ page.wait_for_load_state('networkidle')+ shot(page, "wallos-calendar.png")++ open_add_form(page)+ shot(page, "wallos-form.png")++ open_vodafone_popup(page)+ shot(page, "wallos-subscriptions-popup.png")+ close_popup(page)+++def capture_mobile(page, dark):+ suffix = "dark" if dark else "light"++ page.goto(f"{BASE}/subscriptions.php")+ page.wait_for_load_state('networkidle')+ shot(page, f"wallos-subscriptions-mobile-{suffix}.png")++ if not dark:+ open_vodafone_popup(page)+ shot(page, "wallos-subscriptions-mobile-sheet.png")+ close_popup(page)++ page.goto(f"{BASE}/index.php")+ page.wait_for_load_state('networkidle')+ shot(page, f"wallos-dashboard-mobile-{suffix}.png")+++def main():+ with sync_playwright() as p:+ browser = p.chromium.launch()++ desktop_ctx = browser.new_context(viewport=DESKTOP_VIEWPORT, locale="en-US")+ dpage = desktop_ctx.new_page()+ login(dpage)++ # find current theme selection to restore later+ dpage.goto(f"{BASE}/settings.php")+ original_theme = None+ for name in ("light", "dark", "automatic"):+ classes = dpage.locator(f"#theme-{name}").get_attribute("class") or ""+ if "selected" in classes:+ original_theme = name+ print("original theme:", original_theme)++ # find current view (list/grid) selection to restore later+ dpage.goto(f"{BASE}/subscriptions.php")+ dpage.wait_for_load_state('networkidle')+ grid_classes = dpage.locator("#view-grid-button").get_attribute("class") or ""+ original_view = "grid" if "selected" in grid_classes else "list"+ print("original view:", original_view)++ iphone = dict(p.devices["iPhone 14 Pro Max"])+ iphone["viewport"] = {"width": 430, "height": 932}++ # Screenshots use grid view throughout; the cookie this sets carries+ # over to the mobile context below via storage_state.+ set_view(dpage, "grid")++ # ---------- LIGHT ----------+ set_theme(dpage, "light")+ capture_desktop(dpage, dark=False)++ storage_state = desktop_ctx.storage_state()+ mobile_ctx = browser.new_context(storage_state=storage_state, locale="en-US", **iphone)+ mpage = mobile_ctx.new_page()+ capture_mobile(mpage, dark=False)+ mobile_ctx.close()++ # ---------- DARK ----------+ set_theme(dpage, "dark")+ capture_desktop(dpage, dark=True)++ storage_state = desktop_ctx.storage_state()+ mobile_ctx = browser.new_context(storage_state=storage_state, locale="en-US", **iphone)+ mpage = mobile_ctx.new_page()+ capture_mobile(mpage, dark=True)+ mobile_ctx.close()++ # ---------- restore original theme/view ----------+ if original_theme:+ set_theme(dpage, original_theme)+ set_view(dpage, original_view)++ desktop_ctx.close()+ browser.close()+++if __name__ == "__main__":+ main()diff --git a/screenshots/wallos-calendar.png b/screenshots/wallos-calendar.pngindex 8b837ab..cea41ff 100644Binary files a/screenshots/wallos-calendar.png and b/screenshots/wallos-calendar.png differdiff --git a/screenshots/wallos-dashboard-dark.png b/screenshots/wallos-dashboard-dark.pngnew file mode 100644index 0000000..fc68ac7Binary files /dev/null and b/screenshots/wallos-dashboard-dark.png differdiff --git a/screenshots/wallos-dashboard-light.png b/screenshots/wallos-dashboard-light.pngnew file mode 100644index 0000000..7dd7efdBinary files /dev/null and b/screenshots/wallos-dashboard-light.png differdiff --git a/screenshots/wallos-dashboard-mobile-dark.png b/screenshots/wallos-dashboard-mobile-dark.pngindex 954d803..7d9440c 100644Binary files a/screenshots/wallos-dashboard-mobile-dark.png and b/screenshots/wallos-dashboard-mobile-dark.png differdiff --git a/screenshots/wallos-dashboard-mobile-light.png b/screenshots/wallos-dashboard-mobile-light.pngindex 3251e22..ec58aba 100644Binary files a/screenshots/wallos-dashboard-mobile-light.png and b/screenshots/wallos-dashboard-mobile-light.png differdiff --git a/screenshots/wallos-form.png b/screenshots/wallos-form.pngindex 48541a4..5a98642 100644Binary files a/screenshots/wallos-form.png and b/screenshots/wallos-form.png differdiff --git a/screenshots/wallos-stats.png b/screenshots/wallos-stats.pngindex 2861a20..f417940 100644Binary files a/screenshots/wallos-stats.png and b/screenshots/wallos-stats.png differdiff --git a/screenshots/wallos-subscriptions-dark.png b/screenshots/wallos-subscriptions-dark.pngindex 26aa915..79cd9eb 100644Binary files a/screenshots/wallos-subscriptions-dark.png and b/screenshots/wallos-subscriptions-dark.png differdiff --git a/screenshots/wallos-subscriptions-light.png b/screenshots/wallos-subscriptions-light.pngindex f300c13..f06a31e 100644Binary files a/screenshots/wallos-subscriptions-light.png and b/screenshots/wallos-subscriptions-light.png differdiff --git a/screenshots/wallos-subscriptions-mobile-dark.png b/screenshots/wallos-subscriptions-mobile-dark.pngindex 05187f1..2489b29 100644Binary files a/screenshots/wallos-subscriptions-mobile-dark.png and b/screenshots/wallos-subscriptions-mobile-dark.png differdiff --git a/screenshots/wallos-subscriptions-mobile-light.png b/screenshots/wallos-subscriptions-mobile-light.pngindex dff3d38..bdb21bf 100644Binary files a/screenshots/wallos-subscriptions-mobile-light.png and b/screenshots/wallos-subscriptions-mobile-light.png differdiff --git a/screenshots/wallos-subscriptions-mobile-sheet.png b/screenshots/wallos-subscriptions-mobile-sheet.pngnew file mode 100644index 0000000..dffc41bBinary files /dev/null and b/screenshots/wallos-subscriptions-mobile-sheet.png differdiff --git a/screenshots/wallos-subscriptions-popup.png b/screenshots/wallos-subscriptions-popup.pngnew file mode 100644index 0000000..6c4570eBinary files /dev/null and b/screenshots/wallos-subscriptions-popup.png differdiff --git a/scripts/auth-theme.js b/scripts/auth-theme.jsnew file mode 100644index 0000000..b58e894--- /dev/null+++ b/scripts/auth-theme.js@@ -0,0 +1,37 @@+function applyAuthThemeIcon() {+ const darkCss = document.getElementById('dark-theme');+ const icon = document.querySelector('#theme-toggle i');+ if (!darkCss || !icon) {+ return;+ }+ icon.className = 'fa-solid ' + (darkCss.disabled ? 'fa-moon' : 'fa-sun');+}++function toggleAuthTheme() {+ const darkCss = document.getElementById('dark-theme');+ if (!darkCss) {+ return;+ }+ const next = darkCss.disabled ? 'dark' : 'light';+ darkCss.disabled = next === 'light';++ const expirationDate = new Date();+ expirationDate.setFullYear(expirationDate.getFullYear() + 1);+ document.cookie = 'theme=' + next + '; expires=' + expirationDate.toUTCString() + '; SameSite=Lax';++ const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');+ if (themeColorMetaTag) {+ themeColorMetaTag.setAttribute('content', next === 'dark' ? '#12151C' : '#FFFFFF');+ }++ applyAuthThemeIcon();+}++document.addEventListener('DOMContentLoaded', function () {+ const toggle = document.getElementById('theme-toggle');+ if (toggle) {+ toggle.addEventListener('click', toggleAuthTheme);+ }+ // Sync the icon after login.js may have applied the OS preference+ applyAuthThemeIcon();+});diff --git a/scripts/calendar.js b/scripts/calendar.jsindex 578329c..0e16832 100644--- a/scripts/calendar.js+++ b/scripts/calendar.js@@ -22,91 +22,6 @@ function currentMoth() {window.location.href = `calendar.php`;}-function closeSubscriptionModal() {- const modal = document.getElementById('subscriptionModal');- modal.classList.remove('is-open');-}--function openSubscriptionModal(subscriptionId) {- const modal = document.getElementById('subscriptionModal');- const modalContent = document.getElementById('subscriptionModalContent');-- modalContent.innerHTML = '';-- fetch('endpoints/subscription/getcalendar.php', {- method: 'POST',- body: JSON.stringify({id: subscriptionId}),- headers: {- 'Content-Type': 'application/json'- }- })- .then(response => response.json())- .then(data => {- if (data.success && data.data) {- const subscription = data.data;- const html = `- <div class="modal-header">- <h3>${subscription.name}</h3>- <span class="fa-solid fa-xmark close-modal" onclick="closeSubscriptionModal()"></span>- </div>- <div class="modal-body">- ${subscription.logo ? `<div class="subscription-logo">- <img src="images/uploads/logos/${subscription.logo}" alt="${subscription.name}">- </div>` : ''}- <div class="subscription-info">- ${subscription.price ? `<p><strong>${translate('price')}:</strong> ${subscription.currency}${subscription.price}</p>` : ''}- ${subscription.category ? `<p><strong>${translate('category')}:</strong> ${subscription.category}</p>` : ''}- ${subscription.payer_user ? `<p><strong>${translate('paid_by')}:</strong> ${subscription.payer_user}</p>` : ''}- ${subscription.payment_method ? `<p><strong>${translate('payment_method')}:</strong> ${subscription.payment_method}</p>` : ''}- ${subscription.notes ? `<p><strong>${translate('notes')}:</strong> ${subscription.notes}</p>` : ''}- </div>- </div>- <div class="modal-footer">- <button class="button tiny" onclick="exportCalendar(${subscription.id})">${translate('export')}</button>- </div>`;- modalContent.innerHTML = html;- modal.classList.add('is-open');- } else {- console.error(data.message);- }- })- .catch(error => console.error('Error:', error));-}--function decodeHtmlEntities(str) {- const txt = document.createElement('textarea');- txt.innerHTML = str;- return txt.value;-}--function exportCalendar(subscriptionId) {- fetch('endpoints/subscription/exportcalendar.php', {- method: 'POST',- body: JSON.stringify({id: subscriptionId}),- headers: {- 'Content-Type': 'application/json',- 'X-CSRF-Token': window.csrfToken,- }- })- .then(response => response.json())- .then(data => {- if (data.success && data.ics) {- const blob = new Blob([data.ics], {type: 'text/calendar'});- const url = window.URL.createObjectURL(blob);- const a = document.createElement('a');- a.href = url;- // Use the subscription name for the file name, replacing any characters that are invalid in file names- a.download = `${decodeHtmlEntities(data.name).replace(/[\/\\:*?"<>|]/g, '_').toLowerCase()}.ics`;- document.body.appendChild(a);- a.click();- window.URL.revokeObjectURL(url);- } else {- showErrorMessage(data.message);- }- })- .catch(error => console.error('Error:', error));-}-function showExportPopup() {const host = window.location.href;const apiPath = "api/subscriptions/get_ical_feed.php";diff --git a/scripts/common.js b/scripts/common.jsindex c8b9a17..4e69dd4 100644--- a/scripts/common.js+++ b/scripts/common.js@@ -1,5 +1,27 @@let isDropdownOpen = false;+// Shared loading/empty/error states for the logo & payment icon search popups+function showSearchState(container, state) {+ if (state === 'loading') {+ container.innerHTML = '<div class="search-state"><i class="fa-solid fa-spinner fa-spin"></i></div>';+ return;+ }++ const isError = state === 'error';+ const icon = isError ? 'fa-circle-exclamation' : 'fa-magnifying-glass';+ const message = isError+ ? translate('error_fetching_image_results').replace(/:\s*$/, '')+ : translate('no_results_found');++ const stateElement = document.createElement('div');+ stateElement.className = 'search-state' + (isError ? ' error' : '');+ stateElement.innerHTML = `<i class="fa-solid ${icon}"></i>`;+ stateElement.appendChild(document.createTextNode(message));++ container.innerHTML = '';+ container.appendChild(stateElement);+}+function toggleDropdown() {const dropdown = document.querySelector('.dropdown');dropdown.classList.toggle('is-open');@@ -85,7 +107,7 @@ document.addEventListener('DOMContentLoaded', function () {document.cookie = `inUseTheme=${themePreference}; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax`;const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');- themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');+ themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#12151C' : '#FFFFFF');}document.addEventListener('mousedown', function (event) {diff --git a/scripts/i18n/ca.js b/scripts/i18n/ca.jsindex 7b4ea07..446e952 100644--- a/scripts/i18n/ca.js+++ b/scripts/i18n/ca.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Mètode de pagment",notes: "Notes",export: "Exportar",+ no_results_found: "No s'han trobat resultats",}diff --git a/scripts/i18n/cs.js b/scripts/i18n/cs.jsindex 766a686..4670454 100644--- a/scripts/i18n/cs.js+++ b/scripts/i18n/cs.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Platební metoda",notes: "Poznámky",export: "Exportovat",+ no_results_found: "Nebyly nalezeny žádné výsledky",}diff --git a/scripts/i18n/da.js b/scripts/i18n/da.jsindex df2d218..36608e3 100644--- a/scripts/i18n/da.js+++ b/scripts/i18n/da.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Betalingsmetode",notes: "Noter",export: "Eksportér",+ no_results_found: "Ingen resultater fundet",}diff --git a/scripts/i18n/de.js b/scripts/i18n/de.jsindex 4d1e97b..f59ca94 100644--- a/scripts/i18n/de.js+++ b/scripts/i18n/de.js@@ -48,4 +48,5 @@ let i18n = {payment_method: "Zahlungsmethode",notes: "Notizen",export: "Exportieren",+ no_results_found: "Keine Ergebnisse gefunden",}diff --git a/scripts/i18n/el.js b/scripts/i18n/el.jsindex 0e991f2..3efe453 100644--- a/scripts/i18n/el.js+++ b/scripts/i18n/el.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Μέθοδος πληρωμής",notes: "Σημειώσεις",export: "Εξαγωγή",+ no_results_found: "Δεν βρέθηκαν αποτελέσματα",}diff --git a/scripts/i18n/en.js b/scripts/i18n/en.jsindex e7493f7..97fea47 100644--- a/scripts/i18n/en.js+++ b/scripts/i18n/en.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Payment method",notes: "Notes",export: "Export",+ no_results_found: "No results found",}diff --git a/scripts/i18n/es.js b/scripts/i18n/es.jsindex bd5c64b..c45ac19 100644--- a/scripts/i18n/es.js+++ b/scripts/i18n/es.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Método de pago",notes: "Notas",export: "Exportar",+ no_results_found: "No se encontraron resultados",}diff --git a/scripts/i18n/fr.js b/scripts/i18n/fr.jsindex 9b41d62..b9812c6 100644--- a/scripts/i18n/fr.js+++ b/scripts/i18n/fr.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Méthode de paiement",notes: "Notes",export: "Exporter",+ no_results_found: "Aucun résultat trouvé",};diff --git a/scripts/i18n/hu.js b/scripts/i18n/hu.jsindex f9e19f1..49f7ce1 100644--- a/scripts/i18n/hu.js+++ b/scripts/i18n/hu.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Fizetési mód",notes: "Jegyzetek",export: "Exportálás",+ no_results_found: "Nincs találat",}diff --git a/scripts/i18n/id.js b/scripts/i18n/id.jsindex 668313e..96ff2b2 100644--- a/scripts/i18n/id.js+++ b/scripts/i18n/id.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Metode pembayaran",notes: "Catatan",export: "Ekspor",+ no_results_found: "Tidak ada hasil ditemukan",}diff --git a/scripts/i18n/it.js b/scripts/i18n/it.jsindex 1f15298..cfc3a52 100644--- a/scripts/i18n/it.js+++ b/scripts/i18n/it.js@@ -47,4 +47,5 @@ let i18n = {payment_method: "Metodo di pagamento",notes: "Note",export: "Esporta",+ no_results_found: "Nessun risultato trovato",}diff --git a/scripts/i18n/ja.js b/scripts/i18n/ja.jsindex a6960fe..49954c7 100644--- a/scripts/i18n/ja.js+++ b/scripts/i18n/ja.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "支払い方法",notes: "メモ",export: "エクスポート",+ no_results_found: "結果が見つかりません",}diff --git a/scripts/i18n/ko.js b/scripts/i18n/ko.jsindex 72d82c7..0a77d6a 100644--- a/scripts/i18n/ko.js+++ b/scripts/i18n/ko.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "결제 수단",notes: "메모",export: "내보내기",+ no_results_found: "결과를 찾을 수 없습니다",};diff --git a/scripts/i18n/nl.js b/scripts/i18n/nl.jsindex db0f298..3a47e1e 100644--- a/scripts/i18n/nl.js+++ b/scripts/i18n/nl.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Betaalmethode",notes: "Notities",export: "Exporteren"+ no_results_found: "Geen resultaten gevonden",}diff --git a/scripts/i18n/pl.js b/scripts/i18n/pl.jsindex 56891bc..e78f398 100644--- a/scripts/i18n/pl.js+++ b/scripts/i18n/pl.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Metoda płatności",notes: "Notatki",export: "Eksport",+ no_results_found: "Nie znaleziono wyników",}diff --git a/scripts/i18n/pt.js b/scripts/i18n/pt.jsindex 7989cd0..6d4dca5 100644--- a/scripts/i18n/pt.js+++ b/scripts/i18n/pt.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Método de pagamento",notes: "Notas",export: "Exportar",+ no_results_found: "Nenhum resultado encontrado",};diff --git a/scripts/i18n/pt_br.js b/scripts/i18n/pt_br.jsindex c0050ca..2bfe3ef 100644--- a/scripts/i18n/pt_br.js+++ b/scripts/i18n/pt_br.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Método de pagamento",notes: "Notas",export: "Exportar",+ no_results_found: "Nenhum resultado encontrado",}diff --git a/scripts/i18n/ro.js b/scripts/i18n/ro.jsindex 638134d..e871cbf 100644--- a/scripts/i18n/ro.js+++ b/scripts/i18n/ro.js@@ -46,4 +46,5 @@ let i18n = {payment_method: ",Metoda de plată",notes: "Notițe",export: "Export",+ no_results_found: "Nu s-au găsit rezultate",}diff --git a/scripts/i18n/ru.js b/scripts/i18n/ru.jsindex 9169096..0ebde64 100644--- a/scripts/i18n/ru.js+++ b/scripts/i18n/ru.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Способ оплаты",notes: "Примечания",export: "Экспорт",+ no_results_found: "Ничего не найдено",}diff --git a/scripts/i18n/sl.js b/scripts/i18n/sl.jsindex d4b6e87..b340479 100644--- a/scripts/i18n/sl.js+++ b/scripts/i18n/sl.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Način plačila",notes: "Opombe",export: "Izvozi",+ no_results_found: "Ni najdenih rezultatov",}diff --git a/scripts/i18n/sr.js b/scripts/i18n/sr.jsindex 22e0821..4b276dd 100644--- a/scripts/i18n/sr.js+++ b/scripts/i18n/sr.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Метод плаћања",notes: "Белешке",export: "Извоз",+ no_results_found: "Нема резултата",}diff --git a/scripts/i18n/sr_lat.js b/scripts/i18n/sr_lat.jsindex fea3680..19f228f 100644--- a/scripts/i18n/sr_lat.js+++ b/scripts/i18n/sr_lat.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Način plaćanja",notes: "Beleške",export: "Izvezi",+ no_results_found: "Nema rezultata",}diff --git a/scripts/i18n/tr.js b/scripts/i18n/tr.jsindex 900912d..0ecba7b 100644--- a/scripts/i18n/tr.js+++ b/scripts/i18n/tr.js@@ -46,6 +46,7 @@ let i18n = {payment_method: "Payment method",notes: "Notes",export: "Export",+ no_results_found: "Sonuç bulunamadı",}diff --git a/scripts/i18n/uk.js b/scripts/i18n/uk.jsindex ce259e6..e3ca81c 100644--- a/scripts/i18n/uk.js+++ b/scripts/i18n/uk.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Спосіб оплати",notes: "Примітки",export: "Експорт",+ no_results_found: "Нічого не знайдено",}diff --git a/scripts/i18n/vi.js b/scripts/i18n/vi.jsindex 6b908fd..740cf5e 100644--- a/scripts/i18n/vi.js+++ b/scripts/i18n/vi.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "Phương thức thanh toán",notes: "Ghi chú",export: "Xuất",+ no_results_found: "Không tìm thấy kết quả",}diff --git a/scripts/i18n/zh_cn.js b/scripts/i18n/zh_cn.jsindex a49a497..39822ab 100644--- a/scripts/i18n/zh_cn.js+++ b/scripts/i18n/zh_cn.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "支付方式",notes: "备注",export: "导出",+ no_results_found: "未找到结果",};diff --git a/scripts/i18n/zh_tw.js b/scripts/i18n/zh_tw.jsindex a89242c..25b2468 100644--- a/scripts/i18n/zh_tw.js+++ b/scripts/i18n/zh_tw.js@@ -46,4 +46,5 @@ let i18n = {payment_method: "支付方式",notes: "備註",export: "匯出",+ no_results_found: "找不到結果",};diff --git a/scripts/libs/apexcharts.min.js b/scripts/libs/apexcharts.min.jsnew file mode 100644index 0000000..0bde11b--- /dev/null+++ b/scripts/libs/apexcharts.min.js@@ -0,0 +1,5 @@+/*!+ * ApexCharts v5.15.2+ * (c) 2018-2026 ApexCharts+ */+!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).ApexCharts=e()}(this,function(){"use strict";var t=Object.defineProperty,e=Object.defineProperties,s=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,n=(t,e)=>{for(var s in e||(e={}))a.call(e,s)&&r(t,s,e[s]);if(i)for(var s of i(e))o.call(e,s)&&r(t,s,e[s]);return t},l=(t,i)=>e(t,s(i)),h=(t,e,s)=>r(t,"symbol"!=typeof e?e+"":e,s);class c{static isSSR(){return"undefined"==typeof window||"undefined"==typeof document}static isBrowser(){return!this.isSSR()}static hasAPI(t){return!this.isSSR()&&void 0!==window[t]}static getApex(){return"undefined"!=typeof window&&window.Apex?window.Apex:"undefined"!=typeof global&&global.Apex?global.Apex:{}}}class d{constructor(t,e=null){this.nodeName=t,this.namespaceURI=e,this.attributes=new Map,this.children=[],this.textContent="",this.style={},this.classList=new g,this.parentNode=null,this._ssrWidth=void 0,this._ssrHeight=void 0,this._ssrMode=void 0}setAttribute(t,e){this.attributes.set(t,e)}getAttribute(t){return this.attributes.get(t)}removeAttribute(t){this.attributes.delete(t)}hasAttribute(t){return this.attributes.has(t)}appendChild(t){if(t&&t!==this){if(t.parentNode&&t.parentNode!==this)t.parentNode.removeChild(t);else if(t.parentNode===this){const e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1)}t.parentNode=this,this.children.push(t)}return t}removeChild(t){const e=this.children.indexOf(t);return-1!==e&&(this.children.splice(e,1),t.parentNode=null),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(t.parentNode&&t.parentNode!==this)t.parentNode.removeChild(t);else if(t.parentNode===this){const e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1)}const s=this.children.indexOf(e);return-1!==s&&(t.parentNode=this,this.children.splice(s,0,t)),t}cloneNode(t=!1){const e=new d(this.nodeName,this.namespaceURI);return e.textContent=this.textContent,this.attributes.forEach((t,s)=>{e.attributes.set(s,t)}),Object.assign(e.style,this.style),t&&this.children.forEach(t=>{t.cloneNode&&e.appendChild(t.cloneNode(!0))}),e}getBoundingClientRect(){return{width:this._ssrWidth||0,height:this._ssrHeight||0,top:0,left:0,right:this._ssrWidth||0,bottom:this._ssrHeight||0,x:0,y:0}}getRootNode(){let t=this;for(;t.parentNode;)t=t.parentNode;return t}querySelector(){return null}querySelectorAll(){return[]}getElementsByClassName(){return[]}addEventListener(){}removeEventListener(){}get childNodes(){return this.children}toString(){let t="";if(this.attributes.forEach((e,s)=>{t+=` ${s}="${e}"`}),0===this.children.length&&!this.textContent)return`<${this.nodeName}${t}/>`;const e=this.children.map(t=>t.toString()).join("");return`<${this.nodeName}${t}>${this.textContent}${e}</${this.nodeName}>`}get innerHTML(){return this.children.map(t=>t.toString()).join("")}set innerHTML(t){this.children=[],this.textContent=t}get outerHTML(){return this.toString()}get isConnected(){return!0}}class g{constructor(){this.classes=new Set}add(...t){t.forEach(t=>this.classes.add(t))}remove(...t){t.forEach(t=>this.classes.delete(t))}contains(t){return this.classes.has(t)}toggle(t,e){return!0===e?(this.classes.add(t),!0):!1===e||this.classes.has(t)?(this.classes.delete(t),!1):(this.classes.add(t),!0)}toString(){return Array.from(this.classes).join(" ")}}class p{constructor(){this.SVGNS="http://www.w3.org/2000/svg",this.XLINKNS="http://www.w3.org/1999/xlink"}createElementNS(t,e){return new d(e,t)}createTextNode(t){const e={nodeName:"#text",nodeType:3,textContent:t,toString:()=>e.textContent};return e}querySelector(){return null}querySelectorAll(){return[]}getComputedStyle(){return{}}getBoundingClientRect(t){return t&&t.getBoundingClientRect?t.getBoundingClientRect():{width:0,height:0,top:0,left:0,right:0,bottom:0,x:0,y:0}}createXMLSerializer(){return{serializeToString:t=>t.toString?t.toString():""}}createDOMParser(){return{parseFromString(t,e){const s=new d("root");return s.innerHTML=t,{documentElement:s}}}}}let u=null,x=null,f=null;class b{static init(){c.isSSR()&&!u&&(u=new p)}static createElement(t){return c.isSSR()?(u||this.init(),u.createElementNS(null,t)):document.createElement(t)}static createElementNS(t,e){return c.isSSR()?(u||this.init(),u.createElementNS(t,e)):document.createElementNS(t,e)}static createTextNode(t){return c.isSSR()?(u||this.init(),u.createTextNode(t)):document.createTextNode(t)}static querySelector(t){return c.isSSR()?null:document.querySelector(t)}static querySelectorAll(t){return c.isSSR()?[]:document.querySelectorAll(t)}static getComputedStyle(t){return c.isSSR()?{}:window.getComputedStyle(t)}static getBoundingClientRect(t){return c.isSSR()?(u||this.init(),u.getBoundingClientRect(t)):t?t.getBoundingClientRect():{width:0,height:0,top:0,left:0,right:0,bottom:0,x:0,y:0}}static getXMLSerializer(){return c.isSSR()?(u||this.init(),x||(x=u.createXMLSerializer()),x):(x||(x=new XMLSerializer),x)}static getDOMParser(){return c.isSSR()?(u||this.init(),f||(f=u.createDOMParser()),f):(f||(f=new DOMParser),f)}static addWindowEventListener(t,e,s){c.isBrowser()&&window.addEventListener(t,e,s)}static removeWindowEventListener(t,e,s){c.isBrowser()&&window.removeEventListener(t,e,s)}static requestAnimationFrame(t){return c.isBrowser()?window.requestAnimationFrame(t):(t(0),null)}static cancelAnimationFrame(t){c.isBrowser()&&t&&window.cancelAnimationFrame(t)}static elementExists(t){return!!t&&(c.isSSR()?!0===t._ssrMode||void 0!==t.nodeName:!!t.getRootNode&&(t.getRootNode({composed:!0})===document||t.isConnected))}static getWindow(){return c.isBrowser()?window:null}static getDocument(){return c.isBrowser()?document:null}static _getShim(){return u}static _resetShim(){u=null,x=null,f=null}}let m=class t{static isObject(t){return t&&"object"==typeof t&&!Array.isArray(t)}static is(t,e){return Object.prototype.toString.call(e)==="[object "+t+"]"}static isSafari(){return c.isBrowser()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}static extend(t,e){const s=Object.assign({},t);return this.isObject(t)&&this.isObject(e)&&Object.keys(e).forEach(i=>{this.isObject(e[i])?i in t?s[i]=this.extend(t[i],e[i]):Object.assign(s,{[i]:e[i]}):Object.assign(s,{[i]:e[i]})}),s}static extendArray(e,s){const i=[];return e.map(e=>{i.push(t.extend(s,e))}),e=i}static monthMod(t){return t%12}static clone(t,e=new WeakMap,s=!1){if(null===t||"object"!=typeof t)return t;if(e.has(t))return e.get(t);let i;if(Array.isArray(t))if(s)i=t.slice();else{i=[],e.set(t,i);for(let s=0;s<t.length;s++)i[s]=this.clone(t[s],e,!1)}else if(t instanceof Date)i=new Date(t.getTime());else if(s)i=Object.assign({},t);else{i={},e.set(t,i);for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=this.clone(t[s],e,!1))}return i}static shallowClone(t){return null===t||"object"!=typeof t?t:Array.isArray(t)?t.slice():Object.assign({},t)}static shallowEqual(t,e){if(t===e)return!0;if(!t||!e)return!1;if("object"!=typeof t||"object"!=typeof e)return t===e;const s=Object.keys(t),i=Object.keys(e);if(s.length!==i.length)return!1;for(const i of s)if(t[i]!==e[i])return!1;return!0}static log10(t){return Math.log(t)/Math.LN10}static roundToBase10(t){return Math.pow(10,Math.floor(Math.log10(t)))}static roundToBase(t,e){return Math.pow(e,Math.floor(Math.log(t)/Math.log(e)))}static parseNumber(t){return"number"==typeof t||null===t?t:parseFloat(t)}static stripNumber(t,e=2){return Number.isInteger(t)?t:parseFloat(t.toPrecision(e))}static randomId(){return(Math.random()+1).toString(36).substring(4)}static noExponents(t){return t.toString().includes("e")?Math.round(t):t}static elementExists(t){return!(!t||!t.isConnected)}static isInShadowDOM(e){if(!e||!e.getRootNode)return!1;const s=e.getRootNode();return s&&s!==document&&t.is("ShadowRoot",s)}static getShadowRootHost(e){if(!t.isInShadowDOM(e))return null;return e.getRootNode().host||null}static getDimensions(t){if(!t)return[0,0];if(c.isSSR())return[t._ssrWidth||400,t._ssrHeight||300];let e;try{e=getComputedStyle(t,null)}catch(e){return[t.clientWidth||0,t.clientHeight||0]}let s=t.clientWidth,i=t.clientHeight;if(!s||!i){const e=t.getBoundingClientRect();s=s||e.width,i=i||e.height}return i-=parseFloat(e.paddingTop)+parseFloat(e.paddingBottom),s-=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight),[s,i]}static getBoundingClientRect(t){if(!t)return{top:0,right:0,bottom:0,left:0,width:0,height:0,x:0,y:0};if(c.isSSR())return b.getBoundingClientRect(t);const e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:t.clientWidth,height:t.clientHeight,x:e.left,y:e.top}}static getLargestStringFromArr(t){return t.reduce((t,e)=>(Array.isArray(e)&&(e=e.reduce((t,e)=>t.length>e.length?t:e)),t.length>e.length?t:e),0)}static hexToRgba(t="#999999",e=.6){"#"!==t.substring(0,1)&&(t="#999999");const s=t.replace("#",""),i=s.match(new RegExp("(.{"+s.length/3+"})","g"))||[];for(let t=0;t<i.length;t++)i[t]=parseInt(1===i[t].length?i[t]+i[t]:i[t],16);return void 0!==e&&i.push(e),"rgba("+i.join(",")+")"}static getOpacityFromRGBA(t){return parseFloat(t.replace(/^.*,(.+)\)/,"$1"))}static parseHex(t){if("string"!=typeof t)return null;let e=t.trim().replace("#","");return 3===e.length&&(e=e.split("").map(t=>t+t).join("")),/^[0-9a-fA-F]{6}$/.test(e)?[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]:null}static relativeLuminance([t,e,s]){const i=t=>{const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)};return.2126*i(t)+.7152*i(e)+.0722*i(s)}static getContrastRatio(e,s){const i=t.parseHex(e),a=t.parseHex(s);if(!i||!a)return 0;const o=t.relativeLuminance(i),r=t.relativeLuminance(a);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}static rgb2hex(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""}shadeRGBColor(t,e){const s=e.split(","),i=t<0?0:255,a=t<0?-1*t:t,o=parseInt(s[0].slice(4),10),r=parseInt(s[1],10),n=parseInt(s[2],10);return"rgb("+(Math.round((i-o)*a)+o)+","+(Math.round((i-r)*a)+r)+","+(Math.round((i-n)*a)+n)+")"}shadeHexColor(t,e){const s=parseInt(e.slice(1),16),i=t<0?0:255,a=t<0?-1*t:t,o=s>>16,r=s>>8&255,n=255&s;return"#"+(16777216+65536*(Math.round((i-o)*a)+o)+256*(Math.round((i-r)*a)+r)+(Math.round((i-n)*a)+n)).toString(16).slice(1)}shadeColor(e,s){return t.isColorHex(s)?this.shadeHexColor(e,s):this.shadeRGBColor(e,s)}static isColorHex(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)|(^#[0-9A-F]{8}$)/i.test(t)}static isCSSVariable(t){if("string"!=typeof t)return!1;const e=t.trim();return e.startsWith("var(")&&e.endsWith(")")}static getThemeColor(e){if(!t.isCSSVariable(e))return e;if(c.isSSR())return e;const s=document.createElement("div");let i;s.style.cssText="position:fixed; left: -9999px; visibility:hidden;",s.style.color=e,document.body.appendChild(s);try{i=window.getComputedStyle(s).color}finally{s.parentNode&&s.parentNode.removeChild(s)}return i}static applyOpacityToColor(t,e){const s=Number(e);if(!Number.isFinite(s))return t;if(s<=0)return"transparent";if(s>=1)return t;return`color-mix(in srgb, ${t} ${Math.round(100*s)}%, transparent)`}static getPolygonPos(t,e){const s=[],i=2*Math.PI/e;for(let a=0;a<e;a++){const e={};e.x=t*Math.sin(a*i),e.y=-t*Math.cos(a*i),s.push(e)}return s}static polarToCartesian(t,e,s,i){const a=(i-90)*Math.PI/180;return{x:t+s*Math.cos(a),y:e+s*Math.sin(a)}}static escapeString(t,e="x"){let s=t.toString().slice();return s=s.replace(/[` ~!@#$%^&*()|+=?;:'",.<>{}[\]\\/]/gi,e),s}static negToZero(t){return t<0?0:t}static moveIndexInArray(t,e,s){if(s>=t.length){let e=s-t.length+1;for(;e--;)t.push(void 0)}return t.splice(s,0,t.splice(e,1)[0]),t}static extractNumber(t){return parseFloat(t.replace(/[^\d.]*/g,""))}static findAncestor(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}static setELstyles(t,e){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t.style.key=e[s])}static preciseAddition(t,e){const s=(String(t).split(".")[1]||"").length,i=(String(e).split(".")[1]||"").length,a=Math.pow(10,Math.max(s,i));return(Math.round(t*a)+Math.round(e*a))/a}static isNumber(t){return!isNaN(t)&&parseFloat(String(Number(t)))===t&&!isNaN(parseInt(t,10))}static isFloat(t){return Number(t)===t&&t%1!=0}static isMsEdge(){if(c.isSSR())return!1;const t=window.navigator.userAgent,e=t.indexOf("Edge/");return e>0&&parseInt(t.substring(e+5,t.indexOf(".",e)),10)}static getGCD(t,e,s=7){let i=Math.pow(10,s-Math.floor(Math.log10(Math.max(t,e))));for(i>1?(t=Math.round(Math.abs(t)*i),e=Math.round(Math.abs(e)*i)):i=1;e;){const s=e;e=t%e,t=s}return t/i}static getPrimeFactors(t){const e=[];let s=2;for(;t>=2;)t%s==0?(e.push(s),t/=s):s++;return e}static mod(t,e,s=7){const i=Math.pow(10,s-Math.floor(Math.log10(Math.max(t,e))));return(t=Math.round(Math.abs(t)*i))%(e=Math.round(Math.abs(e)*i))/i}};class y{constructor(t){this.w=t,this.months31=[1,3,5,7,8,10,12],this.months30=[2,4,6,9,11],this.daysCntOfYear=[0,31,59,90,120,151,181,212,243,273,304,334]}isValidDate(t){return"number"!=typeof t&&!isNaN(this.parseDate(t))}getTimeStamp(t){if(!Date.parse(t))return t;return this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(t).toISOString().substr(0,25)).getTime():new Date(t).getTime()}getDate(t){return this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(t).toUTCString()):new Date(t)}parseDate(t){const e=Date.parse(t);if(!isNaN(e))return this.getTimeStamp(t);let s=Date.parse(t.replace(/-/g,"/").replace(/[a-z]+/gi," "));return s=this.getTimeStamp(s),s}parseDateWithTimezone(t){return Date.parse(t.replace(/-/g,"/").replace(/[a-z]+/gi," "))}formatDate(t,e){const s=this.w.globals.locale,i=this.w.config.xaxis.labels.datetimeUTC,a=["\0",...s.months],o=["\x01",...s.shortMonths],r=["\x02",...s.days],n=["\x03",...s.shortDays];function l(t,e=2){let s=t+"";for(;s.length<e;)s="0"+s;return s}const h=i?t.getUTCFullYear():t.getFullYear();e=(e=(e=e.replace(/(^|[^\\])yyyy+/g,"$1"+h)).replace(/(^|[^\\])yy/g,"$1"+h.toString().substr(2,2))).replace(/(^|[^\\])y/g,"$1"+h);const c=(i?t.getUTCMonth():t.getMonth())+1;e=(e=(e=(e=e.replace(/(^|[^\\])MMMM+/g,"$1"+a[0])).replace(/(^|[^\\])MMM/g,"$1"+o[0])).replace(/(^|[^\\])MM/g,"$1"+l(c))).replace(/(^|[^\\])M/g,"$1"+c);const d=i?t.getUTCDate():t.getDate();e=(e=(e=(e=e.replace(/(^|[^\\])dddd+/g,"$1"+r[0])).replace(/(^|[^\\])ddd/g,"$1"+n[0])).replace(/(^|[^\\])dd/g,"$1"+l(d))).replace(/(^|[^\\])d/g,"$1"+d);const g=i?t.getUTCHours():t.getHours(),p=g>12?g-12:0===g?12:g;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+l(g))).replace(/(^|[^\\])H/g,"$1"+g)).replace(/(^|[^\\])hh+/g,"$1"+l(p))).replace(/(^|[^\\])h/g,"$1"+p);const u=i?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+l(u))).replace(/(^|[^\\])m/g,"$1"+u);const x=i?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+l(x))).replace(/(^|[^\\])s/g,"$1"+x);let f=i?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+l(f,3)),f=Math.round(f/10),e=e.replace(/(^|[^\\])ff/g,"$1"+l(f)),f=Math.round(f/10);const b=g<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+f)).replace(/(^|[^\\])TT+/g,"$1"+b)).replace(/(^|[^\\])T/g,"$1"+b.charAt(0));const m=b.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+m)).replace(/(^|[^\\])t/g,"$1"+m.charAt(0));let y=-t.getTimezoneOffset(),w=i||!y?"Z":y>0?"+":"-";if(!i){y=Math.abs(y);const t=y%60;w+=l(Math.floor(y/60))+":"+l(t)}e=e.replace(/(^|[^\\])K/g,"$1"+w);const v=(i?t.getUTCDay():t.getDay())+1;return e=(e=(e=(e=(e=e.replace(new RegExp(r[0],"g"),r[v])).replace(new RegExp(n[0],"g"),n[v])).replace(new RegExp(a[0],"g"),a[c])).replace(new RegExp(o[0],"g"),o[c])).replace(/\\(.)/g,"$1")}getTimeUnitsfromTimestamp(t,e){const s=this.w;void 0!==s.config.xaxis.min&&(t=s.config.xaxis.min),void 0!==s.config.xaxis.max&&(e=s.config.xaxis.max);const i=this.getDate(t),a=this.getDate(e),o=this.formatDate(i,"yyyy MM dd HH mm ss fff").split(" "),r=this.formatDate(a,"yyyy MM dd HH mm ss fff").split(" ");return{minMillisecond:parseInt(o[6],10),maxMillisecond:parseInt(r[6],10),minSecond:parseInt(o[5],10),maxSecond:parseInt(r[5],10),minMinute:parseInt(o[4],10),maxMinute:parseInt(r[4],10),minHour:parseInt(o[3],10),maxHour:parseInt(r[3],10),minDate:parseInt(o[2],10),maxDate:parseInt(r[2],10),minMonth:parseInt(o[1],10)-1,maxMonth:parseInt(r[1],10)-1,minYear:parseInt(o[0],10),maxYear:parseInt(r[0],10)}}isLeapYear(t){return t%4==0&&t%100!=0||t%400==0}calculcateLastDaysOfMonth(t,e,s){return this.determineDaysOfMonths(t,e)-s}determineDaysOfYear(t){let e=365;return this.isLeapYear(t)&&(e=366),e}determineRemainingDaysOfYear(t,e,s){let i=this.daysCntOfYear[e]+s;return e>1&&this.isLeapYear(t)&&i++,i}determineDaysOfMonths(t,e){let s=30;switch(t=m.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(s=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:s=31}return s}getDateFields(t,e){const s=new Date(t);return e?{year:s.getUTCFullYear(),month:s.getUTCMonth(),date:s.getUTCDate(),hour:s.getUTCHours(),minute:s.getUTCMinutes(),second:s.getUTCSeconds(),ms:s.getUTCMilliseconds(),weekday:s.getUTCDay()}:{year:s.getFullYear(),month:s.getMonth(),date:s.getDate(),hour:s.getHours(),minute:s.getMinutes(),second:s.getSeconds(),ms:s.getMilliseconds(),weekday:s.getDay()}}addInterval(t,e,s,i){const a=new Date(t);if(i)switch(e){case"year":a.setUTCFullYear(a.getUTCFullYear()+s);break;case"month":a.setUTCMonth(a.getUTCMonth()+s);break;case"week":a.setUTCDate(a.getUTCDate()+7*s);break;case"day":a.setUTCDate(a.getUTCDate()+s);break;case"hour":a.setUTCHours(a.getUTCHours()+s);break;case"minute":a.setUTCMinutes(a.getUTCMinutes()+s);break;case"second":a.setUTCSeconds(a.getUTCSeconds()+s)}else switch(e){case"year":a.setFullYear(a.getFullYear()+s);break;case"month":a.setMonth(a.getMonth()+s);break;case"week":a.setDate(a.getDate()+7*s);break;case"day":a.setDate(a.getDate()+s);break;case"hour":a.setHours(a.getHours()+s);break;case"minute":a.setMinutes(a.getMinutes()+s);break;case"second":a.setSeconds(a.getSeconds()+s)}return a.getTime()}ceilToBoundary(t,e,s,i){const a=new Date(t);if(i)switch(e){case"second":{const e=a.getUTCSeconds(),i=Math.ceil(e/s)*s;return i===e&&0===a.getUTCMilliseconds()?t:(a.setUTCMilliseconds(0),a.setUTCSeconds(i),a.getTime())}case"minute":{const e=a.getUTCMinutes(),i=Math.ceil(e/s)*s;return i===e&&0===a.getUTCSeconds()&&0===a.getUTCMilliseconds()?t:(a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(i),a.getTime())}case"hour":{const e=a.getUTCHours(),i=Math.ceil(e/s)*s;return i===e&&0===a.getUTCMinutes()&&0===a.getUTCSeconds()&&0===a.getUTCMilliseconds()?t:(a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),a.setUTCHours(i),a.getTime())}case"day":return 0===a.getUTCHours()&&0===a.getUTCMinutes()&&0===a.getUTCSeconds()&&0===a.getUTCMilliseconds()?t:(a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),a.setUTCHours(0),a.setUTCDate(a.getUTCDate()+1),a.getTime());case"week":{const e=6048e5,i=Date.UTC(1970,0,5);a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),a.setUTCHours(0);const o=a.getTime(),r=Math.ceil((o-i)/e),n=i+Math.ceil(r/s)*s*e;return n>=t?n:n+s*e}case"month":{const e=a.getUTCMonth(),i=Math.ceil(e/s)*s;return i===e&&1===a.getUTCDate()&&0===a.getUTCHours()&&0===a.getUTCMinutes()&&0===a.getUTCSeconds()&&0===a.getUTCMilliseconds()?t:(a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),a.setUTCHours(0),a.setUTCDate(1),a.setUTCMonth(i),a.getTime())}case"year":{const e=a.getUTCFullYear(),i=Math.ceil(e/s)*s;return i===e&&0===a.getUTCMonth()&&1===a.getUTCDate()&&0===a.getUTCHours()&&0===a.getUTCMinutes()&&0===a.getUTCSeconds()&&0===a.getUTCMilliseconds()?t:Date.UTC(i,0,1)}}else switch(e){case"second":{const e=a.getSeconds(),i=Math.ceil(e/s)*s;return i===e&&0===a.getMilliseconds()?t:(a.setMilliseconds(0),a.setSeconds(i),a.getTime())}case"minute":{const e=a.getMinutes(),i=Math.ceil(e/s)*s;return i===e&&0===a.getSeconds()&&0===a.getMilliseconds()?t:(a.setMilliseconds(0),a.setSeconds(0),a.setMinutes(i),a.getTime())}case"hour":{const e=a.getHours(),i=Math.ceil(e/s)*s;return i===e&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds()?t:(a.setMilliseconds(0),a.setSeconds(0),a.setMinutes(0),a.setHours(i),a.getTime())}case"day":return 0===a.getHours()&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds()?t:(a.setMilliseconds(0),a.setSeconds(0),a.setMinutes(0),a.setHours(0),a.setDate(a.getDate()+1),a.getTime());case"week":{const e=6048e5,i=new Date(1970,0,5).getTime();a.setMilliseconds(0),a.setSeconds(0),a.setMinutes(0),a.setHours(0);const o=a.getTime(),r=Math.ceil((o-i)/e),n=i+Math.ceil(r/s)*s*e;return n>=t?n:n+s*e}case"month":{const e=a.getMonth(),i=Math.ceil(e/s)*s;return i===e&&1===a.getDate()&&0===a.getHours()&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds()?t:(a.setMilliseconds(0),a.setSeconds(0),a.setMinutes(0),a.setHours(0),a.setDate(1),a.setMonth(i),a.getTime())}case"year":{const e=a.getFullYear(),i=Math.ceil(e/s)*s;return i===e&&0===a.getMonth()&&1===a.getDate()&&0===a.getHours()&&0===a.getMinutes()&&0===a.getSeconds()&&0===a.getMilliseconds()?t:new Date(i,0,1).getTime()}}return t}isAtBoundary(t,e,s){const i=this.getDateFields(t,s);switch(e){case"year":return 0===i.month&&1===i.date&&0===i.hour&&0===i.minute&&0===i.second&&0===i.ms;case"month":return 1===i.date&&0===i.hour&&0===i.minute&&0===i.second&&0===i.ms;case"day":return 0===i.hour&&0===i.minute&&0===i.second&&0===i.ms;case"hour":return 0===i.minute&&0===i.second&&0===i.ms;case"minute":return 0===i.second&&0===i.ms;case"second":return 0===i.ms}return!1}}class w{constructor(t){this.w=t,this.tooltipKeyFormat="dd MMM"}xLabelFormat(t,e,s,i){const a=this.w;if("datetime"===a.config.xaxis.type&&void 0===a.config.xaxis.labels.formatter&&void 0===a.config.tooltip.x.formatter){const t=new y(this.w);return t.formatDate(t.getDate(e),a.config.tooltip.x.format)}return t(e,s,i)}defaultGeneralFormatter(t){return Array.isArray(t)?t.map(t=>t):t}defaultYFormatter(t,e){const s=this.w;if(m.isNumber(t))if(0!==s.globals.yValueDecimal)t=t.toFixed(void 0!==e.decimalsInFloat?e.decimalsInFloat:s.globals.yValueDecimal);else{const e=t.toFixed(0);t=Number(e)===t?e:t.toFixed(1)}return t}setLabelFormatters(){const t=this.w,e=t.formatters;return e.xaxisTooltipFormatter=t=>this.defaultGeneralFormatter(t),e.ttKeyFormatter=t=>this.defaultGeneralFormatter(t),e.ttZFormatter=t=>t,e.legendFormatter=t=>this.defaultGeneralFormatter(t),void 0!==t.config.xaxis.labels.formatter?e.xLabelFormatter=t.config.xaxis.labels.formatter:e.xLabelFormatter=e=>{if(m.isNumber(e)){if(!t.config.xaxis.convertedCatToNumeric&&"numeric"===t.config.xaxis.type){if(m.isNumber(t.config.xaxis.decimalsInFloat))return e.toFixed(t.config.xaxis.decimalsInFloat);{const s=t.globals.maxX-t.globals.minX;if(s>0){const t=s/10,i=Math.max(0,-Math.floor(Math.log10(t)));return e.toFixed(i)}return e.toFixed(0)}}if(t.globals.isBarHorizontal){if(t.globals.maxY-t.globals.minYArr<4)return e.toFixed(1)}return e.toFixed(0)}return e},"function"==typeof t.config.tooltip.x.formatter?e.ttKeyFormatter=t.config.tooltip.x.formatter:e.ttKeyFormatter=e.xLabelFormatter,"function"==typeof t.config.xaxis.tooltip.formatter&&(e.xaxisTooltipFormatter=t.config.xaxis.tooltip.formatter),(Array.isArray(t.config.tooltip.y)||void 0!==t.config.tooltip.y.formatter)&&(e.ttVal=t.config.tooltip.y),void 0!==t.config.tooltip.z.formatter&&(e.ttZFormatter=t.config.tooltip.z.formatter),void 0!==t.config.legend.formatter&&(e.legendFormatter=t.config.legend.formatter),e.yLabelFormatters=[],t.config.yaxis.forEach((s,i)=>{if(void 0!==s.labels.formatter)e.yLabelFormatters[i]=s.labels.formatter;else if("violin"===t.config.chart.type){const s=t=>"number"==typeof t&&isFinite(t)?""+Math.round(100*t)/100:t;e.yLabelFormatters[i]=e=>t.globals.xyCharts?Array.isArray(e)?e.map(s):s(e):e}else e.yLabelFormatters[i]=e=>t.globals.xyCharts?Array.isArray(e)?e.map(t=>this.defaultYFormatter(t,s)):this.defaultYFormatter(e,s):e}),t.globals}heatmapLabelFormatters(){const t=this.w;if("heatmap"===t.config.chart.type){t.globals.yAxisScale[0].result=t.seriesData.seriesNames.slice();const e=t.seriesData.seriesNames.reduce((t,e)=>t.length>e.length?t:e,0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}const v=({isTimeline:t,seriesIndex:e,dataPointIndex:s,y1:i,y2:a,w:o})=>{var r;let n=o.rangeData.seriesRangeStart[e][s],l=o.rangeData.seriesRangeEnd[e][s],h=o.labelData.labels[s],c=o.config.series[e].name?o.config.series[e].name:"";const d=o.formatters.ttKeyFormatter,g=o.config.tooltip.y.title.formatter,p={w:o,seriesIndex:e,dataPointIndex:s,start:n,end:l};if("function"==typeof g&&(c=g(c,p)),(null==(r=o.config.series[e].data[s])?void 0:r.x)&&(h=o.config.series[e].data[s].x),!t&&"datetime"===o.config.xaxis.type){h=new w(o).xLabelFormat(o.formatters.ttKeyFormatter,h,h,{i:void 0,dateFormatter:new y(o).formatDate,w:o})}"function"==typeof d&&(h=d(h,p)),Number.isFinite(i)&&Number.isFinite(a)&&(n=i,l=a);let u="",x="";const f=o.globals.colors[e];if(void 0===o.config.tooltip.x.formatter)if("datetime"===o.config.xaxis.type){const t=new y(o);u=t.formatDate(t.getDate(n),o.config.tooltip.x.format),x=t.formatDate(t.getDate(l),o.config.tooltip.x.format)}else u=n,x=l;else u=o.config.tooltip.x.formatter(n),x=o.config.tooltip.x.formatter(l);return{start:n,end:l,startVal:u,endVal:x,ylabel:h,color:f,seriesName:c}},A=t=>{let{color:e,seriesName:s,ylabel:i,start:a,end:o,seriesIndex:r,dataPointIndex:n}=t;const l=t.w.globals.tooltip.tooltipLabels.getFormatters(r);a=l.yLbFormatter(a),o=l.yLbFormatter(o);const h=l.yLbFormatter(t.w.seriesData.series[r][n]);let c="";const d=`<span class="value start-value">\n ${a}\n </span> <span class="separator">-</span> <span class="value end-value">\n ${o}\n </span>`;return c=t.w.globals.comboCharts?"rangeArea"===t.w.config.series[r].type||"rangeBar"===t.w.config.series[r].type?d:`<span>${h}</span>`:d,'<div class="apexcharts-tooltip-rangebar"><div> <span class="series-name" style="color: '+e+'">'+(s||"")+'</span></div><div> <span class="category">'+i+": </span> "+c+" </div></div>"};class C{constructor(t){this.opts=t}hideYAxis(){this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0}line(){return{dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}sparkline(t){this.hideYAxis();return m.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}slope(){return this.hideYAxis(),{chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!0,formatter(t,e){const s=e.w.config.series[e.seriesIndex].name;return null!==t?s+": "+t:""},background:{enabled:!1},offsetX:-5},grid:{xaxis:{lines:{show:!0}},yaxis:{lines:{show:!1}}},xaxis:{position:"top",labels:{style:{fontSize:14,fontWeight:900}},tooltip:{enabled:!1},crosshairs:{show:!1}},markers:{size:8,hover:{sizeOffset:1}},legend:{show:!1},tooltip:{shared:!1,intersect:!0,followCursor:!0},stroke:{width:5,curve:"straight"}}}bar(){return{chart:{stacked:!1},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square"}},tooltip:{shared:!1,intersect:!0},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}funnel(){return this.hideYAxis(),l(n({},this.bar()),{chart:{animations:{speed:800,animateGradually:{enabled:!1}}},plotOptions:{bar:{horizontal:!0,borderRadiusApplication:"around",borderRadius:0,dataLabels:{position:"center"}}},grid:{show:!1,padding:{left:0,right:0}},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}}})}pyramid(){return this.funnel()}gauge(){const t=this.radialBar();return l(n({},t),{plotOptions:{radialBar:{startAngle:-135,endAngle:135,hollow:{margin:0,size:"60%"},track:{background:"#e7e7e7",strokeWidth:"100%",margin:5},dataLabels:{name:{show:!1},value:{show:!0,fontSize:"32px",fontWeight:600,offsetY:8}}}}})}candlestick(){return{stroke:{width:1},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:({seriesIndex:t,dataPointIndex:e,w:s})=>this._getBoxTooltip(s,t,e,["Open","High","","Low","Close"],"candlestick")},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}boxPlot(){return{chart:{animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:({seriesIndex:t,dataPointIndex:e,w:s})=>this._getBoxTooltip(s,t,e,["Minimum","Q1","Median","Q3","Maximum"],"boxPlot")},markers:{size:7,strokeWidth:1,strokeColors:"#111"},xaxis:{crosshairs:{width:1}}}}violin(){return{chart:{zoom:{enabled:!1},animations:{dynamicAnimation:{enabled:!1}}},stroke:{width:1,colors:["#24292e"]},fill:{opacity:.7},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:({seriesIndex:t,dataPointIndex:e,w:s})=>this._getViolinTooltip(s,t,e)},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}rangeBar(){return{chart:{animations:{animateGradually:!1}},stroke:{width:0,lineCap:"square"},plotOptions:{bar:{borderRadius:0,dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter(t,{seriesIndex:e,dataPointIndex:s,w:i}){const a=()=>{const t=i.rangeData.seriesRangeStart[e][s];return i.rangeData.seriesRangeEnd[e][s]-t};return i.globals.comboCharts?"rangeBar"===i.config.series[e].type||"rangeArea"===i.config.series[e].type?a():t:a()},background:{enabled:!1},style:{colors:["#fff"]}},markers:{size:10},tooltip:{shared:!1,followCursor:!0,custom:t=>t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?(t=>{const{color:e,seriesName:s,ylabel:i,startVal:a,endVal:o}=v(l(n({},t),{isTimeline:!0}));return A(l(n({},t),{color:e,seriesName:s,ylabel:i,start:a,end:o}))})(t):(t=>{const{color:e,seriesName:s,ylabel:i,start:a,end:o}=v(t);return A(l(n({},t),{color:e,seriesName:s,ylabel:i,start:a,end:o}))})(t)},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}dumbbell(t){var e,s;return(null==(e=t.plotOptions.bar)?void 0:e.barHeight)||(t.plotOptions.bar.barHeight=2),(null==(s=t.plotOptions.bar)?void 0:s.columnWidth)||(t.plotOptions.bar.columnWidth=2),t}area(){return{stroke:{width:4,fill:{type:"solid",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}}},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}rangeArea(){return{stroke:{curve:"straight",width:0},fill:{type:"solid",opacity:.6},markers:{size:0},states:{hover:{filter:{type:"none"}},active:{filter:{type:"none"}}},tooltip:{intersect:!1,shared:!0,followCursor:!0,custom:t=>(t=>{const{color:e,seriesName:s,ylabel:i,start:a,end:o}=v(t);return A(l(n({},t),{color:e,seriesName:s,ylabel:i,start:a,end:o}))})(t)}}}brush(t){return m.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}stacked100(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;const e=t.dataLabels.formatter;t.yaxis.forEach((e,s)=>{t.yaxis[s].min=0,t.yaxis[s].max=100});return"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}stackedBars(){const t=this.bar();return l(n({},t),{plotOptions:l(n({},t.plotOptions),{bar:l(n({},t.plotOptions.bar),{borderRadiusApplication:"end",borderRadiusWhenStacked:"last"})})})}convertCatToNumeric(t){return t.xaxis.convertedCatToNumeric=!0,t}convertCatToNumericXaxis(t,e){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return m.isNumber(t)?Math.floor(t):t};const s=t.xaxis.labels.formatter;let i=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return e&&e.length&&(i=e.map(t=>Array.isArray(t)?t:String(t))),i&&i.length&&(t.xaxis.labels.formatter=function(t){return m.isNumber(t)?s(i[Math.floor(t)-1]):s(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}bubble(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}scatter(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}heatmap(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square"}},grid:{padding:{right:20}}}}treemap(){return{chart:{zoom:{enabled:!1}},dataLabels:{style:{fontSize:14,fontWeight:600,colors:["#fff"]}},stroke:{show:!0,width:2,colors:["#fff"]},legend:{show:!1},fill:{opacity:1,gradient:{stops:[0,100]}},tooltip:{followCursor:!0,x:{show:!1}},grid:{padding:{left:0,right:0}},xaxis:{crosshairs:{show:!1},tooltip:{enabled:!1}}}}pie(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:t=>t.toFixed(1)+"%",style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}donut(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:t=>t.toFixed(1)+"%",style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}polarArea(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:t=>t.toFixed(1)+"%",enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}radar(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:5,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},xaxis:{labels:{formatter:t=>t,style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}radialBar(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},stroke:{lineCap:"butt"},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0},grid:{padding:{left:0,right:0,top:0,bottom:0}}}}_getBoxTooltip(t,e,s,i,a){const o=t.candleData.seriesCandleO[e][s],r=t.candleData.seriesCandleH[e][s],n=t.candleData.seriesCandleM[e][s],l=t.candleData.seriesCandleL[e][s],h=t.candleData.seriesCandleC[e][s],c=t.config.series[e];return c.type&&c.type!==a?`<div class="apexcharts-custom-tooltip">\n ${c.name?c.name:"series-"+(e+1)}: <strong>${t.seriesData.series[e][s]}</strong>\n </div>`:`<div class="apexcharts-tooltip-box apexcharts-tooltip-${t.config.chart.type}"><div>${i[0]}: <span class="value">`+o+`</span></div><div>${i[1]}: <span class="value">`+r+"</span></div>"+(n?`<div>${i[2]}: <span class="value">`+n+"</span></div>":"")+`<div>${i[3]}: <span class="value">`+l+`</span></div><div>${i[4]}: <span class="value">`+h+"</span></div></div>"}_getViolinTooltip(t,e,s){var i,a,o;const r=null==(i=t.violinData.seriesViolinMin[e])?void 0:i[s],n=null==(a=t.violinData.seriesViolinMax[e])?void 0:a[s],l=(null==(o=t.violinData.seriesViolinPoints[e])?void 0:o[s])||[],h=t.config.series[e].name||"series-"+(e+1);return`<div class="apexcharts-tooltip-box apexcharts-tooltip-${t.config.chart.type}"><div class="apexcharts-tooltip-violin-name">${h}</div><div>Min: <span class="value">${r}</span></div><div>Max: <span class="value">${n}</span></div><div>Observations: <span class="value">${l.length}</span></div></div>`}}const S={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}};class k{constructor(){this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,logBase:10,tickAmount:void 0,stepSize:void 0,forceNiceScale:!1,alignZero:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,showDuplicates:!1,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={id:void 0,x:0,y:null,yAxisIndex:0,seriesIndex:void 0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={id:void 0,y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,width:"100%",yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={id:void 0,x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,mouseEnter:void 0,mouseLeave:void 0,click:void 0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}init(){return{annotations:{yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350},chartTypeMorph:{enabled:!0,speed:600},respectReducedMotion:!0,largeDatasetThreshold:1e3},background:"",locales:[S],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.7},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,mouseLeave:void 0,xAxisLabelClick:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,beforeResetZoom:void 0,zoomed:void 0,scrolled:void 0,brushScrolled:void 0,keyDown:void 0,keyUp:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,redrawOnWindowResize:!0,id:void 0,group:void 0,nonce:void 0,offsetX:0,offsetY:0,injectStyleSheet:!0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0,targets:void 0},stacked:!1,stackOnlyBar:!0,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",categoryFormatter:void 0,valueFormatter:void 0},png:{filename:void 0},svg:{filename:void 0},scale:void 0,width:void 0},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,allowMouseWheelZoom:!0,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}},accessibility:{enabled:!0,description:void 0,announcements:{enabled:!0},keyboard:{enabled:!0,navigation:{enabled:!0,wrapAround:!1}}},dataReducer:{enabled:!1,algorithm:"lttb",targetPoints:250,threshold:500}},parsing:{x:void 0,y:void 0},plotOptions:{line:{isSlopeChart:!1,colors:{threshold:0,colorAboveThreshold:void 0,colorBelowThreshold:void 0}},area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,borderRadius:0,borderRadiusApplication:"around",borderRadiusWhenStacked:"last",rangeBarOverlap:!0,rangeBarGroupRows:!1,hideZeroBarsWhenGrouped:!1,isDumbbell:!1,dumbbellColors:void 0,isFunnel:!1,isFunnel3d:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal",total:{enabled:!1,formatter:void 0,offsetX:0,offsetY:0,style:{color:"#373d3f",fontSize:"12px",fontFamily:void 0,fontWeight:600}}}},bubble:{zScaling:!0,minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},boxPlot:{colors:{upper:"#00E396",lower:"#008FFB"},points:{show:!1,shape:"circle",size:2.5,jitter:.5,maxPoints:3e3,opacity:.9,fillColor:"series-dark",strokeColor:"#fff",strokeWidth:1}},violin:{bandwidthScale:1,normalize:"individual",points:{show:!0,shape:"circle",size:2.5,jitter:.5,constrainToViolin:!0,maxPoints:3e3,opacity:.9,fillColor:"series-dark",strokeColor:"#fff",strokeWidth:1}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0,gradientLegend:{enabled:!1,width:"70%",height:"70%",thickness:12,align:"center",stops:16,showLabels:!0,showHoverValue:!0,labelStyle:{fontSize:"11px",fontFamily:void 0,colors:void 0},arrow:{size:8,color:void 0},formatter:void 0}}},funnel:{shape:"rectangle",lastShape:"flat"},treemap:{enableShades:!0,shadeIntensity:.5,distributed:!1,reverseNegativeShade:!1,useFillColorAsStroke:!1,borderRadius:4,dataLabels:{format:"scale"},colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0},seriesTitle:{show:!0,offsetY:1,offsetX:1,borderColor:"#000",borderWidth:1,borderRadius:2,style:{background:"rgba(0, 0, 0, 0.6)",color:"#fff",fontSize:"12px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:6,right:6,top:2,bottom:2}}}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,shape:"arc",min:0,max:100,bands:[],bandsStyle:{strokeWidth:"40%",gap:0,hideTrackWhenPresent:!0},ticks:{show:!1,major:{count:11,length:10,width:2,color:"#666",placement:"outside"},minor:{count:4,length:5,width:1,color:"#999",placement:"outside"},labels:{show:!1,offset:6,fontSize:"11px",fontFamily:void 0,fontWeight:400,color:"#666",formatter:t=>String(t)}},needle:{color:"#333",length:"85%",baseWidth:4,tipWidth:1,offsetY:0,showValueArc:!1,animation:{enabled:!0,duration:800,easing:"ease-out"}},hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",stroke:void 0,strokeWidth:1,strokeDasharray:void 0,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:t=>t},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:t=>t+"%"},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:t=>t.globals.seriesTotals.reduce((t,e)=>t+e,0)/t.seriesData.series.length+"%"}},barLabels:{enabled:!1,offsetX:0,offsetY:0,useSeriesColors:!0,fontFamily:void 0,fontWeight:600,fontSize:"16px",formatter:t=>t,onClick:void 0}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,endAngle:360,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:t=>t},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:t=>t},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:t=>t.globals.seriesTotals.reduce((t,e)=>t+e,0)}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"},spokes:{strokeWidth:1,connectorColors:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:t=>null!==t?t:"",textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",backgroundColor:void 0,borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.8}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},forecastDataPoints:{count:0,fillOpacity:.5,strokeWidth:void 0,dashArray:4},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,customLegendItems:[],clusterGroupedSeries:!0,clusterGroupedSeriesOrientation:"vertical",labels:{colors:void 0,useSeriesColors:!1},markers:{size:7,fillColors:void 0,strokeWidth:1,shape:void 0,offsetX:0,offsetY:0,customHTML:void 0,onClick:void 0},itemMargin:{horizontal:5,vertical:4},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",offsetX:0,offsetY:0,showNullDataPoints:!0,onClick:void 0,onDblClick:void 0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{hover:{filter:{type:"lighten"}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken"}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0,fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]}}},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,hideEmptySeries:!1,followCursor:!1,intersect:!1,inverseOrder:!1,arrow:!0,custom:void 0,fillSeriesColor:!1,theme:"light",cssClass:"",style:{fontSize:"12px",fontFamily:void 0,background:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:t=>t?t+": ":""}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,offsetX:0,offsetY:0,overwriteCategories:void 0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM",day:"dd MMM",hour:"HH:mm",minute:"HH:mm",second:"HH:mm:ss"}},group:{groups:[],style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},stepSize:void 0,tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,decimalsInFloat:void 0,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.8}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65},accessibility:{colorBlindMode:""}}}}}class D{constructor(t){this.opts=t}init({responsiveOverride:t}){var e,s,i,a,o,r,n,l,h,d;let g=this.opts;const p=new k,u=new C(g);g=this.normalizeAliasedChartType(g),this.chartType=g.chart.type,g=this.extendYAxis(g),g=this.extendAnnotations(g);let x=p.init(),f={};if(g&&"object"==typeof g){let p={};const b=["line","area","bar","candlestick","boxPlot","violin","rangeBar","rangeArea","bubble","scatter","heatmap","treemap","pie","polarArea","donut","radar","radialBar"],y=g.chart.requestedType;p="funnel"===y||"pyramid"===y?u[y]():"gauge"===y?u.gauge():-1!==b.indexOf(g.chart.type)?u[g.chart.type]():u.line(),(null==(s=null==(e=g.plotOptions)?void 0:e.bar)?void 0:s.isFunnel)&&(p=u.funnel()),g.chart.stacked&&"bar"===g.chart.type&&(p=u.stackedBars()),(null==(i=g.chart.brush)?void 0:i.enabled)&&(p=u.brush(p)),(null==(o=null==(a=g.plotOptions)?void 0:a.line)?void 0:o.isSlopeChart)&&(p=u.slope()),g.chart.stacked&&"100%"===g.chart.stackType&&(g=u.stacked100(g)),(null==(n=null==(r=g.plotOptions)?void 0:r.bar)?void 0:n.isDumbbell)&&(g=u.dumbbell(g)),this.checkForDarkTheme(c.getApex()),this.checkForDarkTheme(g),g.xaxis=g.xaxis||c.getApex().xaxis||{},t||(g.xaxis.convertedCatToNumeric=!1),g=this.checkForCatToNumericXAxis(this.chartType,p,g),((null==(l=g.chart.sparkline)?void 0:l.enabled)||(null==(d=null==(h=c.getApex().chart)?void 0:h.sparkline)?void 0:d.enabled))&&(p=u.sparkline(p)),f=m.extend(x,p)}const b=m.extend(f,c.getApex());return x=m.extend(b,g),x=this.handleUserInputErrors(x),x}normalizeAliasedChartType(t){if(!t||!t.chart)return t;const e=t.chart.type;return"funnel"!==e&&"pyramid"!==e&&"gauge"!==e||(t.chart.requestedType=e,"funnel"===e||"pyramid"===e?(t.plotOptions=t.plotOptions||{},t.plotOptions.bar=t.plotOptions.bar||{},t.plotOptions.bar.isFunnel=!0,t.plotOptions.bar.horizontal=!0,t.chart.type="bar",t.plotOptions.bar.isPyramid="pyramid"===e):"gauge"===e&&(t.chart.type="radialBar")),t}checkForCatToNumericXAxis(t,e,s){var i,a;const o=new C(s),r=("bar"===t||"boxPlot"===t||"violin"===t)&&(null==(a=null==(i=s.plotOptions)?void 0:i.bar)?void 0:a.horizontal),n="pie"===t||"polarArea"===t||"donut"===t||"radar"===t||"radialBar"===t||"heatmap"===t,l="datetime"!==s.xaxis.type&&"numeric"!==s.xaxis.type,h=s.xaxis.tickPlacement?s.xaxis.tickPlacement:e.xaxis&&e.xaxis.tickPlacement;return r||n||!l||"between"===h||(s=o.convertCatToNumeric(s)),s}extendYAxis(t,e){const s=new k;(void 0===t.yaxis||!t.yaxis||Array.isArray(t.yaxis)&&0===t.yaxis.length)&&(t.yaxis={});const i=c.getApex();t.yaxis.constructor!==Array&&i.yaxis&&i.yaxis.constructor!==Array&&(t.yaxis=m.extend(t.yaxis,i.yaxis)),t.yaxis.constructor!==Array?t.yaxis=[m.extend(s.yAxis,t.yaxis)]:t.yaxis=m.extendArray(t.yaxis,s.yAxis);let a=!1;t.yaxis.forEach(t=>{t.logarithmic&&(a=!0)});let o=t.series;return e&&!o&&(o=e.config.series),a&&o.length!==t.yaxis.length&&o.length&&(t.yaxis=o.map((e,i)=>{if(e.name||(o[i].name=`series-${i+1}`),t.yaxis[i])return t.yaxis[i].seriesName=o[i].name,t.yaxis[i];{const e=m.extend(s.yAxis,t.yaxis[0]);return e.show=!1,e}})),a&&o.length>1&&(o.length,t.yaxis.length),t}extendAnnotations(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),t=this.extendPointAnnotations(t)}extendYAxisAnnotations(t){const e=new k;return t.annotations.yaxis=m.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}extendXAxisAnnotations(t){const e=new k;return t.annotations.xaxis=m.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}extendPointAnnotations(t){const e=new k;return t.annotations.points=m.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}checkForDarkTheme(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.theme.palette||(t.theme.palette="palette4"))}handleUserInputErrors(t){const e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if("bar"===e.chart.type&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&"barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(e.xaxis.crosshairs.width="tickWidth"),"candlestick"!==e.chart.type&&"boxPlot"!==e.chart.type||e.yaxis[0].reversed&&(e.yaxis[0].reversed=!1),e}}const L=[[1,1,2,5,5,5,10,10,10,10,10],[1,1,2,5,5,5,10,10,10,10,10]],M=[1,2,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,12,12,12,12,12,12,12,12,12,24];class P{initGlobalVars(t){t.series=[],t.seriesCandleO=[],t.seriesCandleH=[],t.seriesCandleM=[],t.seriesCandleL=[],t.seriesCandleC=[],t.seriesRangeStart=[],t.seriesRangeEnd=[],t.seriesRange=[],t.seriesPercent=[],t.seriesGoals=[],t.seriesX=[],t.seriesZ=[],t.seriesNames=[],t.seriesTotals=[],t.seriesLog=[],t.seriesColors=[],t.stackedSeriesTotals=[],t.seriesXvalues=[],t.seriesYvalues=[],t.dataWasParsed=!1,t.originalSeries=null,t.maxValsInArrayIndex=0,t.yValueDecimal=0,t.allSeriesHasEqualX=!0,t.labels=[],t.hasXaxisGroups=!1,t.groups=[],t.barGroups=[],t.lineGroups=[],t.areaGroups=[],t.hasSeriesGroups=!1,t.seriesGroups=[],t.categoryLabels=[],t.timescaleLabels=[],t.noLabelsProvided=!1,t.isXNumeric=!1,t.skipLastTimelinelabel=!1,t.skipFirstTimelinelabel=!1,t.isDataXYZ=!1,t.isMultiLineX=!1,t.isMultipleYAxis=!1,t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE,t.minYArr=[],t.maxYArr=[],t.maxX=-Number.MAX_VALUE,t.minX=Number.MAX_VALUE,t.initialMaxX=-Number.MAX_VALUE,t.initialMinX=Number.MAX_VALUE,t.maxDate=0,t.minDate=Number.MAX_VALUE,t.minZ=Number.MAX_VALUE,t.maxZ=-Number.MAX_VALUE,t.minXDiff=Number.MAX_VALUE,t.yAxisScale=[],t.xAxisScale=null,t.xAxisTicksPositions=[],t.xRange=0,t.yRange=[],t.zRange=0,t.dataPoints=0,t.xTickAmount=0,t.multiAxisTickAmount=0,t.disableZoomIn=!1,t.disableZoomOut=!1,t.yLabelsCoords=[],t.yTitleCoords=[],t.barPadForNumericAxis=0,t.padHorizontal=0,t.rotateXLabels=!1,t.overlappingXLabels=!1,t.radialSize=0,t.barHeight=0,t.barWidth=0,t.animationEnded=!1,t.isDestroyed=!1,t.bulkRevealScheduled=!1,t.resizeTimer=null,t.selectionResizeTimer=null,t.lastWheelExecution=0,t.delayedElements=[],t.pointsArray=[],t.dataLabelsRects=[],t.lastDrawnDataLabelsIndexes=[],t.textRectsCache=new Map,t.domCache=new Map,t.dimensionCache={},t.cachedSelectors={},t.seriesNS||this._attachNamespaces(t)}_attachNamespaces(t){const e=(e,s,i=s)=>{Object.defineProperty(e,i,{get:()=>t[s],set(e){t[s]=e},enumerable:!0,configurable:!0})},s={};e(s,"series","data");for(const t of["seriesNames","seriesX","seriesZ","seriesXvalues","seriesYvalues","seriesGoals","seriesLog","seriesColors","seriesPercent","seriesTotals","stackedSeriesTotals","seriesCandleO","seriesCandleH","seriesCandleM","seriesCandleL","seriesCandleC","seriesRangeStart","seriesRangeEnd","seriesRange","seriesYAxisMap","seriesYAxisReverseMap","seriesGroups","barGroups","lineGroups","areaGroups","originalSeries","collapsedSeries","collapsedSeriesIndices","ancillaryCollapsedSeries","ancillaryCollapsedSeriesIndices","allSeriesCollapsed","risingSeries","previousPaths","ignoreYAxisIndexes","labels","categoryLabels","timescaleLabels","groups"])e(s,t);Object.defineProperty(t,"seriesNS",{value:s,writable:!1,enumerable:!1,configurable:!0});const i={};for(const t of["minX","maxX","initialMinX","initialMaxX","minY","maxY","minYArr","maxYArr","minZ","maxZ","minDate","maxDate","minXDiff","xRange","yRange","zRange","xAxisScale","yAxisScale","xAxisTicksPositions","xTickAmount","multiAxisTickAmount","dataPoints","maxValsInArrayIndex","isXNumeric","isMultipleYAxis","isMultiLineX","isDataXYZ","dataFormatXNumeric","allSeriesHasEqualX","hasNullValues","dataWasParsed","hasXaxisGroups","hasSeriesGroups","skipFirstTimelinelabel","skipLastTimelinelabel","yValueDecimal","invalidLogScale","noLabelsProvided"])e(i,t);Object.defineProperty(t,"axes",{value:i,writable:!1,enumerable:!1,configurable:!0});const a={};for(const t of["svgWidth","svgHeight","gridWidth","gridHeight","translateX","translateY","translateXAxisX","translateXAxisY","translateYAxisX","xAxisLabelsHeight","xAxisGroupLabelsHeight","xAxisLabelsWidth","yAxisLabelsWidth","yAxisWidths","yLabelsCoords","yTitleCoords","padHorizontal","barPadForNumericAxis","rotateXLabels","scaleX","scaleY","radialSize","defaultLabels","overlappingXLabels"])e(a,t);Object.defineProperty(t,"layout",{value:a,writable:!1,enumerable:!1,configurable:!0});const o={};for(const t of["domCache","dimensionCache","cachedSelectors","textRectsCache","pointsArray","dataLabelsRects","lastDrawnDataLabelsIndexes","delayedElements","resizeTimer","selectionResizeTimer","resizeObserver"])e(o,t);Object.defineProperty(t,"cache",{value:o,writable:!1,enumerable:!1,configurable:!0})}globalVars(t){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:t.markers.size,largestSize:0},LINE_HEIGHT_RATIO:1.618,axisCharts:!0,isSlopeChart:t.plotOptions.line.isSlopeChart,comboCharts:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],ignoreYAxisIndexes:[],isDirty:!1,isExecCalled:!1,dataChanged:!1,resized:!1,invalidLogScale:!1,hasNullValues:!1,columnSeries:null,yaxis:null,total:0,shouldAnimate:!0,previousPaths:[],svgWidth:0,svgHeight:0,defaultLabels:!1,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateYAxisX:[],yAxisWidths:[],tooltip:null,resizeObserver:null,locale:{},memory:{methodsToExec:[]},niceScaleAllowedMagMsd:L,niceScaleDefaultTicks:M,seriesYAxisMap:[],seriesYAxisReverseMap:[],noData:!1}}init(t){const e=this.globalVars(t);return this.initGlobalVars(e),e.initialConfig=m.extend({},t),e.initialSeries=m.clone(t.series),e.lastXAxis=m.clone(e.initialConfig.xaxis),e.lastYAxis=m.clone(e.initialConfig.yaxis),e}}class T{constructor(t){this.opts=t}init(){const t=new D(this.opts).init({responsiveOverride:!1}),e=(new P).init(t),s={config:t,globals:e,dom:{},interact:{zoomEnabled:"zoom"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.zoom&&t.chart.zoom.enabled,panEnabled:"pan"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.pan,selectionEnabled:"selection"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.selection,zoomed:!1,selection:void 0,visibleXRange:void 0,selectedDataPoints:[],mousedown:!1,clientX:null,clientY:null,lastClientPosition:{},lastWheelExecution:0,capturedSeriesIndex:-1,capturedDataPointIndex:-1,disableZoomIn:!1,disableZoomOut:!1,isTouchDevice:!!c.isBrowser()&&("ontouchstart"in window||navigator.maxTouchPoints>0)},formatters:{xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,legendFormatter:void 0},candleData:{seriesCandleO:[],seriesCandleH:[],seriesCandleM:[],seriesCandleL:[],seriesCandleC:[],seriesBoxPoints:[]},rangeData:{seriesRangeStart:[],seriesRangeEnd:[],seriesRange:[]},violinData:{seriesViolinDensity:[],seriesViolinPoints:[],seriesViolinMin:[],seriesViolinMax:[]},labelData:{labels:[],categoryLabels:[],timescaleLabels:[],hasXaxisGroups:!1,groups:[],seriesGroups:[]},axisFlags:{isXNumeric:!1,dataFormatXNumeric:!1,isDataXYZ:!1,isRangeData:!1,isRangeBar:!1,isMultiLineX:!1,noLabelsProvided:!1,dataWasParsed:!1},seriesData:{series:[],seriesNames:[],seriesX:[],seriesZ:[],seriesColors:[],seriesGoals:[],stackedSeriesTotals:[],stackedSeriesTotalsByGroups:[]},layout:{gridHeight:0,gridWidth:0,translateX:0,translateY:0,translateXAxisX:0,translateXAxisY:0,rotateXLabels:!1,xAxisHeight:0,xAxisLabelsHeight:0,xAxisGroupLabelsHeight:0,xAxisLabelsWidth:0,yLabelsCoords:[],yTitleCoords:[]}};Object.defineProperty(e,"dom",{get:()=>s.dom,set(t){s.dom=t},enumerable:!1,configurable:!0});for(const t of["xLabelFormatter","yLabelFormatters","xaxisTooltipFormatter","ttKeyFormatter","ttVal","ttZFormatter","legendFormatter"])Object.defineProperty(e,t,{get:()=>s.formatters[t],set(e){s.formatters[t]=e},enumerable:!1,configurable:!0});for(const t of["zoomEnabled","panEnabled","selectionEnabled","zoomed","selection","visibleXRange","selectedDataPoints","mousedown","clientX","clientY","lastClientPosition","lastWheelExecution","capturedSeriesIndex","capturedDataPointIndex","disableZoomIn","disableZoomOut","isTouchDevice"])Object.defineProperty(e,t,{get:()=>s.interact[t],set(e){s.interact[t]=e},enumerable:!1,configurable:!0});for(const t of["gridHeight","gridWidth","translateX","translateY","translateXAxisX","translateXAxisY","rotateXLabels","xAxisHeight","xAxisLabelsHeight","xAxisGroupLabelsHeight","xAxisLabelsWidth","yLabelsCoords","yTitleCoords"])Object.defineProperty(e,t,{get:()=>s.layout[t],set(e){s.layout[t]=e},enumerable:!1,configurable:!0});for(const t of["series","seriesNames","seriesX","seriesZ","seriesColors","seriesGoals","stackedSeriesTotals","stackedSeriesTotalsByGroups"])Object.defineProperty(e,t,{get:()=>s.seriesData[t],set(e){s.seriesData[t]=e},enumerable:!1,configurable:!0});for(const t of["isXNumeric","dataFormatXNumeric","isDataXYZ","isRangeData","isRangeBar","isMultiLineX","noLabelsProvided","dataWasParsed"])Object.defineProperty(e,t,{get:()=>s.axisFlags[t],set(e){s.axisFlags[t]=e},enumerable:!1,configurable:!0});for(const t of["labels","categoryLabels","timescaleLabels","hasXaxisGroups","groups","seriesGroups"])Object.defineProperty(e,t,{get:()=>s.labelData[t],set(e){s.labelData[t]=e},enumerable:!1,configurable:!0});for(const t of["seriesRangeStart","seriesRangeEnd","seriesRange"])Object.defineProperty(e,t,{get:()=>s.rangeData[t],set(e){s.rangeData[t]=e},enumerable:!1,configurable:!0});for(const t of["seriesCandleO","seriesCandleH","seriesCandleM","seriesCandleL","seriesCandleC"])Object.defineProperty(e,t,{get:()=>s.candleData[t],set(e){s.candleData[t]=e},enumerable:!1,configurable:!0});for(const t of["seriesViolinDensity","seriesViolinPoints","seriesViolinMin","seriesViolinMax"])Object.defineProperty(e,t,{get:()=>s.violinData[t],set(e){s.violinData[t]=e},enumerable:!1,configurable:!0});return s}}class F{constructor(t){this.w=t}static checkComboSeries(t,e){let s=!1,i=0,a=0;return void 0===e&&(e="line"),t.length&&void 0!==t[0].type&&t.forEach(t=>{"bar"!==t.type&&"column"!==t.type&&"candlestick"!==t.type&&"boxPlot"!==t.type&&"violin"!==t.type||i++,void 0!==t.type&&t.type!==e&&a++}),a>0&&(s=!0),{comboBarCount:i,comboCharts:s}}getStackedSeriesTotals(t=[]){const e=this.w,s=[];if(0===e.seriesData.series.length)return s;for(let i=0;i<e.seriesData.series[e.globals.maxValsInArrayIndex].length;i++){let a=0;for(let s=0;s<e.seriesData.series.length;s++)void 0!==e.seriesData.series[s][i]&&-1===t.indexOf(s)&&(a+=e.seriesData.series[s][i]);s.push(a)}return s}getSeriesTotalByIndex(t=null){if(null===t)return this.w.config.series.reduce((t,e)=>t+e,0);{const e=this.w.seriesData.series[t];return Array.isArray(e)?e.reduce((t,e)=>t+e,0):null!=e?e:0}}getStackedSeriesTotalsByGroups(){const t=this.w,e=[];return t.labelData.seriesGroups.forEach(s=>{const i=[];t.config.series.forEach((e,a)=>{s.indexOf(t.seriesData.seriesNames[a])>-1&&i.push(a)});const a=t.seriesData.series.map((t,e)=>-1===i.indexOf(e)?e:-1).filter(t=>-1!==t);e.push(this.getStackedSeriesTotals(a))}),e}setSeriesYAxisMappings(){const t=this.w.globals,e=this.w.config;let s=[];const i=[],a=[],o=this.w.seriesData.series.length>e.yaxis.length||e.yaxis.some(t=>Array.isArray(t.seriesName));e.series.forEach((t,e)=>{a.push(e),i.push(null)}),e.yaxis.forEach((t,e)=>{s[e]=[]});const r=[];e.yaxis.forEach((t,i)=>{let n=!1;if(t.seriesName){let r=[];Array.isArray(t.seriesName)?r=t.seriesName:r.push(t.seriesName),r.forEach(t=>{e.series.forEach((e,r)=>{if(e.name===t){let t=r;i===r||o?(!o||a.indexOf(r)>-1)&&s[i].push([i,r]):(s[r].push([r,i]),t=i),n=!0,t=a.indexOf(t),-1!==t&&a.splice(t,1)}})})}n||r.push(i)}),s=s.map(t=>{const e=[];return t.forEach(t=>{i[t[1]]=t[0],e.push(t[1])}),e});let n=e.yaxis.length-1;for(let t=0;t<r.length&&(n=r[t],s[n]=[],a);t++){const t=a[0];a.shift(),s[n].push(t),i[t]=n}a.forEach(t=>{s[n].push(t),i[t]=n}),t.seriesYAxisMap=s.map(t=>t),t.seriesYAxisReverseMap=i.map(t=>t),t.seriesYAxisMap.forEach((t,s)=>{t.forEach(t=>{if(e.series[t]&&void 0===e.series[t].group){e.series[t].group="apexcharts-axis-".concat(s.toString())}})})}isSeriesNull(t=null){let e=[];const s=this.w.config.series;return e=null===t?s.filter(t=>null!==t):s[t]&&Array.isArray(s[t].data)?s[t].data.filter(t=>null!==t):null!==s[t]&&void 0!==s[t]?[s[t]]:[],0===e.length}seriesHaveSameValues(t){const e=this.w.seriesData.series[t];return!Array.isArray(e)||e.every((t,e,s)=>t===s[0])}getCategoryLabels(t){const e=this.w;let s=t.slice();return e.config.xaxis.convertedCatToNumeric&&(s=t.map(t=>e.config.xaxis.labels.formatter(t-e.globals.minX+1))),s}getLargestSeries(){const t=this.w;t.globals.maxValsInArrayIndex=t.seriesData.series.map(t=>t.length).indexOf(Math.max.apply(Math,t.seriesData.series.map(t=>t.length)))}getLargestMarkerSize(){const t=this.w;let e=0;return t.globals.markers.size.forEach(t=>{e=Math.max(e,t)}),t.config.markers.discrete&&t.config.markers.discrete.length&&t.config.markers.discrete.forEach(t=>{e=Math.max(e,t.size)}),e>0&&(t.config.markers.hover.size>0?e=t.config.markers.hover.size:e+=t.config.markers.hover.sizeOffset),t.globals.markers.largestSize=e,e}getSeriesTotals(){const t=this.w;t.globals.seriesTotals=t.seriesData.series.map(t=>{let e=0;if(Array.isArray(t))for(let s=0;s<t.length;s++)e+=t[s];else e+=t;return e})}getSeriesTotalsXRange(t,e){const s=this.w;return s.seriesData.series.map((i,a)=>{let o=0;for(let r=0;r<i.length;r++)s.seriesData.seriesX[a][r]>t&&s.seriesData.seriesX[a][r]<e&&(o+=i[r]);return o})}getPercentSeries(){const t=this.w;t.globals.seriesPercent=t.seriesData.series.map(e=>{const s=[];if(Array.isArray(e))for(let i=0;i<e.length;i++){const a=t.seriesData.stackedSeriesTotals[i];let o=0;a&&(o=100*e[i]/a),s.push(o)}else{const i=100*e/t.globals.seriesTotals.reduce((t,e)=>t+e,0);s.push(i)}return s})}getCalculatedRatios(){const t=this.w,e=t.globals,s=[];let i=0,a=0,o=0,r=0,n=[],l=.1,h=0;if(e.yRange=[],e.isMultipleYAxis)for(let t=0;t<e.minYArr.length;t++)e.yRange.push(Math.abs(e.minYArr[t]-e.maxYArr[t])),n.push(0);else e.yRange.push(Math.abs(e.minY-e.maxY));e.xRange=Math.abs(e.maxX-e.minX),e.zRange=Math.abs(e.maxZ-e.minZ);for(let t=0;t<e.yRange.length;t++)s.push(e.yRange[t]/this.w.layout.gridHeight);if(a=e.xRange/this.w.layout.gridWidth,i=e.yRange/this.w.layout.gridWidth,o=e.xRange/this.w.layout.gridHeight,r=e.zRange/this.w.layout.gridHeight*16,r||(r=1),e.minY!==Number.MIN_VALUE&&0!==Math.abs(e.minY)){e.hasNegs=!0}if(t.globals.seriesYAxisReverseMap.length>0){const o=(e,i)=>{const a=t.config.yaxis[t.globals.seriesYAxisReverseMap[i]],o=e<0?-1:1;return e=Math.abs(e),a.logarithmic&&(e=this.getBaseLog(a.logBase,e)),-o*e/s[i]};if(e.isMultipleYAxis){n=[];for(let t=0;t<s.length;t++)n.push(o(e.minYArr[t],t))}else n=[],n.push(o(e.minY,0)),e.minY!==Number.MIN_VALUE&&0!==Math.abs(e.minY)&&(l=-e.minY/i,h=e.minX/a)}else n=[],n.push(0),l=0,h=0;return{yRatio:s,invertedYRatio:i,zRatio:r,xRatio:a,invertedXRatio:o,baseLineInvertedY:l,baseLineY:n,baseLineX:h}}getLogSeries(t){const e=this.w;return e.globals.seriesLog=t.map((t,s)=>{const i=e.globals.seriesYAxisReverseMap[s];return e.config.yaxis[i]&&e.config.yaxis[i].logarithmic?t.map(t=>null===t?null:this.getLogVal(e.config.yaxis[i].logBase,t,s)):t}),e.globals.invalidLogScale?t:e.globals.seriesLog}getLogValAtSeriesIndex(t,e){if(null===t)return null;const s=this.w,i=s.globals.seriesYAxisReverseMap[e];return s.config.yaxis[i]&&s.config.yaxis[i].logarithmic?this.getLogVal(s.config.yaxis[i].logBase,t,e):t}getBaseLog(t,e){return Math.log(e)/Math.log(t)}getLogVal(t,e,s){if(e<=0)return 0;const i=this.w,a=0===i.globals.minYArr[s]?-1:this.getBaseLog(t,i.globals.minYArr[s]),o=(0===i.globals.maxYArr[s]?0:this.getBaseLog(t,i.globals.maxYArr[s]))-a;if(e<1)return e/o;return(this.getBaseLog(t,e)-a)/o}getLogYRatios(t){const e=this.w,s=this.w.globals,i=s;return i.yLogRatio=t.slice(),i.logYRange=s.yRange.map((t,a)=>{const o=e.globals.seriesYAxisReverseMap[a];if(e.config.yaxis[o]&&this.w.config.yaxis[o].logarithmic){let t=-Number.MAX_VALUE,o=Number.MIN_VALUE,r=1;return s.seriesLog.forEach((s,i)=>{s.forEach(s=>{e.config.yaxis[i]&&e.config.yaxis[i].logarithmic&&(t=Math.max(s,t),o=Math.min(s,o))})}),r=Math.pow(s.yRange[a],Math.abs(o-t)/s.yRange[a]),i.yLogRatio[a]=r/this.w.layout.gridHeight,r}}),i.invalidLogScale?t.slice():i.yLogRatio}static extendArrayProps(t,e,s){var i,a;return(null==e?void 0:e.yaxis)&&(e=t.extendYAxis(e,s)),(null==e?void 0:e.annotations)&&(e.annotations.yaxis&&(e=t.extendYAxisAnnotations(e)),(null==(i=null==e?void 0:e.annotations)?void 0:i.xaxis)&&(e=t.extendXAxisAnnotations(e)),(null==(a=null==e?void 0:e.annotations)?void 0:a.points)&&(e=t.extendPointAnnotations(e))),e}drawSeriesByGroup(t,e,s,i){const a=this.w,o=[];return t.series.length>0&&e.forEach(e=>{const r=[],n=[];t.i.forEach((s,i)=>{a.config.series[s].group===e&&(r.push(t.series[i]),n.push(s))}),r.length>0&&o.push(i.draw(r,s,n))}),o}}const E="http://www.w3.org/2000/svg";function I(t){return 1-Math.pow(1-t,3)}let X=null;function R(){if(!c.isBrowser())return!1;try{return X||(X=window.matchMedia("(prefers-reduced-motion: reduce)")),!!X.matches}catch(t){return!1}}function z(t,e,s){if(!c.isBrowser())return!1;if(s.globals.dataChanged||s.globals.resized)return!1;const i=s.config.chart.animations;if(!i||!1===i.enabled)return!1;const a=s.config.chart.type;if("line"!==a&&"area"!==a&&"rangeArea"!==a)return!1;if(!(s.layout.gridWidth>0))return!1;const o=2*(i.speed||800),r=Math.max(0,Math.min(1,e/s.layout.gridWidth)),n=(1-Math.cbrt(1-r))*o,l=t.node.style;l.opacity="0";let h=null;const d=t=>{null===h&&(h=t),t-h>=n?l.opacity="":b.requestAnimationFrame(d)};return b.requestAnimationFrame(d),!0}function Y(t){const e=t.style,s=t.index||0,i="number"==typeof t.baseDelay?t.baseDelay:40,a=t.row||0,o=t.col||0,r=t.groupIndex||0,n=t.perGroup||1,l=t.centerDistance||0;switch(e){case"none":return 0;case"diagonal":return(a+o)*i;case"group":return r*i+s%n*(i/4);case"centroid":return l*i*(s+1);default:return s*i}}class B{constructor(t,e){this.w=t,this.ctx=e}animateLine(t,e,s,i){t.attr(e).animate(i).attr(s)}animateMarker(t,e,s,i){t.attr({opacity:0}).animate(e).attr({opacity:1}).after(()=>{i()})}animatePop(t,{speed:e,delay:s=0,onComplete:i}){const a=this.w;if(!c.isBrowser()||!a.globals.shouldAnimate||e<1)return void(i&&i());const o=t.node.style;o.transformBox="fill-box",o.transformOrigin="center",o.transform="scale(0)",o.opacity="0";const r=performance.now()+s,n=t=>{const s=Math.max(0,Math.min(1,(t-r)/e));o.transform=`scale(${function(t){const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)}(s)})`,o.opacity=String(Math.min(1,2*s)),s<1?b.requestAnimationFrame(n):(o.transform="",o.transformOrigin="",o.transformBox="",o.opacity="",i&&i())};b.requestAnimationFrame(n)}animateRect(t,e,s,i,a,o=0){t.attr(e).animate(i,o).attr(s).after(()=>a())}animatePathsGradually(t){const{el:e,realIndex:s,j:i,fill:a,pathFrom:o,pathTo:r,speed:n,delay:l}=t,h=this.w;let c=0;h.config.chart.animations.animateGradually.enabled&&(c=h.config.chart.animations.animateGradually.delay),h.config.chart.animations.dynamicAnimation.enabled&&h.globals.dataChanged&&"bar"!==h.config.chart.type&&(c=0),this.morphSVG(e,s,i,"line"!==h.config.chart.type||h.globals.comboCharts?a:"stroke",o,r,n,l*c)}revealBulk(t){const e=this.w;t.node.classList.add("apexcharts-element-hidden"),e.globals.delayedElements.push({el:t.node}),c.isBrowser()&&e.globals.shouldAnimate?e.globals.bulkRevealScheduled||(e.globals.bulkRevealScheduled=!0,b.requestAnimationFrame(()=>{e.globals.isDestroyed||(e.globals.bulkRevealScheduled=!1,this.animationCompleted(t))})):this.animationCompleted(t)}showDelayedElements(){this.w.globals.delayedElements.forEach(t=>{const e=t.el;e.classList.remove("apexcharts-element-hidden"),e.classList.add("apexcharts-hidden-element-shown")})}animationCompleted(t){const e=this.w;e.globals.animationEnded||(e.globals.animationEnded=!0,this.showDelayedElements(),"function"==typeof e.config.chart.events.animationEnd&&e.config.chart.events.animationEnd(this.ctx,{el:t,w:e}))}animateDraw(t,{realIndex:e,j:s,isFill:i,isLast:a,speed:o,delay:r,mask:n}){const l=this.w,h=this,d=()=>{a&&l.globals.shouldAnimate&&h.animationCompleted(t),h.showDelayedElements()};if(!c.isBrowser()||!l.globals.shouldAnimate||o<1)return void d();const g=t.node,p=()=>{const t=n&&"radial"===n.type,a=l.layout.gridWidth+8,h=n&&n.cx||0,c=n&&n.cy||0,p=(n&&n.r||l.layout.gridWidth/2)+4,u=`apexDrawMask${l.globals.cuid}-${e}-${null!=s?s:0}-${i?"f":"s"}`,x=b.createElementNS(E,"mask");let f;if(x.setAttribute("id",u),x.setAttribute("maskUnits","userSpaceOnUse"),t){const t=p;x.setAttribute("x",String(h-t)),x.setAttribute("y",String(c-t)),x.setAttribute("width",String(2*t)),x.setAttribute("height",String(2*t)),f=b.createElementNS(E,"circle"),f.setAttribute("cx",String(h)),f.setAttribute("cy",String(c)),f.setAttribute("r","0"),f.setAttribute("fill","#fff")}else x.setAttribute("x",String(-4)),x.setAttribute("y",String(-4)),x.setAttribute("width",String(a)),x.setAttribute("height",String(l.layout.gridHeight+8)),f=b.createElementNS(E,"rect"),f.setAttribute("x",String(-4)),f.setAttribute("y",String(-4)),f.setAttribute("width","0"),f.setAttribute("height",String(l.layout.gridHeight+8)),f.setAttribute("fill","#fff");x.appendChild(f),l.dom.elDefs.node.appendChild(x),g.setAttribute("mask",`url(#${u})`);const m=performance.now()+(r||0),y=e=>{if(l.globals.isDestroyed)return;const s=Math.max(0,Math.min(1,(e-m)/o)),i=I(s);t?f.setAttribute("r",String(i*p)):f.setAttribute("width",String(i*a)),s<1?b.requestAnimationFrame(y):(g.removeAttribute("mask"),x.parentNode&&x.parentNode.removeChild(x),d())};b.requestAnimationFrame(y)};b.requestAnimationFrame(()=>{if(l.globals.isDestroyed)return;if(i)return void p();const t=g.getAttribute("stroke-dasharray");if(!!t&&"0"!==t&&""!==t)return void p();let e=0;try{"function"==typeof g.getTotalLength&&(e=g.getTotalLength())}catch(t){e=0}e?(t=>{g.setAttribute("stroke-dasharray",String(t)),g.setAttribute("stroke-dashoffset",String(t));const e=performance.now()+(r||0),s=i=>{if(l.globals.isDestroyed)return;const a=Math.max(0,Math.min(1,(i-e)/o));g.setAttribute("stroke-dashoffset",String(t*(1-I(a)))),a<1?b.requestAnimationFrame(s):(g.removeAttribute("stroke-dasharray"),g.removeAttribute("stroke-dashoffset"),d())};b.requestAnimationFrame(s)})(e):d()})}morphSVG(t,e,s,i,a,o,r,n){var l,h;const c=this.w;a||(a=t.attr("pathFrom")),o||(o=t.attr("pathTo"));const d=()=>("radar"===c.config.chart.type&&(r=1),`M 0 ${c.layout.gridHeight}`);(!a||a.indexOf("undefined")>-1||a.indexOf("NaN")>-1)&&(a=d()),(!o.trim()||o.indexOf("undefined")>-1||o.indexOf("NaN")>-1)&&(o=d()),c.globals.shouldAnimate||(r=1);const g=!0===(null==(h=null==(l=this.ctx)?void 0:l.morphTypeChange)?void 0:h.isActive())?"polygons":"commands";t.plot(a).animate(1,n).plot(a).animate(r,n).plot(o,g).after(()=>{m.isNumber(s)?s===c.seriesData.series[c.globals.maxValsInArrayIndex].length-2&&c.globals.shouldAnimate&&this.animationCompleted(t):"none"!==i&&c.globals.shouldAnimate&&(!c.globals.comboCharts&&e===c.seriesData.series.length-1||c.globals.comboCharts)&&this.animationCompleted(t),this.showDelayedElements()})}}class H{constructor(t){this.w=t}getDefaultFilter(t,e){const s=this.w;t.unfilter&&t.unfilter(!0),s.config.chart.dropShadow.enabled&&this.dropShadow(t,s.config.chart.dropShadow,e)}applyFilter(t,e,s){var i,a,o;const r=this.w;if(t.unfilter&&t.unfilter(!0),"none"===s)return void this.getDefaultFilter(t,e);const n=r.config.chart.dropShadow,l="lighten"===s?2:.3;t.filterWith&&(t.filterWith(t=>{t.colorMatrix({type:"matrix",values:`\n ${l} 0 0 0 0\n 0 ${l} 0 0 0\n 0 0 ${l} 0 0\n 0 0 0 1 0\n `,in:"SourceGraphic",result:"brightness"}),n.enabled&&this.addShadow(t,e,n,"brightness")}),n.noUserSpaceOnUse||null==(a=null==(i=t.filterer())?void 0:i.node)||a.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(null==(o=t.filterer())?void 0:o.node))}addShadow(t,e,s,i){var a;const o=this.w;let{blur:r,top:n,left:l,color:h,opacity:c}=s;if(h=Array.isArray(h)?h[e]:h,(null==(a=o.config.chart.dropShadow.enabledOnSeries)?void 0:a.length)>0&&-1===o.config.chart.dropShadow.enabledOnSeries.indexOf(e))return t;t.offset({in:i,dx:l,dy:n,result:"offset"}),t.gaussianBlur({in:"offset",stdDeviation:r,result:"blur"}),t.flood({"flood-color":h,"flood-opacity":c,result:"flood"}),t.composite({in:"flood",in2:"blur",operator:"in",result:"shadow"}),t.merge(["shadow",i])}dropShadow(t,e,s=0){var i,a,o,r,n;const l=this.w;return t.unfilter&&t.unfilter(!0),m.isMsEdge()&&"radialBar"===l.config.chart.type||(null==(i=l.config.chart.dropShadow.enabledOnSeries)?void 0:i.length)>0&&-1===(null==(a=l.config.chart.dropShadow.enabledOnSeries)?void 0:a.indexOf(s))||t.filterWith&&(t.filterWith(t=>{this.addShadow(t,s,e,"SourceGraphic")}),e.noUserSpaceOnUse||null==(r=null==(o=t.filterer())?void 0:o.node)||r.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(null==(n=t.filterer())?void 0:n.node)),t}setSelectionFilter(t,e,s){const i=this.w;if(void 0!==i.interact.selectedDataPoints[e]&&i.interact.selectedDataPoints[e].indexOf(s)>-1){t.node.setAttribute("selected",!0);const s=i.config.states.active.filter;"none"!==s&&this.applyFilter(t,e,s.type)}}_scaleFilterSize(t){if(!t)return;(e=>{for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.setAttribute(s,e[s])})({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}class N{constructor(t,e=null){this.w=t,this.ctx=e}roundPathCorners(t,e){function s(t,e,s){var a=e.x-t.x,o=e.y-t.y,r=Math.sqrt(a*a+o*o);return i(t,e,Math.min(1,s/r))}function i(t,e,s){return{x:t.x+(e.x-t.x)*s,y:t.y+(e.y-t.y)*s}}function a(t,e){t.length>2&&(t[t.length-2]=e.x,t[t.length-1]=e.y)}function o(t){return{x:parseFloat(t[t.length-2]),y:parseFloat(t[t.length-1])}}t.indexOf("NaN")>-1&&(t="");var r=t.split(/[,\s]/).reduce(function(t,e){var s=e.match(/^([a-zA-Z])(.+)/);return s?(t.push(s[1]),t.push(s[2])):t.push(e),t},[]).reduce(function(t,e){return parseFloat(e)==e&&t.length?t[t.length-1].push(e):t.push([e]),t},[]),n=[];if(r.length>1){var l=o(r[0]),h=null;"Z"==r[r.length-1][0]&&r[0].length>2&&(h=["L",l.x,l.y],r[r.length-1]=h),n.push(r[0]);for(var c=1;c<r.length;c++){var d=n[n.length-1],g=r[c],p=g==h?r[1]:r[c+1];if(p&&d&&d.length>2&&"L"==g[0]&&p.length>2&&"L"==p[0]){var u,x,f=o(d),b=o(g),m=o(p);u=s(b,f,e),x=s(b,m,e),a(g,u),g.origPoint=b,n.push(g);var y=i(u,b,.5),w=i(b,x,.5),v=["C",y.x,y.y,w.x,w.y,x.x,x.y];v.origPoint=b,n.push(v)}else n.push(g)}if(h){var A=o(n[n.length-1]);n.push(["Z"]),a(n[0],A)}}else n=r;return n.reduce(function(t,e){return t+e.join(" ")+" "},"")}drawLine(t,e,s,i,a="#a8a8a8",o=0,r=null,n="butt"){return this.w.dom.Paper.line().attr({x1:t,y1:e,x2:s,y2:i,stroke:a,"stroke-dasharray":o,"stroke-width":r,"stroke-linecap":n})}drawRect(t=0,e=0,s=0,i=0,a=0,o="#fefefe",r=1,n=null,l=null,h=0){const c=this.w.dom.Paper.rect();return c.attr({x:t,y:e,width:s>0?s:0,height:i>0?i:0,rx:a,ry:a,opacity:r,"stroke-width":null!==n?n:0,stroke:null!==l?l:"none","stroke-dasharray":h}),c.node.setAttribute("fill",o),c}drawPolygon(t,e="#e1e1e1",s=1,i="none"){return this.w.dom.Paper.polygon(t).attr({fill:i,stroke:e,"stroke-width":s})}drawCircle(t,e=null){t<0&&(t=0);const s=this.w.dom.Paper.circle(2*t);return null!==e&&s.attr(e),s}drawPath({d:t="",stroke:e="#a8a8a8",strokeWidth:s=1,fill:i,fillOpacity:a=1,strokeOpacity:o=1,classes:r,strokeLinecap:n=null,strokeDashArray:l=0}){const h=this.w;null===n&&(n=h.config.stroke.lineCap),(t.indexOf("undefined")>-1||t.indexOf("NaN")>-1)&&(t=`M 0 ${h.layout.gridHeight}`);return h.dom.Paper.path(t).attr({fill:i,"fill-opacity":a,stroke:e,"stroke-opacity":o,"stroke-linecap":n,"stroke-width":s,"stroke-dasharray":l,class:r})}group(t=null){const e=this.w.dom.Paper.group();return null!==t&&e.attr(t),e}move(t,e){return["M",t,e].join(" ")}line(t,e,s=null){return"H"===s?[" H",t].join(" "):"V"===s?[" V",e].join(" "):[" L",t,e].join(" ")}curve(t,e,s,i,a,o){return["C",t,e,s,i,a,o].join(" ")}quadraticCurve(t,e,s,i){return["Q",t,e,s,i].join(" ")}arc(t,e,s,i,a,o,r,n=!1){let l="A";n&&(l="a");return[l,t,e,s,i,a,o,r].join(" ")}renderPaths({j:t,realIndex:e,pathFrom:s,pathTo:i,stroke:a,strokeWidth:o,strokeLinecap:r,fill:h,animationDelay:c,initialSpeed:d,dataChangeSpeed:g,className:p,chartType:u,shouldClipToGrid:x=!0,bindEventsOnPaths:f=!0,drawShadow:b=!0,drawMask:m=null}){var y,w;const v=this.w,A=new H(this.w),C=new B(this.w,null!=(y=this.ctx)?y:void 0),S=this.w.config.chart.animations.enabled,k=S&&this.w.config.chart.animations.dynamicAnimation.enabled;if(s&&s.startsWith("M 0 0 ")&&i){const t=i.match(/^M\s+[\d.-]+\s+[\d.-]+/);t&&(s=s.replace(/^M\s+0\s+0/,t[0]))}let D;const L=!!(S&&!v.globals.resized||k&&v.globals.dataChanged&&v.globals.shouldAnimate),M="string"==typeof p&&(p.indexOf("apexcharts-line")>-1||p.indexOf("apexcharts-area")>-1||p.indexOf("apexcharts-rangeArea")>-1||p.indexOf("apexcharts-radar")>-1),P=!(!S||v.globals.resized||v.globals.dataChanged||!M),T=null!=(w=v.config.chart.animations.largeDatasetThreshold)?w:0,F=!!(L&&!P&&T>0&&v.globals.dataPoints>T),E=!(!("candlestick"===u||"boxPlot"===u)||!L||P||!v.globals.dataChanged),I=F||E;!L||P||I?(D=i,L||(v.globals.animationEnded=!0)):D=s;const X=v.config.stroke.dashArray;let R=0;R=Array.isArray(X)?X[e]:v.config.stroke.dashArray;const z=this.drawPath({d:D,stroke:a,strokeWidth:o,fill:h,fillOpacity:1,classes:p,strokeLinecap:r,strokeDashArray:R});z.attr("index",e),x&&("bar"===u&&!v.globals.isBarHorizontal||v.globals.comboCharts?z.attr({"clip-path":`url(#gridRectBarMask${v.globals.cuid})`}):z.attr({"clip-path":`url(#gridRectMask${v.globals.cuid})`})),v.config.chart.dropShadow.enabled&&b&&A.dropShadow(z,v.config.chart.dropShadow,e),f&&(z.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,z)),z.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,z)),z.node.addEventListener("mousedown",this.pathMouseDown.bind(this,z))),z.attr({pathTo:i,pathFrom:s});const Y={el:z,j:t,realIndex:e,pathFrom:s,pathTo:i,fill:h,strokeWidth:o,delay:c};if(!S||v.globals.resized||v.globals.dataChanged)!v.globals.resized&&v.globals.dataChanged||I||C.showDelayedElements();else if(P){const s=2*d,i="none"===a||0===o,r=v.seriesData.series.length,n=!!v.globals.comboCharts||e===r-1;C.animateDraw(z,{realIndex:e,j:t,isFill:i,isLast:n,speed:s,delay:0,mask:m})}else I||C.animatePathsGradually(l(n({},Y),{speed:d}));return v.globals.dataChanged&&k&&L&&!I&&C.animatePathsGradually(l(n({},Y),{speed:g})),I&&C.revealBulk(z),z}drawPattern(t,e,s,i="#a8a8a8",a=0){return this.w.dom.Paper.pattern(e,s,o=>{"horizontalLines"===t?o.line(0,0,s,0).stroke({color:i,width:a+1}):"verticalLines"===t?o.line(0,0,0,e).stroke({color:i,width:a+1}):"slantedLines"===t?o.line(0,0,e,s).stroke({color:i,width:a}):"squares"===t?o.rect(e,s).fill("none").stroke({color:i,width:a}):"circles"===t&&o.circle(e).fill("none").stroke({color:i,width:a})})}drawGradient(t,e,s,i,a,o=null,r=null,n=[],l=0){const h=this.w;let c;e.length<9&&0===e.indexOf("#")&&(e=m.hexToRgba(e,i)),s.length<9&&0===s.indexOf("#")&&(s=m.hexToRgba(s,a));let d=0,g=1,p=1,u=null;null!==r&&(d=void 0!==r[0]?r[0]/100:0,g=void 0!==r[1]?r[1]/100:1,p=void 0!==r[2]?r[2]/100:1,u=void 0!==r[3]?r[3]/100:null);const x=!("donut"!==h.config.chart.type&&"pie"!==h.config.chart.type&&"polarArea"!==h.config.chart.type&&"bubble"!==h.config.chart.type);if(c=n&&0!==n.length?h.dom.Paper.gradient(x?"radial":"linear",t=>{(Array.isArray(n[l])?n[l]:n).forEach(e=>{t.stop(e.offset/100,e.color,e.opacity)})}):h.dom.Paper.gradient(x?"radial":"linear",t=>{t.stop(d,e,i),t.stop(g,s,a),t.stop(p,s,a),null!==u&&t.stop(u,e,i)}),x){const t=h.layout.gridWidth/2,e=h.layout.gridHeight/2;"bubble"!==h.config.chart.type?c.attr({gradientUnits:"userSpaceOnUse",cx:t,cy:e,r:o}):c.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?c.from(0,0).to(0,1):"diagonal"===t?c.from(0,0).to(1,1):"horizontal"===t?c.from(0,1).to(1,1):"diagonal2"===t&&c.from(1,0).to(0,1);return c}getTextBasedOnMaxWidth({text:t,maxWidth:e,fontSize:s,fontFamily:i}){const a=this.getTextRects(t,s,i,""),o=a.width/t.length,r=Math.floor(e/o);return e<a.width?t.slice(0,r-3)+"...":t}drawText({x:t,y:e,text:s,textAnchor:i,fontSize:a,fontFamily:o,fontWeight:r,foreColor:l,opacity:h,maxWidth:c,cssClass:d="",isPlainText:g=!0,dominantBaseline:p="auto"}){const u=this.w;void 0===s&&(s="");let x=s;i||(i="start"),l&&l.length||(l=u.config.chart.foreColor),o=o||u.config.chart.fontFamily,r=r||"regular";const f={maxWidth:c,fontSize:a=a||"11px",fontFamily:o};let b;return Array.isArray(s)?b=u.dom.Paper.text(t=>{for(let e=0;e<s.length;e++)x=s[e],c&&(x=this.getTextBasedOnMaxWidth(n({text:s[e]},f))),0===e?t.tspan(x):t.tspan(x).newLine()}):(c&&(x=this.getTextBasedOnMaxWidth(n({text:s},f))),b=g?u.dom.Paper.plain(s):u.dom.Paper.text(t=>t.tspan(x))),b.attr({x:t,y:e,"text-anchor":i,"dominant-baseline":p,"font-size":a,"font-family":o,"font-weight":r,fill:l,class:"apexcharts-text "+d}),b.node.style.fontFamily=o,b.node.style.opacity=h,b}getMarkerPath(t,e,s,i){let a="";switch(s){case"cross":a=`M ${t-(i/=1.4)} ${e-i} L ${t+i} ${e+i} M ${t-i} ${e+i} L ${t+i} ${e-i}`;break;case"plus":a=`M ${t-(i/=1.12)} ${e} L ${t+i} ${e} M ${t} ${e-i} L ${t} ${e+i}`;break;case"star":case"sparkle":{let o=5;i*=1.15,"sparkle"===s&&(i/=1.1,o=4);const r=Math.PI/o;for(let s=0;s<=2*o;s++){const o=s*r,n=s%2==0?i:i/2;a+=(0===s?"M":"L")+(t+n*Math.sin(o))+","+(e-n*Math.cos(o))}a+="Z";break}case"triangle":a=`M ${t} ${e-i} \n L ${t+i} ${e+i} \n L ${t-i} ${e+i} \n Z`;break;case"square":case"rect":a=`M ${t-(i/=1.125)} ${e-i} \n L ${t+i} ${e-i} \n L ${t+i} ${e+i} \n L ${t-i} ${e+i} \n Z`;break;case"diamond":a=`M ${t} ${e-(i*=1.05)} \n L ${t+i} ${e} \n L ${t} ${e+i} \n L ${t-i} ${e} \n Z`;break;case"line":a=`M ${t-(i/=1.1)} ${e} \n L ${t+i} ${e}`;break;default:a=`M ${t}, ${e} \n m -${(i*=2)/2}, 0 \n a ${i/2},${i/2} 0 1,0 ${i},0 \n a ${i/2},${i/2} 0 1,0 -${i},0`}return a}drawMarkerShape(t,e,s,i,a){const o=this.drawPath({d:this.getMarkerPath(t,e,s,i),stroke:a.pointStrokeColor,strokeDashArray:a.pointStrokeDashArray,strokeWidth:a.pointStrokeWidth,fill:a.pointFillColor,fillOpacity:a.pointFillOpacity,strokeOpacity:a.pointStrokeOpacity});return o.attr({cx:t,cy:e,shape:a.shape,class:a.class?a.class:""}),o}drawMarker(t,e,s){t=t||0;let i=s.pSize||0;return m.isNumber(e)||(i=0,e=0),this.drawMarkerShape(t,e,null==s?void 0:s.shape,i,n(n({},s),"line"===s.shape||"plus"===s.shape||"cross"===s.shape?{pointStrokeColor:s.pointFillColor,pointStrokeOpacity:s.pointFillOpacity}:{}))}pathMouseEnter(t,e){var s,i;const a=this.w,o=new H(this.w),r=parseInt(null!=(s=t.node.getAttribute("index"))?s:"",10),n=parseInt(null!=(i=t.node.getAttribute("j"))?i:"",10);if(!(isNaN(r)||isNaN(n)||("function"==typeof a.config.chart.events.dataPointMouseEnter&&a.config.chart.events.dataPointMouseEnter(e,this.ctx,{seriesIndex:r,dataPointIndex:n,w:a}),N._fireEvent(a,"dataPointMouseEnter",[e,this.ctx,{seriesIndex:r,dataPointIndex:n,w:a}]),"none"!==a.config.states.active.filter.type&&"true"===t.node.getAttribute("selected")||"none"===a.config.states.hover.filter.type||a.interact.isTouchDevice))){const e=a.config.states.hover.filter;o.applyFilter(t,r,e.type)}}pathMouseLeave(t,e){var s,i;const a=this.w,o=new H(this.w),r=parseInt(null!=(s=t.node.getAttribute("index"))?s:"",10),n=parseInt(null!=(i=t.node.getAttribute("j"))?i:"",10);isNaN(r)||isNaN(n)||("function"==typeof a.config.chart.events.dataPointMouseLeave&&a.config.chart.events.dataPointMouseLeave(e,this.ctx,{seriesIndex:r,dataPointIndex:n,w:a}),N._fireEvent(a,"dataPointMouseLeave",[e,this.ctx,{seriesIndex:r,dataPointIndex:n,w:a}]),"none"!==a.config.states.active.filter.type&&"true"===t.node.getAttribute("selected")||"none"!==a.config.states.hover.filter.type&&o.getDefaultFilter(t,r))}pathMouseDown(t,e){var s,i;const a=this.w,o=new H(this.w),r=parseInt(null!=(s=t.node.getAttribute("index"))?s:"",10),n=parseInt(null!=(i=t.node.getAttribute("j"))?i:"",10);if(isNaN(r)||isNaN(n))return;let l="false";if("true"===t.node.getAttribute("selected")){t.node.setAttribute("selected","false");const e=a.interact.selectedDataPoints[r].indexOf(n);e>-1&&a.interact.selectedDataPoints[r].splice(e,1)}else{if(!a.config.states.active.allowMultipleDataPointsSelection&&a.interact.selectedDataPoints.length>0){a.interact.selectedDataPoints=[];const t=a.dom.Paper.find(".apexcharts-series path:not(.apexcharts-decoration-element)"),e=a.dom.Paper.find(".apexcharts-series circle:not(.apexcharts-decoration-element), .apexcharts-series rect:not(.apexcharts-decoration-element)"),s=t=>{Array.prototype.forEach.call(t,t=>{t.node.setAttribute("selected","false"),o.getDefaultFilter(t,r)})};s(t),s(e)}t.node.setAttribute("selected","true"),l="true",void 0===a.interact.selectedDataPoints[r]&&(a.interact.selectedDataPoints[r]=[]),a.interact.selectedDataPoints[r].push(n)}if("true"===l){const e=a.config.states.active.filter;if("none"!==e)o.applyFilter(t,r,e.type);else if("none"!==a.config.states.hover.filter&&!a.interact.isTouchDevice){const e=a.config.states.hover.filter;o.applyFilter(t,r,e.type)}}else if("none"!==a.config.states.active.filter.type)if("none"===a.config.states.hover.filter.type||a.interact.isTouchDevice)o.getDefaultFilter(t,r);else{const e=a.config.states.hover.filter;o.applyFilter(t,r,e.type)}"function"==typeof a.config.chart.events.dataPointSelection&&a.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:a.interact.selectedDataPoints,seriesIndex:r,dataPointIndex:n,w:a}),e&&N._fireEvent(a,"dataPointSelection",[e,this.ctx,{selectedDataPoints:a.interact.selectedDataPoints,seriesIndex:r,dataPointIndex:n,w:a}])}rotateAroundCenter(t){let e={};t&&"function"==typeof t.getBBox&&(e=t.getBBox());return{x:e.x+e.width/2,y:e.y+e.height/2}}setupEventDelegation(t,e){let s=null;t.node.addEventListener("mouseover",i=>{const a=N._findDelegateTarget(i.target,t.node,e);a&&a!==s&&(s&&s.instance&&this.pathMouseLeave(s.instance,i),s=a,a.instance&&this.pathMouseEnter(a.instance,i))}),t.node.addEventListener("mouseout",i=>{if(!s)return;(i.relatedTarget?N._findDelegateTarget(i.relatedTarget,t.node,e):null)!==s&&(s&&s.instance&&this.pathMouseLeave(s.instance,i),s=null)}),t.node.addEventListener("mousedown",s=>{const i=N._findDelegateTarget(s.target,t.node,e);i&&i.instance&&this.pathMouseDown(i.instance,s)})}static _fireEvent(t,e,s){const i=t.globals.events;if(!i||!Object.prototype.hasOwnProperty.call(i,e))return;const a=i[e];for(let t=0;t<a.length;t++)a[t].apply(null,s)}static _findDelegateTarget(t,e,s){for(;t&&t!==e&&t!==document;){if(t.matches&&t.matches(s))return t;t=t.parentNode}return null}static setAttrs(t,e){for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.setAttribute(s,e[s])}getTextRects(t,e,s,i,a=!0){const o=this.w,r=[t,e,s,i,a].join("\0"),n=o.globals.textRectsCache;if(n&&n.has(r))return n.get(r);const l=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:s,foreColor:"#fff",opacity:0});i&&l.attr("transform",i),o.dom.Paper.add(l);let h=l.bbox();const c=h.y;a||(h=l.node.getBoundingClientRect()),l.remove();const d={width:h.width,height:h.height,centerOffset:a?c+h.height/2- -200:0};return n&&n.set(r,d),d}placeTextWithEllipsis(t,e,s){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=s/1.1)){for(let i=e.length-3;i>0;i-=3)if(t.getSubStringLength(0,i)<=s/1.1)return void(t.textContent=e.substring(0,i)+"...");t.textContent="."}}}const W="http://www.w3.org/2000/svg";class O{constructor(t,e){"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0)}transform(t){return t.apply(this)}clone(){return new O(this.x,this.y)}}class _{constructor(t,e,s,i,a,o){this.a=null!=t?t:1,this.b=null!=e?e:0,this.c=null!=s?s:0,this.d=null!=i?i:1,this.e=null!=a?a:0,this.f=null!=o?o:0}rotate(t){const e=t*Math.PI/180,s=Math.cos(e),i=Math.sin(e);return this.multiply(new _(s,i,-i,s,0,0))}scale(t,e){return this.multiply(new _(t,0,0,null!=e?e:t,0,0))}multiply(t){return new _(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.e+this.c*t.f+this.e,this.b*t.e+this.d*t.f+this.f)}apply(t){return new O(this.a*t.x+this.c*t.y+this.e,this.b*t.x+this.d*t.y+this.f)}}class ${constructor(t,e,s,i){this.x=t,this.y=e,this.w=s,this.h=i,this.width=s,this.height=i,this.x2=t+s,this.y2=e+i}}class G{constructor(t){this.w=t,this.opts=null,this.seriesIndex=0,this.patternIDs=[]}clippedImgArea(t){const e=this.w,s=e.config,i=parseInt(String(e.layout.gridWidth),10),a=parseInt(String(e.layout.gridHeight),10),o=i>a?i:a,r=t.image;let n=0,l=0;void 0===t.width&&void 0===t.height?void 0!==s.fill.image.width&&void 0!==s.fill.image.height?(n=s.fill.image.width+1,l=s.fill.image.height):(n=o+1,l=o):(n=t.width,l=t.height);const h=b.createElementNS(W,"pattern");N.setAttrs(h,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:n+"px",height:l+"px"});const d=b.createElementNS(W,"image");h.appendChild(d);const g=c.isBrowser()?window.SVG:global.SVG;d.setAttributeNS(g.xlink,"href",r),N.setAttrs(d,{x:0,y:0,preserveAspectRatio:"none",width:n+"px",height:l+"px"}),d.style.opacity=t.opacity,e.dom.elDefs.node.appendChild(h)}getSeriesIndex(t){const e=this.w,s=e.config.chart.type;return("bar"===s||"rangeBar"===s)&&e.config.plotOptions.bar.distributed||"heatmap"===s||"treemap"===s?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.seriesData.series.length,this.seriesIndex}computeColorStops(t,e){const s=this.w;let i=null,a=null;for(const s of t)s>=e.threshold?(null===i||s>i)&&(i=s):(null===a||s<a)&&(a=s);null===i&&(i=e.threshold),null===a&&(a=e.threshold);let o=i-e.threshold+(e.threshold-a);0===o&&(o=1);let r=100-(e.threshold-a)/o*100;return r=Math.max(0,Math.min(r,100)),[{offset:r,color:e.colorAboveThreshold,opacity:s.config.fill.opacity},{offset:0,color:e.colorBelowThreshold,opacity:s.config.fill.opacity}]}fillPath(t){var e,s,i,a;const o=this.w;this.opts=t;const r=this.w.config;let n,l,h;this.seriesIndex=this.getSeriesIndex(t);const c=r.plotOptions.line.colors.colorAboveThreshold&&r.plotOptions.line.colors.colorBelowThreshold;let d=this.getFillColors()[this.seriesIndex];void 0!==o.seriesData.seriesColors[this.seriesIndex]&&(d=o.seriesData.seriesColors[this.seriesIndex]),"function"==typeof d&&(d=d({seriesIndex:this.seriesIndex,dataPointIndex:t.dataPointIndex,value:t.value,w:o}));const g=t.fillType?t.fillType:this.getFillType(this.seriesIndex);let p=Array.isArray(r.fill.opacity)?r.fill.opacity[this.seriesIndex]:r.fill.opacity;const u="gradient"===g||c;t.color&&(d=t.color);const x=o.config.series[this.seriesIndex];(null==(s=null==(e=null==x?void 0:x.data)?void 0:e[t.dataPointIndex])?void 0:s.fillColor)&&(d=null==(a=null==(i=null==x?void 0:x.data)?void 0:i[t.dataPointIndex])?void 0:a.fillColor),d||(d="#fff"),void 0!==t.opacity&&null!==t.opacity&&(p=t.opacity);let f=d;m.isCSSVariable(d)?f=m.applyOpacityToColor(d,p):-1===d.indexOf("rgb")?-1===d.indexOf("#")?f=d:d.length<9&&(f=m.hexToRgba(d,p)):d.indexOf("rgba")>-1?p=m.getOpacityFromRGBA(d):f=m.hexToRgba(m.rgb2hex(d),p);const b=m.isCSSVariable(d)?m.getThemeColor(d):d;if("pattern"===g&&(l=this.handlePatternFill({fillConfig:t.fillConfig,patternFill:l,fillColor:b,defaultColor:f})),u){const e=r.fill.gradient.colorStops?[...r.fill.gradient.colorStops]:[];let s=r.fill.gradient.type;c&&(e[this.seriesIndex]=this.computeColorStops(o.seriesData.series[this.seriesIndex],r.plotOptions.line.colors),s="vertical"),h=this.handleGradientFill({type:s,fillConfig:t.fillConfig,fillColor:b,fillOpacity:p,colorStops:e,i:this.seriesIndex})}if("image"===g){const e=r.fill.image.src,s=t.patternID?t.patternID:"",i=`pattern${o.globals.cuid}${t.seriesNumber+1}${s}`;-1===this.patternIDs.indexOf(i)&&(this.clippedImgArea({opacity:p,image:Array.isArray(e)?t.seriesNumber<e.length?e[t.seriesNumber]:e[0]:e,width:t.width?t.width:void 0,height:t.height?t.height:void 0,patternUnits:t.patternUnits,patternID:i}),this.patternIDs.push(i)),n=`url(#${i})`}else n=u?h:"pattern"===g?l:f;return t.solid&&(n=f),n}getFillType(t){const e=this.w;return Array.isArray(e.config.fill.type)?e.config.fill.type[t]:e.config.fill.type}getFillColors(){const t=this.w,e=t.config,s=this.opts;let i=[];return t.globals.comboCharts?"line"===t.config.series[this.seriesIndex].type?Array.isArray(t.globals.stroke.colors)?i=t.globals.stroke.colors:i.push(t.globals.stroke.colors):Array.isArray(t.globals.fill.colors)?i=t.globals.fill.colors:i.push(t.globals.fill.colors):"line"===e.chart.type?Array.isArray(t.globals.stroke.colors)?i=t.globals.stroke.colors:i.push(t.globals.stroke.colors):Array.isArray(t.globals.fill.colors)?i=t.globals.fill.colors:i.push(t.globals.fill.colors),void 0!==s.fillColors&&(i=[],Array.isArray(s.fillColors)?i=s.fillColors.slice():i.push(s.fillColors)),i}handlePatternFill({fillConfig:t,patternFill:e,fillColor:s,defaultColor:i}){let a=this.w.config.fill;t&&(a=t);const o=this.opts,r=new N(this.w),n=Array.isArray(a.pattern.strokeWidth)?a.pattern.strokeWidth[this.seriesIndex]:a.pattern.strokeWidth,l=s;if(Array.isArray(a.pattern.style))if(void 0!==a.pattern.style[o.seriesNumber]){e=r.drawPattern(a.pattern.style[o.seriesNumber],a.pattern.width,a.pattern.height,l,n)}else e=i;else e=r.drawPattern(a.pattern.style,a.pattern.width,a.pattern.height,l,n);return e}handleGradientFill({type:t,fillColor:e,fillOpacity:s,fillConfig:i,colorStops:a,i:o}){let r=this.w.config.fill;i&&(r=n(n({},r),i));const l=this.opts,h=new N(this.w),c=new m;t=t||r.gradient.type;let d,g=e,p=void 0===r.gradient.opacityFrom?s:Array.isArray(r.gradient.opacityFrom)?r.gradient.opacityFrom[o]:r.gradient.opacityFrom;g.indexOf("rgba")>-1&&(p=m.getOpacityFromRGBA(g));let u=void 0===r.gradient.opacityTo?s:Array.isArray(r.gradient.opacityTo)?r.gradient.opacityTo[o]:r.gradient.opacityTo;if(void 0===r.gradient.gradientToColors||0===r.gradient.gradientToColors.length)d="dark"===r.gradient.shade?c.shadeColor(-1*parseFloat(r.gradient.shadeIntensity),e.indexOf("rgb")>-1?m.rgb2hex(e):e):c.shadeColor(parseFloat(r.gradient.shadeIntensity),e.indexOf("rgb")>-1?m.rgb2hex(e):e);else if(r.gradient.gradientToColors[l.seriesNumber]){const t=r.gradient.gradientToColors[l.seriesNumber];d=t,t.indexOf("rgba")>-1&&(u=m.getOpacityFromRGBA(t))}else d=e;if(r.gradient.gradientFrom&&(g=r.gradient.gradientFrom),r.gradient.gradientTo&&(d=r.gradient.gradientTo),r.gradient.inverseColors){const t=g;g=d,d=t}return g.indexOf("rgb")>-1&&(g=m.rgb2hex(g)),d.indexOf("rgb")>-1&&(d=m.rgb2hex(d)),h.drawGradient(t,g,d,p,u,l.size,r.gradient.stops,a,o)}}class j{constructor(t,e){this.w=t,this.ctx=e,this._filters=new H(this.w),this._graphics=new N(this.w,this.ctx)}setGlobalMarkerSize(){const t=this.w;if(t.globals.markers.size=Array.isArray(t.config.markers.size)?t.config.markers.size:[t.config.markers.size],t.globals.markers.size.length>0){if(t.globals.markers.size.length<t.seriesData.series.length+1)for(let e=0;e<=t.seriesData.series.length;e++)void 0===t.globals.markers.size[e]&&t.globals.markers.size.push(t.globals.markers.size[0])}else t.globals.markers.size=t.config.series.map(()=>t.config.markers.size)}plotChartMarkers({pointsPos:t,seriesIndex:e,j:s,pSize:i,alwaysDrawMarker:a=!1,isVirtualPoint:o=!1}){const r=this.w,n=e,l=t;let h=null;const c=new N(this.w),d=r.config.markers.discrete&&r.config.markers.discrete.length;if(Array.isArray(l.x))for(let t=0;t<l.x.length;t++){let g,p=s,u=!m.isNumber(l.y[t]);0===r.globals.markers.largestSize&&r.globals.hasNullValues&&null!==r.seriesData.series[n][s+1]&&!o&&(u=!0),1===s&&0===t&&(p=0),1===s&&1===t&&(p=1);let x="apexcharts-marker";"line"!==r.config.chart.type&&"area"!==r.config.chart.type||r.globals.comboCharts||r.config.tooltip.intersect||(x+=" no-pointer-events");if((Array.isArray(r.config.markers.size)?r.globals.markers.size[e]>0:r.config.markers.size>0)||a||d){u||(x+=` w${m.randomId()}`);const s=this.getMarkerConfig({cssClass:x,seriesIndex:e,dataPointIndex:p}),o=r.config.series[n];if(o.data[p]&&(o.data[p].fillColor&&(s.pointFillColor=o.data[p].fillColor),o.data[p].strokeColor&&(s.pointStrokeColor=o.data[p].strokeColor)),void 0!==i&&(s.pSize=i),(l.x[t]<-r.globals.markers.largestSize||l.x[t]>r.layout.gridWidth+r.globals.markers.largestSize||l.y[t]<-r.globals.markers.largestSize||l.y[t]>r.layout.gridHeight+r.globals.markers.largestSize)&&(s.pSize=0),!u){(r.globals.markers.size[e]>0||a||d)&&!h&&(h=c.group({class:a||d?"":"apexcharts-series-markers"}),h.attr("clip-path",`url(#gridRectMarkerMask${r.globals.cuid})`),this.setupMarkerDelegation(h)),g=c.drawMarker(l.x[t],l.y[t],s),g.attr("rel",p),g.attr("j",p),g.attr("index",e),g.node.setAttribute("default-marker-size",s.pSize),z(g,l.x[t],r),this._filters.setSelectionFilter(g,e,p),h&&h.add(g)}}else void 0===r.globals.pointsArray[e]&&(r.globals.pointsArray[e]=[]),r.globals.pointsArray[e].push([l.x[t],l.y[t]])}return h}getMarkerConfig({cssClass:t,seriesIndex:e,dataPointIndex:s=null,radius:i=null,size:a=null,strokeWidth:o=null}){const r=this.w,n=this.getMarkerStyle(e);let l=null===a?r.globals.markers.size[e]:a;const h=r.config.markers;return null!==s&&h.discrete.length&&h.discrete.map(t=>{t.seriesIndex===e&&t.dataPointIndex===s&&(n.pointStrokeColor=t.strokeColor,n.pointFillColor=t.fillColor,l=t.size,n.pointShape=t.shape)}),{pSize:null===i?l:i,pRadius:null!==i?i:h.radius,pointStrokeWidth:null!==o?o:Array.isArray(h.strokeWidth)?h.strokeWidth[e]:h.strokeWidth,pointStrokeColor:n.pointStrokeColor,pointFillColor:n.pointFillColor,shape:n.pointShape||(Array.isArray(h.shape)?h.shape[e]:h.shape),class:t,pointStrokeOpacity:Array.isArray(h.strokeOpacity)?h.strokeOpacity[e]:h.strokeOpacity,pointStrokeDashArray:Array.isArray(h.strokeDashArray)?h.strokeDashArray[e]:h.strokeDashArray,pointFillOpacity:Array.isArray(h.fillOpacity)?h.fillOpacity[e]:h.fillOpacity,seriesIndex:e}}setupMarkerDelegation(t){const e=this.w,s=".apexcharts-marker";this._graphics.setupEventDelegation(t,s),t.node.addEventListener("click",i=>{if(e.config.markers.onClick){N._findDelegateTarget(i.target,t.node,s)&&e.config.markers.onClick(i)}}),t.node.addEventListener("dblclick",i=>{if(e.config.markers.onDblClick){N._findDelegateTarget(i.target,t.node,s)&&e.config.markers.onDblClick(i)}}),t.node.addEventListener("touchstart",e=>{const i=N._findDelegateTarget(e.target,t.node,s);i&&i.instance&&this._graphics.pathMouseDown(i.instance,e)},{passive:!0})}addEvents(t){const e=this.w;t.node.addEventListener("mouseenter",this._graphics.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",this._graphics.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",this._graphics.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",this._graphics.pathMouseDown.bind(this.ctx,t),{passive:!0})}getMarkerStyle(t){const e=this.w,s=e.globals.markers.colors,i=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(i)?i[t]:i,pointFillColor:Array.isArray(s)?s[t]:s}}}class V{constructor(t,e){this.ctx=e,this.w=t,this.initialAnim=this.w.config.chart.animations.enabled,this.anim=new B(this.w),this.filters=new H(this.w),this.fill=new G(this.w),this.markers=new j(this.w,this.ctx),this.graphics=new N(this.w)}draw(t,e,s){const i=this.w,a=this.graphics,o=s.realIndex,r=s.pointsPos,n=s.zRatio,l=s.elParent,h=a.group({class:`apexcharts-series-markers apexcharts-series-${i.config.chart.type}`});if(h.attr("clip-path",`url(#gridRectMarkerMask${i.globals.cuid})`),this.markers.setupMarkerDelegation(h),Array.isArray(r.x))for(let t=0;t<r.x.length;t++){let s=e+1,a=!0;0===e&&0===t&&(s=0),0===e&&1===t&&(s=1);let c=i.globals.markers.size[o];if(n!==1/0){const t=i.config.plotOptions.bubble;c=i.seriesData.seriesZ[o][s],t.zScaling&&(c/=n),t.minBubbleRadius&&c<t.minBubbleRadius&&(c=t.minBubbleRadius),t.maxBubbleRadius&&c>t.maxBubbleRadius&&(c=t.maxBubbleRadius)}const d=r.x[t],g=r.y[t];if(c=c||0,null!==g&&void 0!==i.seriesData.series[o][s]||(a=!1),a){const t=this.drawPoint(d,g,c,o,s,e);h.add(t)}l.add(h)}}drawPoint(t,e,s,i,a,o){const r=this.w,n=i,l=this.anim,h=this.filters,c=this.fill,d=this.markers,g=this.graphics,p=d.getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:n,dataPointIndex:a,radius:"bubble"===r.config.chart.type||r.globals.comboCharts&&r.config.series[i]&&"bubble"===r.config.series[i].type?s:null});let u=c.fillPath({seriesNumber:i,dataPointIndex:a,color:p.pointFillColor,patternUnits:"objectBoundingBox",value:r.seriesData.series[i][o]});const x=g.drawMarker(t,e,p),f=r.config.series[n];if(f.data[a]&&f.data[a].fillColor&&(u=f.data[a].fillColor),x.attr({fill:u}),r.config.chart.dropShadow.enabled){const t=r.config.chart.dropShadow;h.dropShadow(x,t,i)}if(!this.initialAnim||r.globals.dataChanged||r.globals.resized)r.globals.animationEnded=!0;else{const t=r.config.chart.animations,e=t.speed,s=r.globals.dataPoints||1,i=t.animateGradually,o=i&&!1!==i.enabled?Math.min(20,.5*e/Math.max(1,s)):0,n=Y({style:o>0?"sequential":"none",index:a,baseDelay:o});l.animatePop(x,{speed:e,delay:n,onComplete:()=>l.animationCompleted(x)})}return x.attr({rel:a,j:a,index:i,"default-marker-size":p.pSize}),h.setSelectionFilter(x,i,a),x.node.classList.add("apexcharts-marker"),x}centerTextInBubble(t){const e=this.w;return{y:t+=parseInt(e.config.dataLabels.style.fontSize,10)/4}}}class U{constructor(t,e=null){this.w=t,this.ctx=e}dataLabelsCorrection(t,e,s,i,a,o,r){const n=this.w;let l=!1;const h=new N(this.w).getTextRects(s,r),c=h.width,d=h.height;e<0&&(e=0),e>n.layout.gridHeight+d&&(e=n.layout.gridHeight+d/2),void 0===n.globals.dataLabelsRects[i]&&(n.globals.dataLabelsRects[i]=[]),n.globals.dataLabelsRects[i].push({x:t,y:e,width:c,height:d});const g=n.globals.dataLabelsRects[i].length-2,p=void 0!==n.globals.lastDrawnDataLabelsIndexes[i]?n.globals.lastDrawnDataLabelsIndexes[i][n.globals.lastDrawnDataLabelsIndexes[i].length-1]:0;if(void 0!==n.globals.dataLabelsRects[i][g]){const s=n.globals.dataLabelsRects[i][p];(t>s.x+s.width||e>s.y+s.height||e+d<s.y||t+c<s.x)&&(l=!0)}return(0===a||o)&&(l=!0),{x:t,y:e,textRects:h,drawnextLabel:l}}drawDataLabel({type:t,pos:e,i:s,j:i,isRangeStart:a,strokeWidth:o=2}){const r=this.w,n=new N(this.w),l=r.config.dataLabels;let h=0,c=0,d=i,g=null;if(-1!==r.globals.collapsedSeriesIndices.indexOf(s)||!l.enabled||!Array.isArray(e.x))return g;g=n.group({class:"apexcharts-data-labels"});for(let n=0;n<e.x.length;n++)if(h=e.x[n]+l.offsetX,c=e.y[n]+l.offsetY+o,!isNaN(h)){1===i&&0===n&&(d=0),1===i&&1===n&&(d=1);let o=r.seriesData.series[s][d];"rangeArea"===t&&(o=a?r.rangeData.seriesRangeStart[s][d]:r.rangeData.seriesRangeEnd[s][d]);let l="";const p=t=>r.config.dataLabels.formatter(t,{seriesIndex:s,dataPointIndex:d,w:r});if("bubble"===r.config.chart.type){o=r.seriesData.seriesZ[s][d],l=p(o),c=e.y[n];c=new V(this.w,this.ctx).centerTextInBubble(c).y}else void 0!==o&&(l=p(o));let u=r.config.dataLabels.textAnchor;r.globals.isSlopeChart&&(u=0===d?"end":d===r.config.series[s].data.length-1?"start":"middle"),this.plotDataLabelsText({x:h,y:c,text:l,i:s,j:d,parent:g,offsetCorrection:!0,dataLabelsConfig:r.config.dataLabels,textAnchor:u})}return g}plotDataLabelsText(t){const e=this.w,s=new N(this.w);let{x:i,y:a,i:o,j:r,text:n,textAnchor:l,fontSize:h,parent:c,dataLabelsConfig:d,color:g,alwaysDrawDataLabel:p,offsetCorrection:u,className:x}=t,f=null;if(Array.isArray(e.config.dataLabels.enabledOnSeries)&&e.config.dataLabels.enabledOnSeries.indexOf(o)<0)return f;let b={x:i,y:a,drawnextLabel:!0,textRects:null};if(u&&(b=this.dataLabelsCorrection(i,a,n,o,r,p,parseInt(d.style.fontSize,10).toString())),e.interact.zoomed||(i=b.x,a=b.y),b.textRects){const t=e.globals.barPadForNumericAxis||0;(i<-(t+20)-b.textRects.width||i>e.layout.gridWidth+b.textRects.width+t+30)&&(n="")}let m=e.globals.dataLabels.style.colors[o];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(m=e.globals.dataLabels.style.colors[r]),"function"==typeof m&&(m=m({series:e.seriesData.series,seriesIndex:o,dataPointIndex:r,w:e})),g&&(m=g);let y=d.offsetX,w=d.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(y=0,w=0),e.globals.isSlopeChart&&(0!==r&&(y=-2*d.offsetX+5),0!==r&&r!==e.config.series[o].data.length-1&&(y=0)),b.drawnextLabel){if("middle"===l&&i===e.layout.gridWidth&&(l="end"),f=s.drawText({x:i+y,y:a+w,foreColor:m,textAnchor:l||d.textAnchor,text:n,fontSize:h||d.style.fontSize,fontFamily:d.style.fontFamily,fontWeight:d.style.fontWeight||"normal"}),f.attr({class:x||"apexcharts-datalabel",cx:i,cy:a}),d.dropShadow.enabled){const t=d.dropShadow;new H(this.w).dropShadow(f,t)}c.add(f),z(f,i,e),void 0===e.globals.lastDrawnDataLabelsIndexes[o]&&(e.globals.lastDrawnDataLabelsIndexes[o]=[]),e.globals.lastDrawnDataLabelsIndexes[o].push(r)}return f}addBackgroundToDataLabel(t,e){const s=this.w,i=s.config.dataLabels.background,a=i.padding,o=i.padding/2,r=e.width,n=e.height,l=new N(this.w).drawRect(e.x-a,e.y-o/2,r+2*a,n+o,i.borderRadius,"transparent"!==s.config.chart.background&&s.config.chart.background?s.config.chart.background:"#fff",i.opacity,i.borderWidth,i.borderColor);if(i.dropShadow.enabled){new H(this.w).dropShadow(l,i.dropShadow)}return l}dataLabelsBackground(){var t;const e=this.w;if("bubble"===e.config.chart.type)return;const s=e.dom.baseEl.querySelectorAll(".apexcharts-datalabels text");for(let i=0;i<s.length;i++){const a=s[i],o=a.getBBox();let r=null;if(o.width&&o.height&&(r=this.addBackgroundToDataLabel(a,o)),r){null==(t=a.parentNode)||t.insertBefore(r.node,a);const s=e.config.dataLabels.background.backgroundColor||a.getAttribute("fill");e.config.chart.animations.enabled&&!e.globals.resized&&!e.globals.dataChanged?r.animate().attr({fill:s}):r.attr({fill:s}),a.setAttribute("fill",e.config.dataLabels.background.foreColor);const i=a.getAttribute("cx");null!==i&&z(r,parseFloat(i),e)}}}bringForward(){const t=this.w,e=t.dom.baseEl.querySelectorAll(".apexcharts-datalabels"),s=t.dom.baseEl.querySelector(".apexcharts-plot-series:last-child");for(let t=0;t<e.length;t++)s&&s.insertBefore(e[t],s.nextSibling)}}class q{static invalidateAll(t){t&&t.globals&&(t.globals.cachedSelectors&&(t.globals.cachedSelectors={}),t.globals.domCache&&t.globals.domCache.clear(),t.globals.dimensionCache={})}static invalidateDimensions(t){t&&t.globals&&(t.globals.dimensionCache={})}static invalidateSelectors(t){t&&t.globals&&t.globals.cachedSelectors&&(t.globals.cachedSelectors={})}static getCachedSelector(t,e,s){return t&&t.globals?(t.globals.cachedSelectors||(t.globals.cachedSelectors={}),t.globals.cachedSelectors[e]||(t.globals.cachedSelectors[e]=s()),t.globals.cachedSelectors[e]):s()}static getCachedDimension(t,e,s,i=1e3){if(!t||!t.globals)return s();t.globals.dimensionCache||(t.globals.dimensionCache={});const a=t.globals.dimensionCache[e],o=Date.now();if(a&&a.lastUpdate&&o-a.lastUpdate<i)return a.value;const r=s();return t.globals.dimensionCache[e]={value:r,lastUpdate:o},r}static cacheDOMElement(t,e,s){t&&t.globals&&(t.globals.domCache||(t.globals.domCache=new Map),t.globals.domCache.set(e,s))}static getCachedDOMElement(t,e){return t&&t.globals&&t.globals.domCache&&t.globals.domCache.get(e)||null}}class Z{constructor(t,{theme:e=null,timeScale:s=null}={}){this.w=t,this.theme=e,this.timeScale=s}getLabel(t,e,s,i,a=[],o="12px",r=!0){const n=this.w,l=void 0===t[i]?"":t[i];let h=l;const c=n.formatters.xLabelFormatter,d=n.config.xaxis.labels.formatter,g=new w(this.w),p=l;r&&(h=g.xLabelFormat(c,l,p,{i:i,dateFormatter:new y(this.w).formatDate,w:n}),void 0!==d&&(h=d(l,t[i],{i:i,dateFormatter:new y(this.w).formatDate,w:n}))),e.length>0?(s=e[i].position,h=e[i].value):"datetime"===n.config.xaxis.type&&void 0===d&&(h=""),void 0===h&&(h=""),h=Array.isArray(h)?h:h.toString();const u=new N(this.w);let x={};x=n.layout.rotateXLabels&&r?u.getTextRects(h,parseInt(o,10).toString(),null,`rotate(${n.config.xaxis.labels.rotate} 0 0)`,!1):u.getTextRects(h,parseInt(o,10).toString());const f=!n.config.xaxis.labels.showDuplicates&&this.timeScale;return!Array.isArray(h)&&("NaN"===String(h)||a.indexOf(h)>=0&&f)&&(h=""),{x:s,text:h,textRect:x}}checkLabelBasedOnTickamount(t,e,s){const i=this.w;let a=i.config.xaxis.tickAmount;if("dataPoints"===a&&(a=Math.round(i.layout.gridWidth/120)),a>s)return e;return t%Math.round(s/(a+1))===0||(e.text=""),e}checkForOverflowingLabels(t,e,s,i,a){const o=this.w;if(0===t&&o.globals.skipFirstTimelinelabel&&(e.text=""),t===s-1&&o.globals.skipLastTimelinelabel&&(e.text=""),o.config.xaxis.labels.hideOverlappingLabels&&i.length>0){const t=a[a.length-1];if(o.config.xaxis.labels.trim&&"datetime"!==o.config.xaxis.type)return e;e.x<t.textRect.width/(o.layout.rotateXLabels?Math.abs(o.config.xaxis.labels.rotate)/12:1.01)+t.x&&(e.text="")}return e}checkForReversedLabels(t,e){const s=this.w;return s.config.yaxis[t]&&s.config.yaxis[t].reversed&&e.reverse(),e}yAxisAllSeriesCollapsed(t){const e=this.w.globals;return!e.seriesYAxisMap[t].some(t=>-1===e.collapsedSeriesIndices.indexOf(t))}translateYAxisIndex(t){const e=this.w,s=e.globals,i=e.config.yaxis;return e.seriesData.series.length>i.length||i.some(t=>Array.isArray(t.seriesName))?t:s.seriesYAxisReverseMap[t]}isYAxisHidden(t){const e=this.w,s=e.config.yaxis[t];if(!s.show||this.yAxisAllSeriesCollapsed(t))return!0;if(!s.showForNullSeries){const s=e.globals.seriesYAxisMap[t],i=new F(this.w);return s.every(t=>i.isSeriesNull(t))}return!1}getYAxisForeColor(t,e){var s;const i=this.w;return Array.isArray(t)&&i.globals.yAxisScale[e]&&(null==(s=this.theme)||s.pushExtraColors(t,i.globals.yAxisScale[e].result.length,!1)),t}drawYAxisTicks(t,e,s,i,a,o,r){const n=this.w,l=new N(this.w);let h=n.layout.translateY+n.config.yaxis[a].labels.offsetY;if(n.globals.isBarHorizontal?h=0:"heatmap"===n.config.chart.type&&(h+=o/2),i.show&&e>0){!0===n.config.yaxis[a].opposite&&(t+=i.width);for(let a=e;a>=0;a--){const e=l.drawLine(t+s.offsetX-i.width+i.offsetX,h+i.offsetY,t+s.offsetX+i.offsetX,h+i.offsetY,i.color);r.add(e),h+=o}}}}class K{constructor(t,e,s){this.w=t,this.ctx=e,this.elgrid=s,this.axesUtils=new Z(t,{theme:e.theme,timeScale:e.timeScale}),this.xaxisLabels=t.labelData.labels.slice(),t.labelData.timescaleLabels.length>0&&!t.globals.isBarHorizontal&&(this.xaxisLabels=t.labelData.timescaleLabels.slice()),t.config.xaxis.overwriteCategories&&(this.xaxisLabels=t.config.xaxis.overwriteCategories),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===t.config.xaxis.position?this.offY=0:this.offY=t.layout.gridHeight,this.offY=this.offY+t.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===t.config.chart.type&&t.config.plotOptions.bar.horizontal,this.xaxisFontSize=t.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=t.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=t.config.xaxis.labels.style.colors,this.xaxisBorderWidth=t.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=t.config.yaxis[0].axisBorder.width.toString()),String(this.xaxisBorderWidth).indexOf("%")>-1?this.xaxisBorderWidth=t.layout.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=t.config.xaxis.axisBorder.height,this.yaxis=t.config.yaxis[0]}drawXaxis(){const t=this.w,e=new N(this.w),s=e.group({class:"apexcharts-xaxis",transform:`translate(${t.config.xaxis.offsetX}, ${t.config.xaxis.offsetY})`}),i=e.group({class:"apexcharts-xaxis-texts-g",transform:`translate(${t.layout.translateXAxisX}, ${t.layout.translateXAxisY})`});s.add(i);let a=[];for(let t=0;t<this.xaxisLabels.length;t++)a.push(this.xaxisLabels[t]);if(this.drawXAxisLabelAndGroup(!0,e,i,a,t.axisFlags.isXNumeric,(t,e)=>e),t.labelData.hasXaxisGroups){const s=t.labelData.groups;a=[];for(let t=0;t<s.length;t++)a.push(s[t].title);const o={};t.config.xaxis.group.style&&(o.xaxisFontSize=t.config.xaxis.group.style.fontSize,o.xaxisFontFamily=t.config.xaxis.group.style.fontFamily,o.xaxisForeColors=t.config.xaxis.group.style.colors,o.fontWeight=t.config.xaxis.group.style.fontWeight,o.cssClass=t.config.xaxis.group.style.cssClass),this.drawXAxisLabelAndGroup(!1,e,i,a,!1,(t,e)=>s[t].cols*e,o)}if(void 0!==t.config.xaxis.title.text){const i=e.group({class:"apexcharts-xaxis-title"}),a=e.drawText({x:t.layout.gridWidth/2+t.config.xaxis.title.offsetX,y:this.offY+parseFloat(this.xaxisFontSize)+("bottom"===t.config.xaxis.position?t.layout.xAxisLabelsHeight:-t.layout.xAxisLabelsHeight-10)+t.config.xaxis.title.offsetY,text:t.config.xaxis.title.text,textAnchor:"middle",fontSize:t.config.xaxis.title.style.fontSize,fontFamily:t.config.xaxis.title.style.fontFamily,fontWeight:t.config.xaxis.title.style.fontWeight,foreColor:t.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text "+t.config.xaxis.title.style.cssClass});i.add(a),s.add(i)}if(t.config.xaxis.axisBorder.show){const i=t.globals.barPadForNumericAxis,a=e.drawLine(t.globals.padHorizontal+t.config.xaxis.axisBorder.offsetX-i,this.offY,this.xaxisBorderWidth+i,this.offY,t.config.xaxis.axisBorder.color,0,this.xaxisBorderHeight);this.elgrid&&this.elgrid.elGridBorders&&t.config.grid.show?this.elgrid.elGridBorders.add(a):s.add(a)}return s}drawXAxisLabelAndGroup(t,e,s,i,a,o,r={}){var n,l;const h=[],c=[],d=this.w,g=r.xaxisFontSize||this.xaxisFontSize,p=r.xaxisFontFamily||this.xaxisFontFamily,u=r.xaxisForeColors||this.xaxisForeColors,x=r.fontWeight||d.config.xaxis.labels.style.fontWeight,f=r.cssClass||d.config.xaxis.labels.style.cssClass;let m,y=d.globals.padHorizontal;const w=i.length;let v="category"===d.config.xaxis.type?d.globals.dataPoints:w;if(0===v&&w>v&&(v=w),a){const t=Math.max(Number(d.config.xaxis.tickAmount)||1,v>1?v-1:v);m=d.layout.gridWidth/Math.min(t,w-1),y=y+o(0,m)/2+d.config.xaxis.labels.offsetX}else m=d.layout.gridWidth/v,y=y+o(0,m)+d.config.xaxis.labels.offsetX;for(let a=0;a<=w-1;a++){let r=y-o(a,m)/2+d.config.xaxis.labels.offsetX;0===a&&1===w&&m/2===y&&1===v&&(r=d.layout.gridWidth/2);let A=this.axesUtils.getLabel(i,d.labelData.timescaleLabels,r,a,h,g,t),C=28;d.layout.rotateXLabels&&t&&(C=22),d.config.xaxis.title.text&&"top"===d.config.xaxis.position&&(C+=parseFloat(d.config.xaxis.title.style.fontSize)+2),t||(C=C+parseFloat(g)+(d.layout.xAxisLabelsHeight-d.layout.xAxisGroupLabelsHeight)+(d.layout.rotateXLabels?10:0));A=void 0!==d.config.xaxis.tickAmount&&"dataPoints"!==d.config.xaxis.tickAmount&&"datetime"!==d.config.xaxis.type?this.axesUtils.checkLabelBasedOnTickamount(a,A,w):this.axesUtils.checkForOverflowingLabels(a,A,w,h,c);const S=()=>t&&d.config.xaxis.convertedCatToNumeric?u[d.globals.minX+a-1]:u[a],k=(null!=(l=null==(n=A.textRect)?void 0:n.width)?l:0)/2,D=A.x+k<0;if(d.config.xaxis.labels.show&&!D){const i=e.drawText({x:A.x,y:this.offY+d.config.xaxis.labels.offsetY+C-("top"===d.config.xaxis.position?d.layout.xAxisHeight+d.config.xaxis.axisTicks.height-2:0),text:A.text,textAnchor:"middle",fontWeight:x,fontSize:g,fontFamily:p,foreColor:Array.isArray(u)?S():u,isPlainText:!1,cssClass:(t?"apexcharts-xaxis-label ":"apexcharts-xaxis-group-label ")+f});if(s.add(i),i.on("click",t=>{if("function"==typeof d.config.chart.events.xAxisLabelClick){const e=Object.assign({},d,{labelIndex:a});d.config.chart.events.xAxisLabelClick(t,this.ctx,e)}}),t){const t=b.createElementNS(W,"title");t.textContent=Array.isArray(A.text)?A.text.join(" "):A.text,i.node.appendChild(t),""!==A.text&&(h.push(A.text),c.push(A))}}a<w-1&&(y+=o(a+1,m))}}drawXaxisInversed(t){const e=this.w,s=new N(this.w),i=e.config.yaxis[0].opposite?e.globals.translateYAxisX[t]:0,a=s.group({class:"apexcharts-yaxis apexcharts-xaxis-inversed",rel:t}),o=s.group({class:"apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g",transform:"translate("+i+", 0)"});a.add(o);const r=[];if(e.config.yaxis[t].show)for(let t=0;t<this.xaxisLabels.length;t++)r.push(this.xaxisLabels[t]);const n=e.layout.gridHeight/r.length;let l=-n/2.2;const h=e.formatters.yLabelFormatters[0],c=e.config.yaxis[0].labels;if(c.show)for(let i=0;i<=r.length-1;i++){let a=void 0===r[i]?"":r[i];a=h(a,{seriesIndex:t,dataPointIndex:i,w:e});const d=this.axesUtils.getYAxisForeColor(c.style.colors,t),g=()=>Array.isArray(d)?d[i]:d;let p=0;Array.isArray(a)&&(p=a.length/2*parseInt(c.style.fontSize,10));let u=c.offsetX-15,x="end";this.yaxis.opposite&&(x="start"),"left"===e.config.yaxis[0].labels.align?(u=c.offsetX,x="start"):"center"===e.config.yaxis[0].labels.align?(u=c.offsetX,x="middle"):"right"===e.config.yaxis[0].labels.align&&(x="end");const f=s.drawText({x:u,y:l+n+c.offsetY-p,text:a,textAnchor:x,foreColor:g(),fontSize:c.style.fontSize,fontFamily:c.style.fontFamily,fontWeight:c.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-yaxis-label "+c.style.cssClass,maxWidth:c.maxWidth});o.add(f),f.on("click",t=>{if("function"==typeof e.config.chart.events.xAxisLabelClick){const s=Object.assign({},e,{labelIndex:i});e.config.chart.events.xAxisLabelClick(t,this.ctx,s)}});const m=b.createElementNS(W,"title");if(m.textContent=Array.isArray(a)?a.join(" "):a,f.node.appendChild(m),0!==e.config.yaxis[t].labels.rotate){const i=s.rotateAroundCenter(f.node);f.node.setAttribute("transform",`rotate(${e.config.yaxis[t].labels.rotate} 0 ${i.y})`)}l+=n}if(void 0!==e.config.yaxis[0].title.text){const t=s.group({class:"apexcharts-yaxis-title apexcharts-xaxis-title-inversed",transform:"translate("+i+", 0)"}),o=s.drawText({x:e.config.yaxis[0].title.offsetX,y:e.layout.gridHeight/2+e.config.yaxis[0].title.offsetY,text:e.config.yaxis[0].title.text,textAnchor:"middle",foreColor:e.config.yaxis[0].title.style.color,fontSize:e.config.yaxis[0].title.style.fontSize,fontWeight:e.config.yaxis[0].title.style.fontWeight,fontFamily:e.config.yaxis[0].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text "+e.config.yaxis[0].title.style.cssClass});t.add(o),a.add(t)}let d=0;this.isCategoryBarHorizontal&&e.config.yaxis[0].opposite&&(d=e.layout.gridWidth);const g=e.config.xaxis.axisBorder;if(g.show){const t=s.drawLine(e.globals.padHorizontal+g.offsetX+d,1+g.offsetY,e.globals.padHorizontal+g.offsetX+d,e.layout.gridHeight+g.offsetY,g.color,0);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(t):a.add(t)}return e.config.yaxis[0].axisTicks.show&&this.axesUtils.drawYAxisTicks(d,r.length,e.config.yaxis[0].axisBorder,e.config.yaxis[0].axisTicks,0,n,a),a}drawXaxisTicks(t,e,s){const i=this.w,a=t;if(t<0||t-2>i.layout.gridWidth)return;const o=this.offY+i.config.xaxis.axisTicks.offsetY;if(e=e+o+i.config.xaxis.axisTicks.height,"top"===i.config.xaxis.position&&(e=o-i.config.xaxis.axisTicks.height),i.config.xaxis.axisTicks.show){const r=new N(this.w).drawLine(t+i.config.xaxis.axisTicks.offsetX,o+i.config.xaxis.offsetY,a+i.config.xaxis.axisTicks.offsetX,e+i.config.xaxis.offsetY,i.config.xaxis.axisTicks.color);s.add(r),r.node.classList.add("apexcharts-xaxis-tick")}}getXAxisTicksPositions(){const t=this.w,e=[],s=this.xaxisLabels.length;let i=t.globals.padHorizontal;if(t.labelData.timescaleLabels.length>0)for(let t=0;t<s;t++)i=this.xaxisLabels[t].position,e.push(i);else{const a=s;for(let s=0;s<a;s++){let s=a;t.axisFlags.isXNumeric&&"bar"!==t.config.chart.type&&(s-=1),i+=t.layout.gridWidth/s,e.push(i)}}return e}xAxisLabelCorrections(){var t,e,s;const i=this.w,a=new N(this.w),o=i.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g"),r=i.dom.baseEl.querySelectorAll(".apexcharts-xaxis-texts-g text:not(.apexcharts-xaxis-group-label)"),n=i.dom.baseEl.querySelectorAll(".apexcharts-yaxis-inversed text"),l=i.dom.baseEl.querySelectorAll(".apexcharts-xaxis-inversed-texts-g text tspan");if(i.layout.rotateXLabels||i.config.xaxis.labels.rotateAlways)for(let t=0;t<r.length;t++){const e=a.rotateAroundCenter(r[t]);e.y=e.y-1,e.x=e.x+1,r[t].setAttribute("transform",`rotate(${i.config.xaxis.labels.rotate} ${e.x} ${e.y})`),r[t].setAttribute("text-anchor","end"),null==o||o.setAttribute("transform","translate(0, -10)");const s=r[t].childNodes;i.config.xaxis.labels.trim&&Array.prototype.forEach.call(s,t=>{a.placeTextWithEllipsis(t,t.textContent,i.layout.xAxisLabelsHeight-("bottom"===i.config.legend.position?20:10))})}else{const t=i.layout.gridWidth/(i.labelData.labels.length+1);for(let e=0;e<r.length;e++){const s=r[e].childNodes;i.config.xaxis.labels.trim&&"datetime"!==i.config.xaxis.type&&Array.prototype.forEach.call(s,e=>{a.placeTextWithEllipsis(e,e.textContent,t)})}}if(n.length>0){const o=n[n.length-1].getBBox(),r=n[0].getBBox();o.x<-20&&(null==(t=n[n.length-1].parentNode)||t.removeChild(n[n.length-1])),r.x+r.width>i.layout.gridWidth&&!i.globals.isBarHorizontal&&(null==(e=n[0].parentNode)||e.removeChild(n[0]));for(let t=0;t<l.length;t++)a.placeTextWithEllipsis(l[t],null!=(s=l[t].textContent)?s:"",i.config.yaxis[0].labels.maxWidth-(i.config.yaxis[0].title.text?2*parseFloat(i.config.yaxis[0].title.style.fontSize):0)-15)}}}class J{constructor(t,e){this.w=t,this.ctx=e,this.xaxisLabels=t.labelData.labels.slice(),this.axesUtils=new Z(e.w,{theme:e.theme,timeScale:e.timeScale}),this.isRangeBar=t.rangeData.seriesRange.length&&t.globals.isBarHorizontal,t.labelData.timescaleLabels.length>0&&(this.xaxisLabels=t.labelData.timescaleLabels.slice())}drawGridArea(t=null){const e=this.w,s=new N(this.w);t||(t=s.group({class:"apexcharts-grid"}));const i=s.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.layout.gridHeight,"transparent"),a=s.drawLine(e.globals.padHorizontal,e.layout.gridHeight,e.layout.gridWidth,e.layout.gridHeight,"transparent");return t.add(a),t.add(i),t}drawGrid(){if(this.w.globals.axisCharts){const t=this.renderGrid();return this.drawGridArea(t.el),t}return null}createGridMask(){const t=this.w,e=t.globals,s=new N(this.w),i=Array.isArray(t.config.stroke.width)?Math.max(...t.config.stroke.width):t.config.stroke.width,a=t=>{const e=b.createElementNS(W,"clipPath");return e.setAttribute("id",t),e};t.dom.elGridRectMask=a(`gridRectMask${e.cuid}`),t.dom.elGridRectBarMask=a(`gridRectBarMask${e.cuid}`),t.dom.elGridRectMarkerMask=a(`gridRectMarkerMask${e.cuid}`),t.dom.elForecastMask=a(`forecastMask${e.cuid}`),t.dom.elNonForecastMask=a(`nonForecastMask${e.cuid}`);let o=0,r=0;(["bar","rangeBar","candlestick","boxPlot","violin"].includes(t.config.chart.type)||t.globals.comboBarCount>0)&&t.axisFlags.isXNumeric&&!t.globals.isBarHorizontal&&(o=Math.max(t.config.grid.padding.left,e.barPadForNumericAxis),r=Math.max(t.config.grid.padding.right,e.barPadForNumericAxis)),t.dom.elGridRect=s.drawRect(-i/2-2,-i/2-2,t.layout.gridWidth+i+4,t.layout.gridHeight+i+4,0,"#fff"),t.dom.elGridRectBar=s.drawRect(-i/2-o-2,-i/2-2,t.layout.gridWidth+i+r+o+4,t.layout.gridHeight+i+4,0,"#fff");const n=t.globals.markers.largestSize;t.dom.elGridRectMarker=s.drawRect(Math.min(-i/2-o-2,-n),-n,t.layout.gridWidth+Math.max(i+r+o+4,2*n),t.layout.gridHeight+2*n,0,"#fff"),t.dom.elGridRectMask.appendChild(t.dom.elGridRect.node),t.dom.elGridRectBarMask.appendChild(t.dom.elGridRectBar.node),t.dom.elGridRectMarkerMask.appendChild(t.dom.elGridRectMarker.node);const l=t.dom.elDefs.node;l.appendChild(t.dom.elGridRectMask),l.appendChild(t.dom.elGridRectBarMask),l.appendChild(t.dom.elGridRectMarkerMask),l.appendChild(t.dom.elForecastMask),l.appendChild(t.dom.elNonForecastMask)}_drawGridLines({i:t,x1:e,y1:s,x2:i,y2:a,xCount:o,parent:r}){const n=this.w;if(!(0===t&&n.globals.skipFirstTimelinelabel||t===o-1&&n.globals.skipLastTimelinelabel&&!n.config.xaxis.labels.formatter||"radar"===n.config.chart.type)){n.config.grid.xaxis.lines.show&&this._drawGridLine({i:t,x1:e,y1:s,x2:i,y2:a,xCount:o,parent:r});let l=0;if(n.labelData.hasXaxisGroups&&"between"===n.config.xaxis.tickPlacement){const e=n.labelData.groups;if(e){let s=0;for(let i=0;s<t&&i<e.length;i++)s+=e[i].cols;s===t&&(l=.6*n.layout.xAxisLabelsHeight)}}new K(this.w,this.ctx).drawXaxisTicks(e,l,n.dom.elGraphical)}}_drawGridLine({i:t,x1:e,y1:s,x2:i,y2:a,xCount:o,parent:r}){const n=this.w,l=r.node.classList.contains("apexcharts-gridlines-horizontal"),h=n.globals.barPadForNumericAxis,c=0===s&&0===a||0===e&&0===i||s===n.layout.gridHeight&&a===n.layout.gridHeight||n.globals.isBarHorizontal&&(0===t||t===o-1),d=new N(this.w).drawLine(e-(l?h:0),s,i+(l?h:0),a,n.config.grid.borderColor,n.config.grid.strokeDashArray);d.node.classList.add("apexcharts-gridline"),c&&n.config.grid.show?this.elGridBorders.add(d):r.add(d)}_drawGridBandRect({c:t,x1:e,y1:s,x2:i,y2:a,type:o}){const r=this.w,n=new N(this.w),l=r.globals.barPadForNumericAxis,h=r.config.grid[o].colors[t],c=n.drawRect(e-("row"===o?l:0),s,i+("row"===o?2*l:0),a,0,h,r.config.grid[o].opacity);this.elg.add(c),c.attr("clip-path",`url(#gridRectMask${r.globals.cuid})`),c.node.classList.add(`apexcharts-grid-${o}`)}_drawXYLines({xCount:t,tickAmount:e}){var s;const i=this.w,a=({xC:e,x1:s,y1:i,x2:a,y2:o})=>{for(let r=0;r<e;r++)s=this.xaxisLabels[r].position,a=this.xaxisLabels[r].position,this._drawGridLines({i:r,x1:s,y1:i,x2:a,y2:o,xCount:t,parent:this.elgridLinesV})},o=({xC:e,x1:s,y1:a,x2:o,y2:r})=>{for(let n=0;n<e+(i.axisFlags.isXNumeric?0:1);n++)0===n&&1===e&&1===i.globals.dataPoints&&(o=s=i.layout.gridWidth/2),this._drawGridLines({i:n,x1:s,y1:a,x2:o,y2:r,xCount:t,parent:this.elgridLinesV}),o=s+=i.layout.gridWidth/(i.axisFlags.isXNumeric?e-1:e)};if(i.config.grid.xaxis.lines.show||i.config.xaxis.axisTicks.show){const e=i.globals.padHorizontal,r=0;let n;const l=i.layout.gridHeight;i.labelData.timescaleLabels.length?a({xC:t,x1:e,y1:r,x2:n,y2:l}):(i.axisFlags.isXNumeric&&(t=null==(s=i.globals.xAxisScale)?void 0:s.result.length),o({xC:t,x1:e,y1:r,x2:n,y2:l}))}if(i.config.grid.yaxis.lines.show){const t=0;let s=0,a=0;const o=i.layout.gridWidth;let r=e+1;this.isRangeBar&&(r=i.labelData.labels.length);for(let n=0;n<r+(this.isRangeBar?1:0);n++)this._drawGridLine({i:n,xCount:r+(this.isRangeBar?1:0),x1:t,y1:s,x2:o,y2:a,parent:this.elgridLinesH}),s+=i.layout.gridHeight/(this.isRangeBar?r:e),a=s}}_drawInvertedXYLines({xCount:t}){const e=this.w;if(e.config.grid.xaxis.lines.show||e.config.xaxis.axisTicks.show){let s=e.globals.padHorizontal;const i=0;let a;const o=e.layout.gridHeight;for(let r=0;r<t+1;r++){e.config.grid.xaxis.lines.show&&this._drawGridLine({i:r,xCount:t+1,x1:s,y1:i,x2:a,y2:o,parent:this.elgridLinesV});new K(this.w,this.ctx).drawXaxisTicks(s,0,e.dom.elGraphical),s+=e.layout.gridWidth/t,a=s}}if(e.config.grid.yaxis.lines.show){const t=0;let s=0,i=0;const a=e.layout.gridWidth;for(let o=0;o<e.globals.dataPoints+1;o++)this._drawGridLine({i:o,xCount:e.globals.dataPoints+1,x1:t,y1:s,x2:a,y2:i,parent:this.elgridLinesH}),s+=e.layout.gridHeight/e.globals.dataPoints,i=s}}renderGrid(){var t,e,s;const i=this.w,a=i.globals,o=new N(this.w);this.elg=o.group({class:"apexcharts-grid"}),this.elgridLinesH=o.group({class:"apexcharts-gridlines-horizontal"}),this.elgridLinesV=o.group({class:"apexcharts-gridlines-vertical"}),this.elGridBorders=o.group({class:"apexcharts-grid-borders"}),this.elg.add(this.elgridLinesH),this.elg.add(this.elgridLinesV),i.config.grid.show||(this.elgridLinesV.hide(),this.elgridLinesH.hide(),this.elGridBorders.hide());let r=0;for(;r<a.seriesYAxisMap.length&&a.ignoreYAxisIndexes.includes(r);)r++;r===a.seriesYAxisMap.length&&(r=0);let n,l=a.yAxisScale[r].result.length-1;return!a.isBarHorizontal||this.isRangeBar?(n=this.xaxisLabels.length,this.isRangeBar&&(l=i.labelData.labels.length,i.config.xaxis.tickAmount&&i.config.xaxis.labels.formatter&&(n=i.config.xaxis.tickAmount),(null==(s=null==(e=null==(t=a.yAxisScale)?void 0:t[r])?void 0:e.result)?void 0:s.length)>0&&"datetime"!==i.config.xaxis.type&&(n=a.yAxisScale[r].result.length-1)),this._drawXYLines({xCount:n,tickAmount:l})):(n=l,l=a.xTickAmount,this._drawInvertedXYLines({xCount:n,tickAmount:l})),this.drawGridBands(n,l),{el:this.elg,elGridBorders:this.elGridBorders,xAxisTickWidth:i.layout.gridWidth/n}}drawGridBands(t,e){var s,i,a,o,r;const n=this.w,l=(t,s,i,a,o,r)=>{for(let l=0,h=0;l<s;l++,h++)h>=n.config.grid[t].colors.length&&(h=0),this._drawGridBandRect({c:h,x1:i,y1:a,x2:o,y2:r,type:t}),a+=n.layout.gridHeight/e};if((null==(s=n.config.grid.row.colors)?void 0:s.length)>0&&l("row",e,0,0,n.layout.gridWidth,n.layout.gridHeight/e),(null==(i=n.config.grid.column.colors)?void 0:i.length)>0){let e=n.globals.isBarHorizontal||"on"!==n.config.xaxis.tickPlacement||"category"!==n.config.xaxis.type&&!n.config.xaxis.convertedCatToNumeric?t:t-1;n.axisFlags.isXNumeric&&(e=(null!=(o=null==(a=n.globals.xAxisScale)?void 0:a.result.length)?o:1)-1);let s=n.globals.padHorizontal;const i=0;let l=n.globals.padHorizontal+n.layout.gridWidth/e;const h=n.layout.gridHeight;for(let a=0,o=0;a<t;a++,o++)o>=n.config.grid.column.colors.length&&(o=0),"datetime"===n.config.xaxis.type&&(s=this.xaxisLabels[a].position,l=((null==(r=this.xaxisLabels[a+1])?void 0:r.position)||n.layout.gridWidth)-this.xaxisLabels[a].position),this._drawGridBandRect({c:o,x1:s,y1:i,x2:l,y2:h,type:"column"}),s+=n.layout.gridWidth/e}}}class Q{constructor(t){this.w=t,this.coreUtils=new F(this.w)}niceScale(t,e,s=0){const i=1e-11,a=this.w,o=a.globals;let r,n,l,h;o.isBarHorizontal?(r=a.config.xaxis,n=Math.max((o.svgWidth-100)/25,2)):(r=a.config.yaxis[s],n=Math.max((o.svgHeight-100)/15,2)),m.isNumber(n)||(n=10),l=void 0!==r.min&&null!==r.min,h=void 0!==r.max&&null!==r.min;let c=void 0!==r.stepSize&&null!==r.stepSize,d=void 0!==r.tickAmount&&null!==r.tickAmount,g=d?r.tickAmount:M[Math.min(Math.round(n/2),M.length-1)];if(o.isMultipleYAxis&&!d&&o.multiAxisTickAmount>0&&(g=o.multiAxisTickAmount,d=!0),g="dataPoints"===g?o.dataPoints-1:Math.abs(Math.round(g)),(t===Number.MIN_VALUE&&0===e||!m.isNumber(t)&&!m.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE)&&(t=m.isNumber(r.min)?r.min:0,e=m.isNumber(r.max)?r.max:t+g,o.allSeriesCollapsed=!1),t>e){const s=e;e=t,t=s}else t===e&&(t=0===t?0:t-1,e=0===e?2:e+1);const p=[];g<1&&(g=1);let u=g,x=Math.abs(e-t);!l&&t>0&&t/x<.15&&(t=0,l=!0),!h&&e<0&&-e/x<.15&&(e=0,h=!0),x=Math.abs(e-t);let f=x/u,b=f;const y=Math.floor(Math.log10(b)),w=Math.pow(10,y);let v=Math.ceil(b/w);if(v=L[0===o.yValueDecimal?0:1][v],b=v*w,f=b,o.isBarHorizontal&&r.stepSize&&"datetime"!==r.type?(f=r.stepSize,c=!0):c&&(f=r.stepSize),c&&r.forceNiceScale){const t=Math.floor(Math.log10(f));f*=Math.pow(10,y-t)}if(l&&h){let t=x/u;if(d)if(c)if(0!=m.mod(x,f)){const e=m.getGCD(f,t);f=t/e<10?e:t}else 0==m.mod(f,t)?f=t:(t=f,d=!1);else f=t;else if(c)0==m.mod(x,f)?t=f:f=t;else if(0==m.mod(x,f))t=f;else{u=Math.ceil(x/f),t=x/u;const e=m.getGCD(x,f);x/e<n&&(t=e),f=t}u=Math.round(x/f)}else{if(l||h){if(h)if(d)t=e-f*u;else{const s=t;t=f*Math.floor(t/f),Math.abs(e-t)/m.getGCD(x,f)>n&&(t=e-f*g,t+=f*Math.floor((s-t)/f))}else if(l)if(d)e=t+f*u;else{const s=e;e=f*Math.ceil(e/f),Math.abs(e-t)/m.getGCD(x,f)>n&&(e=t+f*g,e+=f*Math.ceil((s-e)/f))}}else if(o.isMultipleYAxis&&d){const s=f*Math.floor(t/f);let i=s+f*u;i<e&&(f*=2),i=e,e=(t=s)+f*u,x=Math.abs(e-t),t>0&&t<Math.abs(i-e)&&(t=0,e=f*u),e<0&&-e<Math.abs(s-t)&&(e=0,t=-f*u)}else t=f*Math.floor(t/f),e=f*Math.ceil(e/f);x=Math.abs(e-t),f=m.getGCD(x,f),u=Math.round(x/f)}if(d||l||h||(u=Math.ceil((x-i)/(f+i)),u>16&&m.getPrimeFactors(u).length<2&&u++),!d&&r.forceNiceScale&&0===o.yValueDecimal&&u>x&&(u=x,f=Math.round(x/u)),u>n&&(!d&&!c||r.forceNiceScale)){const t=m.getPrimeFactors(u),e=t.length-1;let s=u;t:for(var A=0;A<e;A++)for(var C=0;C<=e-A;C++){const i=Math.min(C+A,e);let a=s,o=1;for(var S=C;S<=i;S++)o*=t[S];if(a/=o,a<n){s=a;break t}}f=s===u?x:x/s,u=Math.round(x/f)}o.isMultipleYAxis&&0==o.multiAxisTickAmount&&o.ignoreYAxisIndexes.indexOf(s)<0&&(o.multiAxisTickAmount=u);let k=t-f;const D=f*i;do{k+=f,p.push(m.stripNumber(k,7))}while(e-k>D);return{result:p,niceMin:p[0],niceMax:p[p.length-1]}}linearScale(t,e,s=10,i=0,a=void 0){const o=Math.abs(e-t);let r=[];if(t===e)return r=[t],{result:r,niceMin:r[0],niceMax:r[r.length-1]};"dataPoints"===(s=this._adjustTicksForSmallRange(s,i,o))&&(s=this.w.globals.dataPoints-1);const n=s;a||(a=o/n);if(0!==a&&isFinite(a)){const t=Math.floor(Math.log10(Math.abs(a))),e=Math.max(2,2-t),s=Math.pow(10,e);a=Math.round((a+Number.EPSILON)*s)/s}let l=s===Number.MAX_VALUE?5:n;s===Number.MAX_VALUE&&(a=1);let h=t;for(;l>=0;)r.push(h),h=m.preciseAddition(h,a),l-=1;return{result:r,niceMin:r[0],niceMax:r[r.length-1]}}logarithmicScaleNice(t,e,s){e<=0&&(e=Math.max(t,s)),t<=0&&(t=Math.min(e,s));const i=[],a=Math.ceil(Math.log(e)/Math.log(s)+1);for(let e=Math.floor(Math.log(t)/Math.log(s));e<a;e++)i.push(Math.pow(s,e));return{result:i,niceMin:i[0],niceMax:i[i.length-1]}}logarithmicScale(t,e,s){e<=0&&(e=Math.max(t,s)),t<=0&&(t=Math.min(e,s));const i=[],a=Math.log(e)/Math.log(s),o=Math.log(t)/Math.log(s),r=a-o,n=Math.round(r),l=r/n;for(let t=0,e=o;t<n;t++,e+=l)i.push(Math.pow(s,e));return i.push(Math.pow(s,a)),{result:i,niceMin:t,niceMax:e}}_adjustTicksForSmallRange(t,e,s){let i=t;if(void 0!==e&&this.w.config.yaxis[e].labels.formatter&&void 0===this.w.config.yaxis[e].tickAmount){const t=Number(this.w.config.yaxis[e].labels.formatter(1));m.isNumber(t)&&0===this.w.globals.yValueDecimal&&(i=Math.ceil(s))}return i<t?i:t}setYScaleForIndex(t,e,s){const i=this.w.globals,a=this.w.config,o=i.isBarHorizontal?a.xaxis:a.yaxis[t];void 0===i.yAxisScale[t]&&(i.yAxisScale[t]=[]);const r=Math.abs(s-e);o.logarithmic&&r<=5&&(i.invalidLogScale=!0),o.logarithmic&&r>5?(i.allSeriesCollapsed=!1,i.yAxisScale[t]=o.forceNiceScale?this.logarithmicScaleNice(e,s,o.logBase):this.logarithmicScale(e,s,o.logBase)):s!==-Number.MAX_VALUE&&m.isNumber(s)&&e!==Number.MAX_VALUE&&m.isNumber(e)?(i.allSeriesCollapsed=!1,i.yAxisScale[t]=this.niceScale(e,s,t)):i.yAxisScale[t]=this.niceScale(Number.MIN_VALUE,0,t)}setXScale(t,e){const s=this.w,i=s.globals;if(e!==-Number.MAX_VALUE&&m.isNumber(e)){const a=i.xTickAmount;i.xAxisScale=this.linearScale(t,e,a,0,void 0===s.config.xaxis.max?s.config.xaxis.stepSize:void 0)}else i.xAxisScale=this.linearScale(0,10,10);return i.xAxisScale}scaleMultipleYAxes(){const t=this.w.config,e=this.w.globals;this.coreUtils.setSeriesYAxisMappings();const s=e.seriesYAxisMap,i=e.minYArr,a=e.maxYArr,o=[],r=!e.isBarHorizontal;if(e.allSeriesCollapsed=!0,e.barGroups=[],s.forEach((s,n)=>{const l=[];if(s.forEach(e=>{var s;const i=null==(s=t.series[e])?void 0:s.group;l.indexOf(i)<0&&l.push(i)}),s.length>0){let h,c,d=Number.MAX_VALUE,g=-Number.MAX_VALUE,p=d,u=g;if(t.chart.stacked){const i=new Array(e.dataPoints).fill(0),a=[],o=[],r=[];l.forEach(()=>{a.push(i.map(()=>Number.MIN_VALUE)),o.push(i.map(()=>Number.MIN_VALUE)),r.push(i.map(()=>Number.MIN_VALUE))});for(let i=0;i<s.length;i++){!h&&t.series[s[i]].type&&(h=t.series[s[i]].type);const d=s[i];c=t.series[d].group?t.series[d].group:"axis-".concat(n.toString());!(e.collapsedSeriesIndices.indexOf(d)<0&&e.ancillaryCollapsedSeriesIndices.indexOf(d)<0)||(e.allSeriesCollapsed=!1,l.forEach((e,s)=>{if(t.series[d].group===e)for(let t=0;t<this.w.seriesData.series[d].length;t++){const e=this.w.seriesData.series[d][t];e>=0?o[s][t]+=e:r[s][t]+=e,a[s][t]+=e,p=Math.min(p,e),u=Math.max(u,e)}})),"bar"!==h&&"column"!==h||e.barGroups.push(c)}h||(h=t.chart.type),"bar"===h||"column"===h?l.forEach((t,e)=>{d=Math.min(d,Math.min.apply(null,r[e])),g=Math.max(g,Math.max.apply(null,o[e]))}):(l.forEach((t,e)=>{p=Math.min(p,Math.min.apply(null,a[e])),u=Math.max(u,Math.max.apply(null,a[e]))}),d=p,g=u),d===Number.MIN_VALUE&&g===Number.MIN_VALUE&&(g=-Number.MAX_VALUE)}else for(let t=0;t<s.length;t++){const o=s[t];d=Math.min(d,i[o]),g=Math.max(g,a[o]);!(e.collapsedSeriesIndices.indexOf(o)<0&&e.ancillaryCollapsedSeriesIndices.indexOf(o)<0)||(e.allSeriesCollapsed=!1)}void 0!==t.yaxis[n].min&&(d="function"==typeof t.yaxis[n].min?t.yaxis[n].min(d):t.yaxis[n].min),void 0!==t.yaxis[n].max&&(g="function"==typeof t.yaxis[n].max?t.yaxis[n].max(g):t.yaxis[n].max),e.barGroups=e.barGroups.filter((t,e,s)=>s.indexOf(t)===e);const x=t.yaxis[n];r&&!0===x.alignZero&&!x.logarithmic&&void 0===x.min&&void 0===x.max&&e.ignoreYAxisIndexes.indexOf(n)<0&&m.isNumber(d)&&m.isNumber(g)?o.push({ai:n,minY:d,maxY:g}):(this.setYScaleForIndex(n,d,g),s.forEach(t=>{i[t]=e.yAxisScale[n].niceMin,a[t]=e.yAxisScale[n].niceMax}))}else this.setYScaleForIndex(n,0,-Number.MAX_VALUE)}),o.length>=2){o.forEach(t=>{this.setYScaleForIndex(t.ai,t.minY,t.maxY),s[t.ai].forEach(s=>{i[s]=e.yAxisScale[t.ai].niceMin,a[s]=e.yAxisScale[t.ai].niceMax})});let t=0;o.forEach(s=>{const i=e.yAxisScale[s.ai],a=i.niceMax-i.niceMin;if(a>0){const e=-i.niceMin/a;e>t&&(t=e)}}),t>1&&(t=1),t<0&&(t=0);const r=t=>{if(t<=0)return 1;const e=Math.floor(Math.log10(t)),s=Math.pow(10,e),i=t/s;let a;return a=i<=1+1e-9?1:i<=2+1e-9?2:i<=2.5+1e-9?2.5:i<=5+1e-9?5:10,a*s};o.forEach(o=>{const n=e.yAxisScale[o.ai];if(!n.result||n.result.length<2)return;const l=n.niceMax-n.niceMin;if(l<=0)return;const h=-n.niceMin/l;if(Math.abs(h-t)<=1e-9)return;const c=h<t&&t<1-1e-9,d=!c&&h>t&&t>1e-9;if(!c&&!d)return;const g=c?-t*n.niceMax/(1-t):n.niceMin,p=d?-n.niceMin*(1-t)/t:n.niceMax,u=p-g;if(u<=0)return;const x=Math.max(n.result.length,5),f=r(u/Math.max(x-1,1));if(f<=0)return;let b,y;if(c){b=Math.floor(g/f+1e-9)*f;const e=t>1e-9?b*(t-1)/t:n.niceMax,s=Math.max(e,n.niceMax);y=Math.ceil(s/f-1e-9)*f}else{y=Math.ceil(p/f-1e-9)*f;const e=t<1-1e-9?-t*y/(1-t):n.niceMin,s=Math.min(e,n.niceMin);b=Math.floor(s/f+1e-9)*f}n.result=[];for(let t=b;t<=y+1e-9*f;t=m.preciseAddition(t,f))n.result.push(m.stripNumber(t,7));n.niceMin=b,n.niceMax=y,s[o.ai].forEach(t=>{i[t]=n.niceMin,a[t]=n.niceMax})})}else if(1===o.length){const t=o[0];this.setYScaleForIndex(t.ai,t.minY,t.maxY),s[t.ai].forEach(s=>{i[s]=e.yAxisScale[t.ai].niceMin,a[s]=e.yAxisScale[t.ai].niceMax})}}}class tt{constructor(t){this.w=t,this.scales=new Q(this.w)}init(){this.setYRange(),this.setXRange(),this.setZRange()}getMinYMaxY(t,e=Number.MAX_VALUE,s=-Number.MAX_VALUE,i=null){var a,o,r,n,l,h,c,d;const g=this.w.config,p=this.w.globals;let u=-Number.MAX_VALUE,x=Number.MIN_VALUE;null===i&&(i=t+1);const f=this.w.seriesData.series;let b=f,y=f;"candlestick"===g.chart.type?(b=this.w.candleData.seriesCandleL,y=this.w.candleData.seriesCandleH):"boxPlot"===g.chart.type?(b=this.w.candleData.seriesCandleO,y=this.w.candleData.seriesCandleC):"violin"===g.chart.type?(b=this.w.violinData.seriesViolinMin,y=this.w.violinData.seriesViolinMax):this.w.axisFlags.isRangeData&&(b=this.w.rangeData.seriesRangeStart,y=this.w.rangeData.seriesRangeEnd);let w=!1;if(this.w.seriesData.seriesX.length>=i){const t=null==(a=p.brushSource)?void 0:a.w.config.chart.brush;(g.chart.zoom.enabled&&g.chart.zoom.autoScaleYaxis||(null==t?void 0:t.enabled)&&(null==t?void 0:t.autoScaleYaxis))&&(w=!0)}for(let a=t;a<i;a++){p.dataPoints=Math.max(p.dataPoints,f[a].length);const t=g.series[a].type;this.w.labelData.categoryLabels.length&&(p.dataPoints=this.w.labelData.categoryLabels.filter(t=>void 0!==t).length),this.w.labelData.labels.length&&"datetime"!==g.xaxis.type&&0!==this.w.seriesData.series.reduce((t,e)=>t+e.length,0)&&(p.dataPoints=Math.max(p.dataPoints,this.w.labelData.labels.length));let i=0,v=f[a].length-1;if(w){if(g.xaxis.min)for(;i<v&&this.w.seriesData.seriesX[a][i]<g.xaxis.min;i++);if(g.xaxis.max)for(;v>i&&this.w.seriesData.seriesX[a][v]>g.xaxis.max;v--);}for(let g=i;g<=v&&g<this.w.seriesData.series[a].length;g++){let i=f[a][g];if(null!==i&&m.isNumber(i)){switch(void 0!==(null==(o=y[a])?void 0:o[g])&&(u=Math.max(u,y[a][g]),e=Math.min(e,y[a][g])),void 0!==(null==(r=b[a])?void 0:r[g])&&(e=Math.min(e,b[a][g]),s=Math.max(s,b[a][g])),t){case"candlestick":void 0!==this.w.candleData.seriesCandleC[a][g]&&(u=Math.max(u,this.w.candleData.seriesCandleH[a][g]),e=Math.min(e,this.w.candleData.seriesCandleL[a][g]));break;case"boxPlot":void 0!==this.w.candleData.seriesCandleC[a][g]&&(u=Math.max(u,this.w.candleData.seriesCandleC[a][g]),e=Math.min(e,this.w.candleData.seriesCandleO[a][g]));break;case"violin":void 0!==(null==(n=this.w.violinData.seriesViolinMax[a])?void 0:n[g])&&(u=Math.max(u,this.w.violinData.seriesViolinMax[a][g]),e=Math.min(e,this.w.violinData.seriesViolinMin[a][g]))}if(t&&"candlestick"!==t&&"boxPlot"!==t&&"violin"!==t&&"rangeArea"!==t&&"rangeBar"!==t&&(u=Math.max(u,this.w.seriesData.series[a][g]),e=Math.min(e,this.w.seriesData.series[a][g])),this.w.seriesData.seriesGoals[a]&&this.w.seriesData.seriesGoals[a][g]&&Array.isArray(this.w.seriesData.seriesGoals[a][g])&&this.w.seriesData.seriesGoals[a][g].forEach(t=>{u=Math.max(u,t.value),e=Math.min(e,t.value)}),"boxPlot"===this.w.config.chart.type||"boxPlot"===t){const t=null==(h=null==(l=this.w.candleData.seriesBoxPoints)?void 0:l[a])?void 0:h[g];if(t)for(let s=0;s<t.length;s++){const i=t[s];"number"==typeof i&&(u=Math.max(u,i),e=Math.min(e,i))}}s=u,i=m.noExponents(i),m.isFloat(i)&&(p.yValueDecimal=Math.max(p.yValueDecimal,i.toString().split(".")[1].length)),x>(null==(c=b[a])?void 0:c[g])&&(null==(d=b[a])?void 0:d[g])<0&&(x=b[a][g])}else p.hasNullValues=!0}"bar"!==t&&"column"!==t||(x<0&&u<0&&(u=0,s=Math.max(s,0)),x===Number.MIN_VALUE&&(x=0,e=Math.min(e,0)))}return"rangeBar"===g.chart.type&&this.w.rangeData.seriesRangeStart.length&&p.isBarHorizontal&&(x=e),"bar"===g.chart.type&&(x<0&&u<0&&(u=0),x===Number.MIN_VALUE&&(x=0)),{minY:x,maxY:u,lowestY:e,highestY:s}}setYRange(){const t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;let s,i=Number.MAX_VALUE;if(t.isMultipleYAxis){i=Number.MAX_VALUE;for(let e=0;e<this.w.seriesData.series.length;e++)s=this.getMinYMaxY(e),t.minYArr[e]=s.lowestY,t.maxYArr[e]=s.highestY,i=Math.min(i,s.lowestY)}if(s=this.getMinYMaxY(0,i,void 0,this.w.seriesData.series.length),"bar"===e.chart.type?(t.minY=s.minY,t.maxY=s.maxY):(t.minY=s.lowestY,t.maxY=s.highestY),i=s.lowestY,e.chart.stacked&&this._setStackedMinMax(),"line"===e.chart.type||"area"===e.chart.type||"scatter"===e.chart.type||"candlestick"===e.chart.type||"boxPlot"===e.chart.type||"violin"===e.chart.type||"rangeBar"===e.chart.type&&!t.isBarHorizontal?t.minY===Number.MIN_VALUE&&i!==-Number.MAX_VALUE&&i!==t.maxY&&(t.minY=i):t.minY=t.minY!==Number.MIN_VALUE?Math.min(s.minY,t.minY):s.minY,e.yaxis.forEach((e,s)=>{void 0!==e.max&&("number"==typeof e.max?t.maxYArr[s]=e.max:"function"==typeof e.max&&(t.maxYArr[s]=e.max(t.isMultipleYAxis?t.maxYArr[s]:t.maxY)),t.maxY=t.maxYArr[s]),void 0!==e.min&&("number"==typeof e.min?t.minYArr[s]=e.min:"function"==typeof e.min&&(t.minYArr[s]=e.min(t.isMultipleYAxis?t.minYArr[s]===Number.MIN_VALUE?0:t.minYArr[s]:t.minY)),t.minY=t.minYArr[s])}),t.isBarHorizontal){["min","max"].forEach(s=>{void 0!==e.xaxis[s]&&"number"==typeof e.xaxis[s]&&("min"===s?t.minY=e.xaxis[s]:t.maxY=e.xaxis[s])})}return t.isMultipleYAxis?(this.scales.scaleMultipleYAxes(),t.minY=i):(this.scales.setYScaleForIndex(0,t.minY,t.maxY),t.minY=t.yAxisScale[0].niceMin,t.maxY=t.yAxisScale[0].niceMax,t.minYArr[0]=t.minY,t.maxYArr[0]=t.maxY),t.barGroups=[],t.lineGroups=[],t.areaGroups=[],e.series.forEach(s=>{const i=s;switch(i.type||e.chart.type){case"bar":case"column":t.barGroups.push(i.group);break;case"line":t.lineGroups.push(i.group);break;case"area":t.areaGroups.push(i.group)}}),t.barGroups=t.barGroups.filter((t,e,s)=>s.indexOf(t)===e),t.lineGroups=t.lineGroups.filter((t,e,s)=>s.indexOf(t)===e),t.areaGroups=t.areaGroups.filter((t,e,s)=>s.indexOf(t)===e),{minY:t.minY,maxY:t.maxY,minYArr:t.minYArr,maxYArr:t.maxYArr,yAxisScale:t.yAxisScale}}setXRange(){const t=this.w.globals,e=this.w.config,s="numeric"===e.xaxis.type||"datetime"===e.xaxis.type||"category"===e.xaxis.type&&!this.w.axisFlags.noLabelsProvided||this.w.axisFlags.noLabelsProvided||this.w.axisFlags.isXNumeric,i=()=>{for(let e=0;e<this.w.seriesData.series.length;e++)if(this.w.labelData.labels[e])for(let s=0;s<this.w.labelData.labels[e].length;s++)null!==this.w.labelData.labels[e][s]&&m.isNumber(this.w.labelData.labels[e][s])&&(t.maxX=Math.max(t.maxX,this.w.labelData.labels[e][s]),t.initialMaxX=Math.max(t.maxX,this.w.labelData.labels[e][s]),t.minX=Math.min(t.minX,this.w.labelData.labels[e][s]),t.initialMinX=Math.min(t.minX,this.w.labelData.labels[e][s]))};if(this.w.axisFlags.isXNumeric&&i(),this.w.axisFlags.noLabelsProvided&&0===e.xaxis.categories.length&&(t.maxX=this.w.labelData.labels[this.w.labelData.labels.length-1],t.initialMaxX=this.w.labelData.labels[this.w.labelData.labels.length-1],t.minX=1,t.initialMinX=1),this.w.axisFlags.isXNumeric||this.w.axisFlags.noLabelsProvided||this.w.axisFlags.dataFormatXNumeric){let i=10;if(void 0===e.xaxis.tickAmount)i=Math.round(t.svgWidth/150),"numeric"===e.xaxis.type&&t.dataPoints<30&&(i=t.dataPoints-1),i>t.dataPoints&&0!==t.dataPoints&&(i=t.dataPoints-1);else if("dataPoints"===e.xaxis.tickAmount){if(this.w.seriesData.series.length>1&&(i=this.w.seriesData.series[t.maxValsInArrayIndex].length-1),this.w.axisFlags.isXNumeric){const e=Math.round(t.maxX-t.minX);e<30&&(i=e)}}else i=e.xaxis.tickAmount;if(t.xTickAmount=i,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!this.w.axisFlags.dataFormatXNumeric){const e=[];for(let s=t.minX-1;s<t.maxX;s++)e.push(s+1);t.xAxisScale={result:e,niceMin:e[0],niceMax:e[e.length-1]}}else t.xAxisScale=this.scales.setXScale(t.minX,t.maxX);else t.xAxisScale=this.scales.linearScale(0,i,i,0,e.xaxis.stepSize),this.w.axisFlags.noLabelsProvided&&this.w.labelData.labels.length>0&&(t.xAxisScale=this.scales.linearScale(1,this.w.labelData.labels.length,i-1,0,e.xaxis.stepSize),this.w.seriesData.seriesX=this.w.labelData.labels.slice());s&&(this.w.labelData.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&this.w.labelData.labels.length&&(t.xTickAmount=this.w.labelData.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}setZRange(){const t=this.w.globals;if(this.w.axisFlags.isDataXYZ)for(let e=0;e<this.w.seriesData.series.length;e++)if(void 0!==this.w.seriesData.seriesZ[e])for(let s=0;s<this.w.seriesData.seriesZ[e].length;s++)null!==this.w.seriesData.seriesZ[e][s]&&m.isNumber(this.w.seriesData.seriesZ[e][s])&&(t.maxZ=Math.max(t.maxZ,this.w.seriesData.seriesZ[e][s]),t.minZ=Math.min(t.minZ,this.w.seriesData.seriesZ[e][s]))}_handleSingleDataPoint(){const t=this.w.globals,e=this.w.config;if(t.minX===t.maxX){const s=new y(this.w);if("datetime"===e.xaxis.type){const i=s.getDate(t.minX);e.xaxis.labels.datetimeUTC?i.setUTCDate(i.getUTCDate()-2):i.setDate(i.getDate()-2),t.minX=new Date(i).getTime();const a=s.getDate(t.maxX);e.xaxis.labels.datetimeUTC?a.setUTCDate(a.getUTCDate()+2):a.setDate(a.getDate()+2),t.maxX=new Date(a).getTime()}else("numeric"===e.xaxis.type||"category"===e.xaxis.type&&!this.w.axisFlags.noLabelsProvided)&&(t.minX=t.minX-2,t.initialMinX=t.minX,t.maxX=t.maxX+2,t.initialMaxX=t.maxX)}}_getMinXDiff(){const t=this.w.globals;this.w.axisFlags.isXNumeric&&this.w.seriesData.seriesX.forEach(e=>{if(e.length){1===e.length&&e.push(this.w.seriesData.seriesX[t.maxValsInArrayIndex][this.w.seriesData.seriesX[t.maxValsInArrayIndex].length-1]);const s=e.slice();s.sort((t,e)=>t-e),s.forEach((e,i)=>{if(i>0){const a=e-s[i-1];a>0&&(t.minXDiff=Math.min(a,t.minXDiff))}}),1!==t.dataPoints&&t.minXDiff!==Number.MAX_VALUE||(t.minXDiff=.5)}})}_setStackedMinMax(){const t=this.w.globals;if(!this.w.seriesData.series.length)return;let e=this.w.labelData.seriesGroups;e.length||(e=[this.w.seriesData.seriesNames.map(t=>t)]);const s={},i={};e.forEach(e=>{s[e]=[],i[e]=[];this.w.config.series.map((t,s)=>e.indexOf(this.w.seriesData.seriesNames[s])>-1?s:null).filter(t=>null!==t).forEach(a=>{var o,r,n,l;for(let h=0;h<this.w.seriesData.series[t.maxValsInArrayIndex].length;h++){void 0===s[e][h]&&(s[e][h]=0,i[e][h]=0);(this.w.config.chart.stacked&&!t.comboCharts||this.w.config.chart.stacked&&t.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null==(r=null==(o=this.w.config.series)?void 0:o[a])?void 0:r.type)||"column"===(null==(l=null==(n=this.w.config.series)?void 0:n[a])?void 0:l.type)))&&null!==this.w.seriesData.series[a][h]&&m.isNumber(this.w.seriesData.series[a][h])&&(this.w.seriesData.series[a][h]>0?s[e][h]+=parseFloat(String(this.w.seriesData.series[a][h]))+1e-4:i[e][h]+=parseFloat(String(this.w.seriesData.series[a][h])))}})}),Object.entries(s).forEach(([e])=>{s[e].forEach((a,o)=>{t.maxY=Math.max(t.maxY,s[e][o]),t.minY=Math.min(t.minY,i[e][o])})})}}class et{constructor(t,{theme:e=null,timeScale:s=null}={},i){this.w=t,this.elgrid=i,this.xaxisFontSize=t.config.xaxis.labels.style.fontSize,this.axisFontFamily=t.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=t.config.xaxis.labels.style.colors,this.isCategoryBarHorizontal="bar"===t.config.chart.type&&t.config.plotOptions.bar.horizontal,this.xAxisoffX="bottom"===t.config.xaxis.position?t.layout.gridHeight:0,this.drawnLabels=[],this.axesUtils=new Z(t,{theme:e,timeScale:s})}drawYaxis(t){const e=this.w,s=new N(this.w),i=e.config.yaxis[t].labels.style,{fontSize:a,fontFamily:o,fontWeight:r}=i,n=s.group({class:"apexcharts-yaxis",rel:t,transform:`translate(${e.globals.translateYAxisX[t]}, 0)`});if(this.axesUtils.isYAxisHidden(t))return n;const l=s.group({class:"apexcharts-yaxis-texts-g"});n.add(l);const h=e.globals.yAxisScale[t].result.length-1,c=e.layout.gridHeight/h,d=e.formatters.yLabelFormatters[t],g=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice());if(e.config.yaxis[t].labels.show){let n=e.layout.translateY+e.config.yaxis[t].labels.offsetY;e.globals.isBarHorizontal?n=0:"heatmap"===e.config.chart.type&&(n-=c/2),n+=parseInt(a,10)/3;let p=null;for(let u=h;u>=0;u--){const h=d(g[u],u,e);let x=e.config.yaxis[t].labels.padding;e.config.yaxis[t].opposite&&0!==e.config.yaxis.length&&(x*=-1);const f=this.getTextAnchor(e.config.yaxis[t].labels.align,e.config.yaxis[t].opposite),b=this.axesUtils.getYAxisForeColor(i.colors,t),m=Array.isArray(b)?b[u]:b,y=Array.from(e.dom.baseEl.querySelectorAll(`.apexcharts-yaxis[rel='${t}'] .apexcharts-yaxis-label tspan`)).map(t=>t.textContent),w=s.drawText({x:x,y:n,text:y.includes(h)&&!e.config.yaxis[t].labels.showDuplicates?"":h,textAnchor:f,fontSize:a,fontFamily:o,fontWeight:r,maxWidth:e.config.yaxis[t].labels.maxWidth,foreColor:m,isPlainText:!1,cssClass:`apexcharts-yaxis-label ${i.cssClass}`});l.add(w),this.addTooltip(w,h),null===p&&(p=w),0!==e.config.yaxis[t].labels.rotate&&this.rotateLabel(s,w,p,e.config.yaxis[t].labels.rotate),n+=c}}return this.addYAxisTitle(s,n,t),this.addAxisBorder(s,n,t,h,c),n}getTextAnchor(t,e){return"left"===t?"start":"center"===t?"middle":"right"===t?"end":e?"start":"end"}addTooltip(t,e){const s=b.createElementNS(W,"title");s.textContent=Array.isArray(e)?e.join(" "):e,t.node.appendChild(s)}rotateLabel(t,e,s,i){const a=t.rotateAroundCenter(s.node),o=t.rotateAroundCenter(e.node);e.node.setAttribute("transform",`rotate(${i} ${a.x} ${o.y})`)}addYAxisTitle(t,e,s){const i=this.w;if(void 0!==i.config.yaxis[s].title.text){const a=t.group({class:"apexcharts-yaxis-title"}),o=i.config.yaxis[s].opposite?i.globals.translateYAxisX[s]:0,r=t.drawText({x:o,y:i.layout.gridHeight/2+i.layout.translateY+i.config.yaxis[s].title.offsetY,text:i.config.yaxis[s].title.text,textAnchor:"end",foreColor:i.config.yaxis[s].title.style.color,fontSize:i.config.yaxis[s].title.style.fontSize,fontWeight:i.config.yaxis[s].title.style.fontWeight,fontFamily:i.config.yaxis[s].title.style.fontFamily,cssClass:`apexcharts-yaxis-title-text ${i.config.yaxis[s].title.style.cssClass}`});a.add(r),e.add(a)}}addAxisBorder(t,e,s,i,a){const o=this.w,r=o.config.yaxis[s].axisBorder;let n=31+r.offsetX;if(o.config.yaxis[s].opposite&&(n=-31-r.offsetX),r.show){const s=t.drawLine(n,o.layout.translateY+r.offsetY-2,n,o.layout.gridHeight+o.layout.translateY+r.offsetY+2,r.color,0,r.width);e.add(s)}o.config.yaxis[s].axisTicks.show&&this.axesUtils.drawYAxisTicks(n,i,r,o.config.yaxis[s].axisTicks,s,a,e)}drawYaxisInversed(t){const e=this.w,s=new N(this.w),i=s.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),a=s.group({class:"apexcharts-xaxis-texts-g",transform:`translate(${e.layout.translateXAxisX}, ${e.layout.translateXAxisY})`});i.add(a);let o=e.globals.yAxisScale[t].result.length-1;const r=e.layout.gridWidth/o+.1;let n=r+e.config.xaxis.labels.offsetX;const l=e.formatters.xLabelFormatter;let h=this.axesUtils.checkForReversedLabels(t,e.globals.yAxisScale[t].result.slice());const c=e.labelData.timescaleLabels;if(c.length>0&&(this.xaxisLabels=c.slice(),h=c.slice(),o=h.length),e.config.xaxis.labels.show)for(let i=c.length?0:o;c.length?i<c.length:i>=0;c.length?i++:i--){let o=null==l?void 0:l(h[i],i,e),d=e.layout.gridWidth+e.globals.padHorizontal-(n-r+e.config.xaxis.labels.offsetX);if(c.length){const t=this.axesUtils.getLabel(h,c,d,i,this.drawnLabels,this.xaxisFontSize);d=t.x,o=t.text,this.drawnLabels.push(t.text),0===i&&e.globals.skipFirstTimelinelabel&&(o=""),i===h.length-1&&e.globals.skipLastTimelinelabel&&(o="")}const g=s.drawText({x:d,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.layout.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:o,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.axisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:`apexcharts-xaxis-label ${e.config.xaxis.labels.style.cssClass}`});a.add(g),this.addTooltip(g,o),n+=r}return this.inversedYAxisTitleText(i),this.inversedYAxisBorder(i),i}inversedYAxisBorder(t){const e=this.w,s=new N(this.w),i=e.config.xaxis.axisBorder;if(i.show){let a=0;"bar"===e.config.chart.type&&e.axisFlags.isXNumeric&&(a-=15);const o=s.drawLine(e.globals.padHorizontal+a+i.offsetX,this.xAxisoffX,e.layout.gridWidth,this.xAxisoffX,i.color,0,i.height);this.elgrid&&this.elgrid.elGridBorders&&e.config.grid.show?this.elgrid.elGridBorders.add(o):t.add(o)}}inversedYAxisTitleText(t){const e=this.w,s=new N(this.w);if(void 0!==e.config.xaxis.title.text){const i=s.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),a=s.drawText({x:e.layout.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,foreColor:e.config.xaxis.title.style.color,cssClass:`apexcharts-xaxis-title-text ${e.config.xaxis.title.style.cssClass}`});i.add(a),t.add(i)}}yAxisTitleRotate(t,e){const s=this.w,i=new N(this.w),a=s.dom.baseEl.querySelector(`.apexcharts-yaxis[rel='${t}'] .apexcharts-yaxis-texts-g`),o=a?a.getBoundingClientRect():{width:0,height:0},r=s.dom.baseEl.querySelector(`.apexcharts-yaxis[rel='${t}'] .apexcharts-yaxis-title text`),n=r?r.getBoundingClientRect():{width:0,height:0};if(r){const a=this.xPaddingForYAxisTitle(t,o,n,e);r.setAttribute("x",String(a.xPos-(e?10:0)));const l=i.rotateAroundCenter(r);r.setAttribute("transform",`rotate(${e?-1*s.config.yaxis[t].title.rotate:s.config.yaxis[t].title.rotate} ${l.x} ${l.y})`)}}xPaddingForYAxisTitle(t,e,s,i){const a=this.w;let o=0,r=10;return void 0===a.config.yaxis[t].title.text||t<0?{xPos:o,padd:0}:(i?o=e.width+a.config.yaxis[t].title.offsetX+s.width/2+r/2:(o=-1*e.width+a.config.yaxis[t].title.offsetX+r/2+s.width/2,a.globals.isBarHorizontal&&(r=25,o=-1*e.width-a.config.yaxis[t].title.offsetX-r)),{xPos:o,padd:r})}setYAxisXPosition(t,e){const s=this.w;let i=0,a=0,o=18,r=1;s.config.yaxis.length>1&&(this.multipleYs=!0),s.config.yaxis.forEach((n,l)=>{const h=s.globals.ignoreYAxisIndexes.includes(l)||!n.show||n.floating||0===t[l].width,c=t[l].width+e[l].width;n.opposite?s.globals.isBarHorizontal?(a=s.layout.gridWidth+s.layout.translateX-1,s.globals.translateYAxisX[l]=a-n.labels.offsetX):(a=s.layout.gridWidth+s.layout.translateX+r,h||(r+=c+20),s.globals.translateYAxisX[l]=a-n.labels.offsetX+20):(i=s.layout.translateX-o,h||(o+=c+20),s.globals.translateYAxisX[l]=i+n.labels.offsetX)})}setYAxisTextAlignments(){const t=this.w;Array.from(t.dom.baseEl.getElementsByClassName("apexcharts-yaxis")).forEach((e,s)=>{const i=t.config.yaxis[s];if(i&&!i.floating&&void 0!==i.labels.align){const e=t.dom.baseEl.querySelector(`.apexcharts-yaxis[rel='${s}'] .apexcharts-yaxis-texts-g`),a=Array.from(t.dom.baseEl.querySelectorAll(`.apexcharts-yaxis[rel='${s}'] .apexcharts-yaxis-label`)),o=e.getBoundingClientRect();a.forEach(t=>{t.setAttribute("text-anchor",i.labels.align)}),"left"!==i.labels.align||i.opposite?"center"===i.labels.align?e.setAttribute("transform",`translate(${o.width/2*(i.opposite?1:-1)}, 0)`):"right"===i.labels.align&&i.opposite&&e.setAttribute("transform",`translate(${o.width}, 0)`):e.setAttribute("transform",`translate(-${o.width}, 0)`)}})}}class st{constructor(t,e){this.w=t,this.ctx=e,this.documentEvent=this.documentEvent.bind(this)}addEventListener(t,e){const s=this.w;Object.prototype.hasOwnProperty.call(s.globals.events,t)?s.globals.events[t].push(e):s.globals.events[t]=[e]}removeEventListener(t,e){const s=this.w;if(!Object.prototype.hasOwnProperty.call(s.globals.events,t))return;const i=s.globals.events[t].indexOf(e);-1!==i&&s.globals.events[t].splice(i,1)}fireEvent(t,e){const s=this.w;if(!Object.prototype.hasOwnProperty.call(s.globals.events,t))return;e&&e.length||(e=[]);const i=s.globals.events[t],a=i.length;for(let t=0;t<a;t++)i[t].apply(null,e)}setupEventHandlers(){const t=this.w,e=this.ctx,s=t.dom.baseEl.querySelector(t.globals.chartClass);this.ctx.eventList.forEach(i=>{null==s||s.addEventListener(i,s=>{const i=null===s.target.getAttribute("i")&&-1!==t.interact.capturedSeriesIndex?t.interact.capturedSeriesIndex:s.target.getAttribute("i"),a=null===s.target.getAttribute("j")&&-1!==t.interact.capturedDataPointIndex?t.interact.capturedDataPointIndex:s.target.getAttribute("j"),o=Object.assign({},t,{seriesIndex:t.globals.axisCharts?i:0,dataPointIndex:a});"keydown"===s.type?t.config.chart.accessibility.enabled&&t.config.chart.accessibility.keyboard.enabled&&(e.ctx.keyboardNavigation&&e.ctx.keyboardNavigation.handleKey(s),"function"==typeof t.config.chart.events.keyDown&&t.config.chart.events.keyDown(s,e,o),e.ctx.events.fireEvent("keydown",[s,e,o])):"keyup"===s.type?t.config.chart.accessibility.enabled&&t.config.chart.accessibility.keyboard.enabled&&("function"==typeof t.config.chart.events.keyUp&&t.config.chart.events.keyUp(s,e,o),e.ctx.events.fireEvent("keyup",[s,e,o])):"mousemove"===s.type||"touchmove"===s.type?"function"==typeof t.config.chart.events.mouseMove&&t.config.chart.events.mouseMove(s,e,o):"mouseleave"===s.type||"touchleave"===s.type?"function"==typeof t.config.chart.events.mouseLeave&&t.config.chart.events.mouseLeave(s,e,o):("mouseup"===s.type&&1===s.which||"touchend"===s.type)&&("function"==typeof t.config.chart.events.click&&t.config.chart.events.click(s,e,o),e.ctx.events.fireEvent("click",[s,e,o]))},{capture:!1,passive:!0})}),this.ctx.eventList.forEach(e=>{t.dom.baseEl.addEventListener(e,this.documentEvent,{passive:!0})}),this.ctx.core.setupBrushHandler()}documentEvent(t){const e=this.w,s=t.target.className;if("click"===t.type){const t=e.dom.baseEl.querySelector(".apexcharts-menu");t&&t.classList.contains("apexcharts-menu-open")&&"apexcharts-menu-icon"!==s&&t.classList.remove("apexcharts-menu-open")}e.interact.clientX="touchmove"===t.type?t.touches[0].clientX:t.clientX,e.interact.clientY="touchmove"===t.type?t.touches[0].clientY:t.clientY}}class it{constructor(t){this.w=t}setCurrentLocaleValues(t){let e=this.w.config.chart.locales;const s=c.getApex();s.chart&&s.chart.locales&&s.chart.locales.length>0&&(e=this.w.config.chart.locales.concat(s.chart.locales));const i=e.filter(e=>e.name===t)[0];if(!i)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");{const t=m.extend(S,i);this.w.globals.locale=t.options}}}class at{constructor(t,e){this.w=t,this.ctx=e}drawAxis(t,e){const s=this.w.globals,i=this.w.config,a=new K(this.w,this.ctx,e),o=new et(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale},e);if(s.axisCharts&&"radar"!==t){let t,e;s.isBarHorizontal?(e=o.drawYaxisInversed(0),t=a.drawXaxisInversed(0),this.w.dom.elGraphical.add(t),this.w.dom.elGraphical.add(e)):(t=a.drawXaxis(),this.w.dom.elGraphical.add(t),i.yaxis.map((t,i)=>{if(-1===s.ignoreYAxisIndexes.indexOf(i)&&(e=o.drawYaxis(i),this.w.dom.Paper.add(e),"back"===this.w.config.grid.position)){const t=this.w.dom.Paper.children()[1];t&&(t.remove(),this.w.dom.Paper.add(t))}}))}}}class ot{constructor(t){this.w=t}drawXCrosshairs(){const t=this.w,e=new N(this.w),s=new H(this.w),i=t.config.xaxis.crosshairs.fill.gradient,a=t.config.xaxis.crosshairs.dropShadow,o=t.config.xaxis.crosshairs.fill.type,r=i.colorFrom,n=i.colorTo,l=i.opacityFrom,h=i.opacityTo,c=i.stops,d=a.enabled,g=a.left,p=a.top,u=a.blur,x=a.color,f=a.opacity;let b=t.config.xaxis.crosshairs.fill.color;if(t.config.xaxis.crosshairs.show){"gradient"===o&&(b=e.drawGradient("vertical",r,n,l,h,null,c,[]));let i=e.drawRect();1===t.config.xaxis.crosshairs.width&&(i=e.drawLine(0,0,0,0));let a=t.layout.gridHeight;(!m.isNumber(a)||a<0)&&(a=0);let y=t.config.xaxis.crosshairs.width;(!m.isNumber(y)||Number(y)<0)&&(y=0),i.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:a,width:y,height:a,fill:b,filter:"none","fill-opacity":t.config.xaxis.crosshairs.opacity,stroke:t.config.xaxis.crosshairs.stroke.color,"stroke-width":t.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":t.config.xaxis.crosshairs.stroke.dashArray}),d&&(i=s.dropShadow(i,{left:g,top:p,blur:u,color:x,opacity:f})),t.dom.elGraphical.add(i)}}drawYCrosshairs(){const t=this.w,e=new N(this.w),s=t.config.yaxis[0].crosshairs,i=t.globals.barPadForNumericAxis;if(t.config.yaxis[0].crosshairs.show){const a=e.drawLine(-i,0,t.layout.gridWidth+i,0,s.stroke.color,s.stroke.dashArray,s.stroke.width);a.attr({class:"apexcharts-ycrosshairs"}),t.dom.elGraphical.add(a)}const a=e.drawLine(-i,0,t.layout.gridWidth+i,0,s.stroke.color,0,0);a.attr({class:"apexcharts-ycrosshairs-hidden"}),t.dom.elGraphical.add(a)}}function rt(t,e){if(!m.isObject(t)||!m.isObject(e))return void 0!==e?e:t;const s=n({},t);for(const i of Object.keys(e)){const a=e[i];void 0!==a&&(m.isObject(a)&&m.isObject(t[i])?s[i]=rt(t[i],a):s[i]=a)}return s}class nt{constructor(t){this.w=t,this._activeBreakpoint=null}checkResponsiveConfig(t){const e=this.w,s=e.config;if(0===s.responsive.length)return;const i=s.responsive.slice();i.sort((t,e)=>t.breakpoint>e.breakpoint?1:e.breakpoint>t.breakpoint?-1:0).reverse();const a=new D({}),o=(t={})=>{var s;const o=i[0].breakpoint,r=c.isBrowser()?window.innerWidth>0?window.innerWidth:screen.width:0;if(r>o){if(null!==this._activeBreakpoint){if(!e.globals.initialConfig)return;const s=m.clone(e.globals.initialConfig);s.series=m.clone(e.config.series);const i=F.extendArrayProps(a,s,e);t=m.extend(i,t),this.overrideResponsiveOptions(t),this._activeBreakpoint=null}}else for(let o=0;o<i.length;o++)if(r<i[o].breakpoint){const r=(null==(s=i[o].options)?void 0:s.yaxis)?m.clone(i[o].options.yaxis):null;if(t=F.extendArrayProps(a,i[o].options,e),t=m.extend(e.config,t),Array.isArray(e.config.yaxis)&&r){const s=Array.isArray(r)?r:[r];t=l(n({},t),{yaxis:e.config.yaxis.map((t,e)=>rt(t,s[e]))})}this.overrideResponsiveOptions(t),this._activeBreakpoint=i[o].breakpoint}};if(t){let s=F.extendArrayProps(a,t,e);s=m.extend(e.config,s),s=m.extend(s,t),o(s)}else o({})}overrideResponsiveOptions(t){const e=new D(t).init({responsiveOverride:!0});this.w.config=e}}class lt{constructor(t,{toggleDataSeries:e,revertDefaultAxisMinMax:s,updateSeries:i}={}){this.w=t,this._toggleDataSeries=e||null,this._revertDefaultAxisMinMax=s||null,this._updateSeries=i||null,this.legendInactiveClass="legend-mouseover-inactive"}clearSeriesCache(){const t=this.w;t.globals.cachedSelectors&&(delete t.globals.cachedSelectors.allSeriesEls,delete t.globals.cachedSelectors.highlightSeriesEls)}getAllSeriesEls(){const t=this.w,e="allSeriesEls";return t.globals.cachedSelectors[e]||(t.globals.cachedSelectors[e]=t.dom.baseEl.getElementsByClassName("apexcharts-series")),t.globals.cachedSelectors[e]}getSeriesByName(t){return this.w.dom.baseEl.querySelector(`.apexcharts-inner .apexcharts-series[seriesName='${m.escapeString(t)}']`)}isSeriesHidden(t){var e;const s=this.getSeriesByName(t),i=parseInt(null!=(e=s.getAttribute("data:realIndex"))?e:"0",10);return{isHidden:s.classList.contains("apexcharts-series-collapsed"),realIndex:i}}addCollapsedClassToSeries(t,e){lt.addCollapsedClassToSeries(this.w,t,e)}static addCollapsedClassToSeries(t,e,s){function i(t){for(let i=0;i<t.length;i++)t[i].index===s&&e.node.classList.add("apexcharts-series-collapsed")}i(t.globals.collapsedSeries),i(t.globals.ancillaryCollapsedSeries)}toggleSeries(t){var e;const s=this.isSeriesHidden(t);return null==(e=this._toggleDataSeries)||e.call(this,s.realIndex,s.isHidden),s.isHidden}showSeries(t){var e;const s=this.isSeriesHidden(t);s.isHidden&&(null==(e=this._toggleDataSeries)||e.call(this,s.realIndex,!0))}hideSeries(t){var e;const s=this.isSeriesHidden(t);s.isHidden||null==(e=this._toggleDataSeries)||e.call(this,s.realIndex,!1)}resetSeries(t=!0,e=!0,s=!0){var i,a;const o=this.w;this.clearSeriesCache();let r=m.clone(o.globals.initialSeries);o.globals.previousPaths=[],s?(o.globals.collapsedSeries=[],o.globals.ancillaryCollapsedSeries=[],o.globals.collapsedSeriesIndices=[],o.globals.ancillaryCollapsedSeriesIndices=[]):r=this.emptyCollapsedSeries(r),o.config.series=r,t&&(e&&(o.interact.zoomed=!1,null==(i=this._revertDefaultAxisMinMax)||i.call(this)),null==(a=this._updateSeries)||a.call(this,r,o.config.chart.animations.dynamicAnimation.enabled))}emptyCollapsedSeries(t){const e=this.w;for(let s=0;s<t.length;s++)e.globals.collapsedSeriesIndices.indexOf(s)>-1&&(t[s].data=[]);return t}highlightSeries(t){var e;const s=this.w,i=this.getSeriesByName(t),a=parseInt(null!=(e=null==i?void 0:i.getAttribute("data:realIndex"))?e:"",10),o="highlightSeriesEls";let r=s.globals.cachedSelectors[o];r||(r=s.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis"),s.globals.cachedSelectors[o]=r);let n=null,l=null,h=null;if(s.globals.axisCharts||"radialBar"===s.config.chart.type)if(s.globals.axisCharts){n=s.dom.baseEl.querySelector(`.apexcharts-series[data\\:realIndex='${a}']`),l=s.dom.baseEl.querySelector(`.apexcharts-datalabels[data\\:realIndex='${a}']`);const t=s.globals.seriesYAxisReverseMap[a];h=s.dom.baseEl.querySelector(`.apexcharts-yaxis[rel='${t}']`)}else n=s.dom.baseEl.querySelector(`.apexcharts-series[rel='${a+1}']`);else n=s.dom.baseEl.querySelector(`.apexcharts-series[rel='${a+1}'] path`);for(let t=0;t<r.length;t++){r[t].classList.add(this.legendInactiveClass)}if(n){if(!s.globals.axisCharts){const t=n.parentNode;null==t||t.classList.remove(this.legendInactiveClass)}n.classList.remove(this.legendInactiveClass),null!==l&&l.classList.remove(this.legendInactiveClass),null!==h&&h.classList.remove(this.legendInactiveClass)}else for(let t=0;t<r.length;t++){r[t].classList.remove(this.legendInactiveClass)}}toggleSeriesOnHover(t,e){const s=this.w;e||(e=t.target);const i=s.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis");if("mousemove"===t.type){const t=parseInt(e.getAttribute("rel"),10)-1;this.highlightSeries(s.seriesData.seriesNames[t])}else if("mouseout"===t.type)for(let t=0;t<i.length;t++)i[t].classList.remove(this.legendInactiveClass)}highlightRangeInSeries(t,e){const s=this.w,i=s.dom.baseEl.getElementsByClassName("apexcharts-heatmap-rect"),a=t=>{for(let e=0;e<i.length;e++){const s=i[e].classList;"function"==typeof s[t]&&s[t](this.legendInactiveClass)}};if("reset"===e)return void a("remove");const o=s.config.plotOptions.heatmap.colorScale.ranges,r=o&&o[t];if(r){a("add");for(let t=0;t<i.length;t++){const e=Number(i[t].getAttribute("val"));e>=r.from&&e<=r.to&&i[t].classList.remove(this.legendInactiveClass)}}}getActiveConfigSeriesIndex(t="asc",e=[]){const s=this.w;let i=0;if(s.config.series.length>1){const a=s.config.series.map((t,i)=>t.data&&t.data.length>0&&-1===s.globals.collapsedSeriesIndices.indexOf(i)&&(!s.globals.comboCharts||0===e.length||e.length&&e.indexOf(s.config.series[i].type)>-1)?i:-1);for(let e="asc"===t?0:a.length-1;"asc"===t?e<a.length:e>=0;"asc"===t?e++:e--)if(-1!==a[e]){i=a[e];break}}return i}getBarSeriesIndices(){return this.w.globals.comboCharts?this.w.config.series.map((t,e)=>"bar"===t.type||"column"===t.type?e:-1).filter(t=>-1!==t):this.w.config.series.map((t,e)=>e)}getPreviousPaths(){var t,e,s,i;const a=this.w;if(!a.globals.axisCharts)return void(a.globals.previousPaths=a.seriesData.series);function o(t,e,s){const i=t[e].childNodes,o={type:s,paths:[],realIndex:t[e].getAttribute("data:realIndex")};for(let t=0;t<i.length;t++)if(i[t].hasAttribute("pathTo")){const e=i[t].getAttribute("pathTo");o.paths.push({d:e})}a.globals.previousPaths.push(o)}a.globals.previousPaths=[];["line","area","bar","rangebar","rangeArea","candlestick","radar"].forEach(t=>{const e=(s=t,a.dom.baseEl.querySelectorAll(`.apexcharts-${s}-series .apexcharts-series`));var s;for(let s=0;s<e.length;s++)o(e,s,t)});const r=a.dom.baseEl.querySelectorAll(`.apexcharts-${a.config.chart.type} .apexcharts-series`);if(r.length>0)for(let o=0;o<r.length;o++){const r=a.dom.baseEl.querySelectorAll(`.apexcharts-${a.config.chart.type} .apexcharts-series[data\\:realIndex='${o}'] rect`),n=[];for(let a=0;a<r.length;a++){const o=t=>r[a].getAttribute(t),l={x:parseFloat(null!=(t=o("x"))?t:"0"),y:parseFloat(null!=(e=o("y"))?e:"0"),width:parseFloat(null!=(s=o("width"))?s:"0"),height:parseFloat(null!=(i=o("height"))?i:"0")};n.push({rect:l,color:r[a].getAttribute("color")})}a.globals.previousPaths.push(n)}}clearPreviousPaths(){const t=this.w;t.globals.previousPaths=[],t.globals.allSeriesCollapsed=!1}handleNoData(){const t=this.w,e=t.config.noData,s=new N(this.w);let i=t.globals.svgWidth/2,a=t.globals.svgHeight/2,o="middle";if(t.globals.noData=!0,t.globals.animationEnded=!0,"left"===e.align?(i=10,o="start"):"right"===e.align&&(i=t.globals.svgWidth-10,o="end"),"top"===e.verticalAlign?a=50:"bottom"===e.verticalAlign&&(a=t.globals.svgHeight-50),i+=e.offsetX,a=a+parseInt(e.style.fontSize,10)+2+e.offsetY,void 0!==e.text&&""!==e.text){const r=s.drawText({x:i,y:a,text:e.text,textAnchor:o,fontSize:e.style.fontSize,fontFamily:e.style.fontFamily,foreColor:e.style.color,opacity:1,cssClass:"apexcharts-text-nodata"});t.dom.Paper.add(r)}}setNullSeriesToZeroValues(t){const e=this.w;for(let s=0;s<t.length;s++)if(0===t[s].length)for(let i=0;i<t[e.globals.maxValsInArrayIndex].length;i++)t[s].push(0);return t}hasAllSeriesEqualX(){let t=!0;const e=this.w,s=this.filteredSeriesX();for(let e=0;e<s.length-1;e++)if(s[e][0]!==s[e+1][0]){t=!1;break}return e.globals.allSeriesHasEqualX=t,t}filteredSeriesX(){return this.w.seriesData.seriesX.map(t=>t.length>0?t:[])}}class ht{constructor(t){this.w=t,this.colors=[],this.isColorFn=!1,this.isHeatmapDistributed=this.checkHeatmapDistributed(),this.isBarDistributed=this.checkBarDistributed()}checkHeatmapDistributed(){const{chart:t,plotOptions:e}=this.w.config;return"treemap"===t.type&&e.treemap&&e.treemap.distributed||"heatmap"===t.type&&e.heatmap&&e.heatmap.distributed}checkBarDistributed(){const{chart:t,plotOptions:e}=this.w.config;return e.bar&&e.bar.distributed&&("bar"===t.type||"rangeBar"===t.type)}init(){this.setDefaultColors()}setDefaultColors(){var t;const e=this.w,s=new m;e.dom.elWrap.classList.add(`apexcharts-theme-${e.config.theme.mode||"light"}`);const i=null==(t=e.config.theme.accessibility)?void 0:t.colorBlindMode;if(i){e.globals.colors=this.getColorBlindColors(i),this.applySeriesColors(e.seriesData.seriesColors,e.globals.colors);const t=e.globals.colors.slice();return this.pushExtraColors(e.globals.colors),this.applyColorTypes(["fill","stroke"],t),this.applyDataLabelsColors(t),this.applyRadarPolygonsColors(),this.applyMarkersColors(t),void("highContrast"===i&&e.dom.elWrap.classList.add("apexcharts-high-contrast"))}const a=[...e.config.colors||e.config.fill.colors||[]];e.globals.colors=this.getColors(a),this.applySeriesColors(e.seriesData.seriesColors,e.globals.colors),e.config.theme.monochrome.enabled&&(e.globals.colors=this.getMonochromeColors(e.config.theme.monochrome,e.seriesData.series,s));const o=e.globals.colors.slice();this.pushExtraColors(e.globals.colors),this.applyColorTypes(["fill","stroke"],o),this.applyDataLabelsColors(o),this.applyRadarPolygonsColors(),this.applyMarkersColors(o)}getColors(t){const e=this.w;return t&&0!==t.length?Array.isArray(t)&&t.length>0&&"function"==typeof t[0]?(this.isColorFn=!0,e.config.series.map((s,i)=>{const a=t[i]||t[0];return"function"==typeof a?a({value:e.globals.axisCharts?e.seriesData.series[i][0]||0:e.seriesData.series[i],seriesIndex:i,dataPointIndex:i,w:this.w}):a})):t:this.predefined()}applySeriesColors(t,e){t.forEach((t,s)=>{t&&(e[s]=t)})}getMonochromeColors(t,e,s){const{color:i,shadeIntensity:a,shadeTo:o}=t,r=this.isBarDistributed||this.isHeatmapDistributed?e[0].length*e.length:e.length,n=1/(r/a);let l=0;return Array.from({length:r},()=>{const t="dark"===o?s.shadeColor(-1*l,i):s.shadeColor(l,i);return l+=n,t})}applyColorTypes(t,e){const s=this.w;t.forEach(t=>{s.globals[t].colors=void 0===s.config[t].colors?this.isColorFn?s.config.colors:e:s.config[t].colors.slice(),this.pushExtraColors(s.globals[t].colors)})}applyDataLabelsColors(t){const e=this.w;e.globals.dataLabels.style.colors=void 0===e.config.dataLabels.style.colors?t:e.config.dataLabels.style.colors.slice(),this.pushExtraColors(e.globals.dataLabels.style.colors,50)}applyRadarPolygonsColors(){const t=this.w;t.globals.radarPolygons.fill.colors=void 0===t.config.plotOptions.radar.polygons.fill.colors?["dark"===t.config.theme.mode?"#343A3F":"none"]:t.config.plotOptions.radar.polygons.fill.colors.slice(),this.pushExtraColors(t.globals.radarPolygons.fill.colors,20)}applyMarkersColors(t){const e=this.w;e.globals.markers.colors=void 0===e.config.markers.colors?t:e.config.markers.colors.slice(),this.pushExtraColors(e.globals.markers.colors)}pushExtraColors(t,e,s=null){const i=this.w;let a=e||i.seriesData.series.length;if(null===s&&(s=this.isBarDistributed||this.isHeatmapDistributed||"heatmap"===i.config.chart.type&&i.config.plotOptions.heatmap&&i.config.plotOptions.heatmap.colorScale.inverse),s&&i.seriesData.series.length&&(a=i.seriesData.series[i.globals.maxValsInArrayIndex].length*i.seriesData.series.length),t.length<a){const e=a-t.length;for(let s=0;s<e;s++)t.push(t[s])}}getColorBlindColors(t){const e={palette1:["#008FFB","#00A86F","#CA8501","#FF4560","#846DD5"],palette2:["#6978CB","#039DE2","#49A84D","#B39105","#D68000"],palette3:["#209FCC","#648291","#D4526E","#0FA783","#A19285"],palette4:["#2FA59D","#73A20B","#099DE1","#FD5D5D","#648291"],palette5:["#2B908F","#F56566","#2EAB16","#FA4443","#1EA2BD"],palette6:["#449DD1","#F86624","#EA3A4A","#9C63D1","#899E2A"],palette7:["#DF475B","#1B998B","#7E75B7","#F46036","#B1911B"],palette8:["#9C63D1","#F86624","#B38F04","#EA3A4A","#2FA2B3"],palette9:["#98776F","#A19285","#A8705E","#BA6560","#A0927F"],palette10:["#C91EFF","#A94BFD","#6C6AFE","#2983FF","#009ED8"],cvdDeuteranopia:["#0072B2","#E69F00","#56B4E9","#009E73","#F0E442","#D55E00","#CC79A7"],cvdProtanopia:["#0077BB","#EE7733","#009988","#EE3377","#BBBBBB","#33BBEE","#CC3311"],cvdTritanopia:["#CC3311","#009988","#EE7733","#0077BB","#EE3377","#BBBBBB","#33BBEE"],highContrast:["#005A9C","#C00000","#007A33","#6C3483","#7B3F00","#0097A7","#4A235A"]};return({deuteranopia:e.cvdDeuteranopia,protanopia:e.cvdProtanopia,tritanopia:e.cvdTritanopia,highContrast:e.highContrast}[t]||e.palette1).slice()}updateThemeOptions(t){t.chart=t.chart||{},t.tooltip=t.tooltip||{};const e=t.theme.mode,s="dark"===e?"palette4":"light"===e?"palette1":t.theme.palette||"palette1",i="dark"===e?"#f6f7f8":"light"===e?"#373d3f":t.chart.foreColor||"#373d3f";return t.tooltip.theme=e||"light",t.chart.foreColor=i,t.theme.palette=s,t}predefined(){const t={palette1:["#008FFB","#00A86F","#CA8501","#FF4560","#846DD5"],palette2:["#6978CB","#039DE2","#49A84D","#B39105","#D68000"],palette3:["#209FCC","#648291","#D4526E","#0FA783","#A19285"],palette4:["#2FA59D","#73A20B","#099DE1","#FD5D5D","#648291"],palette5:["#2B908F","#F56566","#2EAB16","#FA4443","#1EA2BD"],palette6:["#449DD1","#F86624","#EA3A4A","#9C63D1","#899E2A"],palette7:["#DF475B","#1B998B","#7E75B7","#F46036","#B1911B"],palette8:["#9C63D1","#F86624","#B38F04","#EA3A4A","#2FA2B3"],palette9:["#98776F","#A19285","#A8705E","#BA6560","#A0927F"],palette10:["#C91EFF","#A94BFD","#6C6AFE","#2983FF","#009ED8"],cvdDeuteranopia:["#0072B2","#E69F00","#56B4E9","#009E73","#F0E442","#D55E00","#CC79A7"],cvdProtanopia:["#0077BB","#EE7733","#009988","#EE3377","#BBBBBB","#33BBEE","#CC3311"],cvdTritanopia:["#CC3311","#009988","#EE7733","#0077BB","#EE3377","#BBBBBB","#33BBEE"],highContrast:["#005A9C","#C00000","#007A33","#6C3483","#7B3F00","#0097A7","#4A235A"]};return t[this.w.config.theme.palette]||t.palette1}}class ct{constructor(t){this.w=t}draw(){this.drawTitleSubtitle("title"),this.drawTitleSubtitle("subtitle")}drawTitleSubtitle(t){const e=this.w,s="title"===t?e.config.title:e.config.subtitle;let i=e.globals.svgWidth/2,a=s.offsetY,o="middle";if("left"===s.align?(i=10,o="start"):"right"===s.align&&(i=e.globals.svgWidth-10,o="end"),i+=s.offsetX,a=a+parseInt(s.style.fontSize,10)+s.margin/2,void 0!==s.text){const r=new N(this.w).drawText({x:i,y:a,text:s.text,textAnchor:o,fontSize:s.style.fontSize,fontFamily:s.style.fontFamily,fontWeight:s.style.fontWeight,foreColor:s.style.color,opacity:1});r.node.setAttribute("class",`apexcharts-${t}-text`),e.dom.Paper.add(r)}}}let dt=class{constructor(t){this.w=t.w,this.dCtx=t}getTitleSubtitleCoords(t){const e=this.w;let s=0,i=0;const a="title"===t?e.config.title.floating:e.config.subtitle.floating,o=e.dom.baseEl.querySelector(`.apexcharts-${t}-text`);if(null!==o&&!a){const t=o.getBoundingClientRect();s=t.width,i=e.globals.axisCharts?t.height+5:t.height}return{width:s,height:i}}getLegendsRect(){const t=this.w,e=t.dom.elLegendWrap;t.config.legend.height||"top"!==t.config.legend.position&&"bottom"!==t.config.legend.position||e&&(e.style.maxHeight=t.globals.svgHeight/2+"px");const s=Object.assign({},m.getBoundingClientRect(e));return null!==e&&!t.config.legend.floating&&t.config.legend.show?this.dCtx.lgRect={x:s.x,y:s.y,height:s.height,width:0===s.height?0:s.width}:this.dCtx.lgRect={x:0,y:0,height:0,width:0},"left"!==t.config.legend.position&&"right"!==t.config.legend.position||1.5*this.dCtx.lgRect.width>t.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}getDatalabelsRect(){const t=this.w,e=[];t.config.series.forEach((s,i)=>{s.data.forEach((s,a)=>{const o=(r=t.seriesData.series[i][a],t.config.dataLabels.formatter(r,{seriesIndex:i,dataPointIndex:a,w:t}));var r;e.push(o)})});const s=m.getLargestStringFromArr(e),i=new N(this.w),a=t.config.dataLabels.style,o=i.getTextRects(s,parseInt(a.fontSize).toString(),a.fontFamily);return{width:1.05*o.width,height:o.height}}getLargestStringFromMultiArr(t,e){let s=t;if(this.w.axisFlags.isMultiLineX){const t=e.map(t=>Array.isArray(t)?t.length:1),i=Math.max(...t);s=e[t.indexOf(i)]}return s}};class gt{constructor(t){this.w=t.w,this.dCtx=t}getxAxisLabelsCoords(){const t=this.w;let e,s=t.labelData.labels.slice();if(t.config.xaxis.convertedCatToNumeric&&0===s.length&&(s=t.labelData.categoryLabels),t.labelData.timescaleLabels.length>0){const s=this.getxAxisTimeScaleLabelsCoords();e={width:s.width,height:s.height},t.layout.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==t.config.legend.position&&"right"!==t.config.legend.position||t.config.legend.floating?0:this.dCtx.lgRect.width;const i=t.formatters.xLabelFormatter;let a=m.getLargestStringFromArr(s),o=this.dCtx.dimHelpers.getLargestStringFromMultiArr(a,s);t.globals.isBarHorizontal&&(a=t.globals.yAxisScale[0].result.reduce((t,e)=>t.length>e.length?t:e,0),o=a);const r=new w(this.w),n=a;a=r.xLabelFormat(i,a,n,{i:void 0,dateFormatter:new y(this.w).formatDate,w:t}),o=r.xLabelFormat(i,o,n,{i:void 0,dateFormatter:new y(this.w).formatDate,w:t}),(t.config.xaxis.convertedCatToNumeric&&void 0===a||""===String(a).trim())&&(a="1",o=a);const l=new N(this.w);let h=l.getTextRects(a,t.config.xaxis.labels.style.fontSize),c=h;if(a!==o&&(c=l.getTextRects(o,t.config.xaxis.labels.style.fontSize)),e={width:h.width>=c.width?h.width:c.width,height:h.height>=c.height?h.height:c.height},e.width*s.length>t.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==t.config.xaxis.labels.rotate||t.config.xaxis.labels.rotateAlways){if(!t.globals.isBarHorizontal){t.layout.rotateXLabels=!0;const s=e=>l.getTextRects(e,t.config.xaxis.labels.style.fontSize,t.config.xaxis.labels.style.fontFamily,`rotate(${t.config.xaxis.labels.rotate} 0 0)`,!1);h=s(a),a!==o&&(c=s(o)),e.height=(h.height>c.height?h.height:c.height)/1.5,e.width=h.width>c.width?h.width:c.width}}else t.layout.rotateXLabels=!1}return t.config.xaxis.labels.show||(e={width:0,height:0}),{width:e.width,height:e.height}}getxAxisGroupLabelsCoords(){var t;const e=this.w;if(!e.labelData.hasXaxisGroups)return{width:0,height:0};const s=(null==(t=e.config.xaxis.group.style)?void 0:t.fontSize)||e.config.xaxis.labels.style.fontSize,i=e.labelData.groups.map(t=>t.title);let a;const o=m.getLargestStringFromArr(i),r=this.dCtx.dimHelpers.getLargestStringFromMultiArr(o,i),n=new N(this.w),l=n.getTextRects(o,s);let h=l;return o!==r&&(h=n.getTextRects(r,s)),a={width:l.width>=h.width?l.width:h.width,height:l.height>=h.height?l.height:h.height},e.config.xaxis.labels.show||(a={width:0,height:0}),{width:a.width,height:a.height}}getxAxisTitleCoords(){const t=this.w;let e=0,s=0;if(void 0!==t.config.xaxis.title.text){const i=new N(this.w).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=i.width,s=i.height}return{width:e,height:s}}getxAxisTimeScaleLabelsCoords(){const t=this.w;this.dCtx.timescaleLabels=t.labelData.timescaleLabels.slice();const e=this.dCtx.timescaleLabels.map(t=>t.value),s=e.reduce((t,e)=>void 0===t?0:t.length>e.length?t:e,0),i=new N(this.w).getTextRects(s,t.config.xaxis.labels.style.fontSize);return 1.05*i.width*e.length>t.layout.gridWidth&&0!==t.config.xaxis.labels.rotate&&(t.globals.overlappingXLabels=!0),i}additionalPaddingXLabels(t){const e=this.w,s=e.globals,i=e.config,a=i.xaxis.type,o=t.width;s.skipLastTimelinelabel=!1,s.skipFirstTimelinelabel=!1;const r=e.config.yaxis[0].opposite&&e.globals.isBarHorizontal,n=t=>{if(this.dCtx.timescaleLabels&&this.dCtx.timescaleLabels.length){const a=this.dCtx.timescaleLabels[0],r=this.dCtx.timescaleLabels[this.dCtx.timescaleLabels.length-1].position+o/1.75-this.dCtx.yAxisWidthRight,n=a.position-o/1.75+this.dCtx.yAxisWidthLeft,l="right"===e.config.legend.position&&this.dCtx.lgRect.width>0?this.dCtx.lgRect.width:0;r>s.svgWidth-e.layout.translateX-l&&(s.skipLastTimelinelabel=!0),n<-(t.show&&!t.floating||"bar"!==i.chart.type&&"candlestick"!==i.chart.type&&"rangeBar"!==i.chart.type&&"boxPlot"!==i.chart.type&&"violin"!==i.chart.type?10:o/1.75)&&(s.skipFirstTimelinelabel=!0)}else"datetime"===a?this.dCtx.gridPad.right<o&&!e.layout.rotateXLabels&&(s.skipLastTimelinelabel=!0):"datetime"!==a&&this.dCtx.gridPad.right<o/2-this.dCtx.yAxisWidthRight&&!e.layout.rotateXLabels&&!e.config.xaxis.labels.trim&&(this.dCtx.xPadRight=o/2+1)},l=(t,e)=>{i.yaxis.length>1&&(t=>-1!==s.collapsedSeriesIndices.indexOf(t))(e)||n(t)};i.yaxis.forEach((t,e)=>{r?(this.dCtx.gridPad.left<o&&(this.dCtx.xPadLeft=o/2+1),this.dCtx.xPadRight=o/2+1):l(t,e)})}}class pt{constructor(t){this.w=t.w,this.dCtx=t}getyAxisLabelsCoords(){const t=this.w,e=[];let s=10;const i=new Z(this.w,{theme:this.dCtx.theme,timeScale:this.dCtx.timeScale});return t.config.yaxis.map((a,o)=>{const r={seriesIndex:o,dataPointIndex:-1,w:t},n=t.globals.yAxisScale[o];let l=0;if(!i.isYAxisHidden(o)&&a.labels.show&&void 0!==a.labels.minWidth&&(l=a.labels.minWidth),!i.isYAxisHidden(o)&&a.labels.show&&n.result.length){const i=t.formatters.yLabelFormatters[o],h=n.niceMin===Number.MIN_VALUE?0:n.niceMin;let c=n.result.reduce((t,e)=>{var s,a;return(null==(s=String(i(t,r)))?void 0:s.length)>(null==(a=String(i(e,r)))?void 0:a.length)?t:e},h);c=i(c,r);let d=c;if(void 0!==c&&0!==c.length||(c=n.niceMax),1===String(c).length&&(c+=".0",d=c),t.globals.isBarHorizontal){s=0;const e=t.labelData.labels.slice();c=m.getLargestStringFromArr(e),c=i(c,{seriesIndex:o,dataPointIndex:-1,w:t}),d=this.dCtx.dimHelpers.getLargestStringFromMultiArr(c,e)}const g=new N(this.w),p="rotate(".concat(a.labels.rotate," 0 0)"),u=g.getTextRects(c,a.labels.style.fontSize,a.labels.style.fontFamily,p,!1);let x=u;c!==d&&(x=g.getTextRects(d,a.labels.style.fontSize,a.labels.style.fontFamily,p,!1)),e.push({width:(l>x.width||l>u.width?l:x.width>u.width?x.width:u.width)+s,height:x.height>u.height?x.height:u.height})}else e.push({width:0,height:0})}),e}getyAxisTitleCoords(){const t=this.w,e=[];return t.config.yaxis.map(t=>{if(t.show&&void 0!==t.title.text){const s=new N(this.w),i="rotate(".concat(t.title.rotate," 0 0)"),a=s.getTextRects(t.title.text,t.title.style.fontSize,t.title.style.fontFamily,i,!1);e.push({width:a.width,height:a.height})}else e.push({width:0,height:0})}),e}getTotalYAxisWidth(){const t=this.w;let e=0,s=0,i=0;const a=t.globals.yAxisScale.length>1?10:0,o=new Z(this.w,{theme:this.dCtx.theme,timeScale:this.dCtx.timeScale}),r=(r,n)=>{const l=t.config.yaxis[n].floating;let h=0;r.width>0&&!l?(h=r.width+a,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(n)&&(h=h-r.width-a)):h=l||o.isYAxisHidden(n)?0:5,t.config.yaxis[n].opposite?i+=h:s+=h,e+=h};return t.layout.yLabelsCoords.map((t,e)=>{r(t,e)}),t.layout.yTitleCoords.map((t,e)=>{r(t,e)}),t.globals.isBarHorizontal&&!t.config.yaxis[0].floating&&(e=t.layout.yLabelsCoords[0].width+t.layout.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=s,this.dCtx.yAxisWidthRight=i,e}}class ut{constructor(t){this.w=t.w,this.dCtx=t}gridPadForColumnsInNumericAxis(t){const{w:e}=this,{config:s,globals:i}=e;if(i.noData||i.collapsedSeries.length+i.ancillaryCollapsedSeries.length===s.series.length)return 0;const a=t=>["bar","rangeBar","candlestick","boxPlot","violin"].includes(t),o=s.chart.type;let r=0,n=a(o)?s.series.length:1;i.comboBarCount>0&&(n=i.comboBarCount),i.collapsedSeries.forEach(t=>{a(t.type)&&(n-=1)}),s.chart.stacked&&(n=1);const l=a(o)||i.comboBarCount>0;let h=Math.abs(i.initialMaxX-i.initialMinX);if(l&&e.axisFlags.isXNumeric&&!i.isBarHorizontal&&n>0&&0!==h){h<=3&&(h=i.dataPoints);const e=h/t;let a=i.minXDiff&&i.minXDiff/e>0?i.minXDiff/e:0;a>t/2&&(a/=2),r=a*parseInt(s.plotOptions.bar.columnWidth,10)/100,r<1&&(r=1),i.barPadForNumericAxis=r}return r}gridPadFortitleSubtitle(){const{w:t}=this,{globals:e}=t;let s=this.dCtx.isSparkline||!e.axisCharts?0:10;["title","subtitle"].forEach(i=>{void 0!==t.config[i].text?s+=t.config[i].margin:s+=this.dCtx.isSparkline||!e.axisCharts?0:5}),!t.config.legend.show||"bottom"!==t.config.legend.position||t.config.legend.floating||e.axisCharts||(s+=10);const i=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),a=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");t.layout.gridHeight-=i.height+a.height+s,t.layout.translateY+=i.height+a.height+s}setGridXPosForDualYAxis(t,e){const{w:s}=this,i=new Z(this.w,{theme:this.dCtx.theme,timeScale:this.dCtx.timeScale});s.config.yaxis.forEach((a,o)=>{-1!==s.globals.ignoreYAxisIndexes.indexOf(o)||a.floating||i.isYAxisHidden(o)||(a.opposite&&(s.layout.translateX-=e[o].width+t[o].width+parseInt(a.labels.style.fontSize,10)/1.2+12),s.layout.translateX<2&&(s.layout.translateX=2))})}}class xt{constructor(t,e){this.w=t,this.ctx=e,this.theme=e.theme,this.timeScale=e.timeScale,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new dt(this),this.dimYAxis=new pt(this),this.dimXAxis=new gt(this),this.dimGrid=new ut(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0,this.datalabelsCoords={width:0,height:0},this.xAxisWidth=0,this.timescaleLabels=[]}plotCoords(){const t=this.w,e=t.globals;this.lgRect=this.dimHelpers.getLegendsRect(),this.datalabelsCoords={width:0,height:0};const s=Array.isArray(t.config.stroke.width)?Math.max(...t.config.stroke.width):t.config.stroke.width;this.isSparkline&&((t.config.markers.discrete.length>0||t.config.markers.size>0)&&Object.entries(this.gridPad).forEach(([t,e])=>{this.gridPad[t]=Math.max(e,this.w.globals.markers.largestSize/1.5)}),this.gridPad.top=Math.max(s/2,this.gridPad.top),this.gridPad.bottom=Math.max(s/2,this.gridPad.bottom)),e.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),t.layout.gridHeight=t.layout.gridHeight-this.gridPad.top-this.gridPad.bottom,t.layout.gridWidth=t.layout.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;const i=this.dimGrid.gridPadForColumnsInNumericAxis(t.layout.gridWidth);return t.layout.gridWidth=t.layout.gridWidth-2*i,t.layout.translateX=t.layout.translateX+this.gridPad.left+this.xPadLeft+(i>0?i:0),t.layout.translateY=t.layout.translateY+this.gridPad.top,{layout:{gridHeight:t.layout.gridHeight,gridWidth:t.layout.gridWidth,translateX:t.layout.translateX,translateY:t.layout.translateY,translateXAxisX:t.layout.translateXAxisX,translateXAxisY:t.layout.translateXAxisY,rotateXLabels:t.layout.rotateXLabels,xAxisHeight:t.layout.xAxisHeight,xAxisLabelsHeight:t.layout.xAxisLabelsHeight,xAxisGroupLabelsHeight:t.layout.xAxisGroupLabelsHeight,xAxisLabelsWidth:t.layout.xAxisLabelsWidth,yLabelsCoords:t.layout.yLabelsCoords,yTitleCoords:t.layout.yTitleCoords}}}setDimensionsForAxisCharts(){const t=this.w,e=t.globals,s=this.dimYAxis.getyAxisLabelsCoords(),i=this.dimYAxis.getyAxisTitleCoords();e.isSlopeChart&&(this.datalabelsCoords=this.dimHelpers.getDatalabelsRect()),t.layout.yLabelsCoords=[],t.layout.yTitleCoords=[],t.config.yaxis.map((e,a)=>{t.layout.yLabelsCoords.push({width:s[a].width,index:a}),t.layout.yTitleCoords.push({width:i[a].width,index:a})}),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();const a=this.dimXAxis.getxAxisLabelsCoords(),o=this.dimXAxis.getxAxisGroupLabelsCoords(),r=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(a,r,o),t.layout.translateXAxisY=t.layout.rotateXLabels?this.xAxisHeight/8:-4,t.layout.translateXAxisX=t.layout.rotateXLabels&&t.axisFlags.isXNumeric&&t.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,t.globals.isBarHorizontal&&(t.layout.rotateXLabels=!1,t.layout.translateXAxisY=parseInt(t.config.xaxis.labels.style.fontSize,10)/1.5*-1),t.layout.translateXAxisY=t.layout.translateXAxisY+t.config.xaxis.labels.offsetY,t.layout.translateXAxisX=t.layout.translateXAxisX+t.config.xaxis.labels.offsetX;let n=this.yAxisWidth,l=this.xAxisHeight;t.layout.xAxisLabelsHeight=this.xAxisHeight-r.height,t.layout.xAxisGroupLabelsHeight=t.layout.xAxisLabelsHeight-a.height,t.layout.xAxisLabelsWidth=this.xAxisWidth,t.layout.xAxisHeight=this.xAxisHeight;let h=10;("radar"===t.config.chart.type||this.isSparkline)&&(n=0,l=0),this.isSparkline&&(this.lgRect={height:0,width:0}),(this.isSparkline||"treemap"===t.config.chart.type)&&(n=0,l=0,h=0),this.isSparkline||"treemap"===t.config.chart.type||this.dimXAxis.additionalPaddingXLabels(a);const c=()=>{t.layout.translateX=n+this.datalabelsCoords.width,t.layout.gridHeight=e.svgHeight-this.lgRect.height-l-(this.isSparkline||"treemap"===t.config.chart.type?0:t.layout.rotateXLabels?10:15),t.layout.gridWidth=e.svgWidth-n-2*this.datalabelsCoords.width};switch("top"===t.config.xaxis.position&&(h=t.layout.xAxisHeight-t.config.xaxis.axisTicks.height-5),t.config.legend.position){case"bottom":t.layout.translateY=h,c();break;case"top":t.layout.translateY=this.lgRect.height+h,c();break;case"left":t.layout.translateY=h,t.layout.translateX=this.lgRect.width+n+this.datalabelsCoords.width,t.layout.gridHeight=e.svgHeight-l-12,t.layout.gridWidth=e.svgWidth-this.lgRect.width-n-2*this.datalabelsCoords.width;break;case"right":t.layout.translateY=h,t.layout.translateX=n+this.datalabelsCoords.width,t.layout.gridHeight=e.svgHeight-l-12,t.layout.gridWidth=e.svgWidth-this.lgRect.width-n-2*this.datalabelsCoords.width-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(i,s);new et(this.w,{theme:this.theme,timeScale:this.timeScale}).setYAxisXPosition(s,i)}setDimensionsForNonAxisCharts(){const t=this.w,e=t.globals,s=t.config;let i=0;t.config.legend.show&&!t.config.legend.floating&&(i=20);const a="pie"===s.chart.type||"polarArea"===s.chart.type||"donut"===s.chart.type?"pie":"radialBar",o=s.plotOptions[a].offsetY,r=s.plotOptions[a].offsetX;if(!s.legend.show||s.legend.floating){t.layout.gridHeight=e.svgHeight;const s=t.dom.elWrap.getBoundingClientRect().width;return t.layout.gridWidth=Math.min(s,t.layout.gridHeight),t.layout.translateY=o,void(t.layout.translateX=r+(e.svgWidth-t.layout.gridWidth)/2)}switch(s.legend.position){case"bottom":t.layout.gridHeight=e.svgHeight-this.lgRect.height,t.layout.gridWidth=e.svgWidth,t.layout.translateY=o-10,t.layout.translateX=r+(e.svgWidth-t.layout.gridWidth)/2;break;case"top":t.layout.gridHeight=e.svgHeight-this.lgRect.height,t.layout.gridWidth=e.svgWidth,t.layout.translateY=this.lgRect.height+o+10,t.layout.translateX=r+(e.svgWidth-t.layout.gridWidth)/2;break;case"left":t.layout.gridWidth=e.svgWidth-this.lgRect.width-i,t.layout.gridHeight="auto"!==s.chart.height?e.svgHeight:t.layout.gridWidth,t.layout.translateY=o,t.layout.translateX=r+this.lgRect.width+i;break;case"right":t.layout.gridWidth=e.svgWidth-this.lgRect.width-i-5,t.layout.gridHeight="auto"!==s.chart.height?e.svgHeight:t.layout.gridWidth,t.layout.translateY=o,t.layout.translateX=r+10;break;default:throw new Error("Legend position not supported")}}conditionalChecksForAxisCoords(t,e,s){const i=this.w,a=i.labelData.hasXaxisGroups?2:1,o=s.height+t.height+e.height,r=i.axisFlags.isMultiLineX?1.2:1.618,n=i.layout.rotateXLabels?22:10,l=i.layout.rotateXLabels&&"bottom"===i.config.legend.position?10:0;this.xAxisHeight=o*r+a*n+l,this.xAxisWidth=t.width,this.xAxisHeight-e.height>i.config.xaxis.labels.maxHeight&&(this.xAxisHeight=i.config.xaxis.labels.maxHeight),i.config.xaxis.labels.minHeight&&this.xAxisHeight<i.config.xaxis.labels.minHeight&&(this.xAxisHeight=i.config.xaxis.labels.minHeight),i.config.xaxis.floating&&(this.xAxisHeight=0);let h=0,c=0;i.config.yaxis.forEach(t=>{h+=t.labels.minWidth,c+=t.labels.maxWidth}),this.yAxisWidth<h&&(this.yAxisWidth=h),this.yAxisWidth>c&&(this.yAxisWidth=c)}}const ft=1e3,bt=6e4,mt=36e5,yt=24*mt,wt=7*yt,vt=30*yt,At=365*yt,Ct=10/86400,St=[{unit:"second",step:1,approxMs:ft},{unit:"second",step:5,approxMs:5e3},{unit:"second",step:15,approxMs:15e3},{unit:"second",step:30,approxMs:3e4},{unit:"minute",step:1,approxMs:bt},{unit:"minute",step:5,approxMs:3e5},{unit:"minute",step:15,approxMs:9e5},{unit:"minute",step:30,approxMs:18e5},{unit:"hour",step:1,approxMs:mt},{unit:"hour",step:3,approxMs:3*mt},{unit:"hour",step:6,approxMs:6*mt},{unit:"hour",step:12,approxMs:12*mt},{unit:"day",step:1,approxMs:yt},{unit:"day",step:2,approxMs:2*yt},{unit:"week",step:1,approxMs:wt},{unit:"week",step:2,approxMs:2*wt},{unit:"month",step:1,approxMs:vt},{unit:"month",step:3,approxMs:7776e6},{unit:"month",step:6,approxMs:15552e6},{unit:"year",step:1,approxMs:At},{unit:"year",step:2,approxMs:63072e6},{unit:"year",step:5,approxMs:15768e7},{unit:"year",step:10,approxMs:31536e7},{unit:"year",step:25,approxMs:7884e8},{unit:"year",step:50,approxMs:15768e8},{unit:"year",step:100,approxMs:31536e8}];class kt{constructor(t,e){this.w=t,this.ctx=e,this.tickInterval=null,this.timeScaleArray=[],this.utc=t.config.xaxis.labels.datetimeUTC}calculateTimeScaleTicks(t,e){const s=this.w;if(s.globals.allSeriesCollapsed)return s.labelData.labels=[],s.labelData.timescaleLabels=[],this.timeScaleArray=[],[];const i=e-t,a=i/yt;s.interact.disableZoomIn=!1,s.interact.disableZoomOut=!1,a<Ct?s.interact.disableZoomIn=!0:a>5e4&&(s.interact.disableZoomOut=!0);const o=Number.isFinite(s.config.xaxis.tickAmount)?s.config.xaxis.tickAmount:10;this.tickInterval=function(t,e){(!Number.isFinite(e)||e<=0)&&(e=10);if(t<=0)return St[0];const s=t/e;let i=St[0],a=1/0;for(const t of St){const e=Math.abs(Math.log(t.approxMs/s));e<a&&(a=e,i=t)}return i}(i,o);const r=this.generateBaseTicks(t,e,this.tickInterval);return this.timeScaleArray=r,r}generateBaseTicks(t,e,s){const i=this.w,a=new y(i),o=this.utc,r=i.layout.gridWidth,n=e-t,l=[];let h=a.ceilToBoundary(t,s.unit,s.step,o),c=0;for(;h<=e&&c<5e3;){const e=a.getDateFields(h,o),i=n>0?(h-t)/n*r:0;l.push({timestamp:h,position:i,unit:s.unit,year:e.year,month:e.month+1,day:e.date,hour:e.hour,minute:e.minute,second:e.second,value:h}),h=a.addInterval(h,s.unit,s.step,o),c++}return l}recalcDimensionsBasedOnFormat(t){const e=this.w,s=this.formatDates(t),i=this.removeOverlappingTS(s);e.labelData.timescaleLabels=i.slice();const a=new xt(this.w,this.ctx).plotCoords();this.ctx._writeLayoutCoords(a.layout)}formatDates(t){const e=this.w,s=new y(e),i=e.config.xaxis.labels.format,a=e.config.xaxis.labels.datetimeFormatter,o=this.utc,r=(t,e=2)=>String(t).padStart(e,"0"),n=i||this._effectiveFormat(t,a);return t.map(t=>{const e=s.getDate(t.timestamp),i=s.formatDate(e,n);return{dateString:`${t.year}-${r(t.month)}-${r(t.day)}T${r(t.hour)}:${r(t.minute)}:${r(t.second)}.000${o?"Z":""}`,position:t.position,value:i,unit:t.unit,year:t.year,month:t.month}})}_effectiveFormat(t,e){if(0===t.length)return e.day||"dd MMM";const s=this.tickInterval&&this.tickInterval.unit||t[0].unit,i=e["week"===s?"day":s]||e.day||"dd MMM",a=t[0],o=t[t.length-1],r=a.year!==o.year,n=r||a.month!==o.month||a.day!==o.day,l=/y/i.test(i),h=/M/.test(i),c=/d/i.test(i);if("month"===s||"week"===s)return r&&!l?i+" yyyy":i;if("day"===s)return r&&!l?i+" yyyy":i;if("hour"===s||"minute"===s||"second"===s){if(n&&!c&&!h){return(r?"dd MMM yyyy":"dd MMM")+" "+i}return i}return i}removeOverlappingTS(t){if(0===t.length)return[];const e=this.w,s=new N(e);let i,a=!1;t[0].value&&t.every(e=>e.value.length===t[0].value.length)&&(a=!0,i=s.getTextRects(t[0].value,e.config.xaxis.labels.style.fontSize).width);let o=0;return t.map((r,n)=>{if(0===n)return r;if(!e.config.xaxis.labels.hideOverlappingLabels)return r;const l=a?i:s.getTextRects(t[o].value,e.config.xaxis.labels.style.fontSize).width,h=t[o].position;return r.position>h+l+10?(o=n,r):null}).filter(t=>null!==t)}}const Dt="__apexcharts_registry__";function Lt(){return globalThis[Dt]}function Mt(t){const e=Lt()[t];if(!e)throw new Error(`ApexCharts: chart type "${t}" is not registered. Import it via ApexCharts.use() or use the full apexcharts bundle.`);return e}globalThis[Dt]||(globalThis[Dt]={});class Pt{constructor(t,e,s){this.w=e,this.ctx=s,this.el=t}setupElements(){const{globals:t,config:e}=this.w,s=e.chart.type,i=["line","area","bar","rangeBar","rangeArea","candlestick","boxPlot","violin","scatter","bubble"],a=[...i,"radar","heatmap","treemap"];t.axisCharts=a.includes(s),t.xyCharts=i.includes(s),t.isBarHorizontal=["bar","rangeBar","boxPlot","violin"].includes(s)&&e.plotOptions.bar.horizontal,t.chartClass=`.apexcharts${t.chartID}`,this.w.dom.baseEl=this.el,this.w.dom.elWrap=b.createElementNS("http://www.w3.org/1999/xhtml","div"),N.setAttrs(this.w.dom.elWrap,{id:t.chartClass.substring(1),class:`apexcharts-canvas ${t.chartClass.substring(1)}`}),this.el.appendChild(this.w.dom.elWrap);const o=globalThis.SVG;if(this.w.dom.Paper=o().addTo(this.w.dom.elWrap),this.w.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:`translate(${e.chart.offsetX}, ${e.chart.offsetY})`}),this.w.dom.Paper.node.style.background="dark"!==e.theme.mode||e.chart.background?"light"!==e.theme.mode||e.chart.background?e.chart.background:"#fff":"#343A3F",this.setSVGDimensions(),this.w.dom.elLegendForeign=b.createElementNS(W,"foreignObject"),N.setAttrs(this.w.dom.elLegendForeign,{x:0,y:0,width:t.svgWidth,height:t.svgHeight}),this.w.dom.elLegendWrap=b.createElementNS("http://www.w3.org/1999/xhtml","div"),this.w.dom.elLegendWrap.classList.add("apexcharts-legend"),this.w.dom.elWrap.appendChild(this.w.dom.elLegendWrap),this.w.dom.Paper.node.appendChild(this.w.dom.elLegendForeign),e.chart.accessibility.enabled&&e.chart.accessibility.announcements.enabled){const t=b.createElement("div");t.className="apexcharts-sr-status",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),this.w.dom.elWrap.appendChild(t)}if(e.chart.accessibility.enabled){const t=this.getAccessibleChartLabel(),s=e.chart.accessibility.keyboard.enabled&&e.chart.accessibility.keyboard.navigation.enabled?"application":"img";if(this.w.dom.Paper.attr({role:s,"aria-label":t}),e.chart.accessibility.description){const t=b.createElementNS(W,"desc");t.textContent=e.chart.accessibility.description,this.w.dom.Paper.node.insertBefore(t,this.w.dom.elLegendForeign.nextSibling)}}this.w.dom.elGraphical=this.w.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),this.w.dom.elDefs=this.w.dom.Paper.defs(),this.w.dom.Paper.add(this.w.dom.elGraphical),this.w.dom.elGraphical.add(this.w.dom.elDefs)}plotChartType(t,e){const{w:s,ctx:i}=this,{config:a,globals:o}=s,r={line:{series:[],i:[]},area:{series:[],i:[]},scatter:{series:[],i:[]},bubble:{series:[],i:[]},bar:{series:[],i:[]},candlestick:{series:[],i:[]},boxPlot:{series:[],i:[]},violin:{series:[],i:[]},rangeBar:{series:[],i:[]},rangeArea:{series:[],seriesRangeEnd:[],i:[]}},n=a.chart.type||"line";let l=null,h=0;this.w.seriesData.series.forEach((e,i)=>{var a,o;const c="column"===(null==(a=t[i])?void 0:a.type)?"bar":(null==(o=t[i])?void 0:o.type)||("column"===n?"bar":n),d=r;d[c]?("rangeArea"===c?(d[c].series.push(this.w.rangeData.seriesRangeStart[i]),d[c].seriesRangeEnd.push(this.w.rangeData.seriesRangeEnd[i])):d[c].series.push(e),d[c].i.push(i),"bar"===c&&(s.globals.columnSeries=r.bar)):["heatmap","treemap","pie","donut","polarArea","radialBar","radar"].includes(c)&&(l=c),n!==c&&"scatter"!==c&&h++}),h>0&&r.bar.series.length>0&&a.plotOptions.bar.horizontal&&(h-=r.bar.series.length,r.bar={series:[],i:[]},s.globals.columnSeries={series:[],i:[]}),o.comboCharts||(o.comboCharts=h>0);const c=r.line.series.length>0||r.area.series.length>0||r.scatter.series.length>0||r.bubble.series.length>0||r.rangeArea.series.length>0||!o.comboCharts&&["line","area","scatter","bubble","rangeArea"].includes(a.chart.type)?new(Mt("line"))(i.w,i,e):null,d=r.candlestick.series.length>0||r.boxPlot.series.length>0||!o.comboCharts&&["candlestick","boxPlot"].includes(a.chart.type)?new(Mt("candlestick"))(i.w,i,e):null,g=r.violin.series.length>0||!o.comboCharts&&"violin"===a.chart.type?new(Mt("violin"))(i.w,i,e):null,p=!o.comboCharts&&["pie","donut","polarArea"].includes(a.chart.type);i.pie=p?new(Mt("pie"))(i.w,i):null;const u=r.rangeBar.series.length>0||!o.comboCharts&&"rangeBar"===a.chart.type;i.rangeBar=u?new(Mt("rangeBar"))(i.w,i,e):null;let x=[];if(o.comboCharts){const t=new F(this.w);if(r.area.series.length>0&&x.push(...t.drawSeriesByGroup(r.area,o.areaGroups,"area",c)),r.bar.series.length>0)if(a.chart.stacked){const t=new(Mt("barStacked"))(i.w,i,e);x.push(t.draw(r.bar.series,r.bar.i))}else i.bar=new(Mt("bar"))(i.w,i,e),x.push(i.bar.draw(r.bar.series,r.bar.i));if(r.rangeArea.series.length>0&&x.push(c.draw(r.rangeArea.series,"rangeArea",r.rangeArea.i,r.rangeArea.seriesRangeEnd)),r.line.series.length>0&&x.push(...t.drawSeriesByGroup(r.line,o.lineGroups,"line",c)),r.candlestick.series.length>0&&x.push(d.draw(r.candlestick.series,"candlestick",r.candlestick.i)),r.boxPlot.series.length>0&&x.push(d.draw(r.boxPlot.series,"boxPlot",r.boxPlot.i)),r.violin.series.length>0&&x.push(g.draw(r.violin.series,"violin",r.violin.i)),r.rangeBar.series.length>0&&x.push(i.rangeBar.draw(r.rangeBar.series,r.rangeBar.i)),r.scatter.series.length>0){const t=new(Mt("line"))(i.w,i,e,!0);x.push(t.draw(r.scatter.series,"scatter",r.scatter.i))}if(r.bubble.series.length>0){const t=new(Mt("line"))(i.w,i,e,!0);x.push(t.draw(r.bubble.series,"bubble",r.bubble.i))}}else{const t=a.chart.type;switch(t){case"line":x=c.draw(this.w.seriesData.series,"line");break;case"area":x=c.draw(this.w.seriesData.series,"area");break;case"bar":if(a.chart.stacked){x=new(Mt("barStacked"))(i.w,i,e).draw(this.w.seriesData.series)}else i.bar=new(Mt("bar"))(i.w,i,e),x=i.bar.draw(this.w.seriesData.series);break;case"candlestick":x=d.draw(this.w.seriesData.series,"candlestick");break;case"boxPlot":x=d.draw(this.w.seriesData.series,t);break;case"violin":x=g.draw(this.w.seriesData.series,"violin");break;case"rangeBar":x=i.rangeBar.draw(this.w.seriesData.series);break;case"rangeArea":x=c.draw(this.w.rangeData.seriesRangeStart,"rangeArea",void 0,this.w.rangeData.seriesRangeEnd);break;case"heatmap":x=new(Mt("heatmap"))(i.w,i,e).draw(this.w.seriesData.series);break;case"treemap":x=new(Mt("treemap"))(i.w,i).draw(this.w.seriesData.series);break;case"pie":case"donut":case"polarArea":x=i.pie.draw(this.w.seriesData.series);break;case"radialBar":x=new(Mt("radialBar"))(i.w,i).draw(this.w.seriesData.series);break;case"radar":x=new(Mt("radar"))(i.w,i).draw(this.w.seriesData.series);break;default:x=c.draw(this.w.seriesData.series)}}return x}setSVGDimensions(){var t;const{globals:e,config:s}=this.w;s.chart.width=s.chart.width||"100%",s.chart.height=s.chart.height||"auto";const i=s.chart.width,a=s.chart.height;e.svgWidth=NaN,e.svgHeight=NaN;let o=m.getDimensions(this.el);const r=i.toString().split(/[0-9]+/g).pop();"%"===r?m.isNumber(o[0])&&(0===o[0].width&&(o=m.getDimensions(this.el.parentNode)),e.svgWidth=o[0]*parseInt(i,10)/100):"px"!==r&&""!==r||(e.svgWidth=parseInt(i,10));const n=String(a).toString().split(/[0-9]+/g).pop();if("auto"!==a&&""!==a)if("%"===n){const t=m.getDimensions(this.el.parentNode);e.svgHeight=t[1]*parseInt(a,10)/100}else e.svgHeight=parseInt(a,10);else e.svgHeight=e.axisCharts?e.svgWidth/1.61:e.svgWidth/1.2;if(e.svgWidth=Math.max(e.svgWidth,0),e.svgHeight=Math.max(e.svgHeight,0),N.setAttrs(this.w.dom.Paper.node,{width:e.svgWidth,height:e.svgHeight}),"%"!==n&&c.isBrowser()){const i=e.axisCharts&&(s.grid.show||s.dataLabels.enabled||s.xaxis.labels.show||s.xaxis.axisBorder.show||s.xaxis.axisTicks.show||s.yaxis.some(t=>t.show&&(t.labels.show||t.axisBorder.show||t.axisTicks.show))),a=s.chart.sparkline.enabled||!i?0:s.chart.parentHeightOffset,o=this.w.dom.Paper.node;(null==(t=o.parentNode)?void 0:t.parentNode)&&(o.parentNode.parentNode.style.minHeight=`${e.svgHeight+a}px`)}this.w.dom.elWrap.style.width=`${e.svgWidth}px`,this.w.dom.elWrap.style.height=`${e.svgHeight}px`}shiftGraphPosition(){const{globals:t}=this.w,{translateY:e,translateX:s}=t;N.setAttrs(this.w.dom.elGraphical.node,{transform:`translate(${s}, ${e})`})}resizeNonAxisCharts(){var t,e,s,i,a,o;const{w:r}=this,n=r.config.chart.height?String(r.config.chart.height):"",l=""!==n&&"auto"!==n,h=n.includes("%");let d=0,g=r.config.chart.sparkline.enabled?1:15;g+=r.config.grid.padding.bottom,["top","bottom"].includes(r.config.legend.position)&&r.config.legend.show&&!r.config.legend.floating&&(d=(null!=(e=null==(t=this.ctx.legend)?void 0:t.legendHelpers.getLegendDimensions().clwh)?e:0)+7);const p=r.dom.baseEl.querySelector(".apexcharts-radialbar, .apexcharts-pie");let u=2.05*r.globals.radialSize;const x=Math.abs(r.config.plotOptions.radialBar.endAngle-r.config.plotOptions.radialBar.startAngle);if(p&&!r.config.chart.sparkline.enabled&&x<360){const t=m.getBoundingClientRect(this.w.dom.Paper.node);let e=1/0,n=-1/0;const l=s=>{var i,a,o,r;if(null==(i=s.classList)?void 0:i.contains("apexcharts-radialbar-hollow"))return;const h=null==(o=null==(a=s.tagName)?void 0:a.toLowerCase)?void 0:o.call(a);if("text"===h||"tspan"===h)return;const c=Array.from(null!=(r=s.children)?r:[]);if(c.length>0)return void c.forEach(t=>l(t));const d=m.getBoundingClientRect(s);if(d.bottom-d.top>0){const s=d.top-t.top,i=d.bottom-t.top;s<e&&(e=s),i>n&&(n=i)}};if(Array.from(null!=(s=p.children)?s:[]).forEach(t=>l(t)),Number.isFinite(e)||(e=0),!Number.isFinite(n)){const e=m.getBoundingClientRect(p);n=e.bottom-t.top}const x=Math.max(g,.2*r.globals.radialSize),f=Math.max(x-e,0);0!==f&&(r.layout.translateY=(null!=(i=r.layout.translateY)?i:0)+f,N.setAttrs(this.w.dom.elGraphical.node,{transform:`translate(${null!=(a=r.layout.translateX)?a:0}, ${r.layout.translateY})`}),n+=f),u=n>0?n:2.05*r.globals.radialSize;const b=Math.max(x,e),y=Math.ceil(u+d+b),w=null!=(o=r.config.chart.offsetY)?o:0,v=y+Math.max(w,0);return void(h||(this.w.dom.elLegendForeign&&this.w.dom.elLegendForeign.setAttribute("height",String(v)),this.w.dom.elWrap.style.height=`${v}px`,N.setAttrs(this.w.dom.Paper.node,{height:y}),c.isBrowser()&&(this.w.dom.Paper.node.parentNode.parentNode.style.minHeight=`${v}px`)))}const f=Math.ceil(u+this.w.layout.translateY+d+g);l||(this.w.dom.elLegendForeign&&this.w.dom.elLegendForeign.setAttribute("height",String(f)),this.w.dom.elWrap.style.height=`${f}px`,N.setAttrs(this.w.dom.Paper.node,{height:f}),c.isBrowser()&&(this.w.dom.Paper.node.parentNode.parentNode.style.minHeight=`${f}px`))}coreCalculations(){new tt(this.w).init()}resetGlobals(){const t=()=>this.w.config.series.map(()=>[]),e=new P,{globals:s}=this.w,i={dataWasParsed:this.w.axisFlags.dataWasParsed,originalSeries:s.originalSeries};e.initGlobalVars(s),s.seriesXvalues=t(),s.seriesYvalues=t(),i.dataWasParsed&&(this.w.axisFlags.dataWasParsed=i.dataWasParsed,s.originalSeries=i.originalSeries)}isMultipleY(){return!!(Array.isArray(this.w.config.yaxis)&&this.w.config.yaxis.length>1)&&(this.w.globals.isMultipleYAxis=!0,!0)}xySettings(){const{w:t}=this;let e=null;if(t.globals.axisCharts){if("back"===t.config.xaxis.crosshairs.position&&new ot(this.w).drawXCrosshairs(),"back"===t.config.yaxis[0].crosshairs.position&&new ot(this.w).drawYCrosshairs(),"datetime"===t.config.xaxis.type&&void 0===t.config.xaxis.labels.formatter){this.ctx.timeScale=new kt(this.w,this.ctx);let e=[];isFinite(t.globals.minX)&&isFinite(t.globals.maxX)&&!t.globals.isBarHorizontal?e=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minX,t.globals.maxX):t.globals.isBarHorizontal&&(e=this.ctx.timeScale.calculateTimeScaleTicks(t.globals.minY,t.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(e)}e=new F(this.w).getCalculatedRatios()}return e}updateSourceChart(t){this.ctx.w.interact.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}setupBrushHandler(){const{ctx:t,w:e}=this;if(e.config.chart.brush.enabled&&"function"!=typeof e.config.chart.events.selection){const s=Array.isArray(e.config.chart.brush.targets)?e.config.chart.brush.targets:[e.config.chart.brush.target];s.forEach(e=>{const s=t.constructor.getChartByID(e);s.w.globals.brushSource=this.ctx,"function"!=typeof s.w.config.chart.events.zoomed&&(s.w.config.chart.events.zoomed=()=>this.updateSourceChart(s)),"function"!=typeof s.w.config.chart.events.scrolled&&(s.w.config.chart.events.scrolled=()=>this.updateSourceChart(s))}),e.config.chart.events.selection=(e,i)=>{s.forEach(e=>{t.constructor.getChartByID(e).ctx.updateHelpers._updateOptions({xaxis:{min:i.xaxis.min,max:i.xaxis.max}},!1,!1,!1,!1)})}}}getAccessibleChartLabel(){const t=this.w,e=t.config;if(e.chart.accessibility&&e.chart.accessibility.description)return e.chart.accessibility.description;const s=e.chart.type,i=[];if(e.title.text)i.push(`${e.title.text}. ${s} chart`),e.subtitle.text&&i.push(e.subtitle.text);else{const a=Array.isArray(t.seriesData.seriesNames)&&t.seriesData.seriesNames.length?t.seriesData.seriesNames.filter(Boolean):Array.isArray(e.series)?e.series.map(t=>"object"==typeof t&&null!==t?t.name:null).filter(Boolean):[],o=t.seriesData.series.length||(e.series?e.series.length:0);a.length?i.push(`${s} chart with ${o} data series: ${a.join(", ")}`):i.push(`${s} chart with ${o} data series`)}return i.join(". ")}}class Tt{constructor(t,{resetGlobals:e=()=>{},isMultipleY:s=()=>{}}={}){this.w=t,this.resetGlobals=e,this.isMultipleY=s,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.seriesGoals=[],this.coreUtils=new F(this.w),this.activeSeriesIndex=0}getFirstDataPoint(){const t=this.w.config.series,e=new lt(this.w);this.activeSeriesIndex=e.getActiveConfigSeriesIndex();const s=t[this.activeSeriesIndex];return s&&s.data&&s.data.length>0&&null!==s.data[0]&&void 0!==s.data[0]?s.data[0]:null}isMultiFormat(){return this.isFormatXY()||this.isFormat2DArray()}isFormatXY(){var t;const e=this.getFirstDataPoint();if(!e||void 0===e.x)return!1;const s=null==(t=this.w.config.series[this.activeSeriesIndex])?void 0:t.data;if(s){const t=t=>t&&void 0!==t.x;for(let e=1;e<Math.min(3,s.length)&&!0===t(s[e]);e++);}return!0}isFormat2DArray(){const t=this.getFirstDataPoint();return t&&Array.isArray(t)}handleFormat2DArray(t,e){const s=this.w.config,i=t[e].data,a="boxPlot"===s.chart.type||"boxPlot"===s.series[e].type;for(let t=0;t<i.length;t++){const e=i[t],o=e[0],r=e[1],n=e[2];if(void 0!==r&&(Array.isArray(r)&&4===r.length&&!a?this.twoDSeries.push(m.parseNumber(r[3])):e.length>=5?this.twoDSeries.push(m.parseNumber(e[4])):this.twoDSeries.push(m.parseNumber(r)),this.w.axisFlags.dataFormatXNumeric=!0),"datetime"===s.xaxis.type){const t=new Date(o).getTime();this.twoDSeriesX.push(t)}else this.twoDSeriesX.push(o);void 0!==n&&(this.threeDSeries.push(n),this.w.axisFlags.isDataXYZ=!0)}}handleFormatXY(t,e){const s=this.w.config,i=this.w.globals,a=new y(this.w),o=t[e].data;let r=e;i.collapsedSeriesIndices.indexOf(e)>-1&&(r=this.activeSeriesIndex);const n=t[r].data;for(let t=0;t<o.length;t++){const s=o[t];if(void 0!==s.y){const t=Array.isArray(s.y)?m.parseNumber(s.y[s.y.length-1]):m.parseNumber(s.y);this.twoDSeries.push(t)}void 0===this.seriesGoals[e]&&(this.seriesGoals[e]=[]),void 0!==s.goals&&Array.isArray(s.goals)?this.seriesGoals[e].push(s.goals):this.seriesGoals[e].push(null),void 0!==s.z&&(this.threeDSeries.push(s.z),this.w.axisFlags.isDataXYZ=!0)}for(let t=0;t<n.length;t++){const e=n[t].x,o="string"==typeof e,r=Array.isArray(e),l=!r&&!!a.isValidDate(e);if(o||l)if(o||s.xaxis.convertedCatToNumeric){const t=i.isBarHorizontal&&this.w.axisFlags.isRangeData;"datetime"!==s.xaxis.type||t?(this.fallbackToCategory=!0,this.twoDSeriesX.push(e),isNaN(e)||"category"===this.w.config.xaxis.type||"string"==typeof e||(this.w.axisFlags.isXNumeric=!0)):this.twoDSeriesX.push(a.parseDate(e))}else"datetime"===s.xaxis.type?this.twoDSeriesX.push(a.parseDate(e.toString())):(this.w.axisFlags.dataFormatXNumeric=!0,this.w.axisFlags.isXNumeric=!0,this.twoDSeriesX.push(parseFloat(e)));else r?(this.fallbackToCategory=!0,this.twoDSeriesX.push(e)):(this.w.axisFlags.isXNumeric=!0,this.w.axisFlags.dataFormatXNumeric=!0,this.twoDSeriesX.push(e))}}handleRangeData(t,e){let s={start:[],end:[],rangeUniques:[]};return this.isFormat2DArray()?s=this.handleRangeDataFormat("array",t,e):this.isFormatXY()&&(s=this.handleRangeDataFormat("xy",t,e)),this.w.rangeData.seriesRangeStart[e]=void 0===s.start?[]:s.start,this.w.rangeData.seriesRangeEnd[e]=void 0===s.end?[]:s.end,this.w.rangeData.seriesRange[e]=s.rangeUniques,this.w.rangeData.seriesRange.forEach(t=>{t&&t.forEach(t=>{const e=t.y,s=e.length;if(!(s<=1))for(let i=0;i<s;i++){const a=e[i],o=a.y1,r=a.y2;for(let n=i+1;n<s;n++){const s=e[n],i=s.y1;if(o<=s.y2&&i<=r){const e=t;e.overlaps.add(a.rangeName),e.overlaps.add(s.rangeName)}}}})}),s}handleCandleStickBoxData(t,e){let s={o:[],h:[],m:[],l:[],c:[]};return this.isFormat2DArray()?s=this.handleCandleStickBoxDataFormat("array",t,e):this.isFormatXY()&&(s=this.handleCandleStickBoxDataFormat("xy",t,e)),this.w.candleData.seriesCandleO[e]=s.o,this.w.candleData.seriesCandleH[e]=s.h,this.w.candleData.seriesCandleM[e]=s.m,this.w.candleData.seriesCandleL[e]=s.l,this.w.candleData.seriesCandleC[e]=s.c,this.w.candleData.seriesBoxPoints[e]=s.points||[],s}handleViolinData(t,e){var s,i,a,o,r,n;const l=this.w,h=t[e].data,c=[],d=[],g=[],p=[],u=[];for(let t=0;t<h.length;t++){const e=h[t],l=null!=(a=null!=(i=null==(s=null==e?void 0:e.y)?void 0:s.density)?i:null==e?void 0:e[1])?a:[],x=null!=(n=null!=(r=null==(o=null==e?void 0:e.y)?void 0:o.points)?r:null==e?void 0:e[2])?n:[],f=[],b=[];let y=0,w=null,v=1/0,A=-1/0;for(let t=0;t<l.length;t++){const e=m.parseNumber(l[t][0]),s=m.parseNumber(l[t][1]);null!==e&&null!==s&&(f.push(e),b.push(s),s>y&&(y=s,w=e),e<v&&(v=e),e>A&&(A=e))}const C=[];for(let t=0;t<x.length;t++){const e=m.parseNumber(x[t]);null!==e&&(C.push(e),e<v&&(v=e),e>A&&(A=e))}c.push({values:f,weights:b,maxWeight:y}),d.push(C),g.push(v===1/0?0:v),p.push(A===-1/0?0:A),u.push(null!==w?w:C.length?C[Math.floor(C.length/2)]:0)}l.violinData.seriesViolinDensity[e]=c,l.violinData.seriesViolinPoints[e]=d,l.violinData.seriesViolinMin[e]=g,l.violinData.seriesViolinMax[e]=p,this.twoDSeries=u}handleRangeDataFormat(t,e,s){const i=[],a=[],o=new Map,r=[];if(e[s].data.forEach(t=>{if(!o.has(t.x)){const e={x:t.x,overlaps:new Set,y:[]};o.set(t.x,e),r.push(e)}}),"array"===t)for(let t=0;t<e[s].data.length;t++)Array.isArray(e[s].data[t])?(i.push(e[s].data[t][1][0]),a.push(e[s].data[t][1][1])):(i.push(e[s].data[t]),a.push(e[s].data[t]));else if("xy"===t)for(let t=0;t<e[s].data.length;t++){const r=Array.isArray(e[s].data[t].y),n=m.randomId(),l=e[s].data[t].x,h={y1:r?e[s].data[t].y[0]:e[s].data[t].y,y2:r?e[s].data[t].y[1]:e[s].data[t].y,rangeName:n};e[s].data[t].rangeName=n;const c=o.get(l);c&&c.y.push(h),i.push(h.y1),a.push(h.y2)}return{start:i,end:a,rangeUniques:r}}handleCandleStickBoxDataFormat(t,e,s){const i=this.w,a="boxPlot"===i.config.chart.type||"boxPlot"===i.config.series[s].type,o=[],r=[],n=[],l=[],h=[],c=[],d=e[s].data;let g;if("array"===t){g=a&&6===d[0].length||!a&&5===d[0].length?t=>t.slice(1):t=>Array.isArray(t[1])?t[1]:[]}else g=t=>Array.isArray(t.y)?t.y:[];for(let t=0;t<d.length;t++){const e=g(d[t]);e&&e.length>=2&&(o.push(e[0]),r.push(e[1]),a?(n.push(e[2]),l.push(e[3]),h.push(e[4])):(l.push(e[2]),h.push(e[3])));const s=d[t]&&d[t].points;c.push(Array.isArray(s)?s:[])}return{o:o,h:r,m:n,l:l,c:h,points:c}}parseDataAxisCharts(t){var e,s,i,a,o,r;const h=this.w.config,c=this.w.globals,d=new y(this.w),g=h.labels.length>0?h.labels.slice():h.xaxis.categories.slice();this.w.axisFlags.isRangeBar="rangeBar"===h.chart.type&&c.isBarHorizontal,this.w.labelData.hasXaxisGroups="category"===h.xaxis.type&&h.xaxis.group.groups.length>0,this.w.labelData.hasXaxisGroups&&(this.w.labelData.groups=h.xaxis.group.groups),t.forEach((t,e)=>{void 0!==t.name?this.w.seriesData.seriesNames.push(t.name):this.w.seriesData.seriesNames.push("series-"+parseInt(String(e+1),10))}),this.coreUtils.setSeriesYAxisMappings();const p=[],u=[...new Set(h.series.map(t=>t.group))];h.series.forEach((t,e)=>{const s=u.indexOf(t.group);p[s]||(p[s]=[]),p[s].push(this.w.seriesData.seriesNames[e])}),this.w.labelData.seriesGroups=p;const x=()=>{for(let t=0;t<g.length;t++)if("string"==typeof g[t]){if(!d.isValidDate(g[t]))throw new Error("You have provided invalid Date format. Please provide a valid JavaScript Date");this.twoDSeriesX.push(d.parseDate(g[t]))}else this.twoDSeriesX.push(g[t])};for(let d=0;d<t.length;d++){if(this.twoDSeries=[],this.twoDSeriesX=[],this.threeDSeries=[],void 0===t[d].data)return;const p=h.chart.dataReducer,u=null==(s=null==(e=c.dataReducerRawSeries)?void 0:e[d])?void 0:s.data;if((null==p?void 0:p.enabled)&&this.isMultiFormat()&&Array.isArray(u)&&u.length>(null!=(i=p.threshold)?i:500)){const e=null!=(a=p.targetPoints)?a:250,s=h.xaxis.min,i=h.xaxis.max,c=null==s&&null==i?u:Tt.sliceByXRange(u,s,i);let g=c;if(c.length>e){const t=Array.isArray(c[0])?null==(r=c[0])?void 0:r[1]:null==(o=c[0])?void 0:o.y;Array.isArray(t)?4===t.length&&(g=Tt.ohlcAggregate(c,e)):g=Tt.lttbDownsample(c,e)}t[d]=l(n({},t[d]),{data:g})}if("rangeBar"!==h.chart.type&&"rangeArea"!==h.chart.type&&"rangeBar"!==t[d].type&&"rangeArea"!==t[d].type||(this.w.axisFlags.isRangeData=!0,this.handleRangeData(t,d)),this.isMultiFormat())this.isFormat2DArray()?this.handleFormat2DArray(t,d):this.isFormatXY()&&this.handleFormatXY(t,d),"candlestick"!==h.chart.type&&"candlestick"!==t[d].type&&"boxPlot"!==h.chart.type&&"boxPlot"!==t[d].type||this.handleCandleStickBoxData(t,d),"violin"!==h.chart.type&&"violin"!==t[d].type||this.handleViolinData(t,d),this.w.seriesData.series.push(this.twoDSeries),this.w.labelData.labels.push(this.twoDSeriesX),this.w.seriesData.seriesX.push(this.twoDSeriesX),this.w.seriesData.seriesGoals=this.seriesGoals,d!==this.activeSeriesIndex||this.fallbackToCategory||(this.w.axisFlags.isXNumeric=!0);else{"datetime"===h.xaxis.type?(this.w.axisFlags.isXNumeric=!0,x(),this.w.seriesData.seriesX.push(this.twoDSeriesX)):"numeric"===h.xaxis.type&&(this.w.axisFlags.isXNumeric=!0,g.length>0&&(this.twoDSeriesX=g,this.w.seriesData.seriesX.push(this.twoDSeriesX))),this.w.labelData.labels.push(this.twoDSeriesX);const e=t[d].data.map(t=>m.parseNumber(t));this.w.seriesData.series.push(e)}this.w.seriesData.seriesZ.push(this.threeDSeries),void 0!==t[d].color?this.w.seriesData.seriesColors.push(t[d].color):this.w.seriesData.seriesColors.push(void 0)}return this.w}parseDataNonAxisCharts(t){const e=this.w.config,s=Array.isArray(t)&&t.every(t=>"number"==typeof t)&&e.labels.length>0;Array.isArray(t)&&t.some(t=>t&&"object"==typeof t&&t.data||t&&"object"==typeof t&&t.parsing);if(s){this.w.seriesData.series=t.slice(),this.w.seriesData.seriesNames=e.labels.slice();for(let t=0;t<this.w.seriesData.series.length;t++)void 0===this.w.seriesData.seriesNames[t]&&this.w.seriesData.seriesNames.push("series-"+(t+1));return this.w}if(Array.isArray(t)&&t.every(t=>"number"==typeof t)){this.w.seriesData.series=t.slice(),this.w.seriesData.seriesNames=[];for(let t=0;t<this.w.seriesData.series.length;t++)this.w.seriesData.seriesNames.push(e.labels[t]||`series-${t+1}`);return this.w}const i=this.extractPieDataFromSeries(t);this.w.seriesData.series=i.values,this.w.seriesData.seriesNames=i.labels,"radialBar"===e.chart.type&&(this.w.seriesData.series=this.w.seriesData.series.map(t=>{const e=m.parseNumber(t);return e}));for(let t=0;t<this.w.seriesData.series.length;t++)void 0===this.w.seriesData.seriesNames[t]&&this.w.seriesData.seriesNames.push("series-"+(t+1));return this.w}resetParsingFlags(){const t=this.w;t.axisFlags.dataWasParsed=!1,t.globals.originalSeries=null,t.config.series&&t.config.series.forEach(t=>{t.__apexParsed&&delete t.__apexParsed})}extractPieDataFromSeries(t){const e=[],s=[];if(!Array.isArray(t))return{values:[],labels:[]};if(0===t.length)return{values:[],labels:[]};const i=t[0];return"object"==typeof i&&null!==i&&i.data?(this.extractPieDataFromSeriesObjects(t,e,s),{values:e,labels:s}):{values:[],labels:[]}}extractPieDataFromSeriesObjects(t,e,s){t.forEach((t,i)=>{t.data&&Array.isArray(t.data)&&t.data.forEach(t=>{"object"==typeof t&&null!==t&&void 0!==t.x&&void 0!==t.y&&(s.push(String(t.x)),e.push(m.parseNumber(t.y)))})})}handleExternalLabelsData(t){const e=this.w.config;if(e.xaxis.categories.length>0)this.w.labelData.labels=e.xaxis.categories;else if(e.labels.length>0)this.w.labelData.labels=e.labels.slice();else if(this.fallbackToCategory){if(this.w.labelData.labels=this.w.labelData.labels[0],this.w.rangeData.seriesRange.length){this.w.rangeData.seriesRange.map(t=>{t.forEach(t=>{this.w.labelData.labels.indexOf(t.x)<0&&t.x&&this.w.labelData.labels.push(t.x)})});const t=this.w.labelData.labels;if(t.length>0&&("number"==typeof t[0]||"string"==typeof t[0]))this.w.labelData.labels=[...new Set(t)];else{const e=new Map;for(const s of t){const t=JSON.stringify(s);e.has(t)||e.set(t,s)}this.w.labelData.labels=Array.from(e.values())}}if(e.xaxis.convertedCatToNumeric){new C(e).convertCatToNumericXaxis(e,this.w.seriesData.seriesX[0]),this._generateExternalLabels(t)}}else this._generateExternalLabels(t)}_generateExternalLabels(t){const e=this.w.globals,s=this.w.config;let i=[];if(e.axisCharts){if(this.w.seriesData.series.length>0)if(this.isFormatXY()){const t=s.series.map(t=>{const e=new Map;for(const s of t.data)e.has(s.x)||e.set(s.x,s);return Array.from(e.values())}),e=t.reduce((t,e,s,i)=>i[t].length>e.length?t:s,0);for(let s=0;s<t[e].length;s++)i.push(s+1)}else for(let t=0;t<this.w.seriesData.series[e.maxValsInArrayIndex].length;t++)i.push(t+1);this.w.seriesData.seriesX=[];for(let e=0;e<t.length;e++)this.w.seriesData.seriesX.push(i);this.w.globals.isBarHorizontal||(this.w.axisFlags.isXNumeric=!0)}if(0===i.length){i=e.axisCharts?[]:this.w.seriesData.series.map((t,e)=>e+1);for(let e=0;e<t.length;e++)this.w.seriesData.seriesX.push(i)}this.w.labelData.labels=i,s.xaxis.convertedCatToNumeric&&(this.w.labelData.categoryLabels=i.map(t=>s.xaxis.labels.formatter(t))),this.w.axisFlags.noLabelsProvided=!0}parseRawDataIfNeeded(t){const e=this.w.config,s=this.w.globals,i=e.parsing;if(this.w.axisFlags.dataWasParsed)return t;if(!i&&!t.some(t=>t.parsing))return t;const a=t.map((t,e)=>{var s,a,o;if(!t.data||!Array.isArray(t.data)||0===t.data.length)return t;const r={x:(null==(s=t.parsing)?void 0:s.x)||(null==i?void 0:i.x),y:(null==(a=t.parsing)?void 0:a.y)||(null==i?void 0:i.y),z:(null==(o=t.parsing)?void 0:o.z)||(null==i?void 0:i.z)};if(!r.x&&!r.y)return t;const h=t.data[0];if("object"==typeof h&&null!==h&&(Object.prototype.hasOwnProperty.call(h,"x")||Object.prototype.hasOwnProperty.call(h,"y"))||Array.isArray(h))return t;if(!r.x||!r.y||Array.isArray(r.y)&&0===r.y.length)return t;const c=t.data.map((t,e)=>{if("object"!=typeof t||null===t)return t;const s=this.getNestedValue(t,r.x);let i,a;if(Array.isArray(r.y)){const e=r.y.map(e=>this.getNestedValue(t,e));"bubble"===this.w.config.chart.type?(e.length,i=e[0]):i=e}else i=this.getNestedValue(t,r.y);r.z&&(a=this.getNestedValue(t,r.z));const o={x:s,y:i,z:void 0};if("bubble"===this.w.config.chart.type&&Array.isArray(r.y)&&2===r.y.length){const e=this.getNestedValue(t,r.y[1]);void 0!==e&&(o.z=e)}return void 0!==a&&(o.z=a),o});return l(n({},t),{data:c,__apexParsed:!0})});return this.w.axisFlags.dataWasParsed=!0,s.originalSeries||(s.originalSeries=m.clone(t)),a}getNestedValue(t,e){if(!t||"object"!=typeof t||!e)return;if(-1===e.indexOf("."))return t[e];const s=e.split(".");let i=t;for(let t=0;t<s.length;t++){if(null==i||"object"!=typeof i)return;i=i[s[t]]}return i}parseData(t){var e,s,i,a,o,r;const h=this.w,c=h.config,d=h.globals;if(t=this.parseRawDataIfNeeded(t),(null==(e=c.chart.dataReducer)?void 0:e.enabled)&&d.axisCharts&&!d.dataReducerRawSeries){d.dataReducerRawSeries=t.map(t=>({data:Array.isArray(null==t?void 0:t.data)?t.data.slice():null==t?void 0:t.data}));let e=1/0,r=-1/0;for(const n of t){const t=null==n?void 0:n.data;if(!Array.isArray(t)||0===t.length)continue;const l=!Array.isArray(t[0]),h=l?null==(s=t[0])?void 0:s.x:null==(i=t[0])?void 0:i[0],c=l?null==(a=t[t.length-1])?void 0:a.x:null==(o=t[t.length-1])?void 0:o[0];"number"==typeof h&&(e=Math.min(e,h)),"number"==typeof c&&(r=Math.max(r,c))}e!==1/0&&(d.dataReducerRawMinX=e,d.dataReducerRawMaxX=r)}if(c.series=t,d.dataReducerRawSeries&&(null==(r=c.chart.dataReducer)?void 0:r.enabled)){const e=d.dataReducerRawSeries;d.initialSeries=t.map((t,s)=>{var i,a,o;return l(n({},t),{data:null!=(o=null==(a=null==(i=e[s])?void 0:i.data)?void 0:a.slice())?o:t.data})})}else d.initialSeries=m.clone(t);if(this.excludeCollapsedSeriesInYAxis(),this.fallbackToCategory=!1,this.resetGlobals(),this.isMultipleY(),d.axisCharts?(this.parseDataAxisCharts(t),this.coreUtils.getLargestSeries()):this.parseDataNonAxisCharts(t),c.chart.stacked){const t=new lt(this.w);this.w.seriesData.series=t.setNullSeriesToZeroValues(this.w.seriesData.series)}this.coreUtils.getSeriesTotals(),d.axisCharts&&(this.w.seriesData.stackedSeriesTotals=this.coreUtils.getStackedSeriesTotals(),this.w.seriesData.stackedSeriesTotalsByGroups=this.coreUtils.getStackedSeriesTotalsByGroups()),this.coreUtils.getPercentSeries(),this.w.axisFlags.dataFormatXNumeric||this.w.axisFlags.isXNumeric&&("numeric"!==c.xaxis.type||0!==c.labels.length||0!==c.xaxis.categories.length)||this.handleExternalLabelsData(t);const g=this.coreUtils.getCategoryLabels(this.w.labelData.labels);for(let t=0;t<g.length;t++)if(Array.isArray(g[t])){this.w.axisFlags.isMultiLineX=!0;break}return{seriesData:{series:this.w.seriesData.series,seriesNames:this.w.seriesData.seriesNames,seriesX:this.w.seriesData.seriesX,seriesZ:this.w.seriesData.seriesZ,seriesColors:this.w.seriesData.seriesColors,seriesGoals:this.w.seriesData.seriesGoals,initialSeries:d.initialSeries,originalSeries:d.originalSeries,stackedSeriesTotals:this.w.seriesData.stackedSeriesTotals,stackedSeriesTotalsByGroups:this.w.seriesData.stackedSeriesTotalsByGroups,noLabelsProvided:this.w.axisFlags.noLabelsProvided},rangeData:{seriesRangeStart:this.w.rangeData.seriesRangeStart,seriesRangeEnd:this.w.rangeData.seriesRangeEnd,seriesRange:this.w.rangeData.seriesRange},candleData:{seriesCandleO:this.w.candleData.seriesCandleO,seriesCandleH:this.w.candleData.seriesCandleH,seriesCandleM:this.w.candleData.seriesCandleM,seriesCandleL:this.w.candleData.seriesCandleL,seriesCandleC:this.w.candleData.seriesCandleC,seriesBoxPoints:this.w.candleData.seriesBoxPoints},labelData:{labels:this.w.labelData.labels,categoryLabels:this.w.labelData.categoryLabels},axisFlags:{isXNumeric:this.w.axisFlags.isXNumeric,dataFormatXNumeric:this.w.axisFlags.dataFormatXNumeric,isDataXYZ:this.w.axisFlags.isDataXYZ,isRangeData:this.w.axisFlags.isRangeData,isRangeBar:this.w.axisFlags.isRangeBar,isMultiLineX:this.w.axisFlags.isMultiLineX,dataWasParsed:this.w.axisFlags.dataWasParsed,hasXaxisGroups:this.w.labelData.hasXaxisGroups,groups:this.w.labelData.groups,seriesGroups:this.w.labelData.seriesGroups}}}static sliceByXRange(t,e,s){const i=t.length;if(0===i)return t;const a=!Array.isArray(t[0])?t=>t.x:t=>t[0];let o=0;if(null!=e){let s=0,r=i-1;for(;s<=r;){const i=s+r>>1;a(t[i])<e?s=i+1:r=i-1}o=Math.max(0,s-1)}let r=i;if(null!=s){let e=0,o=i-1;for(;e<=o;){const i=e+o>>1;a(t[i])>s?o=i-1:e=i+1}r=Math.min(i,e+1)}return 0===o&&r===i?t.slice():t.slice(o,r)}static lttbDownsample(t,e){const s=t.length;if(e>=s||e<3)return t;const i=!Array.isArray(t[0]),a=i?t=>t.x:t=>t[0],o=i?t=>t.y:t=>t[1],r=[];r.push(t[0]);const n=(s-2)/(e-2);let l=0;for(let i=0;i<e-2;i++){const e=Math.floor((i+1)*n)+1,h=Math.min(Math.floor((i+2)*n)+1,s);let c=0,d=0;const g=h-e;for(let s=e;s<h;s++)c+=a(t[s]),d+=o(t[s]);c/=g,d/=g;const p=Math.floor(i*n)+1,u=Math.min(Math.floor((i+1)*n)+1,s),x=a(t[l]),f=o(t[l]);let b=-1,m=p;for(let e=p;e<u;e++){const s=.5*Math.abs((x-c)*(o(t[e])-f)-(x-a(t[e]))*(d-f));s>b&&(b=s,m=e)}r.push(t[m]),l=m}return r.push(t[s-1]),r}static ohlcAggregate(t,e){const s=t.length;if(e>=s||e<1)return t;const i=!Array.isArray(t[0]),a=i?t=>t.x:t=>t[0],o=i?t=>t.y:t=>t[1],r=i?(t,e)=>({x:t,y:e}):(t,e)=>[t,e],n=[],l=s/e;for(let i=0;i<e;i++){const h=Math.floor(i*l),c=i===e-1?s:Math.floor((i+1)*l);if(c<=h)continue;const d=o(t[h]),g=d[0];let p=d[1],u=d[2],x=d[3];for(let e=h+1;e<c;e++){const s=o(t[e]);s[1]>p&&(p=s[1]),s[2]<u&&(u=s[2]),x=s[3]}n.push(r(a(t[h]),[g,p,u,x]))}return n}excludeCollapsedSeriesInYAxis(){const t=this.w,e=[];t.globals.seriesYAxisMap.forEach((s,i)=>{let a=0;s.forEach(e=>{-1!==t.globals.collapsedSeriesIndices.indexOf(e)&&a++}),a>0&&a==s.length&&e.push(i)}),t.globals.ignoreYAxisIndexes=e.map(t=>t)}}class Ft{constructor(t,e){this.w=t,this.ctx=e}_updateOptions(t,e=!1,s=!0,i=!0,a=!1){return new Promise(o=>{let r=[this.ctx];i&&(r=this.ctx.getSyncedCharts()),this.w.globals.isExecCalled&&(r=[this.ctx],this.w.globals.isExecCalled=!1),r.forEach((i,n)=>{var l,h;const c=i.w;if(c.globals.shouldAnimate=s,e||(c.globals.resized=!0,c.globals.dataChanged=!0,s&&i.series.getPreviousPaths()),s&&t&&"object"==typeof t){const e=null==(l=null==t?void 0:t.chart)?void 0:l.type,s=c.config.chart.requestedType||c.config.chart.type;e&&e!==s&&(null==(h=i.morphTypeChange)||h.captureBeforeDestroy({fromType:s,toType:e,newSeries:t.series||c.config.series}))}if(t&&"object"==typeof t){i.config=new D(t);const e=t.chart&&t.chart.type,s="funnel"===e||"pyramid"===e||"gauge"===e,o=!!c.config.chart.requestedType;if(e&&!s&&o){t.chart=t.chart||{},t.chart.requestedType=e;const s=c.config.chart.requestedType;"funnel"!==s&&"pyramid"!==s||(t.plotOptions=t.plotOptions||{},t.plotOptions.bar=t.plotOptions.bar||{},void 0===t.plotOptions.bar.isFunnel&&(t.plotOptions.bar.isFunnel=!1),void 0===t.plotOptions.bar.isPyramid&&(t.plotOptions.bar.isPyramid=!1))}if(i.config.normalizeAliasedChartType(t),t=F.extendArrayProps(i.config,t,c),i.w.globals.chartID!==this.w.globals.chartID&&delete t.series,c.config=m.extend(c.config,t),a&&(c.globals.lastXAxis=t.xaxis?m.clone(t.xaxis):[],c.globals.lastYAxis=t.yaxis?m.clone(t.yaxis):[],c.globals.initialConfig=m.extend({},c.config),c.globals.initialSeries=m.clone(c.config.series),t.series)){for(let t=0;t<c.globals.collapsedSeriesIndices.length;t++){const e=c.config.series[c.globals.collapsedSeriesIndices[t]];c.globals.collapsedSeries[t].data=c.globals.axisCharts?e.data.slice():e}for(let t=0;t<c.globals.ancillaryCollapsedSeriesIndices.length;t++){const e=c.config.series[c.globals.ancillaryCollapsedSeriesIndices[t]];c.globals.ancillaryCollapsedSeries[t].data=c.globals.axisCharts?e.data.slice():e}i.series.emptyCollapsedSeries(c.config.series)}}return i.update(t).then(()=>{n===r.length-1&&o(i)})})})}_updateSeries(t,e,s=!1){return new Promise(i=>{const a=this.w;a.globals.shouldAnimate=e,a.globals.dataChanged=!0,q.invalidateSelectors(a),e&&this.ctx.series.getPreviousPaths();const o=a.config.series.length;a.globals.dataReducerRawSeries=null,this.ctx.data.resetParsingFlags();const r=this.ctx.data.parseData(t);return this.ctx._writeParsedSeriesData(r.seriesData),this.ctx._writeParsedRangeData(r.rangeData),this.ctx._writeParsedCandleData(r.candleData),this.ctx._writeParsedLabelData(r.labelData),this.ctx._writeParsedAxisFlags(r.axisFlags),s&&(a.globals.initialConfig&&(a.globals.initialConfig.series=m.clone(a.config.series)),a.globals.initialSeries=m.clone(a.config.series)),this._canUseFastPath(t,o,a)?this.ctx.fastUpdate(e).then(()=>{i(this.ctx)}):this.ctx.update().then(()=>{i(this.ctx)})})}_canUseFastPath(t,e,s){return!!s.dom.elGraphical&&(!!s.globals.axisCharts&&(t.length===e&&(!(s.globals.collapsedSeries.length>0)&&(!(s.globals.ancillaryCollapsedSeries.length>0)&&(!(s.globals.risingSeries.length>0)&&(!s.globals.comboCharts&&!s.interact.zoomed))))))}_extendSeries(t,e){const s=this.w,i=s.config.series[e];return l(n({},s.config.series[e]),{name:t.name?t.name:null==i?void 0:i.name,color:t.color?t.color:null==i?void 0:i.color,type:t.type?t.type:null==i?void 0:i.type,group:t.group?t.group:null==i?void 0:i.group,hidden:void 0!==t.hidden?t.hidden:null==i?void 0:i.hidden,data:t.data?t.data:null==i?void 0:i.data,zIndex:void 0!==t.zIndex?t.zIndex:e})}toggleDataPointSelection(t,e){const s=this.w;let i=null;const a=`.apexcharts-series[data\\:realIndex='${t}']`;if(s.globals.axisCharts?i=s.dom.Paper.findOne(`${a} path[j='${e}'], ${a} circle[j='${e}'], ${a} rect[j='${e}']`):void 0===e&&(i=s.dom.Paper.findOne(`${a} path[j='${t}']`),"pie"!==s.config.chart.type&&"polarArea"!==s.config.chart.type&&"donut"!==s.config.chart.type||this.ctx.pie.pieClicked(t)),!i)return null;new N(this.w).pathMouseDown(i,null);return i.node?i.node:null}forceXAxisUpdate(t){const e=this.w;if(["min","max"].forEach(s=>{void 0!==t.xaxis[s]&&(e.config.xaxis[s]=t.xaxis[s],e.globals.lastXAxis[s]=t.xaxis[s])}),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){const e=new C(t);t=e.convertCatToNumericXaxis(t,this.ctx)}return t}forceYAxisUpdate(t){return t.chart&&t.chart.stacked&&"100%"===t.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((e,s)=>{t.yaxis[s].min=0,t.yaxis[s].max=100}):(t.yaxis.min=0,t.yaxis.max=100)),t}revertDefaultAxisMinMax(t){const e=this.w;let s=e.globals.lastXAxis,i=e.globals.lastYAxis;t&&t.xaxis&&(s=t.xaxis),t&&t.yaxis&&(i=t.yaxis);const a=s;e.config.xaxis.min=a.min,e.config.xaxis.max=a.max;const o=t=>{if(void 0!==i[t]){const s=i[t];e.config.yaxis[t].min=s.min,e.config.yaxis[t].max=s.max}};e.config.yaxis.map((t,s)=>{e.interact.zoomed||void 0!==i[s]?o(s):void 0!==this.ctx.opts.yaxis[s]&&(t.min=this.ctx.opts.yaxis[s].min,t.max=this.ctx.opts.yaxis[s].max)})}}class Et{constructor(t){this.w=t.w,this.ttCtx=t}getNearestValues({hoverArea:t,elGrid:e,clientX:s,clientY:i}){var a,o;const r=this.w,n=e.getBoundingClientRect(),l=n.width,h=n.height;let c=l/(r.globals.dataPoints-1);const d=h/r.globals.dataPoints,g=this.hasBars();!r.globals.comboCharts&&!g||r.config.xaxis.convertedCatToNumeric||(c=l/r.globals.dataPoints);const p=s-n.left-r.globals.barPadForNumericAxis,u=i-n.top;p<0||u<0||p>l||u>h?(t.classList.remove("hovering-zoom"),t.classList.remove("hovering-pan")):r.interact.zoomEnabled?(t.classList.remove("hovering-pan"),t.classList.add("hovering-zoom")):r.interact.panEnabled&&(t.classList.remove("hovering-zoom"),t.classList.add("hovering-pan"));let x=Math.round(p/c);const f=Math.floor(u/d);g&&!r.config.xaxis.convertedCatToNumeric&&(x=Math.ceil(p/c),x-=1);let b=null,y=null,w=r.globals.seriesXvalues.map(t=>t.filter(t=>m.isNumber(t)));const v=r.globals.seriesYvalues.map(t=>t.filter(t=>m.isNumber(t)));if(r.axisFlags.isXNumeric){const t=this.ttCtx.getElGrid();if(!t)return{hoverX:p,hoverY:u};const e=t.getBoundingClientRect(),s=p*(e.width/l),i=u*(e.height/h);y=this.closestInMultiArray(s,i,w,v),b=y.index,x=null!=(a=y.j)?a:0,null!==b&&r.globals.hasNullValues&&(w=r.globals.seriesXvalues[b],y=this.closestInArray(s,w),x=null!=(o=y.j)?o:0)}return r.interact.capturedSeriesIndex=null===b?-1:b,(!x||x<1)&&(x=0),r.globals.isBarHorizontal?r.interact.capturedDataPointIndex=f:r.interact.capturedDataPointIndex=x,{capturedSeries:b,j:r.globals.isBarHorizontal?f:x,hoverX:p,hoverY:u}}getFirstActiveXArray(t){const e=this.w;let s=0;const i=t.map((t,e)=>t.length>0?e:-1);for(let t=0;t<i.length;t++)if(-1!==i[t]&&-1===e.globals.collapsedSeriesIndices.indexOf(t)&&-1===e.globals.ancillaryCollapsedSeriesIndices.indexOf(t)){s=i[t];break}return s}closestInMultiArray(t,e,s,i){const a=this.w,o=t=>-1===a.globals.collapsedSeriesIndices.indexOf(t)&&-1===a.globals.ancillaryCollapsedSeriesIndices.indexOf(t),r=a.config.chart.type,n=!a.globals.comboCharts&&("line"===r||"area"===r);let l=1/0,h=null,c=null;if(a.globals.allSeriesHasEqualX){let a=1/0;for(let e=0;e<s.length;e++){if(!o(e))continue;const r=s[e],n=i[e],l=Math.min(r.length,n.length);for(let e=0;e<l;e++){const s=Math.abs(t-r[e]);s<a&&(a=s,c=e)}}if(null!==c)if(n){let a=1/0;for(let r=0;r<s.length;r++){if(!o(r))continue;const n=s[r],l=i[r],d=Math.min(n.length,l.length);if(d<2){const t=l[c];if("number"!=typeof t)continue;const s=Math.abs(e-t);s<a&&(a=s,h=r);continue}for(let s=0;s<d-1;s++){const i=this._distanceToSegment(t,e,n[s],l[s],n[s+1],l[s+1]);i.dist<a&&(a=i.dist,h=r)}}}else{let t=1/0;for(let a=0;a<s.length;a++){if(!o(a))continue;const s=i[a][c];if("number"!=typeof s)continue;const r=Math.abs(e-s);r<t&&(t=r,h=a)}}return{index:h,j:c}}for(let a=0;a<s.length;a++){if(!o(a))continue;const r=s[a],d=i[a],g=Math.min(r.length,d.length);if(n&&g>=2)for(let s=0;s<g-1;s++){const i=this._distanceToSegment(t,e,r[s],d[s],r[s+1],d[s+1]);i.dist<l&&(l=i.dist,h=a,c=i.t<.5?s:s+1)}else for(let s=0;s<g;s++){const i=t-r[s],o=e-d[s],n=Math.sqrt(i*i+o*o);n<l&&(l=n,h=a,c=s)}}return{index:h,j:c}}_distanceToSegment(t,e,s,i,a,o){const r=a-s,n=o-i,l=r*r+n*n;let h=0===l?0:((t-s)*r+(e-i)*n)/l;h<0?h=0:h>1&&(h=1);const c=t-(s+h*r),d=e-(i+h*n);return{dist:Math.sqrt(c*c+d*d),t:h}}closestInArray(t,e){const s=e[0];let i=null,a=Math.abs(t-s);for(let s=0;s<e.length;s++){const o=Math.abs(t-e[s]);o<a&&(a=o,i=s)}return{j:i}}isXoverlap(t){const e=[],s=this.w.seriesData.seriesX.filter(t=>void 0!==t[0]);if(s.length>0)for(let i=0;i<s.length-1;i++)void 0!==s[i][t]&&void 0!==s[i+1][t]&&s[i][t]!==s[i+1][t]&&e.push("unEqual");return 0===e.length}isInitialSeriesSameLen(){var t,e,s;let i=!0;const a=(null==(t=this.w.globals.initialSeries)?void 0:t.filter((t,e)=>{var s;return!(null==(s=this.w.globals.collapsedSeriesIndices)?void 0:s.includes(e))}))||[];for(let t=0;t<a.length-1;t++){if(!(null==(e=a[t])?void 0:e.data)||!(null==(s=a[t+1])?void 0:s.data))return!0;if(a[t].data.length!==a[t+1].data.length){i=!1;break}}return i}getBarsHeight(t){return[...t].reduce((t,e)=>t+e.getBBox().height,0)}getElMarkers(t){return"number"==typeof t?this.w.dom.baseEl.querySelectorAll(`.apexcharts-series[data\\:realIndex='${t}'] .apexcharts-series-markers-wrap > *`):this.w.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap > *")}getAllMarkers(t=!1){let e=[...this.w.dom.baseEl.querySelectorAll(".apexcharts-series-markers-wrap")];t&&(e=e.filter(t=>{const e=Number(t.getAttribute("data:realIndex"));return-1===this.w.globals.collapsedSeriesIndices.indexOf(e)})),e.sort((t,e)=>{var s=Number(t.getAttribute("data:realIndex")),i=Number(e.getAttribute("data:realIndex"));return i<s?1:i>s?-1:0});const s=[];return e.forEach(t=>{s.push(t.querySelector(".apexcharts-marker"))}),s}hasMarkers(t){return this.getElMarkers(t).length>0}getPathFromPoint(t,e){const s=Number(t.getAttribute("cx")),i=Number(t.getAttribute("cy")),a=t.getAttribute("shape");return new N(this.w).getMarkerPath(s,i,a,e)}getElBars(){return this.w.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-boxPlot-series, .apexcharts-violin-series, .apexcharts-rangebar-series")}hasBars(){return this.getElBars().length>0}getHoverMarkerSize(t){const e=this.w;let s=e.config.markers.hover.size;return void 0===s&&(s=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),s}toggleAllTooltipSeriesGroups(t){const e=this.w,s=this.ttCtx;0===s.allTooltipSeriesGroups.length&&(s.allTooltipSeriesGroups=e.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));const i=s.allTooltipSeriesGroups;for(let s=0;s<i.length;s++)"enable"===t?(i[s].classList.add("apexcharts-active"),i[s].style.display=e.config.tooltip.items.display):(i[s].classList.remove("apexcharts-active"),i[s].style.display="none")}}class It{constructor(t){this.w=t.w,this.ttCtx=t,this.tooltipUtil=new Et(t)}drawSeriesTexts({shared:t=!0,ttItems:e,i:s=0,j:i=null,y1:a,y2:o,e:r}){const n=this.w;void 0!==n.config.tooltip.custom?this.handleCustomTooltip({i:s,j:i,y1:a,y2:o,w:n}):this.toggleActiveInactiveSeries(t,s);const l=this.getValuesToPrint({i:s,j:i});this.printLabels({i:s,j:i,values:l,ttItems:e,shared:t,e:r});const h=this.ttCtx.getElTooltip();h&&(this.ttCtx.tooltipRect.ttWidth=h.getBoundingClientRect().width,this.ttCtx.tooltipRect.ttHeight=h.getBoundingClientRect().height)}printLabels({i:t,j:e,values:s,ttItems:i,shared:a,e:o}){const r=this.w,{xVal:n,zVal:l,xAxisTTVal:h}=s,c=r.seriesData.series.length,d=null!==e&&r.config.plotOptions.bar.distributed?r.globals.colors[e]:r.globals.colors[t];for(let s=0;s<c;s++){const g=r.config.tooltip.inverseOrder?c-1-s:s,p=this.computeSeriesRow({i:t,j:e,t:s,tIndex:g,shared:a,e:o,basePColor:d});this.DOMHandling({i:t,t:g,j:e,ttItems:i,values:{val:p.val,goalVals:p.goalVals,xVal:n,xAxisTTVal:h,zVal:l},seriesName:p.seriesName,shared:a,pColor:p.pColor})}}computeSeriesRow({i:t,j:e,tIndex:s,shared:i,e:a,basePColor:o}){const r=this.w;let h,c=this.getFormatters(t),d=o,g=[],p="treemap"===r.config.chart.type?c.yLbTitleFormatter(String(r.config.series[t].data[e].x),{series:r.seriesData.series,seriesIndex:t,dataPointIndex:e,w:r}):this.getSeriesName({fn:c.yLbTitleFormatter,index:t,seriesIndex:t,j:e});return r.globals.axisCharts&&(i?(c=this.getFormatters(s),p=this.getSeriesName({fn:c.yLbTitleFormatter,index:s,seriesIndex:t,j:e}),d=r.globals.colors[s],h=this.formatYValue(c,s,e),g=this.formatGoalVals(c,s,e)):(d=this.resolvePatternColor(a,d),h=this.formatYValue(c,t,e),g=this.formatGoalVals(c,t,e))),null===e&&(h=c.yLbFormatter(r.seriesData.series[t],l(n({},r),{seriesIndex:t,dataPointIndex:t}))),{seriesName:p,val:h,goalVals:g,pColor:d}}formatYValue(t,e,s){var i,a,o,r;const n=this.w;return n.axisFlags.isRangeData?t.yLbFormatter(null==(a=null==(i=n.rangeData.seriesRangeStart)?void 0:i[e])?void 0:a[s],{series:n.rangeData.seriesRangeStart,seriesIndex:e,dataPointIndex:s,w:n})+" - "+t.yLbFormatter(null==(r=null==(o=n.rangeData.seriesRangeEnd)?void 0:o[e])?void 0:r[s],{series:n.rangeData.seriesRangeEnd,seriesIndex:e,dataPointIndex:s,w:n}):t.yLbFormatter(n.seriesData.series[e][s],{series:n.seriesData.series,seriesIndex:e,dataPointIndex:s,w:n})}formatGoalVals(t,e,s){var i;const a=this.w,o=null==(i=a.seriesData.seriesGoals[e])?void 0:i[s];return Array.isArray(o)?o.map(i=>({attrs:i,val:t.yLbFormatter(i.value,{seriesIndex:e,dataPointIndex:s,w:a})})):[]}resolvePatternColor(t,e){var s,i,a;const o=this.w,r=null==(s=null==t?void 0:t.target)?void 0:s.getAttribute("fill");if(!r)return e;if(-1===r.indexOf("url"))return r;if(-1===r.indexOf("Pattern"))return e;const n=o.dom.baseEl.querySelector(r.substr(4).slice(0,-1));return null!=(a=null==(i=null==n?void 0:n.childNodes[0])?void 0:i.getAttribute("stroke"))?a:e}getFormatters(t){const e=this.w;let s,i=e.formatters.yLabelFormatters[t];return void 0!==e.formatters.ttVal?Array.isArray(e.formatters.ttVal)?(i=e.formatters.ttVal[t]&&e.formatters.ttVal[t].formatter,s=e.formatters.ttVal[t]&&e.formatters.ttVal[t].title&&e.formatters.ttVal[t].title.formatter):(i=e.formatters.ttVal.formatter,"function"==typeof e.formatters.ttVal.title.formatter&&(s=e.formatters.ttVal.title.formatter)):s=e.config.tooltip.y.title.formatter,"function"!=typeof i&&(i=e.formatters.yLabelFormatters[0]?e.formatters.yLabelFormatters[0]:function(t){return t}),"function"!=typeof s&&(s=function(t){return t?t+": ":""}),{yLbFormatter:i,yLbTitleFormatter:s}}getSeriesName({fn:t,index:e,seriesIndex:s,j:i}){const a=this.w;return t(String(a.seriesData.seriesNames[e]),{series:a.seriesData.series,seriesIndex:s,dataPointIndex:i,w:a})}DOMHandling({t:t,j:e,ttItems:s,values:i,seriesName:a,shared:o,pColor:r}){const n=this.w,l=this.ttCtx,{val:h,goalVals:c,xVal:d,xAxisTTVal:g,zVal:p}=i;let u=null;u=s[t].children,n.config.tooltip.fillSeriesColor&&(s[t].style.backgroundColor=r,u[0].style.display="none"),l.showTooltipTitle&&(null===l.tooltipTitle&&(l.tooltipTitle=n.dom.baseEl.querySelector(".apexcharts-tooltip-title")),l.tooltipTitle&&(l.tooltipTitle.innerHTML=d)),l.isXAxisTooltipEnabled&&l.xaxisTooltipText&&(l.xaxisTooltipText.innerHTML=""!==g?g:d);const x=s[t].querySelector(".apexcharts-tooltip-text-y-label");x&&(x.innerHTML=a||"");const f=s[t].querySelector(".apexcharts-tooltip-text-y-value");f&&(f.innerHTML=void 0!==h?h:""),u[0]&&u[0].classList.contains("apexcharts-tooltip-marker")&&(n.config.tooltip.marker.fillColors&&Array.isArray(n.config.tooltip.marker.fillColors)&&(r=n.config.tooltip.marker.fillColors[t]),n.config.tooltip.fillSeriesColor?u[0].style.backgroundColor=r:u[0].style.color=r),n.config.tooltip.marker.show||(u[0].style.display="none");const b=s[t].querySelector(".apexcharts-tooltip-text-goals-label"),m=s[t].querySelector(".apexcharts-tooltip-text-goals-value");if(c.length&&n.seriesData.seriesGoals[t]){const s=()=>{let t="<div>",e="<div>";c.forEach(s=>{t+=` <div style="display: flex"><span class="apexcharts-tooltip-marker" style="background-color: ${s.attrs.strokeColor}; height: 3px; border-radius: 0; top: 5px;"></span> ${s.attrs.name}</div>`,e+=`<div>${s.val}</div>`}),b.innerHTML=t+"</div>",m.innerHTML=e+"</div>"};o?n.seriesData.seriesGoals[t][e]&&Array.isArray(n.seriesData.seriesGoals[t][e])?s():(b.innerHTML="",m.innerHTML=""):s()}else b.innerHTML="",m.innerHTML="";if(null!==p){s[t].querySelector(".apexcharts-tooltip-text-z-label").innerHTML=n.config.tooltip.z.title;s[t].querySelector(".apexcharts-tooltip-text-z-value").innerHTML=void 0!==p?p:""}if(o&&u[0]){if(n.config.tooltip.hideEmptySeries){const e=s[t].querySelector(".apexcharts-tooltip-marker"),i=s[t].querySelector(".apexcharts-tooltip-text");0==parseFloat(h)?(e.style.display="none",i.style.display="none"):(e.style.display="block",i.style.display="block")}null==h||n.globals.ancillaryCollapsedSeriesIndices.indexOf(t)>-1||n.globals.collapsedSeriesIndices.indexOf(t)>-1||Array.isArray(l.tConfig.enabledOnSeries)&&-1===l.tConfig.enabledOnSeries.indexOf(t)?u[0].parentNode.style.display="none":u[0].parentNode.style.display=n.config.tooltip.items.display}else Array.isArray(l.tConfig.enabledOnSeries)&&-1===l.tConfig.enabledOnSeries.indexOf(t)&&(u[0].parentNode.style.display="none")}toggleActiveInactiveSeries(t,e){const s=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");const t=s.dom.baseEl.querySelector(`.apexcharts-tooltip-series-group-${e}`);if(t){const e=t;e.classList.add("apexcharts-active"),e.style.display=s.config.tooltip.items.display}}}getValuesToPrint({i:t,j:e}){var s,i,a,o,r,n,l,h;const c=this.w,d=c.seriesData.seriesX.map(t=>t.length>0?t:[]);let g="",p="",u=null,x=null;const f={series:c.seriesData.series,seriesIndex:t,dataPointIndex:e,w:c},b=c.formatters.ttZFormatter;if(null===e)x=c.seriesData.series[t];else if(c.axisFlags.isXNumeric&&"treemap"!==c.config.chart.type){if(g=d[t][e],0===d[t].length){g=d[this.tooltipUtil.getFirstActiveXArray(d)][e]}}else{g=new Tt(this.w).isFormatXY()?void 0!==c.config.series[t].data[e]?c.config.series[t].data[e].x:"":void 0!==c.labelData.labels[e]?c.labelData.labels[e]:""}const m=g;if(c.axisFlags.isXNumeric&&"datetime"===c.config.xaxis.type){g=new w(this.w).xLabelFormat(c.formatters.ttKeyFormatter,m,m,{i:void 0,dateFormatter:new y(this.w).formatDate,w:this.w})}else g=c.globals.isBarHorizontal?c.formatters.yLabelFormatters[0](m,f):null!=(a=null==(i=(s=c.formatters).xLabelFormatter)?void 0:i.call(s,m,f))?a:m;return void 0!==c.config.tooltip.x.formatter&&(g=null!=(n=null==(r=(o=c.formatters).ttKeyFormatter)?void 0:r.call(o,m,f))?n:m),c.seriesData.seriesZ.length>0&&c.seriesData.seriesZ[t].length>0&&(u=null==b?void 0:b(c.seriesData.seriesZ[t][e],c)),p="function"==typeof c.config.xaxis.tooltip.formatter?null==(h=(l=c.formatters).xaxisTooltipFormatter)?void 0:h.call(l,m,f):g,{val:Array.isArray(x)?x.join(" "):x,xVal:Array.isArray(g)?g.join(" "):g,xAxisTTVal:Array.isArray(p)?p.join(" "):p,zVal:u}}handleCustomTooltip({i:t,j:e,y1:s,y2:i,w:a}){const o=this.ttCtx.getElTooltip();let r=a.config.tooltip.custom;Array.isArray(r)&&r[t]&&(r=r[t]);const n=r({series:a.seriesData.series,seriesIndex:t,dataPointIndex:e,y1:s,y2:i,w:a});o&&("string"==typeof n||"number"==typeof n?o.innerHTML=String(n):(n instanceof Element||"string"==typeof n.nodeName)&&(o.innerHTML="",o.appendChild(n.cloneNode(!0))))}}class Xt{constructor(t){this.ttCtx=t,this.w=t.w}moveXCrosshairs(t,e=null){const s=this.ttCtx,i=this.w,a=s.getElXCrosshairs();let o=t-s.xcrosshairsWidth/2;const r=i.labelData.labels.slice().length;if(null!==e&&(o=i.layout.gridWidth/r*e),null===a||i.globals.isBarHorizontal||(a.setAttribute("x",String(o)),a.setAttribute("x1",String(o)),a.setAttribute("x2",String(o)),a.setAttribute("y2",String(i.layout.gridHeight)),a.classList.add("apexcharts-active")),o<0&&(o=0),o>i.layout.gridWidth&&(o=i.layout.gridWidth),s.isXAxisTooltipEnabled){let t=o;"tickWidth"!==i.config.xaxis.crosshairs.width&&"barWidth"!==i.config.xaxis.crosshairs.width||(t=o+s.xcrosshairsWidth/2),this.moveXAxisTooltip(t)}}moveYCrosshairs(t){const e=this.ttCtx;null!==e.ycrosshairs&&N.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&N.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}moveXAxisTooltip(t){var e,s;const i=this.w,a=this.ttCtx;if(null!==a.xaxisTooltip&&0!==a.xcrosshairsWidth){a.xaxisTooltip.classList.add("apexcharts-active");const o=a.xaxisOffY+i.config.xaxis.tooltip.offsetY+i.layout.translateY+5+i.config.xaxis.offsetY;if(t-=a.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(t)){t+=i.layout.translateX;const r=new N(this.w).getTextRects(null!=(s=null==(e=a.xaxisTooltipText)?void 0:e.innerHTML)?s:"",i.config.xaxis.labels.style.fontSize);a.xaxisTooltipText&&(a.xaxisTooltipText.style.minWidth=r.width+"px"),a.xaxisTooltip.style.left=t+"px",a.xaxisTooltip.style.top=o+"px"}}}moveYAxisTooltip(t){var e,s;const i=this.w,a=this.ttCtx;null===a.yaxisTTEls&&(a.yaxisTTEls=[...i.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip")]);const o=parseInt(null!=(s=null==(e=a.ycrosshairsHidden)?void 0:e.getAttribute("y1"))?s:"0",10);let r=i.layout.translateY+o;if(a.yaxisTTEls){const e=a.yaxisTTEls[t].getBoundingClientRect(),s=e.height;let o;const n=i.dom.baseEl.querySelector(`.apexcharts-yaxis[rel='${t}'] .apexcharts-yaxis-texts-g`),l=i.dom.elWrap.getBoundingClientRect();if(n){const t=n.getBoundingClientRect();if(t.width>0){o=t.left+t.width/2-l.left-e.width/2}}if(null==o){const s=4;o=i.config.yaxis[t].opposite?i.globals.translateYAxisX[t]+s:i.globals.translateYAxisX[t]-e.width-s}r-=s/2,-1===i.globals.ignoreYAxisIndexes.indexOf(t)&&r>0&&r<i.layout.gridHeight?(a.yaxisTTEls[t].classList.add("apexcharts-active"),a.yaxisTTEls[t].style.top=r+"px",a.yaxisTTEls[t].style.left=o+i.config.yaxis[t].tooltip.offsetX+"px"):a.yaxisTTEls[t].classList.remove("apexcharts-active")}}moveTooltip(t,e,s=null){const i=this.ttCtx.getElTooltip();if(!i)return;const a=this.computeTooltipPosition(t,e,s);null!==a&&this.applyTooltipPosition(i,a)}computeTooltipPosition(t,e,s=null){var i,a,o,r,n,l,h;const c=this.w,d=this.ttCtx,g=d.tooltipRect,p=!!c.config.tooltip.arrow,u=null!==s?parseFloat(String(s)):1,x=g.ttHeight||0,f=g.ttWidth||0,b=parseFloat(String(t)),m=parseFloat(String(e));if(isNaN(b))return null;let y=b+u+5;const w=m+c.layout.translateY;let v=p?w-x/2+u/2:m+u/2,A="right";if(y>c.layout.gridWidth/2&&(y=y-f-u-10,A="left"),y>c.layout.gridWidth-f-10&&(y=c.layout.gridWidth-f),y<-20&&(y=-20),c.config.tooltip.followCursor){const t=d.getElGrid();if(!t)return null;const e=t.getBoundingClientRect();y=d.e.clientX-e.left,y>c.layout.gridWidth/2?(y-=f,A="left"):A="right",v=d.e.clientY+c.layout.translateY-e.top,v>c.layout.gridHeight/2&&(v-=x)}else if(!c.globals.isBarHorizontal)if(p){const t=c.layout.translateY,e=c.layout.translateY+c.layout.gridHeight;v+x>e&&(v=e-x),v<t&&(v=t)}else x/2+v>c.layout.gridHeight&&(v=c.layout.gridHeight-x+c.layout.translateY);if(isNaN(y))return null;y+=c.layout.translateX;const C=null==(a=null==(i=c.config)?void 0:i.chart)?void 0:a.accessibility;if((null==C?void 0:C.enabled)&&(null==(r=null==(o=null==C?void 0:C.keyboard)?void 0:o.navigation)?void 0:r.enabled)&&(null==(h=null==(l=null==(n=c.dom)?void 0:n.baseEl)?void 0:l.querySelector)?void 0:h.call(l,".apexcharts-keyboard-focused"))){const t=p?w:m,e=(u||1)+12,s=v,i=v+x;!isNaN(t)&&x>0&&s<t+e&&i>t-e&&(v=t-x-e,v<0&&(v=t+e))}let S=null;if(p&&x>0){const t=w-v,e=10,s=x-10;S=Math.max(e,Math.min(s,t))}return{x:y,y:v,placement:A,arrowY:S}}applyTooltipPosition(t,e){if(!t)return;const s="true"!==t.dataset.positioned;s&&(t.style.transitionProperty="none"),t.style.left=e.x+"px",t.style.top=e.y+"px",e.placement&&(t.dataset.placement=e.placement),null!=e.arrowY&&t.style.setProperty("--apx-tt-arrow-y",e.arrowY+"px"),null!=e.arrowX&&t.style.setProperty("--apx-tt-arrow-x",e.arrowX+"px"),s&&(t.offsetWidth,t.dataset.positioned="true",requestAnimationFrame(()=>{t.style.transitionProperty=""}))}moveMarkers(t,e){var s;const i=this.w,a=this.ttCtx;if(i.globals.markers.size[t]>0){const o=i.dom.baseEl.querySelectorAll(` .apexcharts-series[data\\:realIndex='${t}'] .apexcharts-marker`);for(let t=0;t<o.length;t++)parseInt(null!=(s=o[t].getAttribute("rel"))?s:"0",10)===e&&(a.marker.resetPointsSize(),a.marker.enlargeCurrentPoint(e,o[t]))}else a.marker.resetPointsSize(),this.moveDynamicPointOnHover(e,t)}moveDynamicPointOnHover(t,e){var s,i,a,o,r;const n=this.w,l=this.ttCtx;let h=0,c=0;const d=new N(this.w),g=n.globals.pointsArray,p=l.tooltipUtil.getHoverMarkerSize(e),u=n.config.series[e].type;if(u&&("column"===u||"candlestick"===u||"boxPlot"===u||"violin"===u))return;h=null==(i=null==(s=g[e])?void 0:s[t])?void 0:i[0],c=(null==(o=null==(a=g[e])?void 0:a[t])?void 0:o[1])||0;const x=n.dom.baseEl.querySelector(`.apexcharts-series[data\\:realIndex='${e}'] .apexcharts-series-markers path`);if(x&&c<n.layout.gridHeight&&c>0){const t=null!=(r=x.getAttribute("shape"))?r:"circle",e=d.getMarkerPath(h,c,t,1.5*p);x.setAttribute("d",e)}this.moveXCrosshairs(h),l.fixedTooltip||this.moveTooltip(h,c,p)}moveDynamicPointsOnHover(t){var e,s;const i=this.ttCtx,a=i.w;let o=0,r=0,n=0;const l=a.globals.pointsArray,h=new lt(this.w),c=new N(this.w);n=h.getActiveConfigSeriesIndex("asc",["line","area","scatter","bubble"]);const d=i.tooltipUtil.getHoverMarkerSize(n);if((null==(e=l[n])?void 0:e[t])&&(o=l[n][t][0],r=l[n][t][1]),isNaN(o))return;const g=i.tooltipUtil.getAllMarkers();if(g.length)for(let e=0;e<a.seriesData.series.length;e++){const i=l[e];if(a.globals.comboCharts&&void 0===i&&g.splice(e,0,null),i&&i.length){let i,r=l[e][t][1];g[e].setAttribute("cx",o);const n=null!=(s=g[e].getAttribute("shape"))?s:"circle";if("rangeArea"===a.config.chart.type&&!a.globals.comboCharts){const s=t+a.seriesData.series[e].length;i=l[e][s][1];r-=Math.abs(r-i)/2}if(null!==r&&!isNaN(r)&&r<a.layout.gridHeight+d&&r+d>0){const t=c.getMarkerPath(o,r,n,d);g[e].setAttribute("d",t)}else g[e].setAttribute("d","")}}this.moveXCrosshairs(o),i.fixedTooltip||this.moveTooltip(o,r||a.layout.gridHeight,d)}moveStickyTooltipOverBars(t,e){var s,i,a;const o=this.w,r=this.ttCtx;let n=o.globals.columnSeries?o.globals.columnSeries.length:o.seriesData.series.length;o.config.chart.stacked&&(n=o.globals.barGroups.length);let l=n>=2&&n%2==0?Math.floor(n/2):Math.floor(n/2)+1;if(o.globals.isBarHorizontal){l=new lt(this.w).getActiveConfigSeriesIndex("desc")+1}let h=o.dom.baseEl.querySelector(`.apexcharts-bar-series .apexcharts-series[rel='${l}'] path[j='${t}'], .apexcharts-candlestick-series .apexcharts-series[rel='${l}'] path[j='${t}'], .apexcharts-boxPlot-series .apexcharts-series[rel='${l}'] path[j='${t}'], .apexcharts-violin-series .apexcharts-series[rel='${l}'] path[j='${t}'], .apexcharts-rangebar-series .apexcharts-series[rel='${l}'] path[j='${t}']`);h||"number"!=typeof e||(h=o.dom.baseEl.querySelector(`.apexcharts-bar-series .apexcharts-series[data\\:realIndex='${e}'] path[j='${t}'],\n .apexcharts-candlestick-series .apexcharts-series[data\\:realIndex='${e}'] path[j='${t}'],\n .apexcharts-boxPlot-series .apexcharts-series[data\\:realIndex='${e}'] path[j='${t}'],\n .apexcharts-violin-series .apexcharts-series[data\\:realIndex='${e}'] path[j='${t}'],\n .apexcharts-rangebar-series .apexcharts-series[data\\:realIndex='${e}'] path[j='${t}']`));let c=h?parseFloat(null!=(s=h.getAttribute("cx"))?s:"0"):0,d=h?parseFloat(null!=(i=h.getAttribute("cy"))?i:"0"):0;const g=h?parseFloat(null!=(a=h.getAttribute("barWidth"))?a:"0"):0,p=r.getElGrid();if(!p)return;const u=p.getBoundingClientRect(),x=h&&(h.classList.contains("apexcharts-candlestick-area")||h.classList.contains("apexcharts-boxPlot-area"));if(o.axisFlags.isXNumeric){if(h&&!x){const e=this._datapointCenterXFromBars(t,u);null!=e?c=e:c-=n%2!=0?g/2:0}h&&x&&(c-=g/2)}else o.globals.isBarHorizontal||(c=r.xAxisTicksPositions[t-1]+r.dataPointsDividedWidth/2,isNaN(c)&&(c=r.xAxisTicksPositions[t]-r.dataPointsDividedWidth/2));if(o.globals.isBarHorizontal?d-=r.tooltipRect.ttHeight:o.config.tooltip.followCursor?d=r.e.clientY-u.top-r.tooltipRect.ttHeight/2:d+r.tooltipRect.ttHeight+15>o.layout.gridHeight&&(d=o.layout.gridHeight),o.globals.isBarHorizontal||this.moveXCrosshairs(c),!r.fixedTooltip){if(o.globals.isBarHorizontal&&!o.config.tooltip.followCursor){if(this.placeHorizontalSharedTooltip(t))return}this.moveTooltip(c,d||o.layout.gridHeight)}}_datapointCenterXFromBars(t,e){var s,i;const a=this.w,o=a.dom.baseEl.querySelectorAll(`.apexcharts-bar-series path[j='${t}'],.apexcharts-rangebar-series path[j='${t}']`);if(!o.length)return null;let r=1/0,n=-1/0;for(const t of o){const e=t.parentNode;if(null==(i=null==(s=null==e?void 0:e.classList)?void 0:s.contains)?void 0:i.call(s,"apexcharts-series-collapsed"))continue;const a=t.getBoundingClientRect();0===a.width&&0===a.height||(a.left<r&&(r=a.left),a.right>n&&(n=a.right))}return isFinite(r)?(r+n)/2-e.left-(a.globals.barPadForNumericAxis||0):null}placeHorizontalSharedTooltip(t){var e,s;const i=this.w,a=this.ttCtx,o=a.getElTooltip();if(!o)return!1;const r=a.getElGrid();if(!r)return!1;const n=r.getBoundingClientRect(),l=i.dom.baseEl.querySelectorAll(`.apexcharts-bar-series path[j='${t}'],.apexcharts-rangebar-series path[j='${t}'],.apexcharts-boxPlot-series path[j='${t}']`);if(!l.length)return!1;let h=1/0,c=-1/0,d=1/0,g=-1/0;for(const t of l){const i=t.parentNode;if(null==(s=null==(e=null==i?void 0:i.classList)?void 0:e.contains)?void 0:s.call(e,"apexcharts-series-collapsed"))continue;const a=t.getBoundingClientRect();0===a.width&&0===a.height||(a.left<h&&(h=a.left),a.right>c&&(c=a.right),a.top<d&&(d=a.top),a.bottom>g&&(g=a.bottom))}if(!isFinite(h))return!1;const p=a.tooltipRect.ttWidth||0,u=a.tooltipRect.ttHeight||0,x=(h+c)/2-n.left+i.layout.translateX,f=d-n.top+i.layout.translateY,b=g-n.top+i.layout.translateY,m=i.layout.translateY,y=i.layout.translateY+i.layout.gridHeight,w=i.layout.translateX,v=i.layout.translateX+i.layout.gridWidth;let A="top",C=f-u-7;if(C<m){const t=b+7;t+u<=y&&(A="bottom",C=t)}let S=x-p/2;S<w&&(S=w),S+p>v&&(S=v-p);const k=Math.max(10,Math.min(p-10,x-S));return this.applyTooltipPosition(o,{x:S,y:C,placement:A,arrowY:null,arrowX:k}),!0}}function Rt(t){const e=t=>`<svg viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">${t}</svg>`;switch(t){case"square":case"rect":return e('<rect x="1" y="1" width="10" height="10" rx="1" fill="currentColor"/>');case"line":return e('<rect x="0" y="5" width="12" height="2" rx="1" fill="currentColor"/>');case"diamond":return e('<path d="M6 0.5 L11.5 6 L6 11.5 L0.5 6 Z" fill="currentColor"/>');case"triangle":return e('<path d="M6 1 L11.2 10.5 L0.8 10.5 Z" fill="currentColor"/>');case"cross":return e('<path d="M2 2 L10 10 M10 2 L2 10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>');case"plus":return e('<path d="M6 1 L6 11 M1 6 L11 6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>');case"star":return e('<path d="M6 0.5 L7.5 4.4 L11.5 4.7 L8.4 7.2 L9.5 11.1 L6 8.9 L2.5 11.1 L3.6 7.2 L0.5 4.7 L4.5 4.4 Z" fill="currentColor"/>');case"sparkle":return e('<path d="M6 0.5 L7 5 L11.5 6 L7 7 L6 11.5 L5 7 L0.5 6 L5 5 Z" fill="currentColor"/>');default:return e('<circle cx="6" cy="6" r="5" fill="currentColor"/>')}}class zt{constructor(t){this.w=t.w,this.ttCtx=t,this.ctx=t.ctx,this.tooltipPosition=new Xt(t)}drawDynamicPoints(){const t=this.w,e=new N(this.w),s=new j(this.w,this.ctx),i=[...t.dom.baseEl.querySelectorAll(".apexcharts-series")];t.config.chart.stacked&&i.sort((t,e)=>parseFloat(t.getAttribute("data:realIndex"))-parseFloat(e.getAttribute("data:realIndex")));for(let a=0;a<i.length;a++){const o=i[a].querySelector(".apexcharts-series-markers-wrap");if(null!==o){let i=`apexcharts-marker w${(Math.random()+1).toString(36).substring(4)}`;"line"!==t.config.chart.type&&"area"!==t.config.chart.type||t.globals.comboCharts||t.config.tooltip.intersect||(i+=" no-pointer-events");const a=s.getMarkerConfig({cssClass:i,seriesIndex:Number(o.getAttribute("data:realIndex"))}),r=e.drawMarker(0,0,a);r.node.setAttribute("default-marker-size",0);const n=b.createElementNS(W,"g");n.classList.add("apexcharts-series-markers"),n.appendChild(r.node),o.appendChild(n)}}}enlargeCurrentPoint(t,e,s=null,i=null){const a=this.w;"bubble"!==a.config.chart.type&&this.newPointSize(t,e);let o=e.getAttribute("cx"),r=e.getAttribute("cy");if(null!==s&&null!==i&&(o=s,r=i),this.tooltipPosition.moveXCrosshairs(o),!this.fixedTooltip){if("radar"===a.config.chart.type){const t=this.ttCtx.getElGrid();if(!t)return;const e=t.getBoundingClientRect();o=this.ttCtx.e.clientX-e.left}this.tooltipPosition.moveTooltip(o,r,a.config.markers.hover.size)}}enlargePoints(t){var e,s;const i=this.w,a=this,o=this.ttCtx,r=t,n=i.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker");let l=i.config.markers.hover.size;for(let t=0;t<n.length;t++){const h=n[t].getAttribute("rel"),c=n[t].getAttribute("index");if(void 0===l&&(l=i.globals.markers.size[c]+i.config.markers.hover.sizeOffset),r===parseInt(null!=h?h:"0",10)){a.newPointSize(r,n[t]);const i=null!=(e=n[t].getAttribute("cx"))?e:"0",h=null!=(s=n[t].getAttribute("cy"))?s:"0";a.tooltipPosition.moveXCrosshairs(parseFloat(i)),o.fixedTooltip||a.tooltipPosition.moveTooltip(parseFloat(i),parseFloat(h),l)}else a.oldPointSize(n[t])}}newPointSize(t,e){const s=this.w;let i=s.config.markers.hover.size;const a=0===t?e.parentNode.firstChild:e.parentNode.lastChild;if("0"!==a.getAttribute("default-marker-size")){const t=parseInt(a.getAttribute("index"),10);void 0===i&&(i=s.globals.markers.size[t]+s.config.markers.hover.sizeOffset),i<0&&(i=0);const o=this.ttCtx.tooltipUtil.getPathFromPoint(e,i);e.setAttribute("d",o)}}oldPointSize(t){const e=parseFloat(t.getAttribute("default-marker-size")),s=this.ttCtx.tooltipUtil.getPathFromPoint(t,e);t.setAttribute("d",s)}resetPointsSize(){var t;const e=this.w.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker");for(let s=0;s<e.length;s++){const i=parseFloat(null!=(t=e[s].getAttribute("default-marker-size"))?t:"0");if(m.isNumber(i)&&i>0){const t=this.ttCtx.tooltipUtil.getPathFromPoint(e[s],i);e[s].setAttribute("d",t)}else e[s].setAttribute("d","M0,0")}}}class Yt{constructor(t){this.w=t.w;const e=this.w;this.ttCtx=t,this.isVerticalGroupedRangeBar=!e.globals.isBarHorizontal&&"rangeBar"===e.config.chart.type&&e.config.plotOptions.bar.rangeBarGroupRows}getAttr(t,e){var s;return parseFloat(null!=(s=t.target.getAttribute(e))?s:"")}handleHeatTreeTooltip({e:t,opt:e,x:s,y:i,type:a}){var o,r;const n=this.ttCtx,l=this.w;if(t.target.classList.contains(`apexcharts-${a}-rect`)){const a=this.getAttr(t,"i"),h=this.getAttr(t,"j"),c=this.getAttr(t,"cx"),d=this.getAttr(t,"cy"),g=this.getAttr(t,"width"),p=this.getAttr(t,"height");if(n.tooltipLabels.drawSeriesTexts({ttItems:e.ttItems,i:a,j:h,shared:!1,e:t}),l.interact.capturedSeriesIndex=a,l.interact.capturedDataPointIndex=h,s=c+n.tooltipRect.ttWidth/2+g,i=d+n.tooltipRect.ttHeight/2-p/2,n.tooltipPosition.moveXCrosshairs(c+g/2),s>l.layout.gridWidth/2&&(s=c-n.tooltipRect.ttWidth/2+g),n.w.config.tooltip.followCursor){const t=l.dom.elWrap.getBoundingClientRect();s=(null!=(o=l.interact.clientX)?o:0)-t.left-(s>l.layout.gridWidth/2?n.tooltipRect.ttWidth:0),i=(null!=(r=l.interact.clientY)?r:0)-t.top-(i>l.layout.gridHeight/2?n.tooltipRect.ttHeight:0)}}return{x:s,y:i}}handleMarkerTooltip({e:t,opt:e,x:s,y:i}){const a=this.w,o=this.ttCtx;let r,n;if(t.target.classList.contains("apexcharts-marker")){const l=parseInt(e.paths.getAttribute("cx"),10),h=parseInt(e.paths.getAttribute("cy"),10),c=parseFloat(e.paths.getAttribute("val"));if(n=parseInt(e.paths.getAttribute("rel"),10),r=parseInt(e.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,o.intersect){const t=m.findAncestor(e.paths,"apexcharts-series");t&&(r=parseInt(t.getAttribute("data:realIndex"),10))}o.tooltipLabels.drawSeriesTexts({ttItems:e.ttItems,i:r,j:n,shared:!o.showOnIntersect&&a.config.tooltip.shared,e:t}),"mouseup"===t.type&&o.markerClick(t,r,n),a.interact.capturedSeriesIndex=r,a.interact.capturedDataPointIndex=n;if(s=l,!!a.config.tooltip.arrow?i=h:(i=h+a.layout.translateY-1.4*o.tooltipRect.ttHeight,c<0&&(i=h)),o.w.config.tooltip.followCursor){const t=o.getElGrid();if(!t)return{x:s,y:i};const e=t.getBoundingClientRect();i=o.e.clientY+a.layout.translateY-e.top}o.marker.enlargeCurrentPoint(n,e.paths,s,i)}return{x:s,y:i}}handleBarTooltip({e:t,opt:e}){var s,i,a;const o=this.w,r=this.ttCtx,n=r.getElTooltip();let l,h=0,c=0,d=0,g=0;const p=this.getBarTooltipXY({e:t,opt:e});if(null===p.j&&0===p.barHeight&&0===p.barWidth)return;g=p.i;const u=p.j;if(o.interact.capturedSeriesIndex=g,o.interact.capturedDataPointIndex=null!==u?u:o.interact.capturedDataPointIndex,o.globals.isBarHorizontal&&r.tooltipUtil.hasBars()||!o.config.tooltip.shared?(c=p.x,d=p.y,l=Array.isArray(o.config.stroke.width)?o.config.stroke.width[g]:o.config.stroke.width,h=c):o.globals.comboCharts||o.config.tooltip.shared||(h/=2),isNaN(d)&&(d=o.globals.svgHeight-r.tooltipRect.ttHeight),c+r.tooltipRect.ttWidth>o.layout.gridWidth?c-=r.tooltipRect.ttWidth:c<0&&(c=0),r.w.config.tooltip.followCursor){if(!r.getElGrid())return}if(null===r.tooltip&&(r.tooltip=o.dom.baseEl.querySelector(".apexcharts-tooltip")),o.config.tooltip.shared||(o.globals.comboBarCount>0?r.tooltipPosition.moveXCrosshairs(h+l/2):r.tooltipPosition.moveXCrosshairs(h)),!r.fixedTooltip&&(!o.config.tooltip.shared||o.globals.isBarHorizontal&&r.tooltipUtil.hasBars())&&(d=d+o.layout.translateY-r.tooltipRect.ttHeight/2,n)){const t=r.tooltipRect.ttWidth||0,e=r.tooltipRect.ttHeight||0,l=!!o.config.tooltip.arrow,{barAnchorXInGrid:h,barAnchorYInGrid:g,barRectInGrid:u}=p,x=7,f=null==(s=r.getElGrid())?void 0:s.getBoundingClientRect(),b=o.dom.elWrap.getBoundingClientRect(),m=f?f.left-b.left:o.layout.translateX;let y,w=null,v=null,A=c+m,C=d;if(l&&o.globals.isBarHorizontal&&null!=u){const s=o.layout.translateY,i=o.layout.translateY+o.layout.gridHeight,a=m,r=m+o.layout.gridWidth,n=(u.left+u.right)/2+m,l=u.top+o.layout.translateY,h=u.bottom+o.layout.translateY;let c=l-e-x;if(y="top",c<s){const t=h+x;t+e<=i&&(y="bottom",c=t)}C=c,A=n-t/2,A<a&&(A=a),A+t>r&&(A=r-t),v=Math.max(10,Math.min(t-10,n-A))}else if(l&&null!=h&&null!=g){const s=h+m,r=m+o.layout.gridWidth/2,n=(null!=(i=null==u?void 0:u.left)?i:h)+m,l=(null!=(a=null==u?void 0:u.right)?a:h)+m;if(s<r?(y="right",A=l+x):(y="left",A=n-t-x),u){C=(u.top+u.bottom)/2+o.layout.translateY-e/2;const t=o.layout.translateY,s=o.layout.translateY+o.layout.gridHeight;C<t&&(C=t),C+e>s&&(C=s-e)}if(e>0&&u){const t=(u.top+u.bottom)/2+o.layout.translateY;w=Math.max(10,Math.min(e-10,t-C))}}r.tooltipPosition.applyTooltipPosition(n,{x:A,y:C,placement:y,arrowY:w,arrowX:v})}}getBarTooltipXY({e:t,opt:e}){const s=this.w;let i=null;const a=this.ttCtx;let o=0,r=0,n=0,l=0,h=0,c=null,d=null,g=null,p=null,u=null;const x=t.target.classList;if(x.contains("apexcharts-bar-area")||x.contains("apexcharts-candlestick-area")||x.contains("apexcharts-boxPlot-area")||x.contains("apexcharts-rangebar-area")){const x=t.target,f=x.getBoundingClientRect(),b=e.elGrid.getBoundingClientRect(),m=f.height;h=f.height;const y=f.width,w=parseInt(x.getAttribute("cx"),10),v=parseInt(x.getAttribute("cy"),10);c=w,d=v,l=parseFloat(x.getAttribute("barWidth"));const A=f.left-b.left,C=f.top-b.top,S=C+m/2;g=A+y/2,p=s.globals.isBarHorizontal?S:C,u={left:A,top:C,right:A+y,bottom:C+m};const k="touchmove"===t.type?t.touches[0].clientX:t.clientX;i=parseInt(x.getAttribute("j"),10),o=parseInt(x.parentNode.getAttribute("rel"),10)-1;const D=x.getAttribute("data-range-y1"),L=x.getAttribute("data-range-y2");s.globals.comboCharts&&(o=parseInt(x.parentNode.getAttribute("data:realIndex"),10));const M=t=>s.axisFlags.isXNumeric?w-y/2:this.isVerticalGroupedRangeBar?w+y/2:w-a.dataPointsDividedWidth+y/2,P=()=>v-a.dataPointsDividedHeight+m/2-a.tooltipRect.ttHeight/2;a.tooltipLabels.drawSeriesTexts({ttItems:e.ttItems,i:o,j:i,y1:D?parseInt(D,10):null,y2:L?parseInt(L,10):null,shared:!a.showOnIntersect&&s.config.tooltip.shared,e:t}),s.config.tooltip.followCursor?s.globals.isBarHorizontal?(r=k-b.left+15,n=P()):(r=M(r),n=t.clientY-b.top-a.tooltipRect.ttHeight/2-15):s.globals.isBarHorizontal?(r=w,a.xyRatios&&r<a.xyRatios.baseLineInvertedY&&(r=w-a.tooltipRect.ttWidth),n=P()):(r=M(r),n=v)}return{x:r,y:n,barHeight:h,barWidth:l,i:o,j:i,barCx:c,barCy:d,barAnchorXInGrid:g,barAnchorYInGrid:p,barRectInGrid:u}}}class Bt{constructor(t){this.w=t.w,this.ttCtx=t}drawXaxisTooltip(){const t=this.w,e=this.ttCtx,s="bottom"===t.config.xaxis.position;e.xaxisOffY=s?t.layout.gridHeight+1:-t.layout.xAxisHeight-t.config.xaxis.axisTicks.height+3;const i=s?"apexcharts-xaxistooltip apexcharts-xaxistooltip-bottom":"apexcharts-xaxistooltip apexcharts-xaxistooltip-top",a=t.dom.elWrap;if(e.isXAxisTooltipEnabled){null===t.dom.baseEl.querySelector(".apexcharts-xaxistooltip")&&(e.xaxisTooltip=b.createElementNS("http://www.w3.org/1999/xhtml","div"),e.xaxisTooltip.setAttribute("class",i+" apexcharts-theme-"+t.config.tooltip.theme),a.appendChild(e.xaxisTooltip),e.xaxisTooltipText=b.createElementNS("http://www.w3.org/1999/xhtml","div"),e.xaxisTooltipText.classList.add("apexcharts-xaxistooltip-text"),e.xaxisTooltipText.style.fontFamily=t.config.xaxis.tooltip.style.fontFamily||t.config.chart.fontFamily,e.xaxisTooltipText.style.fontSize=t.config.xaxis.tooltip.style.fontSize,e.xaxisTooltip.appendChild(e.xaxisTooltipText))}}drawYaxisTooltip(){const t=this.w,e=this.ttCtx;for(let s=0;s<t.config.yaxis.length;s++){const i=t.config.yaxis[s].opposite||t.config.yaxis[s].crosshairs.opposite;e.yaxisOffX=i?t.layout.gridWidth+1:1;const a=i?`apexcharts-yaxistooltip apexcharts-yaxistooltip-${s} apexcharts-yaxistooltip-right`:`apexcharts-yaxistooltip apexcharts-yaxistooltip-${s} apexcharts-yaxistooltip-left`,o=t.dom.elWrap;null===t.dom.baseEl.querySelector(`.apexcharts-yaxistooltip apexcharts-yaxistooltip-${s}`)&&(e.yaxisTooltip=b.createElementNS("http://www.w3.org/1999/xhtml","div"),e.yaxisTooltip.setAttribute("class",a+" apexcharts-theme-"+t.config.tooltip.theme),o.appendChild(e.yaxisTooltip),0===s&&(e.yaxisTooltipText=[]),e.yaxisTooltipText[s]=b.createElementNS("http://www.w3.org/1999/xhtml","div"),e.yaxisTooltipText[s].classList.add("apexcharts-yaxistooltip-text"),e.yaxisTooltip.appendChild(e.yaxisTooltipText[s]))}}setXCrosshairWidth(){var t,e;const s=this.w,i=this.ttCtx,a=i.getElXCrosshairs();if(i.xcrosshairsWidth=parseInt(s.config.xaxis.crosshairs.width,10),s.globals.comboCharts){const t=s.dom.baseEl.querySelector(".apexcharts-bar-area");if(null!==t&&"barWidth"===s.config.xaxis.crosshairs.width){const s=parseFloat(null!=(e=t.getAttribute("barWidth"))?e:"0");i.xcrosshairsWidth=s}else if("tickWidth"===s.config.xaxis.crosshairs.width){const t=s.labelData.labels.length;i.xcrosshairsWidth=s.layout.gridWidth/t}}else if("tickWidth"===s.config.xaxis.crosshairs.width){const t=s.labelData.labels.length;i.xcrosshairsWidth=s.layout.gridWidth/t}else if("barWidth"===s.config.xaxis.crosshairs.width){const e=s.dom.baseEl.querySelector(".apexcharts-bar-area");if(null!==e){const s=parseFloat(null!=(t=e.getAttribute("barWidth"))?t:"0");i.xcrosshairsWidth=s}else i.xcrosshairsWidth=1}s.globals.isBarHorizontal&&(i.xcrosshairsWidth=0),null!==a&&i.xcrosshairsWidth>0&&a.setAttribute("width",String(i.xcrosshairsWidth))}handleYCrosshair(){const t=this.w,e=this.ttCtx;e.ycrosshairs=t.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}drawYaxisTooltipText(t,e,s){const i=this.ttCtx,a=this.w,o=a.globals,r=o.seriesYAxisMap[t];if(i.yaxisTooltips[t]&&r.length>0){const n=a.formatters.yLabelFormatters[t],l=i.getElGrid();if(!l)return;const h=l.getBoundingClientRect(),c=r[0];let d=0;s.yRatio.length>1&&(d=c);const g=(e-h.top)*s.yRatio[d],p=o.maxYArr[c]-o.minYArr[c];let u=o.minYArr[c]+(p-g);a.config.yaxis[t].reversed&&(u=o.maxYArr[c]-(p-g)),i.tooltipPosition.moveYCrosshairs(e-h.top),i.yaxisTooltipText[t].innerHTML=n(u),i.tooltipPosition.moveYAxisTooltip(t)}}}class Ht{constructor(t,e){this.w=t,this.ctx=e,this.tConfig=t.config.tooltip,this.tooltipUtil=new Et(this),this.tooltipLabels=new It(this),this.tooltipPosition=new Xt(this),this.marker=new zt(this),this.intersect=new Yt(this),this.axesTooltip=new Bt(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.xaxisTooltipText=null,this.yaxisTooltip=null,this.yaxisTooltipText=null,this.yaxisTTEls=null,this.xaxisOffY=0,this.yaxisOffX=0,this.xcrosshairsWidth=0,this.ycrosshairs=null,this.ycrosshairsHidden=null,this.tooltip=null,this.e=null,this.isBarShared=!t.globals.isBarHorizontal&&this.tConfig.shared,this.lastHoverTime=Date.now(),this.dimensionUpdateScheduled=!1,this.xyRatios=null,this.isXAxisTooltipEnabled=!1,this.yaxisTooltips=[],this.allTooltipSeriesGroups=[],this.xAxisTicksPositions=null,this.dataPointsDividedHeight=0,this.dataPointsDividedWidth=0,this.tooltipTitle=null,this.legendLabels=null,this.ttItems=null,this.seriesBound=null,this.seriesHoverTimeout=void 0,this.clientX=0,this.clientY=0,this.barSeriesHeight=0,this.tooltipRect={x:0,y:0,ttWidth:0,ttHeight:0}}setupDimensionCache(){const t=this.w,e=this.getElTooltip();e&&(this.updateDimensionCache(),"undefined"==typeof ResizeObserver||t.globals.resizeObserver||(t.globals.resizeObserver=new ResizeObserver(()=>{this.dimensionUpdateScheduled||(this.dimensionUpdateScheduled=!0,requestAnimationFrame(()=>{this.updateDimensionCache(),this.dimensionUpdateScheduled=!1}))}),t.globals.resizeObserver.observe(e)))}updateDimensionCache(){const t=this.w,e=this.getElTooltip();if(!e)return;const s=e.getBoundingClientRect();t.globals.dimensionCache.tooltip={width:s.width,height:s.height,lastUpdate:Date.now()}}getCachedDimensions(){const t=this.w;if(t.globals.dimensionCache.tooltip){const e=t.globals.dimensionCache.tooltip;if(Date.now()-e.lastUpdate<1e3)return{ttWidth:e.width,ttHeight:e.height}}this.updateDimensionCache();const e=t.globals.dimensionCache.tooltip;return e?{ttWidth:e.width,ttHeight:e.height}:{ttWidth:0,ttHeight:0}}getElTooltip(t){return t||(t=this),t.w.dom.baseEl?t.w.dom.baseEl.querySelector(".apexcharts-tooltip"):null}getElXCrosshairs(){return this.w.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}getElGrid(){return this.w.dom.baseEl.querySelector(".apexcharts-grid")}drawTooltip(t){const e=this.w;this.xyRatios=t,this.isXAxisTooltipEnabled=e.config.xaxis.tooltip.enabled&&e.globals.axisCharts,this.yaxisTooltips=e.config.yaxis.map(t=>!!(t.show&&t.tooltip.enabled&&e.globals.axisCharts)),this.allTooltipSeriesGroups=[],e.globals.axisCharts||(this.showTooltipTitle=!1);const s=this.getElTooltip();(null==s?void 0:s.parentNode)&&s.parentNode.removeChild(s),this.tooltipTitle=null;const i=b.createElementNS("http://www.w3.org/1999/xhtml","div");i.classList.add("apexcharts-tooltip"),e.config.tooltip.cssClass&&i.classList.add(e.config.tooltip.cssClass),i.classList.add(`apexcharts-theme-${this.tConfig.theme||"light"}`),this.tConfig.fillSeriesColor&&i.classList.add("apexcharts-tooltip-fill-series"),this.tConfig.style&&this.tConfig.style.background&&i.style.setProperty("--apx-tt-bg",this.tConfig.style.background);const a=this.tConfig.shared&&e.config.series.length>1&&!e.globals.isBarHorizontal;if(this.tConfig.arrow&&!this.tConfig.followCursor&&!this.tConfig.fixed.enabled&&!a&&!this.tConfig.fillSeriesColor&&e.globals.axisCharts){const t=b.createElementNS("http://www.w3.org/1999/xhtml","div");t.classList.add("apexcharts-tooltip-arrow"),i.appendChild(t)}if(e.config.chart.accessibility.enabled&&e.config.chart.accessibility.announcements.enabled&&(i.setAttribute("role","tooltip"),i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),i.setAttribute("aria-hidden","true")),e.dom.elWrap.appendChild(i),e.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();const t=new K(this.w,this.ctx,void 0);this.xAxisTicksPositions=t.getXAxisTicksPositions()}if(!e.globals.comboCharts&&!this.tConfig.intersect&&"rangeBar"!==e.config.chart.type||this.tConfig.shared||(this.showOnIntersect=!0),0!==e.config.markers.size&&0!==e.globals.markers.largestSize||this.marker.drawDynamicPoints(),e.globals.collapsedSeries.length===e.seriesData.series.length)return;this.dataPointsDividedHeight=e.layout.gridHeight/e.globals.dataPoints,this.dataPointsDividedWidth=e.layout.gridWidth/e.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=b.createElementNS("http://www.w3.org/1999/xhtml","div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,i.appendChild(this.tooltipTitle));let o=e.seriesData.series.length;(e.globals.xyCharts||e.globals.comboCharts)&&this.tConfig.shared&&(o=this.showOnIntersect?1:e.seriesData.series.length),this.legendLabels=e.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(o),this.addSVGEvents(),this.setupDimensionCache()}createTTElements(t){const e=this.w,s=[],i=this.getElTooltip();if(!i)return s;for(let a=0;a<t;a++){const o=b.createElementNS("http://www.w3.org/1999/xhtml","div");o.classList.add("apexcharts-tooltip-series-group",`apexcharts-tooltip-series-group-${a}`),o.style.order=String(e.config.tooltip.inverseOrder?t-a:a+1);const r=b.createElementNS("http://www.w3.org/1999/xhtml","span");r.classList.add("apexcharts-tooltip-marker"),e.config.tooltip.fillSeriesColor?r.style.backgroundColor=e.globals.colors[a]:r.style.color=e.globals.colors[a];const n=e.config.markers.shape;let l=n;Array.isArray(n)&&(l=n[a]),r.setAttribute("shape",l),r.innerHTML=Rt(l),o.appendChild(r);const h=b.createElementNS("http://www.w3.org/1999/xhtml","div");h.classList.add("apexcharts-tooltip-text"),h.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,h.style.fontSize=this.tConfig.style.fontSize,["y","goals","z"].forEach(t=>{const e=b.createElementNS("http://www.w3.org/1999/xhtml","div");e.classList.add(`apexcharts-tooltip-${t}-group`);const s=b.createElementNS("http://www.w3.org/1999/xhtml","span");s.classList.add(`apexcharts-tooltip-text-${t}-label`),e.appendChild(s);const i=b.createElementNS("http://www.w3.org/1999/xhtml","span");i.classList.add(`apexcharts-tooltip-text-${t}-value`),e.appendChild(i),h.appendChild(e)}),o.appendChild(h),i.appendChild(o),s.push(o)}return s}addSVGEvents(){const t=this.w,e=t.config.chart.type,s=this.getElTooltip();if(!s)return;const i=!("bar"!==e&&"candlestick"!==e&&"boxPlot"!==e&&"violin"!==e&&"rangeBar"!==e),a="area"===e||"line"===e||"scatter"===e||"bubble"===e||"radar"===e,o=t.dom.Paper.node,r=this.getElGrid();r&&(this.seriesBound=r.getBoundingClientRect());const n=[],l=[],h={hoverArea:o,elGrid:r,tooltipEl:s,tooltipY:n,tooltipX:l,ttItems:this.ttItems};let c;if(t.globals.axisCharts&&(a?c=t.dom.baseEl.querySelectorAll(".apexcharts-series[data\\:longestSeries='true'] .apexcharts-marker"):i?c=t.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-bar-area, .apexcharts-series .apexcharts-candlestick-area, .apexcharts-series .apexcharts-boxPlot-area, .apexcharts-series .apexcharts-violin-area, .apexcharts-series .apexcharts-rangebar-area"):"heatmap"!==e&&"treemap"!==e||(c=t.dom.baseEl.querySelectorAll(".apexcharts-series .apexcharts-heatmap, .apexcharts-series .apexcharts-treemap")),c&&c.length))for(let t=0;t<c.length;t++)n.push(c[t].getAttribute("cy")),l.push(c[t].getAttribute("cx"));if(t.globals.xyCharts&&!this.showOnIntersect||t.globals.comboCharts&&!this.showOnIntersect||i&&this.tooltipUtil.hasBars()&&this.tConfig.shared)this.addPathsEventListeners([o],h);else if(i&&!t.globals.comboCharts||a&&this.showOnIntersect)this.addDatapointEventsListeners(h);else if(!t.globals.axisCharts||"heatmap"===e||"treemap"===e){const e=t.dom.baseEl.querySelectorAll(".apexcharts-series");this.addPathsEventListeners(e,h)}if(this.showOnIntersect){const e=t.dom.baseEl.querySelectorAll(".apexcharts-line-series .apexcharts-marker, .apexcharts-area-series .apexcharts-marker");e.length>0&&this.addPathsEventListeners(e,h),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(h)}}drawFixedTooltipRect(){const t=this.w,e=this.getElTooltip();if(!e)return{x:0,y:0,ttWidth:0,ttHeight:0};const s=e.getBoundingClientRect(),i=s.width+10,a=s.height+10;let o=this.tConfig.fixed.offsetX,r=this.tConfig.fixed.offsetY;const n=this.tConfig.fixed.position.toLowerCase();return n.indexOf("right")>-1&&(o=o+t.globals.svgWidth-i+10),n.indexOf("bottom")>-1&&(r=r+t.globals.svgHeight-a-10),this.tooltipPosition.applyTooltipPosition(e,{x:o,y:r}),{x:o,y:r,ttWidth:i,ttHeight:a}}addDatapointEventsListeners(t){const e=this.w.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-boxPlot-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}addPathsEventListeners(t,e){const s=this;for(let i=0;i<t.length;i++){const a={paths:t[i],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map(e=>t[i].addEventListener(e,s.onSeriesHover.bind(s,a),{capture:!1,passive:!0}))}}onSeriesHover(t,e){const s=Date.now()-this.lastHoverTime;s>=20?this.seriesHover(t,e):(clearTimeout(this.seriesHoverTimeout),this.seriesHoverTimeout=setTimeout(()=>{this.seriesHover(t,e)},20-s))}seriesHover(t,e){this.lastHoverTime=Date.now();let s=[];const i=this.w;i.config.chart.group&&(s=this.ctx.getGroupedCharts()),i.globals.axisCharts&&(i.globals.minX===-1/0&&i.globals.maxX===1/0||0===i.globals.dataPoints)||(s.length?s.forEach(s=>{const i=this.getElTooltip(s),a={paths:t.paths,tooltipEl:i,tooltipY:t.tooltipY,tooltipX:t.tooltipX,elGrid:t.elGrid,hoverArea:t.hoverArea,ttItems:s.w.globals.tooltip.ttItems};s.w.globals.minX===this.w.globals.minX&&s.w.globals.maxX===this.w.globals.maxX&&s.w.globals.tooltip.seriesHoverByContext({chartCtx:s,ttCtx:s.w.globals.tooltip,opt:a,e:e})}):this.seriesHoverByContext({chartCtx:this.ctx,ttCtx:this.w.globals.tooltip,opt:t,e:e}))}seriesHoverByContext({chartCtx:t,ttCtx:e,opt:s,e:i}){const a=t.w;if(!this.getElTooltip(t))return;const o=e.getCachedDimensions();if(e.tooltipRect={x:0,y:0,ttWidth:o.ttWidth,ttHeight:o.ttHeight},e.e=i,e.tooltipUtil.hasBars()&&!a.globals.comboCharts&&!e.isBarShared&&this.tConfig.onDatasetHover.highlightDataSeries){new lt(t.w).toggleSeriesOnHover(i,i.target.parentNode)}a.globals.axisCharts?e.axisChartsTooltips({e:i,opt:s,tooltipRect:e.tooltipRect}):e.nonAxisChartsTooltips({e:i,opt:s,tooltipRect:e.tooltipRect}),e.fixedTooltip&&e.drawFixedTooltipRect()}axisChartsTooltips({e:t,opt:e}){var s;const i=this.w;let a,o;const r=e.elGrid.getBoundingClientRect(),n="touchmove"===t.type?t.touches[0].clientX:t.clientX,l="touchmove"===t.type?t.touches[0].clientY:t.clientY;if(this.clientY=l,this.clientX=n,i.interact.capturedSeriesIndex=-1,i.interact.capturedDataPointIndex=-1,l<r.top||l>r.top+r.height)return void this.handleMouseOut(e);if(Array.isArray(this.tConfig.enabledOnSeries)&&!i.config.tooltip.shared){const t=parseInt(e.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(t)<0)return void this.handleMouseOut(e)}const h=this.getElTooltip();if(!h)return;const c=this.getElXCrosshairs();let d=[];i.config.chart.group&&(d=this.ctx.getSyncedCharts());const g=i.globals.xyCharts||"bar"===i.config.chart.type&&!i.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||i.globals.comboCharts&&this.tooltipUtil.hasBars();if("mousemove"===t.type||"touchmove"===t.type||"mouseup"===t.type){if(i.globals.collapsedSeries.length+i.globals.ancillaryCollapsedSeries.length===i.seriesData.series.length)return;null!==c&&c.classList.add("apexcharts-active");const r=null==(s=this.yaxisTooltips)?void 0:s.filter(t=>!0===t),p=this.ycrosshairs;if(null!==p&&(null==r?void 0:r.length)&&p.classList.add("apexcharts-active"),g&&!this.showOnIntersect||d.length>1)this.handleStickyTooltip(t,n,l,e);else if("heatmap"===i.config.chart.type||"treemap"===i.config.chart.type){const s=this.intersect.handleHeatTreeTooltip({e:t,opt:e,x:a,y:o,type:i.config.chart.type});a=s.x,o=s.y,h.style.left=a+"px",h.style.top=o+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:t,opt:e}),this.tooltipUtil.hasMarkers(0)&&this.intersect.handleMarkerTooltip({e:t,opt:e,x:a,y:o});if(this.yaxisTooltips&&this.yaxisTooltips.length)for(let t=0;t<i.config.yaxis.length;t++)this.axesTooltip.drawYaxisTooltipText(t,l,this.xyRatios);i.dom.baseEl.classList.add("apexcharts-tooltip-active"),e.tooltipEl.classList.add("apexcharts-active"),i.config.chart.accessibility.enabled&&i.config.chart.accessibility.announcements.enabled&&e.tooltipEl.removeAttribute("aria-hidden")}else"mouseout"!==t.type&&"touchend"!==t.type||this.handleMouseOut(e)}nonAxisChartsTooltips({e:t,opt:e,tooltipRect:s}){var i,a,o,r;const n=this.w,l=e.paths.getAttribute("rel"),h=this.getElTooltip();if(!h)return;const c=n.dom.elWrap.getBoundingClientRect();if("mousemove"===t.type||"touchmove"===t.type){let t,r;n.dom.baseEl.classList.add("apexcharts-tooltip-active"),h.classList.add("apexcharts-active"),n.config.chart.accessibility.enabled&&n.config.chart.accessibility.announcements.enabled&&h.removeAttribute("aria-hidden"),this.tooltipLabels.drawSeriesTexts({ttItems:e.ttItems,i:parseInt(l,10)-1,shared:!1});const d=e.paths.querySelector("path[data\\:cx]")||e.paths;if(n.config.tooltip.intersect&&d.hasAttribute("data:cx")&&d.hasAttribute("data:cy")){const e=n.dom.Paper.node.getBoundingClientRect();t=e.left-c.left+parseFloat(d.getAttribute("data:cx"))-s.ttWidth/2,r=e.top-c.top+parseFloat(d.getAttribute("data:cy"))-s.ttHeight-10}else t=(null!=(i=n.interact.clientX)?i:0)-c.left-s.ttWidth/2,r=(null!=(a=n.interact.clientY)?a:0)-c.top-s.ttHeight-10;if(h.style.left=t+"px",h.style.top=r+"px",n.config.legend.tooltipHoverFormatter){const t=n.config.legend.tooltipHoverFormatter,e=l-1,s=null==(o=this.legendLabels)?void 0:o[e];if(!s)return;const i=t(s.getAttribute("data:default-text"),{seriesIndex:e,dataPointIndex:e,w:n});s.innerHTML=i}}else"mouseout"!==t.type&&"touchend"!==t.type||(h.classList.remove("apexcharts-active"),n.dom.baseEl.classList.remove("apexcharts-tooltip-active"),n.config.legend.tooltipHoverFormatter&&(null==(r=this.legendLabels)||r.forEach(t=>{const e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(null!=e?e:"")})))}handleStickyTooltip(t,e,s,i){const a=this.w,o=this.tooltipUtil.getNearestValues({context:this,hoverArea:i.hoverArea,elGrid:i.elGrid,clientX:e,clientY:s}),r=o.j;let n=o.capturedSeries;null!==n&&a.globals.collapsedSeriesIndices.includes(null!=n?n:-1)&&(n=null);const l=i.elGrid.getBoundingClientRect();if(o.hoverX<0||o.hoverX>l.width)this.handleMouseOut(i);else if(null!==n)this.handleStickyCapturedSeries(t,null!=n?n:-1,i,null!=r?r:0);else if(this.tooltipUtil.isXoverlap(null!=r?r:0)||a.globals.isBarHorizontal){const e=a.seriesData.series.findIndex((t,e)=>!a.globals.collapsedSeriesIndices.includes(e));this.create(t,this,e,null!=r?r:0,i.ttItems)}}handleStickyCapturedSeries(t,e,s,i){const a=this.w;if(!this.tConfig.shared){if(null===a.seriesData.series[e][i])return void this.handleMouseOut(s)}if(void 0!==a.seriesData.series[e][i])this.tConfig.shared&&this.tooltipUtil.isXoverlap(i)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,i,s.ttItems):this.create(t,this,e,i,s.ttItems,!1);else if(this.tooltipUtil.isXoverlap(i)){const e=a.seriesData.series.findIndex((t,e)=>!a.globals.collapsedSeriesIndices.includes(e));this.create(t,this,e,i,s.ttItems)}}deactivateHoverFilter(){const t=this.w,e=new N(this.w,this.ctx),s=t.dom.Paper.find(".apexcharts-bar-area");for(let t=0;t<s.length;t++)e.pathMouseLeave(s[t],void 0)}handleMouseOut(t){var e,s;const i=this.w,a=this.getElXCrosshairs();i.dom.baseEl.classList.remove("apexcharts-tooltip-active"),t.tooltipEl.classList.remove("apexcharts-active"),delete t.tooltipEl.dataset.positioned,i.config.chart.accessibility.enabled&&i.config.chart.accessibility.announcements.enabled&&t.tooltipEl.setAttribute("aria-hidden","true"),this.deactivateHoverFilter(),"bubble"!==i.config.chart.type&&this.marker.resetPointsSize(),null!==a&&a.classList.remove("apexcharts-active");const o=this.ycrosshairs;if(null!==o&&o.classList.remove("apexcharts-active"),this.isXAxisTooltipEnabled&&(null==(e=this.xaxisTooltip)||e.classList.remove("apexcharts-active")),this.yaxisTooltips&&this.yaxisTooltips.length){null===this.yaxisTTEls&&(this.yaxisTTEls=[...i.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip")]);for(let t=0;t<this.yaxisTTEls.length;t++)this.yaxisTTEls[t].classList.remove("apexcharts-active")}i.config.legend.tooltipHoverFormatter&&(null==(s=this.legendLabels)||s.forEach(t=>{const e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(null!=e?e:"")}))}markerClick(t,e,s){const i=this.w;"function"==typeof i.config.chart.events.markerClick&&i.config.chart.events.markerClick(t,this.ctx,{seriesIndex:e,dataPointIndex:s,w:i}),this.ctx.events.fireEvent("markerClick",[t,this.ctx,{seriesIndex:e,dataPointIndex:s,w:i}])}create(t,e,s,i,a,o=null){var r,h,c,d,g,p,u,x,f,b,m,y,w,v,A,C,S,k,D;const L=this.w,M=e;"mouseup"===t.type&&this.markerClick(t,s,i),null===o&&(o=this.tConfig.shared);const P=this.tooltipUtil.hasMarkers(s),T=this.tooltipUtil.getElBars(),F=()=>{L.globals.markers.largestSize>0?M.marker.enlargePoints(i):M.tooltipPosition.moveDynamicPointsOnHover(i)};if(L.config.legend.tooltipHoverFormatter){const t=L.config.legend.tooltipHoverFormatter,e=Array.from(null!=(r=this.legendLabels)?r:[]);e.forEach(t=>{const e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(null!=e?e:"")});for(let a=0;a<e.length;a++){const r=e[a],n=parseInt(null!=(h=r.getAttribute("i"))?h:"",10),l=decodeURIComponent(null!=(c=r.getAttribute("data:default-text"))?c:""),d=t(l,{seriesIndex:o?n:s,dataPointIndex:i,w:L});if(o)r.innerHTML=L.globals.collapsedSeriesIndices.indexOf(n)<0?d:l;else if(r.innerHTML=n===s?d:l,s===n)break}}const E=L.rangeData,I=n(n({ttItems:a,i:s,j:i},void 0!==(null==(u=null==(p=null==(g=null==(d=E.seriesRange)?void 0:d[s])?void 0:g[i])?void 0:p.y[0])?void 0:u.y1)&&{y1:null==(m=null==(b=null==(f=null==(x=E.seriesRange)?void 0:x[s])?void 0:f[i])?void 0:b.y[0])?void 0:m.y1}),void 0!==(null==(A=null==(v=null==(w=null==(y=E.seriesRange)?void 0:y[s])?void 0:w[i])?void 0:v.y[0])?void 0:A.y2)&&{y2:null==(D=null==(k=null==(S=null==(C=E.seriesRange)?void 0:C[s])?void 0:S[i])?void 0:k.y[0])?void 0:D.y2});if(o){if(M.tooltipLabels.drawSeriesTexts(l(n({},I),{shared:!this.showOnIntersect&&this.tConfig.shared})),P)F();else if(this.tooltipUtil.hasBars()&&(this.barSeriesHeight=this.tooltipUtil.getBarsHeight([...T]),this.barSeriesHeight>0)){const t=new N(this.w,this.ctx),e=L.dom.Paper.find(`.apexcharts-bar-area[j='${i}']`);this.deactivateHoverFilter();M.tooltipUtil.getAllMarkers(!0).length&&!this.barSeriesHeight&&F(),M.tooltipPosition.moveStickyTooltipOverBars(i,s);for(let s=0;s<e.length;s++)t.pathMouseEnter(e[s],void 0)}}else M.tooltipLabels.drawSeriesTexts(n({shared:!1},I)),this.tooltipUtil.hasBars()&&M.tooltipPosition.moveStickyTooltipOverBars(i,s),P&&M.tooltipPosition.moveMarkers(s,i)}}class Nt{constructor(t){this.node=t,t&&(t.instance=this),this._listeners=[],this._filter=null}attr(t,e){if("string"==typeof t&&void 0===e)return this.node.getAttribute(t);const s="string"==typeof t?{[t]:e}:t;for(const t in s){let e=s[t];null===e?this.node.removeAttribute(t):void 0!==e&&("number"==typeof e&&isNaN(e)&&(e=0),this.node.setAttribute(t,e))}if("text"===this.node.nodeName&&null!=s.x){const t=this.node.querySelectorAll("tspan[data-newline]");for(let e=0;e<t.length;e++)t[e].setAttribute("x",s.x)}return this}css(t){for(const e in t)this.node.style[e]=t[e];return this}fill(t){return"object"==typeof t?this.attr(t):this.attr("fill",t)}stroke(t){return"object"==typeof t?(void 0!==t.color&&this.attr("stroke",t.color),void 0!==t.width&&this.attr("stroke-width",t.width),void 0!==t.dasharray&&this.attr("stroke-dasharray",t.dasharray),void 0!==t.linecap&&this.attr("stroke-linecap",t.linecap),void 0!==t.opacity&&this.attr("stroke-opacity",t.opacity),this):this.attr("stroke",t)}size(t,e){return this.attr({width:t,height:e})}move(t,e){return this.attr({x:t,y:e})}center(t,e){if("g"===this.node.nodeName){const s=this.bbox(),i=t-(s.x+s.width/2),a=e-(s.y+s.height/2);return this.attr("transform",`translate(${i}, ${a})`)}return this.attr({cx:t,cy:e})}add(t){return this.node.appendChild(t.node||t),this}addTo(t){return(t.node||t).appendChild(this.node),this}remove(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node),this}clear(){for(;this.node.firstChild;)this.node.removeChild(this.node.firstChild);return this}find(t){return Array.from(this.node.querySelectorAll(t)).map(t=>t.instance||new Nt(t))}findOne(t){const e=this.node.querySelector(t);return e?e.instance||new Nt(e):null}on(t,e){const s=t.split(".")[0];return this._listeners.push({event:t,eventType:s,handler:e}),this.node.addEventListener(s,e),this}off(t,e){if(t||e)if(t&&!e){const e=t.split(".")[0];this._listeners=this._listeners.filter(t=>t.eventType!==e||(this.node.removeEventListener(t.eventType,t.handler),!1))}else{const s=t.split(".")[0];this._listeners=this._listeners.filter(t=>t.eventType!==s||t.handler!==e||(this.node.removeEventListener(t.eventType,t.handler),!1))}else this._listeners.forEach(t=>{this.node.removeEventListener(t.eventType,t.handler)}),this._listeners=[];return this}each(t,e){return Array.from(this.node.children).forEach(s=>{const i=s.instance||new Nt(s);t.call(i),e&&i.each(t,e)}),this}removeClass(t){return"*"===t?this.node.removeAttribute("class"):this.node.classList.remove(t),this}children(){return Array.from(this.node.childNodes).filter(t=>1===t.nodeType).map(t=>t.instance||new Nt(t))}hide(){return this.node.style.display="none",this}show(){return this.node.style.display="",this}bbox(){if("function"==typeof this.node.getBBox)try{return this.node.getBBox()}catch(t){}return{x:0,y:0,width:0,height:0}}tspan(t){const e=b.createElementNS("http://www.w3.org/2000/svg","tspan");return e.textContent=t,this.node.appendChild(e),new Nt(e)}plot(t){return"string"==typeof t&&this.attr("d",t),this}animate(){throw new Error("Animation module not loaded")}filterWith(){throw new Error("Filter module not loaded")}unfilter(t){return this._filter&&(this.node.removeAttribute("filter"),t&&this._filter.node&&this._filter.node.parentNode&&this._filter.node.parentNode.removeChild(this._filter.node),this._filter=null),this}filterer(){return this._filter}}let Wt=0;class Ot extends Nt{constructor(t,e,s){const i="radial"===e?"radialGradient":"linearGradient";super(b.createElementNS(W,i)),this._id="SvgjsGradient"+ ++Wt,this.attr("id",this._id),"function"==typeof s&&s(new _t(this));let a=t.node.querySelector("defs");a||(a=b.createElementNS(W,"defs"),t.node.appendChild(a)),a.appendChild(this.node)}stop(t,e,s){const i=b.createElementNS(W,"stop");return i.setAttribute("offset",t),i.setAttribute("stop-color",e),void 0!==s&&i.setAttribute("stop-opacity",String(s)),this.node.appendChild(i),this}from(t,e){return this.attr({x1:t,y1:e})}to(t,e){return this.attr({x2:t,y2:e})}url(){return"url(#"+this._id+")"}toString(){return this.url()}valueOf(){return this.url()}fill(){return this.url()}}class _t{constructor(t){this.gradient=t}stop(t,e,s){return this.gradient.stop(t,e,s),this}}let $t=0;class Gt extends Nt{constructor(t,e,s,i){if(super(b.createElementNS(W,"pattern")),this._id="SvgjsPattern"+ ++$t,this.attr({id:this._id,width:e,height:s,patternUnits:"userSpaceOnUse"}),"function"==typeof i){i(new jt(this.node))}let a=t.node.querySelector("defs");a||(a=b.createElementNS(W,"defs"),t.node.appendChild(a)),a.appendChild(this.node)}url(){return"url(#"+this._id+")"}toString(){return this.url()}valueOf(){return this.url()}fill(){return this.url()}}class jt extends Nt{line(t,e,s,i){const a=this._make("line");return void 0!==t&&a.attr({x1:t,y1:e,x2:s,y2:i}),a}rect(t,e){const s=this._make("rect");return void 0!==t&&s.attr({width:t,height:e}),s}circle(t){const e=this._make("circle");return void 0!==t&&e.attr({r:t/2,cx:t/2,cy:t/2}),e}path(t){const e=this._make("path");return t&&e.attr("d",t),e}polygon(t){const e=this._make("polygon");return t&&e.attr("points",t),e}group(){return this._makeContainer("g")}defs(){return this._makeContainer("defs")}plain(t){const e=b.createElementNS(W,"text");e.textContent=t;const s=new Nt(e);return this.node.appendChild(e),s}text(t){const e=b.createElementNS(W,"text"),s=new Nt(e);return this.node.appendChild(e),"function"==typeof t&&t(new Vt(e)),s}image(t,e){const s=b.createElementNS(W,"image");s.setAttributeNS("http://www.w3.org/1999/xlink","href",t);const i=new Nt(s);if(this.node.appendChild(s),"function"==typeof e){const s=new Image;s.onload=function(){i.size(s.width,s.height),e.call(i,{width:s.width,height:s.height})},s.src=t}return i}gradient(t,e){return new Ot(this,t,e)}pattern(t,e,s){return new Gt(this,t,e,s)}_make(t){const e=b.createElementNS(W,t);return this.node.appendChild(e),new Nt(e)}_makeContainer(t){const e=b.createElementNS(W,t);return this.node.appendChild(e),new jt(e)}}class Vt{constructor(t){this.textNode=t}tspan(t){const e=b.createElementNS(W,"tspan");return e.textContent=t,this.textNode.appendChild(e),new Ut(e,this.textNode)}}class Ut{constructor(t,e){this.node=t,this.textNode=e}newLine(){return this.node.setAttribute("dy","1.1em"),this.node.dataset.newline="1",this}}let qt=0;class Zt extends Nt{constructor(){super(b.createElementNS(W,"filter")),this._id="SvgjsFilter"+ ++qt,this.attr("id",this._id)}size(t,e,s,i){return this.attr({width:t,height:e,x:s,y:i})}}class Kt{constructor(t){this.filter=t}colorMatrix(t){return this._primitive("feColorMatrix",t)}offset(t){return this._primitive("feOffset",t)}gaussianBlur(t){return this._primitive("feGaussianBlur",t)}flood(t){return this._primitive("feFlood",t)}composite(t){return this._primitive("feComposite",t)}merge(t){const e=b.createElementNS(W,"feMerge");return t.forEach(t=>{const s=b.createElementNS(W,"feMergeNode");s.setAttribute("in",t),e.appendChild(s)}),this.filter.node.appendChild(e),new Nt(e)}_primitive(t,e){const s=b.createElementNS(W,t);for(const t in e)s.setAttribute(t,e[t]);return this.filter.node.appendChild(s),new Nt(s)}}function Jt(t){if(!t||"string"!=typeof t)return[["M",0,0]];const e=[],s=/([MmLlHhVvCcSsQqTtAaZz])\s*/g,i=/[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/gi;let a;const o=[],r=[];for(;null!==(a=s.exec(t));)o.push(a[1]),r.push(a.index);for(let s=0;s<o.length;s++){const a=r[s]+o[s].length,n=s+1<r.length?r[s+1]:t.length,l=t.substring(a,n),h=[];let c;for(i.lastIndex=0;null!==(c=i.exec(l));)h.push(parseFloat(c[0]));const d=o[s].toUpperCase();if("Z"===d)e.push(["Z"]);else if("M"===d||"L"===d||"T"===d)for(let t=0;t<h.length;t+=2)e.push([d,h[t],h[t+1]]);else if("H"===d)for(let t=0;t<h.length;t++)e.push([d,h[t]]);else if("V"===d)for(let t=0;t<h.length;t++)e.push([d,h[t]]);else if("C"===d)for(let t=0;t<h.length;t+=6)e.push([d,h[t],h[t+1],h[t+2],h[t+3],h[t+4],h[t+5]]);else if("S"===d||"Q"===d)for(let t=0;t<h.length;t+=4)e.push([d,h[t],h[t+1],h[t+2],h[t+3]]);else if("A"===d)for(let t=0;t<h.length;t+=7)e.push([d,h[t],h[t+1],h[t+2],h[t+3],h[t+4],h[t+5],h[t+6]])}return 0===e.length&&e.push(["M",0,0]),e}function Qt(t){let e=1/0,s=1/0,i=-1/0,a=-1/0;return t.forEach(t=>{for(let o=1;o<t.length;o+=2)if(o+1<=t.length){const r=t[o],n=t[o+1];"number"==typeof r&&"number"==typeof n&&(r<e&&(e=r),r>i&&(i=r),n<s&&(s=n),n>a&&(a=n))}}),e===1/0?{x:0,y:0,width:0,height:0}:{x:e,y:s,width:i-e,height:a-s}}function te(t){switch(t[0]){case"z":case"Z":t[0]="L",t[1]=this.start[0],t[2]=this.start[1];break;case"H":t[0]="L",t[2]=this.pos[1];break;case"V":t[0]="L",t[2]=t[1],t[1]=this.pos[0];break;case"T":t[0]="Q",t[3]=t[1],t[4]=t[2],t[1]=this.reflection[1],t[2]=this.reflection[0];break;case"S":t[0]="C",t[6]=t[4],t[5]=t[3],t[4]=t[2],t[3]=t[1],t[2]=this.reflection[1],t[1]=this.reflection[0]}return t}function ee(t){var e=t.length;return this.pos=[t[e-2],t[e-1]],-1!="SCQT".indexOf(t[0])&&(this.reflection=[2*this.pos[0]-t[e-4],2*this.pos[1]-t[e-3]]),t}function se(t){var e,s=[t];switch(t[0]){case"M":return this.pos=this.start=[t[1],t[2]],s;case"L":t[5]=t[3]=t[1],t[6]=t[4]=t[2],t[1]=this.pos[0],t[2]=this.pos[1];break;case"Q":t[6]=t[4],t[5]=t[3],t[4]=1*t[4]/3+2*t[2]/3,t[3]=1*t[3]/3+2*t[1]/3,t[2]=1*this.pos[1]/3+2*t[2]/3,t[1]=1*this.pos[0]/3+2*t[1]/3;break;case"A":s=function(t,e){var s,i,a,o,r,n,l,h,c,d,g,p,u,x,f,b,m,y,w,v,A,C,S,k,D,L,M=Math.abs(e[1]),P=Math.abs(e[2]),T=e[3]%360,F=e[4],E=e[5],I=e[6],X=e[7],R=new O(t[0],t[1]),z=new O(I,X),Y=[];if(0===M||0===P||R.x===z.x&&R.y===z.y)return[["C",R.x,R.y,z.x,z.y,z.x,z.y]];s=new O((R.x-z.x)/2,(R.y-z.y)/2).transform((new _).rotate(T)),(i=s.x*s.x/(M*M)+s.y*s.y/(P*P))>1&&(M*=i=Math.sqrt(i),P*=i);a=(new _).rotate(T).scale(1/M,1/P).rotate(-T),R=R.transform(a),z=z.transform(a),o=[z.x-R.x,z.y-R.y],n=o[0]*o[0]+o[1]*o[1],r=Math.sqrt(n),o[0]/=r,o[1]/=r,l=n<4?Math.sqrt(1-n/4):0,F===E&&(l*=-1);h=new O((z.x+R.x)/2+l*-o[1],(z.y+R.y)/2+l*o[0]),c=new O(R.x-h.x,R.y-h.y),d=new O(z.x-h.x,z.y-h.y),g=Math.acos(c.x/Math.sqrt(c.x*c.x+c.y*c.y)),c.y<0&&(g*=-1);p=Math.acos(d.x/Math.sqrt(d.x*d.x+d.y*d.y)),d.y<0&&(p*=-1);E&&g>p&&(p+=2*Math.PI);!E&&g<p&&(p-=2*Math.PI);for(x=Math.ceil(2*Math.abs(g-p)/Math.PI),b=[],m=g,u=(p-g)/x,f=4*Math.tan(u/4)/3,A=0;A<=x;A++)w=Math.cos(m),y=Math.sin(m),v=new O(h.x+w,h.y+y),b[A]=[new O(v.x+f*y,v.y-f*w),v,new O(v.x-f*y,v.y+f*w)],m+=u;for(b[0][0]=b[0][1].clone(),b[b.length-1][2]=b[b.length-1][1].clone(),a=(new _).rotate(T).scale(M,P).rotate(-T),A=0,C=b.length;A<C;A++)b[A][0]=b[A][0].transform(a),b[A][1]=b[A][1].transform(a),b[A][2]=b[A][2].transform(a);for(A=1,C=b.length;A<C;A++)S=(v=b[A-1][2]).x,k=v.y,D=(v=b[A][0]).x,L=v.y,I=(v=b[A][1]).x,X=v.y,Y.push(["C",S,k,D,L,I,X]);return Y}(null!=(e=this.pos)?e:[],t),t=s[0]}return t[0]="C",this.pos=[t[5],t[6]],this.reflection=[2*t[5]-t[3],2*t[6]-t[4]],s}function ie(t,e){if(!1===e)return!1;for(var s=e,i=t.length;s<i;++s)if("M"==t[s][0])return s;return!1}function ae(t,e,s,i,a,o){for(var r=t.slice(e,s||void 0),n=i.slice(a,o||void 0),l=0,h={pos:[0,0],start:[0,0]},c={pos:[0,0],start:[0,0]};r[l]=te.call(h,r[l]),n[l]=te.call(c,n[l]),r[l][0]!=n[l][0]||"M"==r[l][0]||"A"==r[l][0]&&(r[l][4]!=n[l][4]||r[l][5]!=n[l][5])?(Array.prototype.splice.apply(r,[l,1].concat(se.call(h,r[l]))),Array.prototype.splice.apply(n,[l,1].concat(se.call(c,n[l])))):(r[l]=ee.call(h,r[l]),n[l]=ee.call(c,n[l])),++l!=r.length||l!=n.length;)l==r.length&&r.push(["C",h.pos[0],h.pos[1],h.pos[0],h.pos[1],h.pos[0],h.pos[1]]),l==n.length&&n.push(["C",c.pos[0],c.pos[1],c.pos[0],c.pos[1],c.pos[0],c.pos[1]]);return{start:r,dest:n}}function oe(t,e){var s=function(t,e){for(var s,i=Jt(t),a=Jt(e),o=0,r=0,n=!1,l=!1;!1!==o||!1!==r;){if(n=ie(i,!1!==o&&o+1),l=ie(a,!1!==r&&r+1),!1===o){const t=Qt(s.start);o=0==t.height||0==t.width?i.push(i[0])-1:i.push(["M",t.x+t.width/2,t.y+t.height/2])-1}if(!1===r){const t=Qt(s.dest);r=0==t.height||0==t.width?a.push(a[0])-1:a.push(["M",t.x+t.width/2,t.y+t.height/2])-1}s=ae(i,o,n,a,r,l),i=i.slice(0,o).concat(s.start,!1===n?[]:i.slice(n)),a=a.slice(0,r).concat(s.dest,!1===l?[]:a.slice(l)),o=!1!==n&&o+s.start.length,r=!1!==l&&r+s.dest.length}return{start:i,dest:a}}(t,e),i=s.start,a=s.dest;return function(t){var e=i.map(function(e,s){return a[s].map(function(i,o){return 0===o?i:e[o]+(a[s][o]-e[o])*t})});return e.map(t=>t.join(" ")).join(" ")}}let re=null,ne=null;function le(t,e){const s=new Array(e);if(!c.isBrowser()){const i=Qt(Jt(t)),a=i.x+i.width/2,o=i.y+i.height/2;for(let t=0;t<e;t++)s[t]={x:a,y:o};return s}re||(re=document.createElementNS("http://www.w3.org/2000/svg","svg"),re.setAttribute("width","0"),re.setAttribute("height","0"),re.setAttribute("style","position:absolute;width:0;height:0;visibility:hidden;pointer-events:none;"),ne=document.createElementNS("http://www.w3.org/2000/svg","path"),re.appendChild(ne),document.body.appendChild(re)),ne.setAttribute("d",t||"M0 0");let i=0;try{i=ne.getTotalLength()}catch(t){i=0}if(!i||!isFinite(i)){const i=Qt(Jt(t)),a=i.x+i.width/2,o=i.y+i.height/2;for(let t=0;t<e;t++)s[t]={x:a,y:o};return s}for(let t=0;t<e;t++)try{const a=ne.getPointAtLength(t/e*i);s[t]={x:a.x,y:a.y}}catch(e){s[t]={x:0,y:0}}return s}function he(t){if(!t||"string"!=typeof t)return null;if("#"===t[0]){let e=t.slice(1);3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const s=parseInt(e,16);return[s>>16&255,s>>8&255,255&s,1]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);return e?[+e[1],+e[2],+e[3],void 0!==e[4]?+e[4]:1]:null}function ce(t,e,s){return`rgba(${Math.round(t[0]+(e[0]-t[0])*s)},${Math.round(t[1]+(e[1]-t[1])*s)},${Math.round(t[2]+(e[2]-t[2])*s)},${t[3]+(e[3]-t[3])*s})`}class de{constructor(t,e,s){this.el=t,this.duration=null!=e?e:300,this.delay=s||0,this._attrTarget=null,this._plotTarget=null,this._plotAlgorithm="commands",this._afterCb=null,this._duringCb=null,this._next=null,this._root=null,this._scheduled=!1}attr(t){return this._attrTarget=t,this._schedule(),this}plot(t,e){return this._plotTarget=t,e&&(this._plotAlgorithm=e),this._schedule(),this}after(t){return this._afterCb=t,this._schedule(),this}during(t){return this._duringCb=t,this._schedule(),this}animate(t,e){const s=new de(this.el,t,e);return this._next=s,s._root=this._root||this,s}_schedule(){const t=this._root||this;t._scheduled||(t._scheduled=!0,queueMicrotask(()=>t._executeChain()))}_executeChain(){const t=[];let e=this;for(;e;)t.push(e),e=e._next;let s=0;t.forEach(t=>{s+=t.delay,t._execute(s),s+=t.duration})}_execute(t){const e=this.el,s=this.duration;if(s<=1){const s=()=>{this._attrTarget&&e.attr(this._attrTarget),this._plotTarget&&e.plot(this._plotTarget),this._afterCb&&this._afterCb.call(e)};return void(t>0?setTimeout(s,t):s())}const i=()=>{const t={},i={},a={};if(this._attrTarget)for(const s of Object.keys(this._attrTarget)){const o=e.attr(s);t[s]=o;const r=he(o),n=he(String(this._attrTarget[s]));r&&n&&(i[s]=r,a[s]=n)}let o=null;if(this._plotTarget){const t=e.attr("d")||"";try{o="polygons"===this._plotAlgorithm?function(t,e,s=96){const i=le(t,s),a=le(e,s);let o=0,r=1/0;for(let t=0;t<s;t++){let e=0;for(let o=0;o<s;o++){const n=i[(o+t)%s],l=a[o],h=n.x-l.x,c=n.y-l.y;if(e+=h*h+c*c,e>=r)break}e<r&&(r=e,o=t)}const n=new Array(s);for(let t=0;t<s;t++)n[t]=i[(t+o)%s];return function(t){let e="";for(let i=0;i<s;i++){const s=n[i],o=a[i],r=s.x+(o.x-s.x)*t,l=s.y+(o.y-s.y)*t;e+=(0===i?"M":"L")+r.toFixed(3)+" "+l.toFixed(3)+" "}return e+"Z"}}(t,this._plotTarget):oe(t,this._plotTarget)}catch(t){o=null}}const r=performance.now(),n=l=>{const h=l-r,c=Math.min(h/s,1),d=(g=c,-Math.cos(g*Math.PI)/2+.5);var g;if(this._attrTarget)if(c>=1)e.attr(this._attrTarget);else{const s={};for(const e of Object.keys(this._attrTarget))if(i[e]&&a[e])s[e]=ce(i[e],a[e],d);else{const i=parseFloat(t[e]),a=parseFloat(this._attrTarget[e]);isNaN(i)||isNaN(a)||(s[e]=i+(a-i)*d)}e.attr(s)}o&&c<1&&e.attr("d",o(d)),this._duringCb&&this._duringCb(d),c<1?b.requestAnimationFrame(n):(this._plotTarget&&e.attr("d",this._plotTarget),this._afterCb&&this._afterCb.call(e))};b.requestAnimationFrame(n)};t>0?setTimeout(i,t):i()}}var ge;function pe(){const t=b.createElementNS(W,"svg"),e=new jt(t);return e.attr({xmlns:W}),e}(ge=Nt).prototype.filterWith=function(t){const e=new Zt;this._filter=e;let s=this.node;for(;s&&"svg"!==s.nodeName;)s=s.parentNode;if(s){let t=s.querySelector("defs");t||(t=b.createElementNS(W,"defs"),s.insertBefore(t,s.firstChild)),t.appendChild(e.node)}return t(new Kt(e)),this.attr("filter","url(#"+e._id+")"),this},ge.prototype.unfilter=function(t){return this._filter&&(this.node.removeAttribute("filter"),t&&this._filter.node&&this._filter.node.parentNode&&this._filter.node.parentNode.removeChild(this._filter.node),this._filter=null),this},ge.prototype.filterer=function(){return this._filter},function(t){t.prototype.animate=function(t,e){return new de(this,t,e)}}(Nt),function(t){t.prototype.draggable=function(t){if(!1===t)return this._dragCleanup&&(this._dragCleanup(),this._dragCleanup=null),this;const e=this,s=t||{},i=t=>{if(t.button&&0!==t.button)return;t.stopPropagation();const i="touchstart"===t.type?t.touches[0]:t,a=e.node,o=parseFloat(a.getAttribute("x"))||0,r=parseFloat(a.getAttribute("y"))||0,n=i.clientX,l=i.clientY,h=a.ownerSVGElement;let d=null;h&&(d=h.getScreenCTM());const g=t=>{const e="touchmove"===t.type?t.touches[0]:t;let i=e.clientX-n,h=e.clientY-l;d&&(i/=d.a,h/=d.d);let c=o+i,g=r+h;const p=parseFloat(a.getAttribute("width"))||0,u=parseFloat(a.getAttribute("height"))||0;void 0!==s.minX&&c<s.minX&&(c=s.minX),void 0!==s.minY&&g<s.minY&&(g=s.minY),void 0!==s.maxX&&c+p>s.maxX&&(c=s.maxX-p),void 0!==s.maxY&&g+u>s.maxY&&(g=s.maxY-u);const x=new CustomEvent("dragmove",{detail:{handler:{move:function(t,e){a.setAttribute("x",t),a.setAttribute("y",e)}},box:{x:c,y:g,w:p,h:u,x2:c+p,y2:g+u}}});a.dispatchEvent(x)},p=()=>{c.isBrowser()&&(document.removeEventListener("mousemove",g),document.removeEventListener("touchmove",g),document.removeEventListener("mouseup",p),document.removeEventListener("touchend",p))};c.isBrowser()&&(document.addEventListener("mousemove",g),document.addEventListener("touchmove",g),document.addEventListener("mouseup",p),document.addEventListener("touchend",p))};return e.node.addEventListener("mousedown",i),e.node.addEventListener("touchstart",i),e._dragCleanup=()=>{e.node.removeEventListener("mousedown",i),e.node.removeEventListener("touchstart",i)},e}}(Nt),function(t){t.prototype.select=function(t){if(!1===t)return this._selectCleanup&&(this._selectCleanup(),this._selectCleanup=null),this;const e=this,{createHandle:s,updateHandle:i}=t,a=document.createElementNS(W,"g");a.setAttribute("class","svg_select_points");const o=e.node.parentNode;o&&o.appendChild(a);const r={},n=["t","b","l","r","lt","rt","lb","rb"];n.forEach((t,e)=>{const i=new jt(document.createElementNS(W,"g"));a.appendChild(i.node);const o=s(i,[0,0],e,[],t);r[t]={group:i,handle:o}});const l=()=>{const t=parseFloat(e.attr("x"))||0,s=parseFloat(e.attr("y"))||0,o=parseFloat(e.attr("width"))||0,l=parseFloat(e.attr("height"))||0,h=e.node.getAttribute("transform");h?a.setAttribute("transform",h):a.removeAttribute("transform");const c={t:[t+o/2,s],b:[t+o/2,s+l],l:[t,s+l/2],r:[t+o,s+l/2],lt:[t,s],rt:[t+o,s],lb:[t,s+l],rb:[t+o,s+l]};n.forEach(t=>{r[t]&&c[t]&&i(r[t].group,c[t])})};return l(),e._selectHandles=a,e._selectHandlesMap=r,e._updateSelectPositions=l,e._selectCleanup=()=>{a.parentNode&&a.parentNode.removeChild(a),e._selectHandles=null,e._selectHandlesMap=null,e._updateSelectPositions=null},e},t.prototype.resize=function(t){if(!1===t)return this._resizeCleanup&&(this._resizeCleanup(),this._resizeCleanup=null),this;const e=this,s=e._selectHandlesMap;if(!s)return e;const i=[],a=t=>{const a=s[t];if(!a||!a.group||!a.group.node)return;const o=a.group.node,r=s=>{if(s.button&&0!==s.button)return;s.stopPropagation();const i=("touchstart"===s.type?s.touches[0]:s).clientX,a=e.node.ownerSVGElement;let o=null;a&&(o=a.getScreenCTM());const r=parseFloat(e.attr("x"))||0,n=parseFloat(e.attr("width"))||0,l=s=>{let a=("touchmove"===s.type?s.touches[0]:s).clientX-i;o&&(a/=o.a);let l=r,h=n;"l"===t?(l=r+a,h=n-a):"r"===t&&(h=n+a),h<0&&(h=0),e.attr({x:l,width:h}),e._updateSelectPositions&&e._updateSelectPositions();const c=new CustomEvent("resize",{detail:{el:e}});e.node.dispatchEvent(c)},h=()=>{c.isBrowser()&&(document.removeEventListener("mousemove",l),document.removeEventListener("touchmove",l),document.removeEventListener("mouseup",h),document.removeEventListener("touchend",h));const t=new CustomEvent("resize",{detail:{el:e}});e.node.dispatchEvent(t)};c.isBrowser()&&(document.addEventListener("mousemove",l),document.addEventListener("touchmove",l),document.addEventListener("mouseup",h),document.addEventListener("touchend",h))};o.addEventListener("mousedown",r),o.addEventListener("touchstart",r),i.push(()=>{o.removeEventListener("mousedown",r),o.removeEventListener("touchstart",r)})};return a("l"),a("r"),e._resizeCleanup=()=>{i.forEach(t=>t())},e}}(Nt),pe.xlink="http://www.w3.org/1999/xlink",c.isBrowser()&&void 0===window.SVG&&(window.SVG=pe),c.isBrowser()?(void 0===window.SVG&&(window.SVG=pe),void 0===window.Apex&&(window.Apex={})):"undefined"!=typeof global&&(void 0===global.Apex&&(global.Apex={}),void 0===global.SVG&&(global.SVG=pe));const ue=class t{static registerFeatures(e){for(const[s,i]of Object.entries(e))t._featureRegistry.set(s,i)}constructor(t){this.ctx=t,this.w=t.w}initModules(){this.ctx.publicMethods=["updateOptions","updateSeries","appendData","appendSeries","isSeriesHidden","highlightSeries","toggleSeries","showSeries","hideSeries","setLocale","resetSeries","zoomX","toggleDataPointSelection","dataURI","exportToCSV","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","paper","destroy"],this.ctx.eventList=["click","mousedown","mousemove","mouseleave","touchstart","touchmove","touchleave","mouseup","touchend","keydown","keyup"],this.ctx.animations=new B(this.w,this.ctx),this.ctx.axes=new at(this.w,this.ctx),this.ctx.core=new Pt(this.ctx.el,this.w,this.ctx),this.ctx.config=new D({}),this.ctx.data=new Tt(this.w,{resetGlobals:()=>this.ctx.core.resetGlobals(),isMultipleY:()=>this.ctx.core.isMultipleY()}),this.ctx.grid=new J(this.w,this.ctx),this.ctx.graphics=new N(this.w,this.ctx),this.ctx.coreUtils=new F(this.w),this.ctx.crosshairs=new ot(this.w),this.ctx.events=new st(this.w,this.ctx),this.ctx.fill=new G(this.w),this.ctx.localization=new it(this.w),this.ctx.options=new k,this.ctx.responsive=new nt(this.w),this.ctx.series=new lt(this.w,{toggleDataSeries:(...t)=>{var e;return null==(e=this.ctx.legend)?void 0:e.legendHelpers.toggleDataSeries(...t)},revertDefaultAxisMinMax:()=>this.ctx.updateHelpers.revertDefaultAxisMinMax(),updateSeries:(...t)=>this.ctx.updateHelpers._updateSeries(...t)}),this.ctx.theme=new ht(this.w),this.ctx.formatters=new w(this.w),this.ctx.titleSubtitle=new ct(this.w),this.ctx.dimensions=new xt(this.w,this.ctx),this.ctx.updateHelpers=new Ft(this.w,this.ctx);const t=new Ht(this.w,this.ctx);this.w.globals.tooltip=t,Object.defineProperty(this.ctx,"tooltip",{get(){return this.w.globals.tooltip},configurable:!0}),this._initOptionalModules()}_initOptionalModules(){const e=t._featureRegistry,s=this.w,i=this.ctx,a=e.get("exports");i.exports=a?new a(s,i):null;const o=e.get("legend");i.legend=o?new o(s,i):null;const r=e.get("morphTypeChange");i.morphTypeChange=r?new r(s,i):null;const n=e.get("toolbar");Object.defineProperty(i,"toolbar",{get(){var t;return!this._toolbar&&n&&(this._toolbar=new n(s,this)),null!=(t=this._toolbar)?t:null},configurable:!0});const l=e.get("zoomPanSelection");Object.defineProperty(i,"zoomPanSelection",{get(){var t;return!this._zoomPanSelection&&l&&(this._zoomPanSelection=new l(s,this)),null!=(t=this._zoomPanSelection)?t:null},configurable:!0});const h=e.get("keyboardNavigation");Object.defineProperty(i,"keyboardNavigation",{get(){var t;return!this._keyboardNavigation&&h&&(this._keyboardNavigation=new h(s,this)),null!=(t=this._keyboardNavigation)?t:null},configurable:!0})}};h(ue,"_featureRegistry",new Map);let xe=ue;class fe{constructor(t){this.ctx=t,this.w=t.w}clear({isUpdating:t}){t||(this.w.globals.isDestroyed=!0),this.ctx._zoomPanSelection&&this.ctx._zoomPanSelection.destroy(),this.ctx._toolbar&&this.ctx._toolbar.destroy(),this.w.globals.resizeObserver&&"function"==typeof this.w.globals.resizeObserver.disconnect&&(this.w.globals.resizeObserver.disconnect(),this.w.globals.resizeObserver=null),q.invalidateAll(this.w),t?(this.ctx._zoomPanSelection=null,this.ctx._toolbar=null,this.ctx._keyboardNavigation=null):(this.ctx.animations=null,this.ctx.axes=null,this.ctx.annotations=null,this.ctx.core=null,this.ctx.data=null,this.ctx.grid=null,this.ctx.series=null,this.ctx.responsive=null,this.ctx.theme=null,this.ctx.formatters=null,this.ctx.titleSubtitle=null,this.ctx.legend=null,this.ctx.dimensions=null,this.ctx.options=null,this.ctx.crosshairs=null,this.ctx._zoomPanSelection=null,this.ctx.updateHelpers=null,this.ctx._toolbar=null,this.ctx.localization=null,this.ctx._keyboardNavigation=null,this.ctx.w.globals.tooltip=null),this.clearDomElements({isUpdating:t})}killSVG(t){t.each(function(){this.removeClass("*"),this.off()},!0),t.clear()}clearDomElements({isUpdating:t}){const e=this.w.dom;if(c.isBrowser()&&e.Paper){const s=e.Paper.node;s.parentNode&&s.parentNode.parentNode&&!t&&(s.parentNode.parentNode.style.minHeight="unset");const i=e.baseEl;if(i&&this.ctx.eventList.forEach(t=>{i.removeEventListener(t,this.ctx.events.documentEvent)}),null!==this.ctx.el)for(;this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild);this.killSVG(e.Paper),e.Paper.remove()}e.elWrap=null,e.elGraphical=null,e.elLegendWrap=null,e.elLegendForeign=null,e.baseEl=null,e.elGridRect=null,e.elGridRectMask=null,e.elGridRectBarMask=null,e.elGridRectMarkerMask=null,e.elForecastMask=null,e.elNonForecastMask=null,e.elDefs=null}}const be=new WeakMap;class me{constructor(t,e){h(this,"core"),h(this,"responsive"),h(this,"axes"),h(this,"grid"),h(this,"graphics"),h(this,"coreUtils"),h(this,"crosshairs"),h(this,"events"),h(this,"fill"),h(this,"localization"),h(this,"options"),h(this,"series"),h(this,"theme"),h(this,"formatters"),h(this,"titleSubtitle"),h(this,"dimensions"),h(this,"updateHelpers"),h(this,"tooltip"),h(this,"data"),h(this,"animations"),h(this,"exports"),h(this,"legend"),h(this,"toolbar"),h(this,"zoomPanSelection"),h(this,"keyboardNavigation"),h(this,"annotations"),h(this,"morphTypeChange"),h(this,"timeScale"),h(this,"_keyboardNavigation"),h(this,"windowResizeHandler"),h(this,"parentResizeHandler"),h(this,"publicMethods",[]),h(this,"eventList",[]),h(this,"config"),this.opts=e,this.ctx=this,this.w=new T(e).init(),this.el=t,this.w.globals.cuid=m.randomId(),this.w.globals.chartID=this.w.config.chart.id?m.escapeString(this.w.config.chart.id):this.w.globals.cuid,function(t){const e=t.config.chart.animations;e&&!1!==e.respectReducedMotion&&R()&&(e.enabled=!1,e.dynamicAnimation&&(e.dynamicAnimation.enabled=!1))}(this.w);new xe(this).initModules(),this.lastUpdateOptions=null,this.create=this.create.bind(this),c.isBrowser()&&(this.windowResizeHandler=this._windowResizeHandler.bind(this),this.parentResizeHandler=this._parentResizeCallback.bind(this))}render(){var t,e;return(null==(e=null==(t=this.w)?void 0:t.config)?void 0:e.chart)?new Promise((t,e)=>{var s;if(m.elementExists(this.el)){void 0===Apex._chartInstances&&(Apex._chartInstances=[]),this.w.config.chart.id&&Apex._chartInstances.push({id:this.w.globals.chartID,group:this.w.config.chart.group,chart:this}),this.setLocale(this.w.config.chart.defaultLocale);const i=this.w.config.chart.events.beforeMount;if("function"==typeof i&&i(this,this.w),this.events.fireEvent("beforeMount",[this,this.w]),c.isBrowser()){window.addEventListener("resize",this.windowResizeHandler),function(t,e){if(c.isSSR())return;let s=!1;if(t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE){const e=t.getBoundingClientRect();"none"!==t.style.display&&0!==e.width||(s=!0)}const i=new ResizeObserver(i=>{s&&e.call(t,i),s=!0});t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Array.from(t.children).forEach(t=>i.observe(t)):i.observe(t),be.set(e,i)}(this.el.parentNode,this.parentResizeHandler);const t=this.el.getRootNode&&this.el.getRootNode(),e=m.is("ShadowRoot",t),i=this.el.ownerDocument;let a=e?t.getElementById("apexcharts-css"):i.getElementById("apexcharts-css");if(!a){a=b.createElementNS("http://www.w3.org/1999/xhtml","style"),a.id="apexcharts-css",a.textContent='@keyframes opaque {\n 0% {\n opacity: 0\n }\n\n to {\n opacity: 1\n }\n}\n\n@keyframes resizeanim {\n\n 0%,\n to {\n opacity: 0\n }\n}\n\n.apexcharts-canvas {\n position: relative;\n direction: ltr !important;\n user-select: none;\n /* Focus indicator colour. Themes override below. */\n --apexcharts-focus-color: #008FFB;\n}\n\n/* Dark theme & high-contrast: brighter focus colour for sufficient contrast. */\n.apexcharts-canvas .apexcharts-theme-dark,\n.apexcharts-theme-dark.apexcharts-canvas {\n --apexcharts-focus-color: #FFD500;\n}\n.apexcharts-canvas.apexcharts-high-contrast,\n.apexcharts-high-contrast.apexcharts-canvas {\n --apexcharts-focus-color: #FFFF00;\n}\n\n/* Visually-hidden aria-live status region (WCAG 4.1.3 Status Messages). */\n.apexcharts-sr-status {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n/* Respect OS-level reduced-motion preference (WCAG 2.3.3). */\n@media (prefers-reduced-motion: reduce) {\n .apexcharts-canvas *,\n .apexcharts-canvas *::before,\n .apexcharts-canvas *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n\n.apexcharts-canvas ::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 6px\n}\n\n.apexcharts-canvas ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(0, 0, 0, .5);\n box-shadow: 0 0 1px rgba(255, 255, 255, .5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5)\n}\n\n.apexcharts-inner {\n position: relative\n}\n\n.apexcharts-text tspan {\n font-family: inherit\n}\n\nrect.legend-mouseover-inactive,\n.legend-mouseover-inactive rect,\n.legend-mouseover-inactive path,\n.legend-mouseover-inactive circle,\n.legend-mouseover-inactive line,\n.legend-mouseover-inactive text.apexcharts-yaxis-title-text,\n.legend-mouseover-inactive text.apexcharts-yaxis-label {\n transition: .15s ease all;\n opacity: .2\n}\n\n.apexcharts-legend-text {\n padding-left: 15px;\n margin-left: -15px;\n}\n\n.apexcharts-legend-series[role="button"]:focus {\n outline: 2px solid var(--apexcharts-focus-color, #008FFB);\n outline-offset: 2px;\n}\n\n.apexcharts-legend-series[role="button"]:focus:not(:focus-visible) {\n outline: none;\n}\n\n.apexcharts-legend-series[role="button"]:focus-visible {\n outline: 2px solid var(--apexcharts-focus-color, #008FFB);\n outline-offset: 2px;\n}\n\n.apexcharts-series-collapsed {\n opacity: 0\n}\n\n.apexcharts-canvas svg:focus:not(:focus-visible) {\n outline: none;\n}\n\n/* Keyboard navigation focus indicator on SVG data elements.\n SVG elements don\'t support CSS outline, so we use stroke. */\n.apexcharts-bar-area.apexcharts-keyboard-focused,\n.apexcharts-candlestick-area.apexcharts-keyboard-focused,\n.apexcharts-boxPlot-area.apexcharts-keyboard-focused,\n.apexcharts-rangebar-area.apexcharts-keyboard-focused,\n.apexcharts-pie-area.apexcharts-keyboard-focused,\n.apexcharts-heatmap-rect.apexcharts-keyboard-focused,\n.apexcharts-treemap-rect.apexcharts-keyboard-focused {\n stroke: var(--apexcharts-focus-color, #008FFB);\n stroke-width: 2;\n stroke-opacity: 1;\n}\n\n.apexcharts-tooltip {\n --apx-tt-bg: #ffffff;\n --apx-tt-border: rgba(15, 23, 42, 0.06);\n /* Layered shadow: tight inner contact + soft outer drop. The two Y\n * offsets are exposed as variables so they flip in sync with the\n * arrow when the tooltip is below the data point \u2014 see the\n * `[data-placement="bottom"]` rule further down. */\n --apx-tt-shadow-y-mid: 8px;\n --apx-tt-shadow-y-far: 16px;\n --apx-tt-shadow: 0 0 0 1px rgba(15, 23, 42, 0.04), 0 var(--apx-tt-shadow-y-mid) 16px -6px rgba(15, 23, 42, 0.12), 0 var(--apx-tt-shadow-y-far) 36px -12px rgba(15, 23, 42, 0.18);\n --apx-tt-arrow-bg: var(--apx-tt-bg);\n /* Two stacked drop-shadows: the first is a tight contact halo for\n * edge definition against light chart backgrounds; the second is a\n * softer directional drop that lifts the arrow off the surface.\n * `--apx-tt-arrow-drop-y` is the Y offset of the directional drop;\n * a per-placement rule below flips it to negative when the tooltip\n * is below the data point (arrow on top) so the shadow always\n * casts outward instead of into the tooltip body. */\n --apx-tt-arrow-drop-y: 2px;\n --apx-tt-arrow-shadow: drop-shadow(0 0 0.5px rgba(15, 23, 42, 0.2)) drop-shadow(0 var(--apx-tt-arrow-drop-y) 4px rgba(15, 23, 42, 0.2));\n --apx-tt-color: #0f172a;\n --apx-tt-color-muted: rgba(15, 23, 42, 0.55);\n border-radius: 8px;\n background: var(--apx-tt-bg);\n border: 1px solid var(--apx-tt-border);\n box-shadow: var(--apx-tt-shadow);\n color: var(--apx-tt-color);\n cursor: default;\n font-size: 13px;\n left: 0;\n top: 0;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n display: flex;\n flex-direction: column;\n padding: 2px 0;\n white-space: nowrap;\n z-index: 12;\n transition: opacity .12s ease\n}\n\n/* While the tooltip is visible, smoothly animate position changes\n * between data points. Kept short (160 ms) and ease-out so it stays\n * responsive \u2014 too long would feel laggy when sweeping across many\n * points fast. The position transition is only attached after the\n * first paint (Position.applyTooltipPosition flips `data-positioned`\n * once the tooltip has been placed) so the *first* show doesn\'t slide\n * the tooltip in from the previously-stale (0,0) coordinates. */\n.apexcharts-tooltip.apexcharts-active {\n opacity: 1;\n transition: opacity .12s ease\n}\n.apexcharts-tooltip.apexcharts-active[data-positioned="true"] {\n transition: opacity .12s ease, left .16s ease-out, top .16s ease-out\n}\n\n.apexcharts-tooltip.apexcharts-theme-light {\n /* defaults already set above; class kept for backward-compat selectors */\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark {\n --apx-tt-bg: #1c1c1f;\n --apx-tt-border: rgba(255, 255, 255, 0.08);\n --apx-tt-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 var(--apx-tt-shadow-y-mid) 16px -6px rgba(0, 0, 0, 0.45), 0 var(--apx-tt-shadow-y-far) 36px -12px rgba(0, 0, 0, 0.55);\n --apx-tt-arrow-shadow: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.55)) drop-shadow(0 var(--apx-tt-arrow-drop-y) 4px rgba(0, 0, 0, 0.45));\n --apx-tt-color: #f3f4f6;\n --apx-tt-color-muted: rgba(243, 244, 246, 0.55);\n}\n\n.apexcharts-tooltip * {\n font-family: inherit\n}\n\n.apexcharts-tooltip-title {\n padding: 8px 12px 4px;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: var(--apx-tt-color-muted);\n background: transparent;\n border-bottom: none;\n margin-bottom: 0\n}\n\n.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title,\n.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {\n background: transparent;\n border-bottom: none\n}\n\n/* `fillSeriesColor`: each series-group already paints itself with the\n * series colour. Drop the glass body entirely (transparent bg, no\n * border, no backdrop-filter, no padding) and clip the coloured\n * series-group(s) to the tooltip\'s rounded corners so they fill the\n * shell edge-to-edge. Text inside the coloured group is forced to\n * white for contrast. */\n.apexcharts-tooltip.apexcharts-tooltip-fill-series {\n background: transparent;\n -webkit-backdrop-filter: none;\n backdrop-filter: none;\n border: none;\n padding: 0;\n overflow: hidden;\n color: #fff\n}\n\n.apexcharts-tooltip.apexcharts-tooltip-fill-series .apexcharts-tooltip-title {\n background: rgba(0, 0, 0, 0.22);\n color: #fff;\n opacity: 1;\n padding: 6px 12px\n}\n\n.apexcharts-tooltip.apexcharts-tooltip-fill-series .apexcharts-tooltip-series-group {\n color: #fff\n}\n\n/* Arrow connector \u2014 sits *entirely outside* the tooltip body. Shares\n * the body\'s solid fill so it reads as a single shape. `filter:\n * drop-shadow` traces the clipped triangle outline (a regular\n * `box-shadow` would be erased by the `clip-path`). */\n.apexcharts-tooltip-arrow {\n position: absolute;\n width: 7px;\n height: 14px;\n background: var(--apx-tt-arrow-bg);\n /* The variable already contains the full `drop-shadow(...) ...` filter\n * chain (stacked shadows) so it\'s applied raw. */\n -webkit-filter: var(--apx-tt-arrow-shadow);\n filter: var(--apx-tt-arrow-shadow);\n pointer-events: none;\n top: calc(var(--apx-tt-arrow-y, 50%) - 7px)\n}\n\n.apexcharts-tooltip[data-placement="right"] .apexcharts-tooltip-arrow {\n left: -7px;\n clip-path: polygon(0 50%, 100% 0, 100% 100%)\n}\n\n.apexcharts-tooltip[data-placement="left"] .apexcharts-tooltip-arrow {\n right: -7px;\n clip-path: polygon(100% 50%, 0 0, 0 100%)\n}\n\n/* Vertical arrow variants: tooltip is above/below the data point and the\n * arrow points down/up. The base rule above uses `--apx-tt-arrow-y` for\n * left/right placement; for top/bottom we re-orient the rectangle and\n * use `--apx-tt-arrow-x` (set by applyTooltipPosition). */\n.apexcharts-tooltip[data-placement="top"] .apexcharts-tooltip-arrow,\n.apexcharts-tooltip[data-placement="bottom"] .apexcharts-tooltip-arrow {\n width: 14px;\n height: 7px;\n top: auto;\n left: calc(var(--apx-tt-arrow-x, 50%) - 7px)\n}\n\n.apexcharts-tooltip[data-placement="top"] .apexcharts-tooltip-arrow {\n bottom: -7px;\n clip-path: polygon(50% 100%, 0 0, 100% 0)\n}\n\n.apexcharts-tooltip[data-placement="bottom"] .apexcharts-tooltip-arrow {\n top: -7px;\n clip-path: polygon(50% 0, 0 100%, 100% 100%)\n}\n\n/* When the tooltip is flipped below the data point (arrow on top\n * pointing up), the default downward-biased shadows leave the top\n * edge of both the body *and* the arrow undefined. Flipping every\n * Y offset to negative casts the entire elevation upward so the\n * shadow falls between the tooltip and the bar above. */\n.apexcharts-tooltip[data-placement="bottom"] {\n --apx-tt-shadow-y-mid: -8px;\n --apx-tt-shadow-y-far: -16px;\n --apx-tt-arrow-drop-y: -2px\n}\n\n.apexcharts-tooltip-text-goals-value,\n.apexcharts-tooltip-text-y-value,\n.apexcharts-tooltip-text-z-value {\n display: inline-block;\n margin-left: 5px;\n font-weight: 600\n}\n\n.apexcharts-tooltip-text-goals-label:empty,\n.apexcharts-tooltip-text-goals-value:empty,\n.apexcharts-tooltip-text-y-label:empty,\n.apexcharts-tooltip-text-y-value:empty,\n.apexcharts-tooltip-text-z-value:empty,\n.apexcharts-tooltip-title:empty {\n display: none\n}\n\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n padding: 6px 0 5px\n}\n\n.apexcharts-tooltip-goals-group,\n.apexcharts-tooltip-text-goals-label,\n.apexcharts-tooltip-text-goals-value {\n display: flex\n}\n\n.apexcharts-tooltip-text-goals-label:not(:empty),\n.apexcharts-tooltip-text-goals-value:not(:empty) {\n margin-top: -6px\n}\n\n.apexcharts-tooltip-marker {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n width: 12px;\n height: 12px;\n margin-right: 6px;\n vertical-align: middle;\n color: inherit;\n}\n\n.apexcharts-tooltip-marker svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.apexcharts-tooltip-series-group {\n padding: 4px 12px;\n display: none;\n gap: 8px;\n text-align: left;\n justify-content: left;\n align-items: center\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {\n opacity: 1\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active:last-child,\n.apexcharts-tooltip-series-group:last-child {\n padding-bottom: 8px\n}\n\n.apexcharts-tooltip-y-group {\n padding: 6px 0 5px\n}\n\n.apexcharts-custom-tooltip,\n.apexcharts-tooltip-box {\n padding: 4px 8px\n}\n\n.apexcharts-tooltip-boxPlot {\n display: flex;\n flex-direction: column-reverse\n}\n\n.apexcharts-tooltip-box>div {\n margin: 4px 0\n}\n\n.apexcharts-tooltip-box span.value {\n font-weight: 700\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: 700;\n display: block;\n margin-bottom: 5px\n}\n\n/* X/Y axis tooltips \u2014 small popovers that label the crosshair on the\n * axes. Restyled to match the modern data-tooltip palette: solid white\n * body with a subtle border + soft drop-shadow, smaller font, rounded\n * corners. The arrows still use the CSS border-triangle technique\n * (cheap, crisp at small sizes); their colours flow from CSS variables\n * so light/dark themes only need one override per axis. */\n.apexcharts-xaxistooltip,\n.apexcharts-yaxistooltip {\n --apx-axt-bg: #ffffff;\n --apx-axt-border: rgba(15, 23, 42, 0.08);\n --apx-axt-color: #0f172a;\n --apx-axt-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.18), 0 1px 3px -1px rgba(15, 23, 42, 0.12);\n opacity: 0;\n pointer-events: none;\n color: var(--apx-axt-color);\n font-size: 12px;\n font-weight: 500;\n text-align: center;\n border-radius: 6px;\n position: absolute;\n z-index: 10;\n background: var(--apx-axt-bg);\n border: 1px solid var(--apx-axt-border);\n box-shadow: var(--apx-axt-shadow)\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark,\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n --apx-axt-bg: #1c1c1f;\n --apx-axt-border: rgba(255, 255, 255, 0.1);\n --apx-axt-color: #f3f4f6;\n --apx-axt-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.55), 0 1px 3px -1px rgba(0, 0, 0, 0.45)\n}\n\n.apexcharts-xaxistooltip {\n padding: 4px 8px;\n transition: .15s ease all\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n/* :before paints the 1px border outline of the triangle (slightly larger\n * than :after); :after sits inside and paints the fill \u2014 leaves a 1px\n * ring of :before visible at the edges. */\n.apexcharts-xaxistooltip:after {\n border-color: transparent;\n border-width: 5px;\n margin-left: -5px\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: transparent;\n border-width: 6px;\n margin-left: -6px\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: var(--apx-axt-bg)\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: var(--apx-axt-border)\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: var(--apx-axt-bg)\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: var(--apx-axt-border)\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-yaxistooltip {\n padding: 3px 8px\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: transparent;\n border-width: 5px;\n margin-top: -5px\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: transparent;\n border-width: 6px;\n margin-top: -6px\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: var(--apx-axt-bg)\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: var(--apx-axt-border)\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: var(--apx-axt-bg)\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: var(--apx-axt-border)\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: .15s ease all\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: .15s ease all\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0\n}\n\n.apexcharts-selection-rect {\n cursor: move\n}\n\n.svg_select_shape {\n stroke-width: 1;\n stroke-dasharray: 10 10;\n stroke: black;\n stroke-opacity: 0.1;\n pointer-events: none;\n fill: none;\n}\n\n.svg_select_handle {\n stroke-width: 3;\n stroke: black;\n fill: none;\n}\n\n.svg_select_handle_r {\n cursor: e-resize;\n}\n\n.svg_select_handle_l {\n cursor: w-resize;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-menu-icon,\n.apexcharts-pan-icon,\n.apexcharts-reset-icon,\n.apexcharts-selection-icon,\n.apexcharts-toolbar-custom-icon,\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n cursor: pointer;\n /* WCAG 2.5.8 Target Size (Minimum): 24\xd724 CSS px hit target. */\n width: 26px;\n height: 24px;\n line-height: 24px;\n color: #6e8192;\n text-align: center;\n /* Reset native <button> chrome \u2014 these are styled via SVG icons. */\n padding: 0;\n margin: 0;\n background: transparent;\n border: 0;\n border-radius: 5px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n transition: background-color .12s ease, color .12s ease;\n}\n\n.apexcharts-menu-icon svg,\n.apexcharts-pan-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-selection-icon svg,\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg {\n width: 18px;\n height: 18px;\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon,\n.apexcharts-theme-dark .apexcharts-pan-icon,\n.apexcharts-theme-dark .apexcharts-reset-icon,\n.apexcharts-theme-dark .apexcharts-selection-icon,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon,\n.apexcharts-theme-dark .apexcharts-zoom-icon,\n.apexcharts-theme-dark .apexcharts-zoomin-icon,\n.apexcharts-theme-dark .apexcharts-zoomout-icon {\n color: #d4d6dc\n}\n\n.apexcharts-canvas .apexcharts-pan-icon.apexcharts-selected,\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected,\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected {\n background: rgba(0, 143, 251, 0.12);\n color: #008ffb\n}\n\n.apexcharts-theme-light .apexcharts-menu-icon:hover,\n.apexcharts-theme-light .apexcharts-pan-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-light .apexcharts-reset-icon:hover,\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover {\n background: rgba(15, 23, 42, 0.06);\n color: #1f2937\n}\n\n.apexcharts-theme-dark .apexcharts-menu-icon:hover,\n.apexcharts-theme-dark .apexcharts-pan-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-dark .apexcharts-reset-icon:hover,\n.apexcharts-theme-dark .apexcharts-selection-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-dark .apexcharts-zoom-icon:not(.apexcharts-selected):hover,\n.apexcharts-theme-dark .apexcharts-zoomin-icon:hover,\n.apexcharts-theme-dark .apexcharts-zoomout-icon:hover {\n background: rgba(255, 255, 255, 0.08);\n color: #fff\n}\n\n.apexcharts-menu-icon,\n.apexcharts-selection-icon {\n position: relative\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n display: inline-flex;\n align-items: center;\n gap: 1px;\n padding: 3px;\n border-radius: 8px;\n background: rgba(255, 255, 255, 0.85);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n}\n\n.apexcharts-theme-dark .apexcharts-toolbar {\n background: rgba(28, 28, 31, 0.82);\n}\n\n.apexcharts-menu {\n background: rgba(255, 255, 255, 0.95);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n position: absolute;\n top: calc(100% + 4px);\n border: 1px solid rgba(15, 23, 42, 0.08);\n border-radius: 8px;\n padding: 4px;\n right: 0;\n opacity: 0;\n min-width: 120px;\n transition: opacity .15s ease, transform .15s ease;\n transform: translateY(-2px);\n pointer-events: none;\n box-shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.12), 0 2px 4px -1px rgba(15, 23, 42, 0.06)\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n transform: translateY(0);\n pointer-events: all\n}\n\n.apexcharts-menu-item {\n padding: 6px 9px;\n font-size: 12px;\n border-radius: 5px;\n cursor: pointer\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: rgba(15, 23, 42, 0.06)\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(28, 28, 31, 0.92);\n border-color: rgba(255, 255, 255, 0.08);\n color: #f3f4f6;\n box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4)\n}\n\n.apexcharts-theme-dark .apexcharts-menu-item:hover {\n background: rgba(255, 255, 255, 0.08)\n}\n\n@media screen and (min-width:768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1\n }\n}\n\n/* Toolbar keyboard accessibility: show toolbar when any button inside it is focused */\n.apexcharts-toolbar:focus-within {\n opacity: 1\n}\n\n/* Focus indicator for toolbar icon buttons */\n.apexcharts-menu-icon:focus-visible,\n.apexcharts-pan-icon:focus-visible,\n.apexcharts-reset-icon:focus-visible,\n.apexcharts-selection-icon:focus-visible,\n.apexcharts-toolbar-custom-icon:focus-visible,\n.apexcharts-zoom-icon:focus-visible,\n.apexcharts-zoomin-icon:focus-visible,\n.apexcharts-zoomout-icon:focus-visible {\n outline: 2px solid var(--apexcharts-focus-color, #008FFB);\n outline-offset: 1px;\n border-radius: 5px\n}\n\n/* Focus indicator for hamburger menu items */\n.apexcharts-menu-item:focus-visible {\n outline: 2px solid var(--apexcharts-focus-color, #008FFB);\n outline-offset: -2px;\n background: #eee\n}\n\n.apexcharts-canvas .apexcharts-element-hidden,\n.apexcharts-datalabel.apexcharts-element-hidden,\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-hidden-element-shown {\n opacity: 1;\n transition: 0.25s ease all;\n}\n\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value,\n.apexcharts-datalabels,\n.apexcharts-pie-label {\n cursor: default;\n pointer-events: none\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: .3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease\n}\n\n.apexcharts-radialbar-label {\n cursor: pointer;\n}\n\n.apexcharts-annotation-rect,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-gridline,\n.apexcharts-line,\n.apexcharts-point-annotation-label,\n.apexcharts-radar-series path:not(.apexcharts-marker),\n.apexcharts-radar-series polygon,\n.apexcharts-toolbar svg,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-xaxis-annotation-label,\n.apexcharts-yaxis-annotation-label,\n.apexcharts-zoom-rect,\n.no-pointer-events {\n pointer-events: none\n}\n\n.apexcharts-tooltip-active .apexcharts-marker {\n transition: .15s ease all\n}\n\n.apexcharts-radar-series .apexcharts-yaxis {\n pointer-events: none;\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n height: 100%;\n width: 100%;\n overflow: hidden\n}\n\n.contract-trigger:before,\n.resize-triggers,\n.resize-triggers>div {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0\n}\n\n.resize-triggers>div {\n height: 100%;\n width: 100%;\n background: #eee;\n overflow: auto\n}\n\n.contract-trigger:before {\n overflow: hidden;\n width: 200%;\n height: 200%\n}\n\n.apexcharts-bar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-bar-shadows {\n pointer-events: none\n}\n\n.apexcharts-rangebar-goals-markers {\n pointer-events: none\n}\n\n.apexcharts-disable-transitions * {\n transition: none !important;\n}';const o=(null==(s=this.opts.chart)?void 0:s.nonce)||this.w.config.chart.nonce;o&&a.setAttribute("nonce",o),e?t.prepend(a):!1!==this.w.config.chart.injectStyleSheet&&i.head.appendChild(a)}}const a=this.create(this.w.config.series,{});if(!a)return t(this);this.mount(a).then(()=>{"function"==typeof this.w.config.chart.events.mounted&&this.w.config.chart.events.mounted(this,this.w),this.events.fireEvent("mounted",[this,this.w]),t(a)}).catch(t=>{var s,i;const a=t instanceof Error?t:new Error(String(t)),o=a;o.chartId=null==(i=null==(s=this.w)?void 0:s.globals)?void 0:i.chartID,o.el=this.el,e(a)})}else e(new Error("Element not found"))}):Promise.reject(new Error("ApexCharts: chart configuration is missing or invalid. Ensure the options object includes a `chart` property."))}create(t,e){var s,i,a;const o=this.w;if(!this.core){new xe(this).initModules()}const r=this.w.globals;if(r.noData=!1,r.animationEnded=!1,!m.elementExists(this.el))return r.animationEnded=!0,null;if(this.responsive.checkResponsiveConfig(e),o.config.xaxis.convertedCatToNumeric){new C(o.config).convertCatToNumericXaxis(o.config,this.ctx)}if(this.core.setupElements(),"treemap"===o.config.chart.type&&(o.config.grid.show=!1,o.config.yaxis[0].show=!1),0===r.svgWidth)return r.animationEnded=!0,null;let n=t;t.forEach((t,e)=>{t.hidden&&(n=this.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:e}))});const l=F.checkComboSeries(n,o.config.chart.type);r.comboCharts=l.comboCharts,r.comboBarCount=l.comboBarCount;const h=n.every(t=>t.data&&0===t.data.length);(0===n.length||h&&r.collapsedSeries.length<1)&&this.series.handleNoData(),c.isBrowser()&&this.events.setupEventHandlers();const d=this.data.parseData(n);this._writeParsedSeriesData(d.seriesData),this._writeParsedRangeData(d.rangeData),this._writeParsedCandleData(d.candleData),this._writeParsedLabelData(d.labelData),this._writeParsedAxisFlags(d.axisFlags),this.theme.init();new j(this.w,this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),r.noData&&r.collapsedSeries.length!==o.seriesData.series.length&&!o.config.legend.showForSingleSeries||null==(s=this.legend)||s.init(),this.series.hasAllSeriesEqualX(),r.axisCharts&&(this.core.coreCalculations(),"category"!==o.config.xaxis.type&&this.formatters.setLabelFormatters(),this.ctx.toolbar&&(this.ctx.toolbar.minX=o.globals.minX,this.ctx.toolbar.maxX=o.globals.maxX)),this.formatters.heatmapLabelFormatters();new F(this.w).getLargestMarkerSize();const g=this.dimensions.plotCoords();this._writeLayoutCoords(g.layout);const p=this.core.xySettings();this.grid.createGridMask();const u=this.core.plotChartType(n,p),x=new U(this.w,this);x.bringForward(),o.config.dataLabels.background.enabled&&x.dataLabelsBackground(),this.core.shiftGraphPosition(),null==(a=null==(i=this.legend)?void 0:i.heatmapGradientLegend)||a.repositionToPlot(),o.globals.dataPoints>50&&o.dom.elWrap.classList.add("apexcharts-disable-transitions");return{elGraph:u,xyRatios:p,dimensions:{plot:{left:o.layout.translateX,top:o.layout.translateY,width:o.layout.gridWidth,height:o.layout.gridHeight}}}}mount(t=null){const e=this,s=e.w;return new Promise((i,a)=>{var o,r,n,l,h,d,g,p,u;if(null===e.el)return a(new Error("Not enough data to display or target element not found"));(null===t||s.globals.allSeriesCollapsed)&&e.series.handleNoData(),e.grid=new J(e.w,e);const x=e.grid.drawGrid(),f=xe._featureRegistry.get("annotations");if(e.annotations=f?new f(e.w,{theme:e.theme,timeScale:e.timeScale}):null,null==(o=e.annotations)||o.drawImageAnnos(),null==(r=e.annotations)||r.drawTextAnnos(),"back"===s.config.grid.position&&(x&&s.dom.elGraphical.add(x.el),(null==(n=null==x?void 0:x.elGridBorders)?void 0:n.node)&&s.dom.elGraphical.add(x.elGridBorders)),Array.isArray(t.elGraph))for(let e=0;e<t.elGraph.length;e++)s.dom.elGraphical.add(t.elGraph[e]);else s.dom.elGraphical.add(t.elGraph);"front"===s.config.grid.position&&(x&&s.dom.elGraphical.add(x.el),(null==(l=null==x?void 0:x.elGridBorders)?void 0:l.node)&&s.dom.elGraphical.add(x.elGridBorders)),"front"===s.config.xaxis.crosshairs.position&&e.crosshairs.drawXCrosshairs(),"front"===s.config.yaxis[0].crosshairs.position&&e.crosshairs.drawYCrosshairs(),"treemap"!==s.config.chart.type&&e.axes.drawAxis(s.config.chart.type,x);const b=new K(this.w,this.ctx,x),m=new et(this.w,{theme:this.theme,timeScale:this.timeScale},x);if(null!==x&&(b.xAxisLabelCorrections(),m.setYAxisTextAlignments(),s.config.yaxis.map((t,e)=>{-1===s.globals.ignoreYAxisIndexes.indexOf(e)&&m.yAxisTitleRotate(e,t.opposite)})),null==(h=e.annotations)||h.drawAxesAnnotations(),!s.globals.noData){if(c.isBrowser()&&s.config.tooltip.enabled&&!s.globals.noData&&(null==(d=e.w.globals.tooltip)||d.drawTooltip(t.xyRatios)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.config.chart.accessibility.keyboard.navigation.enabled&&(null==(g=e.keyboardNavigation)||g.init()),c.isBrowser()&&s.globals.axisCharts&&(s.axisFlags.isXNumeric||s.config.xaxis.convertedCatToNumeric||s.axisFlags.isRangeBar))(s.config.chart.zoom.enabled||s.config.chart.selection&&s.config.chart.selection.enabled||s.config.chart.pan&&s.config.chart.pan.enabled)&&(null==(p=e.zoomPanSelection)||p.init({xyRatios:t.xyRatios}));else{const t=s.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach(e=>{t[e]=!1})}s.config.chart.toolbar.show&&!s.globals.allSeriesCollapsed&&(null==(u=e.toolbar)||u.createToolbar())}s.globals.memory.methodsToExec.length>0&&s.globals.memory.methodsToExec.forEach(t=>{t.method(t.params,!1,t.context)}),s.globals.axisCharts||s.globals.noData||e.core.resizeNonAxisCharts(),i(e)})}destroy(){var t;c.isBrowser()&&(window.removeEventListener("resize",this.windowResizeHandler),function(t,e){if(c.isSSR())return;const s=be.get(e);s&&(s.disconnect(),be.delete(e))}(this.el.parentNode,this.parentResizeHandler),clearTimeout(null!=(t=this.w.globals.resizeTimer)?t:void 0));const e=this.w.config.chart.id;e&&Array.isArray(Apex._chartInstances)&&Apex._chartInstances.forEach((t,s)=>{t.id===m.escapeString(e)&&Apex._chartInstances.splice(s,1)}),this._keyboardNavigation&&this._keyboardNavigation.destroy(),new fe(this.ctx).clear({isUpdating:!1})}updateOptions(t,e=!1,s=!0,i=!0,a=!0){const o=this.w;if(o.interact.selection=void 0,this.lastUpdateOptions){if(m.shallowEqual(this.lastUpdateOptions,t))return Promise.resolve(this);if(t.series&&this.lastUpdateOptions.series&&JSON.stringify(this.lastUpdateOptions.series)===JSON.stringify(t.series)){const e=n({},t),s=n({},this.lastUpdateOptions);if(delete e.series,delete s.series,m.shallowEqual(e,s))return Promise.resolve(this)}}return t.series&&(this.data.resetParsingFlags(),this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((t,e)=>this.updateHelpers._extendSeries(t,e))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),o.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,e,s,i,a)}updateSeries(t=[],e=!0,s=!0){return this.data.resetParsingFlags(),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,s)}appendSeries(t,e=!0,s=!0){this.data.resetParsingFlags();const i=this.w.config.series.slice();return i.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(i,e,s)}appendData(t,e=!0){const s=this;s.data.resetParsingFlags(),s.w.globals.dataChanged=!0,s.series.getPreviousPaths();const i=s.w.config.series.slice();for(let e=0;e<i.length;e++)if(null!==t[e]&&void 0!==t[e]){const s=t[e],a=i[e];for(let t=0;t<s.data.length;t++)a.data.push(s.data[t])}return s.w.config.series=i,e&&(s.w.globals.initialSeries=m.clone(s.w.config.series)),this.update()}update(t){return new Promise((e,s)=>{if(this.lastUpdateOptions&&JSON.stringify(this.lastUpdateOptions)===JSON.stringify(t))return e(this);this.lastUpdateOptions=m.clone(t),new fe(this.ctx).clear({isUpdating:!0});const i=this.create(this.w.config.series,null!=t?t:{});if(!i)return e(this);this.mount(i).then(()=>{var t;null==(t=this.morphTypeChange)||t.applyChromeFade(),"function"==typeof this.w.config.chart.events.updated&&this.w.config.chart.events.updated(this,this.w),this.events.fireEvent("updated",[this,this.w]),this.w.globals.isDirty=!0,e(this)}).catch(t=>{s(t)})})}fastUpdate(t){return new Promise((e,s)=>{var i;try{const s=this.w,a=s.globals;a.shouldAnimate=t,a.dataChanged=!0,a.animationEnded=!1,q.invalidateSelectors(s);const o=s.globals;o.maxY=-Number.MAX_VALUE,o.minY=Number.MIN_VALUE,o.minYArr=[],o.maxYArr=[],o.maxX=-Number.MAX_VALUE,o.minX=Number.MAX_VALUE,o.initialMaxX=-Number.MAX_VALUE,o.initialMinX=Number.MAX_VALUE,o.yAxisScale=[],o.xAxisScale=null,o.xAxisTicksPositions=[],o.xRange=0,o.yRange=[],o.zRange=0,o.xTickAmount=0,o.multiAxisTickAmount=0,o.pointsArray=[],o.dataLabelsRects=[],o.lastDrawnDataLabelsIndexes=[],o.textRectsCache=new Map,o.domCache=new Map,o.cachedSelectors={},o.disableZoomIn=!1,o.disableZoomOut=!1,a.axisCharts&&(this.core.coreCalculations(),"category"!==s.config.xaxis.type&&this.formatters.setLabelFormatters());const r=this.core.xySettings(),n=s.dom.elGraphical.node;n.querySelectorAll(".apexcharts-series, .apexcharts-datalabels, .apexcharts-datalabels-background").forEach(t=>{var e;return null==(e=t.parentNode)?void 0:e.removeChild(t)});const l=this.core.plotChartType(s.config.series,r),h=n.querySelector(".apexcharts-grid"),d=Array.isArray(l)?l:[l];h&&"front"===s.config.grid.position?d.forEach(t=>{const e=t&&t.node?t.node:t;e&&n.insertBefore(e,h)}):d.forEach(t=>{s.dom.elGraphical.add(t)});const g=new U(s,this);g.bringForward(),s.config.dataLabels.background.enabled&&g.dataLabelsBackground(),c.isBrowser()&&s.config.tooltip.enabled&&!a.noData&&(null==(i=s.globals.tooltip)||i.drawTooltip(r)),"function"==typeof s.config.chart.events.updated&&s.config.chart.events.updated(this,s),this.events.fireEvent("updated",[this,s]),a.isDirty=!0,e(this)}catch(t){s(t)}})}getSyncedCharts(){const t=this.getGroupedCharts();let e=[this];return t.length&&(e=[],t.forEach(t=>{e.push(t)})),e}getGroupedCharts(){return Apex._chartInstances.filter(t=>{if(t.group)return!0}).map(t=>this.w.config.chart.group===t.group?t.chart:this)}static getChartByID(t){const e=m.escapeString(t);if(!Apex._chartInstances)return;const s=Apex._chartInstances.filter(t=>t.id===e)[0];return s&&s.chart}static initOnLoad(){var t;const e=document.querySelectorAll("[data-apexcharts]");for(let s=0;s<e.length;s++){const i=e[s],a=JSON.parse(null!=(t=e[s].getAttribute("data-options"))?t:"");new me(i,a).render()}}static exec(t,e,...s){const i=this.getChartByID(t);if(!i)return;i.w.globals.isExecCalled=!0;let a=null;return-1!==i.publicMethods.indexOf(e)&&(a=i[e](...s)),a}static merge(t,e){return m.extend(t,e)}static getThemePalettes(){return{palette1:["#008FFB","#00A86F","#CA8501","#FF4560","#846DD5"],palette2:["#6978CB","#039DE2","#49A84D","#B39105","#D68000"],palette3:["#209FCC","#648291","#D4526E","#0FA783","#A19285"],palette4:["#2FA59D","#73A20B","#099DE1","#FD5D5D","#648291"],palette5:["#2B908F","#F56566","#2EAB16","#FA4443","#1EA2BD"],palette6:["#449DD1","#F86624","#EA3A4A","#9C63D1","#899E2A"],palette7:["#DF475B","#1B998B","#7E75B7","#F46036","#B1911B"],palette8:["#9C63D1","#F86624","#B38F04","#EA3A4A","#2FA2B3"],palette9:["#98776F","#A19285","#A8705E","#BA6560","#A0927F"],palette10:["#C91EFF","#A94BFD","#6C6AFE","#2983FF","#009ED8"],cvdDeuteranopia:["#0072B2","#E69F00","#56B4E9","#009E73","#F0E442","#D55E00","#CC79A7"],cvdProtanopia:["#0077BB","#EE7733","#009988","#EE3377","#BBBBBB","#33BBEE","#CC3311"],cvdTritanopia:["#CC3311","#009988","#EE7733","#0077BB","#EE3377","#BBBBBB","#33BBEE"],highContrast:["#005A9C","#C00000","#007A33","#6C3483","#7B3F00","#0097A7","#4A235A"]}}static use(t){!function(t){Object.assign(Lt(),t)}(t)}static registerFeatures(t){xe.registerFeatures(t)}toggleSeries(t){return this.series.toggleSeries(t)}highlightSeriesOnLegendHover(t,e){return this.series.toggleSeriesOnHover(t,e)}showSeries(t){this.series.showSeries(t)}hideSeries(t){this.series.hideSeries(t)}highlightSeries(t){this.series.highlightSeries(t)}isSeriesHidden(t){return this.series.isSeriesHidden(t)}resetSeries(t=!0,e=!0){this.series.resetSeries(t,e)}addEventListener(t,e){this.events.addEventListener(t,e)}removeEventListener(t,e){this.events.removeEventListener(t,e)}addXaxisAnnotation(t,e=!0,s=void 0){var i;let a=this;s&&(a=s),null==(i=a.annotations)||i.addXaxisAnnotationExternal(t,e,a)}addYaxisAnnotation(t,e=!0,s=void 0){var i;let a=this;s&&(a=s),null==(i=a.annotations)||i.addYaxisAnnotationExternal(t,e,a)}addPointAnnotation(t,e=!0,s=void 0){var i;let a=this;s&&(a=s),null==(i=a.annotations)||i.addPointAnnotationExternal(t,e,a)}clearAnnotations(t=void 0){var e;let s=this;t&&(s=t),null==(e=s.annotations)||e.clearAnnotations(s)}removeAnnotation(t,e=void 0){var s;let i=this;e&&(i=e),null==(s=i.annotations)||s.removeAnnotation(i,t)}getChartArea(){return this.w.dom.baseEl.querySelector(".apexcharts-inner")}getSeriesTotalXRange(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}getHighestValueInSeries(t=0){return new tt(this.w).getMinYMaxY(t).highestY}getLowestValueInSeries(t=0){return new tt(this.w).getMinYMaxY(t).lowestY}getSeriesTotal(){return this.w.globals.seriesTotals}getState(){const t=this.w,e=t.globals;return{series:t.seriesData.series,seriesNames:t.seriesData.seriesNames,colors:e.colors,labels:t.labelData.labels,seriesTotals:e.seriesTotals,seriesPercent:e.seriesPercent,seriesXvalues:e.seriesXvalues,seriesYvalues:e.seriesYvalues,minX:e.minX,maxX:e.maxX,minY:e.minY,maxY:e.maxY,minYArr:e.minYArr,maxYArr:e.maxYArr,minXDiff:e.minXDiff,dataPoints:e.dataPoints,xAxisScale:e.xAxisScale,yAxisScale:e.yAxisScale,xTickAmount:e.xTickAmount,isXNumeric:t.axisFlags.isXNumeric,seriesYAxisMap:e.seriesYAxisMap,seriesYAxisReverseMap:e.seriesYAxisReverseMap,svgWidth:e.svgWidth,svgHeight:e.svgHeight,gridWidth:t.layout.gridWidth,gridHeight:t.layout.gridHeight,selectedDataPoints:t.interact.selectedDataPoints,collapsedSeriesIndices:e.collapsedSeriesIndices,zoomed:t.interact.zoomed,seriesX:t.seriesData.seriesX,seriesZ:t.seriesData.seriesZ,seriesCandleO:t.candleData.seriesCandleO,seriesCandleH:t.candleData.seriesCandleH,seriesCandleM:t.candleData.seriesCandleM,seriesCandleL:t.candleData.seriesCandleL,seriesCandleC:t.candleData.seriesCandleC,seriesRangeStart:t.rangeData.seriesRangeStart,seriesRangeEnd:t.rangeData.seriesRangeEnd,seriesGoals:t.seriesData.seriesGoals}}toggleDataPointSelection(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}zoomX(t,e){var s;null==(s=this.ctx.toolbar)||s.zoomUpdateOptions(t,e)}setLocale(t){this.localization.setCurrentLocaleValues(t)}dataURI(t){if(!this.ctx.exports)throw new Error("apexcharts: Exports feature is not registered. Import apexcharts/features/exports.");return this.ctx.exports.dataURI(t)}getSvgString(t){if(!this.ctx.exports)throw new Error("apexcharts: Exports feature is not registered. Import apexcharts/features/exports.");return this.ctx.exports.getSvgString(t)}exportToCSV(t={}){if(!this.ctx.exports)throw new Error("apexcharts: Exports feature is not registered. Import apexcharts/features/exports.");return this.ctx.exports.exportToCSV(t)}paper(){return this.w.dom.Paper}_writeParsedSeriesData(t){Object.assign(this.w.seriesData,t)}_writeParsedRangeData(t){Object.assign(this.w.rangeData,t)}_writeParsedCandleData(t){Object.assign(this.w.candleData,t)}_writeParsedLabelData(t){Object.assign(this.w.labelData,t)}_writeParsedAxisFlags(t){Object.assign(this.w.axisFlags,t)}_writeLayoutCoords(t){Object.assign(this.w.layout,t)}_parentResizeCallback(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}_windowResize(){this.w.globals.resizeTimer=window.setTimeout(()=>{this.w.globals.resized=!0,this.w.globals.dataChanged=!1,this.ctx.update()},150)}_windowResizeHandler(){var t;clearTimeout(null!=(t=this.w.globals.resizeTimer)?t:void 0);let{redrawOnWindowResize:e}=this.w.config.chart;"function"==typeof e&&(e=e()),e&&this._windowResize()}}const ye=".apexcharts-flip-y {\n transform: scaleY(-1) translateY(-100%);\n transform-origin: top;\n transform-box: fill-box;\n}\n.apexcharts-flip-x {\n transform: scaleX(-1);\n transform-origin: center;\n transform-box: fill-box;\n}\n.apexcharts-legend {\n display: flex;\n overflow: auto;\n padding: 0 10px;\n}\n.apexcharts-legend.apexcharts-legend-group-horizontal {\n flex-direction: column;\n}\n.apexcharts-legend-group {\n display: flex;\n}\n.apexcharts-legend-group-vertical {\n flex-direction: column-reverse;\n}\n.apexcharts-legend.apx-legend-position-bottom, .apexcharts-legend.apx-legend-position-top {\n flex-wrap: wrap\n}\n.apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n flex-direction: column;\n bottom: 0;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-left, .apexcharts-legend.apx-legend-position-top.apexcharts-align-left, .apexcharts-legend.apx-legend-position-right, .apexcharts-legend.apx-legend-position-left {\n justify-content: flex-start;\n align-items: flex-start;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-center, .apexcharts-legend.apx-legend-position-top.apexcharts-align-center {\n justify-content: center;\n align-items: center;\n}\n.apexcharts-legend.apx-legend-position-bottom.apexcharts-align-right, .apexcharts-legend.apx-legend-position-top.apexcharts-align-right {\n justify-content: flex-end;\n align-items: flex-end;\n}\n.apexcharts-legend-series {\n cursor: pointer;\n line-height: normal;\n display: flex;\n align-items: center;\n}\n.apexcharts-legend-text {\n position: relative;\n font-size: 14px;\n}\n.apexcharts-legend-text *, .apexcharts-legend-marker * {\n pointer-events: none;\n}\n.apexcharts-legend-marker {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n margin-right: 1px;\n}\n\n.apexcharts-legend-series.apexcharts-no-click {\n cursor: auto;\n}\n.apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\n display: none !important;\n}\n.apexcharts-inactive-legend {\n opacity: 0.45;\n} ";class we{constructor(t,e){this.w=t,this.ctx=e}svgStringToNode(t){return(new DOMParser).parseFromString(t,"image/svg+xml").documentElement}scaleSvgNode(t,e){const s=parseFloat(t.getAttributeNS(null,"width")),i=parseFloat(t.getAttributeNS(null,"height"));t.setAttributeNS(null,"width",s*e),t.setAttributeNS(null,"height",i*e),t.setAttributeNS(null,"viewBox","0 0 "+s+" "+i)}getSvgString(t){return new Promise(e=>{const s=this.w;let i=t||s.config.chart.toolbar.export.scale||s.config.chart.toolbar.export.width/s.globals.svgWidth;i||(i=1);const a=s.globals.svgWidth*i,o=s.globals.svgHeight*i,r=s.dom.elWrap.cloneNode(!0);r.style.width=a+"px",r.style.height=o+"px";const n=(new XMLSerializer).serializeToString(r);let l="\n .apexcharts-tooltip, .apexcharts-toolbar, .apexcharts-xaxistooltip, .apexcharts-yaxistooltip, .apexcharts-xcrosshairs, .apexcharts-ycrosshairs, .apexcharts-zoom-rect, .apexcharts-selection-rect {\n display: none;\n }\n ";s.config.legend.show&&s.dom.elLegendWrap&&s.dom.elLegendWrap.children.length>0&&(l+=ye);let h=`\n <svg xmlns="http://www.w3.org/2000/svg"\n version="1.1"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n class="apexcharts-svg"\n xmlns:data="ApexChartsNS"\n transform="translate(0, 0)"\n width="${s.globals.svgWidth}px" height="${s.globals.svgHeight}px">\n <foreignObject width="100%" height="100%">\n <div xmlns="http://www.w3.org/1999/xhtml" style="width:${a}px; height:${o}px;">\n <style type="text/css">\n ${l}\n </style>\n ${n}\n </div>\n </foreignObject>\n </svg>\n `;const c=this.svgStringToNode(h);1!==i&&this.scaleSvgNode(c,i),this.convertImagesToBase64(c).then(()=>{h=(new XMLSerializer).serializeToString(c),e(h.replace(/ /g," "))})})}convertImagesToBase64(t){const e=t.getElementsByTagName("image"),s=Array.from(e).map(t=>{const e=t.getAttributeNS("http://www.w3.org/1999/xlink","href");return e&&!e.startsWith("data:")?this.getBase64FromUrl(e).then(e=>{t.setAttributeNS("http://www.w3.org/1999/xlink","href",e)}).catch(t=>{}):Promise.resolve()});return Promise.all(s)}getBase64FromUrl(t){return c.isSSR()?Promise.resolve(t):new Promise((e,s)=>{const i=new Image;i.crossOrigin="Anonymous",i.onload=()=>{const t=document.createElement("canvas");t.width=i.width,t.height=i.height;const s=t.getContext("2d");s&&s.drawImage(i,0,0),e(t.toDataURL())},i.onerror=s,i.src=t})}svgUrl(){return new Promise(t=>{this.getSvgString().then(e=>{const s=new Blob([e],{type:"image/svg+xml;charset=utf-8"});t(URL.createObjectURL(s))})})}dataURI(t){return c.isSSR()?Promise.resolve({imgURI:""}):new Promise(e=>{const s=this.w,i=t?t.scale||t.width/s.globals.svgWidth:1,a=document.createElement("canvas");a.width=s.globals.svgWidth*i,a.height=parseInt(s.dom.elWrap.style.height,10)*i;const o="transparent"!==s.config.chart.background&&s.config.chart.background?s.config.chart.background:"#fff",r=a.getContext("2d");r&&(r.fillStyle=o,r.fillRect(0,0,a.width*i,a.height*i),this.getSvgString(i).then(t=>{const s="data:image/svg+xml,"+encodeURIComponent(t),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{r.drawImage(i,0,0);const t=a;if(t.msToBlob){const s=t.msToBlob();e({blob:s})}else{const t=a.toDataURL("image/png");e({imgURI:t})}},i.src=s}))})}exportToSVG(){this.svgUrl().then(t=>{this.triggerDownload(t,this.w.config.chart.toolbar.export.svg.filename,".svg")})}exportToPng(){const t=this.w.config.chart.toolbar.export.scale,e=this.w.config.chart.toolbar.export.width,s=t?{scale:t}:e?{width:e}:void 0;this.dataURI(s).then(({imgURI:t,blob:e})=>{e?navigator.msSaveOrOpenBlob(e,this.w.globals.chartID+".png"):this.triggerDownload(t,this.w.config.chart.toolbar.export.png.filename,".png")})}exportToCSV({series:t,fileName:e,columnDelimiter:s=",",lineDelimiter:i="\n"}){const a=this.w;t||(t=a.config.series);let o=[];const r=[];let n="";const l=a.seriesData.series.map((t,e)=>-1===a.globals.collapsedSeriesIndices.indexOf(e)?t:[]),h=t=>"function"==typeof a.config.chart.toolbar.export.csv.categoryFormatter?a.config.chart.toolbar.export.csv.categoryFormatter(t):"datetime"===a.config.xaxis.type&&String(t).length>=10?new Date(t).toDateString():m.isNumber(t)?t:t.split(s).join(""),c=t=>"function"==typeof a.config.chart.toolbar.export.csv.valueFormatter?a.config.chart.toolbar.export.csv.valueFormatter(t):t,d=Math.max(...t.map(t=>t.data?t.data.length:0)),g=new Tt(this.w),p=new Z(this.w,{theme:this.ctx.theme,timeScale:this.ctx.timeScale}),u=t=>{let e="";if(a.globals.axisCharts){if("category"===a.config.xaxis.type||a.config.xaxis.convertedCatToNumeric)if(a.globals.isBarHorizontal){const s=a.formatters.yLabelFormatters[0],i=new lt(this.ctx.w).getActiveConfigSeriesIndex();e=s(a.labelData.labels[t],{seriesIndex:i,dataPointIndex:t,w:a})}else e=p.getLabel(a.labelData.labels,a.labelData.timescaleLabels,0,t).text;"datetime"===a.config.xaxis.type&&(a.config.xaxis.categories.length?e=a.config.xaxis.categories[t]:a.config.labels.length&&(e=a.config.labels[t]))}else e=a.config.labels[t];return null===e?"nullvalue":(Array.isArray(e)&&(e=e.join(" ")),m.isNumber(e)?e:e.split(s).join(""))},x=(e,i)=>{var n,p,x,f,b,m;if(o.length&&0===i&&r.push(o.join(s)),e.data){e.data=e.data.length&&e.data||[...Array(d)].map(()=>"");for(let d=0;d<e.data.length;d++){o=[];let y=u(d);if("nullvalue"!==y){if(y||(g.isFormatXY()?y=t[i].data[d].x:g.isFormat2DArray()&&(y=t[i].data[d]?t[i].data[d][0]:"")),0===i){o.push(h(y));for(let e=0;e<a.seriesData.series.length;e++){const s=g.isFormatXY()?null==(n=t[e].data[d])?void 0:n.y:l[e][d];o.push(c(s))}}("candlestick"===a.config.chart.type||e.type&&"candlestick"===e.type)&&(o.pop(),o.push(a.candleData.seriesCandleO[i][d]),o.push(a.candleData.seriesCandleH[i][d]),o.push(a.candleData.seriesCandleL[i][d]),o.push(a.candleData.seriesCandleC[i][d])),("boxPlot"===a.config.chart.type||e.type&&"boxPlot"===e.type)&&(o.pop(),o.push(a.candleData.seriesCandleO[i][d]),o.push(a.candleData.seriesCandleH[i][d]),o.push(a.candleData.seriesCandleM[i][d]),o.push(a.candleData.seriesCandleL[i][d]),o.push(a.candleData.seriesCandleC[i][d])),"rangeBar"===a.config.chart.type&&(o.pop(),o.push(a.rangeData.seriesRangeStart[i][d]),o.push(a.rangeData.seriesRangeEnd[i][d])),("violin"===a.config.chart.type||e.type&&"violin"===e.type)&&(o.pop(),o.push(null==(p=a.violinData.seriesViolinMin[i])?void 0:p[d]),o.push(null==(x=a.violinData.seriesViolinMax[i])?void 0:x[d]),o.push(null!=(m=null==(b=null==(f=a.violinData.seriesViolinPoints[i])?void 0:f[d])?void 0:b.length)?m:0)),o.length&&r.push(o.join(s))}}}};o.push(a.config.chart.toolbar.export.csv.headerCategory),"boxPlot"===a.config.chart.type?(o.push("minimum"),o.push("q1"),o.push("median"),o.push("q3"),o.push("maximum")):"candlestick"===a.config.chart.type?(o.push("open"),o.push("high"),o.push("low"),o.push("close")):"rangeBar"===a.config.chart.type?(o.push("minimum"),o.push("maximum")):"violin"===a.config.chart.type?(o.push("minimum"),o.push("maximum"),o.push("observations")):t.map((t,e)=>{const i=(t.name?t.name:`series-${e}`)+"";a.globals.axisCharts&&o.push(i.split(s).join("")?i.split(s).join(""):`series-${e}`)}),a.globals.axisCharts||(o.push(a.config.chart.toolbar.export.csv.headerValue),r.push(o.join(s))),a.globals.allSeriesHasEqualX||!a.globals.axisCharts||a.config.xaxis.categories.length||a.config.labels.length?t.map((t,e)=>{a.globals.axisCharts?x(t,e):(o=[],o.push(h(a.labelData.labels[e])),o.push(c(l[e])),r.push(o.join(s)))}):(()=>{const e=new Set,i={};t.forEach((s,a)=>{null==s||s.data.forEach(s=>{let o,r;if(g.isFormatXY())o=s.x,r=s.y;else{if(!g.isFormat2DArray())return;o=s[0],r=s[1]}i[o]||(i[o]=Array(t.length).fill("")),i[o][a]=c(r),e.add(o)})}),o.length&&r.push(o.join(s)),Array.from(e).sort().forEach(t=>{r.push([h(t),i[t].join(s)])})})(),n+=r.join(i),this.triggerDownload("data:text/csv; charset=utf-8,"+encodeURIComponent("\ufeff"+n),e||a.config.chart.toolbar.export.csv.filename,".csv")}triggerDownload(t,e,s){if(c.isSSR())return;const i=document.createElement("a");i.href=t,i.download=(e||this.w.globals.chartID)+s,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}me.registerFeatures({exports:we});let ve=class{constructor(t){this.w=t.w,this.lgCtx=t}getLegendStyles(){if(c.isSSR())return null;const t=document.createElement("style");t.setAttribute("type","text/css");const e=this.w.config.chart.nonce;e&&t.setAttribute("nonce",e);const s=document.createTextNode(ye);return t.appendChild(s),t}getLegendDimensions(){const t=this.w.dom.baseEl.querySelector(".apexcharts-legend");if(!t)return{clwh:0,clww:0};const{width:e,height:s}=t.getBoundingClientRect();return{clwh:s,clww:e}}appendToForeignObject(){var t;const e=this.getLegendStyles();!1!==this.w.config.chart.injectStyleSheet&&e&&(null==(t=this.w.dom.elLegendForeign)||t.appendChild(e))}toggleDataSeries(t,e){var s,i;const a=this.w;if(a.globals.axisCharts||"radialBar"===a.config.chart.type){a.globals.resized=!0;let o=null,r=null;if(a.globals.risingSeries=[],a.globals.axisCharts){if(o=a.dom.baseEl.querySelector(`.apexcharts-series[data\\:realIndex='${t}']`),!o)return;r=parseInt(null!=(s=o.getAttribute("data:realIndex"))?s:"",10)}else{if(o=a.dom.baseEl.querySelector(`.apexcharts-series[rel='${t+1}']`),!o)return;r=parseInt(null!=(i=o.getAttribute("rel"))?i:"",10)-1}if(e){[{cs:a.globals.collapsedSeries,csi:a.globals.collapsedSeriesIndices},{cs:a.globals.ancillaryCollapsedSeries,csi:a.globals.ancillaryCollapsedSeriesIndices}].forEach(t=>{const e=t.cs,s=t.csi;this.riseCollapsedSeries(e,s,r)})}else this.hideSeries({seriesEl:o,realIndex:r});if(a.config.chart.accessibility.enabled){const e=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const s=a.globals.collapsedSeriesIndices.includes(r)||a.globals.ancillaryCollapsedSeriesIndices.includes(r);e.setAttribute("aria-pressed",s?"true":"false");const i=e.querySelector(".apexcharts-legend-text"),o=i?i.textContent:a.seriesData.seriesNames[t],n=s?"hidden":"visible";e.setAttribute("aria-label",`${o}, ${n}. Press Enter or Space to toggle.`)}}}else{const e=a.dom.Paper.findOne(` .apexcharts-series[rel='${t+1}'] path`),s=a.config.chart.type;if("pie"===s||"polarArea"===s||"donut"===s){const t=a.config.plotOptions.pie.donut.labels;new N(this.w).pathMouseDown(e,null),this.lgCtx.printDataLabelsInner(e.node,t)}if(a.config.chart.accessibility.enabled){const e=a.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${t+1}"]`);if(e){const s=a.globals.collapsedSeriesIndices.includes(t);e.setAttribute("aria-pressed",s?"true":"false");const i=e.querySelector(".apexcharts-legend-text"),o=i?i.textContent:a.seriesData.seriesNames[t],r=s?"hidden":"visible";e.setAttribute("aria-label",`${o}, ${r}. Press Enter or Space to toggle.`)}}}}getSeriesAfterCollapsing({realIndex:t}){var e;const s=this.w,i=s.globals,a=m.clone(s.config.series);if(i.axisCharts){const e=s.config.yaxis[i.seriesYAxisReverseMap[t]],o={index:t,data:a[t].data.slice(),type:a[t].type||s.config.chart.type};if(e&&e.show&&e.showAlways)i.ancillaryCollapsedSeriesIndices.indexOf(t)<0&&(i.ancillaryCollapsedSeries.push(o),i.ancillaryCollapsedSeriesIndices.push(t));else if(i.collapsedSeriesIndices.indexOf(t)<0){i.collapsedSeries.push(o),i.collapsedSeriesIndices.push(t);const e=i.risingSeries.indexOf(t);i.risingSeries.splice(e,1)}}else i.collapsedSeries.push({index:t,data:a[t],type:null!=(e=s.config.series[t].type)?e:"line"}),i.collapsedSeriesIndices.push(t);return i.allSeriesCollapsed=i.collapsedSeries.length+i.ancillaryCollapsedSeries.length===s.config.series.length,this._getSeriesBasedOnCollapsedState(a)}hideSeries({seriesEl:t,realIndex:e}){const s=this.w,i=this.getSeriesAfterCollapsing({realIndex:e}),a=t.childNodes;for(let t=0;t<a.length;t++)a[t].classList.contains("apexcharts-series-markers-wrap")&&(a[t].classList.contains("apexcharts-hide")?a[t].classList.remove("apexcharts-hide"):a[t].classList.add("apexcharts-hide"));this.lgCtx.updateSeries(i,s.config.chart.animations.dynamicAnimation.enabled)}riseCollapsedSeries(t,e,s){const i=this.w;let a=m.clone(i.config.series);if(t.length>0){for(let o=0;o<t.length;o++)t[o].index===s&&(i.globals.axisCharts?a[s].data=t[o].data.slice():a[s]=t[o].data,"number"!=typeof a[s]&&(a[s].hidden=!1),t.splice(o,1),e.splice(o,1),i.globals.risingSeries.push(s),o--);a=this._getSeriesBasedOnCollapsedState(a),this.lgCtx.updateSeries(a,i.config.chart.animations.dynamicAnimation.enabled)}}_getSeriesBasedOnCollapsedState(t){const e=this.w;let s=0;return e.globals.axisCharts?t.forEach((i,a)=>{e.globals.collapsedSeriesIndices.indexOf(a)<0&&e.globals.ancillaryCollapsedSeriesIndices.indexOf(a)<0||(t[a].data=[],s++)}):t.forEach((i,a)=>{e.globals.collapsedSeriesIndices.indexOf(a)<0||(t[a]=0,s++)}),e.globals.allSeriesCollapsed=s===t.length,t}};const Ae="http://www.w3.org/2000/svg";class Ce{constructor(t,e){this.w=t,this.ctx=e,this.svgEl=null,this.arrowEl=null,this.hoverValueEl=null,this._min=0,this._max=0,this._geom=null,this._bandHitEls=[],this._activeBandIndex=-1,this._onCellEnter=this._onCellEnter.bind(this),this._onCellLeave=this._onCellLeave.bind(this),this._onBandEnter=this._onBandEnter.bind(this),this._onBandLeave=this._onBandLeave.bind(this)}_getFormatter(){const t=this.w.config.plotOptions.heatmap.colorScale.gradientLegend;return"function"==typeof t.formatter?t.formatter:t=>{if(!Number.isFinite(t))return String(t);const e=Math.abs(t);return e>=1e3?t.toFixed(0):e>=10?t.toFixed(1):t.toFixed(2)}}static isEnabled(t){var e,s,i,a;const o=null==(a=null==(i=null==(s=null==(e=null==t?void 0:t.config)?void 0:e.plotOptions)?void 0:s.heatmap)?void 0:i.colorScale)?void 0:a.gradientLegend;return!(!o||!o.enabled)}draw(){var t,e,s,i,a,o,r,n;const l=this.w,h=l.dom.elLegendWrap;if(!h)return;const c=l.config.plotOptions.heatmap.colorScale.gradientLegend,d=l.config.legend.position,g="left"===d||"right"===d,p=null!=(e=null==(t=c.arrow)?void 0:t.size)?e:8,u=p+4,x=c.showLabels?28:4,f=c.showLabels?20:4,m=c.showLabels?44:0,y=this._resolveStripLength(g?c.height:c.width,g),w=c.thickness,v=g?Math.max(w+u+4,m):y+2*x,A=g?y+2*f:w+u+4,C=(v-(w+u))/2,S=g?"left"===d?C:C+u:x,k=g?f:"top"===d?u:4,D=b.createElementNS(Ae,"svg");D.setAttribute("class","apexcharts-heatmap-gradient-legend"),D.setAttribute("width",String(v)),D.setAttribute("height",String(A)),D.setAttribute("overflow","visible");const L=b.createElementNS(Ae,"defs"),M=`apexcharts-heatmap-gradient-${l.globals.cuid}`,P=b.createElementNS(Ae,"linearGradient");P.setAttribute("id",M),g?(P.setAttribute("x1","0"),P.setAttribute("y1","1"),P.setAttribute("x2","0"),P.setAttribute("y2","0")):(P.setAttribute("x1","0"),P.setAttribute("y1","0"),P.setAttribute("x2","1"),P.setAttribute("y2","0"));const{min:T,max:F,stops:E,bands:I}=this._computeStops();this._min=T,this._max=F,E.forEach(t=>{const e=b.createElementNS(Ae,"stop");e.setAttribute("offset",`${(100*t.percent).toFixed(2)}%`),e.setAttribute("stop-color",t.color),P.appendChild(e)}),L.appendChild(P),D.appendChild(L);const X=b.createElementNS(Ae,"rect");if(X.setAttribute("x",String(S)),X.setAttribute("y",String(k)),X.setAttribute("width",String(g?w:y)),X.setAttribute("height",String(g?y:w)),X.setAttribute("rx","2"),X.setAttribute("fill",`url(#${M})`),D.appendChild(X),c.showLabels){const t=(null==(s=c.labelStyle)?void 0:s.colors)||(Array.isArray(l.config.legend.labels.colors)?l.config.legend.labels.colors[0]:l.config.legend.labels.colors)||l.config.chart.foreColor,e=(null==(i=c.labelStyle)?void 0:i.fontSize)||"11px",o=(null==(a=c.labelStyle)?void 0:a.fontFamily)||l.config.chart.fontFamily,r=this._getFormatter(),n=(s,i,a,r)=>{const n=b.createElementNS(Ae,"text");return n.setAttribute("x",String(i)),n.setAttribute("y",String(a)),n.setAttribute("text-anchor",r),n.setAttribute("dominant-baseline","middle"),n.setAttribute("fill",t),n.setAttribute("font-size",e),o&&n.setAttribute("font-family",o),n.textContent=String(s),n};if(g){const t=S+w/2;D.appendChild(n(r(T),t,k+y+10,"middle")),D.appendChild(n(r(F),t,k-10,"middle"))}else{const t=k+w/2;D.appendChild(n(r(T),S-6,t,"end")),D.appendChild(n(r(F),S+y+6,t,"start"))}}const R=(null==(o=c.arrow)?void 0:o.color)||l.config.chart.foreColor,z=this._buildArrow(p,R,d);if(D.appendChild(z),this.arrowEl=z,this._bandHitEls=[],l.config.legend.onItemHover.highlightDataSeries&&I.length>0&&I.forEach(t=>{const e=b.createElementNS(Ae,"rect");if(g){const s=k+y-t.p2*y,i=k+y-t.p1*y;e.setAttribute("x",String(S)),e.setAttribute("y",String(s)),e.setAttribute("width",String(w)),e.setAttribute("height",String(Math.max(0,i-s)))}else e.setAttribute("x",String(S+t.p1*y)),e.setAttribute("y",String(k)),e.setAttribute("width",String(Math.max(0,(t.p2-t.p1)*y))),e.setAttribute("height",String(w));e.setAttribute("fill","transparent"),e.setAttribute("class","apexcharts-heatmap-gradient-band"),e.setAttribute("data:range-index",String(t.index)),e.style.cursor="pointer",D.appendChild(e),this._bandHitEls.push(e)}),this._geom={isVertical:g,position:d,stripX:S,stripY:k,stripLength:y,stripThickness:w,arrowSize:p,svgWidth:v,svgHeight:A},c.showHoverValue){const t=b.createElement("div");t.classList.add("apexcharts-heatmap-gradient-legend-value"),t.style.position="absolute",t.style.fontSize=(null==(r=c.labelStyle)?void 0:r.fontSize)||"11px",t.style.fontFamily=(null==(n=c.labelStyle)?void 0:n.fontFamily)||l.config.chart.fontFamily||"",t.style.color=l.config.chart.foreColor,t.style.background="rgba(0,0,0,0.65)",t.style.color="#fff",t.style.padding="2px 6px",t.style.borderRadius="3px",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.opacity="0",t.style.transition="opacity 120ms ease",this.hoverValueEl=t}h.classList.add("apexcharts-heatmap-gradient-legend-wrap"),h.classList.add("apx-legend-position-"+d),h.appendChild(D),this.hoverValueEl&&h.appendChild(this.hoverValueEl),this.svgEl=D,this._applyWrapAlignment(h,d,g,v,A),this._attachHoverListeners(),this._attachBandHoverListeners()}_resolveStripLength(t,e){const s=this.w,i=e?s.globals.svgHeight||s.config.chart.height||300:s.globals.svgWidth||s.config.chart.width||600;if("string"==typeof t){const e=t.trim();if(e.endsWith("%")){const t=parseFloat(e)||0;return Math.max(20,i*t/100)}const s=parseFloat(e);return Number.isFinite(s)?s:200}return"number"==typeof t&&Number.isFinite(t)?t:200}_applyWrapAlignment(t,e,s,i,a){const o=this.w,r=o.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",n=12,l=o.globals.svgWidth||o.config.chart.width||600,h=o.globals.svgHeight||o.config.chart.height||300,c=o.config.legend.offsetX||0,d=o.config.legend.offsetY||0;if(t.style.position="absolute",t.style.display="block",t.style.overflow="visible",t.style.padding="0",t.style.width=i+"px",t.style.height=a+"px",t.style.right="auto",t.style.bottom="auto",s){const s=h-a-24;let o;o="start"===r?n:"end"===r?n+Math.max(0,s):n+Math.max(0,s)/2,t.style.top=o+d+"px",t.style.left="left"===e?n+c+"px":l-i-n+c+"px"}else{const s=l-i-24;let o;o="start"===r?n:"end"===r?n+Math.max(0,s):n+Math.max(0,s)/2,t.style.left=o+c+"px",t.style.top="top"===e?n+d+"px":h-a-n+d+"px"}}repositionToPlot(){var t,e;if(!c.isBrowser())return;const s=this.w,i=s.globals,a=s.dom.elLegendWrap;if(!a||!this._geom)return;if(!Number.isFinite(i.gridWidth)||!Number.isFinite(i.gridHeight))return;const{isVertical:o,position:r,svgWidth:n,svgHeight:l,stripX:h,stripY:d,stripThickness:g}=this._geom,p=s.config.plotOptions.heatmap.colorScale.gradientLegend.align||"center",u=s.config.legend.offsetX||0,x=s.config.legend.offsetY||0,f=null==(e=null==(t=this.ctx)?void 0:t.dimensions)?void 0:e.dimHelpers,m=f?f.getTitleSubtitleCoords("title").height+f.getTitleSubtitleCoords("subtitle").height:0,y=s.layout.xAxisHeight||0,w=(t,e)=>{const s=Math.max(0,t-e);return"start"===p?0:"end"===p?s:s/2};if(o){a.style.top=i.translateY+w(i.gridHeight,l)+x+"px";const t=(("left"===r?0:i.translateX+i.gridWidth)+("left"===r?i.translateX:i.svgWidth))/2;a.style.left=t-h-g/2+u+"px"}else{a.style.left=i.translateX+w(i.gridWidth,n)+u+"px";const t=(("top"===r?m:i.translateY+i.gridHeight+y)+("top"===r?i.translateY:i.svgHeight))/2;a.style.top=t-d-g/2+x+"px"}b.requestAnimationFrame(()=>this._enforceMinPlotGap())}_enforceMinPlotGap(){const t=this.w,e=t.dom.elLegendWrap,s=this.svgEl&&this.svgEl.querySelector("rect"),i=t.dom.baseEl.querySelector(".apexcharts-grid");if(!(e&&s&&i&&this._geom))return;const a=s.getBoundingClientRect(),o=i.getBoundingClientRect();if(!(a.width&&a.height&&o.width&&o.height))return;const{isVertical:r,position:n}=this._geom;if(r){const t="left"===n?o.left-a.right:a.left-o.right;if(t<16){const s=parseFloat(e.style.left)||0,i=16-t;e.style.left=s+("left"===n?-i:i)+"px"}}else{const t="top"===n?o.top-a.bottom:a.top-o.bottom;if(t<16){const s=parseFloat(e.style.top)||0,i=16-t;e.style.top=s+("top"===n?-i:i)+"px"}}}destroy(){var t,e,s,i,a,o,r;for(let s=0;s<this._bandHitEls.length;s++){const i=this._bandHitEls[s];null==(t=i.removeEventListener)||t.call(i,"mousemove",this._onBandEnter),null==(e=i.removeEventListener)||e.call(i,"mouseout",this._onBandLeave)}if(this._bandHitEls=[],this._activeBandIndex=-1,null==(s=this.ctx)?void 0:s.events)try{null==(a=(i=this.ctx.events).removeEventListener)||a.call(i,"dataPointMouseEnter",this._onCellEnter),null==(r=(o=this.ctx.events).removeEventListener)||r.call(o,"dataPointMouseLeave",this._onCellLeave)}catch(t){}}_attachBandHoverListeners(){if(c.isBrowser())for(let t=0;t<this._bandHitEls.length;t++){const e=this._bandHitEls[t];e.addEventListener("mousemove",this._onBandEnter),e.addEventListener("mouseout",this._onBandLeave)}}_onBandEnter(t){var e,s,i,a;const o=this.w,r=t.currentTarget,n=parseInt(null!=(e=r.getAttribute("data:range-index"))?e:"-1",10);n<0||n===this._activeBandIndex||(this._activeBandIndex=n,null==(a=null==(i=null==(s=this.ctx)?void 0:s.events)?void 0:i.fireEvent)||a.call(i,"legendHover",[this.ctx,n,o]),new lt(o).highlightRangeInSeries(n,"highlight"))}_onBandLeave(){if(this._activeBandIndex<0)return;const t=this._activeBandIndex;this._activeBandIndex=-1,new lt(this.w).highlightRangeInSeries(t,"reset")}_attachHoverListeners(){var t,e;c.isBrowser()&&(null==(e=null==(t=this.ctx)?void 0:t.events)?void 0:e.addEventListener)&&(this.ctx.events.addEventListener("dataPointMouseEnter",this._onCellEnter),this.ctx.events.addEventListener("dataPointMouseLeave",this._onCellLeave))}_onCellEnter(...t){var e,s;const i=this.w;if(!this.arrowEl)return;const a=t[t.length-1];if(!a||"object"!=typeof a)return;const o=a.seriesIndex,r=a.dataPointIndex;if("number"!=typeof o||"number"!=typeof r)return;if("heatmap"!==i.config.chart.type)return;const n=null==(s=null==(e=i.seriesData)?void 0:e.series)?void 0:s[o],l=null==n?void 0:n[r];null==l||Number.isNaN(l)||this._positionArrow(l)}_onCellLeave(){this.arrowEl&&(this.arrowEl.setAttribute("opacity","0"),this.hoverValueEl&&(this.hoverValueEl.style.opacity="0"))}_positionArrow(t){if(!this.arrowEl||!this._geom)return;const{isVertical:e,position:s,stripX:i,stripY:a,stripLength:o,stripThickness:r,arrowSize:n}=this._geom,l=this._min,h=this._max-l;let c;if(c=0===h?.5:(t-l)/h,c<0&&(c=0),c>1&&(c=1),e){const t=a+o-c*o;let e,l;"left"===s?(e=i+r,l=e+n):(e=i,l=e-n);const h=[`${e},${t}`,`${l},${t-n/2}`,`${l},${t+n/2}`].join(" ");this.arrowEl.setAttribute("points",h)}else{const t=i+c*o;let e,l;"top"===s?(e=a+r,l=e+n):(e=a,l=e-n);const h=[`${t},${e}`,`${t-n/2},${l}`,`${t+n/2},${l}`].join(" ");this.arrowEl.setAttribute("points",h)}if(this.arrowEl.setAttribute("opacity","1"),this.hoverValueEl){const l=this._getFormatter();if(this.hoverValueEl.textContent=l(t),e){const t=a+o-c*o;"left"===s?this.hoverValueEl.style.left=`${i+r+n+8}px`:(this.hoverValueEl.style.left=i-n-8+"px",this.hoverValueEl.style.transform="translateX(-100%)"),this.hoverValueEl.style.top=t-9+"px"}else{const t=i+c*o;this.hoverValueEl.style.left=`${t}px`,this.hoverValueEl.style.transform="translateX(-50%)",this.hoverValueEl.style.top="top"===s?`${a+r+n+8}px`:a-n-18+"px"}this.hoverValueEl.style.opacity="1"}}_buildArrow(t,e,s){const i=b.createElementNS(Ae,"polygon");return i.setAttribute("fill",e),i.setAttribute("opacity","0"),i.setAttribute("class","apexcharts-heatmap-gradient-arrow"),i.setAttribute("points","0,0 0,0 0,0"),i.setAttribute("pointer-events","none"),i}_computeStops(){var t,e;const s=this.w,i=s.config.plotOptions.heatmap.colorScale,a=i.gradientLegend;let o=1/0,r=-1/0;const h=(null==(t=s.seriesData)?void 0:t.series)||[];for(let t=0;t<h.length;t++){const e=h[t];if(e)for(let t=0;t<e.length;t++){const s=e[t];null==s||Number.isNaN(s)||(s<o&&(o=s),s>r&&(r=s))}}Number.isFinite(o)||(o=0),Number.isFinite(r)||(r=0);let c=o,d=r;void 0!==i.min&&(c=i.min<o?i.min:o),void 0!==i.max&&(d=i.max>r?i.max:r);const g=[],p=[];if(i.ranges&&i.ranges.length>0){const t=i.ranges.map((t,e)=>l(n({},t),{_originalIndex:e})).sort((t,e)=>t.from-e.from),e=t[0].from,s=t[t.length-1].to;c=e,d=s;const a=s-e||1;t.forEach(t=>{const s=(t.from-e)/a,i=(t.to-e)/a;g.push({percent:(s+i)/2,color:t.color}),p.push({index:t._originalIndex,p1:s,p2:i})})}else{const t=s.globals.colors[0]||"#008FFB",i=new m,o=null!=(e=s.config.plotOptions.heatmap.shadeIntensity)?e:.5,r=s.globals.hasNegs,n=Math.max(2,a.stops||16);for(let e=0;e<n;e++){const a=e/(n-1),l=c+a*(d-c),h=Math.abs(d)+Math.abs(c),p=0===h?0:100*l/h;let u;u=r?s.config.plotOptions.heatmap.reverseNegativeShade?p<0?p/100*(1.25*o):1.25*o*(1-p/100):p<=0?1-(1+p/100)*o:(1-p/100)*o:1-p/100,u>1&&(u=1),u<-1&&(u=-1);const x=s.config.plotOptions.heatmap.enableShades?i.shadeColor("dark"===s.config.theme.mode?-1*u:u,t):t;g.push({percent:a,color:x})}}return{min:c,max:d,stops:g,bands:p}}}me.registerFeatures({legend:class{constructor(t,e){this.w=t,this.ctx=e,this.printDataLabelsInner=(...t)=>{var s;return null==(s=e.pie)?void 0:s.printDataLabelsInner(...t)},this.updateSeries=(...t)=>e.updateHelpers._updateSeries(...t),this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.isBarsDistributed="bar"===this.w.config.chart.type&&this.w.config.plotOptions.bar.distributed&&1===this.w.config.series.length,this.legendHelpers=new ve(this)}init(){const t=this.w,e=t.globals,s=t.config,i=s.legend.showForSingleSeries&&1===this.w.seriesData.series.length||this.isBarsDistributed||"heatmap"===s.chart.type||this.w.seriesData.series.length>1;if(this.legendHelpers.appendToForeignObject(),(i||!e.axisCharts)&&s.legend.show){const e=t.dom.elLegendWrap;for(;e.firstChild;)e.removeChild(e.firstChild);this.heatmapGradientLegend&&(this.heatmapGradientLegend.destroy(),this.heatmapGradientLegend=null),"heatmap"===s.chart.type&&Ce.isEnabled(t)?(this.heatmapGradientLegend=new Ce(t,this.ctx),this.heatmapGradientLegend.draw()):(this.drawLegends(),"bottom"===s.legend.position||"top"===s.legend.position?this.legendAlignHorizontal():"right"!==s.legend.position&&"left"!==s.legend.position||this.legendAlignVertical())}}createLegendMarker({i:t,fillcolor:e}){const s=this.w,i=b.createElement("span");i.classList.add("apexcharts-legend-marker");const a=s.config.legend.markers.shape||s.config.markers.shape;let o=a;Array.isArray(a)&&(o=a[t]);const r=Array.isArray(s.config.legend.markers.size)?parseFloat(s.config.legend.markers.size[t]):parseFloat(s.config.legend.markers.size),h=Array.isArray(s.config.legend.markers.offsetX)?parseFloat(s.config.legend.markers.offsetX[t]):parseFloat(s.config.legend.markers.offsetX),d=Array.isArray(s.config.legend.markers.offsetY)?parseFloat(s.config.legend.markers.offsetY[t]):parseFloat(s.config.legend.markers.offsetY),g=Array.isArray(s.config.legend.markers.strokeWidth)?parseFloat(s.config.legend.markers.strokeWidth[t]):parseFloat(s.config.legend.markers.strokeWidth),p=i.style;if(p.height=2*(r+g)+"px",p.width=2*(r+g)+"px",p.left=h+"px",p.top=d+"px",s.config.legend.markers.customHTML)p.background="transparent",p.color=e[t],Array.isArray(s.config.legend.markers.customHTML)?s.config.legend.markers.customHTML[t]&&(i.innerHTML=s.config.legend.markers.customHTML[t]()):i.innerHTML=s.config.legend.markers.customHTML();else{const a=new j(this.ctx.w,this.ctx).getMarkerConfig({cssClass:`apexcharts-legend-marker apexcharts-marker apexcharts-marker-${o}`,seriesIndex:t,strokeWidth:g,size:r}),h=(c.isBrowser()?window.SVG:global.SVG)().addTo(i).size("100%","100%"),d=new N(this.w).drawMarker(0,0,l(n({},a),{pointFillColor:Array.isArray(e)?e[t]:a.pointFillColor,shape:o}));s.dom.Paper.find(".apexcharts-legend-marker.apexcharts-marker").forEach(t=>{t.node.classList.contains("apexcharts-marker-triangle")?t.node.style.transform="translate(50%, 45%)":t.node.style.transform="translate(50%, 50%)"}),h.add(d)}return i}drawLegends(){var t;const e=this,s=this.w,i=s.dom.elLegendWrap,a=s.config.legend.fontFamily;let o=s.seriesData.seriesNames,r=s.config.legend.markers.fillColors?s.config.legend.markers.fillColors.slice():s.globals.colors.slice();if("heatmap"===s.config.chart.type){const t=s.config.plotOptions.heatmap.colorScale.ranges;o=t.map(t=>t.name?t.name:t.from+" - "+t.to),r=t.map(t=>t.color)}else this.isBarsDistributed&&(o=s.labelData.labels.slice());s.config.legend.customLegendItems.length&&(o=s.config.legend.customLegendItems);const n=s.formatters.legendFormatter,l=s.config.legend.inverseOrder,h=[];s.labelData.seriesGroups.length>1&&s.config.legend.clusterGroupedSeries&&s.labelData.seriesGroups.forEach((t,e)=>{h[e]=b.createElement("div"),h[e].classList.add("apexcharts-legend-group",`apexcharts-legend-group-${e}`),"horizontal"===s.config.legend.clusterGroupedSeriesOrientation?i.classList.add("apexcharts-legend-group-horizontal"):h[e].classList.add("apexcharts-legend-group-vertical")});for(let e=l?o.length-1:0;l?e>=0:e<=o.length-1;l?e--:e++){const l=n(o[e],{seriesIndex:e,w:s});let c=!1,d=!1;if(s.globals.collapsedSeries.length>0)for(let t=0;t<s.globals.collapsedSeries.length;t++)s.globals.collapsedSeries[t].index===e&&(c=!0);if(s.globals.ancillaryCollapsedSeriesIndices.length>0)for(let t=0;t<s.globals.ancillaryCollapsedSeriesIndices.length;t++)s.globals.ancillaryCollapsedSeriesIndices[t]===e&&(d=!0);const g=this.createLegendMarker({i:e,fillcolor:r});N.setAttrs(g,{rel:e+1,"data:collapsed":c||d}),(c||d)&&g.classList.add("apexcharts-inactive-legend");const p=b.createElement("div");if(s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled){p.setAttribute("role","button"),p.setAttribute("tabindex","0");const t=Array.isArray(l)?l.join(" "):l,e=c||d,s=e?"hidden":"visible";p.setAttribute("aria-label",`${t}, ${s}. Press Enter or Space to toggle.`),p.setAttribute("aria-pressed",e?"true":"false")}const u=b.createElement("span");u.classList.add("apexcharts-legend-text"),u.innerHTML=Array.isArray(l)?l.join(" "):l;let x=s.config.legend.labels.useSeriesColors?s.globals.colors[e]:Array.isArray(s.config.legend.labels.colors)?null==(t=s.config.legend.labels.colors)?void 0:t[e]:s.config.legend.labels.colors;x||(x=s.config.chart.foreColor),u.style.color=x,u.style.fontSize=s.config.legend.fontSize,u.style.fontWeight=s.config.legend.fontWeight,u.style.fontFamily=a||s.config.chart.fontFamily,N.setAttrs(u,{rel:e+1,i:e,"data:default-text":encodeURIComponent(l),"data:collapsed":c||d}),p.appendChild(g),p.appendChild(u);const f=new F(this.w);if(!s.config.legend.showForZeroSeries){0===f.getSeriesTotalByIndex(e)&&f.seriesHaveSameValues(e)&&!f.isSeriesNull(e)&&-1===s.globals.collapsedSeriesIndices.indexOf(e)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-zero-series")}s.config.legend.showForNullSeries||f.isSeriesNull(e)&&-1===s.globals.collapsedSeriesIndices.indexOf(e)&&-1===s.globals.ancillaryCollapsedSeriesIndices.indexOf(e)&&p.classList.add("apexcharts-hidden-null-series"),h.length?s.labelData.seriesGroups.forEach((t,a)=>{var o,r;t.includes(null!=(r=null==(o=s.config.series[e])?void 0:o.name)?r:"")&&(i.appendChild(h[a]),h[a].appendChild(p))}):i.appendChild(p),i.classList.add(`apexcharts-align-${s.config.legend.horizontalAlign}`),i.classList.add("apx-legend-position-"+s.config.legend.position),p.classList.add("apexcharts-legend-series"),p.style.margin=`${s.config.legend.itemMargin.vertical}px ${s.config.legend.itemMargin.horizontal}px`,i.style.width=s.config.legend.width?s.config.legend.width+"px":"",i.style.height=s.config.legend.height?s.config.legend.height+"px":"",N.setAttrs(p,{rel:e+1,seriesName:m.escapeString(o[e]),"data:collapsed":c||d}),(c||d)&&p.classList.add("apexcharts-inactive-legend"),s.config.legend.onItemClick.toggleDataSeries||p.classList.add("apexcharts-no-click")}s.dom.elWrap.addEventListener("click",e.onLegendClick,!0),s.config.legend.onItemHover.highlightDataSeries&&0===s.config.legend.customLegendItems.length&&(s.dom.elWrap.addEventListener("mousemove",e.onLegendHovered,!0),s.dom.elWrap.addEventListener("mouseout",e.onLegendHovered,!0)),s.config.chart.accessibility.enabled&&s.config.chart.accessibility.keyboard.enabled&&s.dom.elWrap.addEventListener("keydown",e.onLegendKeyDown.bind(e),!0)}setLegendWrapXY(t,e){const s=this.w,i=s.dom.elLegendWrap,a=i.clientHeight;let o=0,r=0;if("bottom"===s.config.legend.position)r=s.globals.svgHeight-Math.min(a,s.globals.svgHeight/2)-5;else if("top"===s.config.legend.position){const t=new xt(this.w,this.ctx),e=t.dimHelpers.getTitleSubtitleCoords("title").height,s=t.dimHelpers.getTitleSubtitleCoords("subtitle").height;r=(e>0?e-10:0)+(s>0?s-10:0)}i.style.position="absolute",o=o+t+s.config.legend.offsetX,r=r+e+s.config.legend.offsetY,i.style.left=o+"px",i.style.top=r+"px","right"===s.config.legend.position&&(i.style.left="auto",i.style.right=25+s.config.legend.offsetX+"px");["width","height"].forEach(t=>{i&&i.style[t]&&(i.style[t]=parseInt(String(s.config.legend[t]),10)+"px")})}legendAlignHorizontal(){const t=this.w;t.dom.elLegendWrap.style.right="0";const e=new xt(this.w,this.ctx),s=e.dimHelpers.getTitleSubtitleCoords("title"),i=e.dimHelpers.getTitleSubtitleCoords("subtitle");let a=0;"top"===t.config.legend.position&&(a=s.height+i.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,a)}legendAlignVertical(){const t=this.w,e=this.legendHelpers.getLegendDimensions();let s=0;"left"===t.config.legend.position&&(s=20),"right"===t.config.legend.position&&(s=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(s,20)}onLegendHovered(t){var e;const s=this.w,i=t.target,a=i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker");if("heatmap"===s.config.chart.type||this.isBarsDistributed){if(a){const s=parseInt(null!=(e=i.getAttribute("rel"))?e:"0",10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,s,this.w]);const a=new lt(this.ctx.w);"mousemove"===t.type?a.highlightRangeInSeries(s,"highlight"):"mouseout"===t.type&&a.highlightRangeInSeries(s,"reset")}}else if(!i.classList.contains("apexcharts-inactive-legend")&&a){new lt(this.ctx.w).toggleSeriesOnHover(t,i)}}onLegendKeyDown(t){const e=this,s=this.w,i=t.target;if((i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker"))&&("Enter"===t.key||" "===t.key)){t.preventDefault();const a=i.getAttribute("rel");e.onLegendClick(t),null!==a&&s.config.legend.onItemClick.toggleDataSeries&&requestAnimationFrame(()=>{const t=s.dom.baseEl.querySelector(`.apexcharts-legend-series[rel="${a}"]`);t&&t.focus()})}}onLegendClick(t){var e;const s=this.w,i=t.target;if(!s.config.legend.customLegendItems.length&&(i.classList.contains("apexcharts-legend-series")||i.classList.contains("apexcharts-legend-text")||i.classList.contains("apexcharts-legend-marker"))){const t=parseInt(null!=(e=i.getAttribute("rel"))?e:"0",10)-1,a="true"===i.getAttribute("data:collapsed"),o=this.w.config.chart.events.legendClick;"function"==typeof o&&o(this.ctx,t,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,t,this.w]);const r=this.w.config.legend.markers.onClick;"function"==typeof r&&i.classList.contains("apexcharts-legend-marker")&&(r(this.ctx,t,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,t,this.w]));"treemap"!==s.config.chart.type&&"heatmap"!==s.config.chart.type&&!this.isBarsDistributed&&s.config.legend.onItemClick.toggleDataSeries&&this.legendHelpers.toggleDataSeries(t,a)}}}});class Se{constructor(t,e){this.w=t,this.ctx=e,this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar,this.minX=t.globals.minX,this.maxX=t.globals.maxX,this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null,this.elMenu=null,this.elMenuItems=[],this.t=null}createToolbar(){const t=this.w,e=()=>b.createElementNS("http://www.w3.org/1999/xhtml","div"),s=()=>{const t=b.createElementNS("http://www.w3.org/1999/xhtml","button");return t.setAttribute("type","button"),t},i=e();if(i.setAttribute("class","apexcharts-toolbar"),i.style.top=t.config.chart.toolbar.offsetY+"px",i.style.right=3-t.config.chart.toolbar.offsetX+"px",t.dom.elWrap.appendChild(i),this.elZoom=s(),this.elZoomIn=s(),this.elZoomOut=s(),this.elPan=s(),this.elSelection=s(),this.elZoomReset=s(),this.elMenuIcon=s(),this.elMenu=e(),this.elCustomIcons=[],this.t=t.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons.push(s());const a=[],o=(e,s,i)=>{const o=e.toLowerCase();this.t[o]&&t.config.chart.zoom.enabled&&a.push({el:s,icon:"string"==typeof this.t[o]?this.t[o]:i,title:this.localeValues[e],class:`apexcharts-${o}-icon`})};o("zoomIn",this.elZoomIn,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M12 5v14M5 12h14"/>\n</svg>\n'),o("zoomOut",this.elZoomOut,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 12h14"/>\n</svg>\n');const r=e=>{this.t[e]&&t.config.chart[e].enabled&&a.push({el:"zoom"===e?this.elZoom:this.elSelection,icon:"string"==typeof this.t[e]?this.t[e]:"zoom"===e?'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <circle cx="11" cy="11" r="7"/>\n <path d="m21 21-4.3-4.3M8 11h6M11 8v6"/>\n</svg>\n':'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 3a2 2 0 0 0-2 2"/>\n <path d="M19 3a2 2 0 0 1 2 2"/>\n <path d="M21 19a2 2 0 0 1-2 2"/>\n <path d="M5 21a2 2 0 0 1-2-2"/>\n <path d="M9 3h1M14 3h1M9 21h1M14 21h1M3 9v1M3 14v1M21 9v1M21 14v1"/>\n</svg>\n',title:this.localeValues["zoom"===e?"selectionZoom":"selection"],class:`apexcharts-${e}-icon`})};r("zoom"),r("selection"),this.t.pan&&t.config.chart.zoom.enabled&&a.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M5 9 2 12l3 3"/>\n <path d="M9 5l3-3 3 3"/>\n <path d="M15 19l-3 3-3-3"/>\n <path d="M19 9l3 3-3 3"/>\n <path d="M2 12h20"/>\n <path d="M12 2v20"/>\n</svg>\n',title:this.localeValues.pan,class:"apexcharts-pan-icon"}),o("reset",this.elZoomReset,'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>\n <path d="M3 3v5h5"/>\n</svg>\n'),this.t.download&&a.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 6h16M4 12h16M4 18h16"/>\n</svg>\n',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(let t=0;t<this.elCustomIcons.length;t++)a.push({el:this.elCustomIcons[t],icon:this.t.customIcons[t].icon,title:this.t.customIcons[t].title,index:this.t.customIcons[t].index,class:"apexcharts-toolbar-custom-icon "+this.t.customIcons[t].class});a.forEach((t,e)=>{t.index&&m.moveIndexInArray(a,e,t.index)});for(let t=0;t<a.length;t++)N.setAttrs(a[t].el,{class:a[t].class,title:a[t].title,"aria-label":a[t].title}),a[t].el.innerHTML=a[t].icon,i.appendChild(a[t].el);this.elZoom.parentNode&&this.elZoom.setAttribute("aria-pressed",String(!!t.interact.zoomEnabled)),this.elSelection.parentNode&&this.elSelection.setAttribute("aria-pressed",String(!!t.interact.selectionEnabled)),this.elPan.parentNode&&this.elPan.setAttribute("aria-pressed",String(!!t.interact.panEnabled)),this.elMenuIcon.parentNode&&(this.elMenuIcon.setAttribute("aria-haspopup","true"),this.elMenuIcon.setAttribute("aria-expanded","false")),this._createHamburgerMenu(i),t.interact.zoomEnabled?this.elZoom.classList.add(this.selectedClass):t.interact.panEnabled?this.elPan.classList.add(this.selectedClass):t.interact.selectionEnabled&&this.elSelection.classList.add(this.selectedClass),this.addToolbarEventListeners()}_createHamburgerMenu(t){this.elMenuItems=[],t.appendChild(this.elMenu),N.setAttrs(this.elMenu,{class:"apexcharts-menu",role:"menu"});const e=[{name:"exportSVG",title:this.localeValues.exportToSVG},{name:"exportPNG",title:this.localeValues.exportToPNG},{name:"exportCSV",title:this.localeValues.exportToCSV}];for(let t=0;t<e.length;t++)this.elMenuItems.push(b.createElementNS("http://www.w3.org/1999/xhtml","div")),this.elMenuItems[t].innerHTML=e[t].title,N.setAttrs(this.elMenuItems[t],{class:`apexcharts-menu-item ${e[t].name}`,title:e[t].title,role:"menuitem",tabindex:"-1"}),this.elMenu.appendChild(this.elMenuItems[t])}addToolbarEventListeners(){var t,e,s,i,a,o,r,n;null==(t=this.elZoomReset)||t.addEventListener("click",this.handleZoomReset.bind(this)),null==(e=this.elSelection)||e.addEventListener("click",this.toggleZoomSelection.bind(this,"selection")),null==(s=this.elZoom)||s.addEventListener("click",this.toggleZoomSelection.bind(this,"zoom")),null==(i=this.elZoomIn)||i.addEventListener("click",this.handleZoomIn.bind(this)),null==(a=this.elZoomOut)||a.addEventListener("click",this.handleZoomOut.bind(this)),null==(o=this.elPan)||o.addEventListener("click",this.togglePanning.bind(this)),null==(r=this.elMenuIcon)||r.addEventListener("click",this.toggleMenu.bind(this)),this.elMenuItems.forEach(t=>{t.classList.contains("exportSVG")?t.addEventListener("click",this.handleDownload.bind(this,"svg")):t.classList.contains("exportPNG")?t.addEventListener("click",this.handleDownload.bind(this,"png")):t.classList.contains("exportCSV")&&t.addEventListener("click",this.handleDownload.bind(this,"csv"))});for(let t=0;t<this.t.customIcons.length;t++)this.elCustomIcons[t].addEventListener("click",this.t.customIcons[t].click.bind(this,this.ctx,this.ctx.w));[this.elZoomReset,this.elSelection,this.elZoom,this.elZoomIn,this.elZoomOut,this.elPan,this.elMenuIcon,...this.elCustomIcons].forEach(t=>{t.addEventListener("keydown",e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const s=t.className;t.click(),requestAnimationFrame(()=>{const t=this.w.dom.baseEl;if(!t)return;const e=s.split(" ").find(t=>t.startsWith("apexcharts-"));if(!e)return;const i=t.querySelector(`.${e}`);i&&i.focus()})}})}),null==(n=this.elMenuIcon)||n.addEventListener("keydown",t=>{var e;"ArrowDown"!==t.key&&"ArrowUp"!==t.key||(t.preventDefault(),(null==(e=this.elMenu)?void 0:e.classList.contains("apexcharts-menu-open"))||this.toggleMenu(),window.setTimeout(()=>{const e="ArrowDown"===t.key?0:this.elMenuItems.length-1;this.elMenuItems[e]&&this.elMenuItems[e].focus()},20))}),this.elMenuItems.forEach((t,e)=>{t.addEventListener("keydown",s=>{var i;if("ArrowDown"===s.key){s.preventDefault();(this.elMenuItems[e+1]||this.elMenuItems[0]).focus()}else if("ArrowUp"===s.key){s.preventDefault();(this.elMenuItems[e-1]||this.elMenuItems[this.elMenuItems.length-1]).focus()}else"Escape"===s.key||"Tab"===s.key?(this._closeMenu(),null==(i=this.elMenuIcon)||i.focus(),"Tab"===s.key||s.preventDefault()):"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),t.click())})})}toggleZoomSelection(t){this.ctx.getSyncedCharts().forEach(e=>{e.ctx.toolbar.toggleOtherControls();const s="selection"===t?e.ctx.toolbar.elSelection:e.ctx.toolbar.elZoom,i="selection"===t?"selectionEnabled":"zoomEnabled";e.w.globals[i]=!e.w.globals[i],s.classList.contains(e.ctx.toolbar.selectedClass)?s.classList.remove(e.ctx.toolbar.selectedClass):s.classList.add(e.ctx.toolbar.selectedClass),s.setAttribute("aria-pressed",String(e.w.globals[i]))})}getToolbarIconsReference(){const t=this.w;this.elZoom||(this.elZoom=t.dom.baseEl.querySelector(".apexcharts-zoom-icon")),this.elPan||(this.elPan=t.dom.baseEl.querySelector(".apexcharts-pan-icon")),this.elSelection||(this.elSelection=t.dom.baseEl.querySelector(".apexcharts-selection-icon"))}enableZoomPanFromToolbar(t){this.toggleOtherControls(),"pan"===t?this.w.interact.panEnabled=!0:this.w.interact.zoomEnabled=!0;const e="pan"===t?this.elPan:this.elZoom,s="pan"===t?this.elZoom:this.elPan;e&&e.classList.add(this.selectedClass),s&&s.classList.remove(this.selectedClass)}togglePanning(){this.ctx.getSyncedCharts().forEach(t=>{t.ctx.toolbar.toggleOtherControls(),t.w.interact.panEnabled=!t.w.interact.panEnabled,t.ctx.toolbar.elPan.classList.contains(t.ctx.toolbar.selectedClass)?t.ctx.toolbar.elPan.classList.remove(t.ctx.toolbar.selectedClass):t.ctx.toolbar.elPan.classList.add(t.ctx.toolbar.selectedClass),t.ctx.toolbar.elPan.setAttribute("aria-pressed",String(t.w.interact.panEnabled))})}toggleOtherControls(){const t=this.w;t.interact.panEnabled=!1,t.interact.zoomEnabled=!1,t.interact.selectionEnabled=!1,this.getToolbarIconsReference();[this.elPan,this.elSelection,this.elZoom].forEach(t=>{t&&t.classList.remove(this.selectedClass)})}_currentXRange(){const t=this.w;return t.axisFlags.isRangeBar?{minX:t.globals.minY,maxX:t.globals.maxY}:{minX:t.globals.minX,maxX:t.globals.maxX}}handleZoomIn(){const t=this.w,{minX:e,maxX:s}=this._currentXRange();this.minX=e,this.maxX=s;const i=(e+s)/2,a=(e+i)/2,o=(s+i)/2,r=this._getNewMinXMaxX(a,o);t.interact.disableZoomIn||this.zoomUpdateOptions(r.minX,r.maxX)}handleZoomOut(){const t=this.w,{minX:e,maxX:s}=this._currentXRange();if(this.minX=e,this.maxX=s,"datetime"===t.config.xaxis.type&&new Date(e).getUTCFullYear()<1e3)return;const i=(e+s)/2,a=e-(i-e),o=s-(i-s),r=this._getNewMinXMaxX(a,o);t.interact.disableZoomOut||this.zoomUpdateOptions(r.minX,r.maxX)}_getNewMinXMaxX(t,e){const s=this.w.config.xaxis.convertedCatToNumeric;return{minX:s?Math.floor(t):t,maxX:s?Math.floor(e):e}}zoomUpdateOptions(t,e){const s=this.w;if(void 0===t&&void 0===e)return void this.handleZoomReset();if(s.config.xaxis.convertedCatToNumeric&&(t<1&&(t=1,e=s.globals.dataPoints),e-t<2))return;let i={min:t,max:e};const a=this.getBeforeZoomRange(i,void 0);a&&(i=a.xaxis);const o={xaxis:i};if(!s.globals.initialConfig)return;const r=m.clone(s.globals.initialConfig.yaxis);s.config.chart.group||(o.yaxis=r),this.w.interact.zoomed=!0,this.ctx.updateHelpers._updateOptions(o,!1,this.w.config.chart.animations.dynamicAnimation.enabled),this.zoomCallback(i,r)}zoomCallback(t,e){"function"==typeof this.ev.zoomed&&(this.ev.zoomed(this.ctx,{xaxis:t,yaxis:e}),this.ctx.events.fireEvent("zoomed",{xaxis:t,yaxis:e}))}getBeforeZoomRange(t,e){let s=null;return"function"==typeof this.ev.beforeZoom&&(s=this.ev.beforeZoom(this,{xaxis:t,yaxis:e})),s}toggleMenu(){window.setTimeout(()=>{var t,e,s;(null==(t=this.elMenu)?void 0:t.classList.contains("apexcharts-menu-open"))?this._closeMenu():(null==(e=this.elMenu)||e.classList.add("apexcharts-menu-open"),null==(s=this.elMenuIcon)||s.setAttribute("aria-expanded","true"))},0)}_closeMenu(){var t,e;null==(t=this.elMenu)||t.classList.remove("apexcharts-menu-open"),null==(e=this.elMenuIcon)||e.setAttribute("aria-expanded","false")}handleDownload(t){const e=this.w,s=new we(this.w,this.ctx);switch(t){case"svg":s.exportToSVG();break;case"png":s.exportToPng();break;case"csv":s.exportToCSV({series:e.config.series,columnDelimiter:e.config.chart.toolbar.export.csv.columnDelimiter})}}handleZoomReset(){this.ctx.getSyncedCharts().forEach(t=>{const e=t.w;if(!e.interact.zoomed)return;if(e.globals.lastXAxis.min=e.globals.initialConfig.xaxis.min,e.globals.lastXAxis.max=e.globals.initialConfig.xaxis.max,t.updateHelpers.revertDefaultAxisMinMax(),"function"==typeof e.config.chart.events.beforeResetZoom){const s=e.config.chart.events.beforeResetZoom(t,e);s&&t.updateHelpers.revertDefaultAxisMinMax(s)}"function"==typeof e.config.chart.events.zoomed&&t.ctx.toolbar.zoomCallback({min:e.config.xaxis.min,max:e.config.xaxis.max});const s=t.ctx.series.emptyCollapsedSeries(m.clone(e.globals.initialSeries));t.updateHelpers._updateSeries(s,e.config.chart.animations.dynamicAnimation.enabled),e.interact.zoomed=!1})}destroy(){this.elZoom=null,this.elZoomIn=null,this.elZoomOut=null,this.elPan=null,this.elSelection=null,this.elZoomReset=null,this.elMenuIcon=null}}me.registerFeatures({toolbar:Se,zoomPanSelection:class extends Se{constructor(t,e){super(t,e),this.w=t,this.ctx=e,this.dragged=!1,this.graphics=new N(this.w),this.eventList=["mousedown","mouseleave","mousemove","touchstart","touchmove","mouseup","touchend","wheel"],this.clientX=0,this.clientY=0,this.startX=0,this.endX=0,this.dragX=0,this.startY=0,this.endY=0,this.dragY=0,this.moveDirection="none",this.debounceTimer=null,this.debounceDelay=100,this.wheelDelay=400}init({xyRatios:t}){const e=this.w,s=this;this.xyRatios=t,this.zoomRect=this.graphics.drawRect(0,0,0,0),this.selectionRect=this.graphics.drawRect(0,0,0,0),this.gridRect=e.dom.baseEl.querySelector(".apexcharts-grid"),this.constraints=new $(0,0,e.layout.gridWidth,e.layout.gridHeight),this.zoomRect.node.classList.add("apexcharts-zoom-rect"),this.selectionRect.node.classList.add("apexcharts-selection-rect"),e.dom.Paper.add(this.zoomRect),e.dom.Paper.add(this.selectionRect),"x"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,minY:0,maxX:e.layout.gridWidth,maxY:e.layout.gridHeight}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):"y"===e.config.chart.selection.type?this.slDraggableRect=this.selectionRect.draggable({minX:0,maxX:e.layout.gridWidth}).on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")):this.slDraggableRect=this.selectionRect.draggable().on("dragmove.namespace",this.selectionDragging.bind(this,"dragging")),this.preselectedSelection(),this.hoverArea=e.dom.baseEl.querySelector(`${e.globals.chartClass} .apexcharts-svg`),this.hoverArea&&(this.hoverArea.classList.add("apexcharts-zoomable"),this.eventList.forEach(e=>{var i;null==(i=this.hoverArea)||i.addEventListener(e,s.svgMouseEvents.bind(s,t),{capture:!1,passive:!0})}),e.config.chart.zoom.enabled&&e.config.chart.zoom.allowMouseWheelZoom&&this.hoverArea.addEventListener("wheel",s.mouseWheelEvent.bind(s),{capture:!1,passive:!1}))}destroy(){this.slDraggableRect&&(this.slDraggableRect.draggable(!1),this.slDraggableRect.off(),this.selectionRect.off()),this.selectionRect=null,this.zoomRect=null,this.gridRect=null}svgMouseEvents(t,e){var s;const i=this.w,a=this.ctx.toolbar,o=i.interact.zoomEnabled?i.config.chart.zoom.type:i.config.chart.selection.type,r=i.config.chart.toolbar.autoSelected;if(e.shiftKey?(this.shiftWasPressed=!0,a.enableZoomPanFromToolbar("pan"===r?"zoom":"pan")):this.shiftWasPressed&&(a.enableZoomPanFromToolbar(r),this.shiftWasPressed=!1),!e.target)return;const n=e.target.classList;let l;e.target.parentNode&&null!==e.target.parentNode&&(l=e.target.parentNode.classList);if(!(n.contains("apexcharts-legend-marker")||n.contains("apexcharts-legend-text")||l&&l.contains("apexcharts-toolbar"))){if(this.clientX="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientX:"touchend"===e.type?e.changedTouches[0].clientX:e.clientX,this.clientY="touchmove"===e.type||"touchstart"===e.type?e.touches[0].clientY:"touchend"===e.type?e.changedTouches[0].clientY:e.clientY,"mousedown"===e.type&&1===e.which||"touchstart"===e.type){const t=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();if(!t)return;this.startX=this.clientX-t.left-i.globals.barPadForNumericAxis,this.startY=this.clientY-t.top,this.dragged=!1,this.w.interact.mousedown=!0}("mousemove"===e.type&&1===e.which||"touchmove"===e.type)&&(this.dragged=!0,i.interact.panEnabled?(i.interact.selection=null,this.w.interact.mousedown&&this.panDragging({context:this,zoomtype:o,xyRatios:t})):(this.w.interact.mousedown&&i.interact.zoomEnabled||this.w.interact.mousedown&&i.interact.selectionEnabled)&&(this.selection=this.selectionDrawing({context:this,zoomtype:o}))),"mouseup"!==e.type&&"touchend"!==e.type&&"mouseleave"!==e.type||this.handleMouseUp({zoomtype:o}),this.makeSelectionRectDraggable()}}handleMouseUp({zoomtype:t,isResized:e}){var s;const i=this.w,a=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();a&&(this.w.interact.mousedown||e)&&(this.endX=this.clientX-a.left-i.globals.barPadForNumericAxis,this.endY=this.clientY-a.top,this.dragX=Math.abs(this.endX-this.startX),this.dragY=Math.abs(this.endY-this.startY),(i.interact.zoomEnabled||i.interact.selectionEnabled)&&this.selectionDrawn({context:this,zoomtype:t})),i.interact.zoomEnabled&&this.hideSelectionRect(this.selectionRect),this.dragged=!1,this.w.interact.mousedown=!1}mouseWheelEvent(t){const e=this.w;t.preventDefault();const s=Date.now();s-e.interact.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(t),e.interact.lastWheelExecution=s),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{s-e.interact.lastWheelExecution>this.wheelDelay&&(this.executeMouseWheelZoom(t),e.interact.lastWheelExecution=s)},this.debounceDelay)}executeMouseWheelZoom(t){var e,s,i;const a=this.w;this.minX=a.axisFlags.isRangeBar?a.globals.minY:a.globals.minX,this.maxX=a.axisFlags.isRangeBar?a.globals.maxY:a.globals.maxX;const o=null==(e=this.gridRect)?void 0:e.getBoundingClientRect();if(!o)return;const r=(t.clientX-o.left)/o.width,n=this.minX,l=this.maxX,h=l-n;let c,d,g;if(t.deltaY<0){c=.5*h;const t=n+r*h;d=t-c/2,g=t+c/2}else c=1.5*h,d=n-c/2,g=l+c/2;if(!a.axisFlags.isRangeBar){const t=null!=(s=a.globals.dataReducerRawMinX)?s:a.globals.initialMinX,e=null!=(i=a.globals.dataReducerRawMaxX)?i:a.globals.initialMaxX;d=Math.max(d,t),g=Math.min(g,e);const o=a.globals.minXDiff>0&&isFinite(a.globals.minXDiff)?a.globals.minXDiff:0,r=Math.max(2*o,1e-6*(e-t));if(g-d<r){const t=(d+g)/2;d=t-r/2,g=t+r/2}}const p=this._getNewMinXMaxX(d,g);isNaN(p.minX)||isNaN(p.maxX)||this.zoomUpdateOptions(p.minX,p.maxX)}makeSelectionRectDraggable(){const t=this.w;if(!this.selectionRect)return;const e=this.selectionRect.node.getBoundingClientRect();e.width>0&&e.height>0&&(this.selectionRect.select(!1).resize(!1),this.selectionRect.select({createRot:()=>{},updateRot:()=>{},createHandle:(t,e,s,i,a)=>"l"===a||"r"===a?t.circle(8).css({"stroke-width":1,stroke:"#333",fill:"#fff"}):t.circle(0),updateHandle:(t,e)=>t.center(e[0],e[1])}).resize().on("resize",()=>{const e=t.interact.zoomEnabled?t.config.chart.zoom.type:t.config.chart.selection.type;this.handleMouseUp({zoomtype:e,isResized:!0})}))}preselectedSelection(){const t=this.w,e=this.xyRatios;if(!t.interact.zoomEnabled)if(void 0!==t.interact.selection&&null!==t.interact.selection)this.drawSelectionRect(l(n({},t.interact.selection),{translateX:t.layout.translateX,translateY:t.layout.translateY}));else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){let s=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,i=t.layout.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-s;t.axisFlags.isRangeBar&&(s=(t.config.chart.selection.xaxis.min-t.globals.yAxisScale[0].niceMin)/e.invertedYRatio,i=(t.config.chart.selection.xaxis.max-t.config.chart.selection.xaxis.min)/e.invertedYRatio);const a={x:s,y:0,width:i,height:t.layout.gridHeight,translateX:t.layout.translateX,translateY:t.layout.translateY,selectionEnabled:!0};this.drawSelectionRect(a),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}drawSelectionRect({x:t,y:e,width:s,height:i,translateX:a=0,translateY:o=0}){const r=this.w,n=this.zoomRect,l=this.selectionRect;if(this.dragged||null!==r.interact.selection){const h={transform:"translate("+a+", "+o+")"};r.interact.zoomEnabled&&this.dragged&&(s<0&&(s=1),n.attr({x:t,y:e,width:s,height:i,fill:r.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":r.config.chart.zoom.zoomedArea.fill.opacity,stroke:r.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":r.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":r.config.chart.zoom.zoomedArea.stroke.opacity}),N.setAttrs(n.node,h)),r.interact.selectionEnabled&&(l.attr({x:t,y:e,width:s>0?s:0,height:i>0?i:0,fill:r.config.chart.selection.fill.color,"fill-opacity":r.config.chart.selection.fill.opacity,stroke:r.config.chart.selection.stroke.color,"stroke-width":r.config.chart.selection.stroke.width,"stroke-dasharray":r.config.chart.selection.stroke.dashArray,"stroke-opacity":r.config.chart.selection.stroke.opacity}),N.setAttrs(l.node,h))}}hideSelectionRect(t){t&&t.attr({x:0,y:0,width:0,height:0})}selectionDrawing({context:t,zoomtype:e}){var s;const i=this.w,a=t,o=null==(s=this.gridRect)?void 0:s.getBoundingClientRect();if(!o)return;const r=a.startX-1,h=a.startY;let c=!1,d=!1;const g=a.clientX-o.left-i.globals.barPadForNumericAxis,p=a.clientY-o.top;let u=g-r,x=p-h,f={translateX:i.layout.translateX,translateY:i.layout.translateY};return Math.abs(u+r)>i.layout.gridWidth?u=i.layout.gridWidth-r:g<0&&(u=r),r>g&&(c=!0,u=Math.abs(u)),h>p&&(d=!0,x=Math.abs(x)),f="x"===e?{x:c?r-u:r,y:0,width:u,height:i.layout.gridHeight}:"y"===e?{x:0,y:d?h-x:h,width:i.layout.gridWidth,height:x}:{x:c?r-u:r,y:d?h-x:h,width:u,height:x},f=l(n({},f),{translateX:i.layout.translateX,translateY:i.layout.translateY}),a.drawSelectionRect(f),a.selectionDragging("resizing"),f}selectionDragging(t,e){var s;const i=this.w;if(!e)return;e.preventDefault();const{handler:a,box:o}=e.detail,r=this.constraints;let{x:n,y:l}=o;n<r.x&&(n=r.x),l<r.y&&(l=r.y),o.x2>r.x2&&(n=r.x2-o.w),o.y2>r.y2&&(l=r.y2-o.h),a.move(n,l);const h=this.xyRatios,c=this.selectionRect;let d=0;"resizing"===t&&(d=30);const g=t=>parseFloat(c.node.getAttribute(t)),p={x:g("x"),y:g("y"),width:g("width"),height:g("height")};i.interact.selection=p,"function"==typeof i.config.chart.events.selection&&i.interact.selectionEnabled&&(clearTimeout(null!=(s=this.w.globals.selectionResizeTimer)?s:void 0),this.w.globals.selectionResizeTimer=window.setTimeout(()=>{var t;const e=null==(t=this.gridRect)?void 0:t.getBoundingClientRect();if(!e)return;const s=c.node.getBoundingClientRect();let a,o,r,n;if(i.axisFlags.isRangeBar)a=i.globals.yAxisScale[0].niceMin+(s.left-e.left)*h.invertedYRatio,o=i.globals.yAxisScale[0].niceMin+(s.right-e.left)*h.invertedYRatio,r=0,n=1;else{if(!i.globals.xAxisScale)return;a=i.globals.xAxisScale.niceMin+(s.left-e.left)*h.xRatio,o=i.globals.xAxisScale.niceMin+(s.right-e.left)*h.xRatio,r=i.globals.yAxisScale[0].niceMin+(e.bottom-s.bottom)*h.yRatio[0],n=i.globals.yAxisScale[0].niceMax-(s.top-e.top)*h.yRatio[0]}const l={xaxis:{min:a,max:o},yaxis:{min:r,max:n}};i.config.chart.events.selection(this.ctx,l),i.config.chart.brush.enabled&&void 0!==i.config.chart.events.brushScrolled&&i.config.chart.events.brushScrolled(this.ctx,l)},d))}selectionDrawn({context:t,zoomtype:e}){var s,i;const a=this.w,o=t,r=this.xyRatios,n=this.ctx.toolbar,l=a.interact.zoomEnabled?o.zoomRect.node.getBoundingClientRect():o.selectionRect.node.getBoundingClientRect(),h=o.gridRect.getBoundingClientRect(),c=l.left-h.left-a.globals.barPadForNumericAxis,d=l.right-h.left-a.globals.barPadForNumericAxis,g=l.top-h.top,p=l.bottom-h.top;let u,x;if(a.axisFlags.isRangeBar)u=a.globals.yAxisScale[0].niceMin+c*r.invertedYRatio,x=a.globals.yAxisScale[0].niceMin+d*r.invertedYRatio;else{const t=null!=(i=null==(s=a.globals.xAxisScale)?void 0:s.niceMin)?i:0;u=t+c*r.xRatio,x=t+d*r.xRatio}const f=[],b=[];if(a.config.yaxis.forEach((t,e)=>{const s=a.globals.seriesYAxisMap[e][0],i=a.globals.yAxisScale[e].niceMax-r.yRatio[s]*g,o=a.globals.yAxisScale[e].niceMax-r.yRatio[s]*p;f.push(i),b.push(o)}),o.dragged&&(o.dragX>10||o.dragY>10)&&u!==x)if(a.interact.zoomEnabled){if(!a.globals.initialConfig)return;let t=m.clone(a.globals.initialConfig.yaxis),s=m.clone(a.globals.initialConfig.xaxis);if(a.interact.zoomed=!0,a.config.xaxis.convertedCatToNumeric&&(u=Math.floor(u),x=Math.floor(x),u<1&&(u=1,x=a.globals.dataPoints),x-u<2&&(x=u+1)),"xy"!==e&&"x"!==e||(s={min:u,max:x}),"xy"!==e&&"y"!==e||t.forEach((e,s)=>{t[s].min=b[s],t[s].max=f[s]}),n){const e=n.getBeforeZoomRange(s,t);e&&(s=e.xaxis?e.xaxis:s,t=e.yaxis?e.yaxis:t)}const i={xaxis:s};a.config.chart.group||(i.yaxis=t),o.ctx.updateHelpers._updateOptions(i,!1,o.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof a.config.chart.events.zoomed&&n.zoomCallback(s,t)}else if(a.interact.selectionEnabled){let t=null,s=null;if(s={min:u,max:x},"xy"===e||"y"===e){const e=m.clone(a.config.yaxis);t=e,e.forEach((t,s)=>{e[s].min=b[s],e[s].max=f[s]})}a.interact.selection=o.selection,"function"==typeof a.config.chart.events.selection&&a.config.chart.events.selection(o.ctx,{xaxis:s,yaxis:t})}}panDragging({context:t}){var e;const s=this.w,i=t;if(void 0!==s.interact.lastClientPosition.x){const t=s.interact.lastClientPosition.x-i.clientX,a=(null!=(e=s.interact.lastClientPosition.y)?e:0)-i.clientY;Math.abs(t)>Math.abs(a)&&t>0?this.moveDirection="left":Math.abs(t)>Math.abs(a)&&t<0?this.moveDirection="right":Math.abs(a)>Math.abs(t)&&a>0?this.moveDirection="up":Math.abs(a)>Math.abs(t)&&a<0&&(this.moveDirection="down")}s.interact.lastClientPosition={x:i.clientX,y:i.clientY};const a=s.axisFlags.isRangeBar?s.globals.minY:s.globals.minX,o=s.axisFlags.isRangeBar?s.globals.maxY:s.globals.maxX;i.panScrolled(a,o)}panScrolled(t,e){var s,i;const a=this.w,o=this.xyRatios;if(!a.globals.initialConfig)return;const r=m.clone(a.globals.initialConfig.yaxis);let n=o.xRatio,l=a.globals.minX,h=a.globals.maxX;if(a.axisFlags.isRangeBar&&(n=o.invertedYRatio,l=a.globals.minY,h=a.globals.maxY),"left"===this.moveDirection?(t=l+a.layout.gridWidth/15*n,e=h+a.layout.gridWidth/15*n):"right"===this.moveDirection&&(t=l-a.layout.gridWidth/15*n,e=h-a.layout.gridWidth/15*n),!a.axisFlags.isRangeBar){const o=null!=(s=a.globals.dataReducerRawMinX)?s:a.globals.initialMinX,r=null!=(i=a.globals.dataReducerRawMaxX)?i:a.globals.initialMaxX;(t<o||e>r)&&(t=l,e=h)}const c={xaxis:{min:t,max:e}};a.config.chart.group||(c.yaxis=r),this.updateScrolledChart(c,t,e)}updateScrolledChart(t,e,s){const i=this.w;if(this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof i.config.chart.events.scrolled){const t={xaxis:{min:e,max:s}};i.config.chart.events.scrolled(this.ctx,t),this.ctx.events.fireEvent("scrolled",t)}}}});let ke=class{constructor(t){this.w=t.w,this.annoCtx=t}setOrientations(t,e=null){var s,i;const a=this.w;if("vertical"===t.label.orientation){const o=null!==e?e:0,r=a.dom.baseEl.querySelector(`.apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='${o}']`);if(null!==r){const e=r.getBBox();r.setAttribute("x",String(parseFloat(null!=(s=r.getAttribute("x"))?s:"0")-e.height+4));const a="top"===t.label.position?e.width:-e.width;r.setAttribute("y",String(parseFloat(null!=(i=r.getAttribute("y"))?i:"0")+a));const{x:o,y:n}=this.annoCtx.graphics.rotateAroundCenter(r);r.setAttribute("transform",`rotate(-90 ${o} ${n})`)}}}addBackgroundToAnno(t,e){const s=this.w;if(!t||!e.label.text||!String(e.label.text).trim())return null;const i=s.dom.baseEl.querySelector(".apexcharts-grid");if(!i)return null;const a=i.getBoundingClientRect(),o=i.getBBox(),r=a.width/o.width||1,n=t.getBoundingClientRect();let{left:l,right:h,top:c,bottom:d}=e.label.style.padding;"vertical"===e.label.orientation&&([c,d,l,h]=[l,h,c,d]);const g=(n.left-a.left)/r-l,p=(n.top-a.top)/r-c,u=this.annoCtx.graphics.drawRect(g-s.globals.barPadForNumericAxis,p,n.width/r+l+h,n.height/r+c+d,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&u.node.classList.add(e.id),u}annotationsBackground(){const t=this.w,e=(e,s,i)=>{const a=t.dom.baseEl.querySelector(`.apexcharts-${i}-annotations .apexcharts-${i}-annotation-label[rel='${s}']`);if(a){const s=a.parentNode,i=this.addBackgroundToAnno(a,e);if(i){null==s||s.insertBefore(i.node,a);const o=a.getAttribute("x");null!==o&&z(i,parseFloat(o),t),e.label.mouseEnter&&i.node.addEventListener("mouseenter",e.label.mouseEnter.bind(this,e)),e.label.mouseLeave&&i.node.addEventListener("mouseleave",e.label.mouseLeave.bind(this,e)),e.label.click&&i.node.addEventListener("click",e.label.click.bind(this,e))}}};t.config.annotations.xaxis.forEach((t,s)=>e(t,s,"xaxis")),t.config.annotations.yaxis.forEach((t,s)=>e(t,s,"yaxis")),t.config.annotations.points.forEach((t,s)=>e(t,s,"point"))}getY1Y2(t,e){var s,i;const a=this.w,o="y1"===t?e.y:e.y2;let r,n=!1;if(this.annoCtx.invertAxis){const t=a.config.xaxis.convertedCatToNumeric?a.labelData.categoryLabels:a.labelData.labels,i=t.indexOf(o),n=a.dom.baseEl.querySelector(`.apexcharts-yaxis-texts-g text:nth-child(${i+1})`);r=n?parseFloat(null!=(s=n.getAttribute("y"))?s:"0"):(a.layout.gridHeight/t.length-1)*(i+1)-a.globals.barHeight,void 0!==e.seriesIndex&&a.globals.barHeight&&(r-=a.globals.barHeight/2*(a.seriesData.series.length-1)-a.globals.barHeight*e.seriesIndex)}else{const t=a.globals.seriesYAxisMap[e.yAxisIndex][0],s=a.config.yaxis[e.yAxisIndex].logarithmic?new F(this.w).getLogVal(a.config.yaxis[e.yAxisIndex].logBase,o,t)/a.globals.yLogRatio[t]:(o-a.globals.minYArr[t])/(a.globals.yRange[t]/a.layout.gridHeight);r=a.layout.gridHeight-Math.min(Math.max(s,0),a.layout.gridHeight),n=s>a.layout.gridHeight||s<0,!e.marker||void 0!==e.y&&null!==e.y||(r=0),(null==(i=a.config.yaxis[e.yAxisIndex])?void 0:i.reversed)&&(r=s)}return"string"==typeof o&&o.includes("px")&&(r=parseFloat(o)),{yP:r,clipped:n}}getX1X2(t,e){const s=this.w,i="x1"===t?e.x:e.x2,a=this.annoCtx.invertAxis?s.globals.minY:s.globals.minX,o=this.annoCtx.invertAxis?s.globals.maxY:s.globals.maxX,r=this.annoCtx.invertAxis?s.globals.yRange[0]:s.globals.xRange;let n=!1,l=this.annoCtx.inversedReversedAxis?(o-i)/(r/s.layout.gridWidth):(i-a)/(r/s.layout.gridWidth);return"category"!==s.config.xaxis.type&&!s.config.xaxis.convertedCatToNumeric||this.annoCtx.invertAxis||s.axisFlags.dataFormatXNumeric||s.config.chart.sparkline.enabled||(l=this.getStringX(i)),"string"==typeof i&&i.includes("px")&&(l=parseFloat(i)),null==i&&e.marker&&(l=s.layout.gridWidth),void 0!==e.seriesIndex&&s.globals.barWidth&&!this.annoCtx.invertAxis&&(l-=s.globals.barWidth/2*(s.seriesData.series.length-1)-s.globals.barWidth*e.seriesIndex),"number"!=typeof l&&(l=0,n=!0),parseFloat(l.toFixed(10))>parseFloat(s.layout.gridWidth.toFixed(10))?(l=s.layout.gridWidth,n=!0):l<0&&(l=0,n=!0),{x:l,clipped:n}}getStringX(t){var e;const s=this.w;let i=t;if(s.config.xaxis.convertedCatToNumeric&&s.labelData.categoryLabels.length){const e=String(t);t=s.labelData.categoryLabels.findIndex(t=>String(t)===e)+1}const a=s.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(t),o=s.dom.baseEl.querySelector(`.apexcharts-xaxis-texts-g text:nth-child(${a+1})`);return o&&(i=parseFloat(null!=(e=o.getAttribute("x"))?e:"0")),i}};class De{constructor(t){this.w=t.w,this.annoCtx=t,this.invertAxis=this.annoCtx.invertAxis,this.helpers=new ke(this.annoCtx)}addXaxisAnnotation(t,e,s){const i=this.w,a=this.helpers.getX1X2("x1",t);let o=a.x;const r=a.clipped;let n,l=!0;const h=t.label.text,c=t.strokeDashArray;if(m.isNumber(o)){if(null===t.x2||void 0===t.x2){if(!r){const s=this.annoCtx.graphics.drawLine(o+t.offsetX,0+t.offsetY,o+t.offsetX,i.layout.gridHeight+t.offsetY,t.borderColor,c,t.borderWidth);e.appendChild(s.node),t.id&&s.node.classList.add(t.id),z(s,o+t.offsetX,i)}}else{const s=this.helpers.getX1X2("x2",t);if(n=s.x,l=s.clipped,n<o){const t=o;o=n,n=t}const a=this.annoCtx.graphics.drawRect(o+t.offsetX,0+t.offsetY,n-o,i.layout.gridHeight+t.offsetY,0,t.fillColor,t.opacity,1,t.borderColor,c);a.node.classList.add("apexcharts-annotation-rect"),a.attr("clip-path",`url(#gridRectMask${i.globals.cuid})`),e.appendChild(a.node),t.id&&a.node.classList.add(t.id),z(a,o+t.offsetX,i)}if(!r||!l){const a=this.annoCtx.graphics.getTextRects(h,t.label.style.fontSize),r="top"===t.label.position?4:"center"===t.label.position?i.layout.gridHeight/2+("vertical"===t.label.orientation?a.width/2:0):i.layout.gridHeight,n=this.annoCtx.graphics.drawText({x:o+t.label.offsetX,y:r+t.label.offsetY-("vertical"===t.label.orientation?"top"===t.label.position?a.width/2-12:-a.width/2:0),text:h,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-xaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});n.attr({rel:s}),e.appendChild(n.node),z(n,o+t.label.offsetX,i),this.annoCtx.helpers.setOrientations(t,s)}}}drawXAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-xaxis-annotations"});return t.config.annotations.xaxis.map((t,s)=>{this.addXaxisAnnotation(t,e.node,s)}),e}}class Le{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new ke(this.annoCtx),this.axesUtils=new Z(this.annoCtx.w,{theme:this.annoCtx.theme,timeScale:this.annoCtx.timeScale})}addYaxisAnnotation(t,e,s){const i=this.w,a=t.strokeDashArray;let o=this.helpers.getY1Y2("y1",t),r=o.yP;const n=o.clipped;let l,h=!0,c=!1;const d=t.label.text;if(null===t.y2||void 0===t.y2){if(!n){c=!0;const s=this.annoCtx.graphics.drawLine(0+t.offsetX,r+t.offsetY,this._getYAxisAnnotationWidth(t),r+t.offsetY,t.borderColor,a,t.borderWidth);e.appendChild(s.node),t.id&&s.node.classList.add(t.id)}}else{if(o=this.helpers.getY1Y2("y2",t),l=o.yP,h=o.clipped,l>r){const t=r;r=l,l=t}if(!n||!h){c=!0;const s=this.annoCtx.graphics.drawRect(0+t.offsetX,l+t.offsetY,this._getYAxisAnnotationWidth(t),r-l,0,t.fillColor,t.opacity,1,t.borderColor,a);s.node.classList.add("apexcharts-annotation-rect"),s.attr("clip-path",`url(#gridRectMask${i.globals.cuid})`),e.appendChild(s.node),t.id&&s.node.classList.add(t.id)}}if(c){const a="right"===t.label.position?i.layout.gridWidth:"center"===t.label.position?i.layout.gridWidth/2:0,o=this.annoCtx.graphics.drawText({x:a+t.label.offsetX,y:(null!=l?l:r)+t.label.offsetY-3,text:d,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-yaxis-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});o.attr({rel:s}),e.appendChild(o.node)}}_getYAxisAnnotationWidth(t){const e=this.w;let s=e.layout.gridWidth;return s=t.width.indexOf("%")>-1?e.layout.gridWidth*parseInt(t.width,10)/100:parseInt(t.width,10),s+t.offsetX}drawYAxisAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return t.config.annotations.yaxis.forEach((t,s)=>{t.yAxisIndex=this.axesUtils.translateYAxisIndex(t.yAxisIndex),this.axesUtils.isYAxisHidden(t.yAxisIndex)&&this.axesUtils.yAxisAllSeriesCollapsed(t.yAxisIndex)||this.addYaxisAnnotation(t,e.node,s)}),e}}class Me{constructor(t){this.w=t.w,this.annoCtx=t,this.helpers=new ke(this.annoCtx)}addPointAnnotation(t,e,s){const i=this.w;if(i.globals.collapsedSeriesIndices.indexOf(t.seriesIndex)>-1)return;const a=this.helpers.getX1X2("x1",t),o=a.x,r=a.clipped,n=this.helpers.getY1Y2("y1",t),l=n.yP,h=n.clipped;if(m.isNumber(o)&&!h&&!r){const a={pSize:t.marker.size,pointStrokeWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:`apexcharts-point-annotation-marker ${t.marker.cssClass} ${t.id?t.id:""}`};let r=this.annoCtx.graphics.drawMarker(o+t.marker.offsetX,l+t.marker.offsetY,a);e.appendChild(r.node),z(r,o,i);const n=t.label.text?t.label.text:"",h=this.annoCtx.graphics.drawText({x:o+t.label.offsetX,y:l+t.label.offsetY-t.marker.size-parseFloat(t.label.style.fontSize)/1.6,text:n,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:`apexcharts-point-annotation-label ${t.label.style.cssClass} ${t.id?t.id:""}`});if(h.attr({rel:s}),e.appendChild(h.node),z(h,o,i),t.customSVG.SVG){const s=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});s.attr({transform:`translate(${o+t.customSVG.offsetX}, ${l+t.customSVG.offsetY})`}),s.node.innerHTML=t.customSVG.SVG,e.appendChild(s.node)}if(t.image.path){const e=t.image.width?t.image.width:20,s=t.image.height?t.image.height:20;r=this.annoCtx.addImage({x:o+t.image.offsetX-e/2,y:l+t.image.offsetY-s/2,width:e,height:s,path:t.image.path,appendTo:".apexcharts-point-annotations"})}t.mouseEnter&&r.node.addEventListener("mouseenter",t.mouseEnter.bind(this,t)),t.mouseLeave&&r.node.addEventListener("mouseleave",t.mouseLeave.bind(this,t)),t.click&&r.node.addEventListener("click",t.click.bind(this,t))}}drawPointAnnotations(){const t=this.w,e=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return t.config.annotations.points.map((t,s)=>{this.addPointAnnotation(t,e.node,s)}),e}}me.registerFeatures({annotations:class{constructor(t,{theme:e=null,timeScale:s=null}={}){this.w=t,this.theme=e,this.timeScale=s,this.invertAxis=void 0,this.inversedReversedAxis=void 0,this.graphics=new N(this.w),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new ke(this),this.xAxisAnnotations=new De(this),this.yAxisAnnotations=new Le(this),this.pointsAnnotations=new Me(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.layout.gridWidth/this.w.globals.dataPoints}drawAxesAnnotations(){const t=this.w;if(t.globals.axisCharts&&t.globals.dataPoints){const e=this.yAxisAnnotations.drawYAxisAnnotations(),s=this.xAxisAnnotations.drawXAxisAnnotations(),i=this.pointsAnnotations.drawPointAnnotations(),a=t.config.chart.animations.enabled,o=[e,s,i],r=[s.node,e.node,i.node],n="line"===t.config.chart.type||"area"===t.config.chart.type||"rangeArea"===t.config.chart.type,l=[n,!1,n];for(let e=0;e<3;e++)t.dom.elGraphical.add(o[e]),!a||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&!l[e]&&r[e].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:r[e],index:0});this.helpers.annotationsBackground()}}drawImageAnnos(){this.w.config.annotations.images.map(t=>{this.addImage(t)})}drawTextAnnos(){this.w.config.annotations.texts.map(t=>{this.addText(t)})}addXaxisAnnotation(t,e,s){this.xAxisAnnotations.addXaxisAnnotation(t,e,s)}addYaxisAnnotation(t,e,s){this.yAxisAnnotations.addYaxisAnnotation(t,e,s)}addPointAnnotation(t,e,s){this.pointsAnnotations.addPointAnnotation(t,e,s)}addText(t){const{x:e,y:s,text:i,textAnchor:a,foreColor:o,fontSize:r,fontFamily:n,fontWeight:l,cssClass:h,backgroundColor:c,borderWidth:d,strokeDashArray:g,borderRadius:p,borderColor:u,appendTo:x=".apexcharts-svg",paddingLeft:f=4,paddingRight:b=4,paddingBottom:m=2,paddingTop:y=2}=t,w=this.w,v=this.graphics.drawText({x:e,y:s,text:i,textAnchor:a||"start",fontSize:r||"12px",fontWeight:l||"regular",fontFamily:n||w.config.chart.fontFamily,foreColor:o||w.config.chart.foreColor,cssClass:h}),A=w.dom.baseEl.querySelector(x);A&&A.appendChild(v.node);const C=v.bbox();if(i){const t=this.graphics.drawRect(C.x-f,C.y-y,C.width+f+b,C.height+m+y,p,c||"transparent",1,d,u,g);A.insertBefore(t.node,v.node)}}addImage(t){const e=this.w,{path:s,x:i=0,y:a=0,width:o=20,height:r=20,appendTo:n=".apexcharts-svg"}=t,l=e.dom.Paper.image(s);l.size(o,r).move(i,a);const h=e.dom.baseEl.querySelector(n);return h&&h.appendChild(l.node),l}addXaxisAnnotationExternal(t,e,s){return this.addAnnotationExternal({params:t,pushToMemory:e,context:s,type:"xaxis",contextMethod:s.addXaxisAnnotation}),s}addYaxisAnnotationExternal(t,e,s){return this.addAnnotationExternal({params:t,pushToMemory:e,context:s,type:"yaxis",contextMethod:s.addYaxisAnnotation}),s}addPointAnnotationExternal(t,e,s){return void 0===this.invertAxis&&(this.invertAxis=s.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:s,type:"point",contextMethod:s.addPointAnnotation}),s}addAnnotationExternal({params:t,pushToMemory:e,context:s,type:i,contextMethod:a}){const o=s,r=o.w,n=r.dom.baseEl.querySelector(`.apexcharts-${i}-annotations`),l=n.childNodes.length+1,h=new k,c=Object.assign({},"xaxis"===i?h.xAxisAnnotation:"yaxis"===i?h.yAxisAnnotation:h.pointAnnotation),d=m.extend(c,t);switch(i){case"xaxis":this.addXaxisAnnotation(d,n,l);break;case"yaxis":this.addYaxisAnnotation(d,n,l);break;case"point":this.addPointAnnotation(d,n,l)}const g=r.dom.baseEl.querySelector(`.apexcharts-${i}-annotations .apexcharts-${i}-annotation-label[rel='${l}']`),p=this.helpers.addBackgroundToAnno(g,d);return p&&n.insertBefore(p.node,g),e&&r.globals.memory.methodsToExec.push({context:o,id:d.id?d.id:m.randomId(),method:a,label:"addAnnotation",params:t}),s}clearAnnotations(t){const e=t.w,s=e.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");for(let t=e.globals.memory.methodsToExec.length-1;t>=0;t--)"addText"!==e.globals.memory.methodsToExec[t].label&&"addAnnotation"!==e.globals.memory.methodsToExec[t].label||e.globals.memory.methodsToExec.splice(t,1);Array.prototype.forEach.call(s,t=>{for(;t.firstChild;)t.removeChild(t.firstChild)})}removeAnnotation(t,e){const s=t.w,i=s.dom.baseEl.querySelectorAll(`.${e}`);i&&(s.globals.memory.methodsToExec.map((t,i)=>{t.id===e&&s.globals.memory.methodsToExec.splice(i,1)}),Object.keys(s.config.annotations).forEach(t=>{const i=s.config.annotations[t];Array.isArray(i)&&(s.config.annotations[t]=i.filter(t=>t.id!==e))}),Array.prototype.forEach.call(i,t=>{t.parentElement.removeChild(t)}))}}});me.registerFeatures({keyboardNavigation:class{constructor(t,e){this.w=t,this.ctx=e,this.seriesIndex=0,this.dataPointIndex=0,this.active=!1,this._tooltipDismissed=!1,this._focusedEl=null,this._hoveredBarEl=null,this._enlargedScatterMarker=null,this._onKeyDown=this._onKeyDown.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onLegendClick=this._onLegendClick.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._lastPointerDownAt=0}init(){const t=this.w.dom.Paper.node;t&&(t.setAttribute("tabindex","0"),t.addEventListener("focus",this._onFocus),t.addEventListener("blur",this._onBlur),t.addEventListener("mousedown",this._onPointerDown,{capture:!0}),t.addEventListener("pointerdown",this._onPointerDown,{capture:!0}),t.addEventListener("touchstart",this._onPointerDown,{capture:!0,passive:!0}),t.addEventListener("keydown",this._onKeyDown,{passive:!1}),this.ctx.events.addEventListener("legendClick",this._onLegendClick))}destroy(){const t=this.w,e=t.dom.Paper&&t.dom.Paper.node;e&&(e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur),e.removeEventListener("keydown",this._onKeyDown),e.removeEventListener("mousedown",this._onPointerDown,{capture:!0}),e.removeEventListener("pointerdown",this._onPointerDown,{capture:!0}),e.removeEventListener("touchstart",this._onPointerDown,{capture:!0}),this.ctx.events.removeEventListener("legendClick",this._onLegendClick))}_onPointerDown(){this._lastPointerDownAt=Date.now()}handleKey(t){}_onFocus(){this._isNavEnabled()&&(Date.now()-this._lastPointerDownAt<100||(this.active=!0,this._clampCursor(),this._snapToVisibleRange(),this._showCurrentPoint()))}_onBlur(){this.active=!1,this._tooltipDismissed=!1,this._hideFocus()}_onLegendClick(){this.active&&(this.active=!1,this._hideFocus())}_onKeyDown(t){var e,s,i;if(this._isNavEnabled()&&this.active){if(t.shiftKey&&("ArrowRight"===t.key||"ArrowLeft"===t.key)&&this._canPan())return t.preventDefault(),void this._panBy("ArrowRight"===t.key?1:-1);switch(t.key){case"ArrowRight":t.preventDefault(),this._move(0,1);break;case"ArrowLeft":t.preventDefault(),this._move(0,-1);break;case"ArrowUp":t.preventDefault(),this._move(-1,0);break;case"ArrowDown":t.preventDefault(),this._move(1,0);break;case"Home":t.preventDefault(),this.dataPointIndex=0,this._skipNullForward(),this._showCurrentPoint();break;case"End":t.preventDefault(),this.dataPointIndex=this._getDataPointCount(this.seriesIndex)-1,this._skipNullBackward(),this._showCurrentPoint();break;case"Enter":case" ":t.preventDefault(),this._fireClick();break;case"+":case"=":this._canZoom()&&(t.preventDefault(),null==(e=this.ctx.toolbar)||e.handleZoomIn(),this._announce("Zoomed in"));break;case"-":case"_":this._canZoom()&&(t.preventDefault(),null==(s=this.ctx.toolbar)||s.handleZoomOut(),this._announce("Zoomed out"));break;case"0":this._canZoom()&&this.w.interact.zoomed&&(t.preventDefault(),null==(i=this.ctx.toolbar)||i.handleZoomReset(),this._announce("Zoom reset"));break;case"Escape":t.preventDefault(),this._tooltipDismissed?(this.active=!1,this._tooltipDismissed=!1,this._hideFocus()):(this._tooltipDismissed=!0,this._hideFocus())}}}_canZoom(){const t=this.w;return Boolean(t.globals.axisCharts&&t.config.chart.zoom&&t.config.chart.zoom.enabled)}_canPan(){return this._canZoom()}_panBy(t){const e=this.w,s=this.ctx.toolbar;if(!s)return;const i=Number(e.globals.minX),a=Number(e.globals.maxX);if(!isFinite(i)||!isFinite(a)||i===a)return;const o=.1*(a-i)*t;s.zoomUpdateOptions(i+o,a+o),this._announce(t>0?"Panned right":"Panned left")}_move(t,e){const s=this.w,i=s.config.chart.accessibility.keyboard.navigation.wrapAround;if(0!==t){const e=this.w.globals.tooltip;if(e&&e.tConfig&&e.tConfig.shared){const t=this.dataPointIndex;if(e.tooltipUtil&&e.tooltipUtil.isXoverlap(t)&&e.tooltipUtil.isInitialSeriesSameLen())return}const a=this._getSeriesCount();let o=this.seriesIndex+t,r=0;for(;r<a&&(o<0&&(o=i?a-1:0),o>=a&&(o=i?0:a-1),s.globals.collapsedSeriesIndices.includes(o));)o+=t,r++;this.seriesIndex=o;const n=this._getDataPointCount(o);this.dataPointIndex>=n&&(this.dataPointIndex=n-1)}if(0!==e){const t=this._getDataPointCount(this.seriesIndex);let s=this.dataPointIndex+e;s<0&&(s=i?t-1:0),s>=t&&(s=i?0:t-1),this.dataPointIndex=s,e>0?this._skipNullForward():this._skipNullBackward(),this._isDataPointVisible(this.seriesIndex,this.dataPointIndex)||this._snapToVisibleRangeInDirection(e)}this._showCurrentPoint()}_skipNullForward(){const t=this.w,e=this.seriesIndex,s=this._getDataPointCount(e);let i=this.dataPointIndex,a=0;if(Array.isArray(t.seriesData.series[e])){for(;a<s&&null===t.seriesData.series[e][i];)i=(i+1)%s,a++;this.dataPointIndex=i}}_skipNullBackward(){const t=this.w,e=this.seriesIndex,s=this._getDataPointCount(e);let i=this.dataPointIndex,a=0;if(Array.isArray(t.seriesData.series[e])){for(;a<s&&null===t.seriesData.series[e][i];)i=(i-1+s)%s,a++;this.dataPointIndex=i}}_showCurrentPoint(){const{seriesIndex:t,dataPointIndex:e}=this,s=this.w,i=s.globals.tooltip;i&&i.ttItems&&(s.interact.capturedSeriesIndex=t,s.interact.capturedDataPointIndex=e,this._applyFocusClass(t,e),this._showTooltip(t,e,i))}_hideFocus(){const t=this.w,e=t.globals.tooltip;if(this._removeFocusClass(),this._leaveHoveredBar(),!e)return;e.marker&&e.marker.resetPointsSize(),this._enlargedScatterMarker=null;const s=e.getElTooltip();s&&(s.classList.remove("apexcharts-active"),t.config.chart.accessibility.enabled&&t.config.chart.accessibility.announcements.enabled&&s.setAttribute("aria-hidden","true")),t.dom.baseEl.classList.remove("apexcharts-tooltip-active");const i=e.getElXCrosshairs();i&&i.classList.remove("apexcharts-active")}_showTooltip(t,e,s){const i=this.w,a=i.config.chart.type,o=s.getElTooltip();if(!o)return;const r=s.getCachedDimensions();s.tooltipRect={x:0,y:0,ttWidth:r.ttWidth||0,ttHeight:r.ttHeight||0},this._setSyntheticEvent(t,e,s),i.dom.baseEl.classList.add("apexcharts-tooltip-active"),o.classList.add("apexcharts-active"),i.config.chart.accessibility.enabled&&i.config.chart.accessibility.announcements.enabled&&o.removeAttribute("aria-hidden"),"pie"===a||"donut"===a||"polarArea"===a?this._showTooltipNonAxis(t,e,s,o):"radialBar"===a?this._showTooltipRadialBar(t,e,s,o):"heatmap"===a||"treemap"===a?this._showTooltipHeatTree(t,e,s,o,a):"bar"===a||"candlestick"===a||"boxPlot"===a||"violin"===a||"rangeBar"===a?this._showTooltipBar(t,e,s):this._showTooltipAxisLine(t,e,s)}_setSyntheticEvent(t,e,s){const i=this.w,a=i.config.chart.type;let o=0,r=0;const n=this._getFocusableElement(t,e);if(n){const t=n.getBoundingClientRect();o=t.left+t.width/2,r=t.top+t.height/2}else if(i.globals.pointsArray&&i.globals.pointsArray[t]&&i.globals.pointsArray[t][e]){const a=i.globals.pointsArray[t][e],n=s.getElGrid&&s.getElGrid();if(n){const t=n.getBoundingClientRect();o=t.left+(a[0]||0),r=t.top+(a[1]||0)}}else{const t=i.dom.Paper&&i.dom.Paper.node;if(t){const e=t.getBoundingClientRect();o=e.left+e.width/2,r=e.top+e.height/2}}if(("line"===a||"area"===a||"rangeArea"===a||"scatter"===a||"bubble"===a||"radar"===a)&&i.globals.pointsArray&&i.globals.pointsArray[t]&&i.globals.pointsArray[t][e]){const a=i.globals.pointsArray[t][e],n=s.getElGrid&&s.getElGrid();if(n){const t=n.getBoundingClientRect();o=t.left+(a[0]||0),r=t.top+(a[1]||0)}}s.e={type:"mousemove",clientX:o,clientY:r}}_showTooltipBar(t,e,s){var i,a,o,r;const h=this.w,c=s.tConfig.shared&&(s.tooltipUtil.isXoverlap(e)||h.globals.isBarHorizontal)&&s.tooltipUtil.isInitialSeriesSameLen(),d=null==(r=null==(o=null==(a=null==(i=h.rangeData.seriesRange)?void 0:i[t])?void 0:a[e])?void 0:o.y)?void 0:r[0];s.tooltipLabels.drawSeriesTexts(l(n(n({ttItems:s.ttItems,i:t,j:e},void 0!==(null==d?void 0:d.y1)&&{y1:d.y1}),void 0!==(null==d?void 0:d.y2)&&{y2:d.y2}),{shared:c}));const g=`.apexcharts-series[data\\:realIndex='${t}']`,p=h.dom.Paper.findOne(`${g} path[j='${e}'], ${g} circle[j='${e}'], ${g} rect[j='${e}']`);if(p){this._leaveHoveredBar();new N(this.w,this.ctx).pathMouseEnter(p,null),this._hoveredBarEl=p}if(h.globals.isBarHorizontal){const t=p&&p.node;if(t){const e=h.dom.elWrap.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left-e.left,o=i.top-e.top,r=i.height,n=i.width,l=s.tooltipRect.ttWidth||0,c=o+r/2-(s.tooltipRect.ttHeight||0)/2;let d=a+n;a<(s.xyRatios&&null!=s.xyRatios.baseLineInvertedY?s.xyRatios.baseLineInvertedY:e.width/2)&&(d=a-l);const g=s.getElTooltip();g&&(g.style.left=d+"px",g.style.top=c+"px")}}else s.tooltipPosition.moveStickyTooltipOverBars(e,t)}_showTooltipAxisLine(t,e,s){const i=this.w,a=i.config.chart.type,o=s.tConfig.shared&&s.tooltipUtil.isXoverlap(e)&&s.tooltipUtil.isInitialSeriesSameLen();s.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:t,j:e,shared:o});const r="scatter"===a||"bubble"===a,n=i.globals.markers.largestSize>0;r?this._showScatterBubblePoint(t,e,s):n?o?s.marker.enlargePoints(e):s.tooltipPosition.moveDynamicPointOnHover(e,t):o?s.tooltipPosition.moveDynamicPointsOnHover(e):s.tooltipPosition.moveDynamicPointOnHover(e,t)}_showScatterBubblePoint(t,e,s){const i=this.w.dom.baseEl;this._enlargedScatterMarker&&(s.marker.oldPointSize(this._enlargedScatterMarker),this._enlargedScatterMarker=null);const a=i.querySelector(`.apexcharts-series[data\\:realIndex='${t}']`);if(!a)return;const o=a.querySelector(`.apexcharts-marker[rel='${e}']`);o&&(s.marker.enlargeCurrentPoint(e,o),this._enlargedScatterMarker=o)}_showTooltipNonAxis(t,e,s,i){var a,o;const r=this.w;s.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:e,shared:!1});const n=i.getBoundingClientRect(),l=n.width||s.tooltipRect.ttWidth||0,h=n.height||s.tooltipRect.ttHeight||0,c=r.dom.baseEl.querySelector(`.apexcharts-pie-area[j='${e}']`);if(c){const t=parseFloat(null!=(a=c.getAttribute("data:cx"))?a:""),e=parseFloat(null!=(o=c.getAttribute("data:cy"))?o:"");if(!isNaN(t)&&!isNaN(e)){const s=r.dom.Paper.node.getBoundingClientRect(),a=r.dom.elWrap.getBoundingClientRect(),o=s.left-a.left,n=s.top-a.top;i.style.left=o+t-l/2+"px",i.style.top=n+e-h-10+"px"}}}_showTooltipRadialBar(t,e,s,i){var a;const o=this.w;s.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:t,shared:!1});const{ttWidth:r=0,ttHeight:n=0}=s.getCachedDimensions(),l=o.dom.baseEl.querySelector(`.apexcharts-radialbar-series[data\\:realIndex='${t}'] path`);if(l){const e=parseFloat(null!=(a=l.getAttribute("data:angle"))?a:"")||0,s=(o.config.plotOptions.radialBar.startAngle||0)+e/2,h=o.layout.gridWidth/2,c=o.layout.gridHeight/2,d=o.globals.radialSize||Math.min(o.layout.gridWidth,o.layout.gridHeight)/2,g=o.seriesData.series.length,p=d/Math.max(g,1),u=d-t*p,x=(u+(u-p))/2,f=m.polarToCartesian(h,c,x,s),b=f.x+(o.layout.translateX||0),y=f.y+(o.layout.translateY||0);i.style.left=b-r/2+"px",i.style.top=y-n-10+"px"}}_showTooltipHeatTree(t,e,s,i,a){var o,r;const n=this.w;s.tooltipLabels.drawSeriesTexts({ttItems:s.ttItems,i:t,j:e,shared:!1});const l=i.getBoundingClientRect(),h=l.width||s.tooltipRect.ttWidth||0,c=l.height||s.tooltipRect.ttHeight||0,d="heatmap"===a?"apexcharts-heatmap-rect":"apexcharts-treemap-rect",g=n.dom.baseEl.querySelector(`.${d}[i='${t}'][j='${e}']`);if(g){const t=n.dom.elWrap.getBoundingClientRect(),e=g.getBoundingClientRect(),a=e.left-t.left,l=e.top-t.top,d=e.width,p=e.height,u=parseFloat(null!=(o=g.getAttribute("cx"))?o:""),x=parseFloat(null!=(r=g.getAttribute("width"))?r:"");s.tooltipPosition.moveXCrosshairs(u+x/2);let f=a+d+h/2;const b=l+p/2-c/2;a+d>n.layout.gridWidth/2&&(f=a-h/2),i.style.left=f+"px",i.style.top=b+"px"}}_applyFocusClass(t,e){this._removeFocusClass();const s=this._getFocusableElement(t,e);if(s){s.classList.add("apexcharts-keyboard-focused"),s.setAttribute("role","img");const i=this._buildPointLabel(t,e);i&&s.setAttribute("aria-label",i),this._focusedEl=s}}_removeFocusClass(){this._focusedEl&&(this._focusedEl.classList.remove("apexcharts-keyboard-focused"),this._focusedEl.removeAttribute("role"),this._focusedEl.removeAttribute("aria-label"),this._focusedEl=null)}_buildPointLabel(t,e){var s,i,a,o,r,n,l,h;const c=this.w,d=c.config.chart.type,g=c.seriesData.seriesNames||[],p=c.seriesData.series||[];if("pie"===d||"donut"===d||"polarArea"===d){const t=null!=(i=(null==(s=c.labelData)?void 0:s.labels)&&c.labelData.labels[e])?i:"",a=Array.isArray(p)?p[e]:"";return t?`${t}: ${a}`:`${a}`}if("radialBar"===d){return`${g[t]||`Series ${t+1}`}: ${Array.isArray(p)?p[t]:""}`}const u=g[t]||`Series ${t+1}`,x=(Array.isArray(p[t])?p[t]:[])[e];let f=null==x?"":String(x);const b=null==(o=null==(a=c.formatters)?void 0:a.yLabelFormatters)?void 0:o[t];if("function"==typeof b)try{f=b(x,{seriesIndex:t,dataPointIndex:e,w:c})}catch(t){}let m="";const y=null==(r=c.labelData)?void 0:r.categoryLabels,w=null==(l=null==(n=c.seriesData)?void 0:n.seriesX)?void 0:l[t];if(Array.isArray(y)&&null!=y[e])m=String(y[e]);else if(Array.isArray(w)&&null!=w[e]){const s=null==(h=c.formatters)?void 0:h.xLabelFormatter;if("function"==typeof s)try{m=String(s(w[e],{seriesIndex:t,dataPointIndex:e,w:c}))}catch(t){m=String(w[e])}else m=String(w[e])}return m?`${u}: ${f}, ${m}`:`${u}: ${f}`}_leaveHoveredBar(){if(this._hoveredBarEl){new N(this.w,this.ctx).pathMouseLeave(this._hoveredBarEl,null),this._hoveredBarEl=null}}_getFocusableElement(t,e){const s=this.w,i=s.config.chart.type,a=s.dom.baseEl;if("pie"===i||"donut"===i||"polarArea"===i)return a.querySelector(`.apexcharts-pie-area[j='${e}']`);if("heatmap"===i)return a.querySelector(`.apexcharts-heatmap-rect[i='${t}'][j='${e}']`);if("treemap"===i)return a.querySelector(`.apexcharts-treemap-rect[i='${t}'][j='${e}']`);if("radialBar"===i)return a.querySelector(`.apexcharts-radialbar-series[data\\:realIndex='${t}'] path`);if("bar"===i||"candlestick"===i||"boxPlot"===i||"violin"===i||"rangeBar"===i)return a.querySelector(`.apexcharts-series[data\\:realIndex='${t}'] path[j='${e}']`);return a.querySelector(`.apexcharts-series[data\\:realIndex='${t}'] .apexcharts-marker[rel='${e}']`)||null}_fireClick(){const t=this.w.globals.tooltip;if(!t)return;t.markerClick({type:"mouseup",clientX:0,clientY:0},this.seriesIndex,this.dataPointIndex)}_isNavEnabled(){const t=this.w.config.chart.accessibility;return t.enabled&&t.keyboard.enabled&&t.keyboard.navigation.enabled}_getSeriesCount(){const t=this.w,e=t.config.chart.type;return"pie"===e||"donut"===e||"polarArea"===e?1:t.seriesData.series.length}_getDataPointCount(t){const e=this.w,s=e.config.chart.type;if("pie"===s||"donut"===s||"polarArea"===s)return e.seriesData.series.length;const i=e.seriesData.series;return i[t]&&Array.isArray(i[t])?i[t].length:0}_clampCursor(){const t=this._getSeriesCount();this.seriesIndex>=t&&(this.seriesIndex=t-1),this.seriesIndex<0&&(this.seriesIndex=0);const e=this._getDataPointCount(this.seriesIndex);this.dataPointIndex>=e&&(this.dataPointIndex=e-1),this.dataPointIndex<0&&(this.dataPointIndex=0)}_snapToVisibleRange(){const t=this.w,e=t.globals,s=this.seriesIndex;if(!t.interact.zoomed)return;const i=t.seriesData.seriesX&&t.seriesData.seriesX[s];if(!i||!i.length)return;const a=e.minX,o=e.maxX;if(void 0===a||void 0===o)return;const r=i[this.dataPointIndex];if(r>=a&&r<=o)return;const n=i.length;for(let t=0;t<n;t++)if(i[t]>=a&&i[t]<=o)return void(this.dataPointIndex=t)}_snapToVisibleRangeInDirection(t){const e=this.w,s=e.globals,i=this.seriesIndex,a=e.seriesData.seriesX&&e.seriesData.seriesX[i];if(!a||!a.length)return;const o=s.minX,r=s.maxX;if(void 0===o||void 0===r)return;const n=a.length;if(t>=0){for(let t=0;t<n;t++)if(a[t]>=o&&a[t]<=r)return void(this.dataPointIndex=t)}else for(let t=n-1;t>=0;t--)if(a[t]>=o&&a[t]<=r)return void(this.dataPointIndex=t)}_isDataPointVisible(t,e){const s=this.w,i=s.globals;if(!s.interact.zoomed)return!0;const a=s.seriesData.seriesX&&s.seriesData.seriesX[t];if(!a)return!0;const o=a[e];return void 0===o||o>=i.minX&&o<=i.maxX}_announce(t){const e=this.w;if(!e.config.chart.accessibility.announcements.enabled)return;const s=e.dom.baseEl;if(!s)return;const i=s.querySelector(".apexcharts-sr-status");i&&(i.textContent="",setTimeout(()=>{i.textContent=t},0))}}});const Pe=new Set(["bar","funnel","pyramid"]),Te=new Set(["pie","donut","polarArea","radialBar","gauge"]);function Fe(t){return Pe.has(t)?"bar":Te.has(t)?"radial":null}me.registerFeatures({morphTypeChange:class{constructor(t,e){this.w=t,this.ctx=e,this._snapshot=null}canMorphTypes(t,e){if(t===e)return!1;const s=Fe(t),i=Fe(e);return!(!s||!i)}isCompatibleSeriesShape(t,e,s){if(!Array.isArray(s)||0===s.length)return!1;const i=Fe(t),a=Fe(e);return"radial"===a?s.every(t=>"number"==typeof t):"bar"===a?s.every(t=>t&&"object"==typeof t&&Array.isArray(t.data)):null!==i&&null!==a}captureBeforeDestroy({fromType:t,toType:e,newSeries:s}){if(this._snapshot=null,!c.isBrowser())return!1;const i=this.w.config.chart.animations;if(!i||!1===i.enabled)return!1;if(i.chartTypeMorph&&!1===i.chartTypeMorph.enabled)return!1;if(i.respectReducedMotion&&R())return!1;if(!this.canMorphTypes(t,e))return!1;if(!this.isCompatibleSeriesShape(t,e,s))return!1;const a=this._captureFromDOM(t);if(!a.length)return!1;const o=this._buildMapping(a,t,e,s);return 0!==o.size&&(this._snapshot={fromType:t,toType:e,mapping:o,oldLayout:{translateX:this.w.layout.translateX||0,translateY:this.w.layout.translateY||0}},this.w.globals.previousPaths=[],!0)}_captureFromDOM(t){var e;const s=null==(e=this.w.globals.dom)?void 0:e.baseEl;if(!s)return[];const i=[],a=Fe(t);if("bar"===a){s.querySelectorAll(".apexcharts-bar-series .apexcharts-series").forEach(t=>{var e;const s=parseInt(null!=(e=t.getAttribute("data:realIndex"))?e:"0",10);t.querySelectorAll("path[pathTo]").forEach((t,e)=>{const a=t.getAttribute("pathTo")||t.getAttribute("d");a&&i.push({realIndex:s,j:e,d:a,fill:t.getAttribute("fill")})})})}else if("radial"===a)if("radialBar"===t||"gauge"===t){const t=this.w.layout.gridWidth/2,e=Math.min(this.w.layout.gridWidth,this.w.layout.gridHeight)/2;s.querySelectorAll(".apexcharts-radial-series .apexcharts-radialbar-area").forEach(s=>{var a;const o=s.parentElement,r=parseInt(null!=(a=null==o?void 0:o.getAttribute("data:realIndex"))?a:"0",10),n=s.getAttribute("d");if(!n)return;const l=parseFloat(s.getAttribute("stroke-width")||"0"),h=l>1&&this._radialArcToFilledSegment(n,l,t,e)||n;i.push({realIndex:r,j:0,d:h,fill:s.getAttribute("stroke")})})}else{s.querySelectorAll(".apexcharts-pie-series .apexcharts-pie-area").forEach((t,e)=>{const s=t.getAttribute("d");s&&i.push({realIndex:e,j:0,d:s,fill:t.getAttribute("fill")})})}return i}_radialArcToFilledSegment(t,e,s,i){const a=t.match(/M\s*(-?[\d.]+)\s+(-?[\d.]+)\s+A\s*(-?[\d.]+)\s+(?:-?[\d.]+)\s+(?:-?[\d.]+)\s+(\d)\s+(\d)\s+(-?[\d.]+)\s+(-?[\d.]+)/);if(!a)return null;const o=parseFloat(a[1]),r=parseFloat(a[2]),n=parseFloat(a[3]),l=parseInt(a[4],10),h=parseInt(a[5],10),c=parseFloat(a[6]),d=parseFloat(a[7]);if(!isFinite(n)||n<=0)return null;const g=e/2,p=n+g,u=Math.max(0,n-g),x=(t,e,a)=>{const o=t-s,r=e-i,n=Math.sqrt(o*o+r*r);if(0===n)return{x:s,y:i};const l=a/n;return{x:s+o*l,y:i+r*l}},f=x(o,r,p),b=x(c,d,p),m=x(o,r,u),y=x(c,d,u),w=h?0:1;return`M ${f.x} ${f.y} A ${p} ${p} 0 ${l} ${h} ${b.x} ${b.y} L ${y.x} ${y.y} A ${u} ${u} 0 ${l} ${w} ${m.x} ${m.y} Z`}buildRingSegmentPath(t,e,s,i,a,o){const r=i/2,n=s+r,l=Math.max(0,s-r),h=(a-90)*Math.PI/180,c=(o-90)*Math.PI/180,d=t+n*Math.cos(h),g=e+n*Math.sin(h),p=t+n*Math.cos(c),u=e+n*Math.sin(c),x=t+l*Math.cos(h),f=e+l*Math.sin(h),b=t+l*Math.cos(c),m=e+l*Math.sin(c),y=o>a?1:0,w=Math.abs(o-a)>180?1:0;return`M ${d} ${g} A ${n} ${n} 0 ${w} ${y} ${p} ${u} L ${b} ${m} A ${l} ${l} 0 ${w} ${1-y} ${x} ${f} Z`}getFromType(){return this._snapshot?this._snapshot.fromType:null}_buildMapping(t,e,s,i){const a=new Map,o=Fe(s),r=t.slice().sort((t,e)=>t.realIndex-e.realIndex||t.j-e.j);if("radial"===o)return r.forEach((t,e)=>{a.set(`${e}:0`,{d:t.d,fill:t.fill})}),a;if("bar"===o){const t=[];return(Array.isArray(i)?i:[]).forEach((e,s)=>{const i=e&&Array.isArray(e.data)?e.data:[];for(let e=0;e<i.length;e++)t.push({realIndex:s,j:e})}),r.forEach((e,s)=>{const i=t[s];i&&a.set(`${i.realIndex}:${i.j}`,{d:e.d,fill:e.fill})}),a}return a}isActive(){return null!==this._snapshot}getInitialPathFor(t,e){if(!this._snapshot)return null;const s=this._snapshot.mapping.get(`${t}:${e}`);if(!s)return null;const i=this._snapshot.oldLayout.translateX-(this.w.layout.translateX||0),a=this._snapshot.oldLayout.translateY-(this.w.layout.translateY||0);return 0===i&&0===a?s.d:this._translatePathD(s.d,i,a)}_translatePathD(t,e,s){if(0===e&&0===s)return t;return Jt(t).map(t=>{const i=t[0];return"Z"===i?"Z":"M"===i||"L"===i||"T"===i?`${i} ${t[1]+e} ${t[2]+s}`:"H"===i?`${i} ${t[1]+e}`:"V"===i?`${i} ${t[1]+s}`:"C"===i?`${i} ${t[1]+e} ${t[2]+s} ${t[3]+e} ${t[4]+s} ${t[5]+e} ${t[6]+s}`:"S"===i||"Q"===i?`${i} ${t[1]+e} ${t[2]+s} ${t[3]+e} ${t[4]+s}`:"A"===i?`${i} ${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]+e} ${t[7]+s}`:t.join(" ")}).join(" ")}getInitialFillFor(t,e){if(!this._snapshot)return null;const s=this._snapshot.mapping.get(`${t}:${e}`);return s?s.fill:null}getSpeed(){const t=this.w.config.chart.animations;return t.chartTypeMorph&&t.chartTypeMorph.speed||t.speed||600}applyChromeFade(){var t;if(!this._snapshot||!c.isBrowser())return;const e=null==(t=this.w.globals.dom)?void 0:t.baseEl;if(!e)return;const s=this.getSpeed();[".apexcharts-xaxis",".apexcharts-yaxis",".apexcharts-grid",".apexcharts-gridlines-horizontal",".apexcharts-gridlines-vertical",".apexcharts-legend",".apexcharts-title-text",".apexcharts-subtitle-text"].forEach(t=>{e.querySelectorAll(t).forEach(t=>{t.style&&(t.style.opacity="0",t.style.transition=`opacity ${s}ms ease-out`,b.requestAnimationFrame(()=>{t.style.opacity="1"}),setTimeout(()=>{t.style.transition="",t.style.opacity=""},s+80))})}),setTimeout(()=>this.cleanup(),s+100)}cleanup(){this._snapshot=null}}});class Ee{constructor(t){this.w=t.w,this.barCtx=t,this.totalFormatter=this.w.config.plotOptions.bar.dataLabels.total.formatter,this.totalFormatter||(this.totalFormatter=this.w.config.dataLabels.formatter)}handleBarDataLabels(t){const{x:e,y:s,y1:i,y2:a,i:o,j:r,realIndex:h,columnGroupIndex:c,series:d,barHeight:g,barWidth:p,barXPosition:u,barYPosition:x,visibleSeries:f}=t,b=this.w,m=new N(this.barCtx.w),y=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[h]:this.barCtx.strokeWidth;let w,v;b.axisFlags.isXNumeric&&!b.globals.isBarHorizontal?(w=e+p*(f+1),v=s+g*(f+1)-y):(w=e+p*f,v=s+g*f);let A=null,C=null,S=e,k=s,D={};const L=b.config.dataLabels,M=this.barCtx.barOptions.dataLabels,P=this.barCtx.barOptions.dataLabels.total;void 0!==x&&(this.barCtx.isRangeBar||this.barCtx.isPyramid)&&(v=x,k=x),void 0!==u&&this.barCtx.isVerticalGroupedRangeBar&&(w=u,S=u);const T=L.offsetX,F=L.offsetY;let E={width:0,height:0};if(b.config.dataLabels.enabled){const t=b.seriesData.series[o][r];E=m.getTextRects(b.config.dataLabels.formatter?b.config.dataLabels.formatter(t,l(n({},b),{seriesIndex:o,dataPointIndex:r,w:b})):b.formatters.yLabelFormatters[0](t),parseFloat(L.style.fontSize).toString())}const I={x:e,y:s,i:o,j:r,realIndex:h,columnGroupIndex:c,bcx:w,bcy:v,barHeight:g,barWidth:p,textRects:E,strokeWidth:y,dataLabelsX:S,dataLabelsY:k,dataLabelsConfig:L,barDataLabelsConfig:M,barTotalDataLabelsConfig:P,offX:T,offY:F};return D=this.barCtx.isHorizontal?this.calculateBarsDataLabelsPosition(I):this.calculateColumnsDataLabelsPosition(I),A=this.drawCalculatedDataLabels({x:D.dataLabelsX,y:D.dataLabelsY,val:this.barCtx.isRangeBar?[i,a]:"100%"===b.config.chart.stackType?d[h][r]:b.seriesData.series[h][r],i:h,j:r,barWidth:p,barHeight:g,textRects:E,dataLabelsConfig:L}),b.config.chart.stacked&&P.enabled&&(C=this.drawTotalDataLabels({x:D.totalDataLabelsX,y:D.totalDataLabelsY,barWidth:p,barHeight:g,realIndex:h,textAnchor:D.totalDataLabelsAnchor,val:this.getStackedTotalDataLabel({realIndex:h,j:r}),dataLabelsConfig:L,barTotalDataLabelsConfig:P})),{dataLabelsPos:D,dataLabels:A,totalDataLabels:C}}getStackedTotalDataLabel({realIndex:t,j:e}){const s=this.w;let i=this.barCtx.stackedSeriesTotals[e];return this.totalFormatter&&(i=this.totalFormatter(i,l(n({},s),{seriesIndex:t,dataPointIndex:e,w:s}))),i}calculateColumnsDataLabelsPosition(t){const e=this.w;let s,i,{i:a,j:o,realIndex:r,y:n,bcx:l,barWidth:h,barHeight:c,textRects:d,dataLabelsX:g,dataLabelsY:p,dataLabelsConfig:u,barDataLabelsConfig:x,barTotalDataLabelsConfig:f,strokeWidth:b,offX:m,offY:y}=t;const w=l;c=Math.abs(c);const v="vertical"===e.config.plotOptions.bar.dataLabels.orientation,{zeroEncounters:A}=this.barCtx.barHelpers.getZeroValueEncounters({i:a,j:o});l-=b/2;const C=e.layout.gridWidth/e.globals.dataPoints;if(this.barCtx.isVerticalGroupedRangeBar?g+=h/2:(g=e.axisFlags.isXNumeric?l-h/2+m:l-C+h/2+m,!e.config.chart.stacked&&A>0&&e.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(g-=h*A)),v){const t=2;g=g+d.height/2-b/2-t}const S=e.seriesData.series[a][o]<0;let k=n;switch(this.barCtx.isReversed&&(k=n+(S?c:-c)),x.position){case"center":p=v?S?k-c/2+y:k+c/2-y:S?k-c/2+d.height/2+y:k+c/2+d.height/2-y;break;case"bottom":p=v?S?k-c+y:k+c-y:S?k-c+d.height+b+y:k+c-d.height/2+b-y;break;case"top":p=v?S?k+y:k-y:S?k-d.height/2-y:k+d.height+y}let D=k;if(e.labelData.seriesGroups.forEach(t=>{var e;null==(e=this.barCtx[t.join(",")])||e.prevY.forEach(t=>{D=S?Math.max(t[o],D):Math.min(t[o],D)})}),this.barCtx.lastActiveBarSerieIndex===r&&f.enabled){const t=18,a=new N(this.barCtx.w).getTextRects(this.getStackedTotalDataLabel({realIndex:r,j:o}),u.fontSize);s=S?D-a.height/2-y-f.offsetY+t:D+a.height+y+f.offsetY-t;const n=C;i=w+(e.axisFlags.isXNumeric?-h*e.globals.barGroups.length/2:e.globals.barGroups.length*h/2-(e.globals.barGroups.length-1)*h-n)+f.offsetX}return e.config.chart.stacked||(p<0?p=0+b:p+d.height/3>e.layout.gridHeight&&(p=e.layout.gridHeight-b)),{bcx:l,bcy:n,dataLabelsX:g,dataLabelsY:p,totalDataLabelsX:i,totalDataLabelsY:s,totalDataLabelsAnchor:"middle"}}calculateBarsDataLabelsPosition(t){var e;const s=this.w;let{x:i,i:a,j:o,realIndex:r,bcy:n,barHeight:l,barWidth:h,textRects:c,dataLabelsX:d,strokeWidth:g,dataLabelsConfig:p,barDataLabelsConfig:u,barTotalDataLabelsConfig:x,offX:f,offY:b}=t;const m=s.layout.gridHeight/s.globals.dataPoints,{zeroEncounters:y}=this.barCtx.barHelpers.getZeroValueEncounters({i:a,j:o});let w,v,A;if(h=Math.abs(h),this.barCtx.isPyramid){w=n+l/2+b-(null!=(e=c.centerOffset)?e:0)}else w=n-(this.barCtx.isRangeBar?0:m)+l/2+c.height/2+b-3;!s.config.chart.stacked&&y>0&&s.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(w-=l*y);let C="start";const S=s.seriesData.series[a][o]<0;let k=i;if(this.barCtx.isReversed&&(k=i+(S?-h:h),C=S?"start":"end"),this.barCtx.isPyramid)d=s.layout.gridWidth/2+f;else switch(u.position){case"center":d=S?k+h/2-f:Math.max(c.width/2,k-h/2)+f;break;case"bottom":d=S?k+h-g-f:k-h+g+f;break;case"top":d=S?k-g-f:k-g+f}let D=k;if(s.labelData.seriesGroups.forEach(t=>{var e;null==(e=this.barCtx[t.join(",")])||e.prevX.forEach(t=>{D=S?Math.min(t[o],D):Math.max(t[o],D)})}),this.barCtx.lastActiveBarSerieIndex===r&&x.enabled){const t=new N(this.barCtx.w).getTextRects(this.getStackedTotalDataLabel({realIndex:r,j:o}),p.fontSize);S?(v=D-g-f-x.offsetX,C="end"):v=D+f+x.offsetX+(this.barCtx.isReversed?-(h+g):g),A=w-c.height/2+t.height/2+x.offsetY+g,s.globals.barGroups.length>1&&(A-=s.globals.barGroups.length/2*(l/2))}return s.config.chart.stacked||("start"===p.textAnchor?d-c.width<0?d=S?c.width+g:g:d+c.width>s.layout.gridWidth&&(d=S?s.layout.gridWidth-g:s.layout.gridWidth-c.width-g):"middle"===p.textAnchor?d-c.width/2<0?d=c.width/2+g:d+c.width/2>s.layout.gridWidth&&(d=s.layout.gridWidth-c.width/2-g):"end"===p.textAnchor&&(d<1?d=c.width+g:d+1>s.layout.gridWidth&&(d=s.layout.gridWidth-c.width-g))),{bcx:i,bcy:n,dataLabelsX:d,dataLabelsY:w,totalDataLabelsX:v,totalDataLabelsY:A,totalDataLabelsAnchor:C}}drawCalculatedDataLabels({x:t,y:e,val:s,i:i,j:a,textRects:o,barHeight:r,barWidth:h,dataLabelsConfig:c}){const d=this.w;let g="rotate(0)";"vertical"===d.config.plotOptions.bar.dataLabels.orientation&&(g=`rotate(-90, ${t}, ${e})`);const p=new U(this.barCtx.w,this.barCtx.ctx),u=new N(this.barCtx.w),x=c.formatter;let f=null;const b=d.globals.collapsedSeriesIndices.indexOf(i)>-1;if(c.enabled&&!b){f=u.group({class:"apexcharts-data-labels",transform:g});let b="";void 0!==s&&(b=x(s,l(n({},d),{seriesIndex:i,dataPointIndex:a,w:d}))),!s&&d.config.plotOptions.bar.hideZeroBarsWhenGrouped&&(b="");const m=d.seriesData.series[i][a]<0,y=d.config.plotOptions.bar.dataLabels.position;if("vertical"===d.config.plotOptions.bar.dataLabels.orientation&&("top"===y&&(c.textAnchor=m?"end":"start"),"center"===y&&(c.textAnchor="middle"),"bottom"===y&&(c.textAnchor=m?"end":"start")),this.barCtx.isRangeBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels){h<u.getTextRects(b,parseFloat(c.style.fontSize).toString()).width&&(b="")}d.config.chart.stacked&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&(this.barCtx.isHorizontal?o.width/1.6>Math.abs(h)&&(b=""):o.height/1.6>Math.abs(r)&&(b=""));const w=n({},c);this.barCtx.isHorizontal&&s<0&&("start"===c.textAnchor?w.textAnchor="end":"end"===c.textAnchor&&(w.textAnchor="start")),p.plotDataLabelsText({x:t,y:e,text:b,i:i,j:a,parent:f,dataLabelsConfig:w,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return f}drawTotalDataLabels({x:t,y:e,val:s,realIndex:i,textAnchor:a,barTotalDataLabelsConfig:o}){const r=new N(this.barCtx.w);let n;return o.enabled&&void 0!==t&&void 0!==e&&this.barCtx.lastActiveBarSerieIndex===i&&(n=r.drawText({x:t,y:e,foreColor:o.style.color,text:s,textAnchor:a,fontFamily:o.style.fontFamily,fontSize:o.style.fontSize,fontWeight:o.style.fontWeight})),n}}let Ie=class{constructor(t){this.w=t.w,this.barCtx=t}initVariables(t){const e=this.w;this.barCtx.series=t,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(let s=0;s<t.length;s++)if(t[s].length>0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[s].length),e.axisFlags.isXNumeric)for(let i=0;i<t[s].length;i++)e.seriesData.seriesX[s][i]>e.globals.minX&&e.seriesData.seriesX[s][i]<e.globals.maxX&&this.barCtx.visibleItems++;else this.barCtx.visibleItems=e.globals.dataPoints;this.arrBorderRadius=this.createBorderRadiusArr(e.seriesData.series),m.isSafari()&&(this.arrBorderRadius=this.arrBorderRadius.map(t=>t.map(t=>"none"))),0===this.barCtx.seriesLen&&(this.barCtx.seriesLen=1),this.barCtx.zeroSerieses=[],e.globals.comboCharts||this.checkZeroSeries({series:t})}initialPositions(t){const e=this.w;let s,i,a,o,r,n,l,h,c=e.globals.dataPoints;this.barCtx.isRangeBar&&(c=e.labelData.labels.length);let d=this.barCtx.seriesLen;if(e.config.plotOptions.bar.rangeBarGroupRows&&(d=1),this.barCtx.isHorizontal)a=e.layout.gridHeight/c,r=a/d,e.axisFlags.isXNumeric&&(a=e.layout.gridHeight/this.barCtx.totalItems,r=a/this.barCtx.seriesLen),r=r*parseInt(this.barCtx.barOptions.barHeight,10)/100,-1===String(this.barCtx.barOptions.barHeight).indexOf("%")&&(r=parseInt(this.barCtx.barOptions.barHeight,10)),h=this.barCtx.baseLineInvertedY+e.globals.padHorizontal+(this.barCtx.isReversed?e.layout.gridWidth:0)-(this.barCtx.isReversed?2*this.barCtx.baseLineInvertedY:0),this.barCtx.isFunnel&&(h=e.layout.gridWidth/2),i=(a-r*this.barCtx.seriesLen)/2;else{if(o=e.layout.gridWidth/this.barCtx.visibleItems,e.config.xaxis.convertedCatToNumeric&&(o=e.layout.gridWidth/e.globals.dataPoints),n=o/d*parseInt(this.barCtx.barOptions.columnWidth,10)/100,e.axisFlags.isXNumeric){const t=this.barCtx.xRatio;e.globals.minXDiff&&.5!==e.globals.minXDiff&&e.globals.minXDiff/t>0&&(o=e.globals.minXDiff/t),n=o/d*parseInt(this.barCtx.barOptions.columnWidth,10)/100,n<1&&(n=1)}if(-1===String(this.barCtx.barOptions.columnWidth).indexOf("%")&&(n=parseInt(this.barCtx.barOptions.columnWidth,10)),l=e.layout.gridHeight-this.barCtx.baseLineY[this.barCtx.translationsIndex]-(this.barCtx.isReversed?e.layout.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.translationsIndex]:0),e.axisFlags.isXNumeric){s=this.barCtx.getBarXForNumericXAxis({x:s,j:0,realIndex:t,barWidth:n}).x}else s=e.globals.padHorizontal+m.noExponents(o-n*this.barCtx.seriesLen)/2}return e.globals.barHeight=r,e.globals.barWidth=n,{x:s,y:i,yDivision:a,xDivision:o,barHeight:r,barWidth:n,zeroH:l,zeroW:h}}initializeStackedPrevVars(t){t.w.labelData.seriesGroups.forEach(e=>{t[e]||(t[e]={}),t[e].prevY=[],t[e].prevX=[],t[e].prevYF=[],t[e].prevXF=[],t[e].prevYVal=[],t[e].prevXVal=[]})}initializeStackedXYVars(t){t.w.labelData.seriesGroups.forEach(e=>{t[e]||(t[e]={}),t[e].xArrj=[],t[e].xArrjF=[],t[e].xArrjVal=[],t[e].yArrj=[],t[e].yArrjF=[],t[e].yArrjVal=[]})}getPathFillColor(t,e,s,i){var a,o,r,n;const l=this.w,h=new G(this.barCtx.w);let c=null;const d=this.barCtx.barOptions.distributed?s:e;let g=!1;if(this.barCtx.barOptions.colors.ranges.length>0){this.barCtx.barOptions.colors.ranges.map(i=>{t[e][s]>=i.from&&t[e][s]<=i.to&&(c=i.color,g=!0)})}return{color:h.fillPath({seriesNumber:this.barCtx.barOptions.distributed?d:i,dataPointIndex:s,color:c,value:t[e][s],fillConfig:null==(a=l.config.series[e].data[s])?void 0:a.fill,fillType:(null==(r=null==(o=l.config.series[e].data[s])?void 0:o.fill)?void 0:r.type)?null==(n=l.config.series[e].data[s])?void 0:n.fill.type:Array.isArray(l.config.fill.type)?l.config.fill.type[i]:l.config.fill.type}),useRangeColor:g}}getStrokeWidth(t,e,s){let i=0;const a=this.w;return void 0===this.barCtx.series[t][e]||null===this.barCtx.series[t][e]||"bar"===a.config.chart.type&&!this.barCtx.series[t][e]?this.barCtx.isNullValue=!0:this.barCtx.isNullValue=!1,a.config.stroke.show&&(this.barCtx.isNullValue||(i=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[s]:this.barCtx.strokeWidth)),i}createBorderRadiusArr(t){var e;const s=this.w,i=!this.w.config.chart.stacked||s.config.plotOptions.bar.borderRadius<=0,a=t.length,o=0|(null==(e=t[0])?void 0:e.length),r=Array.from({length:a},()=>Array(o).fill(i?"top":"none"));if(i)return r;const n=this.w.config.chart.type;for(let e=0;e<o;e++){const s=[],i=[];let l=0;for(let o=0;o<a;o++){const a=t[o][e];a>0?(s.push(o),l++):a<0&&(i.push(o),l++)}if(s.length>0&&0===i.length)if(1===s.length)r[s[0]][e]="bar"===n&&1===o?"top":"both";else{const t=s[0],i=s[s.length-1];for(const a of s)r[a][e]=a===t?"bar"===n&&1===o?"top":"bottom":a===i?"top":"none"}else if(i.length>0&&0===s.length)if(1===i.length)r[i[0]][e]="both";else{const t=Math.max(...i),s=Math.min(...i);for(const a of i)r[a][e]=a===t?"bottom":a===s?"top":"none"}else if(s.length>0&&i.length>0){const t=s[s.length-1];for(const i of s)r[i][e]=i===t?"top":"none";const a=Math.max(...i);for(const t of i)r[t][e]=t===a?"bottom":"none"}else if(1===l){r[s[0]||i[0]][e]="both"}}return r}barBackground({j:t,i:e,x1:s,x2:i,y1:a,y2:o,elSeries:r}){const n=this.w,l=new N(this.barCtx.w),h=new lt(this.barCtx.w).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&h===e){t>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(t%=this.barCtx.barOptions.colors.backgroundBarColors.length);const e=this.barCtx.barOptions.colors.backgroundBarColors[t],h=l.drawRect(void 0!==s?s:0,void 0!==a?a:0,void 0!==i?i:n.layout.gridWidth,void 0!==o?o:n.layout.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,e,this.barCtx.barOptions.colors.backgroundBarOpacity);r.add(h),h.node.classList.add("apexcharts-backgroundBar")}}getColumnPaths({barWidth:t,barXPosition:e,y1:s,y2:i,strokeWidth:a,isReversed:o,series:r,seriesGroup:n,realIndex:l,i:h,j:c,w:d}){var g,p,u;const x=new N(this.barCtx.w);(a=Array.isArray(a)?a[l]:a)||(a=0);let f=t,b=e;(null==(g=d.config.series[l].data[c])?void 0:g.columnWidthOffset)&&(b=e-d.config.series[l].data[c].columnWidthOffset/2,f=t+d.config.series[l].data[c].columnWidthOffset);const m=a/2,y=b+m,w=b+f-m,v=(r[h][c]>=0?1:-1)*(o?-1:1);s+=.001-m*v,i+=.001+m*v;const A=x.line(w,s),C="around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[l][c]?" Z":" z";let S,k=x.move(y,s)+x.line(y,i)+x.line(w,i)+A+C;"none"!==this.arrBorderRadius[l][c]&&(k=x.roundPathCorners(k,d.config.plotOptions.bar.borderRadius));const D=null==(u=null==(p=this.barCtx.ctx)?void 0:p.morphTypeChange)?void 0:u.getInitialPathFor(l,c);if(S=D||(d.globals.previousPaths.length>0?this.barCtx.getPreviousPath(l,c,k):x.move(y,s)+x.line(y,s)+A+A+A+A+A+x.line(y,s)+C),d.config.chart.stacked){let t=this.barCtx;t=this.barCtx[n],t.yArrj.push(i-m*v),t.yArrjF.push(Math.abs(s-i+a*v)),t.yArrjVal.push(this.barCtx.series[h][c])}return{pathTo:k,pathFrom:S}}getFunnelTrapezoidPaths({barYPosition:t,barHeight:e,series:s,i:i,j:a,realIndex:o,strokeWidth:r,w:n}){var l,h;const c=new N(this.barCtx.w),d=n.layout.gridWidth/2,g=t=>Math.abs(t/this.barCtx.invertedYRatio)/2,p=g(s[i][a]),u=a===s[i].length-1,x="taper"===n.config.plotOptions.funnel.lastShape?"taper":"flat";let f;f=u?"taper"===x?0:p:g(s[i][a+1]);const b=r/2,m=t+b,y=t+e-b,w=d-p,v=d+p,A=d-f,C=d+f,S=c.move(w,m)+c.line(v,m)+c.line(C,y)+c.line(A,y)+" Z";let k;const D=null==(h=null==(l=this.barCtx.ctx)?void 0:l.morphTypeChange)?void 0:h.getInitialPathFor(o,a);return k=D||(n.globals.previousPaths.length>0?this.barCtx.getPreviousPath(o,a,S):c.move(d,m)+c.line(d,m)+c.line(d,y)+c.line(d,y)+" Z"),{pathTo:S,pathFrom:k,x:v,x1:w,barXPosition:d}}computePyramidLayout(t){const e=this.w,s=e.layout.gridHeight,i=e.layout.gridWidth,a=t.map(t=>Math.abs(Number(t)||0)),o=a.reduce((t,e)=>t+e,0);if(0===o||s<=0)return a.map(()=>({y:0,height:0,topHalf:0,bottomHalf:0}));const r=i/2;let n=0;const l=[];for(let t=0;t<a.length;t++){const e=n/o;n+=a[t];const i=n/o,h=e*s,c=i*s;l.push({y:h,height:c-h,topHalf:e*r,bottomHalf:i*r})}return l}getPyramidPaths({barYPosition:t,barHeight:e,topHalf:s,bottomHalf:i,realIndex:a,j:o,strokeWidth:r,w:n}){var l,h;const c=new N(this.barCtx.w),d=n.layout.gridWidth/2,g=r/2,p=t+g,u=t+e-g,x=d-s,f=d+s,b=d-i,m=d+i,y=c.move(x,p)+c.line(f,p)+c.line(m,u)+c.line(b,u)+" Z";let w;const v=null==(h=null==(l=this.barCtx.ctx)?void 0:l.morphTypeChange)?void 0:h.getInitialPathFor(a,o);return w=v||(n.globals.previousPaths.length>0?this.barCtx.getPreviousPath(a,o,y):c.move(d,p)+c.line(d,p)+c.line(d,u)+c.line(d,u)+" Z"),{pathTo:y,pathFrom:w,x:f,x1:x,barXPosition:d}}getBarpaths({barYPosition:t,barHeight:e,x1:s,x2:i,strokeWidth:a,isReversed:o,series:r,seriesGroup:n,realIndex:l,i:h,j:c,w:d}){var g,p,u;const x=new N(this.barCtx.w);(a=Array.isArray(a)?a[l]:a)||(a=0);let f=t,b=e;(null==(g=d.config.series[l].data[c])?void 0:g.barHeightOffset)&&(f=t-d.config.series[l].data[c].barHeightOffset/2,b=e+d.config.series[l].data[c].barHeightOffset);const m=a/2,y=f+m,w=f+b-m,v=(r[h][c]>=0?1:-1)*(o?-1:1);s+=.001+m*v,i+=.001-m*v;const A=this.barCtx.isFunnel,C=A?(s+i)/2:s,S=x.line(s,w),k="around"===d.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[l][c]?" Z":" z";let D,L=x.move(s,y)+x.line(i,y)+x.line(i,w)+S+k;"none"!==this.arrBorderRadius[l][c]&&(L=x.roundPathCorners(L,d.config.plotOptions.bar.borderRadius));const M=null==(u=null==(p=this.barCtx.ctx)?void 0:p.morphTypeChange)?void 0:u.getInitialPathFor(l,c);if(M)D=M;else if(d.globals.previousPaths.length>0)D=this.barCtx.getPreviousPath(l,c,L);else{const t=A?x.line(C,w):S;D=x.move(C,y)+x.line(C,y)+t+t+t+t+t+x.line(C,y)+k}if(d.config.chart.stacked){let t=this.barCtx;t=this.barCtx[n],t.xArrj.push(i+m*v),t.xArrjF.push(Math.abs(s-i-a*v)),t.xArrjVal.push(this.barCtx.series[h][c])}return{pathTo:L,pathFrom:D}}checkZeroSeries({series:t}){const e=this.w;for(let s=0;s<t.length;s++){let i=0;for(let a=0;a<t[e.globals.maxValsInArrayIndex].length;a++)i+=t[s][a];0===i&&this.barCtx.zeroSerieses.push(s)}}getXForValue(t,e,s=!0){let i=s?e:null;return null!=t&&(i=e+t/this.barCtx.invertedYRatio-2*(this.barCtx.isReversed?t/this.barCtx.invertedYRatio:0)),i}getYForValue(t,e,s,i=!0){let a=i?e:null;return null!=t&&(a=e-t/this.barCtx.yRatio[s]+2*(this.barCtx.isReversed?t/this.barCtx.yRatio[s]:0)),a}getGoalValues(t,e,s,i,a,o){const r=this.w,h=[],c=(i,a)=>{h.push({[t]:"x"===t?this.getXForValue(i,e,!1):this.getYForValue(i,s,o,!1),attrs:a})};if(r.seriesData.seriesGoals[i]&&r.seriesData.seriesGoals[i][a]&&Array.isArray(r.seriesData.seriesGoals[i][a])&&r.seriesData.seriesGoals[i][a].forEach(t=>{c(t.value,t)}),this.barCtx.barOptions.isDumbbell&&r.rangeData.seriesRange.length){const e=this.barCtx.barOptions.dumbbellColors?this.barCtx.barOptions.dumbbellColors:r.globals.colors,s={strokeHeight:"x"===t?0:r.globals.markers.size[i],strokeWidth:"x"===t?r.globals.markers.size[i]:0,strokeDashArray:0,strokeLineCap:"round",strokeColor:Array.isArray(e[i])?e[i][0]:e[i]};c(r.rangeData.seriesRangeStart[i][a],s),c(r.rangeData.seriesRangeEnd[i][a],l(n({},s),{strokeColor:Array.isArray(e[i])?e[i][1]:e[i]}))}return h}drawGoalLine({barXPosition:t,barYPosition:e,goalX:s,goalY:i,barWidth:a,barHeight:o}){const r=new N(this.barCtx.w),n=r.group({className:"apexcharts-bar-goals-groups"});n.node.classList.add("apexcharts-element-hidden"),this.barCtx.w.globals.delayedElements.push({el:n.node}),n.attr("clip-path",`url(#gridRectMarkerMask${this.barCtx.w.globals.cuid})`);let l=null;return this.barCtx.isHorizontal?Array.isArray(s)&&s.forEach(t=>{if(t.x>=-1&&t.x<=r.w.layout.gridWidth+1){const s=void 0!==t.attrs.strokeHeight?t.attrs.strokeHeight:o/2,i=e+s+o/2;l=r.drawLine(t.x,i-2*s,t.x,i,t.attrs.strokeColor?t.attrs.strokeColor:void 0,t.attrs.strokeDashArray,t.attrs.strokeWidth?t.attrs.strokeWidth:2,t.attrs.strokeLineCap),n.add(l)}}):Array.isArray(i)&&i.forEach(e=>{if(e.y>=-1&&e.y<=r.w.layout.gridHeight+1){const s=void 0!==e.attrs.strokeWidth?e.attrs.strokeWidth:a/2,i=t+s+a/2;l=r.drawLine(i-2*s,e.y,i,e.y,e.attrs.strokeColor?e.attrs.strokeColor:void 0,e.attrs.strokeDashArray,e.attrs.strokeHeight?e.attrs.strokeHeight:2,e.attrs.strokeLineCap),n.add(l)}}),n}drawBarShadow({prevPaths:t,currPaths:e,color:s,realIndex:i,j:a}){const o=this.w,{x:r,x1:n,barYPosition:l}=t,{x:h,x1:c,barYPosition:d}=e,g=l+e.barHeight,p=new N(this.barCtx.w),u=new m,x=p.move(n,g)+p.line(r,g)+p.line(h,d)+p.line(c,d)+p.line(n,g)+("around"===o.config.plotOptions.bar.borderRadiusApplication||"both"===this.arrBorderRadius[i][a]?" Z":" z");return p.drawPath({d:x,fill:u.shadeColor(.5,m.rgb2hex(s)),stroke:"none",strokeWidth:0,fillOpacity:1,classes:"apexcharts-bar-shadow apexcharts-decoration-element"})}getZeroValueEncounters({i:t,j:e}){var s;const i=this.w;let a=0,o=0;return(i.config.plotOptions.bar.horizontal?i.seriesData.series.map((t,e)=>e):(null==(s=i.globals.columnSeries)?void 0:s.i.map(t=>t))||[]).forEach(s=>{const r=i.globals.seriesPercent[s][e];r&&a++,s<t&&0===r&&o++}),{nonZeroColumns:a,zeroEncounters:o}}getGroupIndex(t){const e=this.w,s=e.labelData.seriesGroups.findIndex(s=>s.indexOf(e.seriesData.seriesNames[t])>-1),i=this.barCtx.columnGroupIndices;let a=i.indexOf(s);return a<0&&(i.push(s),a=i.length-1),{groupIndex:s,columnGroupIndex:a}}};class Xe{constructor(t,e,s){this.ctx=e,this.w=t,this.barOptions=t.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=t.config.stroke.width,this.isNullValue=!1,this.isRangeBar=t.rangeData.seriesRange.length&&this.isHorizontal,this.isVerticalGroupedRangeBar=!t.globals.isBarHorizontal&&t.rangeData.seriesRange.length&&t.config.plotOptions.bar.rangeBarGroupRows,this.isFunnel=this.barOptions.isFunnel,this.isPyramid=this.barOptions.isPyramid,this.pyramidLayout=null,this.xyRatios=s,this.xRatio=0,this.yRatio=[],this.invertedXRatio=0,this.invertedYRatio=0,this.baseLineY=[],this.baseLineInvertedY=0,null!==this.xyRatios&&(this.xRatio=s.xRatio,this.yRatio=s.yRatio,this.invertedXRatio=s.invertedXRatio,this.invertedYRatio=s.invertedYRatio,this.baseLineY=s.baseLineY,this.baseLineInvertedY=s.baseLineInvertedY),this.yaxisIndex=0,this.translationsIndex=0,this.seriesLen=0,this.pathArr=[],this.series=[],this.elSeries=null,this.visibleI=0,this.isReversed=!1;const i=new lt(this.w);this.lastActiveBarSerieIndex=i.getActiveConfigSeriesIndex("desc",["bar","column"]),this.columnGroupIndices=[];const a=i.getBarSeriesIndices(),o=new F(this.w);this.stackedSeriesTotals=o.getStackedSeriesTotals(this.w.config.series.map((t,e)=>-1===a.indexOf(e)?e:-1).filter(t=>-1!==t)),this.barHelpers=new Ie(this)}draw(t,e){var s,i;const a=this.w,o=new N(this.w),r=new F(this.w);t=r.getLogSeries(t),this.series=t,this.yRatio=r.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);const h=o.group({class:"apexcharts-bar-series apexcharts-plot-series"});a.config.dataLabels.enabled&&(this.totalItems,this.barOptions.dataLabels.maxItems);for(let r=0,c=0;r<t.length;r++,c++){let d,g;const p=[],u=[],x=a.globals.comboCharts?e[r]:r,{columnGroupIndex:f}=this.barHelpers.getGroupIndex(x),b=o.group({class:"apexcharts-series",rel:r+1,seriesName:m.escapeString(a.seriesData.seriesNames[x]),"data:realIndex":x});lt.addCollapsedClassToSeries(this.w,b,x),t[r].length>0&&(this.visibleI=this.visibleI+1),this.yRatio.length>1&&(this.yaxisIndex=a.globals.seriesYAxisReverseMap[x],this.translationsIndex=x);const y=this.translationsIndex;this.isReversed=a.config.yaxis[this.yaxisIndex]&&a.config.yaxis[this.yaxisIndex].reversed,this.isPyramid&&(this.pyramidLayout=this.barHelpers.computePyramidLayout(t[r]));const w=this.barHelpers.initialPositions(x),{y:v,yDivision:A,zeroW:C,x:S,xDivision:k,zeroH:D}=w;let L=w.barHeight,M=w.barWidth;g=v,d=S,this.isHorizontal||u.push(d+(null!=M?M:0)/2);const P=o.group({class:"apexcharts-datalabels","data:realIndex":x});a.globals.delayedElements.push({el:P.node}),P.node.classList.add("apexcharts-element-hidden");const T=o.group({class:"apexcharts-bar-goals-markers"}),F=o.group({class:"apexcharts-bar-shadows"});a.globals.delayedElements.push({el:F.node}),F.node.classList.add("apexcharts-element-hidden");for(let e=0;e<t[r].length;e++){const o=this.barHelpers.getStrokeWidth(r,e,x);let h=null;const w={indexes:{i:r,j:e,realIndex:x,translationsIndex:y,bc:c},x:d,y:g,strokeWidth:o,elSeries:b};this.isHorizontal?(h=this.drawBarPaths(l(n({},w),{barHeight:L,zeroW:C,yDivision:A})),M=this.series[r][e]/this.invertedYRatio):(h=this.drawColumnPaths(l(n({},w),{xDivision:k,barWidth:M,zeroH:D})),L=this.series[r][e]/this.yRatio[y]);const v=this.barHelpers.getPathFillColor(t,r,e,x);if(this.isFunnel&&!this.isPyramid&&this.barOptions.isFunnel3d&&"trapezoid"!==(null==(s=a.config.plotOptions.funnel)?void 0:s.shape)&&this.pathArr.length&&e>0){const t=this.barHelpers.drawBarShadow({color:"string"==typeof v.color&&-1===(null==(i=v.color)?void 0:i.indexOf("url"))?v.color:m.hexToRgba(a.globals.colors[r]),prevPaths:this.pathArr[this.pathArr.length-1],currPaths:h,realIndex:x,j:e});if(F.add(t),a.config.chart.dropShadow.enabled){new H(this.w).dropShadow(t,a.config.chart.dropShadow,x)}}this.pathArr.push(h);const S=this.barHelpers.drawGoalLine({barXPosition:h.barXPosition,barYPosition:h.barYPosition,goalX:h.goalX,goalY:h.goalY,barHeight:L,barWidth:M});S&&T.add(S),g=h.y,d=h.x,e>0&&u.push(d+(null!=M?M:0)/2),p.push(g),this.renderSeries(l(n({realIndex:x,pathFill:v.color},v.useRangeColor?{lineFill:v.color}:{}),{j:e,i:r,columnGroupIndex:f,pathFrom:h.pathFrom,pathTo:h.pathTo,strokeWidth:o,elSeries:b,x:d,y:g,series:t,barHeight:Math.abs(h.barHeight?h.barHeight:L),barWidth:Math.abs(h.barWidth?h.barWidth:M),elDataLabelsWrap:P,elGoalsMarkers:T,elBarShadows:F,visibleSeries:this.visibleI,type:"bar"}))}a.globals.seriesXvalues[x]=u,a.globals.seriesYvalues[x]=p,h.add(b)}return h}renderSeries({realIndex:t,pathFill:e,lineFill:s,j:i,i:a,columnGroupIndex:o,pathFrom:r,pathTo:n,strokeWidth:l,elSeries:h,x:c,y:d,y1:g,y2:p,series:u,barHeight:x,barWidth:f,barXPosition:b,barYPosition:m,elDataLabelsWrap:y,elGoalsMarkers:w,elBarShadows:v,visibleSeries:A,type:C,classes:S}){var k;const D=this.w,L=new N(this.w,this.ctx);let M=!1;if(h._bindingsDelegated||(h._bindingsDelegated=!0,L.setupEventDelegation(h,`.apexcharts-${C}-area`)),!s){let e=function(t){const e=D.config.stroke.colors;let s;return Array.isArray(e)&&e.length>0&&(s=e[t],s||(s=""),"function"==typeof s)?s({value:D.seriesData.series[t][i],dataPointIndex:i,w:D}):s};const a="function"==typeof D.globals.stroke.colors[t]?e(t):D.globals.stroke.colors[t];s=this.barOptions.distributed?D.globals.stroke.colors[i]:a}const P=new Ee(this).handleBarDataLabels({x:c,y:d,y1:g,y2:p,i:a,j:i,series:u,realIndex:t,columnGroupIndex:o,barHeight:x,barWidth:f,barXPosition:b,barYPosition:m,visibleSeries:A});D.globals.isBarHorizontal||(P.dataLabelsPos.dataLabelsX+Math.max(f,D.globals.barPadForNumericAxis)<0||P.dataLabelsPos.dataLabelsX-Math.max(f,D.globals.barPadForNumericAxis)>D.layout.gridWidth)&&(M=!0),D.config.series[a].data[i]&&D.config.series[a].data[i].strokeColor&&(s=D.config.series[a].data[i].strokeColor),this.isNullValue&&(e="none");const T=D.config.chart.animations,F=T.animateGradually;let E=0;if(F&&!1!==F.enabled){const t=D.globals.dataPoints||1,e=F.delay||0,s=Math.min(e,.5*T.speed/Math.max(1,t));let o=Y({style:"sequential",index:i,baseDelay:s});D.config.chart.stacked&&(o+=a*s*.5);E=o/(e||1)}if(!M){const o=!0===(null==(k=this.ctx.morphTypeChange)?void 0:k.isActive())?this.ctx.morphTypeChange.getSpeed():D.config.chart.animations.dynamicAnimation.speed,c=L.renderPaths({i:a,j:i,realIndex:t,pathFrom:r,pathTo:n,stroke:s,strokeWidth:l,strokeLineCap:D.config.stroke.lineCap,fill:e,animationDelay:E,initialSpeed:D.config.chart.animations.speed,dataChangeSpeed:o,className:`apexcharts-${C}-area ${S}`,chartType:C,bindEventsOnPaths:!1});c.attr("clip-path",`url(#gridRectBarMask${D.globals.cuid})`);const d=D.config.forecastDataPoints;d.count>0&&i>=D.globals.dataPoints-d.count&&(c.node.setAttribute("stroke-dasharray",d.dashArray),c.node.setAttribute("stroke-width",d.strokeWidth),c.node.setAttribute("fill-opacity",d.fillOpacity)),void 0!==g&&void 0!==p&&(c.attr("data-range-y1",g),c.attr("data-range-y2",p));new H(this.w).setSelectionFilter(c,t,i),h.add(c),c.attr({cy:P.dataLabelsPos.bcy,cx:P.dataLabelsPos.bcx,j:i,val:D.seriesData.series[a][i],barHeight:x,barWidth:f}),null!==P.dataLabels&&y.add(P.dataLabels),P.totalDataLabels&&y.add(P.totalDataLabels),h.add(y),w&&h.add(w),v&&h.add(v)}return h}drawBarPaths({indexes:t,barHeight:e,strokeWidth:s,zeroW:i,x:a,y:o,yDivision:r,elSeries:n}){const l=this.w,h=t.i,c=t.j;let d;if(l.axisFlags.isXNumeric)d=(o=(l.seriesData.seriesX[h][c]-l.globals.minX)/this.invertedXRatio-e)+e*this.visibleI;else if(l.config.plotOptions.bar.hideZeroBarsWhenGrouped){const{nonZeroColumns:t,zeroEncounters:s}=this.barHelpers.getZeroValueEncounters({i:h,j:c});t>0&&(e=this.seriesLen*e/t),d=o+e*this.visibleI,d-=e*s}else d=o+e*this.visibleI;const g=this.isFunnel&&"trapezoid"===l.config.plotOptions.funnel.shape,p=this.isPyramid&&this.pyramidLayout?this.pyramidLayout[c]:null,u=!!p;if(p)d=p.y,e=p.height;else if(this.isFunnel&&!g){const t=null!=i?i:0;i=t-(this.barHelpers.getXForValue(this.series[h][c],t)-t)/2}let x;return a=this.barHelpers.getXForValue(this.series[h][c],null!=i?i:0),x=p?this.barHelpers.getPyramidPaths({barYPosition:d,barHeight:e,topHalf:p.topHalf,bottomHalf:p.bottomHalf,realIndex:t.realIndex,j:c,strokeWidth:s,w:l}):g?this.barHelpers.getFunnelTrapezoidPaths({barYPosition:d,barHeight:e,series:this.series,i:h,j:c,realIndex:t.realIndex,strokeWidth:s,w:l}):this.barHelpers.getBarpaths({barYPosition:d,barHeight:e,x1:i,x2:a,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:t.realIndex,i:h,j:c,w:l}),(g||u)&&(i=x.x1,a=x.x),l.axisFlags.isXNumeric||u||(o+=r),u&&(o=d),this.barHelpers.barBackground({j:c,i:h,y1:d-e*this.visibleI,y2:e*this.seriesLen,elSeries:n}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x1:i,x:a,y:o,goalX:this.barHelpers.getGoalValues("x",i,null,h,c,0),barYPosition:d,barHeight:e}}drawColumnPaths({indexes:t,x:e,y:s,xDivision:i,barWidth:a,zeroH:o,strokeWidth:r,elSeries:n}){const l=this.w,h=t.realIndex,c=t.translationsIndex,d=t.i,g=t.j,p=t.bc;let u;if(l.axisFlags.isXNumeric){const t=this.getBarXForNumericXAxis({x:e,j:g,realIndex:h,barWidth:a});e=t.x,u=t.barXPosition}else if(l.config.plotOptions.bar.hideZeroBarsWhenGrouped){const{nonZeroColumns:t,zeroEncounters:s}=this.barHelpers.getZeroValueEncounters({i:d,j:g});t>0&&(a=this.seriesLen*a/t),u=e+a*this.visibleI,u-=a*s}else u=e+a*this.visibleI;s=this.barHelpers.getYForValue(this.series[d][g],o,c);const x=this.barHelpers.getColumnPaths({barXPosition:u,barWidth:a,y1:o,y2:s,strokeWidth:r,isReversed:this.isReversed,series:this.series,realIndex:h,i:d,j:g,w:l});return l.axisFlags.isXNumeric||(e+=i),this.barHelpers.barBackground({bc:p,j:g,i:d,x1:u-r/2-a*this.visibleI,x2:a*this.seriesLen+r/2,elSeries:n}),{pathTo:x.pathTo,pathFrom:x.pathFrom,x:e,y:s,goalY:this.barHelpers.getGoalValues("y",null,o,d,g,c),barXPosition:u,barWidth:a}}getBarXForNumericXAxis({x:t,barWidth:e,realIndex:s,j:i}){const a=this.w;let o=s;return a.seriesData.seriesX[s].length||(o=a.globals.maxValsInArrayIndex),m.isNumber(a.seriesData.seriesX[o][i])&&(t=(a.seriesData.seriesX[o][i]-a.globals.minX)/this.xRatio-e*this.seriesLen/2),{barXPosition:t+e*this.visibleI,x:t}}getPreviousPath(t,e,s){const i=this.w;let a=null;for(let s=0;s<i.globals.previousPaths.length;s++){const o=i.globals.previousPaths[s];o.paths&&o.paths.length>0&&parseInt(o.realIndex,10)===parseInt(String(t),10)&&void 0!==o.paths[e]&&(a=o.paths[e].d)}return a&&Xe.pathCommandCount(a)===Xe.pathCommandCount(s)?a:s}static pathCommandCount(t){if(!t)return 0;const e=t.match(/[A-Za-z]/g);return e?e.length:0}}function Re({w:t,points:e,seedA:s,seedB:i,center:a,halfExtent:o,alongFn:r,isHorizontal:n,options:l,clampAt:h}){const c=l;if(!c||!1===c.show)return[];if(!e||!e.length)return[];const d=c.maxPoints||3e3,g=e.length>d?Math.ceil(e.length/d):1,p=null!=c.size?c.size:2.5,u=o*(null!=c.jitter?c.jitter:.5),x=!1!==c.constrainToViolin&&"function"==typeof h,f="square"===c.shape,b=c.colorScale,m=b&&Array.isArray(b.colors)&&b.colors.length>0,y=m?Math.max(2,b.steps||24):1,w=m&&null!=b.min?b.min:t.globals.minY,v=(m&&null!=b.max?b.max:t.globals.maxY)-w||1,A=m?new Array(y).fill(""):[""];for(let t=0;t<e.length;t+=g){const o=e[t],l=r(o);let c=2*(He(7919*s+100003*i+t)-.5)*u;if(x){const t=h(o);c>t&&(c=t),c<-t&&(c=-t)}const d=n?l:a+c,g=n?a+c:l,b=f?We(d,g,p):Ne(d,g,p);if(m){let t=(o-w)/v;t<0&&(t=0),t>1&&(t=1),A[Math.round(t*(y-1))]+=b}else A[0]+=b}if(!m)return A[0]?[{fill:null,d:A[0]}]:[];const C=[];for(let t=0;t<y;t++)A[t]&&C.push({fill:Be(b.colors,t/(y-1)),d:A[t]});return C}function ze({graphics:t,w:e,elSeries:s,pointsByCat:i,options:a,distributed:o,realIndex:r,wrapClass:n,pointClass:l}){if(!a||!1===a.show||!i.length)return;const h=null!=a.opacity?a.opacity:.9,c=null!=a.strokeColor?a.strokeColor:"#fff",d=null!=a.strokeWidth?a.strokeWidth:1,g=e.config.chart.animations.enabled&&!e.globals.resized&&!e.globals.dataChanged,p=t.group({class:g?`${n} apexcharts-element-hidden`:n});g&&e.globals.delayedElements.push({el:p.node}),i.forEach(({groups:s,j:i})=>{const n=o?e.globals.colors[i]:e.globals.colors[r],g=a.fillColor,u="series"===g?n:"series-dark"===g?Ye(n,.45):g||Ye(n,.45);s.forEach(s=>{const a=t.drawPath({d:s.d,fill:null!=s.fill?s.fill:u,stroke:d>0?c:"none",strokeWidth:d,fillOpacity:h,classes:l});a.attr("data:realIndex",r),a.attr("j",i),a.attr("clip-path",`url(#gridRectBarMask${e.globals.cuid})`),a.node.style.pointerEvents="none",p.add(a)})}),s.add(p)}function Ye(t,e){const s=m.parseHex(t);if(!s)return t;const i=Math.max(0,1-e);return`rgb(${Math.round(s[0]*i)},${Math.round(s[1]*i)},${Math.round(s[2]*i)})`}function Be(t,e){if(!t.length)return"#000";if(1===t.length)return t[0];const s=Math.max(0,Math.min(1,e))*(t.length-1),i=Math.floor(s),a=s-i,o=m.parseHex(t[i])||[0,0,0],r=m.parseHex(t[Math.min(i+1,t.length-1)])||o,n=(t,e)=>Math.round(t+(e-t)*a);return`rgb(${n(o[0],r[0])},${n(o[1],r[1])},${n(o[2],r[2])})`}function He(t){let e=(2654435769^t)>>>0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),((e^e>>>16)>>>0)/4294967296}function Ne(t,e,s){return`M ${t-s} ${e} a ${s} ${s} 0 1 0 ${2*s} 0 a ${s} ${s} 0 1 0 ${-2*s} 0 `}function We(t,e,s){return`M ${t-s} ${e-s} h ${2*s} v ${2*s} h ${-2*s} z `}class Oe extends Xe{draw(t,e,s){var i;const a=this.w,o=new N(this.w),r=a.globals.comboCharts?e:a.config.chart.type,h=new G(this.w);this.candlestickOptions=this.w.config.plotOptions.candlestick,this.boxOptions=this.w.config.plotOptions.boxPlot,this.isHorizontal=a.config.plotOptions.bar.horizontal,this.isOHLC=this.candlestickOptions&&"ohlc"===this.candlestickOptions.type,this.coreUtils=new F(this.w),t=this.coreUtils.getLogSeries(t),this.series=t,this.yRatio=this.coreUtils.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);const c=o.group({class:`apexcharts-${r}-series apexcharts-plot-series`});for(let e=0;e<t.length;e++){let r,d;this.isBoxPlot="boxPlot"===a.config.chart.type||"boxPlot"===a.config.series[e].type;const g=[],p=[],u=a.globals.comboCharts?s[e]:e,{columnGroupIndex:x}=this.barHelpers.getGroupIndex(u),f=o.group({class:"apexcharts-series",seriesName:m.escapeString(a.seriesData.seriesNames[u]),rel:e+1,"data:realIndex":u});lt.addCollapsedClassToSeries(this.w,f,u),t[e].length>0&&(this.visibleI=this.visibleI+1);let b=0;this.yRatio.length>1&&(this.yaxisIndex=a.globals.seriesYAxisReverseMap[u][0],b=u);const y=this.barHelpers.initialPositions(u),{y:w,barHeight:v,yDivision:A,zeroW:C,x:S,barWidth:k,xDivision:D,zeroH:L}=y;d=w,r=S,p.push(r+(null!=k?k:0)/2);const M=o.group({class:"apexcharts-datalabels","data:realIndex":u}),P=o.group({class:"apexcharts-bar-goals-markers"}),T=this.isBoxPlot?this.boxOptions.points:null,F=[],E=a.layout.gridWidth,I=null!=k?k:0;for(let s=0;s<a.globals.dataPoints;s++){const o=this.barHelpers.getStrokeWidth(e,s,u);let c=null;const m={indexes:{i:e,j:s,realIndex:u,translationsIndex:b},x:r,y:d,strokeWidth:o,elSeries:f};if(c=this.isHorizontal?this.drawHorizontalBoxPaths(l(n({},m),{yDivision:A,barHeight:v,zeroW:C})):this.drawVerticalBoxPaths(l(n({},m),{xDivision:D,barWidth:k,zeroH:L,cullBounds:{lo:-I,hi:E+I}})),d=c.y,r=c.x,s>0&&p.push(r+(null!=k?k:0)/2),g.push(d),c.culled)continue;const y=this.barHelpers.drawGoalLine({barXPosition:c.barXPosition,barYPosition:c.barYPosition,goalX:c.goalX,goalY:c.goalY,barHeight:v,barWidth:k});if(y&&P.add(y),c.pathTo.forEach((i,n)=>{const l=!this.isBoxPlot&&this.candlestickOptions.wick.useFillColor?c.color[n]:a.globals.stroke.colors[e],g=h.fillPath({seriesNumber:u,dataPointIndex:s,color:c.color[n],value:t[e][s]});this.renderSeries({realIndex:u,pathFill:g,lineFill:l,j:s,i:e,pathFrom:c.pathFrom,pathTo:i,strokeWidth:o,elSeries:f,x:r,y:d,series:t,columnGroupIndex:x,barHeight:v,barWidth:k,elDataLabelsWrap:M,elGoalsMarkers:P,visibleSeries:this.visibleI,type:a.config.chart.type})}),T&&!1!==T.show){const t=null==(i=a.candleData.seriesBoxPoints[u])?void 0:i[s];if(t&&t.length){const e=t=>this.coreUtils.getLogValAtSeriesIndex(t,u);let i,o,r;if(this.isHorizontal){const t=this.invertedYRatio,s=null!=v?v:0,a=null!=C?C:0;i=c.barYPosition+s/2,o=s/2,r=s=>a+e(s)/t}else{const t=this.yRatio[b],s=null!=k?k:0,a=null!=L?L:0;i=c.barXPosition+s/2,o=s/2,r=s=>a-e(s)/t}const n=Re({w:a,points:t,seedA:u,seedB:s,center:i,halfExtent:o,alongFn:r,isHorizontal:this.isHorizontal,options:T});n.length&&F.push({groups:n,j:s})}}}T&&ze({graphics:o,w:a,elSeries:f,pointsByCat:F,options:T,distributed:a.config.plotOptions.bar.distributed,realIndex:u,wrapClass:"apexcharts-boxPlot-points-wrap",pointClass:"apexcharts-boxPlot-points"}),a.globals.seriesXvalues[u]=p,a.globals.seriesYvalues[u]=g,c.add(f)}return c}drawVerticalBoxPaths({indexes:t,x:e,xDivision:s,barWidth:i,zeroH:a,strokeWidth:o,cullBounds:r=null}){var n,l;const h=this.w,c=new N(this.w),d=t.i,g=t.j,{colors:p}=h.config.plotOptions.candlestick,{colors:u}=this.boxOptions,x=t.realIndex,f=t=>Array.isArray(t)?t[x]:t,b=f(p.upward),m=f(p.downward),y=this.yRatio[t.translationsIndex],w=this.getOHLCValue(x,g);let v=a,A=a,C=w.o<w.c?[b]:[m];this.isBoxPlot&&(C=[f(u.lower),f(u.upper)]);let S=Math.min(w.o,w.c),k=Math.max(w.o,w.c),D=w.m;h.axisFlags.isXNumeric&&(e=(h.seriesData.seriesX[x][g]-h.globals.minX)/this.xRatio-i/2);const L=e+i*this.visibleI;if(void 0===(null==(n=this.series[d])?void 0:n[g])||null===(null==(l=this.series[d])?void 0:l[g])?(S=a,k=a):(S=a-S/y,k=a-k/y,v=a-w.h/y,A=a-w.l/y,D=a-w.m/y),r&&(L+i<r.lo||L>r.hi))return{pathTo:null,pathFrom:null,x:h.axisFlags.isXNumeric?e:e+s,y:k,barXPosition:L,color:C,culled:!0};let M,P;if(this.isOHLC){const t=L+i/2,e=a-w.o/y,s=a-w.c/y;M=[c.move(t,v)+c.line(t,A)+c.move(t,e)+c.line(L,e)+c.move(t,s)+c.line(L+i,s)]}else M=this.isBoxPlot?[c.move(L,S)+c.line(L+i/2,S)+c.line(L+i/2,v)+c.line(L+i/4,v)+c.line(L+i-i/4,v)+c.line(L+i/2,v)+c.line(L+i/2,S)+c.line(L+i,S)+c.line(L+i,D)+c.line(L,D)+c.line(L,S+o/2),c.move(L,D)+c.line(L+i,D)+c.line(L+i,k)+c.line(L+i/2,k)+c.line(L+i/2,A)+c.line(L+i-i/4,A)+c.line(L+i/4,A)+c.line(L+i/2,A)+c.line(L+i/2,k)+c.line(L,k)+c.line(L,D)+"z"]:[c.move(L,k)+c.line(L+i/2,k)+c.line(L+i/2,v)+c.line(L+i/2,k)+c.line(L+i,k)+c.line(L+i,S)+c.line(L+i/2,S)+c.line(L+i/2,A)+c.line(L+i/2,S)+c.line(L,S)+c.line(L,k-o/2)];return P=h.globals.previousPaths.length>0?this.getPreviousPath(x,g,M[0]):c.move(L+i/2,S)+c.move(L,S),h.axisFlags.isXNumeric||(e+=s),{pathTo:M,pathFrom:P,x:e,y:k,goalY:this.barHelpers.getGoalValues("y",null,a,d,g,t.translationsIndex),barXPosition:L,color:C}}drawHorizontalBoxPaths({indexes:t,y:e,yDivision:s,barHeight:i,zeroW:a,strokeWidth:o}){var r,n;const l=this.w,h=new N(this.w),c=t.i,d=t.j,g=t.realIndex,{colors:p}=l.config.plotOptions.candlestick,{colors:u}=this.boxOptions,x=t=>Array.isArray(t)?t[g]:t,f=this.invertedYRatio,b=this.getOHLCValue(g,d);let m=b.o<b.c?[x(p.upward)]:[x(p.downward)];this.isBoxPlot&&(m=[x(u.lower),x(u.upper)]);let y=a,w=a,v=Math.min(b.o,b.c),A=Math.max(b.o,b.c),C=b.m;l.axisFlags.isXNumeric&&(e=(l.seriesData.seriesX[g][d]-l.globals.minX)/this.invertedXRatio-i/2);const S=e+i*this.visibleI;void 0===(null==(r=this.series[c])?void 0:r[d])||null===(null==(n=this.series[c])?void 0:n[d])?(v=a,A=a):(v=a+v/f,A=a+A/f,y=a+b.h/f,w=a+b.l/f,C=a+b.m/f);const k=[h.move(v,S)+h.line(v,S+i/2)+h.line(y,S+i/2)+h.line(y,S+i/2-i/4)+h.line(y,S+i/2+i/4)+h.line(y,S+i/2)+h.line(v,S+i/2)+h.line(v,S+i)+h.line(C,S+i)+h.line(C,S)+h.line(v+o/2,S),h.move(C,S)+h.line(C,S+i)+h.line(A,S+i)+h.line(A,S+i/2)+h.line(w,S+i/2)+h.line(w,S+i-i/4)+h.line(w,S+i/4)+h.line(w,S+i/2)+h.line(A,S+i/2)+h.line(A,S)+h.line(C,S)+"z"];let D;return D=l.globals.previousPaths.length>0?this.getPreviousPath(g,d,k[0]):h.move(v,S+i/2)+h.move(v,S),l.axisFlags.isXNumeric||(e+=s),{pathTo:k,pathFrom:D,x:A,y:e,goalX:this.barHelpers.getGoalValues("x",a,null,c,d,0),barYPosition:S,color:m}}getOHLCValue(t,e){const s=this.w,i=this.coreUtils,a=s=>s[t]&&null!=s[t][e]?i.getLogValAtSeriesIndex(s[t][e],t):0,o=a(s.candleData.seriesCandleH),r=a(s.candleData.seriesCandleO),n=a(s.candleData.seriesCandleM),l=a(s.candleData.seriesCandleC),h=a(s.candleData.seriesCandleL);return{o:this.isBoxPlot?o:r,h:this.isBoxPlot?r:o,m:n,l:this.isBoxPlot?l:h,c:this.isBoxPlot?h:l}}}const _e=t=>{const e=function(t){const e=[];let s=t[0],i=t[1],a=e[0]=je(s,i),o=1;for(let r=t.length-1;o<r;o++)s=i,i=t[o+1],e[o]=.5*(a+(a=je(s,i)));return e[o]=a,e}(t),s=t.length-1,i=[];let a,o,r,n;for(let i=0;i<s;i++)r=je(t[i],t[i+1]),Math.abs(r)<1e-6?e[i]=e[i+1]=0:(a=e[i]/r,o=e[i+1]/r,n=a*a+o*o,n>9&&(n=3*r/Math.sqrt(n),e[i]=n*a,e[i+1]=n*o));for(let a=0;a<=s;a++)n=(t[Math.min(s,a+1)][0]-t[Math.max(0,a-1)][0])/(6*(1+e[a]*e[a])),i.push([n||0,e[a]*n||0]);return i},$e=t=>{let e="";for(let s=0;s<t.length;s++){const i=t[s],a=i.length;a>4?(e+=`C${i[0]}, ${i[1]}`,e+=`, ${i[2]}, ${i[3]}`,e+=`, ${i[4]}, ${i[5]}`):a>2&&(e+=`S${i[0]}, ${i[1]}`,e+=`, ${i[2]}, ${i[3]}`)}return e},Ge={points(t){const e=_e(t),s=t[1],i=t[0],a=[],o=e[1],r=e[0];a.push(i,[i[0]+r[0],i[1]+r[1],s[0]-o[0],s[1]-o[1],s[0],s[1]]);for(let s=2,i=e.length;s<i;s++){const i=t[s],o=e[s];a.push([i[0]-o[0],i[1]-o[1],i[0],i[1]])}return a},slice(t,e,s){const i=t.slice(e,s);if(e){if(s-e>1&&i[1].length<6){const t=i[0].length;i[1]=[2*i[0][t-2]-i[0][t-4],2*i[0][t-1]-i[0][t-3]].concat(i[1])}i[0]=i[0].slice(-2)}return i}};function je(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Ve(t){const e=[];for(let s=0;s<t.length;s+=2)e.push(t[s+1],t[s]);return e}class Ue{constructor(t,e){this.ctx=e,this.w=t}checkColorRange(){const t=this.w;let e=!1;const s=t.config.plotOptions[t.config.chart.type];return s.colorScale.ranges.length>0&&s.colorScale.ranges.map(t=>{t.from<=0&&(e=!0)}),e}getShadeColor(t,e,s,i){const a=this.w;let o=1;const r=a.config.plotOptions[t].shadeIntensity,n=this.determineColor(t,e,s);a.globals.hasNegs||i?o=a.config.plotOptions[t].reverseNegativeShade?n.percent<0?n.percent/100*(1.25*r):(1-n.percent/100)*(1.25*r):n.percent<=0?1-(1+n.percent/100)*r:(1-n.percent/100)*r:(o=1-n.percent/100,"treemap"===t&&(o=(1-n.percent/100)*(1.25*r)));let l=n.color;const h=new m;if(a.config.plotOptions[t].enableShades)if("dark"===this.w.config.theme.mode){const t=h.shadeColor(-1*o,n.color);l=m.hexToRgba(m.isColorHex(t)?t:m.rgb2hex(t),a.config.fill.opacity)}else{const t=h.shadeColor(o,n.color);l=m.hexToRgba(m.isColorHex(t)?t:m.rgb2hex(t),a.config.fill.opacity)}return{color:l,colorProps:n}}determineColor(t,e,s){const i=this.w,a=i.seriesData.series[e][s],o=i.config.plotOptions[t];let r=o.colorScale.inverse?s:e;o.distributed&&"treemap"===i.config.chart.type&&(r=s);let n=i.globals.colors[r],l=null,h=Math.min(...i.seriesData.series[e]),c=Math.max(...i.seriesData.series[e]);o.distributed||"heatmap"!==t||(h=i.globals.minY,c=i.globals.maxY),void 0!==o.colorScale.min&&(h=o.colorScale.min<i.globals.minY?o.colorScale.min:i.globals.minY,c=o.colorScale.max>i.globals.maxY?o.colorScale.max:i.globals.maxY);const d=Math.abs(c)+Math.abs(h);let g=0===d?0:100*a/d;if(o.colorScale.ranges.length>0){o.colorScale.ranges.map(t=>{if(a>=t.from&&a<=t.to){n=t.color,l=t.foreColor?t.foreColor:null,h=t.from,c=t.to;const e=Math.abs(c)+Math.abs(h);g=0===e?0:100*a/e}})}return{color:n,foreColor:l,percent:g}}calculateDataLabels({text:t,x:e,y:s,i:i,j:a,colorProps:o,fontSize:r}){const n=this.w.config.dataLabels,l=new N(this.w),h=new U(this.w,this.ctx);let c=null;if(n.enabled){c=l.group({class:"apexcharts-data-labels"});const d=n.offsetX,g=n.offsetY,p=e+d,u=s+parseFloat(n.style.fontSize)/3+g;h.plotDataLabelsText({x:p,y:u,text:t,i:i,j:a,color:o.foreColor,parent:c,fontSize:r,dataLabelsConfig:n})}return c}}class qe{constructor(t){this.w=t.w,this.lineCtx=t}sameValueSeriesFix(t,e){const s=this.w;if("gradient"===s.config.fill.type||"gradient"===s.config.fill.type[t]){if(new F(this.lineCtx.w).seriesHaveSameValues(t)){const s=e[t].slice();s[s.length-1]=s[s.length-1]+1e-6,e[t]=s}}return e}calculatePoints({series:t,realIndex:e,x:s,y:i,i:a,j:o,prevY:r}){const n=this.w,l=[],h=[];let c=this.lineCtx.categoryAxisCorrection+n.config.markers.offsetX;return n.axisFlags.isXNumeric&&(c=(n.seriesData.seriesX[e][0]-n.globals.minX)/this.lineCtx.xRatio+n.config.markers.offsetX),0===o&&(l.push(c),h.push(m.isNumber(t[a][0])?r+n.config.markers.offsetY:null)),l.push(s+n.config.markers.offsetX),h.push(m.isNumber(t[a][o+1])?i+n.config.markers.offsetY:null),{x:l,y:h}}checkPreviousPaths({pathFromLine:t,pathFromArea:e,realIndex:s}){const i=this.w;for(let a=0;a<i.globals.previousPaths.length;a++){const o=i.globals.previousPaths[a];("line"===o.type||"area"===o.type)&&o.paths.length>0&&parseInt(o.realIndex,10)===parseInt(s,10)&&("line"===o.type?(this.lineCtx.appendPathFrom=!1,t=i.globals.previousPaths[a].paths[0].d):"area"===o.type&&(this.lineCtx.appendPathFrom=!1,e=i.globals.previousPaths[a].paths[0].d,i.config.stroke.show&&i.globals.previousPaths[a].paths[1]&&(t=i.globals.previousPaths[a].paths[1].d)))}return{pathFromLine:t,pathFromArea:e}}determineFirstPrevY({i:t,realIndex:e,series:s,prevY:i,lineYPosition:a,translationsIndex:o}){var r,n,l;const h=this.w,c=h.config.chart.stacked&&!h.globals.comboCharts||h.config.chart.stacked&&h.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null==(r=this.w.config.series[e])?void 0:r.type)||"column"===(null==(n=this.w.config.series[e])?void 0:n.type));if(void 0!==(null==(l=s[t])?void 0:l[0]))i=(a=c&&t>0?this.lineCtx.prevSeriesY[t-1][0]:this.lineCtx.zeroY)-s[t][0]/this.lineCtx.yRatio[o]+2*(this.lineCtx.isReversed?s[t][0]/this.lineCtx.yRatio[o]:0);else if(c&&t>0&&void 0===s[t][0])for(let e=t-1;e>=0;e--)if(null!==s[e][0]&&void 0!==s[e][0]){i=a=this.lineCtx.prevSeriesY[e][0];break}return{prevY:i,lineYPosition:a}}}class Ze{constructor(t,e,s,i){this.ctx=e,this.w=t,this.xyRatios=s,this.xRatio=0,this.yRatio=[],this.zRatio=0,this.baseLineY=[],this.pointsChart=!("bubble"!==this.w.config.chart.type&&"scatter"!==this.w.config.chart.type)||i,this.scatter=new V(this.w,this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new qe(this),this.markers=new j(this.w,this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0,this.xDivision=0,this.zeroY=0,this.areaBottomY=0,this.strokeWidth=0,this.isReversed=!1,this.appendPathFrom=!1,this.elSeries=null,this.elPointsMain=null,this.elDataLabelsWrap=null}draw(t,e,s,i){var a;const o=this.w,r=new N(this.w),h=o.globals.comboCharts?e:o.config.chart.type,c=r.group({class:`apexcharts-${h}-series apexcharts-plot-series`}),d=new F(this.w);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,t=d.getLogSeries(t),this.yRatio=d.getLogYRatios(this.yRatio),this.prevSeriesY=[];const g=[];for(let e=0;e<t.length;e++){t=this.lineHelpers.sameValueSeriesFix(e,t);const a=o.globals.comboCharts?s[e]:e,r=this.yRatio.length>1?a:0;this._initSerieVariables(t,e,a);const c=[],d=[],p=[];let u=o.globals.padHorizontal+this.categoryAxisCorrection;const x=1,f=[],b=[];lt.addCollapsedClassToSeries(this.w,this.elSeries,a),o.axisFlags.isXNumeric&&o.seriesData.seriesX.length>0&&(u=(o.seriesData.seriesX[a][0]-o.globals.minX)/this.xRatio),p.push(u);const m=u;let y;const w=m;let v=this.zeroY,A=this.zeroY;const C=0;v=this.lineHelpers.determineFirstPrevY({i:e,realIndex:a,series:t,prevY:v,lineYPosition:C,translationsIndex:r}).prevY,"monotoneCubic"===o.config.stroke.curve&&null===t[e][0]?c.push(null):c.push(v);const S=v;let k;"rangeArea"===h&&(k=this.lineHelpers.determineFirstPrevY({i:e,realIndex:a,series:i,prevY:A,lineYPosition:C,translationsIndex:r}),A=k.prevY,y=A,d.push(null!==c[0]?A:null));const D=this._calculatePathsFrom({type:h,series:t,i:e,realIndex:a,translationsIndex:r,prevX:w,prevY:v,prevY2:A}),L=[c[0]],M=[d[0]],P={type:h,series:t,realIndex:a,translationsIndex:r,i:e,x:u,y:x,pX:m,pY:S,pathsFrom:D,linePaths:f,areaPaths:b,seriesIndex:s,lineYPosition:C,xArrj:p,yArrj:c,y2Arrj:d,seriesRangeEnd:i},T=this._iterateOverDataPoints(l(n({},P),{iterations:"rangeArea"===h?t[e].length-1:void 0,isRangeStart:!0}));if("rangeArea"===h){const t=this._calculatePathsFrom({series:i,i:e,realIndex:a,prevX:w,prevY:A}),s=this._iterateOverDataPoints(l(n({},P),{series:i,xArrj:[u],yArrj:L,y2Arrj:M,pY:y,areaPaths:T.areaPaths,pathsFrom:t,iterations:i[e].length-1,isRangeStart:!1})),o=T.linePaths.length/2;for(let t=0;t<o;t++)T.linePaths[t]=s.linePaths[t+o]+T.linePaths[t];T.linePaths.splice(o),T.pathFromLine=s.pathFromLine+T.pathFromLine}else T.pathFromArea+="z";this._handlePaths({type:h,realIndex:a,i:e,paths:T}),this.elSeries.add(this.elPointsMain),this.elSeries.add(this.elDataLabelsWrap),g.push(this.elSeries)}if(void 0!==(null==(a=o.config.series[0])?void 0:a.zIndex)&&g.sort((t,e)=>Number(t.node.getAttribute("zIndex"))-Number(e.node.getAttribute("zIndex"))),o.config.chart.stacked)for(let t=g.length-1;t>=0;t--)c.add(g[t]);else for(let t=0;t<g.length;t++)c.add(g[t]);return c}_initSerieVariables(t,e,s){const i=this.w,a=new N(this.w);this.xDivision=i.layout.gridWidth/(i.globals.dataPoints-("on"===i.config.xaxis.tickPlacement?1:0)),this.strokeWidth=Array.isArray(i.config.stroke.width)?i.config.stroke.width[s]:i.config.stroke.width;let o=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[s],o=s),this.isReversed=i.config.yaxis[this.yaxisIndex]&&i.config.yaxis[this.yaxisIndex].reversed,this.zeroY=i.layout.gridHeight-this.baseLineY[o]-(this.isReversed?i.layout.gridHeight:0)+(this.isReversed?2*this.baseLineY[o]:0),this.areaBottomY=this.zeroY,(this.zeroY>i.layout.gridHeight||"end"===i.config.plotOptions.area.fillTo)&&(this.areaBottomY=i.layout.gridHeight),this.categoryAxisCorrection=this.xDivision/2;const r=i.config.series[s];if(this.elSeries=a.group({class:"apexcharts-series",zIndex:void 0!==r.zIndex?r.zIndex:s,seriesName:m.escapeString(i.seriesData.seriesNames[s])}),this.elPointsMain=a.group({class:"apexcharts-series-markers-wrap","data:realIndex":s}),i.globals.hasNullValues){const t=this.markers.plotChartMarkers({pointsPos:{x:[0],y:[i.layout.gridHeight+i.globals.markers.largestSize]},seriesIndex:e,j:0,pSize:.1,alwaysDrawMarker:!0,isVirtualPoint:!0});null!==t&&this.elPointsMain.add(t)}this.elDataLabelsWrap=a.group({class:"apexcharts-datalabels","data:realIndex":s});const n=t[e].length===i.globals.dataPoints;this.elSeries.attr({"data:longestSeries":n,rel:e+1,"data:realIndex":s}),this.appendPathFrom=!0}_calculatePathsFrom({type:t,series:e,i:s,realIndex:i,translationsIndex:a,prevX:o,prevY:r,prevY2:n}){const l=this.w,h=new N(this.w);let c,d,g,p;if(null===e[s][0]){for(let t=0;t<e[s].length;t++)if(null!==e[s][t]){o=this.xDivision*t,r=this.zeroY-e[s][t]/this.yRatio[a],c=h.move(o,r),d=h.move(o,this.areaBottomY);break}}else c=h.move(o,r),"rangeArea"===t&&(c=h.move(o,n)+h.line(o,r)),d=h.move(o,this.areaBottomY)+h.line(o,r);if(g=h.move(0,this.areaBottomY)+h.line(0,this.areaBottomY),p=h.move(0,this.areaBottomY)+h.line(0,this.areaBottomY),l.globals.previousPaths.length>0){const t=this.lineHelpers.checkPreviousPaths({pathFromLine:g,pathFromArea:p,realIndex:i});g=t.pathFromLine,p=t.pathFromArea}return{prevX:o,prevY:r,linePath:c,areaPath:d,pathFromLine:g,pathFromArea:p}}_handlePaths({type:t,realIndex:e,i:s,paths:i}){const a=this.w,o=new N(this.w),r=new G(this.w);this.prevSeriesY.push(i.yArrj),a.globals.seriesXvalues[e]=i.xArrj,a.globals.seriesYvalues[e]=i.yArrj;const h=a.config.forecastDataPoints;if(h.count>0&&"rangeArea"!==t){const t=a.globals.seriesXvalues[e][a.globals.seriesXvalues[e].length-h.count-1],s=o.drawRect(t,0,a.layout.gridWidth,a.layout.gridHeight,0);a.dom.elForecastMask.appendChild(s.node);const i=o.drawRect(0,0,t,a.layout.gridHeight,0);a.dom.elNonForecastMask.appendChild(i.node)}this.pointsChart||a.globals.delayedElements.push({el:this.elPointsMain.node,index:e});const c={i:s,realIndex:e,animationDelay:s,initialSpeed:a.config.chart.animations.speed,dataChangeSpeed:a.config.chart.animations.dynamicAnimation.speed,className:`apexcharts-${t}`};if("area"===t){const t=r.fillPath({seriesNumber:e});for(let e=0;e<i.areaPaths.length;e++){const s=o.renderPaths(l(n({},c),{pathFrom:i.pathFromArea,pathTo:i.areaPaths[e],stroke:"none",strokeWidth:0,strokeLineCap:null,fill:t}));this.elSeries.add(s)}}if(a.config.stroke.show&&!this.pointsChart){let d=null;if("line"===t)d=r.fillPath({seriesNumber:e,i:s});else if("solid"===a.config.stroke.fill.type)d=a.globals.stroke.colors[e];else{const t=a.config.fill;a.config.fill=a.config.stroke.fill,d=r.fillPath({seriesNumber:e,i:s}),a.config.fill=t}for(let s=0;s<i.linePaths.length;s++){let g=d;"rangeArea"===t&&(g=r.fillPath({seriesNumber:e}));const p=l(n({},c),{pathFrom:i.pathFromLine,pathTo:i.linePaths[s],stroke:d,strokeWidth:this.strokeWidth,strokeLineCap:a.config.stroke.lineCap,fill:"rangeArea"===t?g:"none"}),u=o.renderPaths(p);if(this.elSeries.add(u),u.attr("fill-rule","evenodd"),h.count>0&&"rangeArea"!==t){const t=o.renderPaths(p);t.node.setAttribute("stroke-dasharray",h.dashArray),h.strokeWidth&&t.node.setAttribute("stroke-width",h.strokeWidth),this.elSeries.add(t),t.attr("clip-path",`url(#forecastMask${a.globals.cuid})`),u.attr("clip-path",`url(#nonForecastMask${a.globals.cuid})`)}}}}_iterateOverDataPoints({type:t,series:e,iterations:s,realIndex:i,translationsIndex:a,i:o,x:r,y:n,pX:l,pY:h,pathsFrom:c,linePaths:d,areaPaths:g,seriesIndex:p,lineYPosition:u,xArrj:x,yArrj:f,y2Arrj:b,isRangeStart:y,seriesRangeEnd:w}){var v,A;const C=this.w,S=new N(this.w),k=this.yRatio;let{prevY:D,linePath:L,areaPath:M,pathFromLine:P,pathFromArea:T}=c;const F=m.isNumber(C.globals.minYArr[i])?C.globals.minYArr[i]:C.globals.minY;s||(s=C.globals.dataPoints>1?C.globals.dataPoints-1:C.globals.dataPoints);const E=(t,e)=>e-t/k[a]+2*(this.isReversed?t/k[a]:0);let I=n;const X=C.config.chart.stacked&&!C.globals.comboCharts||C.config.chart.stacked&&C.globals.comboCharts&&(!this.w.config.chart.stackOnlyBar||"bar"===(null==(v=this.w.config.series[i])?void 0:v.type)||"column"===(null==(A=this.w.config.series[i])?void 0:A.type));let R=C.config.stroke.curve;Array.isArray(R)&&(R=Array.isArray(p)?R[p[o]]:R[o]);let z,Y=0;for(let a=0;a<s&&0!==e[o].length;a++){const c=void 0===e[o][a+1]||null===e[o][a+1];if(C.axisFlags.isXNumeric){let t=C.seriesData.seriesX[i][a+1];void 0===C.seriesData.seriesX[i][a+1]&&(t=C.seriesData.seriesX[i][s-1]),r=(t-C.globals.minX)/this.xRatio}else r+=this.xDivision;if(X)if(o>0&&C.globals.collapsedSeries.length<C.config.series.length-1){const t=t=>{for(let e=t;e>0;e--){if(!(C.globals.collapsedSeriesIndices.indexOf((null==p?void 0:p[e])||e)>-1))return e;e--}return 0};u=this.prevSeriesY[t(o-1)][a+1]}else u=this.zeroY;else u=this.zeroY;c?n=E(F,u):(n=E(e[o][a+1],u),"rangeArea"===t&&(I=E(w[o][a+1],u))),x.push(null===e[o][a+1]?null:r),!c||"smooth"!==C.config.stroke.curve&&"monotoneCubic"!==C.config.stroke.curve?(f.push(n),b.push(I)):(f.push(null),b.push(null));const m=this.lineHelpers.calculatePoints({series:e,x:r,y:n,realIndex:i,i:o,j:a,prevY:D}),v=this._createPaths({type:t,series:e,i:o,j:a,x:r,y:n,y2:I,xArrj:x,yArrj:f,y2Arrj:b,pX:l,pY:h,pathState:Y,segmentStartX:z,linePath:L,areaPath:M,linePaths:d,areaPaths:g,curve:R,isRangeStart:y});g=v.areaPaths,d=v.linePaths,l=v.pX,h=v.pY,Y=v.pathState,z=v.segmentStartX,M=v.areaPath,L=v.linePath,!this.appendPathFrom||C.globals.hasNullValues||"monotoneCubic"===R&&"rangeArea"===t||(P+=S.line(r,this.areaBottomY),T+=S.line(r,this.areaBottomY)),this.handleNullDataPoints(e,m,o,a,i),this._handleMarkersAndLabels({type:t,pointsPos:m,i:o,j:a,realIndex:i,isRangeStart:y})}return{yArrj:f,xArrj:x,pathFromArea:T,areaPaths:g,pathFromLine:P,linePaths:d,linePath:L,areaPath:M}}_handleMarkersAndLabels({type:t,pointsPos:e,isRangeStart:s,i:i,j:a,realIndex:o}){const r=this.w,n=new U(this.w,this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,a,{realIndex:o,pointsPos:e,zRatio:this.zRatio,elParent:this.elPointsMain});else{!(!r.globals.dataChanged&&!r.globals.resized)&&r.seriesData.series[i].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");const t=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:o,j:a+1});null!==t&&this.elPointsMain.add(t)}const l=n.drawDataLabel({type:t,isRangeStart:s,pos:e,i:o,j:a+1});null!==l&&this.elDataLabelsWrap.add(l)}_createPaths({type:t,series:e,i:s,j:i,x:a,y:o,xArrj:r,yArrj:n,y2:l,y2Arrj:h,pX:c,pY:d,pathState:g,segmentStartX:p,linePath:u,areaPath:x,linePaths:f,areaPaths:b,curve:m,isRangeStart:y}){const w=new N(this.w),v=this.areaBottomY,A="rangeArea"===t,C="rangeArea"===t&&y;switch(m){case"monotoneCubic":{const t=y?n:h,a=(t,e)=>t.map((t,s)=>[t,e[s]]).filter(t=>null!==t[1]),o=t=>{const e=[];let s=0;return t.forEach(t=>{null!==t?s++:s>0&&(e.push(s),s=0)}),s>0&&e.push(s),e},l=(t,e)=>{const s=o(t),i=[];for(let t=0,a=0;t<s.length;a+=s[t++])i[t]=Ge.slice(e,a,a+s[t]);return i};switch(g){case 0:if(null===t[i+1])break;g=1;case 1:if(!(A?r.length===e[s].length:i===e[s].length-2))break;case 2:{const e=y?r:r.slice().reverse(),s=y?t:t.slice().reverse(),i=a(e,s),o=i.length>1?Ge.points(i):i;let n=[];A&&(C?b=i:n=b.reverse());let h=0,c=0;if(l(s,o).forEach(t=>{h++;const e=$e(t),s=c;c+=t.length;const a=c-1;C?u=w.move(i[s][0],i[s][1])+e:A?u=w.move(n[s][0],n[s][1])+w.line(i[s][0],i[s][1])+e+w.line(n[a][0],n[a][1]):(u=w.move(i[s][0],i[s][1])+e,x=u+w.line(i[a][0],v)+w.line(i[s][0],v)+"z",b.push(x)),f.push(u)}),A&&h>1&&!C){const t=f.slice(h).reverse();f.splice(h),t.forEach(t=>f.push(t))}g=0;break}}break}case"smooth":{const t=.35*(a-c);if(null===e[s][i])g=0;else switch(g){case 0:if(p=c,u=C?w.move(c,h[i])+w.line(c,d):w.move(c,d),x=w.move(c,d),null===e[s][i+1]||void 0===e[s][i+1]){f.push(u),b.push(x);break}if(g=1,i<e[s].length-2){const e=w.curve(c+t,d,a-t,o,a,o);u+=e,x+=e;break}case 1:if(null===e[s][i+1])u+=C?w.line(c,l):w.move(c,d),x+=w.line(c,v)+w.line(p,v)+"z",f.push(u),b.push(x),g=-1;else{const r=w.curve(c+t,d,a-t,o,a,o);u+=r,x+=r,i>=e[s].length-2&&(C&&(u+=w.curve(a,o,a,o,a,l)+w.move(a,l)),x+=w.curve(a,o,a,o,a,v)+w.line(p,v)+"z",f.push(u),b.push(x),g=-1)}}c=a,d=o;break}default:{const t=(t,e,s)=>{let i="";switch(t){case"stepline":i=w.line(e,null,"H")+w.line(null,s,"V");break;case"linestep":i=w.line(null,s,"V")+w.line(e,null,"H");break;case"straight":i=w.line(e,s)}return i};if(null===e[s][i])g=0;else switch(g){case 0:if(p=c,u=C?w.move(c,h[i])+w.line(c,d):w.move(c,d),x=w.move(c,d),null===e[s][i+1]||void 0===e[s][i+1]){f.push(u),b.push(x);break}if(g=1,i<e[s].length-2){const e=t(m,a,o);u+=e,x+=e;break}case 1:if(null===e[s][i+1])u+=C?w.line(c,l):w.move(c,d),x+=w.line(c,v)+w.line(p,v)+"z",f.push(u),b.push(x),g=-1;else{const r=t(m,a,o);u+=r,x+=r,i>=e[s].length-2&&(C&&(u+=w.line(a,l)),x+=w.line(a,v)+w.line(p,v)+"z",f.push(u),b.push(x),g=-1)}}c=a,d=o;break}}return{linePaths:f,areaPaths:b,pX:c,pY:d,pathState:g,segmentStartX:p,linePath:u,areaPath:x}}handleNullDataPoints(t,e,s,i,a){const o=this.w;if(null===t[s][i]&&o.config.markers.showNullDataPoints||1===t[s].length){let t=this.strokeWidth-o.config.markers.strokeWidth/2;t>0||(t=0);const s=this.markers.plotChartMarkers({pointsPos:e,seriesIndex:a,j:i+1,pSize:t,alwaysDrawMarker:!0});null!==s&&this.elPointsMain.add(s)}}}class Ke{constructor(t){this.w=t}drawYAxisTexts(t,e,s,i){const a=this.w,o=a.config.yaxis[0],r=a.formatters.yLabelFormatters[0];return new N(this.w).drawText({x:t+o.labels.offsetX,y:e+o.labels.offsetY,text:r(i,s),textAnchor:"middle",fontSize:o.labels.style.fontSize,fontFamily:o.labels.style.fontFamily,foreColor:Array.isArray(o.labels.style.colors)?o.labels.style.colors[s]:o.labels.style.colors})}}class Je{constructor(t,e){this.ctx=e,this.w=t,this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=void 0!==t.globals.stroke.colors?t.globals.stroke.colors:t.globals.colors,this.defaultSize=Math.min(t.layout.gridWidth,t.layout.gridHeight),this.centerY=this.defaultSize/2,this.centerX=t.layout.gridWidth/2,"radialBar"===t.config.chart.type?this.fullAngle=360:this.fullAngle=Math.abs(t.config.plotOptions.pie.endAngle-t.config.plotOptions.pie.startAngle),this.initialAngle=t.config.plotOptions.pie.startAngle%this.fullAngle,t.globals.radialSize=this.defaultSize/2.05-t.config.stroke.width-(t.config.chart.sparkline.enabled?0:t.config.chart.dropShadow.blur),this.donutSize=t.globals.radialSize*parseInt(t.config.plotOptions.pie.donut.size,10)/100;const s=t.config.plotOptions.pie.customScale,i=t.layout.gridWidth/2,a=t.layout.gridHeight/2;this.translateX=i-i*s,this.translateY=a-a*s,this.dataLabelsGroup=new N(this.w).group({class:"apexcharts-datalabels-group",transform:`translate(${this.translateX}, ${this.translateY}) scale(${s})`}),this.maxY=0,this.sliceLabels=[],this.sliceSizes=[],this.prevSectorAngleArr=[]}draw(t){var e;const s=this.w,i=new N(this.w),a=i.group({class:"apexcharts-pie"});if(s.globals.noData)return a;let o=0;for(let e=0;e<t.length;e++)o+=m.negToZero(t[e]);const r=[],n=i.group();0===o&&(o=1e-5),t.forEach(t=>{this.maxY=Math.max(this.maxY,t)}),s.config.yaxis[0].max&&(this.maxY=s.config.yaxis[0].max),"back"===s.config.grid.position&&"polarArea"===this.chartType&&this.drawPolarElements(a);for(let e=0;e<t.length;e++){const i=this.fullAngle*m.negToZero(t[e])/o;r.push(i),"polarArea"===this.chartType?(r[e]=this.fullAngle/t.length,this.sliceSizes.push(s.globals.radialSize*t[e]/this.maxY)):this.sliceSizes.push(s.globals.radialSize)}const l=!0===(null==(e=this.ctx.morphTypeChange)?void 0:e.isActive());if(s.globals.dataChanged&&!l){let t,e=0;for(let t=0;t<s.globals.previousPaths.length;t++)e+=m.negToZero(s.globals.previousPaths[t]);for(let i=0;i<s.globals.previousPaths.length;i++)t=this.fullAngle*m.negToZero(s.globals.previousPaths[i])/e,this.prevSectorAngleArr.push(t)}if(this.donutSize<0&&(this.donutSize=0),"donut"===this.chartType){const t=i.drawCircle(this.donutSize);t.attr({cx:this.centerX,cy:this.centerY,fill:s.config.plotOptions.pie.donut.background?s.config.plotOptions.pie.donut.background:"transparent"}),n.add(t)}const h=this.drawArcs(r,t);if(this.sliceLabels.forEach(t=>{h.add(t)}),n.attr({transform:`translate(${this.translateX}, ${this.translateY}) scale(${s.config.plotOptions.pie.customScale})`}),n.add(h),a.add(n),this.donutDataLabels.show){const t=this.initialAnim&&!s.globals.resized&&!s.globals.dataChanged&&this.animDur>0,e=this.renderInnerDataLabels(this.dataLabelsGroup,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:t?0:this.donutDataLabels.show});if(t){const t=this.dataLabelsGroup.node;t.style.transition="opacity 280ms ease-out",setTimeout(()=>{t.style.opacity="1"},this.animDur)}a.add(e)}return"front"===s.config.grid.position&&"polarArea"===this.chartType&&this.drawPolarElements(a),a}drawArcs(t,e){var s,i;const a=this.w,o=new H(this.w),r=new N(this.w),n=new G(this.w),l=r.group({class:"apexcharts-slices"});let h=this.initialAngle,c=this.initialAngle,d=this.initialAngle,g=this.initialAngle;this.strokeWidth=a.config.stroke.show?a.config.stroke.width:0;const p=!0===(null==(s=this.ctx.morphTypeChange)?void 0:s.isActive());for(let s=0;s<t.length;s++){const u=r.group({class:"apexcharts-series apexcharts-pie-series",seriesName:m.escapeString(a.seriesData.seriesNames[s]),rel:s+1,"data:realIndex":s});l.add(u),h=d,c=g,d=h+t[s],g=c+this.prevSectorAngleArr[s];const x=d<h?this.fullAngle+d-h:d-h,f=n.fillPath({seriesNumber:s,size:this.sliceSizes[s],value:e[s]}),b=p?this.ctx.morphTypeChange.getInitialPathFor(s,0):null,y=b||this.getChangedPath(c,g),w=r.drawPath({d:y,stroke:Array.isArray(this.lineColorArr)?null!=(i=this.lineColorArr[s])?i:this.lineColorArr[s%this.lineColorArr.length]:this.lineColorArr,strokeWidth:0,fill:f,fillOpacity:a.config.fill.opacity,classes:`apexcharts-pie-area apexcharts-${this.chartType.toLowerCase()}-slice-${s}`});if(w.attr({index:0,j:s}),o.setSelectionFilter(w,0,s),a.config.chart.dropShadow.enabled){const t=a.config.chart.dropShadow;o.dropShadow(w,t,s)}this.addListeners(w,this.donutDataLabels);let v={x:0,y:0};const A=(h+x/2)%this.fullAngle;let C={x:this.centerX,y:this.centerY};"pie"===this.chartType||"polarArea"===this.chartType?(v=m.polarToCartesian(this.centerX,this.centerY,a.globals.radialSize/1.25+a.config.plotOptions.pie.dataLabels.offset,A),C=m.polarToCartesian(this.centerX,this.centerY,a.globals.radialSize/2,A)):"donut"===this.chartType&&(v=m.polarToCartesian(this.centerX,this.centerY,(a.globals.radialSize+this.donutSize)/2+a.config.plotOptions.pie.dataLabels.offset,A),C=m.polarToCartesian(this.centerX,this.centerY,(a.globals.radialSize+this.donutSize)/2,A)),N.setAttrs(w.node,{"data:angle":x,"data:startAngle":h,"data:strokeWidth":this.strokeWidth,"data:value":e[s],"data:cx":C.x,"data:cy":C.y}),u.add(w);let S=0;if(!this.initialAnim||a.globals.resized||a.globals.dataChanged?this.animBeginArr.push(0):(S=x/this.fullAngle*a.config.chart.animations.speed,0===S&&(S=1),this.animDur=S+this.animDur,this.animBeginArr.push(this.animDur)),p&&b){const t=this.getPiePath({me:this,startAngle:h,angle:x,size:this.sliceSizes[s]}),e=this.ctx.morphTypeChange.getSpeed();w.node.setAttribute("data:pathOrig",t),w.animate(e).plot(t,"polygons").attr({"stroke-width":this.strokeWidth})}else this.dynamicAnim&&a.globals.dataChanged?this.animatePaths(w,{size:this.sliceSizes[s],endAngle:d,startAngle:h,prevStartAngle:c,prevEndAngle:g,animateStartingPos:!0,i:s,animBeginArr:this.animBeginArr,shouldSetPrevPaths:!0,dur:a.config.chart.animations.dynamicAnimation.speed}):this.animatePaths(w,{size:this.sliceSizes[s],endAngle:d,startAngle:h,i:s,totalItems:t.length-1,animBeginArr:this.animBeginArr,dur:S});if(a.config.plotOptions.pie.expandOnClick&&"polarArea"!==this.chartType&&w.node.addEventListener("mouseup",this.pieClicked.bind(this,s)),void 0!==a.interact.selectedDataPoints[0]&&a.interact.selectedDataPoints[0].indexOf(s)>-1)if(this.initialAnim&&!a.globals.resized&&!a.globals.dataChanged&&this.animDur>0){const t=this,e=s;setTimeout(()=>t.pieClicked(e),this.animDur)}else this.pieClicked(s);if(a.config.dataLabels.enabled){const e=v.x,i=v.y;let n=100*x/this.fullAngle+"%";if(0!==x&&a.config.plotOptions.pie.dataLabels.minAngleToShowLabel<t[s]){const t=a.config.dataLabels.formatter;void 0!==t&&(n=t(a.globals.seriesPercent[s][0],{seriesIndex:s,w:a}));const l=a.globals.dataLabels.style.colors[s],h=r.group({class:"apexcharts-datalabels"}),c=r.drawText({x:e,y:i,text:n,textAnchor:"middle",fontSize:a.config.dataLabels.style.fontSize,fontFamily:a.config.dataLabels.style.fontFamily,fontWeight:a.config.dataLabels.style.fontWeight,foreColor:l});if(h.add(c),a.config.dataLabels.dropShadow.enabled){const t=a.config.dataLabels.dropShadow;o.dropShadow(c,t)}c.node.classList.add("apexcharts-pie-label"),a.config.chart.animations.animate&&!1===a.globals.resized&&(c.node.classList.add("apexcharts-pie-label-delay"),c.node.style.animationDelay=a.config.chart.animations.speed/940+"s"),this.sliceLabels.push(h)}}}return l}addListeners(t,e){const s=new N(this.w);t.node.addEventListener("mouseenter",s.pathMouseEnter.bind(this,t)),t.node.addEventListener("mouseleave",s.pathMouseLeave.bind(this,t)),t.node.addEventListener("mouseleave",this.revertDataLabelsInner.bind(this)),t.node.addEventListener("mousedown",s.pathMouseDown.bind(this,t)),this.donutDataLabels.total.showAlways||(t.node.addEventListener("mouseenter",this.printDataLabelsInner.bind(this,t.node,e)),t.node.addEventListener("mousedown",this.printDataLabelsInner.bind(this,t.node,e)))}animatePaths(t,e){const s=this.w;let i=e.endAngle<e.startAngle?this.fullAngle+e.endAngle-e.startAngle:e.endAngle-e.startAngle,a=i,o=e.startAngle;const r=e.startAngle;void 0!==e.prevStartAngle&&void 0!==e.prevEndAngle&&(o=e.prevEndAngle,a=e.prevEndAngle<e.prevStartAngle?this.fullAngle+e.prevEndAngle-e.prevStartAngle:e.prevEndAngle-e.prevStartAngle),e.i===s.config.series.length-1&&(i+r>this.fullAngle?e.endAngle=e.endAngle-(i+r):i+r<this.fullAngle&&(e.endAngle=e.endAngle+(this.fullAngle-(i+r)))),i===this.fullAngle&&(i=this.fullAngle-.01),this.animateArc(t,o,r,i,a,e)}animateArc(t,e,s,i,a,o){const r=this,n=this.w,l=new B(this.w),h=o.size;let c;(isNaN(e)||isNaN(a))&&(e=s,a=i,o.dur=0);let d=i,g=s;const p=e<s?this.fullAngle+e-s:e-s;n.globals.dataChanged&&o.shouldSetPrevPaths&&o.prevEndAngle&&(c=r.getPiePath({me:r,startAngle:o.prevStartAngle,angle:o.prevEndAngle<o.prevStartAngle?this.fullAngle+o.prevEndAngle-o.prevStartAngle:o.prevEndAngle-o.prevStartAngle,size:h}),t.attr({d:c})),0!==o.dur?t.animate(o.dur,o.animBeginArr[o.i]).after(function(){"pie"!==r.chartType&&"donut"!==r.chartType&&"polarArea"!==r.chartType||this.animate(n.config.chart.animations.dynamicAnimation.speed).attr({"stroke-width":r.strokeWidth}),o.i===n.config.series.length-1&&l.animationCompleted(t)}).during(n=>{d=p+(i-p)*n,o.animateStartingPos&&(d=a+(i-a)*n,g=e-a+(s-(e-a))*n),c=r.getPiePath({me:r,startAngle:g,angle:d,size:h}),t.node.setAttribute("data:pathOrig",c),t.attr({d:c})}):(c=r.getPiePath({me:r,startAngle:g,angle:i,size:h}),o.isTrack||(n.globals.animationEnded=!0),t.node.setAttribute("data:pathOrig",c),t.attr({d:c,"stroke-width":r.strokeWidth}))}pieClicked(t){const e=this.w,s=this,i=s.sliceSizes[t]+(e.config.plotOptions.pie.expandOnClick?4:0),a=e.dom.Paper.findOne(`.apexcharts-${s.chartType.toLowerCase()}-slice-${t}`);if("true"===a.attr("data:pieClicked")){a.attr({"data:pieClicked":"false"}),this.revertDataLabelsInner();const t=a.attr("data:pathOrig");return void a.attr({d:t})}{const s=e.dom.baseEl.getElementsByClassName("apexcharts-pie-area");Array.prototype.forEach.call(s,t=>{t.setAttribute("data:pieClicked","false");const e=t.getAttribute("data:pathOrig");e&&t.setAttribute("d",e)}),e.interact.capturedDataPointIndex=t,a.attr("data:pieClicked","true")}const o=parseInt(a.attr("data:startAngle"),10),r=parseInt(a.attr("data:angle"),10),n=s.getPiePath({me:s,startAngle:o,angle:r,size:i});360!==r&&a.plot(n)}getChangedPath(t,e){let s="";return this.dynamicAnim&&this.w.globals.dataChanged&&(s=this.getPiePath({me:this,startAngle:t,angle:e-t,size:this.size})),s}getPiePath({me:t,startAngle:e,angle:s,size:i}){let a;const o=new N(this.w),r=e,n=Math.PI*(r-90)/180;let l=s+e;Math.ceil(l)>=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(l=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(l)>this.fullAngle&&(l-=this.fullAngle);const h=Math.PI*(l-90)/180,c=t.centerX+i*Math.cos(n),d=t.centerY+i*Math.sin(n),g=t.centerX+i*Math.cos(h),p=t.centerY+i*Math.sin(h),u=m.polarToCartesian(t.centerX,t.centerY,t.donutSize,l),x=m.polarToCartesian(t.centerX,t.centerY,t.donutSize,r),f=s>180?1:0,b=["M",c,d,"A",i,i,0,f,1,g,p];return a="donut"===t.chartType?[...b,"L",u.x,u.y,"A",t.donutSize,t.donutSize,0,f,0,x.x,x.y,"L",c,d,"z"].join(" "):"pie"===t.chartType||"polarArea"===t.chartType?[...b,"L",t.centerX,t.centerY,"L",c,d].join(" "):[...b].join(" "),o.roundPathCorners(a,2*this.strokeWidth)}drawPolarElements(t){const e=this.w,s=new Q(this.w),i=new N(this.w),a=new Ke(this.w),o=i.group(),r=i.group(),n=s.niceScale(0,Math.ceil(this.maxY),0),l=n.result.reverse(),h=n.result.length;this.maxY=n.niceMax;let c=e.globals.radialSize;const d=c/(h-1);for(let t=0;t<h-1;t++){const s=i.drawCircle(c);if(s.attr({cx:this.centerX,cy:this.centerY,fill:"none","stroke-width":e.config.plotOptions.polarArea.rings.strokeWidth,stroke:e.config.plotOptions.polarArea.rings.strokeColor}),e.config.yaxis[0].show){const s=a.drawYAxisTexts(this.centerX,this.centerY-c+parseInt(e.config.yaxis[0].labels.style.fontSize,10)/2,t,l[t]);r.add(s)}o.add(s),c-=d}this.drawSpokes(t),t.add(o),t.add(r)}renderInnerDataLabels(t,e,s){const i=this.w,a=new N(this.w),o=e.total.show;t.node.innerHTML="",t.node.style.opacity=s.opacity;const r=s.centerX,n=this.donutDataLabels.total.label?s.centerY:s.centerY-s.centerY/6;let l,h;l=void 0===e.name.color?i.globals.colors[0]:e.name.color;let c=e.name.fontSize,d=e.name.fontFamily,g=e.name.fontWeight;h=void 0===e.value.color?i.config.chart.foreColor:e.value.color;const p=e.value.formatter;let u="",x="";if(o?(l=e.total.color,c=e.total.fontSize,d=e.total.fontFamily,g=e.total.fontWeight,x=this.donutDataLabels.total.label?e.total.label:"",u=e.total.formatter(i)):1===i.seriesData.series.length&&(u=p(i.seriesData.series[0],i),x=i.seriesData.seriesNames[0]),x&&(x=e.name.formatter(x,e.total.show,i)),e.name.show){const s=a.drawText({x:r,y:n+parseFloat(e.name.offsetY),text:x,textAnchor:"middle",foreColor:l,fontSize:c,fontWeight:g,fontFamily:d});s.node.classList.add("apexcharts-datalabel-label"),t.add(s)}if(e.value.show){const s=e.name.show?parseFloat(e.value.offsetY)+16:e.value.offsetY,i=a.drawText({x:r,y:n+s,text:u,textAnchor:"middle",foreColor:h,fontWeight:e.value.fontWeight,fontSize:e.value.fontSize,fontFamily:e.value.fontFamily});i.node.classList.add("apexcharts-datalabel-value"),t.add(i)}return t}printInnerLabels(t,e,s,i){const a=this.w;let o;i?o=void 0===t.name.color?a.globals.colors[parseInt(i.parentNode.getAttribute("rel"),10)-1]:t.name.color:a.seriesData.series.length>1&&t.total.show&&(o=t.total.color);const r=a.dom.baseEl.querySelector(".apexcharts-datalabel-label"),n=a.dom.baseEl.querySelector(".apexcharts-datalabel-value");s=(0,t.value.formatter)(s,a),i||"function"!=typeof t.total.formatter||(s=t.total.formatter(a));const l=e===t.total.label;if(e=this.donutDataLabels.total.label?t.name.formatter(e,l,a):"",null!==r&&(r.textContent=e),null!==n&&(n.textContent=s),null!==r){r.style.fill=o}}printDataLabelsInner(t,e){const s=this.w,i=t.getAttribute("data:value"),a=s.seriesData.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];s.seriesData.series.length>1&&this.printInnerLabels(e,a,i,t);const o=s.dom.baseEl.querySelector(".apexcharts-datalabels-group");if(null!==o){o.style.opacity="1"}}drawSpokes(t){const e=this.w,s=new N(this.w),i=e.config.plotOptions.polarArea.spokes;if(0===i.strokeWidth)return;const a=[],o=360/e.seriesData.series.length;for(let t=0;t<e.seriesData.series.length;t++)a.push(m.polarToCartesian(this.centerX,this.centerY,e.globals.radialSize,e.config.plotOptions.pie.startAngle+o*t));a.forEach((e,a)=>{const o=s.drawLine(e.x,e.y,this.centerX,this.centerY,Array.isArray(i.connectorColors)?i.connectorColors[a]:i.connectorColors);t.add(o)})}revertDataLabelsInner(){const t=this.w;if(this.donutDataLabels.show){const e=t.dom.Paper.findOne(".apexcharts-datalabels-group"),s=this.renderInnerDataLabels(e,this.donutDataLabels,{hollowSize:this.donutSize,centerX:this.centerX,centerY:this.centerY,opacity:this.donutDataLabels.show});t.dom.Paper.findOne(".apexcharts-radialbar, .apexcharts-pie").add(s)}}}function Qe(t,e){let s=0;for(let e=0;e<t.length;e++)s+=t[e];const i=e/s,a=new Array(t.length);for(let e=0;e<t.length;e++)a[e]=t[e]*i;return a}function ts(t,e,s,i){const a=i*i,o=s*s;return Math.max(a*e/o,o/(a*t))}function es(t,e,s,i,a,o){if(0===t)return!0;return ts(e,s,i,o)>=ts(Math.min(e,a),Math.max(s,a),i+a,o)}function ss(t,e,s,i,a,o,r,n){if(r>=n){const r=i/n;let l=o;for(let i=0;i<s;i++){const s=e[i]/r;t.push([a,l,a+r,l+s]),l+=s}}else{const n=i/r;let l=a;for(let i=0;i<s;i++){const s=e[i]/n;t.push([l,o,l+s,o+n]),l+=s}}}function is(t,e,s,i,a){const o=[],r=t.length;if(0===r)return o;const n=new Array(r);let l=0,h=0,c=1/0,d=-1/0,g=0;for(;g<r;){const r=Math.min(i,a),p=t[g];if(es(l,c,d,h,p,r))n[l]=p,l++,h+=p,p<c&&(c=p),p>d&&(d=p),g++;else{if(ss(o,n,l,h,e,s,i,a),i>=a){const t=h/a;e+=t,i-=t}else{const t=h/i;s+=t,a-=t}l=0,h=0,c=1/0,d=-1/0}}return l>0&&ss(o,n,l,h,e,s,i,a),o}const as={generate:function(t,e,s){const i=t.length,a=new Array(i);for(let e=0;e<i;e++){let s=0;const i=t[e];for(let t=0;t<i.length;t++)s+=i[t];a[e]=s}const o=is(Qe(a,e*s),0,0,e,s),r=new Array(i);for(let e=0;e<i;e++){const s=o[e],i=s[0],a=s[1],n=s[2]-i,l=s[3]-a;r[e]=is(Qe(t[e],n*l),i,a,n,l)}return r}};return me.use({line:Ze,area:Ze,scatter:Ze,bubble:Ze,rangeArea:Ze,bar:Xe,column:Xe,barStacked:class extends Xe{draw(t,e){const s=this.w;this.graphics=new N(this.w),this.bar=new Xe(this.w,this.ctx,this.xyRatios);const i=new F(this.w);t=i.getLogSeries(t),this.yRatio=i.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t),"100%"===s.config.chart.stackType&&(t=s.globals.comboCharts?e.map(t=>s.globals.seriesPercent[t]):s.globals.seriesPercent.slice()),this.series=t,this.barHelpers.initializeStackedPrevVars(this);const a=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"});let o=0,r=0;for(let i=0,h=0;i<t.length;i++,h++){const c=s.globals.comboCharts?e[i]:i,{groupIndex:d,columnGroupIndex:g}=this.barHelpers.getGroupIndex(c);this.groupCtx=this[s.labelData.seriesGroups[d]];const p=[],u=[];let x=0;this.yRatio.length>1&&(this.yaxisIndex=s.globals.seriesYAxisReverseMap[c][0],x=c),this.isReversed=s.config.yaxis[this.yaxisIndex]&&s.config.yaxis[this.yaxisIndex].reversed;let f=this.graphics.group({class:"apexcharts-series",seriesName:m.escapeString(s.seriesData.seriesNames[c]),rel:i+1,"data:realIndex":c});lt.addCollapsedClassToSeries(this.w,f,c);const b=this.graphics.group({class:"apexcharts-datalabels","data:realIndex":c}),y=this.graphics.group({class:"apexcharts-bar-goals-markers"}),w=this.initialPositions(o,r,void 0,void 0,void 0,void 0,x),{xDivision:v,yDivision:A,zeroH:C,zeroW:S}=w;let k=w.barHeight,D=w.barWidth;r=w.y,o=w.x,s.globals.barHeight=k,s.globals.barWidth=D,this.barHelpers.initializeStackedXYVars(this),1===this.groupCtx.prevY.length&&this.groupCtx.prevY[0].every(t=>isNaN(t))&&(this.groupCtx.prevY[0]=this.groupCtx.prevY[0].map(()=>C),this.groupCtx.prevYF[0]=this.groupCtx.prevYF[0].map(()=>0));for(let e=0;e<s.globals.dataPoints;e++){const a=this.barHelpers.getStrokeWidth(i,e,c),m={indexes:{i:i,j:e,realIndex:c,translationsIndex:x,bc:h},strokeWidth:a,x:o,y:r,elSeries:f,columnGroupIndex:g,seriesGroup:s.labelData.seriesGroups[d]};let w=null;this.isHorizontal?(w=this.drawStackedBarPaths(l(n({},m),{zeroW:S,barHeight:k,yDivision:A})),D=this.series[i][e]/this.invertedYRatio):(w=this.drawStackedColumnPaths(l(n({},m),{xDivision:v,barWidth:D,zeroH:C})),k=this.series[i][e]/this.yRatio[x]);const L=this.barHelpers.drawGoalLine({barXPosition:w.barXPosition,barYPosition:w.barYPosition,goalX:w.goalX,goalY:w.goalY,barHeight:k,barWidth:D});L&&y.add(L),r=w.y,o=w.x,p.push(o),u.push(r);const M=this.barHelpers.getPathFillColor(t,i,e,c);let P="";const T=s.globals.isBarHorizontal?"apexcharts-flip-x":"apexcharts-flip-y";("bottom"===this.barHelpers.arrBorderRadius[c][e]&&s.seriesData.series[c][e]>0||"top"===this.barHelpers.arrBorderRadius[c][e]&&s.seriesData.series[c][e]<0)&&(P=T),f=this.renderSeries(l(n({realIndex:c,pathFill:M.color},M.useRangeColor?{lineFill:M.color}:{}),{j:e,i:i,columnGroupIndex:g,pathFrom:w.pathFrom,pathTo:w.pathTo,strokeWidth:a,elSeries:f,x:o,y:r,series:t,barHeight:k,barWidth:D,elDataLabelsWrap:b,elGoalsMarkers:y,type:"bar",visibleSeries:g,classes:P}))}s.globals.seriesXvalues[c]=p,s.globals.seriesYvalues[c]=u,this.groupCtx.prevY.push(this.groupCtx.yArrj),this.groupCtx.prevYF.push(this.groupCtx.yArrjF),this.groupCtx.prevYVal.push(this.groupCtx.yArrjVal),this.groupCtx.prevX.push(this.groupCtx.xArrj),this.groupCtx.prevXF.push(this.groupCtx.xArrjF),this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal),a.add(f)}return a}initialPositions(t,e,s,i,a,o,r){const n=this.w;let l,h;if(this.isHorizontal){i=n.layout.gridHeight/n.globals.dataPoints;const t=n.config.plotOptions.bar.barHeight;l=-1===String(t).indexOf("%")?parseInt(t,10):i*parseInt(t,10)/100,o=n.globals.padHorizontal+(this.isReversed?n.layout.gridWidth-this.baseLineInvertedY:this.baseLineInvertedY),e=(i-l)/2}else{h=s=n.layout.gridWidth/n.globals.dataPoints;const e=n.config.plotOptions.bar.columnWidth;n.axisFlags.isXNumeric&&n.globals.dataPoints>1?h=(s=n.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:-1===String(e).indexOf("%")?h=parseInt(e,10):h*=parseInt(e,10)/100,a=this.isReversed?this.baseLineY[r]:n.layout.gridHeight-this.baseLineY[r],t=n.globals.padHorizontal+(s-h)/2}const c=n.globals.barGroups.length||1;return{x:t,y:e,yDivision:i,xDivision:s,barHeight:(null!=l?l:0)/c,barWidth:(null!=h?h:0)/c,zeroH:a,zeroW:o}}drawStackedBarPaths({indexes:t,barHeight:e,strokeWidth:s,zeroW:i,x:a,y:o,columnGroupIndex:r,seriesGroup:n,yDivision:l,elSeries:h}){var c,d,g,p,u;const x=this.w,f=o+r*e;let b;const m=t.i,y=t.j,w=t.realIndex,v=t.translationsIndex;let A=0;for(let t=0;t<this.groupCtx.prevXF.length;t++)A+=this.groupCtx.prevXF[t][y];let C=m;if(x.config.series[w].name&&(C=n.indexOf(x.config.series[w].name)),C>0){let t=i;this.groupCtx.prevXVal[C-1][y]<0?t=(null==(c=this.series[m])?void 0:c[y])>=0?this.groupCtx.prevX[C-1][y]+A-2*(this.isReversed?A:0):this.groupCtx.prevX[C-1][y]:this.groupCtx.prevXVal[C-1][y]>=0&&(t=(null==(d=this.series[m])?void 0:d[y])>=0?this.groupCtx.prevX[C-1][y]:this.groupCtx.prevX[C-1][y]-A+2*(this.isReversed?A:0)),b=t}else b=i;a=null===(null==(g=this.series[m])?void 0:g[y])?b:b+(null==(p=this.series[m])?void 0:p[y])/this.invertedYRatio-2*(this.isReversed?(null==(u=this.series[m])?void 0:u[y])/this.invertedYRatio:0);const S=this.barHelpers.getBarpaths({barYPosition:f,barHeight:e,x1:b,x2:a,strokeWidth:s,isReversed:this.isReversed,series:this.series,realIndex:t.realIndex,seriesGroup:n,i:m,j:y,w:x});return this.barHelpers.barBackground({j:y,i:m,y1:f,y2:e,elSeries:h}),o+=l,{pathTo:S.pathTo,pathFrom:S.pathFrom,goalX:this.barHelpers.getGoalValues("x",i,null,m,y,v),barXPosition:b,barYPosition:f,x:a,y:o}}drawStackedColumnPaths({indexes:t,x:e,y:s,xDivision:i,barWidth:a,zeroH:o,columnGroupIndex:r,seriesGroup:n,elSeries:l}){var h,c,d,g,p,u,x,f,b;const m=this.w,y=t.i,w=t.j,v=t.bc,A=t.realIndex,C=t.translationsIndex;if(m.axisFlags.isXNumeric){let t=m.seriesData.seriesX[A][w];t||(t=0),e=(t-m.globals.minX)/this.xRatio-a/2*m.globals.barGroups.length}const S=e+r*a;let k,D=0;for(let t=0;t<this.groupCtx.prevYF.length;t++)D+=isNaN(this.groupCtx.prevYF[t][w])?0:this.groupCtx.prevYF[t][w];let L=y;if(n&&(L=n.indexOf(m.seriesData.seriesNames[A])),L>0&&!m.axisFlags.isXNumeric||L>0&&m.axisFlags.isXNumeric&&m.seriesData.seriesX[A-1][w]===m.seriesData.seriesX[A][w]){let t,e;const s=Math.min(this.yRatio.length+1,A+1);if(void 0!==this.groupCtx.prevY[L-1]&&this.groupCtx.prevY[L-1].length)for(let t=1;t<s;t++)if(!isNaN(null==(h=this.groupCtx.prevY[L-t])?void 0:h[w])){e=this.groupCtx.prevY[L-t][w];break}for(let i=1;i<s;i++){if((null==(c=this.groupCtx.prevYVal[L-i])?void 0:c[w])<0){t=(null==(d=this.series[y])?void 0:d[w])>=0?e-D+2*(this.isReversed?D:0):e;break}if((null==(g=this.groupCtx.prevYVal[L-i])?void 0:g[w])>=0){t=(null==(p=this.series[y])?void 0:p[w])>=0?e:e+D-2*(this.isReversed?D:0);break}}void 0===t&&(t=m.layout.gridHeight),k=(null==(u=this.groupCtx.prevYF[0])?void 0:u.every(t=>0===t))&&this.groupCtx.prevYF.slice(1,L).every(t=>t.every(t=>isNaN(t)))?o:t}else k=o;s=(null==(x=this.series[y])?void 0:x[w])?k-(null==(f=this.series[y])?void 0:f[w])/this.yRatio[C]+2*(this.isReversed?(null==(b=this.series[y])?void 0:b[w])/this.yRatio[C]:0):k;const M=this.barHelpers.getColumnPaths({barXPosition:S,barWidth:a,y1:k,y2:s,yRatio:this.yRatio[C],strokeWidth:this.strokeWidth,isReversed:this.isReversed,series:this.series,seriesGroup:n,realIndex:t.realIndex,i:y,j:w,w:m});return this.barHelpers.barBackground({bc:v,j:w,i:y,x1:S,x2:a,elSeries:l}),{pathTo:M.pathTo,pathFrom:M.pathFrom,goalY:this.barHelpers.getGoalValues("y",null,o,y,w,0),barXPosition:S,x:m.axisFlags.isXNumeric?e:e+i,y:s}}},rangeBar:class extends Xe{draw(t,e){var s,i,a,o,r,l,h,c,d;const g=this.w,p=new N(this.w);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=t,this.seriesRangeStart=g.rangeData.seriesRangeStart,this.seriesRangeEnd=g.rangeData.seriesRangeEnd,this.barHelpers.initVariables(t);const u=p.group({class:"apexcharts-rangebar-series apexcharts-plot-series"});for(let x=0;x<t.length;x++){let f,b;const y=g.globals.comboCharts?e[x]:x,{columnGroupIndex:w}=this.barHelpers.getGroupIndex(y),v=p.group({class:"apexcharts-series",seriesName:m.escapeString(g.seriesData.seriesNames[y]),rel:x+1,"data:realIndex":y});lt.addCollapsedClassToSeries(this.w,v,y),t[x].length>0&&(this.visibleI=this.visibleI+1);let A=0;this.yRatio.length>1&&(this.yaxisIndex=g.globals.seriesYAxisReverseMap[y][0],A=y);const C=this.barHelpers.initialPositions(y),{y:S,zeroW:k,x:D,zeroH:L}=C;let M=null!=(s=C.barWidth)?s:0,P=null!=(i=C.barHeight)?i:0;const T=null!=(a=C.yDivision)?a:0,F=null!=(o=C.xDivision)?o:0;b=S,f=D;const E=p.group({class:"apexcharts-datalabels","data:realIndex":y}),I=p.group({class:"apexcharts-rangebar-goals-markers"});for(let e=0;e<g.globals.dataPoints;e++){const s=this.barHelpers.getStrokeWidth(x,e,y),i=this.seriesRangeStart[x][e],a=this.seriesRangeEnd[x][e];let o=null,p=null,u=null;const m={x:f,y:b,strokeWidth:s,elSeries:v};let S=this.seriesLen;if(g.config.plotOptions.bar.rangeBarGroupRows&&(S=1),void 0===(null==(r=g.config.series[x].data)?void 0:r[e]))break;if(this.isHorizontal){u=b+P*this.visibleI;const t=(T-P*S)/2;if(null==(h=null==(l=g.config.series[x].data)?void 0:l[e])?void 0:h.x){const s=this.detectOverlappingBars({i:x,j:e,barYPosition:u,srty:t,barHeight:P,yDivision:T,initPositions:C});P=s.barHeight,u=s.barYPosition}o=this.drawRangeBarPaths(n({indexes:{i:x,j:e,realIndex:y},barHeight:P,barYPosition:u,zeroW:k,yDivision:T,y1:i,y2:a},m)),M=o.barWidth}else{g.axisFlags.isXNumeric&&(f=(g.seriesData.seriesX[x][e]-g.globals.minX)/this.xRatio-M/2),p=f+M*this.visibleI;const t=(F-M*S)/2;if(null==(d=null==(c=g.config.series[x].data)?void 0:c[e])?void 0:d.x){const s=this.detectOverlappingBars({i:x,j:e,barXPosition:p,srtx:t,barWidth:M,xDivision:F,initPositions:C});M=s.barWidth,p=s.barXPosition}o=this.drawRangeColumnPaths(n({indexes:{i:x,j:e,realIndex:y,translationsIndex:A},barWidth:M,barXPosition:p,zeroH:L,xDivision:F},m)),P=o.barHeight}const D=this.barHelpers.drawGoalLine({barXPosition:o.barXPosition,barYPosition:u,goalX:o.goalX,goalY:o.goalY,barHeight:P,barWidth:M});D&&I.add(D),b=o.y,f=o.x;const X=this.barHelpers.getPathFillColor(t,x,e,y);this.renderSeries({realIndex:y,pathFill:X.color,lineFill:X.useRangeColor?X.color:g.globals.stroke.colors[y],j:e,i:x,x:f,y:b,y1:i,y2:a,pathFrom:o.pathFrom,pathTo:o.pathTo,strokeWidth:s,elSeries:v,series:t,barHeight:P,barWidth:M,barXPosition:p,barYPosition:u,columnGroupIndex:w,elDataLabelsWrap:E,elGoalsMarkers:I,visibleSeries:this.visibleI,type:"rangebar"})}u.add(v)}return u}detectOverlappingBars({i:t,j:e,barYPosition:s,barXPosition:i,srty:a,srtx:o,barHeight:r,barWidth:n,yDivision:l,xDivision:h,initPositions:c}){var d,g,p,u;const x=this.w;let f=[];const b=null==(g=null==(d=x.config.series[t].data)?void 0:d[e])?void 0:g.rangeName,m=null==(u=null==(p=x.config.series[t].data)?void 0:p[e])?void 0:u.x,y=Array.isArray(m)?m.join(" "):m,w=x.labelData.labels.map(t=>Array.isArray(t)?t.join(" "):t).indexOf(y),v=x.rangeData.seriesRange[t].findIndex(t=>{var e;return t.x===y&&(null==(e=t.overlaps)?void 0:e.size)>0});return this.isHorizontal?(s=x.config.plotOptions.bar.rangeBarGroupRows?a+l*w:a+r*this.visibleI+l*w,v>-1&&!x.config.plotOptions.bar.rangeBarOverlap&&(f=Array.from(x.rangeData.seriesRange[t][v].overlaps),f.indexOf(b)>-1&&(s=(r=c.barHeight/f.length)*this.visibleI+l*(100-parseInt(this.barOptions.barHeight,10))/100/2+r*(this.visibleI+f.indexOf(b))+l*w))):(w>-1&&!x.labelData.timescaleLabels.length&&(i=x.config.plotOptions.bar.rangeBarGroupRows?o+h*w:o+n*this.visibleI+h*w),v>-1&&!x.config.plotOptions.bar.rangeBarOverlap&&(f=Array.from(x.rangeData.seriesRange[t][v].overlaps),f.indexOf(b)>-1&&(i=(n=c.barWidth/f.length)*this.visibleI+h*(100-parseInt(this.barOptions.barWidth,10))/100/2+n*(this.visibleI+f.indexOf(b))+h*w))),{barYPosition:s,barXPosition:i,barHeight:r,barWidth:n}}drawRangeColumnPaths({indexes:t,x:e,xDivision:s,barWidth:i,barXPosition:a,zeroH:o}){var r,n;const l=this.w,{i:h,j:c,realIndex:d,translationsIndex:g}=t,p=this.yRatio[g],u=this.getRangeValue(d,c);let x=Math.min(u.start,u.end),f=Math.max(u.start,u.end);void 0===(null==(r=this.series[h])?void 0:r[c])||null===(null==(n=this.series[h])?void 0:n[c])?x=o:(x=o-x/p,f=o-f/p);const b=Math.abs(f-x),m=this.barHelpers.getColumnPaths({barXPosition:a,barWidth:i,y1:x,y2:f,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,realIndex:d,i:d,j:c,w:l});if(l.axisFlags.isXNumeric){const t=this.getBarXForNumericXAxis({x:e,j:c,realIndex:d,barWidth:i});e=t.x,a=t.barXPosition}else e+=s;return{pathTo:m.pathTo,pathFrom:m.pathFrom,barHeight:b,x:e,y:u.start<0&&u.end<0?x:f,goalY:this.barHelpers.getGoalValues("y",null,o,h,c,g),barXPosition:a}}preventBarOverflow(t){const e=this.w;return t<0&&(t=0),t>e.layout.gridWidth&&(t=e.layout.gridWidth),t}drawRangeBarPaths({indexes:t,y:e,y1:s,y2:i,yDivision:a,barHeight:o,barYPosition:r,zeroW:n}){const l=this.w,{realIndex:h,j:c}=t,d=this.preventBarOverflow(n+s/this.invertedYRatio),g=this.preventBarOverflow(n+i/this.invertedYRatio),p=this.getRangeValue(h,c),u=Math.abs(g-d),x=this.barHelpers.getBarpaths({barYPosition:r,barHeight:o,x1:d,x2:g,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:h,realIndex:h,j:c,w:l});return l.axisFlags.isXNumeric||(e+=a),{pathTo:x.pathTo,pathFrom:x.pathFrom,barWidth:u,x:p.start<0&&p.end<0?d:g,goalX:this.barHelpers.getGoalValues("x",n,null,h,c,0),y:e}}getRangeValue(t,e){const s=this.w;return{start:s.rangeData.seriesRangeStart[t][e],end:s.rangeData.seriesRangeEnd[t][e]}}},candlestick:Oe,boxPlot:Oe,violin:class extends Xe{draw(t,e,s){const i=this.w,a=new N(this.w),o=new G(this.w);this.violinOptions=i.config.plotOptions.violin,this.pointsOptions=this.violinOptions.points,this.bandwidthScale=this.violinOptions.bandwidthScale||1,this.normalize=this.violinOptions.normalize||"individual",this.distributed=i.config.plotOptions.bar.distributed,this.isHorizontal=i.config.plotOptions.bar.horizontal,this.coreUtils=new F(this.w),t=this.coreUtils.getLogSeries(t),this.series=t,this.yRatio=this.coreUtils.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);const r=a.group({class:"apexcharts-violin-series apexcharts-plot-series"});for(let e=0;e<t.length;e++){let n,l;const h=[],c=[],d=i.globals.comboCharts?s[e]:e,{columnGroupIndex:g}=this.barHelpers.getGroupIndex(d),p=a.group({class:"apexcharts-series",seriesName:m.escapeString(i.seriesData.seriesNames[d]),rel:e+1,"data:realIndex":d});lt.addCollapsedClassToSeries(this.w,p,d),t[e].length>0&&(this.visibleI=this.visibleI+1);let u=0;this.yRatio.length>1&&(this.yaxisIndex=i.globals.seriesYAxisReverseMap[d][0],u=d);const x=this.barHelpers.initialPositions(d),{y:f,barHeight:b,yDivision:y,zeroW:w,x:v,barWidth:A,xDivision:C,zeroH:S}=x;l=f,n=v,c.push(n+(null!=A?A:0)/2);const k=a.group({class:"apexcharts-datalabels","data:realIndex":d});if(this.seriesMaxWeight=0,"group"===this.normalize){(i.violinData.seriesViolinDensity[d]||[]).forEach(t=>{t&&t.maxWeight>this.seriesMaxWeight&&(this.seriesMaxWeight=t.maxWeight)})}const D=[];for(let s=0;s<i.globals.dataPoints;s++){const a=this.barHelpers.getStrokeWidth(e,s,d),r=this.isHorizontal?this.drawHorizontalViolin({indexes:{i:e,j:s,realIndex:d,translationsIndex:u},y:l,yDivision:y,barHeight:b,zeroW:w}):this.drawVerticalViolin({indexes:{i:e,j:s,realIndex:d,translationsIndex:u},x:n,xDivision:C,barWidth:A,zeroH:S});n=r.x,l=r.y,s>0&&c.push(r.center),h.push(r.alongRepresentative);const x=this.buildPointsSubPath({realIndex:d,j:s,center:r.center,halfExtent:r.halfExtent,alongFn:r.alongFn,density:r.density,maxWeight:r.maxWeight});x.length&&D.push({groups:x,j:s});const f=o.fillPath({seriesNumber:this.distributed?s:d,dataPointIndex:s,color:this.distributed?i.globals.colors[s]:void 0,value:t[e][s]});this.renderSeries({realIndex:d,pathFill:f,lineFill:i.globals.stroke.colors[d],j:s,i:e,pathFrom:r.pathFrom,pathTo:r.pathTo,strokeWidth:a,elSeries:p,x:n,y:l,series:t,columnGroupIndex:g,barHeight:b,barWidth:A,elDataLabelsWrap:k,visibleSeries:this.visibleI,type:"violin"});const m=p.node.querySelector(`path.apexcharts-violin-area[j='${s}']`);m&&isFinite(r.alongRepresentative)&&m.setAttribute(this.isHorizontal?"cx":"cy",`${r.alongRepresentative}`)}ze({graphics:a,w:i,elSeries:p,pointsByCat:D,options:this.pointsOptions,distributed:this.distributed,realIndex:d,wrapClass:"apexcharts-violin-points-wrap",pointClass:"apexcharts-violin-points"}),i.globals.seriesXvalues[d]=c,i.globals.seriesYvalues[d]=h,r.add(p)}return r}drawVerticalViolin({indexes:t,x:e,xDivision:s,barWidth:i,zeroH:a}){var o;const r=this.w,{realIndex:n,j:l,translationsIndex:h}=t,c=this.yRatio[h];r.axisFlags.isXNumeric&&(e=(r.seriesData.seriesX[n][l]-r.globals.minX)/this.xRatio-i/2);const d=e+i*this.visibleI+i/2,g=i/2,p=this.getDensity(n,l),u=this.effectiveMaxWeight(p),x=t=>a-this.logVal(t,n)/c,f=this.buildBodyPath({nodes:p.nodes,center:d,halfExtent:g,maxWeight:u,vertical:!0,alongFn:x,collapsed:!1});let b;return b=r.globals.previousPaths.length>0?this.getPreviousPath(n,l,f):this.buildBodyPath({nodes:p.nodes,center:d,halfExtent:g,maxWeight:u,vertical:!0,alongFn:x,collapsed:!0}),r.axisFlags.isXNumeric||(e+=s),{pathTo:f,pathFrom:b,x:e,y:a,center:d,halfExtent:g,alongFn:x,density:p,maxWeight:u,alongRepresentative:x(null!=(o=this.series[t.i][l])?o:0)}}drawHorizontalViolin({indexes:t,y:e,yDivision:s,barHeight:i,zeroW:a}){var o;const r=this.w,{realIndex:n,j:l}=t,h=this.invertedYRatio;r.axisFlags.isXNumeric&&(e=(r.seriesData.seriesX[n][l]-r.globals.minX)/this.invertedXRatio-i/2);const c=e+i*this.visibleI+i/2,d=i/2,g=this.getDensity(n,l),p=this.effectiveMaxWeight(g),u=t=>a+this.logVal(t,n)/h,x=this.buildBodyPath({nodes:g.nodes,center:c,halfExtent:d,maxWeight:p,vertical:!1,alongFn:u,collapsed:!1});let f;return f=r.globals.previousPaths.length>0?this.getPreviousPath(n,l,x):this.buildBodyPath({nodes:g.nodes,center:c,halfExtent:d,maxWeight:p,vertical:!1,alongFn:u,collapsed:!0}),r.axisFlags.isXNumeric||(e+=s),{pathTo:x,pathFrom:f,x:a,y:e,center:c,halfExtent:d,alongFn:u,maxWeight:p,density:g,alongRepresentative:u(null!=(o=this.series[t.i][l])?o:0)}}getDensity(t,e){var s;const i=null==(s=this.w.violinData.seriesViolinDensity[t])?void 0:s[e];if(!i||!i.values.length)return{nodes:[],maxWeight:0};const a=i.values.map((t,e)=>e);a.sort((t,e)=>i.values[t]-i.values[e]);const o=[];let r=null;for(const t of a){const e=i.values[t];null!==r&&e===r||(o.push({v:e,w:i.weights[t]}),r=e)}return{nodes:o,maxWeight:i.maxWeight}}effectiveMaxWeight(t){return"group"===this.normalize&&this.seriesMaxWeight>0?this.seriesMaxWeight:t.maxWeight}buildBodyPath({nodes:t,center:e,halfExtent:s,maxWeight:i,vertical:a,alongFn:o,collapsed:r}){const n=new N(this.w);if(0===t.length){const t=o(0);return a?n.move(e,t)+n.line(e,t):n.move(t,e)+n.line(t,e)}const l=t=>{if(r||i<=0)return 0;const e=t/i*s*this.bandwidthScale;return Math.min(s,Math.max(0,e))},h=[],c=[];for(let s=0;s<t.length;s++){const i=o(t[s].v),r=l(t[s].w);a?(h.push([e+r,i]),c.push([e-r,i])):(h.push([i,e+r]),c.push([i,e-r]))}return c.reverse(),this.smoothSegment(h,a,!1)+this.smoothSegment(c,a,!0)+"z"}smoothSegment(t,e,s){const i=new N(this.w),a=t[0];let o=s?i.line(a[0],a[1]):i.move(a[0],a[1]);if(t.length<3||!this.strictlyMonotonic(t,e)){for(let e=1;e<t.length;e++)o+=i.line(t[e][0],t[e][1]);return o}const r=t.map(([t,s])=>e?[s,t]:[t,s]),n=Ge.points(r),l=e?n.map(Ve):n;return o+=$e(l),o}strictlyMonotonic(t,e){const s=e?1:0;for(let e=1;e<t.length;e++)if(t[e][s]===t[e-1][s])return!1;return!0}buildPointsSubPath({realIndex:t,j:e,center:s,halfExtent:i,alongFn:a,density:o,maxWeight:r}){var n;return Re({w:this.w,points:null==(n=this.w.violinData.seriesViolinPoints[t])?void 0:n[e],seedA:t,seedB:e,center:s,halfExtent:i,alongFn:a,isHorizontal:this.isHorizontal,options:this.pointsOptions,clampAt:t=>this.halfWidthAtValue(t,o,i,r)})}halfWidthAtValue(t,e,s,i){const{nodes:a}=e,o=null!=i?i:e.maxWeight;if(!a.length||o<=0)return 0;const r=t=>Math.min(s,t/o*s*this.bandwidthScale);if(t<=a[0].v)return r(a[0].w);if(t>=a[a.length-1].v)return r(a[a.length-1].w);for(let e=1;e<a.length;e++)if(t<=a[e].v){const s=a[e-1],i=a[e],o=i.v===s.v?0:(t-s.v)/(i.v-s.v);return r(s.w+(i.w-s.w)*o)}return 0}logVal(t,e){return this.coreUtils.getLogValAtSeriesIndex(t,e)}},pie:Je,donut:Je,polarArea:Je,radialBar:class extends Je{constructor(t,e){super(t,e),this.ctx=e,this.w=t,this.animBeginArr=[0],this.animDur=0,this.startAngle=t.config.plotOptions.radialBar.startAngle,this.endAngle=t.config.plotOptions.radialBar.endAngle,this.totalAngle=Math.abs(t.config.plotOptions.radialBar.endAngle-t.config.plotOptions.radialBar.startAngle),this.trackStartAngle=t.config.plotOptions.radialBar.track.startAngle,this.trackEndAngle=t.config.plotOptions.radialBar.track.endAngle,this.barLabels=this.w.config.plotOptions.radialBar.barLabels,this.donutDataLabels=this.w.config.plotOptions.radialBar.dataLabels,this.radialDataLabels=this.donutDataLabels,this.trackStartAngle||(this.trackStartAngle=this.startAngle),this.trackEndAngle||(this.trackEndAngle=this.endAngle),360===this.endAngle&&(this.endAngle=359.99),this.margin=parseInt(t.config.plotOptions.radialBar.track.margin,10),this.onBarLabelClick=this.onBarLabelClick.bind(this)}draw(t){var e;const s=this.w,i=new N(this.w),a=i.group({class:"apexcharts-radialbar"});if(s.globals.noData)return a;const o=i.group(),r=this.defaultSize/2,n=s.layout.gridWidth/2;let l=this.defaultSize/2.05;s.config.chart.sparkline.enabled||(l=l-s.config.stroke.width-s.config.chart.dropShadow.blur);const h=s.globals.fill.colors,d=s.config.plotOptions.radialBar,g=Array.isArray(d.bands)&&d.bands.length>0,p=g&&d.bandsStyle&&d.bandsStyle.hideTrackWhenPresent,u="needle"===d.shape;if(d.track.show&&!p){const e=this.drawTracks({size:l,centerX:n,centerY:r,colorArr:h,series:t});o.add(e)}if(g){const e=this.drawBands({size:l,centerX:n,centerY:r,series:t});o.add(e)}const x=this.drawArcs({size:l,centerX:n,centerY:r,colorArr:h,series:t,skipValueArc:u&&!(null==(e=d.needle)?void 0:e.showValueArc)});if(d.ticks&&d.ticks.show){const e=this.drawTicks({size:l,centerX:n,centerY:r,series:t});if(this.initialAnim&&!s.globals.dataChanged&&!s.globals.resized&&c.isBrowser()&&s.globals.shouldAnimate){const t=e.node;t.style.opacity="0",t.style.transition="opacity 280ms ease-out";const i=s.config.chart.animations.speed||800;setTimeout(()=>{t.style.opacity="1"},i)}o.add(e)}if(u){const e=this.drawNeedle({size:l,centerX:n,centerY:r,series:t});o.add(e)}let f=360;s.config.plotOptions.radialBar.startAngle<0&&(f=this.totalAngle);const b=(360-f)/360;if(s.globals.radialSize=l-l*b,this.radialDataLabels.value.show){const t=Math.max(this.radialDataLabels.value.offsetY,this.radialDataLabels.name.offsetY);s.globals.radialSize+=t*b}return o.add(x.g),"front"===s.config.plotOptions.radialBar.hollow.position&&(x.g.add(x.elHollow),x.dataLabels&&x.g.add(x.dataLabels)),a.add(o),a}drawTracks(t){const e=this.w,s=new N(this.w),i=s.group({class:"apexcharts-tracks"}),a=new H(this.w),o=new G(this.w),r=this.getStrokeWidth(t);t.size=t.size-r/2;for(let n=0;n<t.series.length;n++){const l=s.group({class:"apexcharts-radialbar-track apexcharts-track"});i.add(l),l.attr({rel:n+1}),t.size=t.size-r-this.margin;const h=e.config.plotOptions.radialBar.track,c=o.fillPath({seriesNumber:0,size:t.size,fillColors:Array.isArray(h.background)?h.background[n]:h.background,solid:!0}),d=this.trackStartAngle;let g=this.trackEndAngle;Math.abs(g)+Math.abs(d)>=360&&(g=360-Math.abs(this.startAngle)-.1);const p=s.drawPath({d:"",stroke:c,strokeWidth:r*parseInt(h.strokeWidth,10)/100,fill:"none",strokeOpacity:h.opacity,classes:"apexcharts-radialbar-area"});if(h.dropShadow.enabled){const t=h.dropShadow;a.dropShadow(p,t)}l.add(p),p.attr("id","apexcharts-radialbarTrack-"+n),this.animatePaths(p,{centerX:t.centerX,centerY:t.centerY,endAngle:g,startAngle:d,size:t.size,i:n,totalItems:2,animBeginArr:0,dur:0,isTrack:!0})}return i}drawArcs(t){var e;const s=this.w,i=new N(this.w),a=new G(this.w),o=new H(this.w),r=i.group(),n=this.getStrokeWidth(t);t.size=t.size-n/2;let l=s.config.plotOptions.radialBar.hollow.background;const h=t.size-n*t.series.length-this.margin*t.series.length-n*parseInt(s.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,c=h-s.config.plotOptions.radialBar.hollow.margin;void 0!==s.config.plotOptions.radialBar.hollow.image&&(l=this.drawHollowImage(t,r,h,l));const d=this.drawHollow({size:c,centerX:t.centerX,centerY:t.centerY,fill:l||"transparent"});if(s.config.plotOptions.radialBar.hollow.dropShadow.enabled){const t=s.config.plotOptions.radialBar.hollow.dropShadow;o.dropShadow(d,t)}let g=1;!this.radialDataLabels.total.show&&s.seriesData.series.length>1&&(g=0);let p=null;if(this.radialDataLabels.show){const e=s.dom.Paper.findOne(".apexcharts-datalabels-group");p=this.renderInnerDataLabels(e,this.radialDataLabels,{hollowSize:h,centerX:t.centerX,centerY:t.centerY,opacity:g})}"back"===s.config.plotOptions.radialBar.hollow.position&&(r.add(d),p&&r.add(p));let u=!1;s.config.plotOptions.radialBar.inverseOrder&&(u=!0);const x=!0===(null==(e=this.ctx.morphTypeChange)?void 0:e.isActive());for(let e=u?t.series.length-1:0;u?e>=0:e<t.series.length;u?e--:e++){const l=i.group({class:"apexcharts-series apexcharts-radial-series",seriesName:m.escapeString(s.seriesData.seriesNames[e])});r.add(l),l.attr({rel:e+1,"data:realIndex":e}),lt.addCollapsedClassToSeries(this.w,l,e),t.size=t.size-n-this.margin;const h=a.fillPath({seriesNumber:e,size:t.size,value:t.series[e]}),c=this.startAngle;let d;const g=s.config.plotOptions.radialBar,p="number"==typeof g.min?g.min:0,u="number"==typeof g.max?g.max:100,f=u===p?1:u-p,b=t=>{const e=Math.min(Math.max(t,p),u);return Math.max(0,(e-p)/f)},y=b(m.negToZero(t.series[e]));let w,v=Math.round(this.totalAngle*y)+this.startAngle;s.globals.dataChanged&&(d=this.startAngle,w=Math.round(this.totalAngle*b(m.negToZero(s.globals.previousPaths[e])))+d);Math.abs(v)+Math.abs(c)>360&&(v-=.01);Math.abs(w)+Math.abs(d)>360&&(w-=.01);const A=v-c,C=Array.isArray(s.config.stroke.dashArray)?s.config.stroke.dashArray[e]:s.config.stroke.dashArray,S=x?this.ctx.morphTypeChange.getInitialPathFor(e,0):null,k=x?this.ctx.morphTypeChange.getFromType():null,D=!!S&&("bar"===k||"funnel"===k||"pyramid"===k||"pie"===k||"donut"===k||"polarArea"===k),L=i.drawPath({d:S||"",stroke:D||t.skipValueArc?"transparent":h,strokeWidth:D||t.skipValueArc?0:n,fill:D?h:"none",fillOpacity:s.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+e,strokeDashArray:C}),M=c+A/2,P=m.polarToCartesian(t.centerX,t.centerY,t.size,M);if(N.setAttrs(L.node,{"data:angle":A,"data:value":t.series[e],"data:cx":P.x,"data:cy":P.y}),s.config.chart.dropShadow.enabled){const t=s.config.chart.dropShadow;o.dropShadow(L,t,e)}if(o.setSelectionFilter(L,0,e),this.addListeners(L,this.radialDataLabels),l.add(L),L.attr({index:0,j:e}),this.barLabels.enabled){const a=m.polarToCartesian(t.centerX,t.centerY,t.size,c),o=this.barLabels.formatter(s.seriesData.seriesNames[e],{seriesIndex:e,w:s}),r=["apexcharts-radialbar-label"];this.barLabels.onClick||r.push("apexcharts-no-click");let n=this.barLabels.useSeriesColors?s.globals.colors[e]:s.config.chart.foreColor;n||(n=s.config.chart.foreColor);const h=a.x+this.barLabels.offsetX,d=a.y+this.barLabels.offsetY,g=i.drawText({x:h,y:d,text:o,textAnchor:"end",dominantBaseline:"middle",fontFamily:this.barLabels.fontFamily,fontWeight:this.barLabels.fontWeight,fontSize:this.barLabels.fontSize,foreColor:n,cssClass:r.join(" ")});g.on("click",this.onBarLabelClick),g.attr({rel:e+1}),0!==c&&g.attr({"transform-origin":`${h} ${d}`,transform:`rotate(${c} 0 0)`}),l.add(g)}let T=0;if(!this.initialAnim||s.globals.resized||s.globals.dataChanged||(T=s.config.chart.animations.speed),s.globals.dataChanged&&(T=s.config.chart.animations.dynamicAnimation.speed),this.animDur=T/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur),x&&S){const e=this.ctx.morphTypeChange.getSpeed(),s=this.getPiePath({me:this,startAngle:c,angle:A,size:t.size});if(D){const i=this.ctx.morphTypeChange.buildRingSegmentPath(t.centerX,t.centerY,t.size,n,c,c+A);L.animate(e).plot(i,"polygons").after(function(){this.attr({d:s,fill:"none",stroke:t.skipValueArc?"transparent":h,"stroke-width":t.skipValueArc?0:n})})}else L.animate(e).plot(s,"polygons").attr({"stroke-width":n})}else this.animatePaths(L,{centerX:t.centerX,centerY:t.centerY,endAngle:v,startAngle:c,prevEndAngle:w,prevStartAngle:d,size:t.size,i:e,totalItems:2,animBeginArr:this.animBeginArr,dur:T,shouldSetPrevPaths:!0})}return{g:r,elHollow:d,dataLabels:p}}_angleAtValue(t){const e=this.w.config.plotOptions.radialBar,s="number"==typeof e.min?e.min:0,i="number"==typeof e.max?e.max:100,a=i===s?s+1:i,o=(Math.max(s,Math.min(a,Number(t)))-s)/(a-s);return this.startAngle+o*(this.endAngle-this.startAngle)}_describeArc(t,e,s,i,a){const o=m.polarToCartesian(t,e,s,a),r=m.polarToCartesian(t,e,s,i),n=a-i,l=Math.abs(n)>180?1:0;return`M ${o.x} ${o.y} A ${s} ${s} 0 ${l} 0 ${r.x} ${r.y}`}drawBands(t){const e=this.w,s=new N(this.w),i=e.config.plotOptions.radialBar,a=i.bands||[],o=s.group({class:"apexcharts-gauge-bands"}),r=this.getStrokeWidth(t),n=t.size-r/2-r-this.margin,l=r*parseInt(i.bandsStyle.strokeWidth,10)/100,h="number"==typeof i.min?i.min:0,c="number"==typeof i.max?i.max:100,d=c===h?0:(i.bandsStyle.gap||0)*((this.endAngle-this.startAngle)/(c-h));for(let e=0;e<a.length;e++){const r=a[e];if(void 0===r.from||void 0===r.to)continue;const h=this._angleAtValue(r.from),c=this._angleAtValue(r.to),g=Math.min(h,c)+d/2,p=Math.max(h,c)-d/2;if(p-g<=0)continue;const u=s.drawPath({d:this._describeArc(t.centerX,t.centerY,n,g,p),stroke:r.color||"#ccc",strokeWidth:l,fill:"none",strokeLinecap:i.bandsStyle.linecap||"butt",classes:"apexcharts-gauge-band"});u.node.setAttribute("data-band-index",String(e)),o.add(u)}return o}drawTicks(t){var e,s,i,a;const o=this.w,r=new N(this.w),n=o.config.plotOptions.radialBar,l=n.ticks,h=r.group({class:"apexcharts-gauge-ticks"}),c=this.getStrokeWidth(t),d=t.size-c/2-c-this.margin,g="number"==typeof n.min?n.min:0,p="number"==typeof n.max?n.max:100,u=Math.max(2,null!=(s=null==(e=l.major)?void 0:e.count)?s:11),x=Math.max(0,null!=(a=null==(i=l.minor)?void 0:i.count)?a:0),f=(e,s,i)=>{var a,o,n;const c=this._angleAtValue(e),g=null!=(a=s.length)?a:8,p="inside"===s.placement?d-g:d,u="inside"===s.placement?d:d+g,x=m.polarToCartesian(t.centerX,t.centerY,p,c),f=m.polarToCartesian(t.centerX,t.centerY,u,c),b=r.drawLine(x.x,x.y,f.x,f.y,s.color||(i?"#666":"#999"),0,s.width||(i?2:1));if(h.add(b),i&&(null==(o=l.labels)?void 0:o.show)){const i=("inside"===s.placement?p:u)+("inside"===s.placement?-1:1)*(null!=(n=l.labels.offset)?n:6),a=m.polarToCartesian(t.centerX,t.centerY,i,c),o="function"==typeof l.labels.formatter?l.labels.formatter(e):String(e),d=r.drawText({x:a.x,y:a.y,text:o,textAnchor:"middle",dominantBaseline:"middle",fontFamily:l.labels.fontFamily,fontSize:l.labels.fontSize,fontWeight:l.labels.fontWeight,foreColor:l.labels.color,cssClass:"apexcharts-gauge-tick-label"});h.add(d)}};for(let t=0;t<u;t++){if(f(g+t/(u-1)*(p-g),l.major||{},!0),t<u-1&&x>0)for(let e=1;e<=x;e++){f(g+(t+e/(x+1))/(u-1)*(p-g),l.minor||{},!1)}}return h}drawNeedle(t){var e,s,i,a,o;const r=this.w,n=new N(this.w),l=r.config.plotOptions.radialBar.needle||{},h=n.group({class:"apexcharts-gauge-needle"});if(!t.series||0===t.series.length)return h;const d=this.getStrokeWidth(t),g=t.size-d/2-d-this.margin,p="string"==typeof l.length&&l.length.endsWith("%")?g*parseInt(l.length,10)/100:Number(l.length||.85*g),u=null!=(e=l.baseWidth)?e:4,x=null!=(s=l.tipWidth)?s:1,f=l.color||"#333",m=t.centerX,y=Number(null!=(i=l.offsetY)?i:0),w=t.centerY+y,v=`M ${m+u/2} ${w} A ${u/2} ${u/2} 0 0 1 ${m-u/2} ${w} L ${m-x/2} ${w-p} L ${m+x/2} ${w-p} Z`,A=n.drawPath({d:v,stroke:f,strokeWidth:0,fill:f,classes:"apexcharts-gauge-needle-shape"});h.add(A);const C=Number(t.series[0]),S=this._angleAtValue(C),k=this.initialAnim&&!r.globals.dataChanged&&!r.globals.resized,D=this.ctx,L="number"==typeof D._lastNeedleAngle?D._lastNeedleAngle:this.startAngle;D._lastNeedleAngle=S;if(c.isBrowser()&&r.globals.shouldAnimate&&(k||r.globals.dataChanged)&&L!==S){const t=h.node;t.setAttribute("transform-origin",`${m} ${w}`),t.setAttribute("transform",`rotate(${L})`);const e=(null==(a=l.animation)?void 0:a.duration)&&Number(l.animation.duration)||l.animationSpeed&&Number(l.animationSpeed)||(null==(o=r.config.chart.animations.dynamicAnimation)?void 0:o.speed)||r.config.chart.animations.speed||800,s=1.70158,i=s+1,n=k?t=>1+i*Math.pow(t-1,3)+s*Math.pow(t-1,2):t=>1-Math.pow(1-t,3),c=performance.now(),d=s=>{const i=Math.max(0,Math.min(1,(s-c)/e)),a=L+(S-L)*n(i);t.setAttribute("transform",`rotate(${a})`),i<1&&b.requestAnimationFrame(d)};b.requestAnimationFrame(d)}else h.attr({"transform-origin":`${m} ${w}`,transform:`rotate(${S})`});return h}drawHollow(t){var e;const s=new N(this.w),i=this.w.config.plotOptions.radialBar.hollow,a=s.drawCircle(2*t.size),o={class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill};return(i.stroke||i.strokeDasharray)&&(o.stroke=i.stroke||"transparent",o["stroke-width"]=null!=(e=i.strokeWidth)?e:1,i.strokeDasharray&&(o["stroke-dasharray"]=i.strokeDasharray)),a.attr(o),a}drawHollowImage(t,e,s,i){const a=this.w,o=new G(this.w),r=m.randomId(),n=a.config.plotOptions.radialBar.hollow.image;if(a.config.plotOptions.radialBar.hollow.imageClipped)o.clippedImgArea({width:s,height:s,image:n,patternID:`pattern${a.globals.cuid}${r}`}),i=`url(#pattern${a.globals.cuid}${r})`;else{const s=a.config.plotOptions.radialBar.hollow.imageWidth,i=a.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===s&&void 0===i){const s=a.dom.Paper.image(n,function(e){this.move(t.centerX-e.width/2+a.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+a.config.plotOptions.radialBar.hollow.imageOffsetY)});e.add(s)}else{const o=a.dom.Paper.image(n,function(){this.move(t.centerX-s/2+a.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-i/2+a.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(s,i)});e.add(o)}}return i}getStrokeWidth(t){const e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}onBarLabelClick(t){var e;const s=t.target,i=parseInt(null!=(e=s.getAttribute("rel"))?e:"",10)-1,a=this.barLabels.onClick,o=this.w;a&&a(o.seriesData.seriesNames[i],{w:o,seriesIndex:i})}},radar:class{constructor(t,e){this.ctx=e,this.w=t,this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animDur=0,this.graphics=new N(this.w),this.lineColorArr=void 0!==t.globals.stroke.colors?t.globals.stroke.colors:t.globals.colors,this.defaultSize=t.globals.svgHeight<t.globals.svgWidth?t.layout.gridHeight:t.layout.gridWidth,this.isLog=t.config.yaxis[0].logarithmic,this.logBase=t.config.yaxis[0].logBase,this.coreUtils=new F(this.w),this.maxValue=this.isLog?this.coreUtils.getLogVal(this.logBase,t.globals.maxY,0):t.globals.maxY,this.minValue=this.isLog?this.coreUtils.getLogVal(this.logBase,this.w.globals.minY,0):t.globals.minY,this.polygons=t.config.plotOptions.radar.polygons,this.strokeWidth=t.config.stroke.show?t.config.stroke.width:0,this.size=this.defaultSize/2.1-this.strokeWidth-t.config.chart.dropShadow.blur,t.config.xaxis.labels.show&&(this.size=this.size-t.layout.xAxisLabelsWidth/1.75),void 0!==t.config.plotOptions.radar.size&&(this.size=t.config.plotOptions.radar.size),this.dataRadiusOfPercent=[],this.dataRadius=[],this.angleArr=[],this.dataPointsLen=0,this.disAngle=0,this.yaxisLabelsTextsPos=[]}draw(t){const e=this.w,s=new G(this.w),i=[],a=new U(this.w,this.ctx);t.length&&(this.dataPointsLen=t[e.globals.maxValsInArrayIndex].length),this.disAngle=2*Math.PI/this.dataPointsLen;const o=e.layout.gridWidth/2,r=e.layout.gridHeight/2,h=o+e.config.plotOptions.radar.offsetX,c=r+e.config.plotOptions.radar.offsetY,d=this.graphics.group({class:"apexcharts-radar-series apexcharts-plot-series",transform:`translate(${h||0}, ${c||0})`});let g=[],p=null,u=null;if(this.yaxisLabels=this.graphics.group({class:"apexcharts-yaxis"}),t.forEach((t,o)=>{const r=t.length===e.globals.dataPoints,h=this.graphics.group().attr({class:"apexcharts-series","data:longestSeries":r,seriesName:m.escapeString(e.seriesData.seriesNames[o]),rel:o+1,"data:realIndex":o});this.dataRadiusOfPercent[o]=[],this.dataRadius[o]=[],this.angleArr[o]=[],t.forEach((t,e)=>{const s=Math.abs(this.maxValue-this.minValue);t-=this.minValue,this.isLog&&(t=this.coreUtils.getLogVal(this.logBase,t,0)),this.dataRadiusOfPercent[o][e]=t/s,this.dataRadius[o][e]=this.dataRadiusOfPercent[o][e]*this.size,this.angleArr[o][e]=e*this.disAngle}),g=this.getDataPointsPos(this.dataRadius[o],this.angleArr[o]);const c=this.createPaths(g,{x:0,y:0});p=this.graphics.group({class:"apexcharts-series-markers-wrap apexcharts-element-hidden"}),u=this.graphics.group({class:"apexcharts-datalabels","data:realIndex":o}),e.globals.delayedElements.push({el:p.node,index:o});const d={i:o,realIndex:o,animationDelay:o,initialSpeed:e.config.chart.animations.speed,dataChangeSpeed:e.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-radar",shouldClipToGrid:!1,bindEventsOnPaths:!1,stroke:e.globals.stroke.colors[o],strokeLineCap:e.config.stroke.lineCap};let x=null;e.globals.previousPaths.length>0&&(x=this.getPreviousPath(o));for(let t=0;t<c.linePathsTo.length;t++){const i=this.graphics.renderPaths(l(n({},d),{pathFrom:null===x?c.linePathsFrom[t]:x,pathTo:c.linePathsTo[t],strokeWidth:Array.isArray(this.strokeWidth)?this.strokeWidth[o]:this.strokeWidth,fill:"none",drawShadow:!1}));h.add(i);const a=s.fillPath({seriesNumber:o}),r=this.graphics.renderPaths(l(n({},d),{pathFrom:null===x?c.areaPathsFrom[t]:x,pathTo:c.areaPathsTo[t],strokeWidth:0,fill:a,drawShadow:!1,drawMask:{type:"radial",cx:0,cy:0,r:this.size}}));if(e.config.chart.dropShadow.enabled){const t=new H(this.w),s=e.config.chart.dropShadow;t.dropShadow(r,Object.assign({},s,{noUserSpaceOnUse:!0}),o)}h.add(r)}t.forEach((t,s)=>{const i=new j(this.w,this.ctx).getMarkerConfig({cssClass:"apexcharts-marker",seriesIndex:o,dataPointIndex:s}),r=this.graphics.drawMarker(g[s].x,g[s].y,i);r.attr("rel",s),r.attr("j",s),r.attr("index",o),r.node.setAttribute("default-marker-size",i.pSize);const l=this.graphics.group({class:"apexcharts-series-markers"});l&&l.add(r),p.add(l),h.add(p);const c=e.config.dataLabels;if(c.enabled){const t=c.formatter(e.seriesData.series[o][s],{seriesIndex:o,dataPointIndex:s,w:e});a.plotDataLabelsText({x:g[s].x,y:g[s].y,text:t,textAnchor:"middle",i:o,j:o,parent:u,offsetCorrection:!1,dataLabelsConfig:n({},c)})}h.add(u)}),i.push(h)}),this.drawPolygons({parent:d}),e.config.xaxis.labels.show){const t=this.drawXAxisTexts();d.add(t)}return i.forEach(t=>{d.add(t)}),d.add(this.yaxisLabels),d}drawPolygons(t){const e=this.w,{parent:s}=t,i=new Ke(this.w),a=e.globals.yAxisScale[0].result.reverse(),o=a.length,r=[],n=this.size/(o-1);for(let t=0;t<o;t++)r[t]=n*t;r.reverse();const l=[],h=[];r.forEach((t,e)=>{const s=m.getPolygonPos(t,this.dataPointsLen);let i="";s.forEach((t,s)=>{if(0===e){const e=this.graphics.drawLine(t.x,t.y,0,0,Array.isArray(this.polygons.connectorColors)?this.polygons.connectorColors[s]:this.polygons.connectorColors);h.push(e)}0===s&&this.yaxisLabelsTextsPos.push({x:t.x,y:t.y}),i+=t.x+","+t.y+" "}),l.push(i)}),l.forEach((t,i)=>{const a=this.polygons.strokeColors,o=this.polygons.strokeWidth,r=this.graphics.drawPolygon(t,Array.isArray(a)?a[i]:a,Array.isArray(o)?o[i]:o,e.globals.radarPolygons.fill.colors[i]);s.add(r)}),h.forEach(t=>{s.add(t)}),e.config.yaxis[0].show&&this.yaxisLabelsTextsPos.forEach((t,e)=>{const s=i.drawYAxisTexts(t.x,t.y,e,a[e]);this.yaxisLabels.add(s)})}drawXAxisTexts(){const t=this.w,e=t.config.xaxis.labels,s=this.graphics.group({class:"apexcharts-xaxis"}),i=m.getPolygonPos(this.size,this.dataPointsLen);return t.labelData.labels.forEach((a,o)=>{const r=t.config.xaxis.labels.formatter,l=new U(this.w,this.ctx);if(i[o]){const h=this.getTextPos(i[o],this.size),c=r(a,{seriesIndex:-1,dataPointIndex:o,w:t});l.plotDataLabelsText({x:h.newX,y:h.newY,text:c,textAnchor:h.textAnchor,i:o,j:o,parent:s,className:"apexcharts-xaxis-label",color:Array.isArray(e.style.colors)&&e.style.colors[o]?e.style.colors[o]:"#a8a8a8",dataLabelsConfig:n({textAnchor:h.textAnchor,dropShadow:{enabled:!1}},e),offsetCorrection:!1}).on("click",e=>{if("function"==typeof t.config.chart.events.xAxisLabelClick){const s=Object.assign({},t,{labelIndex:o});t.config.chart.events.xAxisLabelClick(e,this.ctx,s)}})}}),s}createPaths(t,e){const s=[];let i=[];const a=[];let o=[];if(t.length){i=[this.graphics.move(e.x,e.y)],o=[this.graphics.move(e.x,e.y)];let r=this.graphics.move(t[0].x,t[0].y),n=this.graphics.move(t[0].x,t[0].y);t.forEach((e,s)=>{r+=this.graphics.line(e.x,e.y),n+=this.graphics.line(e.x,e.y),s===t.length-1&&(r+="Z",n+="Z")}),s.push(r),a.push(n)}return{linePathsFrom:i,linePathsTo:s,areaPathsFrom:o,areaPathsTo:a}}getTextPos(t,e){let s="middle",i=t.x,a=t.y;return Math.abs(t.x)>=10?t.x>0?(s="start",i+=10):t.x<0&&(s="end",i-=10):s="middle",Math.abs(t.y)>=e-10&&(t.y<0?a-=10:t.y>0&&(a+=10)),{textAnchor:s,newX:i,newY:a}}getPreviousPath(t){const e=this.w;let s=null;for(let i=0;i<e.globals.previousPaths.length;i++){const a=e.globals.previousPaths[i];a.paths.length>0&&parseInt(a.realIndex,10)===parseInt(String(t),10)&&void 0!==e.globals.previousPaths[i].paths[0]&&(s=e.globals.previousPaths[i].paths[0].d)}return s}getDataPointsPos(t,e,s=this.dataPointsLen){t=t||[],e=e||[];const i=[];for(let a=0;a<s;a++){const s={};s.x=t[a]*Math.sin(e[a]),s.y=-t[a]*Math.cos(e[a]),i.push(s)}return i}},heatmap:class{constructor(t,e,s){this.ctx=e,this.w=t,this.xRatio=s.xRatio,this.yRatio=s.yRatio,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.helpers=new Ue(t,e),this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}draw(t){const e=this.w,s=new N(this.w,this.ctx),i=s.group({class:"apexcharts-heatmap"});i.attr("clip-path",`url(#gridRectMask${e.globals.cuid})`);const a=e.layout.gridWidth/e.globals.dataPoints,o=e.layout.gridHeight/e.seriesData.series.length;let r=0,n=!1;this.negRange=this.helpers.checkColorRange();const l=t.slice();e.config.yaxis[0].reversed&&(n=!0,l.reverse());for(let h=n?0:l.length-1;n?h<l.length:h>=0;n?h++:h--){const n=s.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:m.escapeString(e.seriesData.seriesNames[h]),rel:h+1,"data:realIndex":h});if(lt.addCollapsedClassToSeries(this.w,n,h),s.setupEventDelegation(n,".apexcharts-heatmap-rect"),e.config.chart.dropShadow.enabled){const t=e.config.chart.dropShadow;new H(this.w).dropShadow(n,t,h)}let c=0;const d=e.config.plotOptions.heatmap.shadeIntensity;let g=0;for(let i=0;i<e.globals.dataPoints;i++){if(e.seriesData.seriesX.length&&!e.globals.allSeriesHasEqualX&&e.globals.minX+e.globals.minXDiff*i<e.seriesData.seriesX[h][g]){c+=a;continue}if(g>=l[h].length)break;const p=this.helpers.getShadeColor(e.config.chart.type,h,g,this.negRange);let u=p.color;const x=p.colorProps;if("image"===e.config.fill.type){u=new G(this.w).fillPath({seriesNumber:h,dataPointIndex:g,opacity:e.globals.hasNegs?x.percent<0?1-(1+x.percent/100):d+x.percent/100:x.percent/100,patternID:m.randomId(),width:e.config.fill.image.width?e.config.fill.image.width:a,height:e.config.fill.image.height?e.config.fill.image.height:o})}const f=this.rectRadius,b=s.drawRect(c,r,a,o,f);if(b.attr({cx:c,cy:r}),b.node.classList.add("apexcharts-heatmap-rect"),n.add(b),b.attr({fill:u,i:h,index:h,j:g,val:t[h][g],"stroke-width":this.strokeWidth,stroke:e.config.plotOptions.heatmap.useFillColorAsStroke?u:e.globals.stroke.colors[0],color:u}),e.config.chart.animations.enabled&&!e.globals.dataChanged){let t=1;e.globals.resized||(t=e.config.chart.animations.speed),this.animateHeatMap(b,c,r,a,o,t,h,g)}if(e.globals.dataChanged){let t=1;if(this.dynamicAnim.enabled&&e.globals.shouldAnimate){t=this.dynamicAnim.speed;let s=e.globals.previousPaths[h]&&e.globals.previousPaths[h][g]&&e.globals.previousPaths[h][g].color;s||(s="rgba(255, 255, 255, 0)"),this.animateHeatColor(b,m.isColorHex(s)?s:m.rgb2hex(s),m.isColorHex(u)?u:m.rgb2hex(u),t)}}const y=(0,e.config.dataLabels.formatter)(e.seriesData.series[h][g],{value:e.seriesData.series[h][g],seriesIndex:h,dataPointIndex:g,w:e}),w=this.helpers.calculateDataLabels({text:y,x:c+a/2,y:r+o/2,i:h,j:g,colorProps:x,series:l});null!==w&&n.add(w),c+=a,g++}r+=o,i.add(n)}const h=e.globals.yAxisScale[0].result.slice();return e.config.yaxis[0].reversed?h.unshift(""):h.push(""),e.globals.yAxisScale[0].result=h,i}animateHeatMap(t,e,s,i,a,o,r=0,n=0){const l=this.w,h=new B(this.w),c=l.config.chart.animations.animateGradually;let d=0;if(c&&!1!==c.enabled){const t=((l.seriesData.series||[]).length||1)+(l.globals.dataPoints||1)-2;d=Y({style:"diagonal",index:n,row:r,col:n,baseDelay:Math.min(c.delay||0,.5*o/Math.max(1,t))})}h.animateRect(t,{x:e+i/2,y:s+a/2,width:0,height:0},{x:e,y:s,width:i,height:a},o,()=>{h.animationCompleted(t)},d)}animateHeatColor(t,e,s,i){t.attr({fill:e}).animate(i).attr({fill:s})}},treemap:class{constructor(t,e){this.ctx=e,this.w=t,this.strokeWidth=this.w.config.stroke.width,this.helpers=new Ue(t,e),this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.labels=[]}draw(t){const e=this.w,s=new N(this.w,this.ctx),i=new G(this.w),a=s.group({class:"apexcharts-treemap"});if(e.globals.noData)return a;const o=[];t.forEach(t=>{const e=t.map(t=>Math.abs(t));o.push(e)}),this.negRange=this.helpers.checkColorRange(),e.config.series.forEach((t,e)=>{t.data.forEach(t=>{Array.isArray(this.labels[e])||(this.labels[e]=[]),this.labels[e].push(t.x)})});return as.generate(o,e.layout.gridWidth,e.layout.gridHeight).forEach((o,r)=>{var n;const l=s.group({class:"apexcharts-series apexcharts-treemap-series",seriesName:m.escapeString(e.seriesData.seriesNames[r]),rel:r+1,"data:realIndex":r});if(s.setupEventDelegation(l,".apexcharts-treemap-rect"),e.config.chart.dropShadow.enabled){const t=e.config.chart.dropShadow;new H(this.w).dropShadow(a,t,r)}const h=s.group({class:"apexcharts-data-labels"}),c={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},d=e.config.chart.animations,g=d.animateGradually,p=g&&!1!==g.enabled,u=new Array(o.length).fill(0);if(p){const t=o.length||1,e=Math.min(g.delay||0,.5*d.speed/t);o.map((t,e)=>({j:e,area:(t[2]-t[0])*(t[3]-t[1])})).sort((t,e)=>e.area-t.area).forEach((t,s)=>{u[t.j]=s*e})}o.forEach((a,o)=>{const n=a[0],h=a[1],d=a[2],g=a[3];c.xMin=Math.min(c.xMin,n),c.yMin=Math.min(c.yMin,h),c.xMax=Math.max(c.xMax,d),c.yMax=Math.max(c.yMax,g);const p=this.helpers.getShadeColor(e.config.chart.type,r,o,this.negRange),x=p.color,f=i.fillPath({color:x,seriesNumber:r,dataPointIndex:o}),b=s.drawRect(n,h,d-n,g-h,e.config.plotOptions.treemap.borderRadius,"#fff",1,this.strokeWidth,e.config.plotOptions.treemap.useFillColorAsStroke?x:e.globals.stroke.colors[r]);b.attr({cx:n,cy:h,index:r,i:r,j:o,width:d-n,height:g-h,fill:f}),b.node.classList.add("apexcharts-treemap-rect");let m={x:n+(d-n)/2,y:h+(g-h)/2,width:0,height:0};const y={x:n,y:h,width:d-n,height:g-h};if(e.config.chart.animations.enabled&&!e.globals.dataChanged){let t=1;e.globals.resized||(t=e.config.chart.animations.speed),this.animateTreemap(b,m,y,t,u[o]||0)}if(e.globals.dataChanged){let t=1;this.dynamicAnim.enabled&&e.globals.shouldAnimate&&(t=this.dynamicAnim.speed,e.globals.previousPaths[r]&&e.globals.previousPaths[r][o]&&e.globals.previousPaths[r][o].rect&&(m=e.globals.previousPaths[r][o].rect),this.animateTreemap(b,m,y,t))}let w=this.getFontSize(a),v=e.config.dataLabels.formatter(this.labels[r][o],{value:e.seriesData.series[r][o],seriesIndex:r,dataPointIndex:o,w:e});"truncate"===e.config.plotOptions.treemap.dataLabels.format&&(w=parseInt(String(e.config.dataLabels.style.fontSize),10),v=this.truncateLabels(String(v),w,n,h,d,g));let A=null;e.seriesData.series[r][o]&&(A=this.helpers.calculateDataLabels({text:v,x:(n+d)/2,y:(h+g)/2+this.strokeWidth/2+w/3,i:r,j:o,colorProps:p,fontSize:w,series:t})),e.config.dataLabels.enabled&&A&&this.rotateToFitLabel(A,w,v,n,h,d,g),l.add(b),null!==A&&l.add(A)});const x=e.config.plotOptions.treemap.seriesTitle;if(e.config.series.length>1&&x&&x.show){const t=e.config.series[r].name||"";if(t&&c.xMin<1/0&&c.yMin<1/0){const{offsetX:i,offsetY:a,borderColor:o,borderWidth:r,borderRadius:h,style:d}=x,g=d.color||e.config.chart.foreColor,p={left:d.padding.left,right:d.padding.right,top:d.padding.top,bottom:d.padding.bottom},u=s.getTextRects(t,d.fontSize,d.fontFamily),f=u.width+p.left+p.right,b=u.height+p.top+p.bottom,m=c.xMin+(i||0),y=c.yMin+(a||0),w=s.drawRect(m,y,f,b,h,d.background,1,r,o),v=s.drawText({x:m+p.left,y:y+p.top+.75*(null!=(n=null==u?void 0:u.height)?n:0),text:t,fontSize:d.fontSize,fontFamily:d.fontFamily,fontWeight:d.fontWeight,foreColor:g,cssClass:d.cssClass||""});l.add(w),l.add(v)}}l.add(h),a.add(l)}),a}getFontSize(t){const e=this.w;const s=function t(e){let s,i=0;if(Array.isArray(e[0]))for(s=0;s<e.length;s++)i+=t(e[s]);else for(s=0;s<e.length;s++)i+=e[s].length;return i}(this.labels)/function t(e){let s,i=0;if(Array.isArray(e[0]))for(s=0;s<e.length;s++)i+=t(e[s]);else for(s=0;s<e.length;s++)i+=1;return i}(this.labels);return function(t,i){const a=t*i,o=Math.pow(a,.5);return Math.min(o/s,parseInt(e.config.dataLabels.style.fontSize,10))}(t[2]-t[0],t[3]-t[1])}rotateToFitLabel(t,e,s,i,a,o,r){const n=new N(this.w),l=n.getTextRects(s,String(e));if(l.width+this.w.config.stroke.width+5>o-i&&l.width<=r-a){const e=n.rotateAroundCenter(t.node);t.node.setAttribute("transform",`rotate(-90 ${e.x} ${e.y}) translate(${l.height/3})`)}}truncateLabels(t,e,s,i,a,o){const r=new N(this.w),n=r.getTextRects(t,String(e)).width+this.w.config.stroke.width+5>a-s&&o-i>a-s?o-i:a-s,l=r.getTextBasedOnMaxWidth({text:t,maxWidth:n,fontSize:e});return t.length!==l.length&&n/e<5?"":l}animateTreemap(t,e,s,i,a=0){const o=new B(this.w);o.animateRect(t,e,s,i,()=>{o.animationCompleted(t)},a)}}}),me});diff --git a/scripts/libs/chart.js b/scripts/libs/chart.jsdeleted file mode 100644index 9a07c2f..0000000--- a/scripts/libs/chart.js+++ /dev/null@@ -1,20 +0,0 @@-/**- * Skipped minification because the original files appears to be already minified.- * Original file: /npm/[email protected]/dist/chart.umd.js- *- * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files- */-/*!- * Chart.js v4.4.0- * https://www.chartjs.org- * (c) 2023 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 Go},get Decimation(){return Qo},get Filler(){return ma},get Legend(){return ya},get SubTitle(){return ka},get Title(){return Ma},get Tooltip(){return Ba}});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;a<r;a++)e.call(i,t[a],a);else if(o(t))for(l=Object.keys(t),r=l.length,a=0;a<r;a++)e.call(i,t[l[a]],l[a])}function f(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=g(t[i[n]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,s){if(!p(t))return;const n=e[t],a=i[t];o(n)&&o(a)?b(n,a,s):e[t]=g(a)}function b(t,e,i){const s=n(e)?e:[e],a=s.length;if(!o(t))return t;const r=(i=i||{}).merger||m;let l;for(let e=0;e<a;++e){if(l=s[e],!o(l))continue;const n=Object.keys(l);for(let e=0,s=n.length;e<s;++e)r(n[e],t,l,i)}return t}function x(t,e){return b(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const s=e[t],n=i[t];o(s)&&o(n)?x(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(n))}const y={"":t=>t,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)<i}function B(t){const e=Math.round(t);t=V(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(z(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function W(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function N(t){return!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;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function $(t){return t*(C/180)}function Y(t){return t*(180/C)}function U(t){if(!a(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*C&&(o+=O),{angle:o,distance:n}}function q(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+A)%O-C}function G(t){return(t%O+O)%O}function Z(t,e,i,s){const n=G(t),o=G(e),a=G(i),r=G(o-n),l=G(a-n),h=G(n-o),c=G(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function J(t,e,i){return Math.max(e,Math.min(i,t))}function Q(t){return J(t,-32768,32767)}function tt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>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 n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),st=(t,e,i)=>et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ot=["push","pop","shift","splice","unshift"];function at(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ot.forEach((e=>{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 s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:h,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=J(Math.min(it(r,l,h).lo,i?s:it(e,l,a.getPixelForValue(h)).lo),0,s-1)),o=u?J(Math.max(it(r,a.axis,c,!0).hi+1,i?0:it(e,l,a.getPixelForValue(c),!0).hi+1),n,s)-n:s-n}return{start:n,count:o}}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 bt{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 xt=new bt;-/*!- * @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<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Nt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Ht;function jt(t){Ht||(Ht=function(){const t={},e=Object.keys(Nt),i=Object.keys(Wt);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Wt[o]);o=parseInt(Nt[a],16),t[r]=[o>>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 Zt{constructor(t){if(t instanceof Zt)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 Zt(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 Jt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Jt(t)?t:new Zt(t)}function te(t){return Jt(t)?t:new Zt(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;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function ce(t,e,i){return"string"==typeof e?b(he(t,e),i):b(he(t,""),e)}class de{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.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 be(t,e){return me(t).getPropertyValue(e)}const xe=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=xe[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=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=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=Math.floor(t.height),t.width=Math.floor(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}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Pe(t,e){const i=be(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;h<l;h++)if(u=i[h],null==u||n(u)){if(n(u))for(c=0,d=u.length;c<d;c++)f=u[c],null==f||n(f)||(r=Ce(t,o,a,r,f))}else r=Ce(t,o,a,r,u);t.restore();const g=a.length/2;if(g>i.length){for(h=0;h<g;h++)delete o[a[h]];a.splice(0,g)}return r}function Ae(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Te(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Le(t,e,i,s){Ee(t,e,i,s,null)}function Ee(t,e,i,s,n){let o,a,r,l,h,c,d,u;const f=e.pointStyle,g=e.rotation,p=e.radius;let m=(g||0)*L;if(f&&"object"==typeof f&&(o=f.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),void t.restore();if(!(isNaN(p)||p<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,p,0,0,O):t.arc(i,s,p,0,O),t.closePath();break;case"triangle":c=n?n/2:p,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,l=p-h,a=Math.cos(m+R)*l,d=Math.cos(m+R)*(n?n/2-h:l),r=Math.sin(m+R)*l,u=Math.sin(m+R)*(n?n/2-h:l),t.arc(i-d,s-r,h,m-C,m-E),t.arc(i+u,s-a,h,m-E,m),t.arc(i+d,s+r,h,m,m+E),t.arc(i-u,s+a,h,m+E,m+C),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,c=n?n/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=R;case"rectRot":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+u,s-a),t.lineTo(i+d,s+r),t.lineTo(i-u,s+a),t.closePath();break;case"crossRot":m+=R;case"cross":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"star":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a),m+=R,d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"line":a=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,t.moveTo(i-a,s-r),t.lineTo(i+a,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function Re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ie(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ze(t){t.restore()}function Fe(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Ve(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function Be(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function We(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Ne(t,e,i,o,a,r={}){const l=n(e)?e:[e],h=r.strokeWidth>0&&""!==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;c<l.length;++c)d=l[c],r.backdrop&&We(t,r.backdrop),h&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),s(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(d,i,o,r.maxWidth)),t.fillText(d,i,o,r.maxWidth),Be(t,i,o,d,r),o+=Number(a.lineHeight);t.restore()}function He(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,1.5*C,C,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,C,E,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,E,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-E,!0),t.lineTo(i+a.topLeft,s)}function je(t,e=[""],i,s,n=(()=>t[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)?Je(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=Je(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=Je(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))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 Ze(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 Je(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=Ze(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;r<l;++r)h=r+i,c=e[h],a[r]={r:n.parse(M(c,o),h)};return a}const si=Number.EPSILON||1e-14,ni=(t,e)=>e<t.length&&!t[e].skip&&t[e],oi=t=>"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<s;++a)if(r=l,l=h,h=ni(t,a+1),l){if(h){const t=h[e]-l[e];n[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?F(n[a-1])!==F(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,l,h=ni(t,0);for(let c=0;c<s-1;++c)l=h,h=ni(t,c+1),l&&h&&(V(e[c],0,si)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=oi(i),n=t.length;let o,a,r,l=ni(t,0);for(let h=0;h<n;++h){if(a=r,r=l,l=ni(t,h+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[h]),l&&(o=(l[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[h])}}(t,o,e)}function li(t,e,i){return Math.max(Math.min(t,i),e)}function hi(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)ri(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=ai(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=Re(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&Re(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=li(n.cp1x,e.left,e.right),n.cp1y=li(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=li(n.cp2x,e.left,e.right),n.cp2y=li(n.cp2y,e.top,e.bottom)))}(t,i)}const ci=t=>0===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 bi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,xi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(bi);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(xi)&&(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;o<a;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),l=!1),void 0!==i&&n(r)&&(r=r[i%r.length],l=!1),void 0!==r))return s&&!l&&(s.cacheable=!1),r}function Di(t,e,i){const{min:s,max:n}=t,o=c(e,(n-s)/2),a=(t,e)=>i&&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:Z,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;h<c&&a(r(e[d%l][s]),n,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,b,x=!1,_=null;const y=()=>x||l(n,b,p)&&0!==r(n,b),v=()=>!x||0===r(o,p)||l(o,b,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==b&&(x=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,b=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;n<s.length;n++){const o=Ri(s[n],t.points,e);o.length&&i.push(...o)}return i}function zi(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&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<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}function Fi(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=Vi(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=Vi(s.setContext(Ci(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Bi(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return h}(t,e,i,s):e}function Vi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Bi(t,e){if(!e)return!1;const i=[],s=function(t,e){return Jt(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)}var Wi=Object.freeze({__proto__:null,HALF_PI:E,INFINITY:T,PI:C,PITAU:A,QUARTER_PI:R,RAD_PER_DEG:L,TAU:O,TWO_THIRDS_PI:I,_addGrace:Di,_alignPixel:Ae,_alignStartEnd:ft,_angleBetween:Z,_angleDiff:K,_arrayUnique:lt,_attachContext:$e,_bezierCurveTo:Ve,_bezierInterpolation:mi,_boundSegment:Ri,_boundSegments:Ii,_capitalize:w,_computeSegments:zi,_createResolver:je,_decimalPlaces:U,_deprecated:function(t,e,i,s){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+s+'" instead')},_descriptors:Ye,_elementsEqual:f,_factorize:W,_filterBetween:nt,_getParentNode:ge,_getStartAndCountOfVisiblePoints:pt,_int16Range:Q,_isBetween:tt,_isClickEvent:D,_isDomSupported:fe,_isPointInArea:Re,_limitValue:J,_longestText:Oe,_lookup:et,_lookupByKey:it,_measureText:Ce,_merger:m,_mergerIf:_,_normalizeAngle:G,_parseObjectDataRadialScale:ii,_pointInLine:gi,_readValueToProps:vi,_rlookupByKey:st,_scaleRangesChanged:mt,_setMinAndMaxByKey:j,_splitKey:v,_steppedInterpolation:pi,_steppedLineTo:Fe,_textX:gt,_toLeftRightCenter:ut,_updateBezierControlPoints:hi,addRoundedRectPath:He,almostEquals:V,almostWhole:H,callback:d,clearCanvas:Te,clipArea:Ie,clone:g,color:Qt,createContext:Ci,debounce:dt,defined:k,distanceBetweenPoints:q,drawPoint:Le,drawPointLegend:Ee,each:u,easingEffects:fi,finiteOrDefault:r,fontString:function(t,e,i){return e+" "+t+"px "+i},formatNumber:ne,getAngleFromPoint:X,getHoverColor:te,getMaximumSize:we,getRelativePosition:ve,getRtlAdapter:Oi,getStyle:be,isArray:n,isFinite:a,isFunction:S,isNullOrUndef:s,isNumber:N,isObject:o,isPatternOrGradient:Jt,listenArrayEvents:at,log10:z,merge:b,mergeIf:x,niceNum:B,noop:e,overrideTextDirection:Ai,readUsedSize:Pe,renderText:Ne,requestAnimFrame:ht,resolve:Pi,resolveObjectKey:M,restoreTextDirection:Ti,retinaScale:ke,setsEqual:P,sign:F,splineCurve:ai,splineCurveMonotone:ri,supportsEventListenerOptions:Se,throttled:ct,toDegrees:Y,toDimension:c,toFont:Si,toFontString:De,toLineHeight:_i,toPadding:ki,toPercentage:h,toRadians:$,toTRBL:Mi,toTRBLCorners:wi,uid:i,unclipArea:ze,unlistenArrayEvents:rt,valueOrDefault:l});function Ni(t,e,i,s){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale;if(r&&e===r.axis&&"r"!==e&&a&&o.length){const t=r._reversePixels?st:it;if(!s)return t(o,e,i);if(n._sharedOptions){const s=o[0],n="function"==typeof s.getRange&&s.getRange(e);if(n){const s=t(o,e,i-n),a=t(o,e,i+n);return{lo:s.lo,hi:a.hi}}}}return{lo:0,hi:o.length-1}}function Hi(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:l,hi:h}=Ni(o[t],e,a,n);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function ji(t,e,i,s,n){const o=[];if(!n&&!t.isPointInArea(e))return o;return Hi(t,i,e,(function(i,a,r){(n||Re(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&o.push({element:i,datasetIndex:a,index:r})}),!0),o}function $i(t,e,i,s,n,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return Hi(t,i,e,(function(i,h,c){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n);if(!(!!o||t.isPointInArea(u))&&!d)return;const f=r(e,u);f<l?(a=[{element:i,datasetIndex:h,index:c}],l=f):f===l&&a.push({element:i,datasetIndex:h,index:c})})),a}function Yi(t,e,i,s,n,o){return o||t.isPointInArea(e)?"r"!==i||s?$i(t,e,i,s,n,o):function(t,e,i,s){let n=[];return Hi(t,i,e,(function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=X(t,{x:e.x,y:e.y});Z(l,a,r)&&n.push({element:t,datasetIndex:i,index:o})})),n}(t,e,i,n):[]}function Ui(t,e,i,s,n){const o=[],a="x"===i?"inXRange":"inYRange";let r=!1;return Hi(t,i,e,((t,s,l)=>{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 Xi={evaluateInteractionItems:Hi,modes:{index(t,e,i,s){const n=ve(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?ji(t,n,o,s,a):Yi(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?ji(t,n,o,s,a):Yi(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;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,s)=>ji(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 Yi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>Ui(t,ve(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Ui(t,ve(e,t),"y",i.intersect,s)}};const qi=["left","top","right","bottom"];function Ki(t,e){return t.filter((t=>t.pos===e))}function Gi(t,e){return t.filter((t=>-1===qi.indexOf(t.pos)&&t.box.axis===e))}function Zi(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 Ji(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!qi.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<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:a&&e.availableHeight)}return i}function Qi(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function ts(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function es(t,e,i,s){const{pos:n,box:a}=i,r=t.maxPadding;if(!o(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?a.height:a.width),i.size=e.size/e.count,t[n]+=i.size}a.getPadding&&ts(r,a.getPadding());const l=Math.max(0,e.outerWidth-Qi(r,t,"left","right")),h=Math.max(0,e.outerHeight-Qi(r,t,"top","bottom")),c=l!==t.w,d=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:c,other:d}:{same:d,other:c}}function is(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function ss(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,is(r.horizontal,e));const{same:a,other:d}=es(e,i,r,s);h|=a&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&ss(n,e,i,s)||c}function ns(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function os(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,o=l.size||t.height;k(l.start)&&(a=l.start),t.fullSize?ns(t,n.left,a,i.outerWidth-n.right-n.left,o):ns(t,e.left+l.placed,a,s,o),l.start=a,l.placed+=s,a=t.bottom}else{const s=e.h*h,a=l.size||t.width;k(l.start)&&(o=l.start),t.fullSize?ns(t,o,n.top,a,i.outerHeight-n.bottom-n.top):ns(t,o,e.top+l.placed,a,s),l.start=o,l.placed+=s,o=t.right}}e.x=o,e.y=a}var as={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=ki(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Zi(e.filter((t=>t.box.fullSize)),!0),s=Zi(Ki(e,"left"),!0),n=Zi(Ki(e,"right")),o=Zi(Ki(e,"top"),!0),a=Zi(Ki(e,"bottom")),r=Gi(e,"x"),l=Gi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ki(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);ts(f,ki(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=Ji(l.concat(h),d);ss(r.fullSize,g,d,p),ss(l,g,d,p),ss(h,g,d,p)&&ss(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),os(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,os(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 rs{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 ls extends rs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const hs="$chartjs",cs={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ds=t=>null===t||""===t;const us=!!Se&&{passive:!0};function fs(t,e,i){t.canvas.removeEventListener(e,i,us)}function gs(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function ps(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||gs(i.addedNodes,s),e=e&&!gs(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ms(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||gs(i.removedNodes,s),e=e&&!gs(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const bs=new Map;let xs=0;function _s(){const t=window.devicePixelRatio;t!==xs&&(xs=t,bs.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ys(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<n.clientWidth&&i()}),window),a=new ResizeObserver((t=>{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){bs.size||window.addEventListener("resize",_s),bs.set(t,e)}(t,o),a}function vs(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){bs.delete(t),bs.size||window.removeEventListener("resize",_s)}(t)}function Ms(t,e,i){const s=t.canvas,n=ct((e=>{null!==t.ctx&&i(function(t,e){const i=cs[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.addEventListener(e,i,us)}(s,e,n),n}class ws extends rs{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[hs]={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",ds(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(ds(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[hs])return!1;const i=e[hs].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[hs],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:ps,detach:ms,resize:ys}[e]||Ms;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:vs,detach:vs,resize:vs}[e]||fs)(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=ge(t);return!(!e||!e.isConnected)}}function ks(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ls:ws}var Ss=Object.freeze({__proto__:null,BasePlatform:rs,BasicPlatform:ls,DomPlatform:ws,_detectPlatform:ks});const Ps="transparent",Ds={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||Ps),n=s.valid&&Qt(e||Ps);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Cs{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||Ds[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||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?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<i.length;t++)i[t][e]()}}class Os{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!o(t))return;const e=Object.keys(ue.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{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<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{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 Cs(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?(xt.add(this._chart,i),!0):void 0}}function As(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 Ts(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function Ls(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let r,l,h,c;if(null!==e){for(r=0,l=n.length;r<l;++r){if(h=+n[r],h===i){if(s.all)continue;break}c=t.values[h],a(c)&&(o||0===e||F(e)===F(c))&&(e+=c)}return e}}function Es(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Rs(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Is(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function zs(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;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=Rs(n,c,o),u[r]=d,u._top=Is(u,a,!0,s.type),u._bottom=Is(u,a,!1,s.type);(u._visualValues||(u._visualValues={}))[r]=d}}function Fs(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Vs(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 Bs=t=>"reset"===t||"none"===t,Ws=(t,e)=>e?t:Object.assign({},t);class Ns{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=Es(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&&Vs(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,Fs(t,"x")),o=e.yAxisID=l(i.yAxisID,Fs(t,"y")),a=e.rAxisID=l(i.rAxisID,Fs(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&&Vs(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(o(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s],i[s]={x:o,y:t[o]};return i}(e);else if(i!==e){if(i){rt(i,this);const t=this._cachedMeta;Vs(t),t._parsed=[]}e&&Object.isExtensible(e)&&at(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=Es(e.vScale,e),e.stack!==i.stack&&(s=!0,Vs(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&zs(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:a,_stacked:r}=i,l=a.axis;let h,c,d,u=0===t&&e===s.length||i._sorted,f=t>0&&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]<f[l];for(h=0;h<e;++h)i._parsed[h+t]=c=d[h],u&&(a()&&(u=!1),f=c);i._sorted=u}r&&zs(this,d)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),h=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:h||n.parse(l[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(M(u,a),d),y:o.parse(M(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return Ls({keys:Ts(s,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=Ls(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,r=this._getOtherScale(t),l=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Ts(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<e}for(u=0;u<o&&(g()||(this.updateRangeFromParsed(h,t,f,l),!n));++u);if(n)for(u=o-1;u>=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<n;++s)o=e[s][t.axis],a(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return o(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(l(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=As(t,i),n=As(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Ci(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Ci(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&k(i);if(a)return Ws(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(ue.elements[t]),f=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s,e)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Ws(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 Os(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||Bs(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){Bs(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Bs(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<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Vs(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class Hs{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return N(this.x)&&N(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function js(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;i<s;i++)t[i].major&&e.push(i);return e}(e):[],r=a.length,l=a[0],h=a[r-1],c=[];if(r>o)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,c,a,r/o),c;const d=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=W(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)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($s(e,c,d,s(n)?0:l-n,l),t=0,i=r-1;t<i;t++)$s(e,c,d,a[t],a[t+1]);return $s(e,c,d,h,s(n)?e.length:h+n),c}return $s(e,c,d),c}function $s(t,e,i,s,n){const o=l(s,0),a=Math.min(l(n,t.length),t.length);let r,h,c,d=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),c=o;c<0;)d++,c=Math.round(o+d*i);for(h=Math.max(o,0);h<a;h++)h===c&&(e.push(t[h]),d++,c=Math.round(o+d*i))}const Ys=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,Us=(t,e)=>Math.min(e||t,t);function Xs(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function qs(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<o-r||h>a+r)))return h}function Ks(t){return t.drawTicks?t.tickLength:0}function Gs(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 Zs(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 Js extends Hs{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;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?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<this.ticks.length;this._convertTicksToLabels(r?Xs(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=js(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=d(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=Us(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let o,a,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=J(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-Ks(t.grid)-e.padding-Gs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Y(Math.min(Math.asin(J((h.highest.height+6)/o,-1,1)),Math.asin(J(a/r,-1,1))-Math.asin(J(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=Gs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ks(n)+o):(t.height=this.maxHeight,t.width=Ks(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<i;e++)s(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Xs(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:o,_longestTextCache:a}=this,r=[],l=[],h=Math.floor(e/Us(e,i));let c,d,f,g,p,m,b,x,_,y,v,M=0,w=0;for(c=0;c<e;c+=h){if(g=t[c].label,p=this._resolveTickFontOptions(c),o.font=m=p.string,b=a[m]=a[m]||{data:{},gc:[]},x=p.lineHeight,_=y=0,s(g)||n(g)){if(n(g))for(d=0,f=g.length;d<f;++d)v=g[d],s(v)||n(v)||(_=Ce(o,b.data,b.gc,_,v),y+=x)}else _=Ce(o,b.data,b.gc,_,g),y=x;r.push(_),l.push(y),M=Math.max(_,M),w=Math.max(y,w)}!function(t,e){u(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(a,e);const k=r.indexOf(M),S=l.indexOf(w),P=t=>({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&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Ci(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Ci(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=$(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_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=Ks(n),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(t){return Ae(i,t,p)};let x,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)x=b(this.bottom),w=this.bottom-u,S=x-m,D=b(t.top)+m,O=t.bottom;else if("bottom"===a)x=b(this.top),D=t.top,O=b(t.bottom)-m,w=x+m,S=this.top+u;else if("left"===a)x=b(this.right),M=this.right-u,k=x-m,P=b(t.left)+m,C=t.right;else if("right"===a)x=b(this.left),P=t.left,C=b(t.right)-m,M=x+m,k=this.left+u;else if("x"===e){if("center"===a)x=b((t.top+t.bottom)/2+.5);else if(o(a)){const t=Object.keys(a)[0],e=a[t];x=b(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=x+m,S=w+u}else if("y"===e){if("center"===a)x=b((t.left+t.right)/2);else if(o(a)){const t=Object.keys(a)[0],e=a[t];x=b(this.chart.scales[t].getPixelForValue(e))}M=x-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;_<d;_+=T){const t=this.getContext(_),e=n.setContext(t),s=r.setContext(t),o=e.lineWidth,a=e.color,l=s.dash||[],d=s.dashOffset,u=e.tickWidth,g=e.tickColor,p=e.tickBorderDash||[],m=e.tickBorderDashOffset;y=qs(this,_,h),void 0!==y&&(v=Ae(i,y,o),c?M=k=P=C=v:w=S=D=O=v,f.push({tx1:M,ty1:w,tx2:k,ty2:S,x1:P,y1:D,x2:C,y2:O,width:o,color:a,borderDash:l,borderDashOffset:d,tickWidth:u,tickColor:g,tickBorderDash:p,tickBorderDashOffset:m}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:a}=i,r=this.isHorizontal(),l=this.ticks,{align:h,crossAlign:c,padding:d,mirror:u}=a,f=Ks(i.grid),g=f+d,p=u?-d:g,m=-$(this.labelRotation),b=[];let x,_,y,v,M,w,k,S,P,D,C,O,A="middle";if("top"===s)w=this.bottom-p,k=this._getXAxisLabelAlignment();else if("bottom"===s)w=this.top+p,k=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("x"===e){if("center"===s)w=(t.top+t.bottom)/2+g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];w=this.chart.scales[t].getPixelForValue(e)+g}k=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)M=(t.left+t.right)/2-g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];M=this.chart.scales[t].getPixelForValue(e)}k=this._getYAxisLabelAlignment(f).textAlign}"y"===e&&("start"===h?A="top":"end"===h&&(A="bottom"));const T=this._getLabelSizes();for(x=0,_=l.length;x<_;++x){y=l[x],v=y.label;const t=a.setContext(this.getContext(x));S=this.getPixelForTick(x)+a.labelOffset,P=this._resolveTickFontOptions(x),D=P.lineHeight,C=n(v)?v.length:1;const e=C/2,i=t.color,o=t.textStrokeColor,h=t.textStrokeWidth;let d,f=k;if(r?(M=S,"inner"===k&&(f=x===_-1?this.options.reverse?"left":"right":0===x?this.options.reverse?"right":"left":"center"),O="top"===s?"near"===c||0!==m?-C*D+D/2:"center"===c?-T.highest.height/2-e*D+D:-T.highest.height+D/2:"near"===c||0!==m?D/2:"center"===c?T.highest.height/2-e*D:T.highest.height-C*D,u&&(O*=-1),0===m||t.showLabelBackdrop||(M+=D/2*Math.sin(m))):(w=S,O=(1-C)*D/2),t.showLabelBackdrop){const e=ki(t.backdropPadding),i=T.heights[x],s=T.widths[x];let n=O-e.top,o=0-e.left;switch(A){case"middle":n-=i/2;break;case"bottom":n-=i}switch(k){case"center":o-=s/2;break;case"right":o-=s}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}b.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 b}_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<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),o=i.display?n.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=Ae(t,this.left,o)-o/2,h=Ae(t,this.right,a)+a/2,c=d=r):(c=Ae(t,this.top,o)-o/2,d=Ae(t,this.bottom,a)+a/2,l=h=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Ie(e,i);const s=this.getLabelItems(t);for(const t of s){const i=t.options,s=t.font;Ne(e,t.label,0,t.textOffset,s,i)}i&&ze(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const a=Si(i.font),r=ki(i.padding),l=i.align;let h=a.lineHeight/2;"bottom"===e||"center"===e||o(e)?(h+=r.bottom,n(i.text)&&(h+=a.lineHeight*(i.text.length-1))):h+=r.top;const{titleX:c,titleY:d,maxWidth:u,rotation:f}=function(t,e,i,s){const{top:n,left:a,bottom:r,right:l,chart:h}=t,{chartArea:c,scales:d}=h;let u,f,g,p=0;const m=r-n,b=l-a;if(t.isHorizontal()){if(f=ft(s,a,l),o(i)){const t=Object.keys(i)[0],s=i[t];g=d[t].getPixelForValue(s)+m-e}else g="center"===i?(c.bottom+c.top)/2+m-e:Ys(t,i,e);u=l-a}else{if(o(i)){const t=Object.keys(i)[0],s=i[t];f=d[t].getPixelForValue(s)-b+e}else f="center"===i?(c.left+c.right)/2-b+e:Ys(t,i,e);g=ft(s,r,n),p="left"===i?-E:E}return{titleX:f,titleY:g,maxWidth:u,rotation:p}}(this,h,e,l);Ne(t,i.text,0,0,a,{color:i.color,maxWidth:u,rotation:f,textAlign:Zs(l,e,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=l(t.grid&&t.grid.z,-1),s=l(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Js.prototype.draw?[{z:i,draw:t=>{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<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return Si(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Qs{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=b(Object.create(null),[i?ue.get(i):{},ue.get(e),t.defaults]);ue.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{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 tn{constructor(){this.controllers=new Qs(Ns,"datasets",!0),this.elements=new Qs(Hs,"elements"),this.plugins=new Qs(Object,"plugins"),this.scales=new Qs(Js,"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;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var en=new tn;class sn{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===d(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){s(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=l(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],s=Object.keys(en.plugins.items);for(let t=0;t<s.length;t++)i.push(en.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,n){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=nn(s[e],n);null!==l&&o.push({plugin:r,options:on(t.config,{plugin:r,local:i[e]},l,a)})}return o}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.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 nn(t,e){return e||!1!==t?!0===t?{}:t:null}function on(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 an(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function rn(t){if("x"===t||"y"===t||"r"===t)return t}function ln(t,...e){if(rn(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&&rn(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 hn(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function cn(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},n=an(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=ln(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 hn(t,"x",i[0])||hn(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]=x(Object.create(null),[{axis:l},r,c[l],c[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||an(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),x(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];x(e,[ue.scales[e.type],ue.scale])})),a}function dn(t){const e=t.options||(t.options={});e.plugins=l(e.plugins,{}),e.scales=cn(t,e)}function un(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const fn=new Map,gn=new Set;function pn(t,e){let i=fn.get(t);return i||(i=e(),fn.set(t,i),gn.add(i)),i}const mn=(t,e,i)=>{const s=M(e,i);void 0!==s&&t.add(s)};class bn{constructor(t){this._config=function(t){return(t=t||{}).data=un(t.data),dn(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=un(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(),dn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return pn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return pn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return pn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return pn(`${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=>mn(r,t,e)))),e.forEach((t=>mn(r,s,t))),e.forEach((t=>mn(r,re[n]||{},t))),e.forEach((t=>mn(r,ue,t))),e.forEach((t=>mn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),gn.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}=xn(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)||_n(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}=xn(this._resolverCache,t,i);return o(e)?$e(n,e,void 0,s):n}}function xn(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 _n=t=>o(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||S(t[i])),!1);const yn=["top","bottom","left","right","chartArea"];function vn(t,e){return"top"===t||"bottom"===t||-1===yn.indexOf(t)&&"x"===e}function Mn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function wn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function kn(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Sn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Pn={},Dn=t=>{const e=Sn(t);return Object.values(Pn).filter((t=>t.canvas===e)).pop()};function Cn(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)}}}function On(t,e,i){return t.options.clip?t[i]:e[i]}class An{static defaults=ue;static instances=Pn;static overrides=re;static registry=en;static version="4.4.0";static getChart=Dn;static register(...t){en.add(...t),Tn()}static unregister(...t){en.remove(...t),Tn()}constructor(t,e){const s=this.config=new bn(e),n=Sn(t),o=Dn(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||ks(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 sn,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=[],Pn[this.id]=this,r&&l?(xt.listen(this,"complete",wn),xt.listen(this,"progress",kn),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 en}_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 xt.stop(this),this}resize(t,e){xt.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=ln(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=ln(o,n),r=l(n.type,e.dtype);void 0!==n.position&&vn(n.position,a)===vn(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(en.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=>{as.configure(this,t,t.options),as.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;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Mn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.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<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||an(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=en.getController(o),{datasetElementType:s,dataElementType:a}=ue.datasets[o];Object.assign(e,{dataElementType:en.getElement(a),datasetElementType:s&&en.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){u(this.data.datasets,((t,e)=>{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<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||u(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Mn("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=>{as.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){Cn(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;t<e;t++)if(!P(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;as.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<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,S(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(xt.has(this)?this.attached&&!xt.running(this)&&xt.start(this):(this.draw(),wn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=function(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:On(i,e,"left"),right:On(i,e,"right"),top:On(s,e,"top"),bottom:On(s,e,"bottom")}:e}(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&Ie(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&ze(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Xi.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(),xt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Te(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Pn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{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<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{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 Tn(){return u(An.instances,(t=>t._plugins.invalidate()))}function Ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class En{static override(t){Object.assign(En.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ln()}parse(){return Ln()}format(){return Ln()}add(){return Ln()}diff(){return Ln()}startOf(){return Ln()}endOf(){return Ln()}}var Rn={_date:En};function In(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;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=lt(s.sort(((t,e)=>t-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;s<n;++s)o=e.getPixelForValue(i[s]),l();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),l();return r}function zn(t,e,i,s){return n(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,h=r;Math.abs(a)>Math.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 Fn(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;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(a[h],h),l.push(zn(u,d,o,h));return l}function Vn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Bn(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(o[Wn(c,a,r,l)]=!0,n=h)),o[Wn(n,a,r,l)]=!0,t.borderSkipped=o}function Wn(t,e,i,s){var n,o,a;return s?(a=i,t=Nn(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Nn(t,e,i),t}function Nn(t,e,i){return"start"===t?e:"end"===t?i:t}function Hn(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class jn extends Ns{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"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;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{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()}}}};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;n<a;++n)s._parsed[n]=r(n)}}_getRotation(){return $(this.options.rotation-90)}_getCircumference(){return $(this.options.circumference)}_getRotationExtents(){let t=O,e=-O;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min(h(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<O){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,s)=>Z(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>Z(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(E,c,u),b=g(C,h,d),x=g(C+E,c,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,a=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),b=(i.width-o)/f,x=(i.height-o)/g,_=Math.max(Math.min(b,x)/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;p<e;++p)m+=this._circumference(p,n);for(p=e;p<e+i;++p){const e=this._circumference(p,n),i=t[p],o={x:l+this.offsetX,y:h+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};g&&(o.options=f||this.resolveDataElementOptions(p,i.active?"active":s)),m+=e,this.updateElement(i,p,o,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!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<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(l(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class $n extends Ns{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{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)&&(s<e.min&&(e.min=s),s>e.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<e;++d)u+=this._computeAngle(d,s,f);for(d=e;d<e+i;d++){const e=t[d];let i=u,g=u+this._computeAngle(d,s,f),p=o.getDataVisibility(d)?r.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=g,n&&(a.animateScale&&(p=0),a.animateRotate&&(i=g=c));const m={x:l,y:h,innerRadius:0,outerRadius:p,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":s)};this.updateElement(e,d,m,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!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 Yn=Object.freeze({__proto__:null,BarController:class extends Ns{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 Fn(t,e,i,s)}parseArrayData(t,e,i,s){return Fn(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;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(M(g,l),d),c.push(zn(M(g,h),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=Vn(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),h=r.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){const e=this.getParsed(f),i=o||s(e[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,c),p=(e._stacks||{})[r.axis],m={horizontal:h,base:i.base,enableBorderRadius:!p||Vn(e._custom)||a===p._top||a===p._bottom,x:h?i.head:g.center,y:h?g.center:i.head,height:h?g.size:Math.abs(i.size),width:h?Math.abs(i.size):g.size};u&&(m.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const b=m.options||t[f].options;Bn(m,b,p,a),Hn(m,b,c.ratio),this.updateElement(t[f],f,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,a=[],r=t=>{const i=t.controller.getParsed(e),n=i&&i[t.vScale.axis];if(s(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!r(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}_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<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||In(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),h=l._custom,c=Vn(h);let d,u,f=l[e.axis],g=0,p=i?this.applyStack(e,l,i):f;p!==f&&(g=p-f,p=f),c&&(f=h.barStart,p=h.barEnd-h.barStart,0!==f&&F(f)!==F(h.barEnd)&&(g=0),g+=f);const m=s(o)||c?g:o;let b=e.getPixelForValue(m);if(d=this.chart.getDataVisibility(t)?e.getPixelForValue(g+p):b,u=d-b,Math.abs(u)<a){u=function(t,e,i){return 0!==t?F(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(u,e,r)*a,f===r&&(b-=u/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),o=Math.min(t,s),h=Math.max(t,s);b=Math.max(Math.min(b,h),o),d=b+u,i&&!c&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(d)-e.getValueForPixel(b))}if(b===e.getPixelForValue(r)){const t=F(u)*e.getLineWidthForValue(r)/2;b+=t,u-=t}return{size:u,base:b,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;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="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<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let a,r;return s(o)?(a=e.min*i.categoryPercentage,r=i.barPercentage):(a=o*n,r=1),{chunk:a/n,ratio:r,start:e.pixels[t]-a/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,h=Math.min(a,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),h=Math.min(a,e.min*e.ratio);return{base:r-h/2,head:r+h/2,center:r,size:h}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null!==this.getParsed(n)[e.axis]&&i[n].draw(this._ctx)}},BubbleController:class extends Ns{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=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;d<e+i;d++){const e=t[d],i=!n&&this.getParsed(d),u={},f=u[h]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[h]),g=u[c]=n?a.getBasePixel():a.getPixelForValue(i[c]);u.skip=isNaN(f)||isNaN(g),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":s),n&&(u.options.radius=0)),this.updateElement(e,d,u,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=l(i&&i._custom,n),s}},DoughnutController:jn,LineController:class extends Ns{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=pt(e,s,o);this._drawStart=a,this._drawCount=r,mt(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:g,segment:p}=this.options,m=N(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||"none"===n,x=e+i,_=t.length;let y=e>0&&this.getParsed(e-1);for(let i=0;i<_;++i){const g=t[i],_=b?g:{};if(i<e||i>=x){_.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)),b||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 jn{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:$n,RadarController:class extends Ns{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;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":s),r=n.getPointPositionForValue(a,this.getParsed(a).r),l=o?n.xCenter:r.x,h=o?n.yCenter:r.y,c={x:l,y:h,angle:r.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,a,c,s)}}},ScatterController:class extends Ns{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};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);return{label:i[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:o}=pt(e,i,s);if(this._drawStart=n,this._drawCount=o,mt(e)&&(n=0,o=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:o}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(n,void 0,{animated:!s,options:a},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(c),u=this.includeOptions(n,d),f=a.axis,g=r.axis,{spanGaps:p,segment:m}=this.options,b=N(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||"none"===n;let _=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),p=x?e:{},y=s(i[g]),v=p[f]=a.getPixelForValue(i[f],c),M=p[g]=o||y?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,i,l):i[g],c);p.skip=isNaN(v)||isNaN(M)||y,p.stop=c>0&&Math.abs(i[f]-_[f])>b,m&&(p.parsed=i,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),x||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 Un(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 J(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:J(n.innerStart,0,a),innerEnd:J(n.innerEnd,0,a)}}function Xn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function qn(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,b=n-p-f,{outerStart:x,outerEnd:_,innerStart:y,innerEnd:v}=Un(e,u,d,b-m),M=d-x,w=d-_,k=m+x/M,S=b-_/w,P=u+y,D=u+v,O=m+y/P,A=b-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=Xn(w,S,a,r);t.arc(e.x,e.y,_,S,b+E)}const i=Xn(D,b,a,r);if(t.lineTo(i.x,i.y),v>0){const e=Xn(D,A,a,r);t.arc(e.x,e.y,v,b+E,A+Math.PI)}const s=(b-v/u+(m+y/u))/2;if(t.arc(a,r,u,b-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=Xn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-E)}const n=Xn(M,m,a,r);if(t.lineTo(n.x,n.y),x>0){const e=Xn(M,k,a,r);t.arc(e.x,e.y,x,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 Kn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u}=l,f="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,f?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let g=e.endAngle;if(o){qn(t,e,i,s,g,n);for(let e=0;e<o;++e)t.stroke();isNaN(r)||(g=a+(r%O||O))}f&&function(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(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,g),o||(qn(t,e,i,s,g,n),t.stroke())}function Gn(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 Jn(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=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function Qn(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:h}=Jn(n,i,s),c=function(t){return t.stepped?Fe:t.tension||"monotone"===t.cubicInterpolationMode?Ve:Zn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=h;++d)u=n[(r+(p?h-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return l&&(u=n[(r+(p?h:0))%a],c(t,f,u,p,o.stepped)),!!l}function to(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=Jn(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,f,g,p,m=0,b=0;const x=t=>(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(b*m+e)/++b):(_(),t.lineTo(e,i),u=s,b=0,f=g=i),p=i}_()}function eo(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?to:Qn}const io="function"==typeof Path2D;function so(t,e,i,s){io&&!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()),Gn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=eo(e);for(const r of n)Gn(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 no extends Hs{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<h;++l){const{start:h,end:c}=o[l],d=n[h],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return eo(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=eo(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),so(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function oo(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}function ao(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=o/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function ro(t,e,i,s){return t?0:J(e,i,s)}function lo(t){const e=ao(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=Mi(s);return{t:ro(n.top,o.top,0,i),r:ro(n.right,o.right,0,e),b:ro(n.bottom,o.bottom,0,i),l:ro(n.left,o.left,0,e)}}(t,i/2,s/2),a=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,a=wi(n),r=Math.min(e,i),l=t.borderSkipped,h=s||o(n);return{topLeft:ro(!h||l.top||l.left,a.topLeft,0,r),topRight:ro(!h||l.top||l.right,a.topRight,0,r),bottomLeft:ro(!h||l.bottom||l.left,a.bottomLeft,0,r),bottomRight:ro(!h||l.bottom||l.right,a.bottomRight,0,r)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:a},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}function ho(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&ao(t,s);return a&&(n||tt(e,a.left,a.right))&&(o||tt(i,a.top,a.bottom))}function co(t,e){t.rect(e.x,e.y,e.w,e.h)}function uo(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var fo=Object.freeze({__proto__:null,ArcElement:class extends Hs{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"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)>=O||Z(n,a,r),g=tt(o,h+u,c+u);return f&&g}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){qn(t,e,i,s,l,n);for(let e=0;e<o;++e)t.fill();isNaN(r)||(l=a+(r%O||O))}qn(t,e,i,s,l,n),t.fill()}(t,this,r,n,o),Kn(t,this,r,n,o),t.restore()}},BarElement:class extends Hs{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=lo(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?He:co;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,uo(o,e,n)),t.clip(),a(t,uo(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,uo(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return ho(this,t,e,i)}inXRange(t,e){return ho(this,t,null,e)}inYRange(t,e){return ho(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:no,PointElement:class extends Hs{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return oo(this,t,"x",e)}inYRange(t,e){return oo(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Re(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Le(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});function go(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("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 po(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function mo(t,e,{horizontal:i,minRotation:s}){const n=$(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class bo extends Js{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return s(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=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,b=!s(a),x=!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&&!b&&!x)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),b&&x&&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=b?a:M,w=x?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(b&&(u&&M!==a?(i.push({value:a}),M<a&&D++,V(Math.round((M+D*S)*v)/v,a,mo(a,y,t))&&D++):M<a&&D++);D<k;++D){const t=Math.round((M+D*S)*v)/v;if(x&&t>r)break;i.push({value:t})}return x&&u&&w!==r?i.length&&V(i[i.length-1].value,r,mo(r,y,t))?i[i.length-1].value=r:i.push({value:r}):x&&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 xo 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 _o=t=>Math.floor(z(t)),yo=(t,e)=>Math.pow(10,_o(t)+e);function vo(t){return 1===t/Math.pow(10,_o(t))}function Mo(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function wo(t,{min:e,max:i}){e=r(t.min,e);const s=[],n=_o(e);let o=function(t,e){let i=_o(e-t);for(;Mo(t,e,i)>10;)i++;for(;Mo(t,e,i)<10;)i--;return Math.min(i,_o(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<i;)s.push({value:f,major:vo(f),significand:u}),u>=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:vo(g),significand:u}),s}class ko extends Js{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===yo(this.min,0)?yo(this.min,-1):yo(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(yo(i,-1)),o(yo(s,1)))),i<=0&&n(yo(s,-1)),s<=0&&o(yo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=wo({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 So(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 Po(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Do(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;u<a;u++){const a=r.setContext(t.getPointLabelContext(u));o[u]=a.padding;const f=t.getPointPosition(u,t.drawingArea+o[u],l),g=Si(a.font),p=(h=t.ctx,c=g,d=n(d=t._pointLabels[u])?d:[d],{w:Oe(h,c.string,d),h:d.length*c.lineHeight});s[u]=p;const m=G(t.getIndexAngle(u)+l),b=Math.round(Y(m));Co(i,e,m,Po(b,f.x,p.w,0,180),Po(b,f.y,p.h,90,270))}var h,c,d;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:So(o)/2,additionalAngle:a?C/n:0};let h;for(let o=0;o<n;o++){l.padding=i[o],l.size=e[o];const n=Oo(t,o,l);s.push(n),"auto"===r&&(n.visible=Ao(n,h),n.visible&&(h=n))}return s}(t,s,o)}function Co(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Oo(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 Ao(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 To(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 Lo(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;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}class Eo extends bo{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ae.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,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(So(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/So(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?Do(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<e.length){const i=e[t];return function(t,e,i){return Ci(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-E+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Lo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));To(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){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(),Lo(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.ticks.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&&!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 Ro={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}},Io=Object.keys(Ro);function zo(t,e){return t-e}function Fo(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 Vo(t,e,i,s){const n=Io.length;for(let o=Io.indexOf(t);o<n-1;++o){const t=Ro[Io[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return Io[o]}return Io[n-1]}function Bo(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=et(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function Wo(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,n,i):s}class No extends Js{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 Rn._date(t.adapters.date);s.init(e),x(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:Fo(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?Vo(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=Io.length-1;o>=Io.indexOf(i);o--){const i=Io[o];if(Ro[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return Io[i?Io.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=Io.indexOf(t)+1,i=Io.length;e<i;++e)if(Ro[Io[e]].common)return Io[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),Wo(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+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=J(s,0,o),n=J(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||Vo(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<i;d=+t.add(d,a,o),u++)Bo(c,d,g);return d!==i&&"ticks"!==s.bounds&&1!==u||Bo(c,d,g),Object.keys(c).sort(zo).map((t=>+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;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=$(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,Wo(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?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<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Fo(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return lt(t.sort(zo))}}function Ho(t,e,i){let s,n,o,a,r=0,l=t.length-1;i?(e>=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 jo=Object.freeze({__proto__:null,CategoryScale:class extends Js{static id="category";static defaults={ticks:{callback:po}};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:J(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:go(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 po.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:xo,LogarithmicScale:ko,RadialLinearScale:Eo,TimeScale:No,TimeSeriesScale:class extends No{static id="timeseries";static defaults=No.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=Ho(e,this.min),this._tableRange=Ho(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<a;++o)l=t[o],l>=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;o<a;++o)h=s[o+1],r=s[o-1],l=s[o],Math.round((h+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-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(Ho(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Ho(this._table,i*this._tableRange+this._minPos,!0)}}});const $o=["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)"],Yo=$o.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Uo(t){return $o[t%$o.length]}function Xo(t){return Yo[t%Yo.length]}function qo(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof jn?e=function(t,e){return t.backgroundColor=t.data.map((()=>Uo(e++))),e}(i,e):n instanceof $n?e=function(t,e){return t.backgroundColor=t.data.map((()=>Xo(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Uo(e),t.backgroundColor=Xo(e),++e}(i,e))}}function Ko(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Go={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;if(!i.forceOverride&&(Ko(s)||(a=n)&&(a.borderColor||a.backgroundColor)||o&&Ko(o)))return;var a;const r=qo(t);s.forEach(r)}};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 Jo(t){t.data.datasets.forEach((t=>{Zo(t)}))}var Qo={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Jo(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=J(it(e,o.axis,a).lo,0,i-1)),s=h?J(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;c<o-2;c++){let s,n=0,o=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,b=m-h;for(s=h;s<m;s++)n+=t[s].x,o+=t[s].y;n/=b,o/=b;const x=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[p];for(u=f=-1,s=x;s<_;s++)f=.5*Math.abs((y-n)*(t[s].y-v)-(y-t[s].x)*(o-v)),f>u&&(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 b=[],x=e+i-1,_=t[e].x,y=t[x].x-_;for(o=e;o<e+i;++o){a=t[o],r=(a.x-_)/y*n,l=a.y;const e=0|r;if(e===h)l<f?(f=l,c=o):l>g&&(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&&b.push({...t[e],x:p}),s!==u&&s!==i&&b.push({...t[s],x:p})}o>0&&i!==u&&b.push(t[i]),b.push(a),h=e,m=0,f=g=l,c=d=u=o}}return b}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f}))},destroy(t){Jo(t)}};function ta(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 ea(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function ia(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function sa(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=ea(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 no({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function na(t){return t&&!1!==t.fill}function oa(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 aa(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 ra(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=la(o,e,"x");if(!(!l||a&&r))if(a)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function la(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],s=a[e.start][i],h=a[e.end][i];if(tt(n,s,h)){r=n===s,l=n===h;break}}return{first:r,last:l,point:s}}class ha{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:O},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function ca(t){const{chart:e,fill:i,line:s}=t;if(a(i))return function(t,e){const i=t.getDatasetMeta(e),s=i&&t.isDatasetVisible(e);return s?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const n=s[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);r.push(sa({x:null,y:e.bottom},s));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)ra(n,a[t],r)}return new no({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,a=s.reverse?e.max:e.min,r=function(t,e,i){let s;return s="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:o(t)?t.value:e.getBaseValue(),s}(i,e,a),l=[];if(s.grid.circular){const t=e.getPointPositionForValue(0,a);return new ha({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<n;++t)l.push(e.getPointPositionForValue(t,r));return l}(t);return function(t){const{scale:e={},fill:i}=t,s=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:o(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(a(s)){const t=e.isHorizontal();return{x:t?s:null,y:t?null:s}}return null}(t)}(t);return n instanceof ha?n:sa(n,s)}function da(t,e,i){const s=ca(e),{line:n,scale:o,axis:a}=e,r=n.options,l=r.fill,h=r.backgroundColor,{above:c=h,below:d=h}=l||{};s&&n.points.length&&(Ie(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&o!==n&&(ua(t,s,a.top),fa(t,{line:i,target:s,color:n,scale:r,property:l}),t.restore(),t.save(),ua(t,s,a.bottom));fa(t,{line:i,target:s,color:o,scale:r,property:l}),t.restore()}(t,{line:n,target:s,above:c,below:d,area:i,scale:o,axis:a}),ze(t))}function ua(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[ea(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function fa(t,e){const{line:i,target:s,property:n,color:o,scale:a}=e,r=function(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const t of s){let{start:s,end:r}=t;r=ea(s,r,n);const l=ta(i,n[s],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[s],end:n[r]});continue}const h=Ii(e,l);for(const e of h){const s=ta(i,o[e.start],o[e.end],e.loop),r=Ri(t,n,s);for(const t of r)a.push({source:t,target:e,start:{[i]:ia(l,s,"start",Math.max)},end:{[i]:ia(l,s,"end",Math.min)}})}}return a}(i,s,n);for(const{source:e,target:l,start:h,end:c}of r){const{style:{backgroundColor:r=o}={}}=e,d=!0!==s;t.save(),t.fillStyle=r,ga(t,a,d&&ta(n,h,c)),t.beginPath();const u=!!i.pathSegment(t,e);let f;if(d){u?t.closePath():pa(t,s,c,n);const e=!!s.pathSegment(t,l,{move:u,reverse:!0});f=u&&e,f||pa(t,s,h,n)}t.closePath(),t.fill(f?"evenodd":"nonzero"),t.restore()}}function ga(t,e,i){const{top:s,bottom:n}=e.chart.chartArea,{property:o,start:a,end:r}=i||{};"x"===o&&(t.beginPath(),t.rect(a,s,r-a,n-s),t.clip())}function pa(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}var ma={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof no&&(l={visible:t.isDatasetVisible(a),index:a,fill:aa(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],l&&!1!==l.fill&&(l.fill=oa(n,a,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&da(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;na(i)&&da(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;na(s)&&"beforeDatasetDraw"===i.drawTime&&da(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ba=(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 xa extends Hs{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}=ba(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=_a(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}=ba(o,d),b=this.isHorizontal(),x=this._computeTitleHeight();f=b?{x:ft(n,this.left+c,this.right-i[0]),y:this.top+c+x,line:0}:{x:this.left+c,y:ft(n,this.top+x+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),b?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+x+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,b?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),b)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=_a(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;i<n.length;++i)if(s=n[i],tt(t,s.left,s.left+s.width)&&tt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(n=i,null!==(s=o)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);o&&!a&&d(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&d(e.onHover,[t,i,this],this)}else i&&d(e.onClick,[t,i,this],this);var s,n}}function _a(t,e){return e*(t.text?t.text.length:0)}var ya={id:"legend",_element:xa,start(t,e,i){const s=t.legend=new xa({ctx:t.ctx,options:i,chart:t});as.configure(t,s,i),as.addBox(t,s)},stop(t){as.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;as.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.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 va extends Hs{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 Ma={id:"title",_element:va,start(t,e,i){!function(t,e){const i=new va({ctx:t.ctx,options:e,chart:t});as.configure(t,i,e),as.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;as.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;as.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 wa=new WeakMap;var ka={id:"subtitle",start(t,e,i){const s=new va({ctx:t.ctx,options:i,chart:t});as.configure(t,s,i),as.addBox(t,s),wa.set(t,s)},stop(t){as.removeBox(t,wa.get(t)),wa.delete(t)},beforeUpdate(t,e,i){const s=wa.get(t);as.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 Sa={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s+=t.x,n+=t.y,++o}}return{x:s/o,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<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=q(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function Pa(t,e){return e&&(n(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Da(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Ca(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 Oa(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,b=0,x=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(x+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),x){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(x-g)*l.lineHeight+(x-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){b=Math.max(b,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(),b+=p.width,{width:b,height:m}}function Aa(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 Ta(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Aa(t,e,i,s),yAlign:s}}function La(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:J(g,0,s.width-e.width),y:J(p,0,s.height-e.height)}}function Ea(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 Ra(t){return Pa([],Da(t))}function Ia(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const za={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<s)return i[e.dataIndex]}return""},afterTitle:e,beforeBody:e,beforeLabel:e,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return s(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:e,afterBody:e,beforeFooter:e,footer:e,afterFooter:e};function Fa(t,e,i,s){const n=t[e].call(i,s);return void 0===n?za[e].call(i,s):n}class Va extends Hs{static positioners=Sa;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new Os(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Ci(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=Fa(i,"beforeTitle",this,t),n=Fa(i,"title",this,t),o=Fa(i,"afterTitle",this,t);let a=[];return a=Pa(a,Da(s)),a=Pa(a,Da(n)),a=Pa(a,Da(o)),a}getBeforeBody(t,e){return Ra(Fa(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return u(t,(t=>{const e={before:[],lines:[],after:[]},n=Ia(i,t);Pa(e.before,Da(Fa(n,"beforeLabel",this,t))),Pa(e.lines,Fa(n,"label",this,t)),Pa(e.after,Da(Fa(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return Ra(Fa(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Fa(i,"beforeFooter",this,t),n=Fa(i,"footer",this,t),o=Fa(i,"afterFooter",this,t);let a=[];return a=Pa(a,Da(s)),a=Pa(a,Da(n)),a=Pa(a,Da(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;a<r;++a)l.push(Ca(this.chart,e[a]));return t.filter&&(l=l.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),u(l,(e=>{const i=Ia(t.callbacks,e);s.push(Fa(i,"labelColor",this,e)),n.push(Fa(i,"labelPointStyle",this,e)),o.push(Fa(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=Sa[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=Oa(this,i),a=Object.assign({},t,e),r=Ta(this.chart,i,a),l=La(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,b,x,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,x=_+o,y=_-o):(p=d+f,m=p+o,x=_-o,y=_+o),b=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(x=u,_=x-o,p=m-o,b=m+o):(x=u+g,_=x+o,p=m+o,b=m-o),y=x),{x1:p,x2:m,x3:b,y1:x,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=Ea(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;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:h}=n,c=Si(n.bodyFont),d=Ea(this,"left",n),u=s.x(d),f=l<c.lineHeight?(c.lineHeight-l)/2:0,g=e.y+f;if(n.usePointStyle){const e={radius:Math.min(h,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=s.leftForLtr(u,h)+h/2,o=g+l/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Le(t,e,i,o),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Le(t,e,i,o)}else{t.lineWidth=o(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=s.leftForLtr(u,h),i=s.leftForLtr(s.xPlus(u,1),h-2),r=wi(a.borderRadius);Object.values(r).some((t=>0!==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 b,x,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ea(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;y<M;++y){for(b=s[y],x=this.labelTextColors[y],e.fillStyle=x,u(b.before,p),_=b.lines,a&&_.length&&(this._drawColorBox(e,t,y,g,i),d=Math.max(c.lineHeight,r)),v=0,w=_.length;v<w;++v)p(_[v]),d=c.lineHeight;u(b.after,p)}f=0,d=c.lineHeight,u(this.afterBody,p),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=Oi(i.rtl,this.x,this.width);for(t.x=Ea(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=Si(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+h-f),e.quadraticCurveTo(a+l,r+h,a+l-f,r+h),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+h),e.quadraticCurveTo(a,r+h,a,r+h-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Sa[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Oa(this,t),a=Object.assign({},i,this._size),r=Ta(e,t,a),l=La(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;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=Sa[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Ba={id:"tooltip",_element:Va,positioners:Sa,afterInit(t,e,i){i&&(t.tooltip=new Va({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:za},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 An.register(Yn,jo,fo,t),An.helpers={...Wi},An._adapters=Rn,An.Animation=Cs,An.Animations=Os,An.animator=xt,An.controllers=en.controllers.items,An.DatasetController=Ns,An.Element=Hs,An.elements=fo,An.Interaction=Xi,An.layouts=as,An.platforms=Ss,An.Scale=Js,An.Ticks=ae,Object.assign(An,Yn,jo,fo,t,Ss),An.Chart=An,"undefined"!=typeof window&&(window.Chart=An),An}));-//# sourceMappingURL=chart.umd.js.mapdiff --git a/scripts/login.js b/scripts/login.jsindex f165792..c41ab63 100644--- a/scripts/login.js+++ b/scripts/login.js@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', function () {darkThemeCss.disabled = themePreference === 'light';document.body.className = themePreference;const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');- themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');+ themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#12151C' : '#FFFFFF');}});\ No newline at end of filediff --git a/scripts/password-toggle.js b/scripts/password-toggle.jsnew file mode 100644index 0000000..c4feec5--- /dev/null+++ b/scripts/password-toggle.js@@ -0,0 +1,31 @@+// Adds a show/hide toggle button to every password field.+// Fields that ship their own toggle can opt out with data-custom-toggle.+document.addEventListener('DOMContentLoaded', function () {+ document.querySelectorAll('input[type="password"]').forEach(function (input) {+ if (input.dataset.customToggle !== undefined) {+ return;+ }++ const wrapper = document.createElement('div');+ wrapper.className = 'password-field';+ input.parentNode.insertBefore(wrapper, input);+ wrapper.appendChild(input);++ const button = document.createElement('button');+ button.type = 'button';+ button.className = 'password-toggle';+ button.setAttribute('aria-label', 'Show password');+ button.innerHTML = '<i class="fa-solid fa-eye"></i>';++ button.addEventListener('click', function () {+ const icon = button.querySelector('i');+ const show = input.type === 'password';++ input.type = show ? 'text' : 'password';+ icon.classList.toggle('fa-eye', !show);+ icon.classList.toggle('fa-eye-slash', show);+ });++ wrapper.appendChild(button);+ });+});diff --git a/scripts/registration.js b/scripts/registration.jsindex b018c71..6c48fea 100644--- a/scripts/registration.js+++ b/scripts/registration.js@@ -180,16 +180,7 @@ function checkThemeNeedsUpdate() {darkThemeCss.disabled = themePreference === 'light';document.body.className = themePreference;const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');- themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');- }-}--function enableGoToLoginButton() {- const goToLoginButton = document.getElementById('goToLoginButton');- if (goToLoginButton) {- goToLoginButton.addEventListener('click', function () {- window.location.href = 'login.php';- });+ themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#12151C' : '#FFFFFF');}}@@ -197,5 +188,4 @@ window.onload = function () {restoreFormFields();removeFromStorage();checkThemeNeedsUpdate();- enableGoToLoginButton();};diff --git a/scripts/settings.js b/scripts/settings.jsindex bf5f0fc..aa85380 100644--- a/scripts/settings.js+++ b/scripts/settings.js@@ -1,22 +1,5 @@-const deleteSvgContent = `-<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="Recycle-Bin-2--Streamline-Plump.svg" height="48" width="48">- <g id="recycle-bin-2--remove-delete-empty-bin-trash-garbage">- <path id="Union" class="accent-color" d="M43.318 15.934a1.5 1.5 0 0 0 -1.618 -1.591c-3.016 0.246 -8.46 0.52 -17.721 0.52 -9.215 0 -14.65 -0.271 -17.675 -0.516a1.5 1.5 0 0 0 -1.618 1.59c0.888 13.84 1.74 21.07 2.253 24.547 0.332 2.252 1.85 4.217 4.226 4.788 2.445 0.588 6.55 1.227 12.837 1.227 6.286 0 10.392 -0.64 12.837 -1.227 2.375 -0.57 3.894 -2.536 4.226 -4.788 0.513 -3.477 1.365 -10.708 2.253 -24.55Z" stroke-width="1"/>- <path id="Union_2" class="main-color" d="M23.37 1a8 8 0 0 0 -7.034 4.188c-3.411 0.072 -6 0.182 -7.814 0.282 -2.312 0.127 -4.692 1.242 -5.7 3.605 -0.244 0.57 -0.475 1.212 -0.663 1.919 -0.68 2.548 1.302 4.622 3.657 4.822 3.057 0.258 8.614 0.548 18.161 0.548 9.549 0 15.106 -0.29 18.162 -0.549 2.374 -0.2 4.291 -2.261 3.751 -4.785a16.68 16.68 0 0 0 -0.294 -1.167c-0.824 -2.831 -3.517 -4.277 -6.188 -4.411a260.66 260.66 0 0 0 -7.744 -0.264A8 8 0 0 0 24.631 1H23.37Z" stroke-width="1"/>- <path id="Vector_831_Stroke" class="main-color" fill-rule="evenodd" d="M17.8 23.01a2 2 0 0 1 2.19 1.791l1 10a2 2 0 0 1 -3.98 0.398l-1 -10a2 2 0 0 1 1.79 -2.189Z" clip-rule="evenodd" stroke-width="1"/>- <path id="Vector_832_Stroke" class="main-color" fill-rule="evenodd" d="M30.2 23.01a2 2 0 0 0 -2.19 1.791l-1 10a2 2 0 0 0 3.98 0.398l1 -10a2 2 0 0 0 -1.79 -2.189Z" clip-rule="evenodd" stroke-width="1"/>- </g>-</svg>-`;--const editSvgContent = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 48 48" id="File-Check-Alternate--Streamline-Plump.svg" height="48" width="48">- <g id="file-check-alternate--file-common-check">- <path id="Subtract" class="accent-color" d="M13.582 2.137C16.326 1.823 20.685 1.5 27 1.5a165 165 0 0 1 5.13 0.077 1.5 1.5 0 0 1 0.4 0.068c1.098 0.343 4.029 1.564 8.123 5.578 3.862 3.787 5.195 6.563 5.63 7.781a1.5 1.5 0 0 1 0.087 0.45c0.08 2.153 0.13 4.655 0.13 7.546 0 7.57 -0.343 12.478 -0.669 15.432 -0.32 2.9 -2.518 5.1 -5.413 5.431 -2.744 0.314 -7.103 0.637 -13.418 0.637 -1.044 0 -2.035 -0.009 -2.974 -0.025A14.458 14.458 0 0 0 28.5 34c0 -8.008 -6.492 -14.5 -14.5 -14.5a14.44 14.44 0 0 0 -6.492 1.531c0.053 -6.464 0.364 -10.773 0.66 -13.463 0.32 -2.9 2.519 -5.1 5.414 -5.431Z" stroke-width="1"></path>- <path id="Intersect" class="main-color" d="M46.348 15.25c-2.42 -0.001 -6.57 -0.04 -8.948 -0.268 -2.598 -0.249 -4.641 -2.321 -4.896 -4.975 -0.214 -2.233 -0.253 -5.99 -0.254 -8.421 0.095 0.01 0.188 0.03 0.28 0.059 1.098 0.343 4.029 1.564 8.123 5.578 3.862 3.787 5.195 6.563 5.63 7.781 0.029 0.08 0.05 0.163 0.065 0.246Z" stroke-width="1"></path>- <path id="Subtract_2" class="main-color" fill-rule="evenodd" d="M14 46c6.627 0 12 -5.373 12 -12s-5.373 -12 -12 -12S2 27.373 2 34s5.373 12 12 12Z" clip-rule="evenodd" stroke-width="1"></path>- <path id="Subtract_3" class="accent-color" fill-rule="evenodd" d="M20.611 31.185a2 2 0 1 0 -3.222 -2.37l-4.413 6.002L10.5 32.01a2 2 0 0 0 -3 2.647l4.118 4.666a2 2 0 0 0 3.111 -0.138l5.882 -8Z" clip-rule="evenodd" stroke-width="1"></path>- </g>-</svg>`;+const saveIconContent = '<i class="fa-solid fa-check"></i>';+const deleteIconContent = '<i class="fa-solid fa-trash-can"></i>';function saveBudget() {const button = document.getElementById("saveBudget");@@ -94,14 +77,14 @@ function addMemberButton(memberId) {editLink.className = "image-button medium";editLink.name = "save";editLink.onclick = () => editMember(newMemberId);- editLink.innerHTML = editSvgContent;+ editLink.innerHTML = saveIconContent;editLink.title = translate("save_member");const deleteLink = document.createElement("button");deleteLink.className = "image-button medium";deleteLink.name = "delete";deleteLink.onclick = () => removeMember(newMemberId);- deleteLink.innerHTML = deleteSvgContent;+ deleteLink.innerHTML = deleteIconContent;deleteLink.title = translate("delete_member");div.appendChild(input);@@ -238,6 +221,7 @@ function addCategoryButton(categoryId) {const dragIcon = document.createElement("div");dragIcon.className = "drag-icon";+ dragIcon.innerHTML = '<i class="fa-solid fa-grip-vertical"></i>';const input = document.createElement("input");input.type = "text";@@ -251,7 +235,7 @@ function addCategoryButton(categoryId) {editLink.onclick = function () {editCategory(newCategoryId);};- editLink.innerHTML = editSvgContent;+ editLink.innerHTML = saveIconContent;editLink.title = translate('save_member');const deleteLink = document.createElement("button");@@ -260,7 +244,7 @@ function addCategoryButton(categoryId) {deleteLink.onclick = function () {removeCategory(newCategoryId);};- deleteLink.innerHTML = deleteSvgContent;+ deleteLink.innerHTML = deleteIconContent;deleteLink.title = translate('delete_member');row.appendChild(dragIcon);@@ -417,7 +401,7 @@ function addCurrencyButton(currencyId) {editLink.onclick = function () {editCurrency(newCurrencyId);};- editLink.innerHTML = editSvgContent;+ editLink.innerHTML = saveIconContent;editLink.title = translate('save_member');const deleteLink = document.createElement("button");@@ -426,7 +410,7 @@ function addCurrencyButton(currencyId) {deleteLink.onclick = function () {removeCurrency(newCurrencyId);};- deleteLink.innerHTML = deleteSvgContent;+ deleteLink.innerHTML = deleteIconContent;deleteLink.title = translate('delete_member');div.appendChild(inputSymbol);@@ -685,25 +669,42 @@ function setSearchButtonStatus() {function searchPaymentIcon() {const nameInput = document.querySelector("#paymentname");const searchTerm = nameInput.value.trim();- if (searchTerm !== "") {- const iconSearchPopup = document.querySelector("#icon-search-results");- iconSearchPopup.classList.add("is-open");- const imageSearchUrl = `endpoints/payments/search.php?search=${searchTerm}`;- fetch(imageSearchUrl)- .then(response => response.json())- .then(data => {- if (data.imageUrls) {- displayImageResults(data.imageUrls);- } else if (data.error) {- console.error(data.error);- }- })- .catch(error => {- console.error(translate('error_fetching_image_results'), error);- });- } else {+ if (searchTerm === "") {nameInput.focus();+ return;+ }++ const iconSearchPopup = document.querySelector("#icon-search-results");+ const iconResults = document.querySelector("#icon-search-images");+ const iconSearchBackdrop = document.querySelector("#icon-search-backdrop");+ iconSearchPopup.classList.add("is-open");+ if (iconSearchBackdrop) {+ iconSearchBackdrop.classList.add("is-open");}+ const iconSearchTitle = document.querySelector("#icon-search-title");+ if (iconSearchTitle) {+ const baseTitle = iconSearchTitle.dataset.title;+ iconSearchTitle.textContent = `${baseTitle}: ${searchTerm}`;+ }+ showSearchState(iconResults, 'loading');++ const imageSearchUrl = `endpoints/payments/search.php?search=${searchTerm}`;+ fetch(imageSearchUrl)+ .then(response => response.json())+ .then(data => {+ if (data.imageUrls && data.imageUrls.length > 0) {+ displayImageResults(data.imageUrls);+ } else if (data.error) {+ console.error(data.error);+ showSearchState(iconResults, 'error');+ } else {+ showSearchState(iconResults, 'empty');+ }+ })+ .catch(error => {+ console.error(translate('error_fetching_image_results'), error);+ showSearchState(iconResults, 'error');+ });}function displayImageResults(imageSources) {@@ -735,6 +736,14 @@ function selectWebIcon(url) {function closeIconSearch() {const iconSearchPopup = document.querySelector("#icon-search-results");iconSearchPopup.classList.remove("is-open");+ const iconSearchBackdrop = document.querySelector("#icon-search-backdrop");+ if (iconSearchBackdrop) {+ iconSearchBackdrop.classList.remove("is-open");+ }+ const iconSearchTitle = document.querySelector("#icon-search-title");+ if (iconSearchTitle) {+ iconSearchTitle.textContent = iconSearchTitle.dataset.title;+ }const iconResults = document.querySelector("#icon-search-images");iconResults.innerHTML = "";}@@ -877,6 +886,9 @@ document.addEventListener('DOMContentLoaded', function () {});});+ loadGoogleSearchUsage();+ loadFixerUsage();+if (document.getElementById("ai_type")) {toggleAiInputs();}@@ -917,7 +929,7 @@ function addFixerKeyButton() {'X-CSRF-Token': window.csrfToken,},body: new URLSearchParams({force: "true"}),- }).catch(console.error);+ }).catch(console.error).finally(() => loadFixerUsage());} else {showErrorMessage(data.message);addButton.disabled = false;@@ -1006,6 +1018,80 @@ function setShowSubscriptionProgress() {storeSettingsOnDB('subscription_progress', value);}+function loadApiUsage(endpoint, containerId, countId, fillId) {+ const usageContainer = document.getElementById(containerId);+ if (!usageContainer) {+ return;+ }++ fetch(endpoint, {+ headers: {+ 'X-CSRF-Token': window.csrfToken,+ }+ })+ .then(response => response.json())+ .then(data => {+ if (!data.success || !data.total) {+ usageContainer.style.display = "none";+ return;+ }++ const percent = Math.min(100, Math.round((data.used / data.total) * 100));+ document.getElementById(countId).textContent = `${data.used} / ${data.total}`;++ const fill = document.getElementById(fillId);+ fill.style.width = percent + "%";+ fill.classList.toggle("warn", percent >= 80 && percent < 95);+ fill.classList.toggle("danger", percent >= 95);++ usageContainer.style.display = "";+ })+ .catch(() => {+ usageContainer.style.display = "none";+ });+}++function loadFixerUsage() {+ loadApiUsage("endpoints/settings/fixer_usage.php", "fixerUsage", "fixerUsageCount", "fixerUsageFill");+}++function loadGoogleSearchUsage() {+ loadApiUsage("endpoints/settings/google_search_usage.php", "googleSearchUsage", "googleSearchUsageCount", "googleSearchUsageFill");+}++function saveGoogleSearchButton() {+ const saveButton = document.getElementById("saveGoogleSearch");+ saveButton.disabled = true;++ const apiKey = document.querySelector("#googleSearchKey").value.trim();++ fetch("endpoints/settings/google_search.php", {+ method: "POST",+ headers: {+ "Content-Type": "application/x-www-form-urlencoded",+ 'X-CSRF-Token': window.csrfToken,+ },+ body: new URLSearchParams({+ api_key: apiKey,+ }),+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ showSuccessMessage(data.message);+ loadGoogleSearchUsage();+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(() => {+ showErrorMessage(translate('unknown_error'));+ })+ .finally(() => {+ saveButton.disabled = false;+ });+}+function setWeekStartsSunday() {const weekStartsSundayCheckbox = document.querySelector("#weekstartssunday");const value = weekStartsSundayCheckbox.checked;@@ -1090,8 +1176,7 @@ function fetch_ai_models() {function toggleAiInputs() {const type = document.getElementById("ai_type").value;const apiKeyInput = document.getElementById("ai_api_key");- const apiKeyToggleButton = document.getElementById("toggleAiApiKey");- const apiKeyToggleIcon = apiKeyToggleButton?.querySelector("i");+ const apiKeyToggleIcon = apiKeyInput.closest(".password-field")?.querySelector(".password-toggle i");const urlGroup = document.getElementById("ai_url_group");const urlInput = document.getElementById("ai_ollama_host");const testButtonUrl = document.getElementById("fetchModelsButton2");@@ -1103,44 +1188,24 @@ function toggleAiInputs() {if (type === "ollama") {apiKeyInput.classList.add("hidden");- apiKeyToggleButton?.classList.add("hidden");testButtonKey.classList.add("hidden"); // hide key-row TesturlGroup.style.display = "";urlInput.placeholder = "http://localhost:11434";testButtonUrl.classList.remove("hidden"); // show url-row Test} else if (type === "openai-compatible") {apiKeyInput.classList.remove("hidden");- apiKeyToggleButton?.classList.remove("hidden");testButtonKey.classList.remove("hidden"); // show key-row TesturlGroup.style.display = "";urlInput.placeholder = "http://localhost:11434/v1";testButtonUrl.classList.add("hidden"); // hide url-row Test} else {apiKeyInput.classList.remove("hidden");- apiKeyToggleButton?.classList.remove("hidden");testButtonKey.classList.remove("hidden"); // show key-row TesturlGroup.style.display = "none";testButtonUrl.classList.add("hidden"); // hidden anyway (group hidden)}}-function toggleAiApiKeyVisibility() {- const apiKeyInput = document.getElementById("ai_api_key");- const apiKeyToggleButton = document.getElementById("toggleAiApiKey");- if (!apiKeyInput || !apiKeyToggleButton) {- return;- }-- const icon = apiKeyToggleButton.querySelector("i");- const isPassword = apiKeyInput.type === "password";- apiKeyInput.type = isPassword ? "text" : "password";-- if (icon) {- icon.classList.toggle("fa-eye", !isPassword);- icon.classList.toggle("fa-eye-slash", isPassword);- }-}-function saveAiSettingsButton() {const aiEnabled = document.querySelector("#ai_enabled").checked;const aiType = document.querySelector("#ai_type").value;@@ -1176,6 +1241,43 @@ function saveAiSettingsButton() {});}+function translateCategories() {+ const button = document.getElementById("translateCategories");+ const originalContent = button.innerHTML;++ button.disabled = true;+ button.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i>';++ fetch('endpoints/ai/translate_categories.php', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ 'X-CSRF-Token': window.csrfToken,+ }+ })+ .then(response => response.json())+ .then(data => {+ if (data.success) {+ Object.entries(data.translations).forEach(([categoryId, categoryName]) => {+ const input = document.querySelector(`#categories div[data-categoryid="${categoryId}"] input[name="category"]`);+ if (input) {+ input.value = categoryName;+ }+ });+ showSuccessMessage(data.message);+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(error => {+ showErrorMessage(translate('unknown_error'));+ })+ .finally(() => {+ button.disabled = false;+ button.innerHTML = originalContent;+ });+}+function runAiRecommendations() {const endpoint = 'endpoints/ai/generate_recommendations.php';const button = document.querySelector("#runAiRecommendations");diff --git a/scripts/stats.js b/scripts/stats.jsindex 4a7a9cd..9e563c4 100644--- a/scripts/stats.js+++ b/scripts/stats.js@@ -1,92 +1,252 @@+const CHART_PALETTE = ['#008FFB','#00E396','#FEB019','#FF4560','#775DD0','#546E7A','#26a69a','#D10CE8'];++function _chartTheme() {+ const cs = getComputedStyle(document.documentElement);+ const main = cs.getPropertyValue('--main-color').trim() || '#007BFF';+ const text = cs.getPropertyValue('--text-color').trim() || '#202020';+ const border = cs.getPropertyValue('--box-border-color').trim() || '#E8E8E8';+ const dark = document.body.classList.contains('dark');+ const font = "Barlow, 'Helvetica Neue', Helvetica, sans-serif";+ return { main, text, border, dark, font };+}+function loadGraph(container, dataPoints, currency, run) {- if (run) {- var ctx = document.getElementById(container).getContext('2d');-- var chart = new Chart(ctx, {- type: 'pie',- data: {- datasets: [{- data: dataPoints.map(point => point.y),- }],- labels: dataPoints.map(point => {- if (currency) {- return `${point.label} (${new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(point.y)})`;- } else {- return `${point.label} (${new Intl.NumberFormat(navigator.language).format(point.y)})`;- }- }),- },- options: {- animation: {- animateRotate: true,- animateScale: true,- },- plugins: {- legend: {- display: true,- position: 'top',- },- tooltip: {- callbacks: {- label: function(context) {- let label = " ";- if (currency) {- label += new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(context.raw);- } else {- label += new Intl.NumberFormat(navigator.language).format(context.raw);- }- return label;- }- }- }- }- },- });+ if (!run) return;++ const t = _chartTheme();+ const fmt = val => currency+ ? new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(val)+ : new Intl.NumberFormat(navigator.language).format(val);++ const hidden = new Array(dataPoints.length).fill(false);++ function activeSubset() {+ const pts = dataPoints.filter((_, i) => !hidden[i]);+ return {+ series: pts.map(p => p.y),+ labels: pts.map(p => `${p.label} (${fmt(p.y)})`),+ colors: CHART_PALETTE.filter((_, i) => !hidden[i]).slice(0, pts.length),+ };}++ const el = document.getElementById(container);++ const chart = new ApexCharts(el, {+ chart: {+ type: 'donut',+ height: 320,+ background: 'transparent',+ fontFamily: t.font,+ },+ theme: { mode: t.dark ? 'dark' : 'light' },+ ...activeSubset(),+ legend: { show: false },+ dataLabels: {+ style: { fontFamily: t.font, fontSize: '12px' },+ dropShadow: { enabled: false },+ },+ plotOptions: { pie: { donut: { size: '55%' } } },+ stroke: { width: 0 },+ tooltip: {+ style: { fontFamily: t.font },+ y: { formatter: fmt },+ },+ });+ chart.render();++ const legend = document.createElement('div');+ legend.className = 'graph-legend';+ dataPoints.forEach((p, i) => {+ const item = document.createElement('button');+ item.className = 'graph-legend-item';+ item.innerHTML = `<span class="graph-legend-dot" style="background:${CHART_PALETTE[i % CHART_PALETTE.length]}"></span>${p.label} (${fmt(p.y)})`;+ item.addEventListener('click', () => {+ hidden[i] = !hidden[i];+ item.classList.toggle('graph-legend-item--off', hidden[i]);+ chart.updateOptions(activeSubset());+ });+ legend.appendChild(item);+ });+ el.after(legend);}function loadLineGraph(container, dataPoints, currency, run) {- if (run) {- var ctx = document.getElementById(container).getContext('2d');-- var chart = new Chart(ctx, {- type: 'line',- data: {- datasets: [{- label: '',- data: dataPoints.map(point => point.y),- }],- labels: dataPoints.map(point => {- return `${point.label}`;- }),+ if (!run) return;++ const t = _chartTheme();+ const fmt = val => currency+ ? new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(val)+ : new Intl.NumberFormat(navigator.language).format(val);++ // Mark the 12-month high and low so the extremes read at a glance+ const values = dataPoints.map(p => p.y);+ const discreteMarkers = [];+ if (values.length > 2) {+ const maxIndex = values.indexOf(Math.max(...values));+ const minIndex = values.indexOf(Math.min(...values));+ if (maxIndex !== minIndex) {+ discreteMarkers.push(+ { seriesIndex: 0, dataPointIndex: maxIndex, size: 5, fillColor: t.main, strokeColor: t.dark ? '#171B23' : '#FFFFFF' },+ { seriesIndex: 0, dataPointIndex: minIndex, size: 5, fillColor: t.main, strokeColor: t.dark ? '#171B23' : '#FFFFFF' }+ );+ }+ }++ const chart = new ApexCharts(document.getElementById(container), {+ chart: {+ type: 'area',+ height: 370,+ background: 'transparent',+ fontFamily: t.font,+ toolbar: { show: false },+ zoom: { enabled: false },+ },+ theme: { mode: t.dark ? 'dark' : 'light' },+ series: [{ name: currency || '', data: dataPoints.map(p => p.y) }],+ xaxis: {+ categories: dataPoints.map(p => p.label),+ labels: { style: { fontFamily: t.font, colors: t.text } },+ },+ yaxis: {+ labels: {+ formatter: fmt,+ style: { fontFamily: t.font, colors: t.text },},- options: {- animation: {- animateRotate: true,- animateScale: true,- },- scales: {- y: {- beginAtZero: false,- ticks: {- callback: function(value, index, values) {- if (currency) {- return new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(value);- } else {- return new Intl.NumberFormat(navigator.language).format(value);- }- }- }- }+ },+ colors: [t.main],+ stroke: { curve: 'smooth', width: 2 },+ fill: {+ type: 'gradient',+ gradient: { opacityFrom: 0.35, opacityTo: 0.0 },+ },+ markers: { size: 0, discrete: discreteMarkers, hover: { size: 5 } },+ grid: { borderColor: t.border },+ tooltip: {+ style: { fontFamily: t.font },+ y: { formatter: fmt },+ },+ legend: { show: false },+ });+ chart.render();+}++function loadBarGraph(container, dataPoints, currency, run, thresholdLine) {+ if (!run) return;++ const t = _chartTheme();+ const cs = getComputedStyle(document.documentElement);+ const errorColor = cs.getPropertyValue('--error-color').trim() || '#EF4444';+ const fmt = val => currency+ ? new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(val)+ : new Intl.NumberFormat(navigator.language).format(val);++ const annotations = {};+ if (thresholdLine !== null && thresholdLine !== undefined) {+ annotations.yaxis = [{+ y: thresholdLine,+ borderColor: errorColor,+ strokeDashArray: 5,+ label: {+ text: fmt(thresholdLine),+ position: 'left',+ textAnchor: 'start',+ style: {+ color: errorColor,+ background: 'transparent',+ fontFamily: t.font,},- plugins: {- legend: {- display: false- }- }- }- });+ },+ }];}++ const chart = new ApexCharts(document.getElementById(container), {+ chart: {+ type: 'bar',+ height: 320,+ background: 'transparent',+ fontFamily: t.font,+ toolbar: { show: false },+ zoom: { enabled: false },+ },+ theme: { mode: t.dark ? 'dark' : 'light' },+ series: [{ name: currency || '', data: dataPoints.map(p => p.y) }],+ xaxis: {+ categories: dataPoints.map(p => p.label),+ labels: { style: { fontFamily: t.font, colors: t.text } },+ },+ yaxis: {+ labels: {+ formatter: fmt,+ style: { fontFamily: t.font, colors: t.text },+ },+ },+ colors: [t.main],+ plotOptions: {+ bar: {+ columnWidth: '55%',+ borderRadius: 4,+ borderRadiusApplication: 'end',+ },+ },+ dataLabels: { enabled: false },+ annotations: annotations,+ grid: { borderColor: t.border },+ tooltip: {+ style: { fontFamily: t.font },+ y: { formatter: fmt },+ },+ legend: { show: false },+ });+ chart.render();+}++function loadHorizontalBarGraph(container, dataPoints, currency, run) {+ if (!run) return;++ const t = _chartTheme();+ const fmt = val => currency+ ? new Intl.NumberFormat(navigator.language, { style: 'currency', currency }).format(val)+ : new Intl.NumberFormat(navigator.language).format(val);++ const chart = new ApexCharts(document.getElementById(container), {+ chart: {+ type: 'bar',+ height: Math.max(200, dataPoints.length * 36 + 60),+ background: 'transparent',+ fontFamily: t.font,+ toolbar: { show: false },+ zoom: { enabled: false },+ },+ theme: { mode: t.dark ? 'dark' : 'light' },+ series: [{ name: currency || '', data: dataPoints.map(p => p.y) }],+ xaxis: {+ categories: dataPoints.map(p => p.label),+ labels: {+ formatter: fmt,+ style: { fontFamily: t.font, colors: t.text },+ },+ },+ yaxis: {+ labels: { style: { fontFamily: t.font, colors: t.text } },+ },+ colors: [t.main],+ plotOptions: {+ bar: {+ horizontal: true,+ barHeight: '55%',+ borderRadius: 4,+ borderRadiusApplication: 'end',+ },+ },+ dataLabels: { enabled: false },+ grid: { borderColor: t.border },+ tooltip: {+ style: { fontFamily: t.font },+ y: { formatter: fmt },+ },+ legend: { show: false },+ });+ chart.render();}diff --git a/scripts/subscription-details.js b/scripts/subscription-details.jsnew file mode 100644index 0000000..822be20--- /dev/null+++ b/scripts/subscription-details.js@@ -0,0 +1,258 @@+let currentDetailsId = null;++function showSubscriptionDetails(event, id) {+ const card = document.querySelector(`.subscription[data-id="${id}"]`);+ if (card && card.classList.contains('flipped')) {+ card.classList.remove('flipped');+ return;+ }+ const url = `endpoints/subscription/get.php?id=${id}`;+ fetch(url)+ .then((response) => {+ if (response.ok) {+ return response.json();+ }+ showErrorMessage(translate('failed_to_load_subscription'));+ })+ .then((data) => {+ if (!data || data.error || data === "Error") {+ showErrorMessage(translate('failed_to_load_subscription'));+ } else {+ renderSubscriptionDetails(data);+ }+ })+ .catch((error) => {+ console.log(error);+ showErrorMessage(translate('failed_to_load_subscription'));+ });+}++function detailsFormatPrice(price, currencyId) {+ const lookups = window.subscriptionLookups;+ const currency = lookups.currencies[currencyId];+ const value = Number(price);+ if (currency && currency.code) {+ try {+ return new Intl.NumberFormat(window.lang || 'en', { style: 'currency', currency: currency.code }).format(value);+ } catch (e) { /* unknown currency code, fall through */ }+ }+ const symbol = currency ? (currency.symbol || currency.code || '') : '';+ return `${symbol}${value.toFixed(2)}`;+}++function detailsFormatDate(dateString) {+ if (!dateString) {+ return "";+ }+ const date = new Date(dateString + "T00:00:00");+ if (isNaN(date)) {+ return dateString;+ }+ try {+ return date.toLocaleDateString(window.lang || 'en', { day: 'numeric', month: 'short', year: 'numeric' });+ } catch (e) {+ return date.toLocaleDateString('en', { day: 'numeric', month: 'short', year: 'numeric' });+ }+}++function detailsBillingCycleText(cycle, frequency) {+ const units = window.subscriptionLookups.cycles[cycle];+ if (!units) {+ return "";+ }+ return Number(frequency) === 1 || Number(cycle) === 5 ? units.one : `${frequency} ${units.many}`;+}++function detailsProgressPercentage(subscription) {+ const cycleDays = { 1: 1, 2: 7, 3: 30, 4: 365 }[subscription.cycle];+ if (!cycleDays) {+ return null; // one-time purchase+ }+ const totalDays = cycleDays * subscription.frequency;+ const nextPayment = new Date(subscription.next_payment + "T00:00:00");+ if (isNaN(nextPayment)) {+ return null;+ }+ const daysUntil = (nextPayment - new Date()) / 86400000;+ const progress = ((totalDays - daysUntil) / totalDays) * 100;+ return Math.min(100, Math.max(0, Math.floor(progress)));+}++function detailsAddChip(container, text, style) {+ const chip = document.createElement('span');+ chip.className = 'details-chip' + (style ? ' ' + style : '');+ chip.textContent = text;+ container.appendChild(chip);+}++function renderSubscriptionDetails(subscription) {+ const lookups = window.subscriptionLookups;+ const strings = lookups.i18n;+ currentDetailsId = subscription.id;++ const logoContainer = document.querySelector('#details-logo');+ logoContainer.innerHTML = "";+ if (subscription.logo) {+ const img = document.createElement('img');+ img.src = "images/uploads/logos/" + subscription.logo;+ img.alt = "";+ logoContainer.appendChild(img);+ } else {+ const fallback = document.createElement('span');+ fallback.className = 'details-logo-fallback';+ fallback.textContent = (subscription.name || "?").charAt(0).toUpperCase();+ logoContainer.appendChild(fallback);+ }++ document.querySelector('#details-name').textContent = subscription.name;++ const chips = document.querySelector('#details-chips');+ chips.innerHTML = "";+ const isOneTime = Number(subscription.cycle) === 5;+ if (subscription.inactive) {+ detailsAddChip(chips, strings.inactive, 'warn');+ }+ if (isOneTime) {+ detailsAddChip(chips, strings.one_time, 'muted');+ } else if (Number(subscription.auto_renew) === 1) {+ detailsAddChip(chips, strings.automatic, 'ok');+ } else {+ detailsAddChip(chips, strings.manual_renewal, 'manual');+ }++ document.querySelector('#details-price').textContent = detailsFormatPrice(subscription.price, subscription.currency_id);+ document.querySelector('#details-billing-cycle').textContent = isOneTime ? "" : detailsBillingCycleText(subscription.cycle, subscription.frequency);++ const progressTrack = document.querySelector('#details-progress-track');+ const progress = detailsProgressPercentage(subscription);+ if (progress === null || subscription.inactive) {+ progressTrack.classList.add('hide');+ } else {+ progressTrack.classList.remove('hide');+ document.querySelector('#details-progress').style.width = progress + "%";+ }++ document.querySelector('#details-next-payment').textContent = detailsFormatDate(subscription.next_payment);+ document.querySelector('#details-start-date').textContent = detailsFormatDate(subscription.start_date) || strings.none;+ document.querySelector('#details-category').textContent = lookups.categories[subscription.category_id] || strings.none;+ document.querySelector('#details-payer').textContent = lookups.members[subscription.payer_user_id] || strings.none;++ const paymentMethod = lookups.paymentMethods[subscription.payment_method_id];+ const paymentIcon = document.querySelector('#details-payment-icon');+ if (paymentMethod) {+ paymentIcon.src = paymentMethod.icon;+ paymentIcon.classList.remove('hide');+ document.querySelector('#details-payment-name').textContent = paymentMethod.name;+ } else {+ paymentIcon.classList.add('hide');+ document.querySelector('#details-payment-name').textContent = strings.none;+ }++ let notificationsText = subscription.notify ? strings.enabled : strings.disabled;+ if (subscription.notify && subscription.notify_days_before >= 0) {+ const days = Number(subscription.notify_days_before);+ if (days === 0) {+ notificationsText += ` · ${strings.on_due_date}`;+ } else if (days === 1) {+ notificationsText += ` · 1 ${strings.day_before}`;+ } else {+ notificationsText += ` · ${days} ${strings.days_before}`;+ }+ }+ document.querySelector('#details-notifications').textContent = notificationsText;++ const cancellationItem = document.querySelector('#details-cancellation-item');+ if (subscription.cancellation_date) {+ cancellationItem.classList.remove('hide');+ document.querySelector('#details-cancellation').textContent = detailsFormatDate(subscription.cancellation_date);+ } else {+ cancellationItem.classList.add('hide');+ }++ const replacementItem = document.querySelector('#details-replacement-item');+ const replacementName = subscription.replacement_subscription_id ? lookups.subscriptionNames[subscription.replacement_subscription_id] : null;+ if (replacementName) {+ replacementItem.classList.remove('hide');+ document.querySelector('#details-replacement').textContent = replacementName;+ } else {+ replacementItem.classList.add('hide');+ }++ const notesItem = document.querySelector('#details-notes-item');+ if (subscription.notes) {+ notesItem.classList.remove('hide');+ document.querySelector('#details-notes').textContent = subscription.notes;+ } else {+ notesItem.classList.add('hide');+ }++ const urlButton = document.querySelector('#details-url-button');+ if (subscription.url) {+ urlButton.classList.remove('hide');+ urlButton.href = /^https?:\/\//.test(subscription.url) ? subscription.url : "https://" + subscription.url;+ } else {+ urlButton.classList.add('hide');+ }++ document.querySelector('#details-export-button').onclick = function () {+ exportCalendar(subscription.id);+ };++ document.querySelector('#subscription-details').classList.add('is-open');+ document.querySelector('#details-backdrop').classList.add('is-open');+ document.body.classList.add('details-open');+}++function closeSubscriptionDetails() {+ currentDetailsId = null;+ document.querySelector('#subscription-details').classList.remove('is-open');+ document.querySelector('#details-backdrop').classList.remove('is-open');+ document.body.classList.remove('details-open');+}++document.addEventListener('DOMContentLoaded', function () {+ const detailsModal = document.querySelector('#subscription-details');+ if (!detailsModal) {+ return;+ }++ document.addEventListener('keydown', function (event) {+ if (event.key === 'Escape' && detailsModal.classList.contains('is-open')) {+ closeSubscriptionDetails();+ }+ });+});++function decodeHtmlEntities(str) {+ const txt = document.createElement('textarea');+ txt.innerHTML = str;+ return txt.value;+}++function exportCalendar(subscriptionId) {+ fetch('endpoints/subscription/exportcalendar.php', {+ method: 'POST',+ body: JSON.stringify({ id: subscriptionId }),+ headers: {+ 'Content-Type': 'application/json',+ 'X-CSRF-Token': window.csrfToken,+ }+ })+ .then(response => response.json())+ .then(data => {+ if (data.success && data.ics) {+ const blob = new Blob([data.ics], { type: 'text/calendar' });+ const url = window.URL.createObjectURL(blob);+ const a = document.createElement('a');+ a.href = url;+ // Use the subscription name for the file name, replacing any characters that are invalid in file names+ a.download = `${decodeHtmlEntities(data.name).replace(/[\/\\:*?"<>|]/g, '_').toLowerCase()}.ics`;+ document.body.appendChild(a);+ a.click();+ window.URL.revokeObjectURL(url);+ } else {+ showErrorMessage(data.message);+ }+ })+ .catch(error => console.error('Error:', error));+}diff --git a/scripts/subscriptions.js b/scripts/subscriptions.jsindex 2168bd5..4890bec 100644--- a/scripts/subscriptions.js+++ b/scripts/subscriptions.js@@ -1,12 +1,6 @@let isSortOptionsOpen = false;let scrollTopBeforeOpening = 0;const shouldScroll = window.innerWidth <= 768;--function toggleOpenSubscription(subId) {- const subscriptionElement = document.querySelector('.subscription[data-id="' + subId + '"]');- subscriptionElement.classList.toggle('is-open');-}-function toggleSortOptions() {const sortOptions = document.querySelector("#sort-options");sortOptions.classList.toggle("is-open");@@ -224,6 +218,7 @@ function deleteSubscription(event, id) {showSuccessMessage(translate('subscription_deleted'));fetchSubscriptions(null, null, "delete");closeAddSubscription();+ closeSubscriptionDetails();} else {showErrorMessage(data.message || translate('error_deleting_subscription'));}@@ -317,30 +312,75 @@ function setSearchButtonStatus() {function searchLogo() {const nameInput = document.querySelector("#name");const searchTerm = nameInput.value.trim();- if (searchTerm !== "") {- const logoSearchPopup = document.querySelector("#logo-search-results");- logoSearchPopup.classList.add("is-open");- const imageSearchUrl = `endpoints/logos/search.php?search=${searchTerm}`;- fetch(imageSearchUrl)+ if (searchTerm === "") {+ nameInput.focus();+ return;+ }++ const logoSearchPopup = document.querySelector("#logo-search-results");+ const logoResults = document.querySelector("#logo-search-images");+ const logoSearchBackdrop = document.querySelector("#logo-search-backdrop");+ logoSearchPopup.classList.add("is-open");+ if (logoSearchBackdrop) {+ logoSearchBackdrop.classList.add("is-open");+ }+ const logoSearchTitle = document.querySelector("#logo-search-title");+ if (logoSearchTitle) {+ const baseTitle = logoSearchTitle.dataset.title;+ logoSearchTitle.textContent = `${baseTitle}: ${searchTerm}`;+ }++ // One section per source, queried in parallel and filled as each response lands+ const sources = [+ { label: 'selfh.st', url: `endpoints/logos/icon_search.php?search=${searchTerm}&source=selfhst` },+ { label: 'Dashboard Icons', url: `endpoints/logos/icon_search.php?search=${searchTerm}&source=dashboardicons` },+ { label: 'DuckDuckGo', url: `endpoints/logos/search.php?search=${searchTerm}&source=duckduckgo` },+ { label: 'Brave', url: `endpoints/logos/search.php?search=${searchTerm}&source=brave` },+ ];++ // Google requires user-provided API credentials; the section only exists when configured+ if (logoSearchPopup.dataset.googleSearch) {+ sources.unshift({ label: 'Google', url: `endpoints/logos/google_search.php?search=${searchTerm}` });+ }++ logoResults.innerHTML = "";++ sources.forEach(source => {+ const section = document.createElement("div");+ section.className = "logo-search-section";++ const title = document.createElement("h4");+ title.textContent = source.label;+ section.appendChild(title);++ const resultsContainer = document.createElement("div");+ resultsContainer.className = "logo-search-section-results";+ section.appendChild(resultsContainer);++ logoResults.appendChild(section);+ showSearchState(resultsContainer, 'loading');++ fetch(source.url).then(response => response.json()).then(data => {- if (data.results) {- displayImageResults(data.results);+ if (data.results && data.results.length > 0) {+ displayImageResults(data.results, resultsContainer);} else if (data.error) {- console.error(data.error);+ console.error(source.label, data.error);+ showSearchState(resultsContainer, 'error');+ } else {+ showSearchState(resultsContainer, 'empty');}}).catch(error => {- console.error(translate('error_fetching_image_results'), error);+ console.error(translate('error_fetching_image_results'), source.label, error);+ showSearchState(resultsContainer, 'error');});- } else {- nameInput.focus();- }+ });}-function displayImageResults(imageSources) {- const logoResults = document.querySelector("#logo-search-images");- logoResults.innerHTML = "";+function displayImageResults(imageSources, container) {+ container.innerHTML = "";imageSources.forEach(src => {const img = document.createElement("img");@@ -351,7 +391,7 @@ function displayImageResults(imageSources) {img.onerror = function () {this.parentNode.removeChild(this);};- logoResults.appendChild(img);+ container.appendChild(img);});}@@ -367,6 +407,14 @@ function selectWebLogo(url) {function closeLogoSearch() {const logoSearchPopup = document.querySelector("#logo-search-results");logoSearchPopup.classList.remove("is-open");+ const logoSearchBackdrop = document.querySelector("#logo-search-backdrop");+ if (logoSearchBackdrop) {+ logoSearchBackdrop.classList.remove("is-open");+ }+ const logoSearchTitle = document.querySelector("#logo-search-title");+ if (logoSearchTitle) {+ logoSearchTitle.textContent = logoSearchTitle.dataset.title;+ }const logoResults = document.querySelector("#logo-search-images");logoResults.innerHTML = "";}@@ -419,12 +467,30 @@ function fetchSubscriptions(id, event, initiator) {}, 1000);}}+ searchSubscriptions();}).catch(error => {console.error(translate('error_reloading_subscription'), error);});}+function setSubscriptionsView(view) {+ const subscriptionsContainer = document.querySelector("#subscriptions");+ subscriptionsContainer.classList.toggle("grid-view", view === "grid");+ document.querySelectorAll('.subscription').forEach((card) => {+ card.classList.remove('flipped');+ card.style.transform = '';+ card.style.transition = '';+ card.style.zIndex = '';+ });+ document.querySelector("#view-list-button").classList.toggle("selected", view !== "grid");+ document.querySelector("#view-grid-button").classList.toggle("selected", view === "grid");++ const expirationDate = new Date();+ expirationDate.setFullYear(expirationDate.getFullYear() + 1);+ document.cookie = "subscriptionsView=" + view + "; expires=" + expirationDate.toUTCString() + "; SameSite=Lax";+}+function setSortOption(sortOption) {const sortOptionsContainer = document.querySelector("#sort-options");const sortOptionsList = sortOptionsContainer.querySelectorAll("li");@@ -591,9 +657,17 @@ function clearSearch() {const searchInput = document.querySelector("#search");searchInput.value = "";+ searchInput.parentElement.classList.remove("mobile-expanded");searchSubscriptions();}+function toggleMobileSearch() {+ const searchContainer = document.querySelector(".top-actions .search");++ searchContainer.classList.add("mobile-expanded");+ document.querySelector("#search").focus();+}+function closeSubMenus() {var subMenus = document.querySelectorAll('.filtermenu-submenu-content');subMenus.forEach(subMenu => {@@ -615,12 +689,14 @@ function setSwipeElements() {const maxTranslateX = element.classList.contains('manual') ? -240 : -180;element.addEventListener('touchstart', (e) => {+ if (element.closest('.subscriptions.grid-view')) return; // no swipe actions in grid viewstartX = e.touches[0].clientX;startY = e.touches[0].clientY;element.style.transition = ''; // Remove transition for smooth dragging});element.addEventListener('touchmove', (e) => {+ if (element.closest('.subscriptions.grid-view')) return;currentX = e.touches[0].clientX;currentY = e.touches[0].clientY;@@ -640,6 +716,7 @@ function setSwipeElements() {});element.addEventListener('touchend', () => {+ if (element.closest('.subscriptions.grid-view')) return;// Check the final swipe position to determine snap behaviorif (translateX < maxTranslateX / 2) {// If more than halfway to the left, snap fully open@@ -821,10 +898,29 @@ document.addEventListener('click', function (event) {}});+function unflipCard(subscriptionId) {+ const card = document.querySelector(`.subscription[data-id="${subscriptionId}"]`);+ if (card) {+ card.classList.remove('flipped');+ }+}+function expandActions(event, subscriptionId) {event.stopPropagation();event.preventDefault();const subscriptionDiv = document.querySelector(`.subscription[data-id="${subscriptionId}"]`);++ // Grid view: flip the card over instead of opening the dropdown+ if (subscriptionDiv.closest('.subscriptions.grid-view')) {+ document.querySelectorAll('.subscription.flipped').forEach((card) => {+ if (card !== subscriptionDiv) {+ card.classList.remove('flipped');+ }+ });+ subscriptionDiv.classList.toggle('flipped');+ return;+ }+const actions = subscriptionDiv.querySelector('.actions');// Close all other open actions@@ -853,27 +949,33 @@ function expandActions(event, subscriptionId) {}function swipeHintAnimation() {- if (window.mobileNavigation && window.matchMedia('(max-width: 768px)').matches) {- const maxAnimations = 3;- const cookieName = 'swipeHintCount';-- let count = parseInt(getCookie(cookieName)) || 0;- if (count < maxAnimations) {- const firstElement = document.querySelector('.subscription');- if (firstElement) {- firstElement.style.transition = 'transform 0.3s ease';- firstElement.style.transform = 'translateX(-80px)';-- setTimeout(() => {- firstElement.style.transform = 'translateX(0px)';- firstElement.style.zIndex = '1';- }, 600);- }+ // The swipe hint only exists in list view: no swipe actions in grid view.+ if (!window.mobileNavigation || !window.matchMedia('(max-width: 768px)').matches) {+ return;+ }- count++;- document.cookie = `${cookieName}=${count}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/; SameSite=Lax`;- }+ const firstElement = document.querySelector('.subscription');+ if (!firstElement || firstElement.closest('.subscriptions.grid-view')) {+ return;+ }++ const maxAnimations = 3;+ const cookieName = 'swipeHintCount';+ let count = parseInt(getCookie(cookieName)) || 0;+ if (count >= maxAnimations) {+ return;}++ firstElement.style.transition = 'transform 0.3s ease';+ firstElement.style.transform = 'translateX(-80px)';++ setTimeout(() => {+ firstElement.style.transform = 'translateX(0px)';+ firstElement.style.zIndex = '1';+ }, 600);++ count++;+ document.cookie = `${cookieName}=${count}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/; SameSite=Lax`;}function toggleOneTimeCycleUI(isOneTime) {diff --git a/service-worker.js b/service-worker.jsindex ba90996..df1d930 100644--- a/service-worker.js+++ b/service-worker.js@@ -1,12 +1,14 @@-const STATIC_CACHE = 'static-cache-v1';+const STATIC_CACHE = 'static-cache-v2';const PAGES_CACHE = 'pages-cache-v1';const LOGOS_CACHE = 'logos-cache-v1';const staticAssets = ['manifest.json','styles/styles.css',+ 'styles/theme.css','styles/dark-theme.css','styles/login.css',+ 'styles/login-dark-theme.css','styles/font-awesome.min.css','styles/brands.css','styles/barlow.css',@@ -20,17 +22,23 @@ const staticAssets = ['webfonts/fa-brands-400.ttf','webfonts/fa-regular-400.woff2','webfonts/fa-regular-400.ttf',+ 'scripts/all.js','scripts/common.js','scripts/dashboard.js','scripts/subscriptions.js',+ 'scripts/subscription-details.js',+ 'scripts/password-toggle.js','scripts/stats.js','scripts/settings.js',+ 'scripts/profile.js','scripts/theme.js',+ 'scripts/auth-theme.js','scripts/notifications.js','scripts/registration.js','scripts/login.js','scripts/admin.js','scripts/calendar.js',+ 'scripts/i18n/ca.js','scripts/i18n/cs.js','scripts/i18n/da.js','scripts/i18n/de.js',@@ -38,9 +46,10 @@ const staticAssets = ['scripts/i18n/en.js','scripts/i18n/es.js','scripts/i18n/fr.js',+ 'scripts/i18n/hu.js','scripts/i18n/id.js','scripts/i18n/it.js',- 'scripts/i18n/jp.js',+ 'scripts/i18n/ja.js','scripts/i18n/ko.js','scripts/i18n/nl.js','scripts/i18n/pl.js',@@ -57,14 +66,19 @@ const staticAssets = ['scripts/i18n/zh_cn.js','scripts/i18n/zh_tw.js','scripts/i18n/getlang.js',- 'scripts/libs/chart.js',+ 'scripts/libs/apexcharts.min.js','scripts/libs/sortable.min.js','scripts/libs/qrcode.min.js','images/icon/favicon.ico',+ 'images/icon/favicon-16x16.png',+ 'images/icon/favicon-32x32.png','images/icon/android-chrome-192x192.png',- 'images/icon/apple-touch-icon-180',- 'images/icon/apple-touch-icon-152',- 'images/icon/apple-touch-icon',+ 'images/icon/android-chrome-512x512.png',+ 'images/icon/maskable_icon_x192.png',+ 'images/icon/maskable_icon_x512.png',+ 'images/icon/apple-touch-icon-180.png',+ 'images/icon/apple-touch-icon-152.png',+ 'images/icon/apple-touch-icon.png','images/screenshots/desktop.png','images/siteicons/wallos.png','images/siteicons/walloswhite.png',@@ -81,23 +95,23 @@ const staticAssets = ['images/avatars/8.svg','images/avatars/9.svg','images/siteicons/svg/logo.php',- 'images/siteicons/svg/category.php',+ 'images/siteicons/svg/automatic.php',+ 'images/siteicons/svg/manual.php',+ 'images/siteicons/svg/export_ical.php','images/siteicons/svg/check.php',- 'images/siteicons/svg/delete.php',- 'images/siteicons/svg/edit.php',- 'images/siteicons/svg/notes.php',- 'images/siteicons/scg/payment.php',- 'images/siteicons/svg/save.php',- 'images/siteicons/svg/subscription.php',- 'images/siteicons/svg/web.php',- 'images/siteicons/svg/websearch.php',- 'images/siteicons/svg/clone.php','images/siteicons/svg/mobile-menu/calendar.php','images/siteicons/svg/mobile-menu/home.php','images/siteicons/svg/mobile-menu/profile.php','images/siteicons/svg/mobile-menu/settings.php','images/siteicons/svg/mobile-menu/statistics.php','images/siteicons/svg/mobile-menu/subscriptions.php',+ 'images/siteicons/svg/mobile-menu/about.php',+ 'images/siteicons/svg/mobile-menu/admin.php',+ 'images/siteicons/svg/mobile-menu/logout.php',+ 'images/siteicons/svg/mobile-menu/clone.php',+ 'images/siteicons/svg/mobile-menu/delete.php',+ 'images/siteicons/svg/mobile-menu/edit.php',+ 'images/siteicons/svg/mobile-menu/renew.php','images/siteicons/pwa/stats.png','images/siteicons/pwa/settings.png','images/siteicons/pwa/about.png',diff --git a/settings.php b/settings.phpindex 0105b01..b774dda 100644--- a/settings.php+++ b/settings.php@@ -15,7 +15,6 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];?><script src="scripts/libs/sortable.min.js"></script>-<script src="scripts/libs/qrcode.min.js"></script><style>.logo-preview:after {content: '<?= translate('upload_logo', $i18n) ?>';@@ -824,6 +823,20 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];}?>+ <?php+ $sql = "SELECT * FROM ai_settings WHERE user_id = :userId LIMIT 1";+ $stmt = $db->prepare($sql);+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();++ $aiSettings = [];+ if ($row = $result->fetchArray(SQLITE3_ASSOC)) {+ $aiSettings = $row;+ }++ $canTranslateCategories = !empty($aiSettings['enabled']) && !empty($aiSettings['model']) && $lang != 'en';+ ?>+<section class="account-section"><header><h2><?= translate('categories', $i18n) ?></h2>@@ -881,6 +894,17 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];<div class="buttons"><input type="submit" value="<?= translate('add', $i18n) ?>" id="addCategory"onClick="addCategoryButton()" class="thin mobile-grow" />+ <?php+ if ($canTranslateCategories) {+ ?>+ <button type="button" class="button secondary-button thin mobile-grow" id="translateCategories"+ onClick="translateCategories()">+ <i class="fa-solid fa-language"></i>+ <?= translate('translate_categories', $i18n) ?>+ </button>+ <?php+ }+ ?></div></div></section>@@ -1037,6 +1061,15 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];<input type="submit" value="<?= translate('save', $i18n) ?>" id="addFixerKey"onClick="addFixerKeyButton()" class="thin mobile-grow" /></div>+ <div class="api-usage" id="fixerUsage" style="display: none;">+ <div class="api-usage-label">+ <span><?= translate('monthly_requests_used', $i18n) ?></span>+ <span id="fixerUsageCount"></span>+ </div>+ <div class="api-usage-track">+ <span class="api-usage-fill" id="fixerUsageFill"></span>+ </div>+ </div><div class="settings-notes"><p><i class="fa-solid fa-circle-info"></i><?= translate('fixer_info', $i18n) ?></p><p><?= translate('get_key', $i18n) ?>:@@ -1063,17 +1096,59 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];</section><?php- $sql = "SELECT * FROM ai_settings WHERE user_id = :userId LIMIT 1";- $stmt = $db->prepare($sql);- $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);- $result = $stmt->execute();-- $aiSettings = [];- if ($row = $result->fetchArray(SQLITE3_ASSOC)) {- $aiSettings = $row;+ $googleSearchApiKey = "";+ if ($db->querySingle("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='google_search'") > 0) {+ $sql = "SELECT api_key FROM google_search WHERE user_id = :userId";+ $stmt = $db->prepare($sql);+ $stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $result = $stmt->execute();+ if ($result && ($row = $result->fetchArray(SQLITE3_ASSOC))) {+ $googleSearchApiKey = $row['api_key'];+ }}?>+ <section class="account-section">+ <header>+ <h2>Google Search (SerpAPI)</h2>+ </header>+ <div class="account-google-search">+ <div class="form-group">+ <input type="text" name="google-search-key" id="googleSearchKey" autocomplete="off"+ value="<?= htmlspecialchars($googleSearchApiKey) ?>" placeholder="<?= translate('api_key', $i18n) ?>"+ <?= $demoMode ? 'disabled title="Not available on Demo Mode"' : '' ?>>+ </div>+ <div class="buttons">+ <input type="submit" value="<?= translate('save', $i18n) ?>" id="saveGoogleSearch"+ onClick="saveGoogleSearchButton()" class="thin mobile-grow" />+ </div>+ <div class="api-usage" id="googleSearchUsage" style="display: none;">+ <div class="api-usage-label">+ <span><?= translate('monthly_searches_used', $i18n) ?></span>+ <span id="googleSearchUsageCount"></span>+ </div>+ <div class="api-usage-track">+ <span class="api-usage-fill" id="googleSearchUsageFill"></span>+ </div>+ </div>+ <div class="settings-notes">+ <p>+ <i class="fa-solid fa-circle-info"></i>+ <?= translate('google_search_info', $i18n) ?>+ </p>+ <p><?= translate('get_key', $i18n) ?>:+ <span>+ https://serpapi.com/+ <a href="https://serpapi.com/users/sign_up?plan=free" title="SerpAPI"+ target="_blank" rel="noreferrer">+ <i class="fa-solid fa-arrow-up-right-from-square"></i>+ </a>+ </span>+ </p>+ </div>+ </div>+ </section>+<section class="account-section"><header><h2><?= translate('ai_recommendations', $i18n) ?></h2>@@ -1109,9 +1184,6 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];class="<?= (isset($aiSettings['type']) && $aiSettings['type'] == 'ollama') ? 'hidden' : '' ?>"placeholder="<?= translate('api_key', $i18n) ?>"value="<?= isset($aiSettings['api_key']) ? htmlspecialchars($aiSettings['api_key']) : '' ?>" />- <button type="button" id="toggleAiApiKey" class="button secondary-button icon-button <?= (isset($aiSettings['type']) && $aiSettings['type'] == 'ollama') ? 'hidden' : '' ?>" onclick="toggleAiApiKeyVisibility()" aria-label="Toggle API key visibility">- <i class="fa-solid fa-eye"></i>- </button><button type="button" id="fetchModelsButton" class="button thin" onclick="fetch_ai_models()"><?= translate('test', $i18n) ?></button>@@ -1247,9 +1319,15 @@ $userData['currency_symbol'] = $currencies[$main_currency]['symbol'];title="<?= translate('search_logo', $i18n) ?>" onClick="searchPaymentIcon()"><i class="fa-solid fa-magnifying-glass"></i></div>+ <div class="icon-search-backdrop" id="icon-search-backdrop" onClick="closeIconSearch()"></div><div id="icon-search-results" class="icon-search">+ <button type="button" class="close-icon-search" onClick="closeIconSearch()" title="<?= translate('cancel', $i18n) ?>">+ <i class="fa-solid fa-xmark"></i>+ </button><header>- <span class="fa-solid fa-xmark close-icon-search" onClick="closeIconSearch()"></span>+ <h3 id="icon-search-title" data-title="<?= translate('web_search', $i18n) ?>">+ <?= translate('web_search', $i18n) ?>+ </h3></header><div id="icon-search-images"></div></div>diff --git a/stats.php b/stats.phpindex 17156cb..8b5fe02 100644--- a/stats.php+++ b/stats.php@@ -1,361 +1,629 @@-<?php-require_once 'includes/header.php';---// Get code of main currency to display on statistics-$query = "SELECT c.code- FROM currencies c- INNER JOIN user u ON c.id = u.main_currency- WHERE u.id = :userId";-$stmt = $db->prepare($query);-$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);-$result = $stmt->execute();-$row = $result->fetchArray(SQLITE3_ASSOC);-$code = $row['code'];--require_once 'includes/stats_calculations.php';--?>-<section class="contain">- <?php- if ($showCantConverErrorMessage) {- ?>- <div class="error-box">- <div class="error-message">- <i class="fa-solid fa-exclamation-circle"></i>- <?= translate('cant_convert_currency', $i18n) ?>- </div>- </div>- <?php- }- ?>- <div class="split-header">- <h2>- <?= translate('general_statistics', $i18n) ?> <span class="header-subtitle"><?= $statsSubtitle ?></span>- </h2>- <div class="filtermenu">- <button class="button secondary-button" id="filtermenu-button">- <i class="fa-solid fa-filter"></i>- <?= translate("filter", $i18n) ?>- </button>- <div class="filtermenu-content">- <?php- if (count($members) > 1) {- ?>- <div class="filtermenu-submenu">- <div class="filter-title" onClick="toggleSubMenu('member')"><?= translate("member", $i18n) ?></div>- <div class="filtermenu-submenu-content" id="filter-member">- <?php- foreach ($members as $member) {- $isSelected = isset($_GET['member']) && in_array($member['id'], array_map('intval', explode(',', $_GET['member'])));- if (($menuMemberCounts[$member['id']] ?? 0) == 0 && !$isSelected) {- continue;- }- $selectedClass = $isSelected ? 'selected' : '';- ?>- <div class="filter-item <?= $selectedClass ?>" data-memberid="<?= $member['id'] ?>"><?= $member['name'] ?>- </div>- <?php- }- ?>- </div>- </div>- <?php- }- ?>- <?php- if (count($categories) > 1) {- // sort categories by order- usort($categories, function ($a, $b) {- return $a['order'] - $b['order'];- });- ?>- <div class="filtermenu-submenu">- <div class="filter-title" onClick="toggleSubMenu('category')"><?= translate("category", $i18n) ?></div>- <div class="filtermenu-submenu-content" id="filter-category">- <?php- foreach ($categories as $category) {- $isSelected = isset($_GET['category']) && in_array($category['id'], array_map('intval', explode(',', $_GET['category'])));- if (($menuCategoryCounts[$category['id']] ?? 0) == 0 && !$isSelected) {- continue;- }- $categoryName = $category['name'] == "No category" ? translate("no_category", $i18n) : $category['name'];- $selectedClass = $isSelected ? 'selected' : '';- ?>- <div class="filter-item <?= $selectedClass ?>" data-categoryid="<?= $category['id'] ?>">- <?= $categoryName ?>- </div>- <?php- }- ?>- </div>- </div>- <?php- }- ?>- <?php- if (count($paymentMethods) > 1) {-- usort($paymentMethods, function ($a, $b) {- return $a['order'] <=> $b['order'];- });- ?>- <div class="filtermenu-submenu">- <div class="filter-title" onClick="toggleSubMenu('payment')"><?= translate("payment_method", $i18n) ?></div>- <div class="filtermenu-submenu-content" id="filter-payment">- <?php- foreach ($paymentMethods as $payment) {- $isSelected = isset($_GET['payment']) && in_array($payment['id'], array_map('intval', explode(',', $_GET['payment'])));- if (($menuPaymentCounts[$payment['id']] ?? 0) == 0 && !$isSelected) {- continue;- }- $selectedClass = $isSelected ? 'selected' : '';- ?>- <div class="filter-item <?= $selectedClass ?>" data-paymentid="<?= $payment['id'] ?>">- <?= $payment['name'] ?>- </div>- <?php- }- ?>- </div>- </div>- <?php- }- ?>- <?php- if (isset($_GET['member']) || isset($_GET['category']) || isset($_GET['payment'])) {- ?>- <div class="filtermenu-submenu">- <div class="filter-title filter-clear" onClick="clearFilters()">- <i class="fa-solid fa-times-circle"></i> <?= translate("clear", $i18n) ?>- </div>- </div>- <?php- }- ?>- </div>- </div>- </div>- </div>- </div>- <div class="statistics">- <div class="statistic">- <span><?= $activeSubscriptions ?></span>- <div class="title"><?= translate('active_subscriptions', $i18n) ?></div>- </div>- <div class="statistic">- <span><?= CurrencyFormatter::format($totalCostPerMonth, $code) ?></span>- <div class="title"><?= translate('monthly_cost', $i18n) ?></div>- </div>- <div class="statistic">- <span><?= CurrencyFormatter::format($totalCostPerYear, $code) ?></span>- <div class="title"><?= translate('yearly_cost', $i18n) ?></div>- </div>- <div class="statistic">- <span><?= CurrencyFormatter::format($averageSubscriptionCost, $code) ?></span>- <div class="title"><?= translate('average_monthly', $i18n) ?></div>- </div>- <div class="statistic short">- <span><?= CurrencyFormatter::format($mostExpensiveSubscription['price'], $code) ?></span>- <div class="title"><?= translate('most_expensive', $i18n) ?></div>- <?php- if (isset($mostExpensiveSubscription['logo']) && $mostExpensiveSubscription['logo'] != '') {- ?>- <div class="subtitle">- <img src="images/uploads/logos/<?= $mostExpensiveSubscription['logo'] ?>"- alt="<?= $mostExpensiveSubscription['name'] ?>" title="<?= $mostExpensiveSubscription['name'] ?>" />- </div>- <?php- } else if (isset($mostExpensiveSubscription['name']) && $mostExpensiveSubscription['name'] != '') {- ?>- <div class="subtitle"><?= $mostExpensiveSubscription['name'] ?></div>- <?php- }- ?>- </div>- <div class="statistic">- <span><?= CurrencyFormatter::format($amountDueThisMonth, $code) ?></span>- <div class="title"><?= translate('amount_due', $i18n) ?></div>- </div>- <?php- if (isset($budgetUsed)) {- ?>- <div class="statistic">- <span><?= number_format($budgetUsed, 2) ?>%</span>- <div class="title"><?= translate('percentage_budget_used', $i18n) ?></div>- </div>- <?php- }- if (isset($budgetLeft)) {- ?>- <div class="statistic">- <span><?= CurrencyFormatter::format($budgetLeft, $code) ?></span>- <div class="title"><?= translate('budget_remaining', $i18n) ?></div>- </div>- <?php- }- if (isset($overBudgetAmount)) {- ?>- <div class="statistic">- <span><?= CurrencyFormatter::format($overBudgetAmount, $code) ?></span>- <div class="title"><?= translate('amount_over_budget', $i18n) ?></div>- </div>- <?php- }- if ($inactiveSubscriptions > 0) {- ?>- <div class="statistic">- <span><?= $inactiveSubscriptions ?></span>- <div class="title"><?= translate('inactive_subscriptions', $i18n) ?></div>- </div>- <?php- if ($totalSavingsPerMonth > 0) {- ?>- <div class="statistic">- <span><?= CurrencyFormatter::format($totalSavingsPerMonth, $code) ?></span>- <div class="title"><?= translate('monthly_savings', $i18n) ?></div>- </div>- <div class="statistic">- <span><?= CurrencyFormatter::format($totalSavingsPerMonth * 12, $code) ?></span>- <div class="title"><?= translate('yearly_savings', $i18n) ?></div>- </div>- <?php- }- }- ?>- </div>- <?php- $categoryDataPoints = [];- if (isset($categoryCost)) {- foreach ($categoryCost as $category) {- if ($category['cost'] != 0) {- $categoryDataPoints[] = [- "label" => html_entity_decode($category['name']),- "y" => $category["cost"],- ];- }- }- }-- usort($categoryDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);- $showCategoryCostGraph = count($categoryDataPoints) > 1;-- $memberDataPoints = [];- if (isset($memberCost)) {- foreach ($memberCost as $member) {- if ($member['cost'] != 0) {- $memberDataPoints[] = [- "label" => html_entity_decode($member['name']),- "y" => $member["cost"],- ];-- }- }- }-- usort($memberDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);- $showMemberCostGraph = count($memberDataPoints) > 1;-- $paymentMethodDataPoints = [];- foreach ($paymentMethodsCount as $paymentMethod) {- if ($paymentMethod['count'] != 0) {- $paymentMethodDataPoints[] = [- "label" => html_entity_decode($paymentMethod['name']),- "y" => $paymentMethod["count"],- ];- }- }-- usort($paymentMethodDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);- $showPaymentMethodsGraph = count($paymentMethodDataPoints) > 1;- if ($showCategoryCostGraph || $showMemberCostGraph || $showPaymentMethodsGraph || $showTotalMonthlyCostGraph || $showVsBudgetGraph) {- ?>- <h2><?= translate('split_views', $i18n) ?></h2>- <div class="graphs">- <?php-- if ($showTotalMonthlyCostGraph) {- ?>- <section class="graph x2">- <header>- <?= translate('total_cost_trend', $i18n) ?>- <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>- </header>- <canvas id="totalMonthlyCostChart" style="height: 370px; width: 100%; max-height: 370px;"></canvas>- </section>- <?php- }-- if ($showMemberCostGraph) {- ?>- <section class="graph">- <header>- <?= translate('household_split', $i18n) ?>- <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>- </header>- <canvas id="memberSplitChart"></canvas>- </section>- <?php- }-- if ($showCategoryCostGraph) {- ?>- <section class="graph">- <header>- <?= translate('category_split', $i18n) ?>- <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>- </header>- <canvas id="categorySplitChart" style="height: 370px; width: 100%;"></canvas>- </section>- <?php- }-- if ($showPaymentMethodsGraph) {- ?>- <section class="graph">- <header>- <?= translate('payment_method_split', $i18n) ?>- </header>- <canvas id="paymentMethidSplitChart" style="height: 370px; width: 100%;"></canvas>- </section>- <?php- }-- if ($showVsBudgetGraph) {- ?>- <section class="graph">- <header>- <?= translate('cost_vs_budget', $i18n) ?> (<?= CurrencyFormatter::format($budget, $code) ?>)- </header>- <canvas id="budgetVsCostChart" style="height: 370px; width: 100%;"></canvas>- </section>- <?php- }-- ?>- </div>- <?php- }- ?>--</section>-<?php-if ($showCategoryCostGraph || $showMemberCostGraph || $showPaymentMethodsGraph || $showTotalMonthlyCostGraph || $showVsBudgetGraph) {- ?>- <script src="scripts/libs/chart.js"></script>- <script type="text/javascript">- window.onload = function () {- loadLineGraph("totalMonthlyCostChart", <?php echo json_encode($totalMonthlyCostDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", "<?= $showTotalMonthlyCostGraph ?>");- loadGraph("categorySplitChart", <?php echo json_encode($categoryDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showCategoryCostGraph ?>);- loadGraph("memberSplitChart", <?php echo json_encode($memberDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showMemberCostGraph ?>);- loadGraph("paymentMethidSplitChart", <?php echo json_encode($paymentMethodDataPoints, JSON_NUMERIC_CHECK); ?>, "", <?= $showPaymentMethodsGraph ?>);- loadGraph("budgetVsCostChart", <?php echo json_encode($vsBudgetDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showVsBudgetGraph ?>);- }- </script>- <?php-}-?>-<script src="scripts/stats.js?<?= $version ?>"></script>-<?php-require_once 'includes/footer.php';+<?php+require_once 'includes/header.php';+++// Get code of main currency to display on statistics+$query = "SELECT c.code+ FROM currencies c+ INNER JOIN user u ON c.id = u.main_currency+ WHERE u.id = :userId";+$stmt = $db->prepare($query);+$stmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+$result = $stmt->execute();+$row = $result->fetchArray(SQLITE3_ASSOC);+$code = $row['code'];++require_once 'includes/stats_calculations.php';+require_once 'includes/stats_extra_calculations.php';++?>+<section class="contain">+ <?php+ if ($showCantConverErrorMessage) {+ ?>+ <div class="error-box">+ <div class="error-message">+ <i class="fa-solid fa-exclamation-circle"></i>+ <?= translate('cant_convert_currency', $i18n) ?>+ </div>+ </div>+ <?php+ }+ ?>+ <div class="split-header">+ <h2>+ <?= translate('general_statistics', $i18n) ?> <span class="header-subtitle"><?= $statsSubtitle ?></span>+ </h2>+ <div class="filtermenu">+ <button class="button secondary-button" id="filtermenu-button" title="<?= translate("filter", $i18n) ?>">+ <i class="fa-solid fa-filter"></i>+ </button>+ <div class="filtermenu-content">+ <?php+ if (count($members) > 1) {+ ?>+ <div class="filtermenu-submenu">+ <div class="filter-title" onClick="toggleSubMenu('member')"><?= translate("member", $i18n) ?></div>+ <div class="filtermenu-submenu-content" id="filter-member">+ <?php+ foreach ($members as $member) {+ $isSelected = isset($_GET['member']) && in_array($member['id'], array_map('intval', explode(',', $_GET['member'])));+ if (($menuMemberCounts[$member['id']] ?? 0) == 0 && !$isSelected) {+ continue;+ }+ $selectedClass = $isSelected ? 'selected' : '';+ ?>+ <div class="filter-item <?= $selectedClass ?>" data-memberid="<?= $member['id'] ?>"><?= $member['name'] ?>+ </div>+ <?php+ }+ ?>+ </div>+ </div>+ <?php+ }+ ?>+ <?php+ if (count($categories) > 1) {+ // sort categories by order+ usort($categories, function ($a, $b) {+ return $a['order'] - $b['order'];+ });+ ?>+ <div class="filtermenu-submenu">+ <div class="filter-title" onClick="toggleSubMenu('category')"><?= translate("category", $i18n) ?></div>+ <div class="filtermenu-submenu-content" id="filter-category">+ <?php+ foreach ($categories as $category) {+ $isSelected = isset($_GET['category']) && in_array($category['id'], array_map('intval', explode(',', $_GET['category'])));+ if (($menuCategoryCounts[$category['id']] ?? 0) == 0 && !$isSelected) {+ continue;+ }+ $categoryName = $category['name'] == "No category" ? translate("no_category", $i18n) : $category['name'];+ $selectedClass = $isSelected ? 'selected' : '';+ ?>+ <div class="filter-item <?= $selectedClass ?>" data-categoryid="<?= $category['id'] ?>">+ <?= $categoryName ?>+ </div>+ <?php+ }+ ?>+ </div>+ </div>+ <?php+ }+ ?>+ <?php+ if (count($paymentMethods) > 1) {++ usort($paymentMethods, function ($a, $b) {+ return $a['order'] <=> $b['order'];+ });+ ?>+ <div class="filtermenu-submenu">+ <div class="filter-title" onClick="toggleSubMenu('payment')"><?= translate("payment_method", $i18n) ?></div>+ <div class="filtermenu-submenu-content" id="filter-payment">+ <?php+ foreach ($paymentMethods as $payment) {+ $isSelected = isset($_GET['payment']) && in_array($payment['id'], array_map('intval', explode(',', $_GET['payment'])));+ if (($menuPaymentCounts[$payment['id']] ?? 0) == 0 && !$isSelected) {+ continue;+ }+ $selectedClass = $isSelected ? 'selected' : '';+ ?>+ <div class="filter-item <?= $selectedClass ?>" data-paymentid="<?= $payment['id'] ?>">+ <?= $payment['name'] ?>+ </div>+ <?php+ }+ ?>+ </div>+ </div>+ <?php+ }+ ?>+ <?php+ if (isset($_GET['member']) || isset($_GET['category']) || isset($_GET['payment'])) {+ ?>+ <div class="filtermenu-submenu">+ <div class="filter-title filter-clear" onClick="clearFilters()">+ <i class="fa-solid fa-times-circle"></i> <?= translate("clear", $i18n) ?>+ </div>+ </div>+ <?php+ }+ ?>+ </div>+ </div>+ </div>+ </div>+ </div>+ <?php+ // Graph datasets for the split views+ $categoryDataPoints = [];+ if (isset($categoryCost)) {+ foreach ($categoryCost as $category) {+ if ($category['cost'] != 0) {+ $categoryDataPoints[] = [+ "label" => html_entity_decode($category['name']),+ "y" => $category["cost"],+ ];+ }+ }+ }+ usort($categoryDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);+ $showCategoryCostGraph = count($categoryDataPoints) > 1;++ $memberDataPoints = [];+ if (isset($memberCost)) {+ foreach ($memberCost as $member) {+ if ($member['cost'] != 0) {+ $memberDataPoints[] = [+ "label" => html_entity_decode($member['name']),+ "y" => $member["cost"],+ ];+ }+ }+ }+ usort($memberDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);+ $showMemberCostGraph = count($memberDataPoints) > 1;++ $paymentMethodDataPoints = [];+ foreach ($paymentMethodCost as $paymentMethodId => $cost) {+ if ($cost > 0 && isset($paymentMethodsCount[$paymentMethodId])) {+ $paymentMethodDataPoints[] = [+ "label" => html_entity_decode($paymentMethodsCount[$paymentMethodId]['name']),+ "y" => round($cost, 2),+ ];+ }+ }+ usort($paymentMethodDataPoints, fn($a, $b) => $b['y'] <=> $a['y']);+ $showPaymentMethodsGraph = count($paymentMethodDataPoints) > 1;++ $showAnyGraph = $showCategoryCostGraph || $showMemberCostGraph || $showPaymentMethodsGraph || $showTotalMonthlyCostGraph || $showVsBudgetGraph+ || $showProjectionGraph || $showLifetimeGraph || $showCycleGraph || $showCurrencyGraph || $showHistogramGraph || $showYearlyNewGraph;++ $showTrendsSection = $showTotalMonthlyCostGraph || $showProjectionGraph || $monthOverMonthDelta !== null;+ $showBudgetSection = isset($budgetUsed) || isset($budgetLeft) || isset($overBudgetAmount) || $showVsBudgetGraph;+ $showSplitSection = $showMemberCostGraph || $showCategoryCostGraph || $showPaymentMethodsGraph || $showCycleGraph || $showCurrencyGraph || $showHistogramGraph;+ $showHistorySection = $totalLifetimeSpend > 0 || $oldestSubscription !== null || $averageSubscriptionAge !== null || $showLifetimeGraph || $showYearlyNewGraph;+ ?>++ <section class="stats-section">+ <h2><?= translate('overview', $i18n) ?></h2>+ <div class="statistics">+ <div class="statistic">+ <span><?= $activeSubscriptions ?></span>+ <div class="title"><?= translate('active_subscriptions', $i18n) ?></div>+ </div>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($totalCostPerMonth, $code) ?></span>+ <div class="title"><?= translate('monthly_cost', $i18n) ?></div>+ </div>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($totalCostPerYear, $code) ?></span>+ <div class="title"><?= translate('yearly_cost', $i18n) ?></div>+ </div>+ <?php+ if ($totalCostPerMonth > 0) {+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($costPerDay, $code) ?></span>+ <div class="title"><?= translate('cost_per_day', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($averageSubscriptionCost, $code) ?></span>+ <div class="title"><?= translate('average_monthly', $i18n) ?></div>+ </div>+ <div class="statistic short">+ <span><?= CurrencyFormatter::format($mostExpensiveSubscription['price'], $code) ?></span>+ <div class="title"><?= translate('most_expensive', $i18n) ?></div>+ <?php+ if (isset($mostExpensiveSubscription['logo']) && $mostExpensiveSubscription['logo'] != '') {+ ?>+ <div class="subtitle">+ <img src="images/uploads/logos/<?= $mostExpensiveSubscription['logo'] ?>"+ alt="<?= $mostExpensiveSubscription['name'] ?>" title="<?= $mostExpensiveSubscription['name'] ?>" />+ </div>+ <?php+ } else if (isset($mostExpensiveSubscription['name']) && $mostExpensiveSubscription['name'] != '') {+ ?>+ <div class="subtitle"><?= $mostExpensiveSubscription['name'] ?></div>+ <?php+ }+ ?>+ </div>+ <?php+ if ($cheapestSubscription !== null) {+ ?>+ <div class="statistic short">+ <span><?= CurrencyFormatter::format($cheapestSubscription['price'], $code) ?></span>+ <div class="title"><?= translate('cheapest_subscription', $i18n) ?></div>+ <?php+ if (!empty($cheapestSubscription['logo'])) {+ ?>+ <div class="subtitle">+ <img src="images/uploads/logos/<?= $cheapestSubscription['logo'] ?>" alt="<?= $cheapestSubscription['name'] ?>"+ title="<?= $cheapestSubscription['name'] ?>" />+ </div>+ <?php+ } else if (!empty($cheapestSubscription['name'])) {+ ?>+ <div class="subtitle"><?= $cheapestSubscription['name'] ?></div>+ <?php+ }+ ?>+ </div>+ <?php+ }+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($amountDueThisMonth, $code) ?></span>+ <div class="title"><?= translate('amount_due', $i18n) ?></div>+ </div>+ <?php+ if ($manualRenewalsCount > 0) {+ ?>+ <div class="statistic">+ <span><?= $manualRenewalsCount ?></span>+ <div class="title"><?= translate('manual_renewals', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ </div>+ </section>++ <?php+ if ($showTrendsSection) {+ ?>+ <section class="stats-section">+ <h2><?= translate('trends_and_forecast', $i18n) ?></h2>+ <?php+ if ($monthOverMonthDelta !== null || ($showProjectionGraph && $heaviestMonth !== null) || $monthsOverBudget !== null) {+ ?>+ <div class="statistics">+ <?php+ if ($monthOverMonthDelta !== null) {+ $momSign = $monthOverMonthDelta >= 0 ? '+' : '-';+ ?>+ <div class="statistic short">+ <span><?= $momSign ?><?= CurrencyFormatter::format(abs($monthOverMonthDelta), $code) ?></span>+ <div class="title"><?= translate('vs_last_month', $i18n) ?></div>+ <?php+ if ($monthOverMonthPercentage !== null) {+ ?>+ <div class="subtitle"><?= $momSign ?><?= number_format(abs($monthOverMonthPercentage), 1) ?>%</div>+ <?php+ }+ ?>+ </div>+ <?php+ }+ if ($showProjectionGraph && $heaviestMonth !== null) {+ ?>+ <div class="statistic short">+ <span><?= CurrencyFormatter::format($heaviestMonth['total'], $code) ?></span>+ <div class="title"><?= translate('heaviest_month', $i18n) ?></div>+ <div class="subtitle capitalize"><?= $heaviestMonth['label'] ?></div>+ </div>+ <?php+ }+ if ($monthsOverBudget !== null) {+ ?>+ <div class="statistic">+ <span><?= $monthsOverBudget ?></span>+ <div class="title"><?= translate('months_over_budget', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ </div>+ <?php+ }+ if ($showTotalMonthlyCostGraph || $showProjectionGraph) {+ ?>+ <div class="graphs">+ <?php+ if ($showTotalMonthlyCostGraph) {+ ?>+ <section class="graph x2">+ <header>+ <?= translate('total_cost_trend', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="totalMonthlyCostChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showProjectionGraph) {+ ?>+ <section class="graph x2">+ <header>+ <?= translate('projected_cost', $i18n) ?>+ </header>+ <div id="projectionChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ ?>+ </div>+ <?php+ }+ ?>+ </section>+ <?php+ }++ if ($showBudgetSection) {+ ?>+ <section class="stats-section">+ <h2><?= translate('budget', $i18n) ?></h2>+ <div class="statistics">+ <?php+ if (isset($budgetUsed)) {+ ?>+ <div class="statistic">+ <span><?= number_format($budgetUsed, 2) ?>%</span>+ <div class="title"><?= translate('percentage_budget_used', $i18n) ?></div>+ </div>+ <?php+ }+ if (isset($budgetLeft)) {+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($budgetLeft, $code) ?></span>+ <div class="title"><?= translate('budget_remaining', $i18n) ?></div>+ </div>+ <?php+ }+ if (isset($overBudgetAmount)) {+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($overBudgetAmount, $code) ?></span>+ <div class="title"><?= translate('amount_over_budget', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ </div>+ <?php+ if ($showVsBudgetGraph) {+ ?>+ <div class="graphs">+ <section class="graph">+ <header>+ <?= translate('cost_vs_budget', $i18n) ?> (<?= CurrencyFormatter::format($budget, $code) ?>)+ </header>+ <div id="budgetVsCostChart" style="width: 100%;"></div>+ </section>+ </div>+ <?php+ }+ ?>+ </section>+ <?php+ }++ if ($showSplitSection) {+ ?>+ <section class="stats-section">+ <h2><?= translate('split_views', $i18n) ?></h2>+ <div class="graphs">+ <?php+ if ($showMemberCostGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('household_split', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="memberSplitChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showCategoryCostGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('category_split', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="categorySplitChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showPaymentMethodsGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('payment_method_split', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="paymentMethidSplitChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showCycleGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('billing_cycle_split', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="cycleSplitChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showCurrencyGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('currency_split', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>)</div>+ </header>+ <div id="currencySplitChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showHistogramGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('price_distribution', $i18n) ?>+ <div class="sub-header">(<?= translate('monthly_cost', $i18n) ?>, <?= $code ?>)</div>+ </header>+ <div id="priceHistogramChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ ?>+ </div>+ </section>+ <?php+ }++ if ($showHistorySection) {+ ?>+ <section class="stats-section">+ <h2><?= translate('history_and_lifetime', $i18n) ?></h2>+ <?php+ if ($totalLifetimeSpend > 0 || $oldestSubscription !== null || $averageSubscriptionAge !== null) {+ ?>+ <div class="statistics">+ <?php+ if ($totalLifetimeSpend > 0) {+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($totalLifetimeSpend, $code) ?></span>+ <div class="title"><?= translate('all_time_spend', $i18n) ?></div>+ </div>+ <?php+ }+ if ($oldestSubscription !== null) {+ ?>+ <div class="statistic short">+ <span><?= number_format($oldestSubscription['years'], 1) ?></span>+ <div class="title"><?= translate('oldest_subscription', $i18n) ?></div>+ <?php+ if (!empty($oldestSubscription['logo'])) {+ ?>+ <div class="subtitle">+ <img src="images/uploads/logos/<?= $oldestSubscription['logo'] ?>" alt="<?= $oldestSubscription['name'] ?>"+ title="<?= $oldestSubscription['name'] ?>" />+ </div>+ <?php+ } else if (!empty($oldestSubscription['name'])) {+ ?>+ <div class="subtitle"><?= $oldestSubscription['name'] ?></div>+ <?php+ }+ ?>+ </div>+ <?php+ }+ if ($averageSubscriptionAge !== null) {+ ?>+ <div class="statistic">+ <span><?= number_format($averageSubscriptionAge, 1) ?></span>+ <div class="title"><?= translate('average_subscription_age', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ </div>+ <?php+ }+ if ($showLifetimeGraph || $showYearlyNewGraph) {+ ?>+ <div class="graphs">+ <?php+ if ($showYearlyNewGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('new_subscriptions_per_year', $i18n) ?>+ </header>+ <div id="newPerYearChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ if ($showLifetimeGraph) {+ ?>+ <section class="graph">+ <header>+ <?= translate('lifetime_spend', $i18n) ?>+ <div class="sub-header"><?= translate('estimated_from_current_prices', $i18n) ?></div>+ </header>+ <div id="lifetimeSpendChart" style="width: 100%;"></div>+ </section>+ <?php+ }+ ?>+ </div>+ <?php+ }+ ?>+ </section>+ <?php+ }++ if ($inactiveSubscriptions > 0) {+ ?>+ <section class="stats-section">+ <h2><?= translate('your_savings', $i18n) ?></h2>+ <div class="statistics">+ <div class="statistic">+ <span><?= $inactiveSubscriptions ?></span>+ <div class="title"><?= translate('inactive_subscriptions', $i18n) ?></div>+ </div>+ <?php+ if ($totalSavingsPerMonth > 0) {+ ?>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($totalSavingsPerMonth, $code) ?></span>+ <div class="title"><?= translate('monthly_savings', $i18n) ?></div>+ </div>+ <div class="statistic">+ <span><?= CurrencyFormatter::format($totalSavingsPerMonth * 12, $code) ?></span>+ <div class="title"><?= translate('yearly_savings', $i18n) ?></div>+ </div>+ <?php+ }+ ?>+ </div>+ </section>+ <?php+ }+ ?>++</section>+<?php+if ($showAnyGraph) {+ ?>+ <script src="scripts/libs/apexcharts.min.js"></script>+ <script type="text/javascript">+ window.onload = function () {+ loadLineGraph("totalMonthlyCostChart", <?php echo json_encode($totalMonthlyCostDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showTotalMonthlyCostGraph ? 1 : 0 ?>);+ loadBarGraph("projectionChart", <?php echo json_encode($projectionDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showProjectionGraph ? 1 : 0 ?>, <?= isset($budget) && $budget > 0 ? $budget : 'null' ?>);+ loadGraph("categorySplitChart", <?php echo json_encode($categoryDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showCategoryCostGraph ? 1 : 0 ?>);+ loadGraph("memberSplitChart", <?php echo json_encode($memberDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showMemberCostGraph ? 1 : 0 ?>);+ loadGraph("paymentMethidSplitChart", <?php echo json_encode($paymentMethodDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showPaymentMethodsGraph ? 1 : 0 ?>);+ loadGraph("budgetVsCostChart", <?php echo json_encode($vsBudgetDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showVsBudgetGraph ? 1 : 0 ?>);+ loadGraph("cycleSplitChart", <?php echo json_encode($cycleDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showCycleGraph ? 1 : 0 ?>);+ loadGraph("currencySplitChart", <?php echo json_encode($currencyDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showCurrencyGraph ? 1 : 0 ?>);+ loadBarGraph("priceHistogramChart", <?php echo json_encode($histogramDataPoints, JSON_NUMERIC_CHECK); ?>, "", <?= $showHistogramGraph ? 1 : 0 ?>, null);+ loadBarGraph("newPerYearChart", <?php echo json_encode($newPerYearDataPoints, JSON_NUMERIC_CHECK); ?>, "", <?= $showYearlyNewGraph ? 1 : 0 ?>, null);+ loadHorizontalBarGraph("lifetimeSpendChart", <?php echo json_encode($lifetimeDataPoints, JSON_NUMERIC_CHECK); ?>, "<?= $code ?>", <?= $showLifetimeGraph ? 1 : 0 ?>);+ }+ </script>+ <?php+}+?>+<script src="scripts/stats.js?<?= $version ?>"></script>+<?php+require_once 'includes/footer.php';?>\ No newline at end of filediff --git a/styles/dark-theme.css b/styles/dark-theme.cssindex 20a153f..dcb1bd8 100644--- a/styles/dark-theme.css+++ b/styles/dark-theme.css@@ -1,247 +1,216 @@- :root {- --background-color: #303030;- --background-color-rgb: 48, 48, 48;- --box-background-color: #222222;- --box-background-color-rgb: 34, 34, 34;- --box-border-color: #333;- --box-border-color-rgb: 51, 51, 51;- --header-background-color: #222222;- --header-background-color-rgb: 34, 34, 34;- --text-color: #E0E0E0;- --text-color-rgb: 224, 224, 224;- --input-border-color: #666;- --input-border-color-rgb: 102, 102, 102;- --input-background-color: #555;- --input-background-color-rgb: 85, 85, 85;- --input-disabled-background-color: #999999;- --input-disabled-background-color-rgb: 153, 153, 153;- --input-disabled-border-color: #666666;- --input-disabled-border-color-rgb: 102, 102, 102;- --box-shadow: 0 2px 5px rgba(120, 120, 120, 0.1);- --negative-box-shadow: 0 -2px 5px rgba(120, 120, 120, 0.1);- }--body {- background-color: var(--background-color);- color: var(--text-color);-}--body>header {- background-color: var(--header-background-color);-}--svg .text-color {- fill: var(--text-color);-}--.split-header>h2 .header-subtitle {- color: var(--text-color);-}--.dropbtn {- color: #E0E0E0;-}--.dropdown-content a {- color: #E0E0E0;-}--.dropdown-content a:hover {- background-color: #333333;-}--.filtermenu-content .filter-item:hover,-.filtermenu-content .filter-title:hover {- background-color: #333333;-}--.subscription-form h3,-.subscription-modal h3 {- color: #FFF;-}--.subscription.inactive {- background-color: #222;- color: rgba(200, 200, 200, 0.6);- box-shadow: 0 2px 5px rgba(50, 50, 50, 0.1);-}--.subscription-main .actions {- color: #E0E0E0-}--.subscription-main .actions>li {- border-bottom: 1px solid #555;- border-color: #666;-}--.subscription-main .actions>li:hover {- background-color: #333;-}--.subscription-main .actions>li:last-of-type {- border: none;-}--.subscription-container {- background-color: #222;- }--.close-form {- color: #EEE;-}--input[type="text"]::placeholder,-input[type="email"]::placeholder,-input[type="password"]::placeholder,-input[type="date"]::placeholder,-input[type="number"]::placeholder,-textarea::placeholder,-select::placeholder {- color: #BBB;-}--button.secondary-button,-button.button.secondary-button,-input[type="button"].secondary-button {- background-color: #222;-}--button.button.secondary-button:hover,-button.secondary-button:hover,-input[type="button"].secondary-button:hover {- background-color: #111;-}--input[type="color"] {- background-color: #F2F2F2;-}--.avatar-select .avatar-list .remove-avatar {- background-color: #222;-}--.avatar-select .avatar-list>img,-.avatar-select .avatar-list .avatar-container>img {- border: 1px solid #999;-}--.avatar-select .avatar-list>img:hover,-.avatar-select .avatar-list .avatar-container>img:hover {- border: 1px solid #EEE;-}--.avatar-select .avatar-list .remove-avatar:hover {- background-color: #666;-}--.account-notification-section-header:hover {- background-color: #444;-}--.toast {- box-shadow: 0 6px 20px -5px rgba(255, 255, 255, 0.1);-}--.toast .close-error {- color: #EEE;-}--.toast-content .message .text.text-1 {- color: #BBB;-}--.toast-content .message .text {- color: #999;-}--.logo-preview:after {- color: var(--main-color);-}--.sort-options>ul>li {- border-bottom: 1px solid #555;- color: #DDD;-}--.sort-options>ul>li:hover {- background-color: #444;-}--.payment-name {- color: #FFF;-}--.payments-list .payments-payment .delete-payment-method {- color: #FFF;-}--.calendar .calendar-body .calendar-cell .calendar-cell-header {- background-color: #111;-}--.calendar .calendar-body .calendar-cell {- border-right: 1px solid #111;-}--button.dark-theme-button {- color: #E0E0E0;-}--button.dark-theme-button:hover {- background-color: #111;-}--.account-notifications-section {- border: 1px solid #666;-}--input[type="checkbox"]+label::before,-input[type="radio"]+label::before {- background: #555;- border: 1px solid #666;-}--input[type="checkbox"]:disabled+label::before,-input[type="radio"]:disabled+label::before {- background-color: #333;- border-color: #222;- cursor: not-allowed;-}--input {- color-scheme: dark;-}--.update-banner {- color: #FFF;-}--.update-banner>span>a {- color: #FFF;-}--.totp-qrcode-container {- padding: 14px;- border: 1px solid #DDD;- border-radius: 8px;-}--.totp-backup-codes {- background-color: #111;- border: 2px dashed #444;-}--.mobile-nav-image {- background-image: url("../images/siteimages/mobilenavdark.png");-}--@media (max-width: 768px) {- .mobile-nav>a {- color: #909090;- }-- .mobile-nav>a.active {- color: #f0f0F0;- }-}\ No newline at end of file+:root {+ --background-color: #0F1218;+ --background-color-rgb: 15, 18, 24;+ --box-background-color: #171B23;+ --box-background-color-rgb: 23, 27, 35;+ --box-border-color: #262C38;+ --box-border-color-rgb: 38, 44, 56;+ --header-background-color: #12151C;+ --header-background-color-rgb: 18, 21, 28;+ --text-color: #E4E8F1;+ --text-color-rgb: 228, 232, 241;+ --input-border-color: #38404F;+ --input-border-color-rgb: 56, 64, 79;+ --input-background-color: #1F2530;+ --input-background-color-rgb: 31, 37, 48;+ --input-disabled-background-color: #232936;+ --input-disabled-background-color-rgb: 35, 41, 54;+ --input-disabled-border-color: #2A3140;+ --input-disabled-border-color-rgb: 42, 49, 64;+ --box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -18px rgba(0, 0, 0, 0.55);+ --negative-box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.35);+ --surface-hover: #1F2530;+ --surface-hover-rgb: 31, 37, 48;+ --text-muted: #8B94A7;+ --text-muted-rgb: 139, 148, 167;+ --warning-color: #F59E0B;+ --warning-color-rgb: 245, 158, 11;+ --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.45), 0 16px 40px -16px rgba(0, 0, 0, 0.65);+ --focus-ring: 0 0 0 3px rgba(var(--main-color-rgb), 0.35);+}++body {+ background-color: var(--background-color);+ color: var(--text-color);+}++body>header {+ background-color: rgba(var(--header-background-color-rgb), 0.85);+}++svg .text-color {+ fill: var(--text-color);+}++.split-header>h2 .header-subtitle {+ color: var(--text-color);+}++.dropbtn {+ color: var(--text-color);+}++.dropdown-content a {+ color: var(--text-color);+}++.subscription-form h3,+.subscription-modal h3 {+ color: #FFF;+}++.subscription.inactive {+ background-color: var(--box-background-color);+ color: rgba(180, 188, 204, 0.55);+ box-shadow: none;+}++.subscription-main .actions {+ color: var(--text-color);+}++.subscription-main .actions>li {+ border-bottom: 1px solid var(--box-border-color);+}++.subscription-main .actions>li:last-of-type {+ border: none;+}++.close-form {+ color: #B4BCCC;+}++input[type="text"]::placeholder,+input[type="email"]::placeholder,+input[type="password"]::placeholder,+input[type="date"]::placeholder,+input[type="number"]::placeholder,+textarea::placeholder,+select::placeholder {+ color: #7E8797;+}++input[type="color"] {+ background-color: #F2F2F2;+}++.avatar-select .avatar-list .remove-avatar {+ background-color: var(--box-background-color);+}++.avatar-select .avatar-list>img,+.avatar-select .avatar-list .avatar-container>img {+ border: 1px solid #4A5265;+}++.avatar-select .avatar-list>img:hover,+.avatar-select .avatar-list .avatar-container>img:hover {+ border: 1px solid #E4E8F1;+}++.avatar-select .avatar-list .remove-avatar:hover {+ background-color: var(--surface-hover);+}++.account-notification-section-header:hover {+ background-color: var(--surface-hover);+}++.toast {+ box-shadow: 0 6px 24px -6px rgba(0, 0, 0, 0.6);+}++.toast .close-error {+ color: #E4E8F1;+}++.toast-content .message .text.text-1 {+ color: #C4CBD9;+}++.toast-content .message .text {+ color: #8B94A7;+}++.logo-preview:after {+ color: var(--main-color);+}++.sort-options>ul>li {+ color: var(--text-color);+}++.payment-name {+ color: #FFF;+}++.payments-list .payments-payment .delete-payment-method {+ color: #FFF;+}++button.dark-theme-button {+ color: var(--text-color);+}++button.dark-theme-button:hover {+ background-color: var(--surface-hover);+}++.account-notifications-section {+ border: 1px solid var(--input-border-color);+}++input[type="checkbox"]+label::before,+input[type="radio"]+label::before {+ background: var(--input-background-color);+ border: 1px solid var(--input-border-color);+}++input[type="checkbox"]:disabled+label::before,+input[type="radio"]:disabled+label::before {+ background-color: #2A3140;+ border-color: #232936;+ cursor: not-allowed;+}++input {+ color-scheme: dark;+}++select {+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238B94A7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+}++.update-banner {+ color: #FFF;+}++.update-banner>span>a {+ color: #FFF;+}++.totp-qrcode-container {+ padding: 14px;+ border: 1px solid #DDD;+ border-radius: 8px;+}++.totp-backup-codes {+ background-color: #12151C;+ border: 2px dashed #38404F;+}++.mobile-nav-image {+ background-image: url("../images/siteimages/mobilenavdark.png");+}++@media (max-width: 768px) {+ .mobile-nav>a {+ color: #7E8797;+ }++ .mobile-nav>a.active {+ color: #F0F2F7;+ }+}diff --git a/styles/login-dark-theme.css b/styles/login-dark-theme.cssindex 1774c72..0baa811 100644--- a/styles/login-dark-theme.css+++ b/styles/login-dark-theme.css@@ -1,38 +1,79 @@-body {- background-color: #303030;- color: #E0E0E0;-}--svg .text-color {- fill: #E0E0E0;-}--.container {- background-color: #222;- border: 1px solid #333;- box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);-}--@media (max-width: 768px) {- .container {- background-color: transparent;- border: none;- box-shadow: none;- }-}--input[type="text"],-input[type="email"],-input[type="password"],-input[type="checkbox"],-select {- background-color: #555;- border: 1px solid #666;- color: #E0E0E0;-}--input[type="text"]::placeholder,-input[type="email"]::placeholder,-input[type="password"]::placeholder {- color: #BBB;-}\ No newline at end of file+body {+ background-color: #0F1218;+ color: #E4E8F1;+}++svg .text-color {+ fill: #E4E8F1;+}++.container {+ background-color: #171B23;+ border: 1px solid #262C38;+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -18px rgba(0, 0, 0, 0.55);+}++@media (max-width: 899px) {+ .container {+ background-color: transparent;+ border: none;+ box-shadow: none;+ }+}++input[type="text"],+input[type="email"],+input[type="password"],+select {+ background-color: #1F2530;+ border: 1px solid #38404F;+ color: #E4E8F1;+}++input[type="checkbox"]+label::before {+ background-color: #1F2530;+ border-color: #38404F;+}++.password-field .password-toggle {+ color: #8B94A7;+}++input[type="text"]::placeholder,+input[type="email"]::placeholder,+input[type="password"]::placeholder {+ color: #7E8797;+}++input {+ color-scheme: dark;+}++select {+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238B94A7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+}++input[type="button"].secondary-button,+button.button.secondary-button,+a.button.secondary-button {+ background-color: #171B23;+ border-color: #38404F;+}++input[type="button"].secondary-button:hover,+button.button.secondary-button:hover,+a.button.secondary-button:hover {+ background-color: #1F2530;+ border-color: var(--main-color);+}++.theme-toggle {+ background-color: #1F2530;+ border-color: #38404F;+ color: #8B94A7;+}++.theme-toggle:hover {+ color: var(--main-color);+ border-color: var(--main-color);+}diff --git a/styles/login.css b/styles/login.cssindex f21a89b..2d91873 100644--- a/styles/login.css+++ b/styles/login.css@@ -2,11 +2,20 @@ body, html {font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;margin: 0;padding: 0;- background-color: #f5f5f5;- font-size: 14px;+ background-color: #F2F4F8;+ color: #1C2434;+ font-size: 18px;min-height: 100%;}+input,+button,+select,+textarea {+ font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;+ font-weight: 400;+}+.content {display: flex;flex-direction: column;@@ -18,18 +27,18 @@ body, html {}.container {- width: 400px;+ width: 500px;margin: auto;max-width: 100%;- padding: 20px;+ padding: 28px;background-color: #fff;- border-radius: 8px;- border: 1px solid #eee;- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);+ border-radius: 16px;+ border: 1px solid #E7EAF0;+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -18px rgba(15, 23, 42, 0.18);box-sizing: border-box;}-@media (max-width: 768px) {+@media (max-width: 899px) {.container {background-color: transparent;border: none;@@ -86,7 +95,7 @@ label {.form-group-inline label {font-weight: 300;- font-size: 13px;+ font-size: 14px;margin-bottom: 0px;margin-left: 8px;cursor: pointer;@@ -108,9 +117,34 @@ select {width: 100%;padding: 15px;font-size: 16px;- border: 1px solid #ccc;- border-radius: 8px;+ border: 1px solid #D7DCE5;+ border-radius: 10px;outline: none;+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;+}++select {+ cursor: pointer;+ appearance: none;+ -webkit-appearance: none;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ background-repeat: no-repeat;+ background-position: right 15px center;+ padding-right: 40px;+}++.rtl select {+ background-position: left 15px center;+ padding-right: 15px;+ padding-left: 40px;+}++input[type="text"]:focus,+input[type="email"]:focus,+input[type="password"]:focus,+select:focus {+ border-color: var(--main-color);+ box-shadow: 0 0 0 3px rgba(var(--main-color-rgb), 0.18);}input[type="submit"],@@ -119,23 +153,28 @@ a.button {width: 100%;padding: 15px;font-size: 16px;+ font-weight: 300;background-color: var(--main-color);color: #fff;- border: none;- border-radius: 8px;+ border: 1px solid var(--main-color);+ border-radius: 10px;cursor: pointer;+ box-sizing: border-box;+ box-shadow: 0 1px 2px rgba(var(--main-color-rgb), 0.25);+ transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;}a.button {text-decoration: none;display: inline-block;text-align: center;- box-sizing: border-box;}input[type="submit"]:hover,a.button:hover {background-color: var(--hover-color);+ border-color: var(--hover-color);+ box-shadow: 0 4px 10px -2px rgba(var(--main-color-rgb), 0.35);}input[type="button"].secondary-button,@@ -143,28 +182,102 @@ button.button.secondary-button,a.button.secondary-button {background-color: #FFFFFF;color: var(--main-color);- border: 2px solid var(--main-color);+ border-color: #D7DCE5;+ box-shadow: none;}input[type="button"].secondary-button:hover,button.button.secondary-button:hover,a.button.secondary-button:hover {- background-color: #EEEEEE;+ background-color: #F3F5F9;color: var(--hover-color);- border-color: var(--hover-color);+ border-color: var(--main-color);+ box-shadow: none;+}++.password-field {+ position: relative;+ flex-grow: 1;+ min-width: 0;+}++.password-field input {+ width: 100%;+ padding-inline-end: 48px;+ box-sizing: border-box;+}++.password-field .password-toggle {+ position: absolute;+ top: 50%;+ inset-inline-end: 6px;+ transform: translateY(-50%);+ border: none;+ background: transparent;+ color: #64748B;+ font-size: 16px;+ padding: 8px 10px;+ border-radius: 8px;+ cursor: pointer;+}++.password-field .password-toggle:hover {+ color: var(--main-color);}input[type="checkbox"] {+ opacity: 0;+ position: absolute;+}++input[type="checkbox"]+label {+ position: relative;+ padding-left: 54px;cursor: pointer;- width: 25px;- height: 25px;- padding: 0px;- margin: 0px;- background-color: #fff;+ display: inline-flex;+ align-items: center;+ margin-left: 0px;+ min-height: 26px;+}++input[type="checkbox"]+label::before {+ content: '';+ position: absolute;+ left: 0;+ top: 50%;+ transform: translateY(-50%);+ width: 44px;+ height: 24px;+ background-color: #e9e9eb;+ border-radius: 12px;+ transition: background-color 0.3s ease;border: 1px solid #ccc;- border-radius: 8px;- display: grid;- place-content: center;+}++input[type="checkbox"]+label::after {+ content: '';+ position: absolute;+ left: 3px;+ top: 50%;+ transform: translateY(-50%);+ width: 20px;+ height: 20px;+ background-color: #fff;+ border-radius: 50%;+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);+ transition: transform 0.3s ease;+}++input[type="checkbox"]:focus+label::before {+ box-shadow: 0 0 0 2px rgba(var(--main-color-rgb), 0.5);+}++input[type="checkbox"]:checked+label::before {+ background-color: var(--main-color);+}++input[type="checkbox"]:checked+label::after {+ transform: translate(20px, -50%);}.or-separator {@@ -182,27 +295,27 @@ input[type="checkbox"] {.error-box,.success-box {display: block;- color: #FFFFFF;- margin-bottom: 20px;- padding: 14px 14px 16px 14px;- border: 1px solid var(--error-color);- background-color: rgba(var(--error-color-rgb), 0.8);- border-radius: 8px;+ margin: 0px 0px 20px;+ padding: 14px 16px;+ background-color: rgba(var(--error-color-rgb), 0.08);+ color: var(--error-color);+ border-radius: 12px;}.success-box {- border: 1px solid var(--success-color);- background-color: rgba(var(--success-color-rgb), 0.5);+ background-color: rgba(var(--success-color-rgb), 0.1);+ color: var(--success-color);}.error-box li,.success-box li {list-style: none;- font-size: 15px;+ font-size: 14px;+ font-weight: 500;display: flex;- gap: 8px;+ gap: 10px;align-items: baseline;- margin-bottom: 5px;+ margin-bottom: 8px;}.error-box li:last-of-type,@@ -218,6 +331,16 @@ input[type="checkbox"] {.login-form-link {text-align: center;margin: 20px 0px;+ font-size: 16px;+}++.login-form-link span {+ margin-inline-end: 6px;+}++.login-form-link.account-switch {+ font-size: 18px;+ margin-top: 36px;}.login-form-link a {@@ -379,7 +502,6 @@ input[type="checkbox"] {.subscription-modal h3 {margin-top: 0;- border-bottom: 1px solid var(--main-color);padding-bottom: 15px;}@@ -405,4 +527,183 @@ input[type="checkbox"] {.subscription-modal .form-group {margin-top: 12px;}-/* RESTORE MODAL END */\ No newline at end of file+/* RESTORE MODAL END */++.auth-brand {+ display: none;+}++@media (min-width: 900px) {+ .content.auth-split {+ flex-direction: row;+ align-items: stretch;+ justify-content: flex-start;+ padding: 0;+ min-height: 100vh;+ }++ .auth-brand {+ display: flex;+ flex-direction: column;+ justify-content: space-between;+ box-sizing: border-box;+ flex: 0 0 44%;+ max-width: 640px;+ padding: 56px;+ background: linear-gradient(160deg, var(--hover-color) 0%, var(--main-color) 65%, var(--accent-color) 190%);+ color: #FFFFFF;+ position: relative;+ overflow: hidden;+ }++ .auth-brand::before,+ .auth-brand::after {+ content: "";+ position: absolute;+ border-radius: 50%;+ background: rgba(255, 255, 255, 0.07);+ }++ .auth-brand::before {+ width: 480px;+ height: 480px;+ right: -160px;+ top: -140px;+ }++ .auth-brand::after {+ width: 320px;+ height: 320px;+ left: -110px;+ bottom: 90px;+ background: rgba(255, 255, 255, 0.05);+ }++ .auth-brand>* {+ position: relative;+ z-index: 1;+ }++ .auth-brand-logo svg {+ width: 190px;+ height: 71px;+ }++ .auth-brand svg .main-color {+ fill: #FFFFFF;+ }++ .auth-brand svg .accent-color {+ fill: rgba(255, 255, 255, 0.65);+ }++ .auth-brand svg .text-color {+ fill: #FFFFFF;+ }++ .auth-brand-text h1 {+ margin: 0 0 14px;+ font-size: 36px;+ font-weight: 600;+ line-height: 1.15;+ text-wrap: balance;+ max-width: 14ch;+ }++ .auth-brand-text p {+ margin: 0;+ font-size: 16px;+ line-height: 1.55;+ max-width: 42ch;+ opacity: 0.85;+ }++ .auth-brand-footer {+ font-size: 13px;+ letter-spacing: 0.04em;+ opacity: 0.7;+ }++ .content.auth-split>.container {+ background-color: transparent;+ border: none;+ box-shadow: none;+ margin: auto;+ max-width: 500px;+ padding: 48px 40px;+ }++ .content.auth-split>.container.wide {+ max-width: 720px;+ }++ .content.auth-split .container>header .logo-image {+ display: none;+ }++ .content.auth-split .container>header {+ text-align: start;+ }++ .content.auth-split .container>header p {+ font-size: 26px;+ font-weight: 600;+ margin: 0 0 28px;+ line-height: 1.25;+ text-wrap: wrap;+ }++ /* Registration: two-column field grid on desktop */+ .registration-form {+ display: grid;+ grid-template-columns: 1fr 1fr;+ column-gap: 20px;+ align-items: start;+ }++ .registration-form>* {+ grid-column: 1 / -1;+ min-width: 0;+ }++ .registration-form .form-group:has(#firstname),+ .registration-form .form-group:has(#lastname),+ .registration-form .form-group:has(#password),+ .registration-form .form-group:has(#confirm_password),+ .registration-form .form-group:has(#currency),+ .registration-form .form-group:has(#language) {+ grid-column: auto / span 1;+ }+}++/* Theme toggle (auth pages) */+.theme-toggle {+ position: fixed;+ top: 16px;+ right: 16px;+ z-index: 50;+ width: 42px;+ height: 42px;+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 0;+ border-radius: 50%;+ border: 1px solid #D7DCE5;+ background-color: #FFFFFF;+ color: #64748B;+ font-size: 16px;+ cursor: pointer;+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);+ transition: color .15s ease-in-out, border-color .15s ease-in-out;+}++.theme-toggle:hover {+ color: var(--main-color);+ border-color: var(--main-color);+}++.rtl .theme-toggle {+ right: auto;+ left: 16px;+}diff --git a/styles/styles.css b/styles/styles.cssindex 6acbdbb..ef59003 100644--- a/styles/styles.css+++ b/styles/styles.css@@ -1,3153 +1,4157 @@-:root {- --logo-flex-basis: 17%;-}--body {- font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;- margin: 0;- padding: 0;- background-color: var(--background-color);- color: var(--text-color);-}--body.no-scroll {- overflow-y: hidden;-}--@media (max-width: 768px) {- .mobile-navigation main {- margin-bottom: 70px;- }-}--input,-button,-select,-textarea {- font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;- font-weight: 400;-}--button.hidden,-input.hidden {- display: none;-}--@media (max-width: 768px) {- body.no-scroll section.contain {- display: none;- }-}--a:hover>i {- color: var(--hover-color);-}--h2,-h3 {- font-weight: 500;-}--.contain {- width: 100%;- max-width: 970px;- margin: 0px auto;- box-sizing: border-box;-}--.error-box {- padding: 20px 16px;- background-color: rgba(var(--error-color-rgb), 0.3);- border: 1px solid var(--error-color);- border-radius: 8px;- margin-bottom: 20px;- font-size: 16px;-}--.error-box .error-message i {- color: var(--error-color);- margin-right: 10px;-}--.split-header {- display: flex;- flex-direction: row;- align-items: center;- justify-content: space-between;- margin-bottom: 10px;-}--.split-header h2 {- margin-right: 20px;- display: flex;-}--.split-header>h2 .header-subtitle {- font-size: 22px;- font-weight: 400;- color: #666666;- margin-left: 10px;-}--@media (max-width: 768px) {- .contain.settings {- padding: 20px 0px;- }-- .split-header>h2 .header-subtitle {- margin-left: 0px;- font-size: 18px;- }-}--body>header {- border-bottom: 7px solid var(--main-color);- background-color: var(--header-background-color);-}--body>header>.contain {- display: flex;- justify-content: space-between;- align-items: center;- padding: 10px 20px;-}--header .logo .logo-image {- height: 50px;- width: 134px;- margin-right: 10px;-}--header .logo .logo-image svg {- height: 50px;- width: 134px;-}--.button-icon {- width: 16px;- height: 16px;-}--.dropdown {- position: relative;- display: inline-block;-}--.dropbtn:after {- content: " \25BC";-}--@media (max-width: 768px) {- .mobile-navigation .dropbtn:after {- content: "";- display: none;- }-}--.dropbtn {- display: flex;- flex-direction: row;- align-items: center;- gap: 8px;- background-color: transparent;- color: var(--text-color);- padding: 7px 12px;- font-size: 16px;- border: none;- cursor: pointer;- -webkit-tap-highlight-color: transparent;- -moz-tap-highlight-color: transparent;- -ms-tap-highlight-color: transparent;-}--.dropbtn>img {- width: 35px;- height: 35px;- object-fit: cover;-}--.dropdown-content {- display: none;- position: absolute;- right: 0px;- background-color: var(--header-background-color);- border: 1px solid var(--box-border-color);- min-width: 130px;- box-shadow: var(--box-shadow);- z-index: 5;- width: max-content;- border-top: none;- border-radius: 8px;-}--.dropdown-content a {- color: var(--text-color);- padding: 14px 18px;- text-decoration: none;- display: flex;- flex-direction: row;- gap: 12px;- align-items: center;-}--.dropdown-content a:hover {- background-color: #f9f9f9;-}--.dropdown:hover .dropdown-content {- display: block;-}--.dropdown-content a>svg {- width: 20px;- height: 20px;-}--@media (max-width: 768px) {- .dropdown:hover .dropdown-content {- display: none;- }-- .dropdown.is-open .dropdown-content {- display: block !important;- }-}--main>.contain {- display: flex;- flex-direction: column;- padding: 20px;-}--@media (max-width: 768px) {- .main>.contain {- padding: 0px 10px;- }-}--.main-actions {- margin: 0px 0px 20px 0px;- display: flex;- flex-direction: row;- justify-content: space-between;- gap: 16px;- flex-wrap: wrap;- position: relative;-}--.main-actions.hidden {- display: none;-}--@media (max-width: 768px) {- .main-actions {- justify-content: space-between;- flex-direction: column-reverse;- }-}--.button {- display: flex;- flex-direction: row;- gap: 8px;- align-items: center;- font-weight: 500;- text-align: center;- vertical-align: middle;- justify-content: center;- cursor: pointer;- user-select: none;- color: #fff;- border: 1px solid var(--main-color);- background-color: var(--main-color);- padding: 15px 30px;- font-size: 1rem;- border-radius: 8px;- transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;- text-decoration: none;-}--.button:hover {- background-color: var(--hover-color);- border-color: var(--hover-color);-}--.button.thin {- padding: 14px 20px;-}--.button.tiny,-.button-secondary.tiny {- padding: 7px 14px;- font-size: 12px;-}--.button.icon-button,-.button-secondary.icon-button {- padding: 15px;-}--button:hover svg .main-color {- fill: var(--hover-color);-}--.actions li:hover svg .main-color {- fill: var(--hover-color);-}--.image-button:hover svg .main-color {- fill: var(--hover-color);-}--.top-actions {- display: flex;- flex-direction: row;- gap: 16px;- align-items: center;- width: auto;-}--.top-actions .search {- flex-grow: 1;-}--.top-actions .search>input[type="text"] {- padding-right: 40px;-}--.top-actions>.search>.search-icon,-.top-actions>.search>.clear-search {- float: right;- right: 15px;- margin-top: -35px;- position: relative;- z-index: 2;- color: var(--main-color);- font-size: 20px;-}--.top-actions>.search>.clear-search {- display: none;- cursor: pointer;-}--.top-actions>.search.has-text>.search-icon {- display: none;-}--.top-actions>.search.has-text>.clear-search {- display: block;-}--.rtl .top-actions>.search>.search-icon,-.rtl .top-actions>.search>.clear-search {- float: left;- right: -15px;-}--.subscriptions {- display: flex;- flex-direction: column;- gap: 15px;- justify-content: center;- font-size: 17px;-}--.subscription-container {- position: relative;- background-color: var(--box-background-color);- box-shadow: var(--box-shadow);- border-radius: 16px;-}--.subscription-container>.mobile-actions {- display: flex;- flex-direction: row;- position: absolute;- right: 0px;- top: 0px;- height: 100%;- overflow: hidden;- border-top-right-radius: 16px;- border-bottom-right-radius: 16px;-}--.subscription-container>.mobile-actions>button {- display: flex;- flex-direction: column;- align-items: center;- padding: 10px;- border: none;- cursor: pointer;- height: 100%;- width: 60px;- justify-content: center;- color: #f1f1f1;-}--button.mobile-action-edit {- background-color: #ffbf15;- /* #f3e22d; */-}--button.mobile-action-delete {- background-color: #f45a40;-}--button.mobile-action-clone {- background-color: #2da7f3-}--button.mobile-action-renew {- background-color: #188823;-}--.subscription-container>.mobile-actions>button>svg {- width: 25px;- height: 25px;- min-height: 25px;-}--.subscription {- display: flex;- flex-direction: column;- height: auto;- justify-content: flex-start;- gap: 12px;- background-color: var(--box-background-color);- box-shadow: var(--box-shadow);- padding: 12px 15px;- border-radius: 16px;- cursor: pointer;- position: relative;- transition: transform 0.2s;- box-sizing: border-box;- justify-content: center;-}--.subscription-container.hide {- display: none;-}--.subscription-container>.subscription-progress-container {- position: absolute;- bottom: 0px;- left: 8px;- right: 8px;- height: 3px;- z-index: 1;-}--.subscription-container>.subscription-progress-container>.subscription-progress {- height: 3px;- background-color: var(--accent-color);- display: block;- position: absolute;-}--.subscription.inactive {- background-color: var(--box-background-color);- color: rgba(100, 100, 100, 0.6);- box-shadow: 0 2px 5px rgba(100, 100, 100, 0.1);-}--.subscription.inactive span.price {- text-decoration: line-through;-}--.subscription.inactive .payment_method img {- opacity: 0.4;-}--.subscription-main {- display: flex;- flex-direction: row;- align-items: center;- gap: 12px;- position: relative;- min-height: 40px;-}--.subscription-main .actions-expand {- font-size: 21px;- padding: 8px 16px;- color: var(--main-color);- background-color: transparent;- border: none;- cursor: pointer;-}--.subscription-main .actions-expand:hover {- color: var(--hover-color);-}--.subscription-main .actions {- display: none;- position: absolute;- right: -16px;- top: 60px;- z-index: 2;- flex-direction: column;- color: var(--text-color);- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- box-shadow: var(--box-shadow);- border-radius: 16px;- padding: 0px;- margin: 0px;-}--.rtl .subscription-main .actions {- left: -16px;- right: auto;-}--.subscription-main .actions.is-open {- display: flex;-}--.subscription-main .actions.open-above {- top: auto;- bottom: 100%;-}--.subscription-main .actions>li {- display: flex;- align-items: center;- justify-content: flex-start;- padding: 14px 35px 14px 18px;- gap: 12px;- cursor: pointer;- border-bottom: 1px solid var(--box-border-color);-}--.rtl .subscription-main .actions>li {- padding: 14px 18px 14px 35px;-}--.subscription-main .actions>li:hover {- background-color: #f9f9f9;-}--.subscription-main .actions>li.delete:hover {- background-color: #fff5f5;-}--.subscription-main .actions>li.delete:hover>i {- color: #e53e3e;-}--.subscription-main .actions>li>i {- color: var(--main-color);- font-size: 16px;- width: 20px;- text-align: center;-}--.subscription-main .actions>li:hover>i {- color: var(--hover-color);-}--.subscription-secondary {- display: none;- flex-direction: row;- align-items: center;- gap: 12px;- padding: 6px 5px;- overflow: hidden;-}--.subscription-notes {- display: none;- flex-direction: row;- align-items: center;- padding: 6px 5px;- overflow: hidden;-}--.subscription-main .actions svg {- width: 32px;- height: 32px;-}--.subscription-secondary i,-.subscription-notes i {- font-size: 19px;- color: var(--main-color);- width: 20px;- text-align: center;-}--.subscription-main>span,-.subscription-secondary>span {- display: flex;- align-items: center;- justify-content: center;- text-align: center;- box-sizing: border-box;- margin: 0px;-}--.subscription .logo {- flex-basis: var(--logo-flex-basis);-}--.subscription .logo img {- width: 100%;- height: 100%;- max-height: 42px;- object-fit: contain;- min-width: 32px;-}--.subscription .logo svg {- max-width: 100%;- height: 42px;-}--.subscription .name {- flex-basis: 25%;- font-weight: 600;-}--.subscription .cycle {- flex-basis: 16%;- flex-grow: 1;- flex-direction: row;- align-items: center;-}--.subscription .cycle>svg {- width: 15px;- height: 15px;- margin-right: 3px;- margin-top: 2px;-}--.subscription .next {- flex-basis: 16%;- flex-grow: 1;- text-transform: capitalize;-}--.subscription .payment_method {- margin-left: 10px;- display: flex;- justify-content: center;- align-items: center;-}--.subscription .payment_method img {- width: 44px;- height: 30px;- aspect-ratio: 3 / 2;- object-fit: contain;-}--.rtl .subscription .payment_method img {- margin-right: 10px;- margin-left: 0px;--}--.subscription .price {- flex-basis: 8%;- justify-content: center;- flex-direction: row;-}--.subscription .price .original_price {- font-size: 14px;- color: #888;-}--.subscription .actions {- flex-basis: auto;-}--.subscription .actions img {- width: 25px;- height: 25px;- cursor: pointer;-}--.subscription-secondary>.name {- display: none;- justify-content: flex-start;- flex-basis: 33%;-}--.subscription-secondary>span {- justify-content: flex-start;- flex-basis: 33%;- gap: 10px;-}--.subscription-secondary>.url {- flex-basis: 20px;- margin-left: auto;- cursor: pointer;-}--.rtl .subscription-secondary>.url {- margin-left: 0px;- margin-right: auto;-}--.subscription-notes>span {- display: flex;- align-items: center;- font-size: 14px;- gap: 10px;-}--@media (max-width: 768px) {-- .subscription-main>.hideOnMobile {- display: none;- }-- .subscription-main>.name {- flex-basis: var(--logo-flex-basis);- font-size: 14px;- font-weight: normal;- max-height: 38px;- overflow: hidden;- align-items: baseline;- }-- .subscription-secondary>.name {- display: flex;- }-- .subscription-secondary>span {- flex-grow: 1;- flex-shrink: 1;- font-size: 14px;- }-}--@media (max-width: 375px) {- .subscription-main>.cycle {- display: none;- }-}--.subscription.is-open .subscription-secondary,-.subscription.is-open .subscription-notes {- display: flex;-}--.subscription-secondary img,-.subscription-notes img {- height: 20px;-}--.subscription-secondary .url img {- margin-right: 0px;- ;-}--.empty-page,-.no-matching-subscriptions {- display: block;- max-width: 90%;- margin: auto;- text-align: center;- font-size: 20px;-}--.empty-page>img,-.no-matching-subscriptions>img {- max-width: 100%;-}--.no-matching-subscriptions>img {- margin-top: 30px;-}--.empty-page>p {- margin: 5px 0px 40px 0px;-}--.no-matching-subscriptions>p {- margin: 30px 0px 40px 0px;-}--.empty-page>button,-.no-matching-subscriptions>button {- margin: 0px auto;-}--.account-section {- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- padding: 20px;- box-shadow: var(--box-shadow);- border-radius: 16px;-}--.account-section header h2 {- margin-top: 0px;- margin-bottom: 34px;-}--.account-section header h2.second-header {- margin-top: 34px;-}--.account-section+.account-section {- margin-top: 34px;-}--.account-section .account-settings-list {- display: flex;- flex-direction: column;- gap: 16px;-}--.account-section .account-settings-list .form-group-inline {- margin-bottom: 0px;-}--.account-section .account-settings-list h3 {- margin: 0px;-}--.account-section .account-settings-theme h3 {- margin-bottom: 24px;-}--.user-form {- display: flex;- flex-direction: column;-}--.user-form .fields {- display: flex;- flex-direction: row;- gap: 34px;-}--@media (max-width: 768px) {- .user-form .fields {- flex-direction: column;- align-items: center;- gap: 20px;- }-- .grow {- width: 100%;- }-}--header #avatar {- border-radius: 50%;-}--.user-form .user-avatar {- position: relative;-}--.user-form .user-avatar>img {- cursor: pointer;- width: 80px;- height: 80px;- object-fit: cover;- max-width: 80px;- border-radius: 50%;- border: 1px solid #ccc;- box-sizing: border-box;-}--.user-form .user-avatar .edit-avatar {- display: none;- align-items: center;- justify-content: center;- width: 80px;- height: 80px;- position: absolute;- top: 0px;- left: 0px;- background-color: rgba(0, 0, 0, 0.6);- border-radius: 39px;- cursor: pointer;- color: #FFFFFF;- font-size: 30px;-}--.user-form .user-avatar:hover>.edit-avatar {- display: flex;-}--@media (max-width: 768px) {- .user-form .user-avatar:hover>.edit-avatar {- display: none;- }-}--.avatar-select {- display: none;- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- position: absolute;- padding: 20px;- box-sizing: border-box;- width: 336px;- max-width: 100%;- box-shadow: var(--box-shadow);- z-index: 3;-}--.avatar-option {- border-radius: 50%;-}--@media (max-width: 768px) {- .avatar-select {- left: 50%;- transform: translateX(-50%);- }-}--.avatar-select.is-open {- display: block;-}--.avatar-select .avatar-list {- display: flex;- gap: 18px;- flex-wrap: wrap;-}--.avatar-select .avatar-list>img,-.avatar-select .avatar-list .avatar-container>img {- width: 60px;- height: 60px;- object-fit: cover;- cursor: pointer;- border: 1px solid #ccc;- box-sizing: border-box-}--.avatar-select .avatar-list>img:hover,-.avatar-select .avatar-list .avatar-container>img:hover {- border: 1px solid #222;-}--.avatar-select .avatar-list .avatar-container {- position: relative;- height: 60px;-}--.avatar-select label.add-avatar {- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- width: 60px;- height: 60px;- border: 1px solid var(--main-color);- border-radius: 50%;- cursor: pointer;- margin: 0px;- box-sizing: border-box;- color: var(--main-color);-}--.avatar-select label.add-avatar:hover {- border-color: var(--accent-color);- color: var(--accent-color);-}--.avatar-select .avatar-list .remove-avatar {- position: absolute;- top: -4px;- right: -11px;- background-color: var(--box-background-color);- border-radius: 50%;- cursor: pointer;- display: flex;- font-weight: 600;- align-items: center;- justify-content: center;- border: 1px solid #ccc;- width: 25px;- height: 25px;- box-sizing: border-box;- font-size: 8px;-}--.avatar-select .avatar-list .remove-avatar:hover {- background-color: #eee;-}--.user-form .fields .grow {- flex: 1;-}--.user-form .buttons,-.account-members .buttons,-.account-currencies .buttons,-.account-fixer .buttons,-.account-ai-settings .buttons,-.account-categories .buttons,-.account-notifications .buttons,-.admin-form .buttons,-.account-2fa .buttons {- display: flex;- justify-content: flex-end;- align-items: center;- gap: 20px;-}--.account-2fa .buttons {- justify-content: flex-start;-}--.admin-form hr {- margin: 20px 0px;- color: var(--main-color);- border-color: var(--main-color);- background-color: var(--main-color);-}--.account-notifications-section {- border: 1px solid #ccc;- border-radius: 8px;- margin-bottom: 10px;- overflow: hidden;-}--.account-notification-section-header {- padding: 16px;- cursor: pointer;-}--.account-notification-section-header:hover {- background-color: #EEE;-}--.account-notification-section-header h3 {- margin: 0px;-}--.account-notification-section-header h3 i {- margin-right: 10px;-}--.account-notification-section-settings {- max-height: 0px;- overflow: hidden;- /* Hide content that goes beyond the height */- transition: max-height 0.3s ease-in-out;- /* Animate max-height changes */- padding: 0px 16px;-}--.account-notification-section-settings.is-open {- max-height: 1500px;- /* Set to a value larger than the content's natural height */-}--.account-notification-section-settings>div:first-of-type {- margin-top: 20px;-}--.account-notification-section-settings>div:last-of-type {- margin-bottom: 20px;-}--.account-notifications .buttons {- gap: 15px;-}--.image-button {- box-sizing: border-box;- border: none;- background: transparent;- cursor: pointer;- padding: 0px;-}--.image-button>i {- color: var(--main-color);- font-size: 18px;- padding: 2px;-}--.image-button:hover>i {- color: var(--hover-color);-}--.image-button.disabled>i {- opacity: 0.35;- cursor: not-allowed;-}--.image-button>svg {- width: 32px;- height: 32px;-}--.image-button.disabled>img,-.image-button.disabled>svg {- -webkit-filter: grayscale(100%);- filter: grayscale(100%);-}--.image-button.success>img {- filter: hue-rotate(262deg);-}--.image-button.error>img {- filter: hue-rotate(141deg);-}--.image-button.small>img {- width: 25px;- height: 25px;- object-fit: contain;-}--.image-button.medium>img {- width: 32px;- height: 32px;- object-fit: contain;-}--#logo-search-button>i,-#icon-search-button>i {- font-size: 26px;-}--.payments-list {- display: flex;- flex-wrap: wrap;- gap: 16px;-}--.payments-list .payments-payment {- cursor: pointer;- display: flex;- flex-direction: row;- align-items: center;- gap: 8px;- background-color: var(--accent-color);- padding: 6px 12px;- border-radius: 8px;- transition: filter 300ms;-}--.payments-list .payments-payment[data-enabled="0"] {- filter: grayscale(100%);-}--.payments-list .payments-payment[data-in-use="yes"] {- cursor: not-allowed;-}--.payments-list .payments-payment .drag-icon {- height: 20px;- width: 14px;- font-size: 14px;-}--.payments-list .payments-payment>img {- width: 32px;- height: 32px;- object-fit: contain;-}--.payments-list .payments-payment>.payment-name {- cursor: text;-}--.payments-list .payments-payment .delete-payment-method {- padding: 5px;- font-weight: bold;- color: var(--text-color);-}--.credits-list {- display: flex;- flex-direction: column;- gap: 16px;- line-break: anywhere;-}--.credits-list>div {- margin: 0px;- font-size: 18px;- display: flex;- flex-direction: column;-}--.updates-list>div {- margin: 0px;-}--.credits-list>div>h3 {- margin: 2px 0px 0px 0px;- font-size: 20px;-}--.credits-list>div>h3>i {- color: var(--accent-color);- font-size: 18px;-}--.settings-notes {- margin-bottom: 1.5em;-}--.settings-notes>p {- margin-bottom: 0px;-}--.credits-list>div>span,-.updates-list>p>span,-.settings-notes>p>span {- color: #AAA;- font-size: 14px;-}--.credits-list>div>span,-.updates-list>p>span {- font-size: 16px;-}--.credits-list>div>span>a,-.updates-list>p>span>a,-.settings-notes>p>span>a {- margin-left: 5px;- font-size: 13px;- color: var(--accent-color);-}--.rtl .credits-list>div>span>a,-.rtl .updates-list>p>span>a,-.rtl .settings-notes>p>span>a {- margin-left: 0px;- margin-right: 5px;-}--.credits-list>div>span>a:visited,-.updates-list>p>span>a:visited,-.settings-notes>p>span>a:visited {- color: var(--accent-color);-}--.settings-notes>p>i,-.account-section .notes>p>i {- color: var(--main-color);- margin-right: 5px;-}--.rtl .settings-notes>p>i,-.rtl .account-section .notes>p>i {- margin-right: 0px;- margin-left: 5px;-}--.form-group {- margin-bottom: 20px;-}--.form-group-inline {- display: flex;- flex-direction: row;- align-items: center;- margin-bottom: 20px;- gap: 15px;- box-sizing: border-box;-}--.form-group .inline {- display: flex;- flex-direction: row;- align-items: center;- gap: 15px;- justify-content: space-between;-}--.form-group .inline .split33 {- flex-basis: 33.34%;-}--.form-group .inline .split66 {- flex-basis: 66.66%;-}--.form-group .inline .split50 {- flex-basis: 50%;- display: flex;- flex-direction: column;-}--.form-group.hide,-.form-group-inline.hide {- display: none;-}--.height50 {- height: 50px;-}--.inline-row {- display: flex;- flex-direction: row;- flex-wrap: wrap;- gap: 15px;- margin-bottom: 20px;-}--@media (max-width: 768px) {- .form-group .inline .mobile-split-50 {- flex-basis: 50%;- }-- select#frequency {- width: 100px;- padding: 0px 10px;- }-}--label {- display: block;- margin-bottom: 5px;-}--.form-group-inline label {- font-size: 16px;- margin-bottom: 0px;- margin-left: 0px;- cursor: pointer;-}--label.split-label {- display: flex;- flex-direction: row;- justify-content: space-between;-}--input {- box-sizing: border-box;-}--input[type="text"],-input[type="email"],-input[type="password"],-input[type="date"],-input[type="number"],-select {- width: 100%;- padding: 0px 15px;- height: 50px;- font-size: 16px;- background-color: var(--input-background-color);- border: 1px solid var(--input-border-color);- border-radius: 8px;- outline: none;- color: var(--text-color);- box-sizing: border-box;-}--input[type="color"] {- height: 46px;- width: 46px;- background-color: #222;- border: 1px solid var(--hover-color);- outline: none;- box-sizing: border-box;- cursor: pointer;- font-size: 16px;- position: relative;- border-radius: 5px;-}--.one-third {- max-width: 33%;-}--select {- cursor: pointer;- height: 50px;-}--.date-wrapper {- display: flex;- flex-grow: 0;- flex-direction: row;- flex-basis: 100%;- box-sizing: border-box;-}--input[type="date"] {- display: flex;- flex-grow: 1;- flex-direction: row;- align-items: center;- flex-basis: 100%;- box-sizing: border-box;-}--input[type="text"].short {- flex-basis: 55px;- min-width: 55px;- text-align: center;-}--input[type="submit"],-input[type="button"],-button.button {- padding: 15px 30px;- font-size: 16px;- background-color: var(--main-color);- color: var(--text-color-inverted);- border: none;- border-radius: 8px;- cursor: pointer;- box-sizing: border-box;- border: 2px solid var(--main-color);-}--input[type="submit"].thin,-input[type="button"].thin,-button.button.thin {- padding: 13px 30px;-}--input[type="button"].secondary-button,-button.button.secondary-button {- background-color: #FFFFFF;- color: var(--main-color);-}--input[type="button"].secondary-button:hover,-button.button.secondary-button:hover {- background-color: #EEEEEE;- color: var(--hover-color);- border-color: var(--hover-color);-}--input[type="button"].warning-button {- background-color: #f45a40;- border-color: #f45a40;-}--input[type="button"].warning-button:hover,-button.button.warning-button:hover {- background-color: #ef8674;- border-color: #ef8674;-}--input[type="submit"]:hover,-input[type="button"]:hover,-button.button:hover {- background-color: var(--hover-color);- border-color: var(--hover-color);-}--input[type="submit"]:disabled,-input[type="button"]:disabled,-button.button:disabled {- background-color: #ccc;- border-color: #ccc;-}--input[type="button"].left button.button.left {- margin-right: auto;-}--input[type="checkbox"] {- cursor: pointer;- width: 25px;- height: 25px;- padding: 0px;- margin: 0px;- background-color: var(--input-background-color);- border: 1px solid var(--input-border-color);- border-radius: 8px;- display: grid;- place-content: center;-}--button.disabled {- cursor: not-allowed;-}--input[type="text"]:disabled,-input[type="password"]:disabled,-input[type="email"]:disabled {- background-color: var(--input-disabled-background-color);- border-color: var(--input-disabled-border-color);- cursor: not-allowed;-}--textarea {- font-size: 16px;- background-color: var(--input-background-color);- border: 1px solid var(--input-border-color);- border-radius: 8px;- padding: 5px 14px;- color: var(--text-color);- width: 100%;- height: 245px;-}--textarea:focus {- outline: none;-}--textarea.thin {- height: 80px;-}--@media (max-width: 768px) {- input[type="checkbox"] {- width: 20px;- height: 20px;- flex-shrink: 0;- }-}--.form-icon-search {- position: relative;-}--.logo-search,-.icon-search {- position: absolute;- width: 165px;- height: 298px;- top: 130px;- right: 32px;- overflow-y: auto;- overflow-x: hidden;- padding: 10px;- border: 1px solid var(--box-border-color);- border-radius: 8px;- box-shadow: var(--box-shadow);- background-color: var(--box-background-color);- box-sizing: border-box;- z-index: 1;- display: none;-}--.icon-search {- width: 156px;- height: 224px;- top: 50px;- right: 0px;-}--.logo-search.is-open,-.icon-search.is-open {- display: block;-}--.logo-search>header,-.icon-search>header {- padding: 0px 5px 5px;- border-bottom: 1px solid #CCC;- display: flex;- flex-direction: row;- justify-content: space-between;- margin-bottom: 10px;-}--.icon-search>header>span {- margin-left: auto;-}--.logo-search .close-logo-search,-.icon-search .close-icon-search {- cursor: pointer;-}--.logo-search img,-.icon-search img {- max-width: 100%;- cursor: pointer;- border-bottom: 1px solid #ccc;- padding: 10px 0px;-}--.icon-search img {- padding: 8px 0px;- aspect-ratio: 16 / 5;- object-fit: contain;-}--.logo-search img:last-of-type,-.icon-search img:last-of-type {- border-bottom: none;- padding-bottom: 0px;-}--.capitalize {- text-transform: capitalize;-}--button.dark-theme-button {- display: flex;- flex-direction: row;- align-items: center;- justify-content: center;- font-size: 18px !important;- border: 1px solid #ccc;- border-radius: 8px;- padding: 16px 20px 14px;- background-color: transparent;- color: var(--text-color);- cursor: pointer;- flex-grow: 1;-}--button.dark-theme-button:hover {- background-color: #EEE;-}--button.dark-theme-button.selected {- border: 1px solid var(--main-color);-}--button.dark-theme-button i {- margin-right: 12px;-}--.error {- display: block;- color: #f45a40;-}--.success {- display: block;- color: #188823;-}--.user-error,-.user-success {- display: none;-}--.user-error.show,-.user-success.show {- display: block;-}--.subscription-form,-.subscription-modal {- background-color: var(--box-background-color);- padding: 22px;- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- box-sizing: border-box;- position: fixed;- left: 50%;- top: 50%;- transform: translateX(-50%) translateY(-50%);- z-index: 3;- max-width: 800px;- max-height: calc(100vh - 34px);- overflow: auto;- overflow-y: auto;- width: 90%;- display: none;-}--.subscription-form.is-open,-.subscription-modal.is-open {- display: block;-}--.subscription-form h3,-.subscription-modal h3 {- border-bottom: 1px solid var(--main-color);- padding-bottom: 15px;- margin-top: 0px;-}--.subscription-form .buttons {- display: flex;- flex-direction: row;- flex-wrap: wrap;- justify-content: flex-end;- gap: 16px;-}--@media (max-width: 768px) {-- .subscription-form,- .subscription-modal {- width: 100%;- max-height: 100vh;- }-- .subscription-form .buttons input {- flex: 1;- }-}--.logo-preview {- padding: 2px 0px;- height: 49px;- box-sizing: border-box;- aspect-ratio: 3.55/1;- display: block;- cursor: pointer;- overflow: hidden;-}--.logo-preview:after {- content: "Upload Logo";- display: flex;- justify-content: center;- align-items: center;- height: 100%;- color: var(--main-color);- font-size: 16px;- text-align: center;-}--.logo-preview:hover::after,-.icon-preview:hover::after {- color: var(--hover-color);-}--.logo-preview img {- width: 100%;- height: 100%;- object-fit: contain;- display: none;-}--.icon-preview {- padding: 2px 0px;- height: 49px;- box-sizing: border-box;- aspect-ratio: 3/2;- display: block;- cursor: pointer;- overflow: hidden;- flex-shrink: 0;-}--.icon-preview:after {- content: "\f093";- font-family: "Font Awesome 6 Free";- font-weight: 900;- display: flex;- justify-content: center;- align-items: center;- height: 100%;- color: var(--main-color);- font-size: 22px;- text-align: center;-}--.icon-preview img {- width: 100%;- height: 100%;- object-fit: contain;- display: none;-}--.hidden-input {- display: none;-}--.close-form {- display: block;- position: absolute;- top: 15px;- right: 15px;- padding: 10px;- font-size: 20px;- cursor: pointer;- color: gray;-}--.rtl .close-form {- right: auto;- left: 15px;-}--.sort-container {- position: relative;-}--.sort-options {- position: absolute;- color: var(--text-color);- font-size: 16px;- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 8px;- box-shadow: 0 2px 5px rgba(163, 100, 100, 0.1);- box-sizing: border-box;- top: 52px;- right: 0px;- display: none;- width: 144px;- width: max-content;- z-index: 2;-}--.rtl .sort-options {- left: 0px;- right: auto;-}--@media (max-width: 380px) {- .sort-container {- flex-grow: 1;- max-width: 144px;- }-}--.sort-options.is-open {- display: block;-}--.sort-options>ul {- padding: 0px;- margin: 0px;-}--.sort-options>ul>li {- position: relative;- list-style: none;- padding: 14px 35px 14px 18px;- border-bottom: 1px solid #DDD;- cursor: pointer;-}--.rtl .sort-options>ul>li {- padding: 14px 18px 14px 35px;-}--.sort-options>ul>li:last-of-type {- border-bottom: none;-}--.sort-options>ul>li:hover {- background-color: #EEE;-}--.sort-options>ul>li.selected::after {- content: "";- position: absolute;- right: 10px;- top: 50%;- transform: translateY(-50%);- width: 16px;- height: 16px;- background-color: var(--main-color);- -webkit-mask: url("../images/siteicons/svg/check.php") no-repeat center;- mask: url("../images/siteicons/svg/check.php") no-repeat center;- background-size: 100% 100%;-}--.rtl .sort-options>ul>li.selected {- background-position: center left 10px;-}--.subscription-list-title {- font-size: 18px;- padding: 4px;- font-weight: 500;-}---/* TOAST MESSAGE */--.toast {- position: fixed;- bottom: 25px;- right: 30px;- border-radius: 12px;- border: 1px solid var(--box-border-color);- background-color: var(--box-background-color);- padding: 20px 35px 20px 25px;- box-shadow: 0 6px 20px -5px rgba(0, 0, 0, 0.1);- overflow: hidden;- transform: translateX(calc(100% + 30px));- transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.35);- box-sizing: border-box;- z-index: 5;-}--@media (max-width: 768px) {- .toast {- bottom: 0px;- right: 0px;- left: 0px;- width: 100%;- }-- .mobile-navigation .toast {- bottom: 70px;- }-}--.toast.active {- transform: translateX(0%);-}--.toast .toast-content {- display: flex;- align-items: center;-}--.toast-content .toast-icon {- display: flex;- align-items: center;- justify-content: center;- height: 35px;- min-width: 35px;- color: #fff;- font-size: 20px;- border-radius: 50%;-}--.toast-content .toast-icon.error {- background-color: var(--error-color);-}--.toast-content .toast-icon.success {- background-color: var(--success-color);-}---.toast-content .message {- display: flex;- flex-direction: column;- margin: 0 20px;-}--.toast-content .message .text {- font-size: 16px;- font-weight: 400;- color: #666666;-}--.toast-content .message .text.text-1 {- font-weight: 600;- color: #333;-}--.toast .close {- position: absolute;- top: 10px;- right: 15px;- padding: 5px;- cursor: pointer;- opacity: 0.7;-}--.toast .close:hover {- opacity: 1;-}--.toast .progress {- position: absolute;- bottom: 0;- left: 0;- height: 3px;- width: 100%;--}--.toast .progress:before {- content: "";- position: absolute;- bottom: 0;- right: 0;- height: 100%;- width: 100%;-}--.toast .progress.error:before {- background-color: var(--error-color);-}--.toast .progress.success:before {- background-color: var(--success-color);-}--.progress.active:before {- animation: progress 5s linear forwards;-}--@keyframes progress {- 100% {- right: 100%;- }-}--/* TOAST END */--.statistics {- display: flex;- flex-direction: row;- flex-wrap: wrap;- gap: 20px;- justify-content: flex-start;-}--.statistic {- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- padding: 20px 24px 30px;- display: flex;- flex-direction: column;- align-items: center;- flex-basis: calc(33.333% - (20px * 2 / 3));- flex-shrink: 0;- box-sizing: border-box;- flex-grow: 0;- overflow: hidden;-}--.statistic.short {- padding-bottom: 15px;-}--.statistic.empty {- background-color: transparent;- border: none;- box-shadow: none;-}--@media (max-width: 768px) {- .statistic {- flex-basis: 100%;- }-- .statistic.empty {- display: none;- }-}--.statistic>span {- font-size: 42px;- color: var(--main-color);-}--.statistic>.title {- margin-top: 5px;- text-align: center;-}--.statistic>.subtitle {- font-size: 25px;- color: var(--accent-color);- margin-top: 10px;- text-align: center;-}--.statistic>.subtitle>img {- width: 100px;- max-height: 40px;- object-fit: contain;-}--.graphs {- display: flex;- flex-direction: row;- flex-wrap: wrap;- gap: 20px;- justify-content: space-between;-}--.graph {- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- flex-basis: 48%;- align-items: center;- justify-content: center;- display: flex;- flex-direction: column;- padding: 20px 10px;- box-sizing: border-box;-}--.graph>header {- font-size: 18px;- font-weight: 500;- margin-bottom: 15px;- text-align: center;-}--.graph>header>.sub-header {- font-size: 13px;- font-weight: normal;-}--.graph.x2 {- flex-basis: 100%;-}--@media (max-width: 768px) {- .graph {- flex-basis: 100%;- max-width: 100%;- }-}--/* Settings sort category */--.sortable-list {- margin: 0px;- padding: 0px;- -webkit-touch-callout: none;- -webkit-user-select: none;- -khtml-user-select: none;- -moz-user-select: none;- -ms-user-select: none;- user-select: none;-}--.drag-icon {- width: 28px;- height: 50px;- cursor: grab;- display: flex;- align-items: center;- justify-content: center;- font-size: 20px;-}--.sortable-list .sortable-ghost {- border-radius: 8px;- background-color: rgba(var(--accent-color-rgb), 0.6);- border: 1px solid var(--accent-color);- padding: 5px;-}--/* Fitler dropdown */--.filtermenu {- position: relative;- display: inline-block;-}--.filtermenu-content {- display: none;- position: absolute;- left: auto;- right: 0;- width: 220px;- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 8px;- box-shadow: var(--box-shadow);- z-index: 3;- overflow: hidden;- margin-top: 6px;-}--.rtl .filtermenu-content {- left: 0;- right: auto;--}--@media (max-width: 354px) {- .on-dashboard .filtermenu-content {- right: -94px;- }-}--.filtermenu-content.is-open {- display: block;-}--.filtermenu-content .filter-title {- padding: 14px 18px;- text-decoration: none;- display: block;- cursor: pointer;- font-weight: 500;- border-bottom: 1px solid #DDD;- user-select: none;-}--.filtermenu-content .filtermenu-submenu.hide {- display: none;-}--.filtermenu-content .filtermenu-submenu:last-of-type .filter-title {- border-bottom: none;-}--.filtermenu-content .filtermenu-submenu:last-of-type .filter-item:first-of-type {- border-top: 1px solid #DDD;-}--.filtermenu-content .filtermenu-submenu:last-of-type .filter-item:last-of-type {- border-bottom: none;-}--.filtermenu-content .filter-item {- position: relative;- padding: 14px 24px;- text-decoration: none;- display: block;- cursor: pointer;- border-bottom: 1px solid #DDD;- user-select: none;- font-size: 16px;-}--.filtermenu-content .filter-item.selected::after {- content: "";- position: absolute;- right: 10px;- top: 50%;- transform: translateY(-50%);- width: 16px;- /* Explicitly set the size */- height: 16px;- /* Explicitly set the size */- background-color: var(--main-color);- /* Set your desired color here */- -webkit-mask: url("../images/siteicons/svg/check.php") no-repeat center;- mask: url("../images/siteicons/svg/check.php") no-repeat center;- background-size: 100% 100%;- /* Ensure the icon scales correctly */-}--.rtl .filtermenu-content .filter-item.selected {- background-position: center left 10px;-}--.filtermenu-content .filter-title.filter-clear {- color: var(--hover-color);- font-weight: normal;- border-bottom: none;-}--.filtermenu-content .filter-title.filter-clear>i {- margin-right: 8px;-}--.rtl .filtermenu-content .filter-title.filter-clear>i {- margin-left: 8px;- margin-right: 0px;-}--.filtermenu-content .filter-item:hover,-.filtermenu-content .filter-title:hover {- background-color: #f1f1f1;-}--.filtermenu-submenu-content {- display: none;-}--.filtermenu-submenu-content.is-open {- display: block;-}--/* Theme Selector */--.theme {- flex-grow: 1;-}--.theme-preview {- cursor: pointer;- border: 1px solid #ccc;- border-radius: 8px;- padding: 20px 15px 20px 10px;- display: flex;- gap: 15px;- flex-direction: row;- align-items: center;-}--.theme-preview.is-selected {- border: 1px solid var(--main-color);-}--.theme-preview:hover {- background-color: rgba(var(--accent-color-rgb), 0.6);-}--.theme-preview .main-color,-.theme-preview .accent-color,-.theme-preview .hover-color {- display: inline-block;- width: 24px;- height: 24px;- border: 1px solid #FFF;- box-sizing: border-box;-}--.theme-preview.blue .main-color {- background-color: #007bff;-}--.theme-preview.blue .accent-color {- background-color: #8fbffa;-}--.theme-preview.blue .hover-color {- background-color: #0056b3;-}--.theme-preview.green .main-color {- background-color: #6B8E23;-}--.theme-preview.green .accent-color {- background-color: #9ACD32;-}--.theme-preview.green .hover-color {- background-color: #556B2F;-}--.theme-preview.red .main-color {- background-color: #f45a40;-}--.theme-preview.red .accent-color {- background-color: #f79988;-}--.theme-preview.red .hover-color {- background-color: #c73f29;-}--.theme-preview.yellow .main-color {- background-color: #ffae00;-}--.theme-preview.yellow .accent-color {- background-color: #faea8f;-}--.theme-preview.yellow .hover-color {- background-color: #cd930c;-}--.theme-preview.purple .main-color {- background-color: #6d4aff;-}--.theme-preview.purple .accent-color {- background-color: #b086ff;-}--.theme-preview.purple .hover-color {- background-color: #5e42cd;-}--.custom-colors {- display: flex;- flex-direction: row;- gap: 12px;-}--.color-picker {- flex-shrink: 0;-}--.color-picker::before {- color: var(--hover-color);- position: absolute;- top: -5px;- right: -5px;- border: 1px solid;- border-radius: 15px;- background-color: var(--box-background-color);- padding: 4px;-}--.color-picker-button:hover label {- color: var(--hover-color);-}--.wrap {- flex-wrap: wrap;-}--.user-list {- display: flex;- flex-direction: column;- flex-wrap: wrap;- justify-content: space-between;-}--.user-list>div {- display: flex;- flex-direction: row;- flex-grow: 1;- flex-wrap: wrap;- align-items: center;-}--.user-list .user-list-row {- display: flex;- flex-direction: row;- flex-grow: 1;-}--@media (max-width: 768px) {- .user-list .user-list-row {- flex-direction: column;- }-}--.user-list .user-list-row:last-of-type {- flex-grow: 0;-}--.user-list .user-list-row>div {- display: flex;- flex-basis: 50%;- gap: 12px;- align-items: center;-}--.user-list a {- color: var(--main-color);- text-decoration: none;-}--.user-list a:hover {- color: var(--hover-color);-}--.user-list .user-list-icon {- width: 22px;- text-align: center;- font-size: 16px;- color: var(--main-color);-}--.calendar-nav {- display: flex;- flex-direction: row;- align-items: center;- gap: 16px;- font-size: 18px;-}--.calendar-nav .month {- text-align: center;-}--.calendar {- display: flex;- flex-direction: column;- width: 100%;- background-color: var(--box-background-color);- border-collapse: collapse;- border-radius: 16px;- box-shadow: var(--box-shadow);- box-sizing: border-box;-}--.calendar .calendar-header,-.calendar .calendar-row {- display: flex;-}--.calendar .calendar-header {- border-bottom: 6px solid var(--main-color);-}--.calendar .calendar-row:last-of-type {- border-bottom: none;-}--.calendar .calendar-cell {- display: flex;- flex: 0 0 14.2857%;- flex-direction: column;- gap: 5px;- overflow: hidden;-}--.calendar .calendar-header .calendar-cell {- padding: 26px 0px;- font-size: 16px;- font-weight: 500;- text-align: center;- box-sizing: border-box;- min-height: 45px;-}--@media (max-width: 768px) {- .calendar .calendar-header .calendar-cell {- font-size: 12px;- }-}--.calendar .calendar-body .calendar-cell {- font-size: 13px;- text-align: center;- box-sizing: border-box;- min-height: 92px;- border-right: 1px solid var(--box-border-color);-}--.calendar .calendar-body .calendar-cell:last-of-type {- border-right: none;-}--.calendar .calendar-body .calendar-cell .calendar-cell-header {- background-color: #EEE;- padding: 5px 0px;-}--.calendar .calendar-body .calendar-cell .calendar-cell-content {- padding: 6px 0px;- display: flex;- flex-direction: column;- gap: 6px;- box-sizing: border-box;- padding: 0px 6px;-}--@media (max-width: 768px) {- .calendar .calendar-body .calendar-cell .calendar-cell-content {- padding: 0px 1px;- }-}--.calendar .calendar-subscription-title {- border: 1px solid var(--main-color);- border-radius: 8px;- padding: 4px 2px;- cursor: pointer;- box-sizing: border-box;- white-space: normal;- overflow-wrap: break-word;- word-wrap: break-word;- user-select: none;-}--.calendar .day {- font-size: 14px;-}--.calendar .today .day {- color: var(--main-color);- font-weight: 700;-}--.over-budget {- background-color: rgba(var(--error-color-rgb), 0.2);- border: 1px solid var(--error-color);- border-radius: 8px;- padding: 10px;- margin-top: 20px;- text-align: center;- font-size: 16px;-}--.over-budget>i {- color: var(--error-color);-}--.subscription-modal {- max-width: 400px;-}--.subscription-modal .modal-header {- position: relative;-}--.subscription-modal .close-modal {- position: absolute;- top: -5px;- right: -5px;- padding: 5px;- font-size: 20px;- cursor: pointer;-}--.subscription-modal img {- max-width: 135px;-}--.grow {- flex-grow: 1;-}--@media (max-width: 768px) {- .mobile-grow {- flex-grow: 1;- }-- .mobile-reverse {- flex-direction: column-reverse;- }-- .mobile-grow-force {- flex-grow: 1;- width: 100%;- }--}--.bold {- font-weight: 700;-}--/* Checkbox */-input[type="checkbox"] {- opacity: 0;- position: absolute;-}--input[type="checkbox"]+label {- position: relative;- padding-left: 54px;- cursor: pointer;- display: inline-flex;- align-items: center;-}--input[type="checkbox"]+label::before {- content: '';- position: absolute;- left: 0;- top: 50%;- transform: translateY(-50%);- width: 44px;- height: 24px;- background-color: #e9e9eb;- border-radius: 12px;- transition: background-color 0.3s ease;- border: 1px solid #ccc;-}--input[type="checkbox"]+label::after {- content: '';- position: absolute;- left: 3px;- top: 50%;- transform: translateY(-50%);- width: 20px;- height: 20px;- background-color: #fff;- border-radius: 50%;- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);- transition: transform 0.3s ease;-}--input[type="checkbox"]:focus+label::before {- box-shadow: 0 0 0 2px rgba(var(--main-color-rgb, 100, 149, 237), 0.5);-}--input[type="checkbox"]:disabled+label::before {- background-color: #d3d3d3;-}--input[type="checkbox"]:disabled+label::after {- background-color: #f0f0f0;-}--input[type="checkbox"]:checked+label::before {- background-color: var(--main-color);-}--input[type="checkbox"]:checked+label::after {- transform: translate(20px, -50%);-}--input[type="checkbox"]:focus+label::after {- outline: 2px solid rgba(var(--main-color-rgb, 100, 149, 237), 0.5);-}--/* Radio */-input[type="radio"] {- opacity: 0;- position: absolute;-}--input[type="radio"]+label {- position: relative;- padding-left: 35px;- cursor: pointer;- display: flex;- line-height: 22px;-}--input[type="radio"]+label::before {- content: '';- position: absolute;- left: 0;- top: 0;- width: 24px;- height: 24px;- background: #fafafa;- border: 1px solid #ccc;- border-radius: 50%;- box-sizing: border-box;-}--input[type="radio"]:focus+label::before {- border-color: var(--main-color);- box-shadow: 0 0 0 2px rgba(var(--main-color-rgb), 0.5);-}--input[type="radio"]:disabled+label::before {- background-color: #F5F5F5;- border-color: #F5F5F5;- cursor: not-allowed;-}--input[type="radio"]:checked+label::after {- content: '';- position: absolute;- left: 5px;- top: 5px;- width: 14px;- height: 14px;- background: var(--main-color);- border-radius: 50%;- box-sizing: border-box;-}--.theme input[type="radio"]+label {- padding-left: 44px;-}--.theme input[type="radio"]+label::before {- left: 11px;- top: 20px;-}--.theme input[type="radio"]:checked+label::after {- left: 16px;- top: 25px;-}--.update-banner {- padding: 15px 20px;- background-color: var(--accent-color);- border: 1px solid var(--main-color);- border-radius: 12px;- margin-bottom: 20px;- text-align: center;- color: var(--text-color);-}--.update-banner>span {- font-weight: 500;-}--.update-banner>span>a {- color: var(--text-color);- text-decoration: underline;-}--.demo-banner {- padding: 15px 20px;- background-color: rgba(var(--error-color-rgb), 0.2);- border: 1px solid #f45a40;- border-radius: 12px;- margin-bottom: 20px;- text-align: center;-}--.totp-popup {- display: none;- position: fixed;- width: 380px;- max-width: 90%;- top: 50%;- left: 50%;- transform: translate(-50%, -50%);- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- box-sizing: border-box;- padding: 20px;- flex-direction: column;- gap: 20px;- z-index: 2;-}--.totp-popup h3,-.totp-popup h4 {- margin: 4px 0px;- text-align: center;-}--.totp-popup.is-open {- display: flex;-}--.totp-popup-content {- display: flex;- flex-direction: column;- gap: 20px;- align-items: center;- margin-top: 20px;-}--.totp-setup {- display: flex;- flex-direction: column;- align-items: center;-}--.totp-setup.hide {- display: none;-}--.totp-qrcode-container {- padding: 14px;- border: 1px solid #333;- border-radius: 8px;-}--.totp-backup-codes {- background-color: #EEE;- border: 2px dashed #ccc;- border-radius: 8px;- padding: 10px;- display: flex;- flex-direction: row;- flex-wrap: wrap;- gap: 10px 18px;- justify-content: space-evenly;-}--.totp-backup-codes li {- list-style: none;- padding: 5px 10px;- font-weight: 500;-}--.mobile-nav {- display: none;-}--.mobile-nav-image {- width: 100%;- max-width: 440px;- margin-top: 15px;- background-image: url("../images/siteimages/mobilenav.png");- background-size: contain;- background-position: center;- background-repeat: no-repeat;- aspect-ratio: 16/9;-}--.button.export-ical {- padding: 0px;- width: 30px;- height: 30px;- margin-left: 10px;- color: white;-}--@media (max-width: 768px) {- .mobile-nav {- position: fixed;- bottom: 0px;- width: 100%;- background-color: var(--box-background-color);- border-top: 1px solid var(--box-border-color);- display: flex;- flex-direction: row;- justify-content: space-around;- z-index: 2;- padding: 7px 0px;- box-shadow: var(--negative-box-shadow);- box-sizing: border-box;- align-items: center;- }-- .mobile-nav>a {- flex-grow: 1;- flex-shrink: 0;- text-align: center;- padding: 5px 0px 10px 0px;- color: #AAA;- font-size: 10px;- text-decoration: none;-- display: flex;- flex-direction: column;- align-items: center;- }-- .mobile-nav>a>svg {- width: 30px;- height: 30px;- max-width: 85%;- }-- .mobile-nav>a.active {- color: #202020;- }-- .mobile-navigation .mobileNavigationHideOnMobile {- display: none !important;- }-}--.button.autofill-next-payment {- padding: 15px 15px !important;- margin-top: 22px;-}--.autofill-next-payment {- color: var(--main-color);- cursor: pointer;-}--.autofill-next-payment.hideOnDesktop {- display: none;-}--@media (max-width: 768px) {- .button.autofill-next-payment.hideOnMobile {- display: none !important;- }--- .autofill-next-payment.hideOnDesktop {- display: block;- }-}--.dashboard h1 {- margin: 0px;-}---.dashboard-subscriptions-container {- overflow-x: auto;- overflow-y: hidden;- max-width: 100%;- padding-bottom: 10px;-}--.dashboard-subscriptions-list {- display: flex;- flex-direction: row;- gap: 10px;- min-width: fit-content;- /* prevent collapsing */-}--.dashboard-subscriptions-list>.subscription-item {- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- padding: 20px;- width: 155px;- height: 145px;- flex: 0 0 auto;- /* prevent flex resizing */- box-sizing: border-box;- display: flex;- flex-direction: column;- justify-content: space-between;-}--.dashboard-subscriptions-list>.subscription-item.thin {- height: 115px;-}--.dashboard-subscriptions-list>.subscription-item .subscription-item-title {- font-size: 19px;- font-weight: 500;- margin: 0px;- display: -webkit-box;- -webkit-line-clamp: 2; /* maximum number of lines */- line-clamp: 2;- -webkit-box-orient: vertical;- overflow: hidden;- text-overflow: ellipsis;-}--.dashboard-subscriptions-list>.subscription-item.thin .subscription-item-title {- font-size: 16px;-}--.dashboard-subscriptions-list>.subscription-item .subscription-item-logo {- max-width: 100%;- height: 42px;- object-fit: contain;-}--.dashboard-subscriptions-list>.subscription-item .subscription-item-date {- font-size: 16px;- margin: 0px;-}--.dashboard-subscriptions-list>.subscription-item .subscription-item-price {- font-size: 18px;- font-weight: 600;- margin: 0px;-}--.dashboard-subscriptions-list>.subscription-item .subscription-item-value {- font-size: 24px;- font-weight: 600;- margin: 0px;-}--.dashboard-subscriptions-list>.subscription-item.thin .subscription-item-value {- font-size: 20px;;-}--.ai-recommendations-container {- width: 100%;- box-sizing: border-box;-}--.ai-recommendations-list {- list-style: none;- padding: 0;- margin: 0;- display: flex;- flex-direction: column;- gap: 16px;-}--.ai-recommendation-item {- background-color: var(--box-background-color);- border: 1px solid var(--box-border-color);- border-radius: 16px;- box-shadow: var(--box-shadow);- padding: 18px 20px;- width: 100%;- box-sizing: border-box;- display: flex;- flex-direction: column;- gap: 8px;- margin: 0;- cursor: pointer;-}--.ai-recommendation-item .ai-recommendation-header h3 {- font-size: 18px;- font-weight: 600;- margin: 0px;- line-height: 1.2;-}--.ai-recommendation-item .ai-recommendation-header {- display: flex;- flex-direction: row;- align-items: center;- justify-content: space-between;- gap: 8px;-}--.ai-recommendation-item .ai-recommendation-header .item-arrow-down {- color: var(--main-color);-}--.ai-recommendation-item.expanded .ai-recommendation-header .item-arrow-down {- transform: rotate(180deg);-}--.ai-recommendation-item .ai-recommendation-header h3 > span {- color: var(--main-color);-}--.ai-recommendation-item p {- display: none;- font-size: 15px;- margin: 0 0 4px 0;- line-height: 1.5;- margin-top: 8px;-}--.ai-recommendation-item.expanded p {- display: block;-}--.ai-recommendation-item p:last-child {- font-size: 16px;- font-weight: 600;- color: var(--accent-color);-}--.ai-recommendation-item p.ai-recommendation-savings {- justify-content: space-between;-}--.ai-recommendation-item p.ai-recommendation-savings a {- color: var(--main-color);- text-decoration: none;-}--.ai-recommendation-item.expanded p.ai-recommendation-savings {- display: flex;-}--.flex {- display: flex;-}--.info-badge {- background-color: orange;- border-radius: 5px;- font-size: 10px;- padding: 2px 6px;- color: #FFFFFF;- margin-bottom: auto;- margin-left: 10px;-}--.spinner {- width: 38px;- height: 38px;- border: 4px solid rgba(0, 0, 0, 0.1);- border-left-color: var(--main-color);- border-radius: 50%;- animation: spin 1s linear infinite;- margin: auto;-}--.spinner.ai-spinner {- margin: 0px 0px 0px auto;-}--.spinner.hidden {- display: none;-}--@keyframes spin {- to {- transform: rotate(360deg);- }-}--@media (max-width: 768px) {- .spinner.ai-spinner {- margin: auto;- }-}--.dashboard-subscriptions-container {- scrollbar-width: none;- -ms-overflow-style: none;-}--.dashboard-subscriptions-container::-webkit-scrollbar {- display: none;-}\ No newline at end of file+:root {+ --logo-flex-basis: 17%;+}++body {+ font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;+ margin: 0;+ padding: 0;+ background-color: var(--background-color);+ color: var(--text-color);+}++body.no-scroll {+ overflow-y: hidden;+}++@media (max-width: 768px) {+ .mobile-navigation main {+ margin-bottom: 70px;+ }+}++input,+button,+select,+textarea {+ font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;+ font-weight: 400;+}++button.hidden,+input.hidden {+ display: none;+}++@media (max-width: 768px) {+ body.no-scroll section.contain {+ display: none;+ }+}++a:hover>i {+ color: var(--hover-color);+}++:focus-visible {+ outline: 2px solid rgba(var(--main-color-rgb), 0.6);+ outline-offset: 2px;+}++input:focus-visible,+select:focus-visible,+textarea:focus-visible {+ outline: none;+}++h2,+h3 {+ font-weight: 500;+}++.contain {+ width: 100%;+ max-width: 970px;+ margin: 0px auto;+ box-sizing: border-box;+}++.error-box {+ padding: 14px 16px;+ background-color: rgba(var(--error-color-rgb), 0.08);+ color: var(--error-color);+ border-radius: 12px;+ margin-bottom: 20px;+ font-size: 14px;+ font-weight: 500;+}++.error-box .error-message i {+ margin-right: 10px;+ font-size: 16px;+}++.rtl .error-box .error-message i {+ margin-right: 0px;+ margin-left: 10px;+}++.split-header {+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: space-between;+ margin-bottom: 10px;+}++.split-header h2 {+ margin-right: 20px;+ display: flex;+}++.split-header>h2 .header-subtitle {+ font-size: 22px;+ font-weight: 400;+ color: #666666;+ margin-left: 10px;+}++@media (max-width: 768px) {+ .contain.settings {+ padding: 20px 0px;+ }++ .split-header>h2 .header-subtitle {+ margin-left: 0px;+ font-size: 18px;+ }+}++body>header {+ position: sticky;+ top: 0;+ z-index: 10;+ border-bottom: 1px solid var(--box-border-color);+ background-color: rgba(var(--header-background-color-rgb), 0.85);+ -webkit-backdrop-filter: blur(12px) saturate(160%);+ backdrop-filter: blur(12px) saturate(160%);+}++body>header>.contain {+ display: flex;+ justify-content: space-between;+ align-items: center;+ padding: 10px 20px;+}++header .logo .logo-image {+ height: 50px;+ width: 134px;+ margin-right: 10px;+}++header .logo .logo-image svg {+ height: 50px;+ width: 134px;+}++.button-icon {+ width: 16px;+ height: 16px;+}++.dropdown {+ position: relative;+ display: inline-block;+}++.dropbtn:after {+ content: " \25BC";+}++@media (max-width: 768px) {+ .mobile-navigation .dropbtn:after {+ content: "";+ display: none;+ }+}++.dropbtn {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 8px;+ background-color: transparent;+ color: var(--text-color);+ padding: 7px 12px;+ font-size: 16px;+ border: none;+ cursor: pointer;+ -webkit-tap-highlight-color: transparent;+ -moz-tap-highlight-color: transparent;+ -ms-tap-highlight-color: transparent;+}++.dropbtn>img {+ width: 35px;+ height: 35px;+ object-fit: cover;+}++.dropdown-content {+ display: none;+ position: absolute;+ right: 0px;+ background-color: var(--header-background-color);+ border: 1px solid var(--box-border-color);+ min-width: 130px;+ box-shadow: var(--shadow-pop);+ z-index: 5;+ width: max-content;+ border-radius: 12px;+ overflow: hidden;+}++.dropdown-content a {+ color: var(--text-color);+ padding: 14px 18px;+ text-decoration: none;+ display: flex;+ flex-direction: row;+ gap: 12px;+ align-items: center;+}++.dropdown-content a:hover {+ background-color: var(--surface-hover);+}++.dropdown:hover .dropdown-content {+ display: block;+}++.dropdown-content a>svg {+ width: 20px;+ height: 20px;+}++@media (max-width: 768px) {+ .dropdown {+ position: static;+ }++ .dropdown:hover .dropdown-content {+ display: none;+ }++ .dropdown.is-open .dropdown-content {+ display: block !important;+ }++ .dropdown-content {+ top: 100%;+ left: 0;+ right: 0;+ width: auto;+ min-width: 0;+ border-radius: 0px 0px 12px 12px;+ border-top: none;+ max-height: calc(100vh - 70px);+ overflow-y: auto;+ }+}++main>.contain {+ display: flex;+ flex-direction: column;+ padding: 20px;+}++@media (max-width: 768px) {+ .main>.contain {+ padding: 0px 10px;+ }+}++.main-actions {+ margin: 0px 0px 20px 0px;+ display: flex;+ flex-direction: row;+ justify-content: space-between;+ gap: 16px;+ flex-wrap: wrap;+ position: relative;+}++.main-actions.hidden {+ display: none;+}++@media (max-width: 768px) {+ .main-actions {+ justify-content: space-between;+ flex-direction: column-reverse;+ }+}++.button {+ display: flex;+ flex-direction: row;+ gap: 8px;+ align-items: center;+ font-weight: 500;+ text-align: center;+ vertical-align: middle;+ justify-content: center;+ cursor: pointer;+ user-select: none;+ color: #fff;+ border: 1px solid var(--main-color);+ background-color: var(--main-color);+ height: 50px;+ padding: 0px 26px;+ box-sizing: border-box;+ font-size: 1rem;+ border-radius: 10px;+ box-shadow: 0 1px 2px rgba(var(--main-color-rgb), 0.25);+ transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;+ text-decoration: none;+}++.button:hover {+ background-color: var(--hover-color);+ border-color: var(--hover-color);+ box-shadow: 0 4px 10px -2px rgba(var(--main-color-rgb), 0.35);+}++.button.thin {+ padding: 0px 20px;+}++.button.tiny,+.button-secondary.tiny {+ height: auto;+ padding: 7px 14px;+ font-size: 12px;+}++.button.icon-button,+.button-secondary.icon-button {+ padding: 0px 15px;+}++.password-field {+ position: relative;+ flex-grow: 1;+ min-width: 0;+}++.password-field:has(>input.hidden) {+ display: none;+}++.password-field input {+ width: 100%;+ padding-inline-end: 48px;+ box-sizing: border-box;+}++.password-field .password-toggle {+ position: absolute;+ top: 50%;+ inset-inline-end: 6px;+ transform: translateY(-50%);+ border: none;+ background: transparent;+ color: var(--text-muted);+ font-size: 16px;+ padding: 8px 10px;+ border-radius: 8px;+ cursor: pointer;+}++.password-field .password-toggle:hover {+ color: var(--main-color);+}++button:hover svg .main-color {+ fill: var(--hover-color);+}++.actions li:hover svg .main-color {+ fill: var(--hover-color);+}++.image-button:hover svg .main-color {+ fill: var(--hover-color);+}++.top-actions {+ display: flex;+ flex-direction: row;+ gap: 16px;+ align-items: center;+ width: auto;+}++.top-actions .search {+ flex-grow: 1;+}++.top-actions .search>input[type="text"] {+ padding-right: 40px;+}++.top-actions>.search>.search-icon,+.top-actions>.search>.clear-search {+ float: right;+ right: 15px;+ margin-top: -35px;+ position: relative;+ z-index: 2;+ color: var(--main-color);+ font-size: 20px;+}++.top-actions>.search>.clear-search {+ display: none;+ cursor: pointer;+}++.top-actions>.search.has-text>.search-icon {+ display: none;+}++.top-actions>.search.has-text>.clear-search {+ display: block;+}++.rtl .top-actions>.search>.search-icon,+.rtl .top-actions>.search>.clear-search {+ float: left;+ right: -15px;+}++.top-actions .mobile-search-toggle {+ display: none;+}++@media (max-width: 768px) {+ .top-actions {+ justify-content: space-between;+ position: relative;+ }++ .top-actions .mobile-search-toggle {+ display: flex;+ }++ .top-actions .search {+ position: absolute;+ inset-block: 0;+ inset-inline-start: 0;+ width: 0;+ opacity: 0;+ overflow: hidden;+ pointer-events: none;+ z-index: 5;+ flex-grow: 0;+ transition: width .25s ease-in-out, opacity .15s ease-in-out;+ }++ .top-actions .search.mobile-expanded {+ width: 100%;+ opacity: 1;+ pointer-events: auto;+ }++ .top-actions .search.mobile-expanded>input[type="text"] {+ height: 100%;+ }++ .top-actions .search.mobile-expanded>.search-icon {+ display: none;+ }++ .top-actions .search.mobile-expanded>.clear-search {+ display: block;+ }++ .split-header {+ position: relative;+ }++ .top-actions .filtermenu,+ .top-actions .sort-container,+ .split-header .filtermenu {+ position: static;+ }++ .top-actions .filtermenu .filtermenu-content,+ .top-actions .sort-container .sort-options,+ .split-header .filtermenu .filtermenu-content {+ left: 0;+ right: 0;+ width: auto;+ max-height: 60vh;+ overflow-y: auto;+ }++ .top-actions .sort-container .sort-options {+ top: auto;+ margin-top: 6px;+ }+}++.subscriptions {+ display: flex;+ flex-direction: column;+ gap: 15px;+ justify-content: center;+ font-size: 17px;+}++.subscription-container {+ position: relative;+ background-color: var(--box-background-color);+ box-shadow: var(--box-shadow);+ border-radius: 16px;+}++.subscription-container>.mobile-actions {+ display: flex;+ flex-direction: row;+ position: absolute;+ right: 0px;+ top: 0px;+ height: 100%;+ overflow: hidden;+ border-top-right-radius: 16px;+ border-bottom-right-radius: 16px;+}++.subscription-container>.mobile-actions>button {+ display: flex;+ flex-direction: column;+ align-items: center;+ padding: 10px;+ border: none;+ cursor: pointer;+ height: 100%;+ width: 60px;+ justify-content: center;+ color: #f1f1f1;+}++button.mobile-action-edit {+ background-color: #ffbf15;+ /* #f3e22d; */+}++button.mobile-action-delete {+ background-color: #f45a40;+}++button.mobile-action-clone {+ background-color: #2da7f3+}++button.mobile-action-renew {+ background-color: #188823;+}++.subscription-container>.mobile-actions>button>svg {+ width: 25px;+ height: 25px;+ min-height: 25px;+}++.subscription {+ display: flex;+ flex-direction: column;+ height: auto;+ justify-content: flex-start;+ gap: 12px;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ box-shadow: var(--box-shadow);+ padding: 12px 15px;+ border-radius: 16px;+ cursor: pointer;+ position: relative;+ transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;+ box-sizing: border-box;+ justify-content: center;+}++.subscription:hover {+ border-color: rgba(var(--main-color-rgb), 0.35);+}++.subscription-container.hide {+ display: none;+}++.subscription-container>.subscription-progress-container {+ position: absolute;+ bottom: 0px;+ left: 8px;+ right: 8px;+ height: 3px;+ z-index: 1;+}++.subscription-container>.subscription-progress-container>.subscription-progress {+ height: 3px;+ background-color: var(--accent-color);+ display: block;+ position: absolute;+}++.subscription.inactive {+ background-color: var(--box-background-color);+ color: rgba(100, 100, 100, 0.6);+ box-shadow: 0 2px 5px rgba(100, 100, 100, 0.1);+}++.subscription.inactive span.price {+ text-decoration: line-through;+}++.subscription.inactive .payment_method img {+ opacity: 0.4;+}++.subscription-main {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 12px;+ position: relative;+ min-height: 40px;+}++.subscription-main .actions-expand {+ font-size: 21px;+ padding: 8px 16px;+ color: var(--main-color);+ background-color: transparent;+ border: none;+ cursor: pointer;+}++.subscription-main .actions-expand:hover {+ color: var(--hover-color);+}++.subscription-main .actions {+ display: none;+ position: absolute;+ right: -16px;+ top: 60px;+ z-index: 2;+ flex-direction: column;+ color: var(--text-color);+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ box-shadow: var(--shadow-pop);+ border-radius: 12px;+ padding: 0px;+ margin: 0px;+ overflow: hidden;+}++.rtl .subscription-main .actions {+ left: -16px;+ right: auto;+}++.subscription-main .actions.is-open {+ display: flex;+}++.subscription-main .actions.open-above {+ top: auto;+ bottom: 100%;+}++.subscription-main .actions>li {+ display: flex;+ align-items: center;+ justify-content: flex-start;+ padding: 14px 35px 14px 18px;+ gap: 12px;+ cursor: pointer;+ border-bottom: 1px solid var(--box-border-color);+}++.rtl .subscription-main .actions>li {+ padding: 14px 18px 14px 35px;+}++.subscription-main .actions>li:hover {+ background-color: var(--surface-hover);+}++.subscription-main .actions>li.delete:hover {+ background-color: rgba(var(--error-color-rgb), 0.12);+}++.subscription-main .actions>li.delete:hover>i {+ color: var(--error-color);+}++.subscription-main .actions>li>i {+ color: var(--main-color);+ font-size: 16px;+ width: 20px;+ text-align: center;+}++.subscription-main .actions>li:hover>i {+ color: var(--hover-color);+}++.subscription-main .actions svg {+ width: 32px;+ height: 32px;+}++.subscription-main>span {+ display: flex;+ align-items: center;+ justify-content: center;+ text-align: center;+ box-sizing: border-box;+ margin: 0px;+}++.subscription .logo {+ flex-basis: var(--logo-flex-basis);+}++.subscription .logo img {+ width: 100%;+ height: 100%;+ max-height: 42px;+ object-fit: contain;+ min-width: 32px;+}++.subscription .logo svg {+ max-width: 100%;+ height: 42px;+}++.subscription .name {+ flex-basis: 25%;+ font-weight: 600;+}++.subscription .cycle {+ flex-basis: 16%;+ flex-grow: 1;+ flex-direction: row;+ align-items: center;+}++.subscription .cycle>svg {+ width: 15px;+ height: 15px;+ margin-right: 3px;+ margin-top: 2px;+}++.subscription .next {+ flex-basis: 16%;+ flex-grow: 1;+ text-transform: capitalize;+}++.subscription .payment_method {+ margin-left: 10px;+ display: flex;+ justify-content: center;+ align-items: center;+}++.subscription .payment_method img {+ width: 44px;+ height: 30px;+ aspect-ratio: 3 / 2;+ object-fit: contain;+}++.rtl .subscription .payment_method img {+ margin-right: 10px;+ margin-left: 0px;++}++.subscription .price {+ flex-basis: 8%;+ justify-content: center;+ flex-direction: row;+}++.subscription .price .original_price {+ font-size: 14px;+ color: var(--text-muted);+}++.subscription .actions {+ flex-basis: auto;+}++.subscription .actions img {+ width: 25px;+ height: 25px;+ cursor: pointer;+}++@media (max-width: 768px) {++ .subscription-main>.hideOnMobile {+ display: none;+ }++ .subscription-main>.name {+ flex-basis: var(--logo-flex-basis);+ font-size: 14px;+ font-weight: normal;+ max-height: 38px;+ overflow: hidden;+ align-items: baseline;+ }+}++@media (max-width: 375px) {+ .subscription-main>.cycle {+ display: none;+ }+}++.empty-page,+.no-matching-subscriptions {+ display: block;+ max-width: 90%;+ margin: auto;+ text-align: center;+ font-size: 20px;+}++.empty-page>img,+.no-matching-subscriptions>img {+ max-width: 100%;+}++.no-matching-subscriptions>img {+ margin-top: 30px;+}++.empty-page>p {+ margin: 5px 0px 40px 0px;+}++.no-matching-subscriptions>p {+ margin: 30px 0px 40px 0px;+}++.empty-page>button,+.no-matching-subscriptions>button {+ margin: 0px auto;+}++.account-section {+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ padding: 20px;+ box-shadow: var(--box-shadow);+ border-radius: 16px;+}++.account-section header h2 {+ margin-top: 0px;+ margin-bottom: 34px;+}++.account-section header h2.second-header {+ margin-top: 34px;+}++.account-section+.account-section {+ margin-top: 34px;+}++.account-section .account-settings-list {+ display: flex;+ flex-direction: column;+ gap: 16px;+}++.account-section .account-settings-list .form-group-inline {+ margin-bottom: 0px;+}++.account-section .account-settings-list h3 {+ margin: 0px;+}++.account-section .account-settings-theme h3 {+ margin-bottom: 24px;+}++.user-form {+ display: flex;+ flex-direction: column;+}++.user-form .fields {+ display: flex;+ flex-direction: row;+ gap: 34px;+}++@media (max-width: 768px) {+ .user-form .fields {+ flex-direction: column;+ align-items: center;+ gap: 20px;+ }++ .grow {+ width: 100%;+ }+}++header #avatar {+ border-radius: 50%;+}++.user-form .user-avatar {+ position: relative;+}++.user-form .user-avatar>img {+ cursor: pointer;+ width: 80px;+ height: 80px;+ object-fit: cover;+ max-width: 80px;+ border-radius: 50%;+ border: 1px solid #ccc;+ box-sizing: border-box;+}++.user-form .user-avatar .edit-avatar {+ display: none;+ align-items: center;+ justify-content: center;+ width: 80px;+ height: 80px;+ position: absolute;+ top: 0px;+ left: 0px;+ background-color: rgba(0, 0, 0, 0.6);+ border-radius: 39px;+ cursor: pointer;+ color: #FFFFFF;+ font-size: 30px;+}++.user-form .user-avatar:hover>.edit-avatar {+ display: flex;+}++@media (max-width: 768px) {+ .user-form .user-avatar:hover>.edit-avatar {+ display: none;+ }+}++.avatar-select {+ display: none;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ position: absolute;+ padding: 20px;+ box-sizing: border-box;+ width: 336px;+ max-width: 100%;+ box-shadow: var(--box-shadow);+ z-index: 3;+}++.avatar-option {+ border-radius: 50%;+}++@media (max-width: 768px) {+ .avatar-select {+ left: 50%;+ transform: translateX(-50%);+ }+}++.avatar-select.is-open {+ display: block;+}++.avatar-select .avatar-list {+ display: flex;+ gap: 18px;+ flex-wrap: wrap;+}++.avatar-select .avatar-list>img,+.avatar-select .avatar-list .avatar-container>img {+ width: 60px;+ height: 60px;+ object-fit: cover;+ cursor: pointer;+ border: 1px solid #ccc;+ box-sizing: border-box+}++.avatar-select .avatar-list>img:hover,+.avatar-select .avatar-list .avatar-container>img:hover {+ border: 1px solid #222;+}++.avatar-select .avatar-list .avatar-container {+ position: relative;+ height: 60px;+}++.avatar-select label.add-avatar {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ width: 60px;+ height: 60px;+ border: 1px solid var(--main-color);+ border-radius: 50%;+ cursor: pointer;+ margin: 0px;+ box-sizing: border-box;+ color: var(--main-color);+}++.avatar-select label.add-avatar:hover {+ border-color: var(--accent-color);+ color: var(--accent-color);+}++.avatar-select .avatar-list .remove-avatar {+ position: absolute;+ top: -4px;+ right: -11px;+ background-color: var(--box-background-color);+ border-radius: 50%;+ cursor: pointer;+ display: flex;+ font-weight: 600;+ align-items: center;+ justify-content: center;+ border: 1px solid #ccc;+ width: 25px;+ height: 25px;+ box-sizing: border-box;+ font-size: 8px;+}++.avatar-select .avatar-list .remove-avatar:hover {+ background-color: #eee;+}++.user-form .fields .grow {+ flex: 1;+}++.user-form .buttons,+.account-members .buttons,+.account-currencies .buttons,+.account-fixer .buttons,+.account-ai-settings .buttons,+.account-categories .buttons,+.account-notifications .buttons,+.admin-form .buttons,+.account-2fa .buttons {+ display: flex;+ justify-content: flex-end;+ align-items: center;+ gap: 20px;+}++.account-2fa .buttons {+ justify-content: flex-start;+}++.admin-form hr {+ margin: 20px 0px;+ color: var(--main-color);+ border-color: var(--main-color);+ background-color: var(--main-color);+}++.account-notifications-section {+ border: 1px solid #ccc;+ border-radius: 8px;+ margin-bottom: 10px;+ overflow: hidden;+}++.account-notification-section-header {+ padding: 16px;+ cursor: pointer;+}++.account-notification-section-header:hover {+ background-color: #EEE;+}++.account-notification-section-header h3 {+ margin: 0px;+}++.account-notification-section-header h3 i {+ margin-right: 10px;+}++.account-notification-section-settings {+ max-height: 0px;+ overflow: hidden;+ /* Hide content that goes beyond the height */+ transition: max-height 0.3s ease-in-out;+ /* Animate max-height changes */+ padding: 0px 16px;+}++.account-notification-section-settings.is-open {+ max-height: 1500px;+ /* Set to a value larger than the content's natural height */+}++.account-notification-section-settings>div:first-of-type {+ margin-top: 20px;+}++.account-notification-section-settings>div:last-of-type {+ margin-bottom: 20px;+}++.account-notifications .buttons {+ gap: 15px;+}++.image-button {+ box-sizing: border-box;+ border: none;+ background: transparent;+ cursor: pointer;+ padding: 0px;+}++.image-button>i {+ color: var(--main-color);+ font-size: 18px;+ padding: 2px;+}++.image-button:hover>i {+ color: var(--hover-color);+}++.image-button.disabled>i {+ opacity: 0.35;+ cursor: not-allowed;+}++.image-button>svg {+ width: 32px;+ height: 32px;+}++.image-button.disabled>img,+.image-button.disabled>svg {+ -webkit-filter: grayscale(100%);+ filter: grayscale(100%);+}++.image-button.success>img {+ filter: hue-rotate(262deg);+}++.image-button.error>img {+ filter: hue-rotate(141deg);+}++.image-button.small>img {+ width: 25px;+ height: 25px;+ object-fit: contain;+}++.image-button.medium>img {+ width: 32px;+ height: 32px;+ object-fit: contain;+}++#logo-search-button>i,+#icon-search-button>i {+ font-size: 26px;+}++.payments-list {+ display: flex;+ flex-wrap: wrap;+ gap: 16px;+}++.payments-list .payments-payment {+ cursor: pointer;+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 8px;+ background-color: var(--accent-color);+ padding: 8px 14px;+ border-radius: 10px;+ transition: filter 300ms;+}++.payments-list .payments-payment[data-enabled="0"] {+ filter: grayscale(100%);+}++.payments-list .payments-payment[data-in-use="yes"] {+ cursor: not-allowed;+}++.payments-list .payments-payment .drag-icon {+ height: 20px;+ width: 14px;+ font-size: 14px;+}++.payments-list .payments-payment>img {+ width: 32px;+ height: 32px;+ object-fit: contain;+}++.payments-list .payments-payment>.payment-name {+ cursor: text;+}++.payments-list .payments-payment .delete-payment-method {+ padding: 5px;+ font-weight: bold;+ color: var(--text-color);+}++.credits-list {+ display: flex;+ flex-direction: column;+ gap: 16px;+ line-break: anywhere;+}++.credits-list>div {+ margin: 0px;+ font-size: 18px;+ display: flex;+ flex-direction: column;+}++.updates-list>div {+ margin: 0px;+}++.credits-list>div>h3 {+ margin: 2px 0px 0px 0px;+ font-size: 20px;+}++.credits-list>div>h3>i {+ color: var(--accent-color);+ font-size: 18px;+}++.settings-notes {+ display: flex;+ flex-direction: column;+ gap: 10px;+ margin: 18px 0px 24px;+}++.settings-notes>p {+ display: flex;+ flex-direction: row;+ align-items: flex-start;+ gap: 10px;+ margin: 0px;+ font-size: 14px;+ line-height: 1.5;+ color: var(--text-muted);+}++.settings-notes>p>span {+ font-size: inherit;+ color: inherit;+}++.credits-list>div>span,+.updates-list>p>span {+ color: #AAA;+ font-size: 16px;+}++.credits-list>div>span>a,+.updates-list>p>span>a,+.settings-notes>p>span>a {+ margin-left: 5px;+ font-size: 13px;+ color: var(--accent-color);+}++.rtl .credits-list>div>span>a,+.rtl .updates-list>p>span>a,+.rtl .settings-notes>p>span>a {+ margin-left: 0px;+ margin-right: 5px;+}++.credits-list>div>span>a:visited,+.updates-list>p>span>a:visited,+.settings-notes>p>span>a:visited {+ color: var(--accent-color);+}++.settings-notes>p>i {+ color: var(--text-muted);+ font-size: 14px;+ width: 16px;+ text-align: center;+ flex-shrink: 0;+ margin-top: 5px;+}++.settings-notes>p>i.fa-triangle-exclamation {+ color: var(--warning-color);+}++.form-group {+ margin-bottom: 20px;+}++.form-group-inline {+ display: flex;+ flex-direction: row;+ align-items: center;+ margin-bottom: 20px;+ gap: 15px;+ box-sizing: border-box;+}++.form-group .inline {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 15px;+ justify-content: space-between;+}++.form-group .inline .split33 {+ flex-basis: 33.34%;+}++.form-group .inline .split66 {+ flex-basis: 66.66%;+}++.form-group .inline .split50 {+ flex-basis: 50%;+ display: flex;+ flex-direction: column;+}++.form-group.hide,+.form-group-inline.hide {+ display: none;+}++.height50 {+ height: 50px;+}++.inline-row {+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ gap: 15px;+ margin-bottom: 20px;+}++@media (max-width: 768px) {+ .form-group .inline .mobile-split-50 {+ flex-basis: 50%;+ }++ select#frequency {+ width: 100px;+ padding: 0px 10px;+ }+}++label {+ display: block;+ margin-bottom: 5px;+}++.form-group-inline label {+ font-size: 16px;+ margin-bottom: 0px;+ margin-left: 0px;+ cursor: pointer;+}++label.split-label {+ display: flex;+ flex-direction: row;+ justify-content: space-between;+}++input {+ box-sizing: border-box;+}++input[type="text"],+input[type="email"],+input[type="password"],+input[type="date"],+input[type="number"],+select {+ width: 100%;+ padding: 0px 15px;+ height: 50px;+ font-size: 16px;+ background-color: var(--input-background-color);+ border: 1px solid var(--input-border-color);+ border-radius: 10px;+ outline: none;+ color: var(--text-color);+ box-sizing: border-box;+ transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;+}++input[type="text"]:focus,+input[type="email"]:focus,+input[type="password"]:focus,+input[type="date"]:focus,+input[type="number"]:focus,+select:focus,+textarea:focus {+ border-color: var(--main-color);+ box-shadow: var(--focus-ring);+}++input[type="color"] {+ height: 46px;+ width: 46px;+ background-color: #222;+ border: 1px solid var(--hover-color);+ outline: none;+ box-sizing: border-box;+ cursor: pointer;+ font-size: 16px;+ position: relative;+ border-radius: 5px;+}++.one-third {+ max-width: 33%;+}++select {+ cursor: pointer;+ height: 50px;+ appearance: none;+ -webkit-appearance: none;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ background-repeat: no-repeat;+ background-position: right 15px center;+ padding-right: 40px;+}++.rtl select {+ background-position: left 15px center;+ padding-right: 15px;+ padding-left: 40px;+}++.date-wrapper {+ display: flex;+ flex-grow: 0;+ flex-direction: row;+ flex-basis: 100%;+ box-sizing: border-box;+}++input[type="date"] {+ display: flex;+ flex-grow: 1;+ flex-direction: row;+ align-items: center;+ flex-basis: 100%;+ box-sizing: border-box;+}++input[type="text"].short {+ flex-basis: 55px;+ min-width: 55px;+ text-align: center;+}++input[type="submit"],+input[type="button"],+button.button {+ height: 50px;+ padding: 0px 26px;+ font-size: 16px;+ background-color: var(--main-color);+ color: var(--text-color-inverted);+ border-radius: 10px;+ cursor: pointer;+ box-sizing: border-box;+ border: 1px solid var(--main-color);+ transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;+}++input[type="submit"].thin,+input[type="button"].thin,+button.button.thin {+ padding: 0px 30px;+}++input[type="button"].secondary-button,+button.button.secondary-button {+ background-color: var(--box-background-color);+ color: var(--main-color);+ border-color: var(--input-border-color);+ box-shadow: none;+}++input[type="button"].secondary-button:hover,+button.button.secondary-button:hover {+ background-color: var(--surface-hover);+ color: var(--hover-color);+ border-color: var(--main-color);+ box-shadow: none;+}++input[type="button"].warning-button {+ background-color: var(--error-color);+ border-color: var(--error-color);+}++input[type="button"].warning-button:hover,+button.button.warning-button:hover {+ background-color: rgba(var(--error-color-rgb), 0.8);+ border-color: rgba(var(--error-color-rgb), 0.8);+}++input[type="submit"]:hover,+input[type="button"]:hover,+button.button:hover {+ background-color: var(--hover-color);+ border-color: var(--hover-color);+}++input[type="submit"]:disabled,+input[type="button"]:disabled,+button.button:disabled {+ background-color: #ccc;+ border-color: #ccc;+}++input[type="button"].left button.button.left {+ margin-right: auto;+}++input[type="checkbox"] {+ cursor: pointer;+ width: 25px;+ height: 25px;+ padding: 0px;+ margin: 0px;+ background-color: var(--input-background-color);+ border: 1px solid var(--input-border-color);+ border-radius: 8px;+ display: grid;+ place-content: center;+}++button.disabled {+ cursor: not-allowed;+}++input[type="text"]:disabled,+input[type="password"]:disabled,+input[type="email"]:disabled {+ background-color: var(--input-disabled-background-color);+ border-color: var(--input-disabled-border-color);+ cursor: not-allowed;+}++textarea {+ font-size: 16px;+ background-color: var(--input-background-color);+ border: 1px solid var(--input-border-color);+ border-radius: 8px;+ padding: 5px 14px;+ color: var(--text-color);+ width: 100%;+ height: 245px;+}++textarea:focus {+ outline: none;+}++textarea.thin {+ height: 80px;+}++@media (max-width: 768px) {+ input[type="checkbox"] {+ width: 20px;+ height: 20px;+ flex-shrink: 0;+ }+}++.form-icon-search {+ position: relative;+}++.logo-search-backdrop,+.icon-search-backdrop {+ display: none;+ position: fixed;+ left: 0;+ top: 0;+ width: 100%;+ height: 100%;+ background-color: rgba(0, 0, 0, 0.4);+ backdrop-filter: blur(3px);+ z-index: 21;+}++.logo-search-backdrop.is-open,+.icon-search-backdrop.is-open {+ display: block;+}++.logo-search,+.icon-search {+ display: none;+ position: fixed;+ left: 50%;+ top: 50%;+ transform: translate(-50%, -50%);+ width: 92%;+ max-width: 460px;+ max-height: 460px;+ overflow: hidden;+ padding: 24px;+ border: 1px solid var(--box-border-color);+ border-radius: 20px;+ box-shadow: var(--shadow-pop);+ background-color: var(--box-background-color);+ box-sizing: border-box;+ z-index: 22;+}++.icon-search {+ max-height: 380px;+}++.logo-search.is-open,+.icon-search.is-open {+ display: flex;+ flex-direction: column;+}++.logo-search>header,+.icon-search>header {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ padding: 0px 0px 10px;+ margin-bottom: 12px;+ flex-shrink: 0;+}++.logo-search>header>h3,+.icon-search>header>h3 {+ margin: 0;+ font-size: 20px;+ font-weight: 400;+ color: var(--text-color);+ border-bottom: none;+ padding-bottom: 0;+}++.close-logo-search,+.close-icon-search {+ position: absolute;+ top: 14px;+ right: 14px;+ border: none;+ background-color: transparent;+ color: var(--text-muted);+ font-size: 20px;+ padding: 8px 10px;+ border-radius: 8px;+ cursor: pointer;+ z-index: 10;+}++.close-logo-search:hover,+.close-icon-search:hover {+ color: var(--text-color);+}++#icon-search-images {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 8px;+ align-content: start;+ overflow-y: auto;+ min-height: 0;+ flex-grow: 1;+ scrollbar-width: none;+ -ms-overflow-style: none;+}++#logo-search-images {+ display: flex;+ flex-direction: column;+ gap: 14px;+ overflow-y: auto;+ min-height: 0;+ flex-grow: 1;+ scrollbar-width: none;+ -ms-overflow-style: none;+}++#icon-search-images::-webkit-scrollbar,+#logo-search-images::-webkit-scrollbar {+ display: none;+}++.logo-search-section>h4 {+ margin: 0px 0px 6px;+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--text-muted);+}++.logo-search-section-results {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 8px;+}++.logo-search img,+.icon-search img {+ width: 100%;+ aspect-ratio: 4 / 3;+ object-fit: contain;+ padding: 8px;+ box-sizing: border-box;+ border: 1px solid var(--input-border-color);+ border-radius: 10px;+ background-color: var(--input-background-color);+ cursor: pointer;+ transition: border-color .15s ease-in-out, background-color .15s ease-in-out;+}++.icon-search img {+ aspect-ratio: 16 / 10;+}++.logo-search img:hover,+.icon-search img:hover {+ border-color: var(--main-color);+ background-color: var(--surface-hover);+}++.logo-search .search-state,+.icon-search .search-state {+ grid-column: 1 / -1;+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 8px;+ padding: 24px 10px;+ color: var(--text-muted);+ font-size: 13px;+ text-align: center;+}++.logo-search .search-state i,+.icon-search .search-state i {+ font-size: 18px;+}++.logo-search .search-state.error,+.icon-search .search-state.error {+ color: var(--error-color);+}++.capitalize {+ text-transform: capitalize;+}++button.dark-theme-button {+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: center;+ font-size: 18px !important;+ border: 1px solid #ccc;+ border-radius: 8px;+ padding: 16px 20px 14px;+ background-color: transparent;+ color: var(--text-color);+ cursor: pointer;+ flex-grow: 1;+}++button.dark-theme-button:hover {+ background-color: #EEE;+}++button.dark-theme-button.selected {+ border: 1px solid var(--main-color);+}++button.dark-theme-button i {+ margin-right: 12px;+}++.error {+ display: block;+ color: #f45a40;+}++.success {+ display: block;+ color: #188823;+}++.user-error,+.user-success {+ display: none;+}++.user-error.show,+.user-success.show {+ display: block;+}++.subscription-form,+.subscription-modal {+ background-color: var(--box-background-color);+ padding: 22px;+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ box-sizing: border-box;+ position: fixed;+ left: 50%;+ top: 50%;+ transform: translateX(-50%) translateY(-50%);+ z-index: 20;+ max-width: 800px;+ max-height: calc(100vh - 34px);+ overflow: auto;+ overflow-y: auto;+ width: 90%;+ display: none;+}++.subscription-form.is-open,+.subscription-modal.is-open {+ display: block;+}++.subscription-form h3,+.subscription-modal h3 {+ padding-bottom: 15px;+ margin-top: 0px;+}++.subscription-form .buttons {+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ justify-content: flex-end;+ gap: 16px;+}++@media (max-width: 768px) {++ .subscription-form,+ .subscription-modal {+ width: 100%;+ max-height: 100dvh;+ }++ .subscription-form .buttons input {+ flex: 1;+ }+}++.logo-preview {+ padding: 2px 0px;+ height: 49px;+ box-sizing: border-box;+ aspect-ratio: 3.55/1;+ display: block;+ cursor: pointer;+ overflow: hidden;+}++.logo-preview:after {+ content: "Upload Logo";+ display: flex;+ justify-content: center;+ align-items: center;+ height: 100%;+ color: var(--main-color);+ font-size: 16px;+ text-align: center;+}++.logo-preview:hover::after,+.icon-preview:hover::after {+ color: var(--hover-color);+}++.logo-preview img {+ width: 100%;+ height: 100%;+ object-fit: contain;+ display: none;+}++.icon-preview {+ padding: 2px 0px;+ height: 49px;+ box-sizing: border-box;+ aspect-ratio: 3/2;+ display: block;+ cursor: pointer;+ overflow: hidden;+ flex-shrink: 0;+}++.icon-preview:after {+ content: "\f093";+ font-family: "Font Awesome 6 Free";+ font-weight: 900;+ display: flex;+ justify-content: center;+ align-items: center;+ height: 100%;+ color: var(--main-color);+ font-size: 22px;+ text-align: center;+}++.icon-preview img {+ width: 100%;+ height: 100%;+ object-fit: contain;+ display: none;+}++.hidden-input {+ display: none;+}++.close-form {+ display: block;+ position: absolute;+ top: 15px;+ right: 15px;+ padding: 10px;+ font-size: 20px;+ cursor: pointer;+ color: gray;+}++.rtl .close-form {+ right: auto;+ left: 15px;+}++.sort-container {+ position: relative;+}++.sort-options {+ position: absolute;+ color: var(--text-color);+ font-size: 16px;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 12px;+ overflow: hidden;+ box-shadow: var(--shadow-pop);+ box-sizing: border-box;+ top: 52px;+ right: 0px;+ display: none;+ width: 144px;+ width: max-content;+ z-index: 2;+}++.rtl .sort-options {+ left: 0px;+ right: auto;+}++.sort-options.is-open {+ display: block;+}++.sort-options>ul {+ padding: 0px;+ margin: 0px;+}++.sort-options>ul>li {+ position: relative;+ list-style: none;+ padding: 14px 35px 14px 18px;+ border-bottom: 1px solid var(--box-border-color);+ cursor: pointer;+}++.rtl .sort-options>ul>li {+ padding: 14px 18px 14px 35px;+}++.sort-options>ul>li:last-of-type {+ border-bottom: none;+}++.sort-options>ul>li:hover {+ background-color: var(--surface-hover);+}++.sort-options>ul>li.selected::after {+ content: "";+ position: absolute;+ right: 10px;+ top: 50%;+ transform: translateY(-50%);+ width: 16px;+ height: 16px;+ background-color: var(--main-color);+ -webkit-mask: url("../images/siteicons/svg/check.php") no-repeat center;+ mask: url("../images/siteicons/svg/check.php") no-repeat center;+ background-size: 100% 100%;+}++.rtl .sort-options>ul>li.selected {+ background-position: center left 10px;+}++.subscription-list-title {+ font-size: 13px;+ padding: 8px 4px 0px;+ font-weight: 600;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--text-muted);+}+++/* TOAST MESSAGE */++.toast {+ position: fixed;+ bottom: 25px;+ right: 30px;+ border-radius: 12px;+ border: 1px solid var(--box-border-color);+ background-color: var(--box-background-color);+ padding: 20px 35px 20px 25px;+ box-shadow: 0 6px 20px -5px rgba(0, 0, 0, 0.1);+ overflow: hidden;+ transform: translateX(calc(100% + 30px));+ transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.35);+ box-sizing: border-box;+ z-index: 5;+}++@media (max-width: 768px) {+ .toast {+ bottom: 0px;+ right: 0px;+ left: 0px;+ width: 100%;+ }++ .mobile-navigation .toast {+ bottom: 70px;+ }+}++.toast.active {+ transform: translateX(0%);+}++.toast .toast-content {+ display: flex;+ align-items: center;+}++.toast-content .toast-icon {+ display: flex;+ align-items: center;+ justify-content: center;+ height: 35px;+ min-width: 35px;+ color: #fff;+ font-size: 20px;+ border-radius: 50%;+}++.toast-content .toast-icon.error {+ background-color: var(--error-color);+}++.toast-content .toast-icon.success {+ background-color: var(--success-color);+}+++.toast-content .message {+ display: flex;+ flex-direction: column;+ margin: 0 20px;+}++.toast-content .message .text {+ font-size: 16px;+ font-weight: 400;+ color: #666666;+}++.toast-content .message .text.text-1 {+ font-weight: 600;+ color: #333;+}++.toast .close {+ position: absolute;+ top: 10px;+ right: 15px;+ padding: 5px;+ cursor: pointer;+ opacity: 0.7;+}++.toast .close:hover {+ opacity: 1;+}++.toast .progress {+ position: absolute;+ bottom: 0;+ left: 0;+ height: 3px;+ width: 100%;++}++.toast .progress:before {+ content: "";+ position: absolute;+ bottom: 0;+ right: 0;+ height: 100%;+ width: 100%;+}++.toast .progress.error:before {+ background-color: var(--error-color);+}++.toast .progress.success:before {+ background-color: var(--success-color);+}++.progress.active:before {+ animation: progress 5s linear forwards;+}++@keyframes progress {+ 100% {+ right: 100%;+ }+}++/* TOAST END */++.statistics {+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ gap: 20px;+ justify-content: flex-start;+}++.statistic {+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ padding: 20px 24px 30px;+ display: flex;+ flex-direction: column;+ align-items: center;+ flex-basis: calc(33.333% - (20px * 2 / 3));+ flex-shrink: 0;+ box-sizing: border-box;+ flex-grow: 0;+ overflow: hidden;+}++.statistic.short {+ padding-bottom: 15px;+}++.statistic.empty {+ background-color: transparent;+ border: none;+ box-shadow: none;+}++@media (max-width: 768px) {+ .statistic {+ flex-basis: 100%;+ }++ .statistic.empty {+ display: none;+ }+}++.statistic>span {+ font-size: 42px;+ color: var(--main-color);+}++.statistic>.title {+ margin-top: 5px;+ text-align: center;+}++.statistic>.subtitle {+ font-size: 25px;+ color: var(--accent-color);+ margin-top: 10px;+ text-align: center;+}++.statistic>.subtitle>img {+ width: 100px;+ max-height: 40px;+ object-fit: contain;+}++.graphs {+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ gap: 20px;+ justify-content: space-between;+}++.graph {+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ flex-basis: 48%;+ align-items: center;+ justify-content: center;+ display: flex;+ flex-direction: column;+ padding: 20px 10px;+ box-sizing: border-box;+}++.graph-legend {+ display: flex;+ flex-wrap: wrap;+ justify-content: center;+ gap: 6px 14px;+ padding: 4px 16px 12px;+ font-size: 13px;+}++.graph-legend-item {+ display: flex;+ align-items: center;+ gap: 6px;+ cursor: pointer;+ background: none;+ border: none;+ font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;+ font-size: 13px;+ color: var(--text-color);+ padding: 2px 4px;+ border-radius: 4px;+}++.graph-legend-item:hover {+ background-color: rgba(var(--main-color-rgb), 0.06);+}++.graph-legend-item--off {+ opacity: 0.4;+ text-decoration: line-through;+}++.graph-legend-dot {+ width: 10px;+ height: 10px;+ border-radius: 50%;+ flex-shrink: 0;+}++.graph>header {+ font-size: 18px;+ font-weight: 500;+ margin-bottom: 15px;+ text-align: center;+}++.graph>header>.sub-header {+ font-size: 13px;+ font-weight: normal;+}++.graph.x2 {+ flex-basis: 100%;+}++@media (max-width: 768px) {+ .graph {+ flex-basis: 100%;+ max-width: 100%;+ }+}++/* Settings sort category */++.sortable-list {+ margin: 0px;+ padding: 0px;+ -webkit-touch-callout: none;+ -webkit-user-select: none;+ -khtml-user-select: none;+ -moz-user-select: none;+ -ms-user-select: none;+ user-select: none;+}++.drag-icon {+ width: 28px;+ height: 50px;+ cursor: grab;+ display: flex;+ align-items: center;+ justify-content: center;+ font-size: 20px;+}++.sortable-list .sortable-ghost {+ border-radius: 8px;+ background-color: rgba(var(--accent-color-rgb), 0.6);+ border: 1px solid var(--accent-color);+ padding: 5px;+}++/* Fitler dropdown */++.filtermenu {+ position: relative;+ display: inline-block;+}++.filtermenu-content {+ display: none;+ position: absolute;+ left: auto;+ right: 0;+ width: 220px;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 12px;+ box-shadow: var(--shadow-pop);+ z-index: 3;+ overflow: hidden;+ margin-top: 6px;+}++.rtl .filtermenu-content {+ left: 0;+ right: auto;++}++.filtermenu-content.is-open {+ display: block;+}++.filtermenu-content .filter-title {+ padding: 14px 18px;+ text-decoration: none;+ display: block;+ cursor: pointer;+ font-weight: 500;+ border-bottom: 1px solid var(--box-border-color);+ user-select: none;+}++.filtermenu-content .filtermenu-submenu.hide {+ display: none;+}++.filtermenu-content .filtermenu-submenu:last-of-type .filter-title {+ border-bottom: none;+}++.filtermenu-content .filtermenu-submenu:last-of-type .filter-item:first-of-type {+ border-top: 1px solid var(--box-border-color);+}++.filtermenu-content .filtermenu-submenu:last-of-type .filter-item:last-of-type {+ border-bottom: none;+}++.filtermenu-content .filter-item {+ position: relative;+ padding: 14px 24px;+ text-decoration: none;+ display: block;+ cursor: pointer;+ border-bottom: 1px solid var(--box-border-color);+ user-select: none;+ font-size: 16px;+}++.filtermenu-content .filter-item.selected::after {+ content: "";+ position: absolute;+ right: 14px;+ top: 50%;+ transform: translateY(-50%);+ width: 16px;+ /* Explicitly set the size */+ height: 16px;+ /* Explicitly set the size */+ background-color: var(--main-color);+ /* Set your desired color here */+ -webkit-mask: url("../images/siteicons/svg/check.php") no-repeat center;+ mask: url("../images/siteicons/svg/check.php") no-repeat center;+ background-size: 100% 100%;+ /* Ensure the icon scales correctly */+}++.rtl .filtermenu-content .filter-item.selected {+ background-position: center left 10px;+}++.filtermenu-content .filter-title.filter-clear {+ color: var(--hover-color);+ font-weight: normal;+ border-bottom: none;+}++.filtermenu-content .filter-title.filter-clear>i {+ margin-right: 8px;+}++.rtl .filtermenu-content .filter-title.filter-clear>i {+ margin-left: 8px;+ margin-right: 0px;+}++.filtermenu-content .filter-item:hover,+.filtermenu-content .filter-title:hover {+ background-color: var(--surface-hover);+}++.filtermenu-submenu-content {+ display: none;+}++.filtermenu-submenu-content.is-open {+ display: block;+}++/* Theme Selector */++.theme {+ flex-grow: 1;+}++.theme-preview {+ cursor: pointer;+ border: 1px solid #ccc;+ border-radius: 8px;+ padding: 20px 15px 20px 10px;+ display: flex;+ gap: 15px;+ flex-direction: row;+ align-items: center;+}++.theme-preview.is-selected {+ border: 1px solid var(--main-color);+}++.theme-preview:hover {+ background-color: rgba(var(--accent-color-rgb), 0.6);+}++.theme-preview .main-color,+.theme-preview .accent-color,+.theme-preview .hover-color {+ display: inline-block;+ width: 24px;+ height: 24px;+ border: 1px solid #FFF;+ box-sizing: border-box;+}++.theme-preview.blue .main-color {+ background-color: #2563eb;+}++.theme-preview.blue .accent-color {+ background-color: #93c5fd;+}++.theme-preview.blue .hover-color {+ background-color: #1d4ed8;+}++.theme-preview.green .main-color {+ background-color: #6B8E23;+}++.theme-preview.green .accent-color {+ background-color: #9ACD32;+}++.theme-preview.green .hover-color {+ background-color: #556B2F;+}++.theme-preview.red .main-color {+ background-color: #f45a40;+}++.theme-preview.red .accent-color {+ background-color: #f79988;+}++.theme-preview.red .hover-color {+ background-color: #c73f29;+}++.theme-preview.yellow .main-color {+ background-color: #ffae00;+}++.theme-preview.yellow .accent-color {+ background-color: #faea8f;+}++.theme-preview.yellow .hover-color {+ background-color: #cd930c;+}++.theme-preview.purple .main-color {+ background-color: #6d4aff;+}++.theme-preview.purple .accent-color {+ background-color: #b086ff;+}++.theme-preview.purple .hover-color {+ background-color: #5e42cd;+}++.custom-colors {+ display: flex;+ flex-direction: row;+ gap: 12px;+}++.color-picker {+ flex-shrink: 0;+}++.color-picker::before {+ color: var(--hover-color);+ position: absolute;+ top: -5px;+ right: -5px;+ border: 1px solid;+ border-radius: 15px;+ background-color: var(--box-background-color);+ padding: 4px;+}++.color-picker-button:hover label {+ color: var(--hover-color);+}++.wrap {+ flex-wrap: wrap;+}++.user-list {+ display: flex;+ flex-direction: column;+ flex-wrap: wrap;+ justify-content: space-between;+}++.user-list>div {+ display: flex;+ flex-direction: row;+ flex-grow: 1;+ flex-wrap: wrap;+ align-items: center;+}++.user-list .user-list-row {+ display: flex;+ flex-direction: row;+ flex-grow: 1;+}++@media (max-width: 768px) {+ .user-list .user-list-row {+ flex-direction: column;+ }+}++.user-list .user-list-row:last-of-type {+ flex-grow: 0;+}++.user-list .user-list-row>div {+ display: flex;+ flex-basis: 50%;+ gap: 12px;+ align-items: center;+}++.user-list a {+ color: var(--main-color);+ text-decoration: none;+}++.user-list a:hover {+ color: var(--hover-color);+}++.user-list .user-list-icon {+ width: 22px;+ text-align: center;+ font-size: 16px;+ color: var(--main-color);+}++.calendar-title {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 16px;+ min-width: 0;+}++.calendar-title h2 {+ margin-right: 0px;+}++.calendar-nav {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 8px;+}++.calendar-nav .button {+ height: auto;+ padding: 8px 11px;+ font-size: 14px;+}++.calendar-nav .button:disabled {+ opacity: 0.4;+ cursor: default;+ pointer-events: none;+}++.calendar {+ width: 100%;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ box-sizing: border-box;+ overflow: hidden;+}++.calendar .calendar-header,+.calendar .calendar-row {+ display: grid;+ grid-template-columns: repeat(7, minmax(0, 1fr));+}++.calendar .calendar-header .calendar-cell {+ padding: 14px 0px 12px;+ font-size: 12px;+ font-weight: 600;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--text-muted);+ text-align: center;+}++.calendar .calendar-body .calendar-cell {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ gap: 6px;+ min-height: 96px;+ padding: 8px;+ box-sizing: border-box;+ border-top: 1px solid var(--box-border-color);+ overflow: hidden;+}++.calendar .calendar-body .calendar-cell+.calendar-cell {+ border-inline-start: 1px solid var(--box-border-color);+}++.calendar .calendar-body .calendar-cell.empty {+ background-color: rgba(var(--text-muted-rgb), 0.04);+}++.calendar .day {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 26px;+ height: 26px;+ border-radius: 50%;+ font-size: 13px;+ font-weight: 500;+ color: var(--text-muted);+ flex-shrink: 0;+}++.calendar .today .day {+ background-color: var(--main-color);+ color: #fff;+ font-weight: 700;+}++.calendar .calendar-cell-content {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: 4px;+ width: 100%;+ min-width: 0;+}++.calendar .calendar-event {+ background-color: rgba(var(--main-color-rgb), 0.1);+ color: var(--main-color);+ font-size: 12px;+ font-weight: 500;+ text-align: start;+ padding: 3px 8px;+ border-radius: 6px;+ cursor: pointer;+ user-select: none;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ transition: background-color .15s ease-in-out;+}++.calendar .calendar-event:hover {+ background-color: rgba(var(--main-color-rgb), 0.18);+}++@media (max-width: 768px) {+ .calendar .calendar-header .calendar-cell {+ padding: 10px 0px 8px;+ font-size: 10px;+ letter-spacing: 0.04em;+ }++ .calendar .calendar-body .calendar-cell {+ min-height: 72px;+ padding: 4px;+ gap: 4px;+ }++ .calendar .day {+ width: 22px;+ height: 22px;+ font-size: 12px;+ }++ .calendar .calendar-event {+ font-size: 10px;+ padding: 2px 5px;+ border-radius: 5px;+ }+}++.over-budget {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 12px;+ background-color: rgba(var(--error-color-rgb), 0.08);+ color: var(--error-color);+ border-radius: 12px;+ padding: 14px 16px;+ margin-top: 20px;+ font-size: 14px;+ font-weight: 500;+}++.over-budget>i {+ font-size: 16px;+}++.subscription-modal {+ max-width: 400px;+}++.subscription-modal .modal-header {+ position: relative;+}++.subscription-modal .close-modal {+ position: absolute;+ top: -5px;+ right: -5px;+ padding: 5px;+ font-size: 20px;+ cursor: pointer;+}++.subscription-modal img {+ max-width: 135px;+}++.grow {+ flex-grow: 1;+}++@media (max-width: 768px) {+ .mobile-grow {+ flex-grow: 1;+ }++ .mobile-reverse {+ flex-direction: column-reverse;+ }++ .mobile-grow-force {+ flex-grow: 1;+ width: 100%;+ }++}++.bold {+ font-weight: 700;+}++/* Checkbox */+input[type="checkbox"] {+ opacity: 0;+ position: absolute;+}++input[type="checkbox"]+label {+ position: relative;+ padding-left: 54px;+ cursor: pointer;+ display: inline-flex;+ align-items: center;+}++input[type="checkbox"]+label::before {+ content: '';+ position: absolute;+ left: 0;+ top: 50%;+ transform: translateY(-50%);+ width: 44px;+ height: 24px;+ background-color: #e9e9eb;+ border-radius: 12px;+ transition: background-color 0.3s ease;+ border: 1px solid #ccc;+}++input[type="checkbox"]+label::after {+ content: '';+ position: absolute;+ left: 3px;+ top: 50%;+ transform: translateY(-50%);+ width: 20px;+ height: 20px;+ background-color: #fff;+ border-radius: 50%;+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);+ transition: transform 0.3s ease;+}++input[type="checkbox"]:focus+label::before {+ box-shadow: 0 0 0 2px rgba(var(--main-color-rgb, 100, 149, 237), 0.5);+}++input[type="checkbox"]:disabled+label::before {+ background-color: #d3d3d3;+}++input[type="checkbox"]:disabled+label::after {+ background-color: #f0f0f0;+}++input[type="checkbox"]:checked+label::before {+ background-color: var(--main-color);+}++input[type="checkbox"]:checked+label::after {+ transform: translate(20px, -50%);+}++input[type="checkbox"]:focus+label::after {+ outline: 2px solid rgba(var(--main-color-rgb, 100, 149, 237), 0.5);+}++/* Radio */+input[type="radio"] {+ opacity: 0;+ position: absolute;+}++input[type="radio"]+label {+ position: relative;+ padding-left: 35px;+ cursor: pointer;+ display: flex;+ line-height: 22px;+}++input[type="radio"]+label::before {+ content: '';+ position: absolute;+ left: 0;+ top: 0;+ width: 24px;+ height: 24px;+ background: #fafafa;+ border: 1px solid #ccc;+ border-radius: 50%;+ box-sizing: border-box;+}++input[type="radio"]:focus+label::before {+ border-color: var(--main-color);+ box-shadow: 0 0 0 2px rgba(var(--main-color-rgb), 0.5);+}++input[type="radio"]:disabled+label::before {+ background-color: #F5F5F5;+ border-color: #F5F5F5;+ cursor: not-allowed;+}++input[type="radio"]:checked+label::after {+ content: '';+ position: absolute;+ left: 5px;+ top: 5px;+ width: 14px;+ height: 14px;+ background: var(--main-color);+ border-radius: 50%;+ box-sizing: border-box;+}++.theme input[type="radio"]+label {+ padding-left: 44px;+}++.theme input[type="radio"]+label::before {+ left: 11px;+ top: 20px;+}++.theme input[type="radio"]:checked+label::after {+ left: 16px;+ top: 25px;+}++.update-banner {+ padding: 15px 20px;+ background-color: var(--accent-color);+ border: 1px solid var(--main-color);+ border-radius: 12px;+ margin-bottom: 20px;+ text-align: center;+ color: var(--text-color);+}++.update-banner>span {+ font-weight: 500;+}++.update-banner>span>a {+ color: var(--text-color);+ text-decoration: underline;+}++.demo-banner {+ padding: 15px 20px;+ background-color: rgba(var(--error-color-rgb), 0.2);+ border: 1px solid #f45a40;+ border-radius: 12px;+ margin-bottom: 20px;+ text-align: center;+}++.totp-popup {+ display: none;+ position: fixed;+ width: 380px;+ max-width: 90%;+ top: 50%;+ left: 50%;+ transform: translate(-50%, -50%);+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ box-sizing: border-box;+ padding: 20px;+ flex-direction: column;+ gap: 20px;+ z-index: 20;+}++.totp-popup h3,+.totp-popup h4 {+ margin: 4px 0px;+ text-align: center;+}++.totp-popup.is-open {+ display: flex;+}++.totp-popup-content {+ display: flex;+ flex-direction: column;+ gap: 20px;+ align-items: center;+ margin-top: 20px;+}++.totp-setup {+ display: flex;+ flex-direction: column;+ align-items: center;+}++.totp-setup.hide {+ display: none;+}++.totp-qrcode-container {+ padding: 14px;+ border: 1px solid #333;+ border-radius: 8px;+}++.totp-backup-codes {+ background-color: #EEE;+ border: 2px dashed #ccc;+ border-radius: 8px;+ padding: 10px;+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ gap: 10px 18px;+ justify-content: space-evenly;+}++.totp-backup-codes li {+ list-style: none;+ padding: 5px 10px;+ font-weight: 500;+}++.mobile-nav {+ display: none;+}++.mobile-nav-image {+ width: 100%;+ max-width: 440px;+ margin-top: 15px;+ background-image: url("../images/siteimages/mobilenav.png");+ background-size: contain;+ background-position: center;+ background-repeat: no-repeat;+ aspect-ratio: 16/9;+}++.button.export-ical {+ height: auto;+ padding: 10px 12px;+ flex-shrink: 0;+}++.button.export-ical svg {+ width: 18px;+ height: 18px;+ display: block;+}++@media (max-width: 768px) {+ .mobile-nav {+ position: fixed;+ bottom: 0px;+ width: 100%;+ background-color: var(--box-background-color);+ border-top: 1px solid var(--box-border-color);+ display: flex;+ flex-direction: row;+ justify-content: space-around;+ z-index: 2;+ padding: 7px 0px;+ box-shadow: var(--negative-box-shadow);+ box-sizing: border-box;+ align-items: center;+ }++ .mobile-nav>a {+ flex-grow: 1;+ flex-shrink: 0;+ text-align: center;+ padding: 5px 0px 10px 0px;+ color: #AAA;+ font-size: 10px;+ text-decoration: none;++ display: flex;+ flex-direction: column;+ align-items: center;+ }++ .mobile-nav>a>svg {+ width: 30px;+ height: 30px;+ max-width: 85%;+ }++ .mobile-nav>a.active {+ color: #202020;+ }++ .mobile-navigation .mobileNavigationHideOnMobile {+ display: none !important;+ }+}++.button.autofill-next-payment {+ padding: 15px 15px !important;+ margin-top: 22px;+}++.autofill-next-payment {+ color: var(--main-color);+ cursor: pointer;+}++.autofill-next-payment.hideOnDesktop {+ display: none;+}++@media (max-width: 768px) {+ .button.autofill-next-payment.hideOnMobile {+ display: none !important;+ }+++ .autofill-next-payment.hideOnDesktop {+ display: block;+ }+}++.dashboard h1 {+ margin: 0px;+}+++.dashboard-subscriptions-container {+ overflow-x: auto;+ overflow-y: hidden;+ max-width: 100%;+ padding-bottom: 10px;+}++.dashboard-subscriptions-list {+ display: flex;+ flex-direction: row;+ gap: 10px;+ min-width: fit-content;+ /* prevent collapsing */+}++.dashboard-subscriptions-list>.subscription-item {+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ padding: 20px;+ width: 155px;+ height: 145px;+ flex: 0 0 auto;+ /* prevent flex resizing */+ box-sizing: border-box;+ display: flex;+ flex-direction: column;+ justify-content: space-between;+}++.dashboard-subscriptions-list>.subscription-item:not(.thin) {+ cursor: pointer;+}++.dashboard-subscriptions-list>.subscription-item.thin {+ height: 115px;+}++.dashboard-subscriptions-list>.subscription-item .subscription-item-title {+ font-size: 19px;+ font-weight: 500;+ margin: 0px;+ display: -webkit-box;+ -webkit-line-clamp: 2; /* maximum number of lines */+ line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+ text-overflow: ellipsis;+}++.dashboard-subscriptions-list>.subscription-item.thin .subscription-item-title {+ font-size: 16px;+}++.dashboard-subscriptions-list>.subscription-item .subscription-item-logo {+ max-width: 100%;+ height: 42px;+ object-fit: contain;+ object-position: left center;+}++.dashboard-subscriptions-list>.subscription-item .subscription-item-date {+ font-size: 16px;+ margin: 0px;+}++.dashboard-subscriptions-list>.subscription-item .subscription-item-price {+ font-size: 18px;+ font-weight: 600;+ margin: 0px;+}++.dashboard-subscriptions-list>.subscription-item .subscription-item-value {+ font-size: 24px;+ font-weight: 600;+ margin: 0px;+}++.dashboard-subscriptions-list>.subscription-item.thin .subscription-item-value {+ font-size: 20px;;+}++.ai-recommendations-container {+ width: 100%;+ box-sizing: border-box;+}++.ai-recommendations-list {+ list-style: none;+ padding: 0;+ margin: 0;+ display: flex;+ flex-direction: column;+ gap: 16px;+}++.ai-recommendation-item {+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 16px;+ box-shadow: var(--box-shadow);+ padding: 18px 20px;+ width: 100%;+ box-sizing: border-box;+ display: flex;+ flex-direction: column;+ gap: 8px;+ margin: 0;+ cursor: pointer;+}++.ai-recommendation-item .ai-recommendation-header h3 {+ font-size: 18px;+ font-weight: 600;+ margin: 0px;+ line-height: 1.2;+}++.ai-recommendation-item .ai-recommendation-header {+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}++.ai-recommendation-item .ai-recommendation-header .item-arrow-down {+ color: var(--main-color);+}++.ai-recommendation-item.expanded .ai-recommendation-header .item-arrow-down {+ transform: rotate(180deg);+}++.ai-recommendation-item .ai-recommendation-header h3 > span {+ color: var(--main-color);+}++.ai-recommendation-item p {+ display: none;+ font-size: 15px;+ margin: 0 0 4px 0;+ line-height: 1.5;+ margin-top: 8px;+}++.ai-recommendation-item.expanded p {+ display: block;+}++.ai-recommendation-item p:last-child {+ font-size: 16px;+ font-weight: 600;+ color: var(--accent-color);+}++.ai-recommendation-item p.ai-recommendation-savings {+ justify-content: space-between;+}++.ai-recommendation-item p.ai-recommendation-savings a {+ color: var(--main-color);+ text-decoration: none;+}++.ai-recommendation-item.expanded p.ai-recommendation-savings {+ display: flex;+}++.flex {+ display: flex;+}++.info-badge {+ background-color: orange;+ border-radius: 5px;+ font-size: 10px;+ padding: 2px 6px;+ color: #FFFFFF;+ margin-bottom: auto;+ margin-left: 10px;+}++.spinner {+ width: 38px;+ height: 38px;+ border: 4px solid rgba(0, 0, 0, 0.1);+ border-left-color: var(--main-color);+ border-radius: 50%;+ animation: spin 1s linear infinite;+ margin: auto;+}++.spinner.ai-spinner {+ margin: 0px 0px 0px auto;+}++.spinner.hidden {+ display: none;+}++@keyframes spin {+ to {+ transform: rotate(360deg);+ }+}++@media (max-width: 768px) {+ .spinner.ai-spinner {+ margin: auto;+ }+}++.dashboard-subscriptions-container {+ scrollbar-width: none;+ -ms-overflow-style: none;+}++.dashboard-subscriptions-container::-webkit-scrollbar {+ display: none;+}++.view-toggle {+ display: flex;+ align-items: stretch;+ box-sizing: border-box;+ height: 50px;+ padding: 4px;+ gap: 2px;+ background-color: var(--box-background-color);+ border: 1px solid var(--input-border-color);+ border-radius: 10px;+}++.view-toggle-button {+ border: none;+ background-color: transparent;+ color: var(--text-muted);+ padding: 0px 14px;+ font-size: 16px;+ border-radius: 7px;+ cursor: pointer;+ transition: background-color .15s ease-in-out, color .15s ease-in-out;+}++.view-toggle-button:hover {+ color: var(--main-color);+}++.view-toggle-button.selected {+ background-color: rgba(var(--main-color-rgb), 0.12);+ color: var(--main-color);+}++.subscriptions.grid-view {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));+ gap: 16px;+ align-items: stretch;+}++.subscriptions.grid-view .subscription-list-title,+.subscriptions.grid-view .empty-page,+.subscriptions.grid-view .no-matching-subscriptions {+ grid-column: 1 / -1;+}++.subscriptions.grid-view .subscription-container {+ display: flex;+ flex-direction: column;+}++.subscriptions.grid-view .subscription-container.hide {+ display: none;+}++.subscriptions.grid-view .subscription-container>.mobile-actions {+ display: none;+}++.subscriptions.grid-view .subscription {+ flex-grow: 1;+ padding: 18px 18px 20px;+ justify-content: flex-start;+}++.subscriptions.grid-view .subscription-main {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ grid-template-rows: auto auto 1fr auto auto;+ grid-template-areas:+ "logo actions"+ "name name"+ "price price"+ "cycle pm"+ "next pm";+ gap: 2px 10px;+ align-items: center;+}++.subscriptions.grid-view .subscription-main>.logo {+ grid-area: logo;+ flex-basis: auto;+ justify-content: flex-start;+ height: 42px;+ max-width: 150px;+ overflow: hidden;+}++.subscriptions.grid-view .subscription-main>.logo img {+ object-position: left center;+}++.subscriptions.grid-view .subscription-main>.hideOnMobile {+ display: flex;+}++.subscriptions.grid-view .subscription-main>.name {+ grid-area: name;+ flex-basis: auto;+ justify-content: flex-start;+ text-align: left;+ font-size: 17px;+ font-weight: 600;+ max-height: none;+ margin-top: 8px;+ overflow: hidden;+ text-overflow: ellipsis;+}++.subscriptions.grid-view .subscription-main>.price {+ grid-area: price;+ flex-basis: auto;+ justify-content: flex-start;+ align-self: start;+ font-size: 23px;+ font-weight: 700;+ margin: 0px 0px 12px;+}++.subscriptions.grid-view .subscription-main>.cycle {+ grid-area: cycle;+ flex-basis: auto;+ flex-grow: 0;+ justify-content: flex-start;+ font-size: 13px;+ color: var(--text-muted);+}++.subscriptions.grid-view .subscription-main>.next {+ grid-area: next;+ flex-basis: auto;+ flex-grow: 0;+ justify-content: flex-start;+ font-size: 13px;+ color: var(--text-muted);+}++.subscriptions.grid-view .subscription-main>.cycle>svg {+ width: 14px;+ height: 14px;+ margin: 0px 6px 0px 0px;+ flex-shrink: 0;+}++.rtl .subscriptions.grid-view .subscription-main>.cycle>svg {+ margin: 0px 0px 0px 6px;+}++.subscriptions.grid-view .subscription-main>.next::before {+ content: "\f073";+ font-family: "Font Awesome 6 Free";+ font-weight: 900;+ font-size: 11px;+ width: 14px;+ display: inline-flex;+ justify-content: center;+ margin-right: 6px;+}++.rtl .subscriptions.grid-view .subscription-main>.next::before {+ margin-right: 0px;+ margin-left: 6px;+}++.subscriptions.grid-view .subscription-main>.payment_method {+ grid-area: pm;+ align-self: end;+ justify-self: end;+ margin-left: 0px;+}++.subscriptions.grid-view .subscription-main>.payment_method img {+ width: 36px;+ height: 24px;+}++.subscriptions.grid-view .subscription-main .actions-expand {+ grid-area: actions;+ justify-self: end;+ align-self: start;+ padding: 4px 8px;+ margin: -4px -8px 0px 0px;+}++.mobile-navigation .subscriptions.grid-view .subscription-main .actions-expand.mobileNavigationHideOnMobile {+ display: block !important;+}++@media (max-width: 768px) {+ .subscriptions.grid-view {+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));+ gap: 12px;+ }++ .subscriptions.grid-view .subscription {+ padding: 14px 14px 16px;+ }++ .subscriptions.grid-view .subscription-main>.name {+ font-size: 15px;+ }++ .subscriptions.grid-view .subscription-main>.price {+ font-size: 19px;+ margin-bottom: 8px;+ }++ .subscriptions.grid-view .subscription-main>.cycle {+ display: flex;+ }+}++body.details-open {+ overflow-y: hidden;+}++.details-backdrop {+ display: none;+ position: fixed;+ inset: 0;+ background-color: rgba(10, 14, 22, 0.45);+ -webkit-backdrop-filter: blur(3px);+ backdrop-filter: blur(3px);+ z-index: 19;+}++.details-backdrop.is-open {+ display: block;+}++.subscription-details {+ display: none;+ position: fixed;+ left: 50%;+ top: 50%;+ transform: translate(-50%, -50%);+ width: 92%;+ max-width: 460px;+ max-height: calc(100vh - 40px);+ overflow-y: auto;+ background-color: var(--box-background-color);+ border: 1px solid var(--box-border-color);+ border-radius: 20px;+ box-shadow: var(--shadow-pop);+ box-sizing: border-box;+ padding: 24px;+ z-index: 20;+ color: var(--text-color);+}++.subscription-details.is-open {+ display: block;+}++.subscription-details .hide {+ display: none !important;+}++.details-close {+ position: absolute;+ top: 14px;+ right: 14px;+ border: none;+ background-color: transparent;+ color: var(--text-muted);+ font-size: 20px;+ padding: 8px 10px;+ border-radius: 8px;+ cursor: pointer;+}++.details-close:hover {+ color: var(--text-color);+ background-color: var(--surface-hover);+}++.rtl .details-close {+ right: auto;+ left: 14px;+}++.details-hero {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: 14px;+}++.details-logo {+ flex-shrink: 0;+ display: flex;+ align-items: center;+}++.details-logo img {+ max-height: 48px;+ max-width: 130px;+ object-fit: contain;+}++.details-logo-fallback {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 48px;+ height: 48px;+ border-radius: 12px;+ background-color: rgba(var(--main-color-rgb), 0.12);+ color: var(--main-color);+ font-size: 22px;+ font-weight: 700;+}++.details-heading {+ min-width: 0;+ display: flex;+ flex-direction: row;+ justify-content: space-between;+ align-items: flex-start;+ gap: 12px;+ padding-right: 34px;+}++.rtl .details-heading {+ padding-right: 0px;+ padding-left: 34px;+}++.details-hero h3 {+ margin: 0px;+ font-size: 20px;+ font-weight: 600;+ overflow-wrap: anywhere;+}++.details-chips {+ display: flex;+ flex-direction: column;+ align-items: flex-end;+ gap: 6px;+ flex-shrink: 0;+}++.details-chip {+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ padding: 3px 9px;+ border-radius: 999px;+ background-color: rgba(var(--main-color-rgb), 0.12);+ color: var(--main-color);+}++.details-chip.warn {+ background-color: rgba(var(--error-color-rgb), 0.12);+ color: var(--error-color);+}++.details-chip.ok {+ background-color: rgba(var(--success-color-rgb), 0.14);+ color: var(--success-color);+}++.details-chip.manual {+ background-color: rgba(var(--warning-color-rgb), 0.15);+ color: var(--warning-color);+}++.details-chip.muted {+ background-color: rgba(var(--text-muted-rgb), 0.15);+ color: var(--text-muted);+}++.details-price-row {+ display: flex;+ flex-direction: row;+ align-items: baseline;+ gap: 8px;+ margin: 16px 0px 4px;+}++.details-price {+ font-size: 32px;+ font-weight: 700;+}++.details-cycle {+ font-size: 14px;+ color: var(--text-muted);+}++.details-price-row .details-action-button {+ align-self: center;+ height: auto;+ padding: 10px 12px;+ background-color: var(--box-background-color);+ color: var(--main-color);+ border-color: var(--input-border-color);+ box-shadow: none;+}++.details-price-row .details-action-button:hover {+ background-color: var(--surface-hover);+ color: var(--hover-color);+ border-color: var(--main-color);+ box-shadow: none;+}++.details-price-row .details-export-button {+ margin-inline-start: auto;+}++.details-progress-track {+ display: block;+ height: 6px;+ border-radius: 3px;+ background-color: rgba(var(--main-color-rgb), 0.12);+ margin: 10px 0px 6px;+ overflow: hidden;+}++.details-progress {+ display: block;+ height: 100%;+ border-radius: 3px;+ background: linear-gradient(90deg, var(--accent-color), var(--main-color));+ width: 0%;+ transition: width 0.4s ease;+}++.details-grid {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 16px;+ margin: 0px;+ padding: 18px 0px;+ border-top: 1px solid var(--box-border-color);+ margin-top: 16px;+}++.details-item dt {+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.07em;+ text-transform: uppercase;+ color: var(--text-muted);+ margin-bottom: 4px;+}++.details-item dd {+ margin: 0px;+ font-size: 15px;+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 8px;+ overflow-wrap: anywhere;+}++#details-payment-method img {+ width: 30px;+ height: 20px;+ object-fit: contain;+ flex-shrink: 0;+}++.details-notes {+ display: flex;+ flex-direction: row;+ align-items: flex-start;+ gap: 10px;+ background-color: var(--surface-hover);+ border-radius: 12px;+ padding: 12px 14px;+ font-size: 14px;+ margin-bottom: 16px;+ overflow-wrap: anywhere;+}++.details-notes i {+ color: var(--main-color);+ margin-top: 2px;+}++@media (max-width: 768px) {+ .subscription-details,+ .logo-search,+ .icon-search {+ left: 0px;+ right: 0px;+ top: auto;+ bottom: 0px;+ transform: none;+ width: 100%;+ max-width: none;+ max-height: 70dvh;+ border-radius: 20px 20px 0px 0px;+ border-bottom: none;+ padding: 22px 20px calc(22px + env(safe-area-inset-bottom));+ }++ .mobile-navigation .subscription-details {+ z-index: 20;+ }+}++.subscription-back {+ display: none;+}++.subscriptions.grid-view .subscription-container {+ perspective: 1400px;+ background-color: transparent;+ box-shadow: none;+}++.subscriptions.grid-view .subscription-container>.subscription-progress-container {+ transition: opacity 0.3s;+}++.subscriptions.grid-view .subscription-container:has(.subscription.flipped)>.subscription-progress-container {+ opacity: 0;+}++.subscriptions.grid-view .subscription {+ transform-style: preserve-3d;+ transition: transform 0.55s cubic-bezier(0.45, 0.05, 0.2, 1.05), border-color 0.2s, box-shadow 0.2s;+}++.subscriptions.grid-view .subscription.flipped {+ transform: rotateY(180deg);+}++.rtl .subscriptions.grid-view .subscription.flipped {+ transform: rotateY(-180deg);+}++.subscriptions.grid-view .subscription>.subscription-main {+ -webkit-backface-visibility: hidden;+ backface-visibility: hidden;+}++.subscriptions.grid-view .subscription-back {+ display: flex;+ flex-direction: column;+ justify-content: center;+ gap: 2px;+ position: absolute;+ inset: 0;+ transform: rotateY(180deg);+ -webkit-backface-visibility: hidden;+ backface-visibility: hidden;+ background-color: var(--box-background-color);+ border-radius: inherit;+ padding: 14px 12px;+ box-sizing: border-box;+ overflow-y: auto;+}++.rtl .subscriptions.grid-view .subscription-back {+ transform: rotateY(-180deg);+}++.subscriptions.grid-view .subscription.flipped .subscription-back {+ z-index: 1;+}++.subscription-back .back-action {+ display: flex;+ flex-direction: row;+ align-items: center;+ gap: 10px;+ width: 100%;+ border: none;+ background-color: transparent;+ color: var(--text-color);+ font-family: Barlow, 'Helvetica Neue', Helvetica, sans-serif;+ font-size: 14px;+ font-weight: 500;+ text-align: start;+ padding: 10px 12px;+ border-radius: 8px;+ cursor: pointer;+ box-sizing: border-box;+}++.subscription-back .back-action:hover {+ background-color: var(--surface-hover);+}++.subscription-back .back-action>i {+ color: var(--main-color);+ font-size: 14px;+ width: 18px;+ text-align: center;+}++.subscription-back .back-action.delete:hover {+ background-color: rgba(var(--error-color-rgb), 0.1);+}++.subscription-back .back-action.delete:hover>i {+ color: var(--error-color);+}++.subscription-back-close {+ position: absolute;+ top: 8px;+ right: 8px;+ border: none;+ background-color: transparent;+ color: var(--text-muted);+ font-size: 16px;+ padding: 6px 9px;+ border-radius: 8px;+ cursor: pointer;+}++.rtl .subscription-back-close {+ right: auto;+ left: 8px;+}++.subscription-back-close:hover {+ color: var(--text-color);+ background-color: var(--surface-hover);+}++@media (prefers-reduced-motion: reduce) {+ .subscriptions.grid-view .subscription {+ transition: border-color 0.2s, box-shadow 0.2s;+ }+}++@media (max-width: 768px) {+ .subscriptions.grid-view .subscription-back {+ padding: 10px 8px;+ }++ .subscription-back .back-action {+ font-size: 13px;+ padding: 7px 10px;+ gap: 8px;+ }+}++.stats-section {+ margin-top: 36px;+}++.stats-section>h2 {+ font-size: 14px;+ font-weight: 600;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--text-muted);+ margin: 0px 0px 14px;+ padding-bottom: 10px;+ border-bottom: 1px solid var(--box-border-color);+}++.stats-section .statistics+.graphs,+.stats-section .statistics~.graphs {+ margin-top: 20px;+}++.api-usage {+ margin: 20px 0px;+}++.api-usage-label {+ display: flex;+ flex-direction: row;+ justify-content: space-between;+ font-size: 13px;+ color: var(--text-muted);+ margin-bottom: 6px;+}++.api-usage-track {+ display: block;+ height: 6px;+ border-radius: 3px;+ background-color: rgba(var(--main-color-rgb), 0.12);+ overflow: hidden;+}++.api-usage-fill {+ display: block;+ height: 100%;+ width: 0%;+ border-radius: 3px;+ background-color: var(--main-color);+ transition: width .3s ease;+}++.api-usage-fill.warn {+ background-color: var(--warning-color);+}++.api-usage-fill.danger {+ background-color: var(--error-color);+}diff --git a/styles/theme.css b/styles/theme.cssindex 243ad2c..5a934db 100644--- a/styles/theme.css+++ b/styles/theme.css@@ -1,46 +1,54 @@-:root {- --main-color: #007BFF;- --main-color-rgb: 0, 123, 255;- --accent-color: #8FBFFA;- --accent-color-rgb: 143, 191, 250;- --hover-color: #0056B3;- --hover-color-rgb: 0, 86, 179;- --error-color: #F45A40;- --error-color-rgb: 244, 90, 64;- --success-color: #188823;- --success-color-rgb: 24, 136, 35;- --background-color: #F5F5F5;- --background-color-rgb: 245, 245, 245;- --header-background-color: #FFFFFF;- --header-background-color-rgb: 255, 255, 255;- --box-background-color: #FFFFFF;- --box-background-color-rgb: 255, 255, 255;- --box-border-color: #EEEEEE;- --box-border-color-rgb: 238, 238, 238;- --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);- --text-color: #202020;- --text-color-rgb: 32, 32, 32;- --text-color-inverted: #FFFFFF;- --text-color-inverted-rgb: 255, 255, 255;- --input-background-color: #FFFFFF;- --input-background-color-rgb: 255, 255, 255;- --input-border-color: #CCCCCC;- --input-border-color-rgb: 204, 204, 204;- --input-disabled-background-color: #F5F5F5;- --input-disabled-background-color-rgb: 245, 245, 245;- --input-disabled-border-color: #F5F5F5;- --input-disabled-border-color-rgb: 245, 245, 245;- --negative-box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);-}--svg .main-color {- fill: var(--main-color);-}--svg .accent-color {- fill: var(--accent-color);-}--svg .text-color {- fill: #202020;-}\ No newline at end of file+:root {+ --main-color: #2563EB;+ --main-color-rgb: 37, 99, 235;+ --accent-color: #93C5FD;+ --accent-color-rgb: 147, 197, 253;+ --hover-color: #1D4ED8;+ --hover-color-rgb: 29, 78, 216;+ --error-color: #EF4444;+ --error-color-rgb: 239, 68, 68;+ --success-color: #16A34A;+ --success-color-rgb: 22, 163, 74;+ --warning-color: #B45309;+ --warning-color-rgb: 180, 83, 9;+ --background-color: #F2F4F8;+ --background-color-rgb: 242, 244, 248;+ --header-background-color: #FFFFFF;+ --header-background-color-rgb: 255, 255, 255;+ --box-background-color: #FFFFFF;+ --box-background-color-rgb: 255, 255, 255;+ --box-border-color: #E7EAF0;+ --box-border-color-rgb: 231, 234, 240;+ --box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -18px rgba(15, 23, 42, 0.18);+ --text-color: #1C2434;+ --text-color-rgb: 28, 36, 52;+ --text-color-inverted: #FFFFFF;+ --text-color-inverted-rgb: 255, 255, 255;+ --input-background-color: #FFFFFF;+ --input-background-color-rgb: 255, 255, 255;+ --input-border-color: #D7DCE5;+ --input-border-color-rgb: 215, 220, 229;+ --input-disabled-background-color: #F2F4F8;+ --input-disabled-background-color-rgb: 242, 244, 248;+ --input-disabled-border-color: #E7EAF0;+ --input-disabled-border-color-rgb: 231, 234, 240;+ --negative-box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);+ --surface-hover: #F3F5F9;+ --surface-hover-rgb: 243, 245, 249;+ --text-muted: #64748B;+ --text-muted-rgb: 100, 116, 139;+ --shadow-pop: 0 2px 6px rgba(15, 23, 42, 0.08), 0 16px 40px -16px rgba(15, 23, 42, 0.28);+ --focus-ring: 0 0 0 3px rgba(var(--main-color-rgb), 0.18);+}++svg .main-color {+ fill: var(--main-color);+}++svg .accent-color {+ fill: var(--accent-color);+}++svg .text-color {+ fill: #1C2434;+}diff --git a/subscriptions.php b/subscriptions.phpindex 300b1e8..4dea601 100644--- a/subscriptions.php+++ b/subscriptions.php@@ -146,6 +146,8 @@ if ($sortOrder == "payment_method_id") {}$headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden";++$subscriptionsView = (isset($_COOKIE['subscriptionsView']) && $_COOKIE['subscriptionsView'] === 'grid') ? 'grid' : 'list';?><style>.logo-preview:after {@@ -160,6 +162,10 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden<?= translate('new_subscription', $i18n) ?></button><div class="top-actions">+ <button class="button secondary-button mobile-search-toggle" id="mobile-search-toggle"+ title="<?= translate('search', $i18n) ?>" onClick="toggleMobileSearch()">+ <i class="fa-solid fa-magnifying-glass"></i>+ </button><div class="search"><input type="text" autocomplete="off" name="search" id="search" placeholder="<?= translate('search', $i18n) ?>"onkeyup="searchSubscriptions()" />@@ -181,9 +187,20 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden</button><?php include 'includes/sort_options.php'; ?></div>++ <div class="view-toggle" id="view-toggle">+ <button type="button" class="view-toggle-button<?= $subscriptionsView === 'list' ? ' selected' : '' ?>"+ id="view-list-button" title="<?= translate('list_view', $i18n) ?>" onClick="setSubscriptionsView('list')">+ <i class="fa-solid fa-list"></i>+ </button>+ <button type="button" class="view-toggle-button<?= $subscriptionsView === 'grid' ? ' selected' : '' ?>"+ id="view-grid-button" title="<?= translate('grid_view', $i18n) ?>" onClick="setSubscriptionsView('grid')">+ <i class="fa-solid fa-table-cells-large"></i>+ </button>+ </div></div></header>- <div class="subscriptions" id="subscriptions">+ <div class="subscriptions<?= $subscriptionsView === 'grid' ? ' grid-view' : '' ?>" id="subscriptions"><?php$formatter = new IntlDateFormatter('en', // Force English locale@@ -254,6 +271,18 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hiddenif (isset($print)) {printSubscriptions($print, $sort, $categories, $members, $i18n, $colorTheme, "", $settings['disabledToBottom'], $settings['mobileNavigation'], $settings['showSubscriptionProgress'], $currencies, $lang);}++ $googleSearchEnabled = false;+ if ($db->querySingle("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='google_search'") > 0) {+ $googleSearchStmt = $db->prepare("SELECT COUNT(*) AS count FROM google_search WHERE user_id = :userId AND api_key != ''");+ $googleSearchStmt->bindValue(':userId', $userId, SQLITE3_INTEGER);+ $googleSearchResult = $googleSearchStmt->execute();+ if ($googleSearchResult) {+ $googleSearchRow = $googleSearchResult->fetchArray(SQLITE3_ASSOC);+ $googleSearchEnabled = $googleSearchRow && $googleSearchRow['count'] > 0;+ }+ }+$db->close();if (count($subscriptions) == 0) {@@ -296,10 +325,15 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden<i class="fa-solid fa-magnifying-glass"></i></div><input type="hidden" id="id" name="id">- <div id="logo-search-results" class="logo-search">+ <div class="logo-search-backdrop" id="logo-search-backdrop" onClick="closeLogoSearch()"></div>+ <div id="logo-search-results" class="logo-search"<?= !empty($googleSearchEnabled) ? ' data-google-search="1"' : '' ?>>+ <button type="button" class="close-logo-search" onClick="closeLogoSearch()" title="<?= translate('cancel', $i18n) ?>">+ <i class="fa-solid fa-xmark"></i>+ </button><header>- <?= translate('web_search', $i18n) ?>- <span class="fa-solid fa-xmark close-logo-search" onClick="closeLogoSearch()"></span>+ <h3 id="logo-search-title" data-title="<?= translate('web_search', $i18n) ?>">+ <?= translate('web_search', $i18n) ?>+ </h3></header><div id="logo-search-images"></div></div>@@ -511,6 +545,8 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden</div></form></section>++<?php require_once 'includes/subscription_details_popup.php'; ?><script src="scripts/subscriptions.js?<?= $version ?>"></script><?phpif (isset($_GET['add'])) {diff --git a/totp.php b/totp.phpindex c3b8caf..a9d0895 100644--- a/totp.php+++ b/totp.php@@ -165,7 +165,7 @@ if (isset($_POST['one-time-code'])) {<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" id="theme-color" /><meta name="apple-mobile-web-app-title" content="Wallos"><title>Wallos - Subscription Tracker</title><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">@@ -187,10 +187,25 @@ if (isset($_POST['one-time-code'])) {window.color_theme = "<?= $colorTheme ?>";</script><script type="text/javascript" src="scripts/login.js?<?= $version ?>"></script>+ <script type="text/javascript" src="scripts/auth-theme.js?<?= $version ?>"></script></head><body class="<?= $languages[$lang]['dir'] ?>">- <div class="content">+ <button type="button" class="theme-toggle" id="theme-toggle" title="<?= translate('theme', $i18n) ?>"+ aria-label="<?= translate('theme', $i18n) ?>">+ <i class="fa-solid <?= $theme == "dark" ? "fa-sun" : "fa-moon" ?>"></i>+ </button>+ <div class="content auth-split">+ <aside class="auth-brand" aria-hidden="true">+ <div class="auth-brand-logo">+ <?php include "images/siteicons/svg/logo.php"; ?>+ </div>+ <div class="auth-brand-text">+ <h1><?= translate('auth_tagline', $i18n) ?></h1>+ <p><?= translate('auth_tagline_sub', $i18n) ?></p>+ </div>+ <div class="auth-brand-footer">Wallos — Subscription Tracker</div>+ </aside><section class="container"><header><div class="logo-image" title="Wallos - Subscription Tracker">@@ -225,4 +240,4 @@ if (isset($_POST['one-time-code'])) {</div></body>-</html>\ No newline at end of file+</html>\ No newline at end of filediff --git a/verifyemail.php b/verifyemail.phpindex 73ef3ee..883f04d 100644--- a/verifyemail.php+++ b/verifyemail.php@@ -84,7 +84,7 @@ if (isset($_GET['email']) && isset($_GET['token'])) {<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">- <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" />+ <meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#12151C" ?>" /><meta name="apple-mobile-web-app-title" content="Wallos"><title>Wallos - Subscription Tracker</title><link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">@@ -101,10 +101,25 @@ if (isset($_GET['email']) && isset($_GET['token'])) {<link rel="stylesheet" href="styles/font-awesome.min.css"><link rel="stylesheet" href="styles/barlow.css"><link rel="stylesheet" href="styles/login-dark-theme.css?<?= $version ?>" id="dark-theme" <?= $theme == "light" ? "disabled" : "" ?>>+ <script type="text/javascript" src="scripts/auth-theme.js?<?= $version ?>"></script></head><body class="<?= $languages[$lang]['dir'] ?>">- <div class="content">+ <button type="button" class="theme-toggle" id="theme-toggle" title="<?= translate('theme', $i18n) ?>"+ aria-label="<?= translate('theme', $i18n) ?>">+ <i class="fa-solid <?= $theme == "dark" ? "fa-sun" : "fa-moon" ?>"></i>+ </button>+ <div class="content auth-split">+ <aside class="auth-brand" aria-hidden="true">+ <div class="auth-brand-logo">+ <?php include "images/siteicons/svg/logo.php"; ?>+ </div>+ <div class="auth-brand-text">+ <h1><?= translate('auth_tagline', $i18n) ?></h1>+ <p><?= translate('auth_tagline_sub', $i18n) ?></p>+ </div>+ <div class="auth-brand-footer">Wallos — Subscription Tracker</div>+ </aside><section class="container"><header><div class="logo-image" title="Wallos - Subscription Tracker">@@ -131,4 +146,4 @@ if (isset($_GET['email']) && isset($_GET['token'])) {</div></body>-</html>\ No newline at end of file+</html>\ No newline at end of file