diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 78123dbd85..1e39f98e65 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -51,7 +51,7 @@ class NetWorth implements NetWorthInterface private CurrencyRepositoryInterface $currencyRepos; private User $user; - private null|UserGroup $userGroup; + private ?UserGroup $userGroup; /** * This method collects the user's net worth in ALL the user's currencies diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index 749b3f6bf3..fa3ed47409 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -39,7 +39,7 @@ class RemoteUserGuard implements Guard { protected Application $application; protected UserProvider $provider; - protected null|User $user; + protected ?User $user; /** * Create a new authentication guard. diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index 55dbbb1c2b..c507e9478b 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -41,7 +41,7 @@ class RemoteUserProvider implements UserProvider * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function retrieveByCredentials(array $credentials): null|Authenticatable + public function retrieveByCredentials(array $credentials): ?Authenticatable { app('log')->debug(sprintf('Now at %s', __METHOD__)); @@ -88,7 +88,7 @@ class RemoteUserProvider implements UserProvider * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function retrieveByToken($identifier, $token): null|Authenticatable + public function retrieveByToken($identifier, $token): ?Authenticatable { app('log')->debug(sprintf('Now at %s', __METHOD__)); diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 8072d178f3..891fcc6163 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -645,7 +645,7 @@ class FireflyValidator extends Validator /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function validateUniqueCurrencyCode(null|string $attribute, null|string $value): bool + public function validateUniqueCurrencyCode(?string $attribute, ?string $value): bool { return $this->validateUniqueCurrency('code', (string)$attribute, (string)$value); } @@ -658,12 +658,12 @@ class FireflyValidator extends Validator return 0 === \DB::table('transaction_currencies')->where($field, $value)->whereNull('deleted_at')->count(); } - public function validateUniqueCurrencyName(null|string $attribute, null|string $value): bool + public function validateUniqueCurrencyName(?string $attribute, ?string $value): bool { return $this->validateUniqueCurrency('name', (string)$attribute, (string)$value); } - public function validateUniqueCurrencySymbol(null|string $attribute, null|string $value): bool + public function validateUniqueCurrencySymbol(?string $attribute, ?string $value): bool { return $this->validateUniqueCurrency('symbol', (string)$attribute, (string)$value); } diff --git a/composer.lock b/composer.lock index 69b9a33f5c..b85e00e848 100644 --- a/composer.lock +++ b/composer.lock @@ -2014,16 +2014,16 @@ }, { "name": "laravel/framework", - "version": "v10.45.1", + "version": "v10.46.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "dcf5d1d722b84ad38a5e053289130b6962f830bd" + "reference": "5e95946a8283a8d5c015035793f9c61c297e937f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/dcf5d1d722b84ad38a5e053289130b6962f830bd", - "reference": "dcf5d1d722b84ad38a5e053289130b6962f830bd", + "url": "https://api.github.com/repos/laravel/framework/zipball/5e95946a8283a8d5c015035793f9c61c297e937f", + "reference": "5e95946a8283a8d5c015035793f9c61c297e937f", "shasum": "" }, "require": { @@ -2216,7 +2216,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-02-21T14:07:36+00:00" + "time": "2024-02-27T16:46:54+00:00" }, { "name": "laravel/passport", @@ -2298,16 +2298,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.15", + "version": "v0.1.16", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "d814a27514d99b03c85aa42b22cfd946568636c1" + "reference": "ca6872ab6aec3ab61db3a61f83a6caf764ec7781" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/d814a27514d99b03c85aa42b22cfd946568636c1", - "reference": "d814a27514d99b03c85aa42b22cfd946568636c1", + "url": "https://api.github.com/repos/laravel/prompts/zipball/ca6872ab6aec3ab61db3a61f83a6caf764ec7781", + "reference": "ca6872ab6aec3ab61db3a61f83a6caf764ec7781", "shasum": "" }, "require": { @@ -2349,9 +2349,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.15" + "source": "https://github.com/laravel/prompts/tree/v0.1.16" }, - "time": "2023-12-29T22:37:42+00:00" + "time": "2024-02-21T19:25:27+00:00" }, { "name": "laravel/sanctum", @@ -4476,16 +4476,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.35", + "version": "3.0.36", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe" + "reference": "c2fb5136162d4be18fdd4da9980696f3aee96d7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4b1827beabce71953ca479485c0ae9c51287f2fe", - "reference": "4b1827beabce71953ca479485c0ae9c51287f2fe", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c2fb5136162d4be18fdd4da9980696f3aee96d7b", + "reference": "c2fb5136162d4be18fdd4da9980696f3aee96d7b", "shasum": "" }, "require": { @@ -4566,7 +4566,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.35" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.36" }, "funding": [ { @@ -4582,7 +4582,7 @@ "type": "tidelift" } ], - "time": "2023-12-29T01:59:53+00:00" + "time": "2024-02-26T05:13:14+00:00" }, { "name": "pragmarx/google2fa", @@ -6028,16 +6028,16 @@ }, { "name": "symfony/console", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e" + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", + "url": "https://api.github.com/repos/symfony/console/zipball/0d9e4eb5ad413075624378f474c4167ea202de78", + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78", "shasum": "" }, "require": { @@ -6102,7 +6102,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.3" + "source": "https://github.com/symfony/console/tree/v6.4.4" }, "funding": [ { @@ -6118,7 +6118,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/css-selector", @@ -6254,16 +6254,16 @@ }, { "name": "symfony/error-handler", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6" + "reference": "c725219bdf2afc59423c32793d5019d2a904e13a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/6dc3c76a278b77f01d864a6005d640822c6f26a6", - "reference": "6dc3c76a278b77f01d864a6005d640822c6f26a6", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c725219bdf2afc59423c32793d5019d2a904e13a", + "reference": "c725219bdf2afc59423c32793d5019d2a904e13a", "shasum": "" }, "require": { @@ -6309,7 +6309,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.3" + "source": "https://github.com/symfony/error-handler/tree/v6.4.4" }, "funding": [ { @@ -6325,7 +6325,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:40:36+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/event-dispatcher", @@ -6549,16 +6549,16 @@ }, { "name": "symfony/http-client", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "3d2605c07cd14aec294f72f5bf8147702f7a5ada" + "reference": "8384876f49a2316a63f88a9cd12436de6936bee6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/3d2605c07cd14aec294f72f5bf8147702f7a5ada", - "reference": "3d2605c07cd14aec294f72f5bf8147702f7a5ada", + "url": "https://api.github.com/repos/symfony/http-client/zipball/8384876f49a2316a63f88a9cd12436de6936bee6", + "reference": "8384876f49a2316a63f88a9cd12436de6936bee6", "shasum": "" }, "require": { @@ -6621,7 +6621,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.0.3" + "source": "https://github.com/symfony/http-client/tree/v7.0.4" }, "funding": [ { @@ -6637,7 +6637,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:41:16+00:00" + "time": "2024-02-15T11:33:06+00:00" }, { "name": "symfony/http-client-contracts", @@ -6719,16 +6719,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9" + "reference": "ebc713bc6e6f4b53f46539fc158be85dfcd77304" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5677bdf7cade4619cb17fc9e1e7b31ec392244a9", - "reference": "5677bdf7cade4619cb17fc9e1e7b31ec392244a9", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ebc713bc6e6f4b53f46539fc158be85dfcd77304", + "reference": "ebc713bc6e6f4b53f46539fc158be85dfcd77304", "shasum": "" }, "require": { @@ -6776,7 +6776,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.3" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.4" }, "funding": [ { @@ -6792,20 +6792,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-08T15:01:18+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2" + "reference": "7a186f64a7f02787c04e8476538624d6aa888e42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9c6ec4e543044f7568a53a76ab1484ecd30637a2", - "reference": "9c6ec4e543044f7568a53a76ab1484ecd30637a2", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7a186f64a7f02787c04e8476538624d6aa888e42", + "reference": "7a186f64a7f02787c04e8476538624d6aa888e42", "shasum": "" }, "require": { @@ -6854,7 +6854,7 @@ "symfony/process": "^5.4|^6.0|^7.0", "symfony/property-access": "^5.4.5|^6.0.5|^7.0", "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.3|^7.0", + "symfony/serializer": "^6.4.4|^7.0.4", "symfony/stopwatch": "^5.4|^6.0|^7.0", "symfony/translation": "^5.4|^6.0|^7.0", "symfony/translation-contracts": "^2.5|^3", @@ -6889,7 +6889,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.3" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.4" }, "funding": [ { @@ -6905,20 +6905,20 @@ "type": "tidelift" } ], - "time": "2024-01-31T07:21:29+00:00" + "time": "2024-02-27T06:32:13+00:00" }, { "name": "symfony/mailer", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "74412c62f88a85a41b61f0b71ab0afcaad6f03ee" + "reference": "791c5d31a8204cf3db0c66faab70282307f4376b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/74412c62f88a85a41b61f0b71ab0afcaad6f03ee", - "reference": "74412c62f88a85a41b61f0b71ab0afcaad6f03ee", + "url": "https://api.github.com/repos/symfony/mailer/zipball/791c5d31a8204cf3db0c66faab70282307f4376b", + "reference": "791c5d31a8204cf3db0c66faab70282307f4376b", "shasum": "" }, "require": { @@ -6969,7 +6969,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.3" + "source": "https://github.com/symfony/mailer/tree/v6.4.4" }, "funding": [ { @@ -6985,20 +6985,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:01:07+00:00" + "time": "2024-02-03T21:33:47+00:00" }, { "name": "symfony/mailgun-mailer", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/mailgun-mailer.git", - "reference": "fa7d03eb374938cb1f7a04c17a11a0e969e38cb8" + "reference": "96df0d3815dc72367ecc38c4a82d8021f8bddd4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/fa7d03eb374938cb1f7a04c17a11a0e969e38cb8", - "reference": "fa7d03eb374938cb1f7a04c17a11a0e969e38cb8", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/96df0d3815dc72367ecc38c4a82d8021f8bddd4e", + "reference": "96df0d3815dc72367ecc38c4a82d8021f8bddd4e", "shasum": "" }, "require": { @@ -7038,7 +7038,7 @@ "description": "Symfony Mailgun Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailgun-mailer/tree/v7.0.3" + "source": "https://github.com/symfony/mailgun-mailer/tree/v7.0.4" }, "funding": [ { @@ -7054,7 +7054,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:41:16+00:00" + "time": "2024-02-15T11:33:06+00:00" }, { "name": "symfony/mime", @@ -7853,16 +7853,16 @@ }, { "name": "symfony/process", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "31642b0818bfcff85930344ef93193f8c607e0a3" + "reference": "710e27879e9be3395de2b98da3f52a946039f297" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/31642b0818bfcff85930344ef93193f8c607e0a3", - "reference": "31642b0818bfcff85930344ef93193f8c607e0a3", + "url": "https://api.github.com/repos/symfony/process/zipball/710e27879e9be3395de2b98da3f52a946039f297", + "reference": "710e27879e9be3395de2b98da3f52a946039f297", "shasum": "" }, "require": { @@ -7894,7 +7894,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.3" + "source": "https://github.com/symfony/process/tree/v6.4.4" }, "funding": [ { @@ -7910,7 +7910,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-20T12:31:00+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -8168,16 +8168,16 @@ }, { "name": "symfony/string", - "version": "v7.0.3", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "524aac4a280b90a4420d8d6a040718d0586505ac" + "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/524aac4a280b90a4420d8d6a040718d0586505ac", - "reference": "524aac4a280b90a4420d8d6a040718d0586505ac", + "url": "https://api.github.com/repos/symfony/string/zipball/f5832521b998b0bec40bee688ad5de98d4cf111b", + "reference": "f5832521b998b0bec40bee688ad5de98d4cf111b", "shasum": "" }, "require": { @@ -8234,7 +8234,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.0.3" + "source": "https://github.com/symfony/string/tree/v7.0.4" }, "funding": [ { @@ -8250,20 +8250,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T15:41:16+00:00" + "time": "2024-02-01T13:17:36+00:00" }, { "name": "symfony/translation", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "637c51191b6b184184bbf98937702bcf554f7d04" + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", - "reference": "637c51191b6b184184bbf98937702bcf554f7d04", + "url": "https://api.github.com/repos/symfony/translation/zipball/bce6a5a78e94566641b2594d17e48b0da3184a8e", + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e", "shasum": "" }, "require": { @@ -8329,7 +8329,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.3" + "source": "https://github.com/symfony/translation/tree/v6.4.4" }, "funding": [ { @@ -8345,7 +8345,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T13:11:52+00:00" + "time": "2024-02-20T13:16:58+00:00" }, { "name": "symfony/translation-contracts", @@ -8501,16 +8501,16 @@ }, { "name": "symfony/var-dumper", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0435a08f69125535336177c29d56af3abc1f69da" + "reference": "b439823f04c98b84d4366c79507e9da6230944b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0435a08f69125535336177c29d56af3abc1f69da", - "reference": "0435a08f69125535336177c29d56af3abc1f69da", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b439823f04c98b84d4366c79507e9da6230944b1", + "reference": "b439823f04c98b84d4366c79507e9da6230944b1", "shasum": "" }, "require": { @@ -8566,7 +8566,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.3" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.4" }, "funding": [ { @@ -8582,7 +8582,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:53:30+00:00" + "time": "2024-02-15T11:23:52+00:00" }, { "name": "therobfonz/laravel-mandrill-driver", @@ -9551,16 +9551,16 @@ }, { "name": "larastan/larastan", - "version": "v2.9.0", + "version": "v2.9.1", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "35fa9cbe1895e76215bbe74571a344f2705fbe01" + "reference": "467113c58d110ad617cf9e07ff49b0948d1c03cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/35fa9cbe1895e76215bbe74571a344f2705fbe01", - "reference": "35fa9cbe1895e76215bbe74571a344f2705fbe01", + "url": "https://api.github.com/repos/larastan/larastan/zipball/467113c58d110ad617cf9e07ff49b0948d1c03cc", + "reference": "467113c58d110ad617cf9e07ff49b0948d1c03cc", "shasum": "" }, "require": { @@ -9628,7 +9628,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v2.9.0" + "source": "https://github.com/larastan/larastan/tree/v2.9.1" }, "funding": [ { @@ -9648,7 +9648,7 @@ "type": "patreon" } ], - "time": "2024-02-13T11:49:22+00:00" + "time": "2024-02-26T14:10:20+00:00" }, { "name": "maximebf/debugbar", diff --git a/package-lock.json b/package-lock.json index dcad70aa4b..5279b819a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,9 +61,9 @@ "integrity": "sha512-Q44beV3vD1jydB0smro9+nJY9g60uSjQ+cM8cHEIS9gDCG/37WiabdtQybJceeIHbne51MJPtOAa89y/TfnbQg==" }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -547,14 +547,14 @@ } }, "node_modules/chart.js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz", - "integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==", + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.2.tgz", + "integrity": "sha512-6GD7iKwFpP5kbSD4MeRRRlTnQvxfQREy36uEtm1hzHzcOqwWx0YEHuspuoNlslu+nciLIB7fjjsHkUv/FzFcOg==", "dependencies": { "@kurkle/color": "^0.3.0" }, "engines": { - "pnpm": ">=7" + "pnpm": ">=8" } }, "node_modules/chartjs-adapter-date-fns": { diff --git a/public/build/assets/create-865d3a86.js b/public/build/assets/create-5a4939e8.js similarity index 97% rename from public/build/assets/create-865d3a86.js rename to public/build/assets/create-5a4939e8.js index 0e79c5a472..0b024e21c1 100644 --- a/public/build/assets/create-865d3a86.js +++ b/public/build/assets/create-5a4939e8.js @@ -1 +1 @@ -import{a as m,d as y,f as d}from"./format-money-0eadc9a5.js";import{d as w,c as b}from"./create-empty-split-224dd5cc.js";import{l as v,a as T,b as C,c as P,p as E,d as _,s as L,e as c,f as S,g as D,h as A,i as x,j as k,k as h,m as p}from"./splice-errors-into-transactions-cff36293.js";import{l,i as r,m as B}from"./vendor-29d868f9.js";import"./get-eb14a1e7.js";class M{post(t){let s="/api/v2/transactions";return m.post(s,t)}}let n=[],u=[];document.addEventListener("location-remove",e=>{u[e.detail.index].remove()});function O(e){let t=0;if(document.querySelector("#form")._x_dataStack[0].$data.entries[t].hasLocation===!1){u[t]=new l.marker(e.latlng,{draggable:!0}),u[t].on("dragend",U),u[t].addTo(n[t]);const o=new CustomEvent("location-set",{detail:{latitude:e.latlng.lat,longitude:e.latlng.lng,index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(o)}}function F(e){let t=0;const s=new CustomEvent("location-zoom",{detail:{index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(s)}function U(e){let t=e.target,s=t.getLatLng();t.setLatLng(new l.LatLng(s.lat,s.lng),{draggable:"true"});const o=new CustomEvent("location-move",{detail:{latitude:s.lat,longitude:s.lng,index:0}});document.dispatchEvent(o)}function z(e){if(e>0){console.warn("Corwardly refuse to add a map on split #"+(e+1));return}if(typeof n[e]>"u"){let t=document.getElementById("location_map");t&&(n[e]=l.map(t).setView([t.dataset.latitude,t.dataset.longitude],t.dataset.zoomLevel),l.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(n[e]),n[e].on("click",O),n[e].on("zoomend",F))}}const a=k();let I=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"create",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},changedDateTime(e){console.warn("changedDateTime, event is not used")},changedDescription(e){console.warn("changedDescription, event is not used")},changedDestinationAccount(e){this.detectTransactionType()},changedSourceAccount(e){this.detectTransactionType()},detectTransactionType(){const e=this.entries[0].source_account.type??"unknown",t=this.entries[0].destination_account.type??"unknown";if(e==="unknown"&&t==="unknown"){this.groupProperties.transactionType="unknown",console.warn("Cannot infer transaction type from two unknown accounts.");return}if(e===t&&["Asset account","Loan","Debt","Mortgage"].includes(e)){this.groupProperties.transactionType="transfer",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log("filter down currencies for transfer."),this.filterNativeCurrencies(this.entries[0].source_account.currency_code),this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);return}if(e==="Asset account"&&["Expense account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="withdrawal",console.log('[a] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Asset account"&&t==="unknown"){this.groupProperties.transactionType="withdrawal",console.log('[b] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log(this.entries[0].source_account),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Expense account"){this.groupProperties.transactionType="withdrawal",console.log('[c] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Revenue account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(e==="unknown"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(e==="Expense account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.warn('FORCE transaction type to be "'+this.groupProperties.transactionType+'".'),this.entries[0].source_account.id="";return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Asset account"){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}console.warn('Unknown account combination between "'+e+'" and "'+t+'".')},formattedTotalAmount(){return this.entries.length===0?d(this.groupProperties.totalAmount,"EUR"):d(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},filterForeignCurrencies(e){let t=[],s;for(let o in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(o)){let i=this.formData.enabledCurrencies[o];i.code===e&&(s=i)}t.push(s),this.formData.foreignCurrencies=t,t.length===1&&t[0].code===this.entries[0].source_account.currency_code&&(console.log("Foreign currency is same as source currency. Disable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!1),t.length===1&&t[0].code!==this.entries[0].source_account.currency_code&&(console.log("Foreign currency is NOT same as source currency. Enable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!0);for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].foreign_currency_code=e)},filterNativeCurrencies(e){let t=[],s;for(let o in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(o)){let i=this.formData.enabledCurrencies[o];i.code===e&&(s=i)}t.push(s),this.formData.nativeCurrencies=t;for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].currency_code=e)},changedAmount(e){const t=parseInt(e.target.dataset.index);this.entries[t].amount=parseFloat(e.target.value),this.groupProperties.totalAmount=0;for(let s in this.entries)this.entries.hasOwnProperty(s)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[s].amount))},addedSplit(){},processUpload(e){this.showMessageOrRedirectUser()},processUploadError(e){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_upload"),console.error(e)},init(){this.addSplit(),v().then(e=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=e.defaultCurrency,this.formData.enabledCurrencies=e.enabledCurrencies,this.formData.nativeCurrencies=e.nativeCurrencies,this.formData.foreignCurrencies=e.foreignCurrencies}),T().then(e=>{this.formData.budgets=e,this.formStates.loadingBudgets=!1}),C().then(e=>{this.formData.piggyBanks=e,this.formStates.loadingPiggyBanks=!1}),P().then(e=>{this.formData.subscriptions=e,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",e=>{this.processUpload(e),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",e=>{this.processUploadError(e)}),document.addEventListener("location-move",e=>{this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude}),document.addEventListener("location-set",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),document.addEventListener("location-zoom",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),this.filters.source=["Asset account","Loan","Debt","Mortgage","Revenue account"],this.filters.destination=["Expense account","Loan","Debt","Mortgage","Asset account"]},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].errors=w());this.formStates.isSubmitting=!0,this.detectTransactionType();let e=E(this.entries,null,this.groupProperties.transactionType),t={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:e};this.groupProperties.title===null&&e.length>1&&(t.group_title=e[0].description);let s=new M;console.log(t),s.post(t).then(o=>{const i=o.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,_(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(o=>{this.submitting=!1,console.log(o),typeof o.response<"u"&&this.parseErrors(o.response.data)})},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=r.t("firefly.stored_journal_js",{description:this.groupProperties.title}),this.formStates.resetButton&&(this.entries=[],this.addSplit(),this.groupProperties.totalAmount=0);return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=created"},parseErrors(e){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_submission_v2",{errorMessage:e.message}),e.hasOwnProperty("errors")&&(this.entries=L(e.errors,this.entries))},addSplit(){this.entries.push(b()),setTimeout(()=>{B.init("select.ac-tags",{allowClear:!0,server:a.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:r.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}});const e=this.entries.length-1;z(e);const t=function(s,o,i){return s.name_with_balance+'
'+r.t("firefly.account_type_"+s.type)+""};c({selector:"input.ac-source",serverUrl:a.account,onChange:S,onSelectItem:D,hiddenValue:this.entries[e].source_account.alpine_name}),c({selector:"input.ac-dest",serverUrl:a.account,filters:this.filters.destination,onRenderItem:t,onChange:A,onSelectItem:x}),c({selector:"input.ac-category",serverUrl:a.category,valueField:"id",labelField:"name",onChange:h,onSelectItem:h}),c({selector:"input.ac-description",serverUrl:a.description,valueField:"id",labelField:"description",onChange:p,onSelectItem:p})},150)},removeSplit(e){this.entries.splice(e,1),document.querySelector("#split-0-tab").click()},clearLocation(e){e.preventDefault();const t=e.currentTarget,s=parseInt(t.attributes["data-index"].value);this.entries[s].hasLocation=!1,this.entries[s].latitude=null,this.entries[s].longitude=null,this.entries[s].zoomLevel=null;const o=new CustomEvent("location-remove",{detail:{index:s}});return document.dispatchEvent(o),!1}}},g={transactions:I,dates:y};function f(){Object.keys(g).forEach(e=>{console.log(`Loading page component "${e}"`);let t=g[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),f()});window.bootstrapped&&(console.log("Loaded through window variable."),f()); +import{a as m,d as y,f as d}from"./format-money-2e5851ad.js";import{d as w,c as b}from"./create-empty-split-81f71b2e.js";import{l as v,a as T,b as C,c as P,p as E,d as _,s as L,e as c,f as S,g as D,h as A,i as x,j as k,k as h,m as p}from"./splice-errors-into-transactions-6727b386.js";import{l,i as r,m as B}from"./vendor-50e42c6c.js";import"./get-28b9aa25.js";class M{post(t){let s="/api/v2/transactions";return m.post(s,t)}}let n=[],u=[];document.addEventListener("location-remove",e=>{u[e.detail.index].remove()});function O(e){let t=0;if(document.querySelector("#form")._x_dataStack[0].$data.entries[t].hasLocation===!1){u[t]=new l.marker(e.latlng,{draggable:!0}),u[t].on("dragend",U),u[t].addTo(n[t]);const o=new CustomEvent("location-set",{detail:{latitude:e.latlng.lat,longitude:e.latlng.lng,index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(o)}}function F(e){let t=0;const s=new CustomEvent("location-zoom",{detail:{index:t,zoomLevel:n[t].getZoom()}});document.dispatchEvent(s)}function U(e){let t=e.target,s=t.getLatLng();t.setLatLng(new l.LatLng(s.lat,s.lng),{draggable:"true"});const o=new CustomEvent("location-move",{detail:{latitude:s.lat,longitude:s.lng,index:0}});document.dispatchEvent(o)}function z(e){if(e>0){console.warn("Corwardly refuse to add a map on split #"+(e+1));return}if(typeof n[e]>"u"){let t=document.getElementById("location_map");t&&(n[e]=l.map(t).setView([t.dataset.latitude,t.dataset.longitude],t.dataset.zoomLevel),l.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'© OpenStreetMap'}).addTo(n[e]),n[e].on("click",O),n[e].on("zoomend",F))}}const a=k();let I=function(){return{entries:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"create",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},filters:{source:[],destination:[]},changedDateTime(e){console.warn("changedDateTime, event is not used")},changedDescription(e){console.warn("changedDescription, event is not used")},changedDestinationAccount(e){this.detectTransactionType()},changedSourceAccount(e){this.detectTransactionType()},detectTransactionType(){const e=this.entries[0].source_account.type??"unknown",t=this.entries[0].destination_account.type??"unknown";if(e==="unknown"&&t==="unknown"){this.groupProperties.transactionType="unknown",console.warn("Cannot infer transaction type from two unknown accounts.");return}if(e===t&&["Asset account","Loan","Debt","Mortgage"].includes(e)){this.groupProperties.transactionType="transfer",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log("filter down currencies for transfer."),this.filterNativeCurrencies(this.entries[0].source_account.currency_code),this.filterForeignCurrencies(this.entries[0].destination_account.currency_code);return}if(e==="Asset account"&&["Expense account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="withdrawal",console.log('[a] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Asset account"&&t==="unknown"){this.groupProperties.transactionType="withdrawal",console.log('[b] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),console.log(this.entries[0].source_account),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Expense account"){this.groupProperties.transactionType="withdrawal",console.log('[c] Transaction type is detected to be "'+this.groupProperties.transactionType+'".'),this.filterNativeCurrencies(this.entries[0].source_account.currency_code);return}if(e==="Revenue account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(e==="unknown"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}if(e==="Expense account"&&["Asset account","Debt","Loan","Mortgage"].includes(t)){this.groupProperties.transactionType="deposit",console.warn('FORCE transaction type to be "'+this.groupProperties.transactionType+'".'),this.entries[0].source_account.id="";return}if(["Debt","Loan","Mortgage"].includes(e)&&t==="Asset account"){this.groupProperties.transactionType="deposit",console.log('Transaction type is detected to be "'+this.groupProperties.transactionType+'".');return}console.warn('Unknown account combination between "'+e+'" and "'+t+'".')},formattedTotalAmount(){return this.entries.length===0?d(this.groupProperties.totalAmount,"EUR"):d(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},filterForeignCurrencies(e){let t=[],s;for(let o in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(o)){let i=this.formData.enabledCurrencies[o];i.code===e&&(s=i)}t.push(s),this.formData.foreignCurrencies=t,t.length===1&&t[0].code===this.entries[0].source_account.currency_code&&(console.log("Foreign currency is same as source currency. Disable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!1),t.length===1&&t[0].code!==this.entries[0].source_account.currency_code&&(console.log("Foreign currency is NOT same as source currency. Enable foreign amount."),this.formBehaviour.foreignCurrencyEnabled=!0);for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].foreign_currency_code=e)},filterNativeCurrencies(e){let t=[],s;for(let o in this.formData.enabledCurrencies)if(this.formData.enabledCurrencies.hasOwnProperty(o)){let i=this.formData.enabledCurrencies[o];i.code===e&&(s=i)}t.push(s),this.formData.nativeCurrencies=t;for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].currency_code=e)},changedAmount(e){const t=parseInt(e.target.dataset.index);this.entries[t].amount=parseFloat(e.target.value),this.groupProperties.totalAmount=0;for(let s in this.entries)this.entries.hasOwnProperty(s)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[s].amount))},addedSplit(){},processUpload(e){this.showMessageOrRedirectUser()},processUploadError(e){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_upload"),console.error(e)},init(){this.addSplit(),v().then(e=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=e.defaultCurrency,this.formData.enabledCurrencies=e.enabledCurrencies,this.formData.nativeCurrencies=e.nativeCurrencies,this.formData.foreignCurrencies=e.foreignCurrencies}),T().then(e=>{this.formData.budgets=e,this.formStates.loadingBudgets=!1}),C().then(e=>{this.formData.piggyBanks=e,this.formStates.loadingPiggyBanks=!1}),P().then(e=>{this.formData.subscriptions=e,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",e=>{this.processUpload(e),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",e=>{this.processUploadError(e)}),document.addEventListener("location-move",e=>{this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude}),document.addEventListener("location-set",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].latitude=e.detail.latitude,this.entries[e.detail.index].longitude=e.detail.longitude,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),document.addEventListener("location-zoom",e=>{this.entries[e.detail.index].hasLocation=!0,this.entries[e.detail.index].zoomLevel=e.detail.zoomLevel}),this.filters.source=["Asset account","Loan","Debt","Mortgage","Revenue account"],this.filters.destination=["Expense account","Loan","Debt","Mortgage","Asset account"]},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let o in this.entries)this.entries.hasOwnProperty(o)&&(this.entries[o].errors=w());this.formStates.isSubmitting=!0,this.detectTransactionType();let e=E(this.entries,null,this.groupProperties.transactionType),t={group_title:this.groupProperties.title,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:e};this.groupProperties.title===null&&e.length>1&&(t.group_title=e[0].description);let s=new M;console.log(t),s.post(t).then(o=>{const i=o.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,_(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=r.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(o=>{this.submitting=!1,console.log(o),typeof o.response<"u"&&this.parseErrors(o.response.data)})},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=r.t("firefly.stored_journal_js",{description:this.groupProperties.title}),this.formStates.resetButton&&(this.entries=[],this.addSplit(),this.groupProperties.totalAmount=0);return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=created"},parseErrors(e){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=r.t("firefly.errors_submission_v2",{errorMessage:e.message}),e.hasOwnProperty("errors")&&(this.entries=L(e.errors,this.entries))},addSplit(){this.entries.push(b()),setTimeout(()=>{B.init("select.ac-tags",{allowClear:!0,server:a.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:r.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}});const e=this.entries.length-1;z(e);const t=function(s,o,i){return s.name_with_balance+'
'+r.t("firefly.account_type_"+s.type)+""};c({selector:"input.ac-source",serverUrl:a.account,onChange:S,onSelectItem:D,hiddenValue:this.entries[e].source_account.alpine_name}),c({selector:"input.ac-dest",serverUrl:a.account,filters:this.filters.destination,onRenderItem:t,onChange:A,onSelectItem:x}),c({selector:"input.ac-category",serverUrl:a.category,valueField:"id",labelField:"name",onChange:h,onSelectItem:h}),c({selector:"input.ac-description",serverUrl:a.description,valueField:"id",labelField:"description",onChange:p,onSelectItem:p})},150)},removeSplit(e){this.entries.splice(e,1),document.querySelector("#split-0-tab").click()},clearLocation(e){e.preventDefault();const t=e.currentTarget,s=parseInt(t.attributes["data-index"].value);this.entries[s].hasLocation=!1,this.entries[s].latitude=null,this.entries[s].longitude=null,this.entries[s].zoomLevel=null;const o=new CustomEvent("location-remove",{detail:{index:s}});return document.dispatchEvent(o),!1}}},g={transactions:I,dates:y};function f(){Object.keys(g).forEach(e=>{console.log(`Loading page component "${e}"`);let t=g[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),f()});window.bootstrapped&&(console.log("Loaded through window variable."),f()); diff --git a/public/build/assets/create-empty-split-224dd5cc.js b/public/build/assets/create-empty-split-81f71b2e.js similarity index 93% rename from public/build/assets/create-empty-split-224dd5cc.js rename to public/build/assets/create-empty-split-81f71b2e.js index 9c6b91474b..373ed83f6b 100644 --- a/public/build/assets/create-empty-split-224dd5cc.js +++ b/public/build/assets/create-empty-split-81f71b2e.js @@ -1 +1 @@ -import{f as n}from"./vendor-29d868f9.js";function e(){return{id:"",name:"",alpine_name:""}}function o(){return{description:[],amount:[],currency_code:[],foreign_amount:[],foreign_currency_code:[],source_account:[],destination_account:[],budget_id:[],category_name:[],piggy_bank_id:[],bill_id:[],tags:[],notes:[],internal_reference:[],external_url:[],latitude:[],longitude:[],zoom_level:[],date:[],interest_date:[],book_date:[],process_date:[],due_date:[],payment_date:[],invoice_date:[]}}function d(){let t=n(new Date,"yyyy-MM-dd HH:mm");return{description:"",amount:"",currency_code:"EUR",foreign_amount:"",foreign_currency_code:"",source_account:e(),destination_account:e(),budget_id:null,category_name:"",piggy_bank_id:null,bill_id:null,tags:[],notes:"",internal_reference:"",external_url:"",hasLocation:!1,latitude:null,longitude:null,zoomLevel:null,date:t,interest_date:"",book_date:"",process_date:"",due_date:"",payment_date:"",invoice_date:"",errors:o()}}export{d as c,o as d}; +import{f as n}from"./vendor-50e42c6c.js";function e(){return{id:"",name:"",alpine_name:""}}function o(){return{description:[],amount:[],currency_code:[],foreign_amount:[],foreign_currency_code:[],source_account:[],destination_account:[],budget_id:[],category_name:[],piggy_bank_id:[],bill_id:[],tags:[],notes:[],internal_reference:[],external_url:[],latitude:[],longitude:[],zoom_level:[],date:[],interest_date:[],book_date:[],process_date:[],due_date:[],payment_date:[],invoice_date:[]}}function d(){let t=n(new Date,"yyyy-MM-dd HH:mm");return{description:"",amount:"",currency_code:"EUR",foreign_amount:"",foreign_currency_code:"",source_account:e(),destination_account:e(),budget_id:null,category_name:"",piggy_bank_id:null,bill_id:null,tags:[],notes:"",internal_reference:"",external_url:"",hasLocation:!1,latitude:null,longitude:null,zoomLevel:null,date:t,interest_date:"",book_date:"",process_date:"",due_date:"",payment_date:"",invoice_date:"",errors:o()}}export{d as c,o as d}; diff --git a/public/build/assets/dashboard-79f411ba.js b/public/build/assets/dashboard-5f195194.js similarity index 98% rename from public/build/assets/dashboard-79f411ba.js rename to public/build/assets/dashboard-5f195194.js index e8b6d05518..821786ade0 100644 --- a/public/build/assets/dashboard-79f411ba.js +++ b/public/build/assets/dashboard-5f195194.js @@ -1 +1 @@ -import{a as O,f,g as v,P as bt,d as wt}from"./format-money-0eadc9a5.js";import{f as g,C as m,a as S,i as p,S as vt,F as mt,L as Ct,b as kt,A as Pt,B as Dt,T as xt,P as Ot,c as Mt,d as Ft,p as St,e as At,g as Bt,h as jt,j as Wt,k as It}from"./vendor-29d868f9.js";import{G as $t}from"./get-e91a7549.js";import{G as Vt,a as Kt}from"./get-eb14a1e7.js";class Lt{get(e,n,a){return O.get("/api/v2/summary/basic",{params:{start:e,end:n,code:a}})}}function P(t,e,n){const a=g(e,"y-MM-dd")+"_"+g(n,"y-MM-dd")+"_"+t;return console.log("getCacheKey: "+a),String(a)}let U=!1;const Et=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-boxes-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.boxData=r,this.generateOptions(this.boxData);return}new Lt().get(g(t,"yyyy-MM-dd"),g(e,"yyyy-MM-dd"),null).then(i=>{this.boxData=i.data,window.store.set(n,i.data),this.generateOptions(this.boxData)})},generateOptions(t){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let e={};for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];if(!a.hasOwnProperty("key"))continue;let r=a.key;if(this.autoConversion){if(r.startsWith("balance-in-native")){this.balanceBox.amounts.push(f(a.value,a.currency_code)),e.hasOwnProperty(a.currency_code)||(e[a.currency_code]="");continue}if(r.startsWith("spent-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-native")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-native")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}if(r.startsWith("net-worth-in-native")){this.netBox.net.push(f(a.value,a.currency_code));continue}}if(!this.autoConversion&&!r.endsWith("native")){if(r.startsWith("balance-in-")){this.balanceBox.amounts.push(f(a.value,a.currency_code));continue}if(r.startsWith("spent-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}r.startsWith("net-worth-in-")&&this.netBox.net.push(f(a.value,a.currency_code))}}for(let n in e)e.hasOwnProperty(n)&&this.balanceBox.subtitles.push(e[n]);this.loading=!1},loadBoxes(){if(this.loading!==!0){if(this.loading=!0,this.boxData===null){this.getFreshData();return}this.generateOptions(this.boxData),this.loading=!1}},init(){Promise.all([v("viewRange"),v("autoConversion",!1)]).then(t=>{U=!0,this.autoConversion=t[1],this.loadBoxes()}),window.store.observe("end",()=>{U&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",t=>{U&&(this.autoConversion=t,this.loadBoxes())})}});class Gt{put(e,n){let a="/api/v1/preferences/"+e;return O.put(a,{data:n})}}function Tt(t,e=null){window.store.set(t,e),new Gt().put(t,e).then(a=>{}).catch(()=>{new bt().post(t,e).then(r=>{})})}let Rt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/dashboard",{params:{start:a,end:r}})}expense(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/expense-dashboard",{params:{start:a,end:r}})}};class st{get(e,n){let a={date:g(n,"y-MM-dd").slice(0,10)};return n?O.get("/api/v2/accounts/"+e,{params:a}):O.get("/api/v2/accounts/"+e)}transactions(e,n){const a={page:n.page??1};return n.hasOwnProperty("start")&&(a.start=g(n.start,"y-MM-dd")),n.hasOwnProperty("end")&&(a.end=g(n.end,"y-MM-dd")),O.get("/api/v2/accounts/"+e+"/transactions",{params:a})}}function N(t){return t==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:t==="pie"?{type:"pie",data:{datasets:[]}}:t==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{}}}:t==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let q=new m("#36a2eb"),I=new m("#ff6384"),G=new m("#4bc0c0"),ft=new m("#ff9f40"),qt=new m("#9966ff"),Nt=new m("#ffcd56"),Yt=new m("#c9cbcf"),lt=0;window.theme==="dark"&&(I.darken(.3).desaturate(.3),G.darken(.3).desaturate(.3),q.darken(.3).desaturate(.3),ft.darken(.3).desaturate(.3));let z=[I,ft,q,G,qt,Nt,Yt,G];function j(t,e){let n={borderColor:I.rgbString(),backgroundColor:I.rgbString()},a;switch(t){default:let o=Math.floor(lt/2)%z.length;a=new m(z[o].rgbString()),a.lighten(.38),n={borderColor:z[o].hexString(),backgroundColor:a.hexString()};break;case"spent":a=new m(q.rgbString()),a.lighten(.38),n={borderColor:q.rgbString(),backgroundColor:a.rgbString()};break;case"left":a=new m(G.rgbString()),a.lighten(.38),n={borderColor:G.rgbString(),backgroundColor:a.rgbString()};break;case"overspent":a=new m(I.rgbString()),a.lighten(.22),n={borderColor:I.rgbString(),backgroundColor:a.rgbString()};break}return lt++,e==="border"?n.borderColor:e==="background"?n.backgroundColor:"#FF0000"}let A=[],$=null,H=null,J=!1;const Ut=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Tt("autoConversion",this.autoConversion)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){console.log(r),this.drawChart(this.generateOptions(r)),this.loading=!1;return}new Rt().dashboard(t,e,null).then(i=>{this.chartData=i.data,window.store.set(n,i.data),console.log(i.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(t){A=[];let e=N("line");for(let n=0;n0){this.loadingAccounts=!1;return}const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.accountList=r,this.loadingAccounts=!1;return}const o=10;let i=0,l=0,u=[];Promise.all([v("frontpageAccounts")]).then(d=>{i=d[0].length;for(let h in d[0]){let c=d[0];if(c.hasOwnProperty(h)){let _=c[h];new st().get(_,new Date(window.store.get("end"))).then(w=>{let C=w.data.data;const yt={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new st().transactions(C.id,yt).then(at=>{let nt=[];for(let B=0;B=o);B++){let M=at.data.data[B],rt={title:M.attributes.group_title===null?"":M.attributes.group_title,id:M.id,transactions:[]};for(let Y=0;YB.order-M.order),this.accountList=u,this.loadingAccounts=!1,window.store.set(n,u))})})}}})},init(){Promise.all([v("viewRange","1M"),v("autoConversion",!1),v("language","en_US")]).then(t=>{this.autoConversion=t[1],J=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{J&&(H=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{J&&(this.loadChart(),this.loadAccounts())})}});let zt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/budget/dashboard",{params:{start:a,end:r}})}},V=[],T=null,F=null,Z=!1;const Ht=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,F!==null){this.drawChart(this.generateOptions(F)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(T!==null){T.data.datasets=t.data.datasets,T.update();return}T=new S(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-budgets-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){F=r,this.drawChart(this.generateOptions(F)),this.loading=!1;return}new zt().dashboard(t,e,null).then(i=>{F=i.data,this.drawChart(this.generateOptions(F)),window.store.set(n,F),this.loading=!1})},generateOptions(t){V=[];let e=N("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(n){return n.label},label:function(n){let a=n.dataset.label||"";return a&&(a+=": "),a+" "+f(n.parsed.y,V[n.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:p.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:j("spent","background"),borderColor:j("spent","border")},{label:p.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:j("left","background"),borderColor:j("left","border")},{label:p.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:j("overspent","background"),borderColor:j("overspent","border")}]};for(const n in t)if(t.hasOwnProperty(n)){let a=t[n],r=a.label+" ("+a.currency_code+")";e.data.labels.push(r),this.autoConversion&&(V.push(a.native_currency_code),e.data.datasets[0].data.push(parseFloat(a.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.native_entries.left)),e.data.datasets[2].data.push(parseFloat(a.native_entries.overspent))),this.autoConversion||(V.push(a.currency_code),e.data.datasets[0].data.push(parseFloat(a.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.entries.left)),e.data.datasets[2].data.push(parseFloat(a.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(n){return f(n,V[0]??"EUR")}}}},e},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Z=!0,this.loading===!1&&this.loadChart()}),window.store.observe("end",()=>{Z&&this.loading===!1&&(F=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Z&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Jt{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/category/dashboard",{params:{start:a,end:r}})}}let ut=[],K=null,W=null,Q=!1;const Zt=()=>({loading:!1,autoConversion:!1,generateOptions(t){ut=[];let e=N("column"),n={};for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code),n.hasOwnProperty(i)||(n[i]={name:i,yAxisID:"",data:{}},ut.push(i))}for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code);for(const l in n)if(n.hasOwnProperty(l)){let u=0;i===l&&(u=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(u=parseFloat(o.native_amount),""+o.native_currency_code)),n[l].data.hasOwnProperty(o.label)&&(n[l].data[o.label]=n[l].data[o.label]+u),n[l].data.hasOwnProperty(o.label)||(n[l].data[o.label]=u)}e.data.labels.includes(o.label)||e.data.labels.push(o.label)}let a=0;for(const r in n){let o="y"+r,i={label:r,currency_code:r,yAxisID:o,data:[]};for(const l in n[r].data)i.data.push(n[r].data[l]);e.data.datasets.push(i),e.options.scales.hasOwnProperty(o)||(e.options.scales[o]={beginAtZero:!0,type:"linear",position:a===1?"right":"left",ticks:{callback:function(l,u,d){return f(l,r)}}},a++)}return e},drawChart(t){if(K!==null){K.options=t.options,K.data=t.data,K.update();return}K=new S(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-categories-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){W=r,this.drawChart(this.generateOptions(W)),this.loading=!1;return}new Jt().dashboard(t,e,null).then(i=>{W=i.data,this.drawChart(this.generateOptions(i.data)),window.store.set(n,W),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,W!==null){this.drawChart(this.generateOptions(W)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Q=!0,this.loadChart()}),window.store.observe("end",()=>{Q&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Q&&(this.autoConversion=t,this.loadChart())})}});S.register({SankeyController:vt,Flow:mt});const ct="dashboard-sankey-data";let X=!1,R=null,D=[],y=!1,s={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const dt=function(t){return t.includes(s.revenue_account)?"forestgreen":t.includes("("+s.in+",")?"green":t.includes(s.budget)||t.includes(s.unknown_budget)?"Orchid":t.includes("("+s.out+",")?"MediumOrchid":t.includes(s.all_money)?"blue":"red"};function L(t,e,n,a){if(t==="category"&&e!==null&&n==="in")return s.category+' "'+e+'" ('+s.in+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="in")return s.unknown_category+" ("+s.in+(y?", "+a+")":")");if(t==="category"&&e!==null&&n==="out")return s.category+' "'+e+'" ('+s.out+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="out")return s.unknown_category+" ("+s.out+(y?", "+a+")":")");if(t==="account"&&e===null&&n==="in")return s.unknown_source+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="in")return s.revenue_account+'"'+e+'"'+(y?" ("+a+")":"");if(t==="account"&&e===null&&n==="out")return s.unknown_dest+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="out")return s.expense_account+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+n+'"')}function E(t,e,n){if(t==="category"&&e!==null)return s.category+' "'+e+'"'+(y?" ("+n+")":"");if(t==="category"&&e===null)return s.unknown_category+(y?" ("+n+")":"");if(t==="account"&&e===null)return s.unknown_account+(y?" ("+n+")":"");if(t==="account"&&e!==null)return e+(y?" ("+n+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+n+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'"')}const Qt=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=N("sankey"),e={},n={};for(let r in D)if(D.hasOwnProperty(r)){let o=D[r];for(let i in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(i)){let l=o.attributes.transactions[i],u=this.autoConversion?l.native_currency_code:l.currency_code,d=this.autoConversion?parseFloat(l.native_amount):parseFloat(l.amount),h;if(l.type==="deposit"){let c=L("category",l.category_name,"in",u),_=L("account",l.source_name,"in",u);n[c]=E("category",l.category_name,u),n[_]=E("account",l.source_name,u),h=_+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:c,amount:0}),e[h].amount+=d,h=c+"-"+s.all_money+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:s.all_money+(this.autoConversion?" ("+u+")":""),amount:0}),e[h].amount+=d}if(l.type==="withdrawal"){let c=L("budget",l.budget_name,"out",u);n[c]=E("budget",l.budget_name,u),h=s.all_money+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:s.all_money+(this.autoConversion?" ("+u+")":""),to:c,amount:0}),e[h].amount+=d;let _=L("category",l.category_name,"out",u);n[_]=E("category",l.category_name,u),h=c+"-"+_+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:_,amount:0}),e[h].amount+=d;let w=L("account",l.destination_name,"out",u);n[w]=E("account",l.destination_name,u),h=_+"-"+w+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:w,amount:0}),e[h].amount+=d}}}let a={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:n,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let o=e[r];a.data.push({from:o.from,to:o.to,flow:o.amount})}return t.data.datasets.push(a),t},drawChart(t){if(R!==null){R.data.datasets=t.data.datasets,R.update();return}R=new S(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ct,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){D=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ct,e,n);new $t().list(t).then(o=>{if(D=[...D,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(a,D),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,D.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){D=[],Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],y=t[0],s.all_money=p.t("firefly.all_money"),s.category=p.t("firefly.category"),s.in=p.t("firefly.money_flowing_in"),s.out=p.t("firefly.money_flowing_out"),s.unknown_category=p.t("firefly.unknown_category_plain"),s.unknown_source=p.t("firefly.unknown_source_plain"),s.unknown_dest=p.t("firefly.unknown_dest_plain"),s.unknown_account=p.t("firefly.unknown_any_plain"),s.unknown_budget=p.t("firefly.unknown_budget_plain"),s.expense_account=p.t("firefly.expense_account"),s.revenue_account=p.t("firefly.revenue_account"),s.budget=p.t("firefly.budget"),X=!0,this.loadChart()}),window.store.observe("end",()=>{X&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{X&&(this.autoConversion=t,this.loadChart())})}});let tt=!1,b={};function gt(t){return new Vt().list(t).then(n=>{let a=n.data.data;for(let r in a)if(a.hasOwnProperty(r)){let o=a[r];if(o.attributes.active&&o.attributes.pay_dates.length>0){let i=o.attributes.object_group_id===null?0:o.attributes.object_group_id,l=o.attributes.object_group_title===null?p.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,u=o.attributes.object_group_order===null?0:o.attributes.object_group_order;b.hasOwnProperty(i)||(b[i]={id:i,title:l,order:u,payment_info:{},bills:[]});let d={id:o.id,name:o.attributes.name,amount_min:o.attributes.amount_min,amount_max:o.attributes.amount_max,amount:(parseFloat(o.attributes.amount_max)+parseFloat(o.attributes.amount_min))/2,currency_code:o.attributes.currency_code,native_amount_min:o.attributes.native_amount_min,native_amount_max:o.attributes.native_amount_max,native_amount:(parseFloat(o.attributes.native_amount_max)+parseFloat(o.attributes.native_amount_min))/2,native_currency_code:o.attributes.native_currency_code,transactions:[],pay_dates:o.attributes.pay_dates,paid:o.attributes.paid_dates.length>0};d.expected_amount=t.autoConversion?f(d.native_amount,d.native_currency_code):f(d.amount,d.currency_code),d.expected_times=p.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:d.expected_amount});for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){const c=o.attributes.paid_dates[h];let _=100;t.autoConversion&&(_=Math.round(-100+parseFloat(c.native_amount)*-1/parseFloat(d.native_amount)*100)),t.autoConversion||(_=Math.round(-100+parseFloat(c.amount)*-1/parseFloat(d.amount)*100));let w={amount:t.autoConversion?f(c.native_amount,c.native_currency_code):f(c.amount,c.currency_code),percentage:_,date:g(new Date(c.date),"PP"),foreign_amount:null};c.foreign_currency_code!==null&&(w.foreign_amount=t.autoConversion?c.foreign_native_amount:c.foreign_amount,w.foreign_currency_code=t.autoConversion?c.native_currency_code:c.foreign_currency_code),d.transactions.push(w)}if(b[i].bills.push(d),o.attributes.paid_dates.length===0){const h=o.attributes.pay_dates.length*d.amount,c=o.attributes.pay_dates.length*d.native_amount;b[i].payment_info.hasOwnProperty(d.currency_code)||(b[i].payment_info[d.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0}),b[i].payment_info[d.currency_code].unpaid+=h,b[i].payment_info[d.currency_code].native_unpaid+=c}if(o.attributes.paid_dates.length>0){for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){let c=o.attributes.paid_dates[h];b[i].payment_info.hasOwnProperty(c.currency_code)||(b[i].payment_info[c.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0});const _=parseFloat(c.amount)*-1,w=parseFloat(c.native_amount)*-1;b[i].payment_info[c.currency_code].paid+=_,b[i].payment_info[c.currency_code].native_paid+=w}}}}return parseInt(n.data.meta.pagination.total_pages)>t.page?(t.page++,gt(t)):Promise.resolve()})}const Xt=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));const n=window.store.get("cacheValid");let a=window.store.get(P("subscriptions-data-dashboard",t,e));n&&typeof a<"u",b={},this.subscriptions=[];let r={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};gt(r).then(()=>{let o=Object.values(b);for(let i in o)if(o.hasOwnProperty(i)){let l=o[i];const u=Object.keys(l.payment_info);l.col_size=u.length===1?"col-6 offset-3":"col-6",l.chart_width=u.length===1?"50%":"100%",l.payment_length=u.length,this.subscriptions.push(l)}this.loading=!1})},drawPieChart(t,e,n){let a="#pie_"+t+"_"+n.currency_code;const r=this.autoConversion?n.native_unpaid:n.unpaid,o=this.autoConversion?n.native_paid:n.paid,i=this.autoConversion?n.native_currency_code:n.currency_code,u={type:"doughnut",data:{labels:[p.t("firefly.paid"),p.t("firefly.unpaid")],datasets:[{label:p.t("firefly.subscriptions_in_group",{title:e}),data:[o,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(h){return h.dataset.label+": "+f(h.raw,i)}}}}}};var d=S.getChart(document.querySelector(a));typeof d<"u"&&d.destroy(),new S(document.querySelector(a),u)},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],tt=!0,this.loading===!1&&this.startSubscriptions()}),window.store.observe("end",()=>{tt&&this.loading===!1&&this.startSubscriptions()}),window.store.observe("autoConversion",t=>{tt&&(this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});let x={},et=!1;const ht="dashboard-piggies-data",te=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ht,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){x=r,this.parsePiggies(),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ht,e,n);new Kt().list(t).then(o=>{if(x=[...x,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(a,x),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in x)if(x.hasOwnProperty(e)){let n=x[e];if(n.attributes.percentage>=100||n.attributes.percentage===0)continue;let a=n.object_group_title??p.t("firefly.default_group_title_name_plain");t.hasOwnProperty(a)||(t[a]={id:n.object_group_id??0,title:a,order:n.object_group_order??0,piggies:[]});let r={id:n.id,name:n.attributes.name,percentage:parseInt(n.attributes.percentage),amount:this.autoConversion?n.attributes.native_current_amount:n.attributes.current_amount,left_to_save:this.autoConversion?n.attributes.native_left_to_save:n.attributes.left_to_save,target_amount:this.autoConversion?n.attributes.native_target_amount:n.attributes.target_amount,save_per_month:this.autoConversion?n.attributes.native_save_per_month:n.attributes.save_per_month,currency_code:this.autoConversion?n.attributes.native_currency_code:n.attributes.currency_code};t[a].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){x=[],Promise.all([v("autoConversion",!1)]).then(t=>{et=!0,this.autoConversion=t[0],this.loadPiggyBanks()}),window.store.observe("end",()=>{et&&(x=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{et&&(this.autoConversion=t,this.loadPiggyBanks())})}});S.register({LineController:Ct,LineElement:kt,ArcElement:Pt,BarController:Dt,TimeScale:xt,PieController:Ot,BarElement:Mt,Filler:Ft,Colors:St,LinearScale:At,CategoryScale:Bt,PointElement:jt,Tooltip:Wt,Legend:It});const pt={dates:wt,boxes:Et,accounts:Ut,budgets:Ht,categories:Zt,sankey:Qt,subscriptions:Xt,piggies:te};function _t(t){Object.keys(t).forEach(e=>{let n=t[e]();Alpine.data(e,()=>n)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),_t(pt)});window.bootstrapped&&(console.log("Loaded through window variable."),_t(pt)); +import{a as O,f,g as v,P as bt,d as wt}from"./format-money-2e5851ad.js";import{f as g,C as m,a as S,i as p,S as vt,F as mt,L as Ct,b as kt,A as Pt,B as Dt,T as xt,P as Ot,c as Mt,d as Ft,p as St,e as At,g as Bt,h as jt,j as Wt,k as It}from"./vendor-50e42c6c.js";import{G as $t}from"./get-e0a81c64.js";import{G as Vt,a as Kt}from"./get-28b9aa25.js";class Lt{get(e,n,a){return O.get("/api/v2/summary/basic",{params:{start:e,end:n,code:a}})}}function P(t,e,n){const a=g(e,"y-MM-dd")+"_"+g(n,"y-MM-dd")+"_"+t;return console.log("getCacheKey: "+a),String(a)}let U=!1;const Et=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-boxes-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.boxData=r,this.generateOptions(this.boxData);return}new Lt().get(g(t,"yyyy-MM-dd"),g(e,"yyyy-MM-dd"),null).then(i=>{this.boxData=i.data,window.store.set(n,i.data),this.generateOptions(this.boxData)})},generateOptions(t){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let e={};for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];if(!a.hasOwnProperty("key"))continue;let r=a.key;if(this.autoConversion){if(r.startsWith("balance-in-native")){this.balanceBox.amounts.push(f(a.value,a.currency_code)),e.hasOwnProperty(a.currency_code)||(e[a.currency_code]="");continue}if(r.startsWith("spent-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-native")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-native")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-native")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}if(r.startsWith("net-worth-in-native")){this.netBox.net.push(f(a.value,a.currency_code));continue}}if(!this.autoConversion&&!r.endsWith("native")){if(r.startsWith("balance-in-")){this.balanceBox.amounts.push(f(a.value,a.currency_code));continue}if(r.startsWith("spent-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=e[a.currency_code]+f(a.value,a.currency_code);continue}if(r.startsWith("earned-in-")){e.hasOwnProperty(a.currency_code)||(e[a.currency_code]=""),e[a.currency_code]=f(a.value,a.currency_code)+" + "+e[a.currency_code];continue}if(r.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(f(a.value,a.currency_code));continue}if(r.startsWith("bills-paid-in-")){this.billBox.paid.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-to-spend-in-")){this.leftBox.left.push(f(a.value,a.currency_code));continue}if(r.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(f(a.value,a.currency_code));continue}r.startsWith("net-worth-in-")&&this.netBox.net.push(f(a.value,a.currency_code))}}for(let n in e)e.hasOwnProperty(n)&&this.balanceBox.subtitles.push(e[n]);this.loading=!1},loadBoxes(){if(this.loading!==!0){if(this.loading=!0,this.boxData===null){this.getFreshData();return}this.generateOptions(this.boxData),this.loading=!1}},init(){Promise.all([v("viewRange"),v("autoConversion",!1)]).then(t=>{U=!0,this.autoConversion=t[1],this.loadBoxes()}),window.store.observe("end",()=>{U&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",t=>{U&&(this.autoConversion=t,this.loadBoxes())})}});class Gt{put(e,n){let a="/api/v1/preferences/"+e;return O.put(a,{data:n})}}function Tt(t,e=null){window.store.set(t,e),new Gt().put(t,e).then(a=>{}).catch(()=>{new bt().post(t,e).then(r=>{})})}let Rt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/dashboard",{params:{start:a,end:r}})}expense(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/account/expense-dashboard",{params:{start:a,end:r}})}};class st{get(e,n){let a={date:g(n,"y-MM-dd").slice(0,10)};return n?O.get("/api/v2/accounts/"+e,{params:a}):O.get("/api/v2/accounts/"+e)}transactions(e,n){const a={page:n.page??1};return n.hasOwnProperty("start")&&(a.start=g(n.start,"y-MM-dd")),n.hasOwnProperty("end")&&(a.end=g(n.end,"y-MM-dd")),O.get("/api/v2/accounts/"+e+"/transactions",{params:a})}}function N(t){return t==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:t==="pie"?{type:"pie",data:{datasets:[]}}:t==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{}}}:t==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(e){let n=e.dataset.currency_code;return f(e.raw,n)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let q=new m("#36a2eb"),I=new m("#ff6384"),G=new m("#4bc0c0"),ft=new m("#ff9f40"),qt=new m("#9966ff"),Nt=new m("#ffcd56"),Yt=new m("#c9cbcf"),lt=0;window.theme==="dark"&&(I.darken(.3).desaturate(.3),G.darken(.3).desaturate(.3),q.darken(.3).desaturate(.3),ft.darken(.3).desaturate(.3));let z=[I,ft,q,G,qt,Nt,Yt,G];function j(t,e){let n={borderColor:I.rgbString(),backgroundColor:I.rgbString()},a;switch(t){default:let o=Math.floor(lt/2)%z.length;a=new m(z[o].rgbString()),a.lighten(.38),n={borderColor:z[o].hexString(),backgroundColor:a.hexString()};break;case"spent":a=new m(q.rgbString()),a.lighten(.38),n={borderColor:q.rgbString(),backgroundColor:a.rgbString()};break;case"left":a=new m(G.rgbString()),a.lighten(.38),n={borderColor:G.rgbString(),backgroundColor:a.rgbString()};break;case"overspent":a=new m(I.rgbString()),a.lighten(.22),n={borderColor:I.rgbString(),backgroundColor:a.rgbString()};break}return lt++,e==="border"?n.borderColor:e==="background"?n.backgroundColor:"#FF0000"}let A=[],$=null,H=null,J=!1;const Ut=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Tt("autoConversion",this.autoConversion)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){console.log(r),this.drawChart(this.generateOptions(r)),this.loading=!1;return}new Rt().dashboard(t,e,null).then(i=>{this.chartData=i.data,window.store.set(n,i.data),console.log(i.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(t){A=[];let e=N("line");for(let n=0;n0){this.loadingAccounts=!1;return}const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-accounts-data",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){this.accountList=r,this.loadingAccounts=!1;return}const o=10;let i=0,l=0,u=[];Promise.all([v("frontpageAccounts")]).then(d=>{i=d[0].length;for(let h in d[0]){let c=d[0];if(c.hasOwnProperty(h)){let _=c[h];new st().get(_,new Date(window.store.get("end"))).then(w=>{let C=w.data.data;const yt={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new st().transactions(C.id,yt).then(at=>{let nt=[];for(let B=0;B=o);B++){let M=at.data.data[B],rt={title:M.attributes.group_title===null?"":M.attributes.group_title,id:M.id,transactions:[]};for(let Y=0;YB.order-M.order),this.accountList=u,this.loadingAccounts=!1,window.store.set(n,u))})})}}})},init(){Promise.all([v("viewRange","1M"),v("autoConversion",!1),v("language","en_US")]).then(t=>{this.autoConversion=t[1],J=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{J&&(H=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{J&&(this.loadChart(),this.loadAccounts())})}});let zt=class{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/budget/dashboard",{params:{start:a,end:r}})}},V=[],T=null,F=null,Z=!1;const Ht=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,F!==null){this.drawChart(this.generateOptions(F)),this.loading=!1;return}this.getFreshData()}},drawChart(t){if(T!==null){T.data.datasets=t.data.datasets,T.update();return}T=new S(document.querySelector("#budget-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-budgets-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){F=r,this.drawChart(this.generateOptions(F)),this.loading=!1;return}new zt().dashboard(t,e,null).then(i=>{F=i.data,this.drawChart(this.generateOptions(F)),window.store.set(n,F),this.loading=!1})},generateOptions(t){V=[];let e=N("column");e.options.locale=window.store.get("locale").replace("_","-"),e.options.plugins={tooltip:{callbacks:{title:function(n){return n.label},label:function(n){let a=n.dataset.label||"";return a&&(a+=": "),a+" "+f(n.parsed.y,V[n.parsed.x]??"EUR")}}}},e.data={labels:[],datasets:[{label:p.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:j("spent","background"),borderColor:j("spent","border")},{label:p.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:j("left","background"),borderColor:j("left","border")},{label:p.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:j("overspent","background"),borderColor:j("overspent","border")}]};for(const n in t)if(t.hasOwnProperty(n)){let a=t[n],r=a.label+" ("+a.currency_code+")";e.data.labels.push(r),this.autoConversion&&(V.push(a.native_currency_code),e.data.datasets[0].data.push(parseFloat(a.native_entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.native_entries.left)),e.data.datasets[2].data.push(parseFloat(a.native_entries.overspent))),this.autoConversion||(V.push(a.currency_code),e.data.datasets[0].data.push(parseFloat(a.entries.spent)*-1),e.data.datasets[1].data.push(parseFloat(a.entries.left)),e.data.datasets[2].data.push(parseFloat(a.entries.overspent)))}return e.options.scales={y:{ticks:{callback:function(n){return f(n,V[0]??"EUR")}}}},e},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Z=!0,this.loading===!1&&this.loadChart()}),window.store.observe("end",()=>{Z&&this.loading===!1&&(F=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Z&&(this.autoConversion=t,this.loading===!1&&this.loadChart())})}});class Jt{dashboard(e,n){let a=g(e,"y-MM-dd"),r=g(n,"y-MM-dd");return O.get("/api/v2/chart/category/dashboard",{params:{start:a,end:r}})}}let ut=[],K=null,W=null,Q=!1;const Zt=()=>({loading:!1,autoConversion:!1,generateOptions(t){ut=[];let e=N("column"),n={};for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code),n.hasOwnProperty(i)||(n[i]={name:i,yAxisID:"",data:{}},ut.push(i))}for(const r in t)if(t.hasOwnProperty(r)){let o=t[r],i=o.currency_code;this.autoConversion&&(i=o.native_currency_code);for(const l in n)if(n.hasOwnProperty(l)){let u=0;i===l&&(u=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(u=parseFloat(o.native_amount),""+o.native_currency_code)),n[l].data.hasOwnProperty(o.label)&&(n[l].data[o.label]=n[l].data[o.label]+u),n[l].data.hasOwnProperty(o.label)||(n[l].data[o.label]=u)}e.data.labels.includes(o.label)||e.data.labels.push(o.label)}let a=0;for(const r in n){let o="y"+r,i={label:r,currency_code:r,yAxisID:o,data:[]};for(const l in n[r].data)i.data.push(n[r].data[l]);e.data.datasets.push(i),e.options.scales.hasOwnProperty(o)||(e.options.scales[o]={beginAtZero:!0,type:"linear",position:a===1?"right":"left",ticks:{callback:function(l,u,d){return f(l,r)}}},a++)}return e},drawChart(t){if(K!==null){K.options=t.options,K.data=t.data,K.update();return}K=new S(document.querySelector("#category-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P("dashboard-categories-chart",t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){W=r,this.drawChart(this.generateOptions(W)),this.loading=!1;return}new Jt().dashboard(t,e,null).then(i=>{W=i.data,this.drawChart(this.generateOptions(i.data)),window.store.set(n,W),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,W!==null){this.drawChart(this.generateOptions(W)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],Q=!0,this.loadChart()}),window.store.observe("end",()=>{Q&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",t=>{Q&&(this.autoConversion=t,this.loadChart())})}});S.register({SankeyController:vt,Flow:mt});const ct="dashboard-sankey-data";let X=!1,R=null,D=[],y=!1,s={category:null,unknown_category:null,in:null,out:null,unknown_source:null,unknown_dest:null,unknown_account:null,expense_account:null,revenue_account:null,budget:null,unknown_budget:null,all_money:null};const dt=function(t){return t.includes(s.revenue_account)?"forestgreen":t.includes("("+s.in+",")?"green":t.includes(s.budget)||t.includes(s.unknown_budget)?"Orchid":t.includes("("+s.out+",")?"MediumOrchid":t.includes(s.all_money)?"blue":"red"};function L(t,e,n,a){if(t==="category"&&e!==null&&n==="in")return s.category+' "'+e+'" ('+s.in+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="in")return s.unknown_category+" ("+s.in+(y?", "+a+")":")");if(t==="category"&&e!==null&&n==="out")return s.category+' "'+e+'" ('+s.out+(y?", "+a+")":")");if(t==="category"&&e===null&&n==="out")return s.unknown_category+" ("+s.out+(y?", "+a+")":")");if(t==="account"&&e===null&&n==="in")return s.unknown_source+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="in")return s.revenue_account+'"'+e+'"'+(y?" ("+a+")":"");if(t==="account"&&e===null&&n==="out")return s.unknown_dest+(y?" ("+a+")":"");if(t==="account"&&e!==null&&n==="out")return s.expense_account+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+a+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+a+")":"");console.error('Cannot handle: type:"'+t+'", dir: "'+n+'"')}function E(t,e,n){if(t==="category"&&e!==null)return s.category+' "'+e+'"'+(y?" ("+n+")":"");if(t==="category"&&e===null)return s.unknown_category+(y?" ("+n+")":"");if(t==="account"&&e===null)return s.unknown_account+(y?" ("+n+")":"");if(t==="account"&&e!==null)return e+(y?" ("+n+")":"");if(t==="budget"&&e!==null)return s.budget+' "'+e+'"'+(y?" ("+n+")":"");if(t==="budget"&&e===null)return s.unknown_budget+(y?" ("+n+")":"");console.error('Cannot handle: type:"'+t+'"')}const Qt=()=>({loading:!1,autoConversion:!1,generateOptions(){let t=N("sankey"),e={},n={};for(let r in D)if(D.hasOwnProperty(r)){let o=D[r];for(let i in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(i)){let l=o.attributes.transactions[i],u=this.autoConversion?l.native_currency_code:l.currency_code,d=this.autoConversion?parseFloat(l.native_amount):parseFloat(l.amount),h;if(l.type==="deposit"){let c=L("category",l.category_name,"in",u),_=L("account",l.source_name,"in",u);n[c]=E("category",l.category_name,u),n[_]=E("account",l.source_name,u),h=_+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:c,amount:0}),e[h].amount+=d,h=c+"-"+s.all_money+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:s.all_money+(this.autoConversion?" ("+u+")":""),amount:0}),e[h].amount+=d}if(l.type==="withdrawal"){let c=L("budget",l.budget_name,"out",u);n[c]=E("budget",l.budget_name,u),h=s.all_money+"-"+c+"-"+u,e.hasOwnProperty(h)||(e[h]={from:s.all_money+(this.autoConversion?" ("+u+")":""),to:c,amount:0}),e[h].amount+=d;let _=L("category",l.category_name,"out",u);n[_]=E("category",l.category_name,u),h=c+"-"+_+"-"+u,e.hasOwnProperty(h)||(e[h]={from:c,to:_,amount:0}),e[h].amount+=d;let w=L("account",l.destination_name,"out",u);n[w]=E("account",l.destination_name,u),h=_+"-"+w+"-"+u,e.hasOwnProperty(h)||(e[h]={from:_,to:w,amount:0}),e[h].amount+=d}}}let a={label:"Firefly III dashboard sankey chart",data:[],colorFrom:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].from:""),colorTo:r=>dt(r.dataset.data[r.dataIndex]?r.dataset.data[r.dataIndex].to:""),colorMode:"gradient",labels:n,size:"min"};for(let r in e)if(e.hasOwnProperty(r)){let o=e[r];a.data.push({from:o.from,to:o.to,flow:o.amount})}return t.data.datasets.push(a),t},drawChart(t){if(R!==null){R.data.datasets=t.data.datasets,R.update();return}R=new S(document.querySelector("#sankey-chart"),t)},getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ct,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){D=r,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ct,e,n);new $t().list(t).then(o=>{if(D=[...D,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadTransactions(t);return}window.store.set(a,D),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,D.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){D=[],Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],y=t[0],s.all_money=p.t("firefly.all_money"),s.category=p.t("firefly.category"),s.in=p.t("firefly.money_flowing_in"),s.out=p.t("firefly.money_flowing_out"),s.unknown_category=p.t("firefly.unknown_category_plain"),s.unknown_source=p.t("firefly.unknown_source_plain"),s.unknown_dest=p.t("firefly.unknown_dest_plain"),s.unknown_account=p.t("firefly.unknown_any_plain"),s.unknown_budget=p.t("firefly.unknown_budget_plain"),s.expense_account=p.t("firefly.expense_account"),s.revenue_account=p.t("firefly.revenue_account"),s.budget=p.t("firefly.budget"),X=!0,this.loadChart()}),window.store.observe("end",()=>{X&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",t=>{X&&(this.autoConversion=t,this.loadChart())})}});let tt=!1,b={};function gt(t){return new Vt().list(t).then(n=>{let a=n.data.data;for(let r in a)if(a.hasOwnProperty(r)){let o=a[r];if(o.attributes.active&&o.attributes.pay_dates.length>0){let i=o.attributes.object_group_id===null?0:o.attributes.object_group_id,l=o.attributes.object_group_title===null?p.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,u=o.attributes.object_group_order===null?0:o.attributes.object_group_order;b.hasOwnProperty(i)||(b[i]={id:i,title:l,order:u,payment_info:{},bills:[]});let d={id:o.id,name:o.attributes.name,amount_min:o.attributes.amount_min,amount_max:o.attributes.amount_max,amount:(parseFloat(o.attributes.amount_max)+parseFloat(o.attributes.amount_min))/2,currency_code:o.attributes.currency_code,native_amount_min:o.attributes.native_amount_min,native_amount_max:o.attributes.native_amount_max,native_amount:(parseFloat(o.attributes.native_amount_max)+parseFloat(o.attributes.native_amount_min))/2,native_currency_code:o.attributes.native_currency_code,transactions:[],pay_dates:o.attributes.pay_dates,paid:o.attributes.paid_dates.length>0};d.expected_amount=t.autoConversion?f(d.native_amount,d.native_currency_code):f(d.amount,d.currency_code),d.expected_times=p.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:d.expected_amount});for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){const c=o.attributes.paid_dates[h];let _=100;t.autoConversion&&(_=Math.round(-100+parseFloat(c.native_amount)*-1/parseFloat(d.native_amount)*100)),t.autoConversion||(_=Math.round(-100+parseFloat(c.amount)*-1/parseFloat(d.amount)*100));let w={amount:t.autoConversion?f(c.native_amount,c.native_currency_code):f(c.amount,c.currency_code),percentage:_,date:g(new Date(c.date),"PP"),foreign_amount:null};c.foreign_currency_code!==null&&(w.foreign_amount=t.autoConversion?c.foreign_native_amount:c.foreign_amount,w.foreign_currency_code=t.autoConversion?c.native_currency_code:c.foreign_currency_code),d.transactions.push(w)}if(b[i].bills.push(d),o.attributes.paid_dates.length===0){const h=o.attributes.pay_dates.length*d.amount,c=o.attributes.pay_dates.length*d.native_amount;b[i].payment_info.hasOwnProperty(d.currency_code)||(b[i].payment_info[d.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0}),b[i].payment_info[d.currency_code].unpaid+=h,b[i].payment_info[d.currency_code].native_unpaid+=c}if(o.attributes.paid_dates.length>0){for(let h in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(h)){let c=o.attributes.paid_dates[h];b[i].payment_info.hasOwnProperty(c.currency_code)||(b[i].payment_info[c.currency_code]={currency_code:d.currency_code,paid:0,unpaid:0,native_currency_code:d.native_currency_code,native_paid:0,native_unpaid:0});const _=parseFloat(c.amount)*-1,w=parseFloat(c.native_amount)*-1;b[i].payment_info[c.currency_code].paid+=_,b[i].payment_info[c.currency_code].native_paid+=w}}}}return parseInt(n.data.meta.pagination.total_pages)>t.page?(t.page++,gt(t)):Promise.resolve()})}const Xt=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let t=new Date(window.store.get("start")),e=new Date(window.store.get("end"));const n=window.store.get("cacheValid");let a=window.store.get(P("subscriptions-data-dashboard",t,e));n&&typeof a<"u",b={},this.subscriptions=[];let r={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),autoConversion:this.autoConversion,page:1};gt(r).then(()=>{let o=Object.values(b);for(let i in o)if(o.hasOwnProperty(i)){let l=o[i];const u=Object.keys(l.payment_info);l.col_size=u.length===1?"col-6 offset-3":"col-6",l.chart_width=u.length===1?"50%":"100%",l.payment_length=u.length,this.subscriptions.push(l)}this.loading=!1})},drawPieChart(t,e,n){let a="#pie_"+t+"_"+n.currency_code;const r=this.autoConversion?n.native_unpaid:n.unpaid,o=this.autoConversion?n.native_paid:n.paid,i=this.autoConversion?n.native_currency_code:n.currency_code,u={type:"doughnut",data:{labels:[p.t("firefly.paid"),p.t("firefly.unpaid")],datasets:[{label:p.t("firefly.subscriptions_in_group",{title:e}),data:[o,r],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(h){return h.dataset.label+": "+f(h.raw,i)}}}}}};var d=S.getChart(document.querySelector(a));typeof d<"u"&&d.destroy(),new S(document.querySelector(a),u)},init(){Promise.all([v("autoConversion",!1)]).then(t=>{this.autoConversion=t[0],tt=!0,this.loading===!1&&this.startSubscriptions()}),window.store.observe("end",()=>{tt&&this.loading===!1&&this.startSubscriptions()}),window.store.observe("autoConversion",t=>{tt&&(this.autoConversion=t,this.loading===!1&&this.startSubscriptions())})}});let x={},et=!1;const ht="dashboard-piggies-data",te=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),n=P(ht,t,e),a=window.store.get("cacheValid");let r=window.store.get(n);if(a&&typeof r<"u"){x=r,this.parsePiggies(),this.loading=!1;return}let o={start:g(t,"y-MM-dd"),end:g(e,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(t){const e=new Date(window.store.get("start")),n=new Date(window.store.get("end")),a=P(ht,e,n);new Kt().list(t).then(o=>{if(x=[...x,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>t.page){t.page++,this.downloadPiggyBanks(t);return}window.store.set(a,x),this.parsePiggies(),this.loading=!1})},parsePiggies(){let t=[];for(let e in x)if(x.hasOwnProperty(e)){let n=x[e];if(n.attributes.percentage>=100||n.attributes.percentage===0)continue;let a=n.object_group_title??p.t("firefly.default_group_title_name_plain");t.hasOwnProperty(a)||(t[a]={id:n.object_group_id??0,title:a,order:n.object_group_order??0,piggies:[]});let r={id:n.id,name:n.attributes.name,percentage:parseInt(n.attributes.percentage),amount:this.autoConversion?n.attributes.native_current_amount:n.attributes.current_amount,left_to_save:this.autoConversion?n.attributes.native_left_to_save:n.attributes.left_to_save,target_amount:this.autoConversion?n.attributes.native_target_amount:n.attributes.target_amount,save_per_month:this.autoConversion?n.attributes.native_save_per_month:n.attributes.save_per_month,currency_code:this.autoConversion?n.attributes.native_currency_code:n.attributes.currency_code};t[a].piggies.push(r)}this.piggies=Object.values(t)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){x=[],Promise.all([v("autoConversion",!1)]).then(t=>{et=!0,this.autoConversion=t[0],this.loadPiggyBanks()}),window.store.observe("end",()=>{et&&(x=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",t=>{et&&(this.autoConversion=t,this.loadPiggyBanks())})}});S.register({LineController:Ct,LineElement:kt,ArcElement:Pt,BarController:Dt,TimeScale:xt,PieController:Ot,BarElement:Mt,Filler:Ft,Colors:St,LinearScale:At,CategoryScale:Bt,PointElement:jt,Tooltip:Wt,Legend:It});const pt={dates:wt,boxes:Et,accounts:Ut,budgets:Ht,categories:Zt,sankey:Qt,subscriptions:Xt,piggies:te};function _t(t){Object.keys(t).forEach(e=>{let n=t[e]();Alpine.data(e,()=>n)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),_t(pt)});window.bootstrapped&&(console.log("Loaded through window variable."),_t(pt)); diff --git a/public/build/assets/edit-5b2f31e3.js b/public/build/assets/edit-4c7ba005.js similarity index 94% rename from public/build/assets/edit-5b2f31e3.js rename to public/build/assets/edit-4c7ba005.js index da55d0395c..ebb26c4a9a 100644 --- a/public/build/assets/edit-5b2f31e3.js +++ b/public/build/assets/edit-4c7ba005.js @@ -1 +1 @@ -import{d as p,f as l}from"./format-money-0eadc9a5.js";import{G as f}from"./get-e91a7549.js";import{p as g}from"./parse-downloaded-splits-c84e4e72.js";import{p as m,d as w,e as a,f as y,g as b,h as P,i as S,l as v,a as C,b as A,c as _,s as E,j as D,k as c,m as u}from"./splice-errors-into-transactions-cff36293.js";import{i as o,m as T}from"./vendor-29d868f9.js";import{d as x}from"./create-empty-split-224dd5cc.js";import{P as B}from"./put-79877c04.js";import"./get-eb14a1e7.js";const n=D();let L=function(){return{entries:[],originals:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,editTitle:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.entries[e].errors=x());this.formStates.isSubmitting=!0;let t=m(this.entries,this.originals,this.groupProperties.transactionType),s={group_title:this.groupProperties.editTitle,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:t};this.groupProperties.title===null&&t.length>1&&(s.group_title=t[0].description);let r=new B;console.log(s),r.put(s,{id:this.groupProperties.id}).then(e=>{const i=e.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,w(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(e=>{this.submitting=!1,console.log(e),typeof e.response<"u"&&this.parseErrors(e.response.data)})},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{const t=function(s,r,e){return s.name_with_balance+'
'+o.t("firefly.account_type_"+s.type)+""};a({selector:"input.ac-source",serverUrl:n.account,filters:this.filters.source,onRenderItem:t,onChange:y,onSelectItem:b}),a({selector:"input.ac-dest",serverUrl:n.account,filters:this.filters.destination,onRenderItem:t,onChange:P,onSelectItem:S}),a({selector:"input.ac-category",serverUrl:n.category,valueField:"id",labelField:"name",onChange:c,onSelectItem:c}),a({selector:"input.ac-description",serverUrl:n.description,valueField:"id",labelField:"description",onChange:u,onSelectItem:u})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){return this.entries.length===0?l(this.groupProperties.totalAmount,"EUR"):l(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){return console.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];const t=window.location.href.split("/"),s=parseInt(t[t.length-1]);new f().show(s,{}).then(e=>{const i=e.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type.toLowerCase(),this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=g(i.attributes.transactions,parseInt(i.id)),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[e].amount),this.filters.source.push(this.entries[e].source_account.type),this.filters.destination.push(this.entries[e].destination_account.type));console.log(this.filters),setTimeout(()=>{T.init("select.ac-tags",{allowClear:!0,server:n.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:o.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}})},150)})},init(){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_loading_transaction"),this.getTransactionGroup(),v().then(t=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=t.defaultCurrency,this.formData.enabledCurrencies=t.enabledCurrencies,this.formData.nativeCurrencies=t.nativeCurrencies,this.formData.foreignCurrencies=t.foreignCurrencies}),C().then(t=>{this.formData.budgets=t,this.formStates.loadingBudgets=!1}),A().then(t=>{this.formData.piggyBanks=t,this.formStates.loadingPiggyBanks=!1}),_().then(t=>{this.formData.subscriptions=t,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",t=>{this.processUpload(t),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",t=>{this.processUploadError(t)}),document.addEventListener("location-move",t=>{this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude}),document.addEventListener("location-set",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel}),document.addEventListener("location-zoom",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel})},changedAmount(t){const s=parseInt(t.target.dataset.index);this.entries[s].amount=parseFloat(t.target.value),this.groupProperties.totalAmount=0;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[r].amount))},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=o.t("firefly.updated_journal_js",{description:this.groupProperties.title});return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=updated"},parseErrors(t){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=o.t("firefly.errors_submission_v2",{errorMessage:t.message}),t.hasOwnProperty("errors")&&(this.entries=E(t.errors,this.entries))},processUpload(t){this.showMessageOrRedirectUser()},processUploadError(t){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=o.t("firefly.errors_upload"),console.error(t)}}},h={transactions:L,dates:p};function d(){Object.keys(h).forEach(t=>{console.log(`Loading page component "${t}"`);let s=h[t]();Alpine.data(t,()=>s)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),d()});window.bootstrapped&&(console.log("Loaded through window variable."),d()); +import{d as p,f as l}from"./format-money-2e5851ad.js";import{G as f}from"./get-e0a81c64.js";import{p as g}from"./parse-downloaded-splits-83822d1b.js";import{p as m,d as w,e as a,f as y,g as b,h as P,i as S,l as v,a as C,b as A,c as _,s as E,j as D,k as c,m as u}from"./splice-errors-into-transactions-6727b386.js";import{i as o,m as T}from"./vendor-50e42c6c.js";import{d as x}from"./create-empty-split-81f71b2e.js";import{P as B}from"./put-bb9ad93a.js";import"./get-28b9aa25.js";const n=D();let L=function(){return{entries:[],originals:[],formStates:{loadingCurrencies:!0,loadingBudgets:!0,loadingPiggyBanks:!0,loadingSubscriptions:!0,isSubmitting:!1,returnHereButton:!1,saveAsNewButton:!1,resetButton:!0,rulesButton:!0,webhooksButton:!0},formBehaviour:{formType:"edit",foreignCurrencyEnabled:!0},formData:{defaultCurrency:null,enabledCurrencies:[],nativeCurrencies:[],foreignCurrencies:[],budgets:[],piggyBanks:[],subscriptions:[]},groupProperties:{transactionType:"unknown",title:null,editTitle:null,id:null,totalAmount:0},notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},submitTransaction(){this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.entries[e].errors=x());this.formStates.isSubmitting=!0;let t=m(this.entries,this.originals,this.groupProperties.transactionType),s={group_title:this.groupProperties.editTitle,fire_webhooks:this.formStates.webhooksButton,apply_rules:this.formStates.rulesButton,transactions:t};this.groupProperties.title===null&&t.length>1&&(s.group_title=t[0].description);let r=new B;console.log(s),r.put(s,{id:this.groupProperties.id}).then(e=>{const i=e.data.data;if(this.groupProperties.id=parseInt(i.id),this.groupProperties.title=i.attributes.group_title??i.attributes.transactions[0].description,w(this.groupProperties.id,i.attributes.transactions)>0){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_attachments");return}this.showMessageOrRedirectUser()}).catch(e=>{this.submitting=!1,console.log(e),typeof e.response<"u"&&this.parseErrors(e.response.data)})},filters:{source:[],destination:[]},addedSplit(){setTimeout(()=>{const t=function(s,r,e){return s.name_with_balance+'
'+o.t("firefly.account_type_"+s.type)+""};a({selector:"input.ac-source",serverUrl:n.account,filters:this.filters.source,onRenderItem:t,onChange:y,onSelectItem:b}),a({selector:"input.ac-dest",serverUrl:n.account,filters:this.filters.destination,onRenderItem:t,onChange:P,onSelectItem:S}),a({selector:"input.ac-category",serverUrl:n.category,valueField:"id",labelField:"name",onChange:c,onSelectItem:c}),a({selector:"input.ac-description",serverUrl:n.description,valueField:"id",labelField:"description",onChange:u,onSelectItem:u})},250)},changedDateTime(t){console.warn("changedDateTime, event is not used")},changedDescription(t){console.warn("changedDescription, event is not used")},changedDestinationAccount(t){console.warn("changedDestinationAccount, event is not used")},changedSourceAccount(t){console.warn("changedSourceAccount, event is not used")},formattedTotalAmount(){return this.entries.length===0?l(this.groupProperties.totalAmount,"EUR"):l(this.groupProperties.totalAmount,this.entries[0].currency_code??"EUR")},getTags(t){return console.log("at get tags "+t),console.log(this.entries[t].tags),this.entries[t].tags??[]},getTransactionGroup(){this.entries=[];const t=window.location.href.split("/"),s=parseInt(t[t.length-1]);new f().show(s,{}).then(e=>{const i=e.data.data;this.groupProperties.id=parseInt(i.id),this.groupProperties.transactionType=i.attributes.transactions[0].type.toLowerCase(),this.groupProperties.title=i.attributes.title??i.attributes.transactions[0].description,this.entries=g(i.attributes.transactions,parseInt(i.id)),this.notifications.wait.show=!1}).then(()=>{this.groupProperties.totalAmount=0;for(let e in this.entries)this.entries.hasOwnProperty(e)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[e].amount),this.filters.source.push(this.entries[e].source_account.type),this.filters.destination.push(this.entries[e].destination_account.type));console.log(this.filters),setTimeout(()=>{T.init("select.ac-tags",{allowClear:!0,server:n.tag,liveServer:!0,clearEnd:!0,allowNew:!0,notFoundMessage:o.t("firefly.nothing_found"),noCache:!0,fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}}})},150)})},init(){this.notifications.wait.show=!0,this.notifications.wait.text=o.t("firefly.wait_loading_transaction"),this.getTransactionGroup(),v().then(t=>{this.formStates.loadingCurrencies=!1,this.formData.defaultCurrency=t.defaultCurrency,this.formData.enabledCurrencies=t.enabledCurrencies,this.formData.nativeCurrencies=t.nativeCurrencies,this.formData.foreignCurrencies=t.foreignCurrencies}),C().then(t=>{this.formData.budgets=t,this.formStates.loadingBudgets=!1}),A().then(t=>{this.formData.piggyBanks=t,this.formStates.loadingPiggyBanks=!1}),_().then(t=>{this.formData.subscriptions=t,this.formStates.loadingSubscriptions=!1}),document.addEventListener("upload-success",t=>{this.processUpload(t),document.querySelectorAll("input[type=file]").value=""}),document.addEventListener("upload-error",t=>{this.processUploadError(t)}),document.addEventListener("location-move",t=>{this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude}),document.addEventListener("location-set",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].latitude=t.detail.latitude,this.entries[t.detail.index].longitude=t.detail.longitude,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel}),document.addEventListener("location-zoom",t=>{this.entries[t.detail.index].hasLocation=!0,this.entries[t.detail.index].zoomLevel=t.detail.zoomLevel})},changedAmount(t){const s=parseInt(t.target.dataset.index);this.entries[s].amount=parseFloat(t.target.value),this.groupProperties.totalAmount=0;for(let r in this.entries)this.entries.hasOwnProperty(r)&&(this.groupProperties.totalAmount=this.groupProperties.totalAmount+parseFloat(this.entries[r].amount))},showMessageOrRedirectUser(){if(this.notifications.error.show=!1,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.returnHereButton){this.notifications.success.show=!0,this.notifications.success.url="transactions/show/"+this.groupProperties.id,this.notifications.success.text=o.t("firefly.updated_journal_js",{description:this.groupProperties.title});return}window.location="transactions/show/"+this.groupProperties.id+"?transaction_group_id="+this.groupProperties.id+"&message=updated"},parseErrors(t){this.notifications.error.show=!0,this.notifications.success.show=!1,this.notifications.wait.show=!1,this.formStates.isSubmitting=!1,this.notifications.error.text=o.t("firefly.errors_submission_v2",{errorMessage:t.message}),t.hasOwnProperty("errors")&&(this.entries=E(t.errors,this.entries))},processUpload(t){this.showMessageOrRedirectUser()},processUploadError(t){this.notifications.success.show=!1,this.notifications.wait.show=!1,this.notifications.error.show=!0,this.formStates.isSubmitting=!1,this.notifications.error.text=o.t("firefly.errors_upload"),console.error(t)}}},h={transactions:L,dates:p};function d(){Object.keys(h).forEach(t=>{console.log(`Loading page component "${t}"`);let s=h[t]();Alpine.data(t,()=>s)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),d()});window.bootstrapped&&(console.log("Loaded through window variable."),d()); diff --git a/public/build/assets/format-money-0eadc9a5.js b/public/build/assets/format-money-2e5851ad.js similarity index 99% rename from public/build/assets/format-money-0eadc9a5.js rename to public/build/assets/format-money-2e5851ad.js index f172dcb428..a4a38bac2d 100644 --- a/public/build/assets/format-money-0eadc9a5.js +++ b/public/build/assets/format-money-2e5851ad.js @@ -1 +1 @@ -import{q as y,s as d,r as l,t as p,u as _,v as c,w as b,x as N,y as P,z as v,D as g,i as C,E as B,G as x,H as O,J as o,K as E,N as T,f as L,O as S,Q as W,R as U,U as I,V as q,W as Q,X as V,Y,Z as $,_ as j,$ as z,a0 as X,a1 as F,a2 as G,a3 as H,a4 as J,a5 as K,a6 as Z,a7 as ee,a8 as te,a9 as ae,aa as se,ab as ne,ac as re,ad as le,ae as de,af as oe,ag as ie,ah as ue,ai as ge,aj as ce,ak as we,al as he,am as ye}from"./vendor-29d868f9.js";const k="/",h=y.create({baseURL:k,withCredentials:!0});y.defaults.withCredentials=!0;y.defaults.baseURL=k;class R{getByName(e){return h.get("/api/v1/preferences/"+e)}getByNameNow(e){return h.get("/api/v1/preferences/"+e)}postByName(e,a){return h.post("/api/v1/preferences",{name:e,data:a})}}class A{post(e,a){let s="/api/v1/preferences";return h.post(s,{name:e,data:a})}}function fe(t,e=null){return new R().getByName(t).then(s=>Promise.resolve(m(t,s))).catch(()=>{new A().post(t,e).then(i=>Promise.resolve(m(t,i)))})}function m(t,e){return e.data.data.attributes.data}function w(t,e=null){const a=window.store.get("cacheValid");if(a&&window.hasOwnProperty(t))return Promise.resolve(window[t]);const s=window.store.get(t);return a&&typeof s<"u"?Promise.resolve(s):new R().getByName(t).then(u=>Promise.resolve(M(t,u))).catch(()=>{new A().post(t,e).then(n=>Promise.resolve(M(t,n)))})}function M(t,e){let a=e.data.data.attributes.data;return window.store.set(t,a),a}function be(t,e){let a,s;switch(t){case"last365":a=d(g(e,365)),s=l(e);break;case"last90":a=d(g(e,90)),s=l(e);break;case"last30":a=d(g(e,30)),s=l(e);break;case"last7":a=d(g(e,7)),s=l(e);break;case"YTD":a=v(e),s=l(e);break;case"QTD":a=p(e),s=l(e);break;case"MTD":a=c(e),s=l(e);break;case"1D":a=d(e),s=l(e);break;case"1W":a=d(N(e,{weekStartsOn:1})),s=l(P(e,{weekStartsOn:1}));break;case"1M":a=d(c(e)),s=l(b(e));break;case"3M":a=d(p(e)),s=l(_(e));break;case"6M":e.getMonth()<=5&&(a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(5),s.setDate(30),s=l(a)),e.getMonth()>5&&(a=new Date(e),a.setMonth(6),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(a));break;case"1Y":a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(s);break}return{start:a,end:s}}let D=!1;function pe(t){if(D===!1){const e=t.replace("-","_");D=!0;const a=7*24*60*60*1e3;return console.log('Will load language "'+e+'"'),C.use(B).init({load:"languageOnly",fallbackLng:"en",lng:e,debug:!1,backend:{backends:[x,O],backendOptions:[{load:"languageOnly",expirationTime:a},{loadPath:"./v2/i18n/{{lng}}.json"}]}})}return console.warn("Loading translations skipped."),Promise.resolve()}o.addPlugin(E);window.bootstrapped=!1;window.store=o;fe("lastActivity").then(t=>{const e=o.get("lastActivity");o.set("cacheValid",e===t),o.set("lastActivity",t),console.log("Server value: "+t),console.log("Local value: "+e),console.log("Cache valid: "+(e===t))}).then(()=>{Promise.all([w("viewRange"),w("darkMode"),w("locale"),w("language")]).then(t=>{if(!o.get("start")||!o.get("end")){const e=be(t[0],new Date);o.set("start",e.start),o.set("end",e.end)}window.__localeId__=t[2],o.set("language",t[3]),o.set("locale",t[3]),pe(t[3]).then(()=>{const e=new Event("firefly-iii-bootstrapped");document.dispatchEvent(e),window.bootstrapped=!0})})});window.axios=y;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";window.Alpine=T;const f={bg:S,cs:W,da:U,de:I,el:q,enGB:Q,enUS:V,es:Y,ca:$,fi:j,fr:z,hu:X,id:F,it:G,ja:H,ko:J,nb:K,nn:Z,nl:ee,pl:te,ptBR:ae,pt:se,ro:ne,ru:re,sk:le,sl:de,sv:oe,tr:ie,uk:ue,vi:ge,zhTW:ce,zhCN:we};function r(t,e="PP"){let a=window.__localeId__.replace("_","");return L(t,e,{locale:f[a]??f[a.slice(0,2)]??f.enUS})}const Me=()=>({range:{start:null,end:null},defaultRange:{start:null,end:null},language:"en_US",init(){this.range={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.defaultRange={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.language=window.store.get("language"),this.locale=window.store.get("locale"),this.locale=this.locale==="equal"?this.language:this.locale,window.__localeId__=this.language,this.buildDateRange(),window.store.observe("start",t=>{this.range.start=new Date(t)}),window.store.observe("end",t=>{this.range.end=new Date(t),this.buildDateRange()})},buildDateRange(){let t=this.getNextRange(),e=this.getPrevRange(),a=this.lastDays(7),s=this.lastDays(30),i=this.mtd(),u=this.ytd(),n=document.getElementsByClassName("daterange-holder")[0];n.textContent=r(this.range.start)+" - "+r(this.range.end),n.setAttribute("data-start",r(this.range.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.range.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-current")[0],n.textContent=r(this.defaultRange.start)+" - "+r(this.defaultRange.end),n.setAttribute("data-start",r(this.defaultRange.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.defaultRange.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-next")[0],n.textContent=r(t.start)+" - "+r(t.end),n.setAttribute("data-start",r(t.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(t.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-prev")[0],n.textContent=r(e.start)+" - "+r(e.end),n.setAttribute("data-start",r(e.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(e.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-7d")[0],n.setAttribute("data-start",r(a.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(a.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-90d")[0],n.setAttribute("data-start",r(s.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(s.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-mtd")[0],n.setAttribute("data-start",r(i.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(i.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-ytd")[0],n.setAttribute("data-start",r(u.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(u.end,"yyyy-MM-dd"))},getNextRange(){let t=c(this.range.start),e=he(t,1),a=b(e);return{start:e,end:a}},getPrevRange(){let t=c(this.range.start),e=ye(t,1),a=b(e);return{start:e,end:a}},ytd(){let t=new Date;return{start:v(this.range.start),end:t}},mtd(){let t=new Date;return{start:c(this.range.start),end:t}},lastDays(t){let e=new Date;return{start:g(e,t),end:e}},changeDateRange(t){t.preventDefault();let e=t.currentTarget,a=new Date(e.getAttribute("data-start")),s=new Date(e.getAttribute("data-end"));return window.store.set("start",a),window.store.set("end",s),!1}});function De(t,e){let a=window.__localeId__.replace("_","-");return Intl.NumberFormat(a,{style:"currency",currency:e}).format(t)}export{A as P,h as a,r as b,Me as d,De as f,w as g}; +import{q as y,s as d,r as l,t as p,u as _,v as c,w as b,x as N,y as P,z as v,D as g,i as C,E as B,G as x,H as O,J as o,K as E,N as T,f as L,O as S,Q as W,R as U,U as I,V as q,W as Q,X as V,Y,Z as $,_ as j,$ as z,a0 as X,a1 as F,a2 as G,a3 as H,a4 as J,a5 as K,a6 as Z,a7 as ee,a8 as te,a9 as ae,aa as se,ab as ne,ac as re,ad as le,ae as de,af as oe,ag as ie,ah as ue,ai as ge,aj as ce,ak as we,al as he,am as ye}from"./vendor-50e42c6c.js";const k="/",h=y.create({baseURL:k,withCredentials:!0});y.defaults.withCredentials=!0;y.defaults.baseURL=k;class R{getByName(e){return h.get("/api/v1/preferences/"+e)}getByNameNow(e){return h.get("/api/v1/preferences/"+e)}postByName(e,a){return h.post("/api/v1/preferences",{name:e,data:a})}}class A{post(e,a){let s="/api/v1/preferences";return h.post(s,{name:e,data:a})}}function fe(t,e=null){return new R().getByName(t).then(s=>Promise.resolve(m(t,s))).catch(()=>{new A().post(t,e).then(i=>Promise.resolve(m(t,i)))})}function m(t,e){return e.data.data.attributes.data}function w(t,e=null){const a=window.store.get("cacheValid");if(a&&window.hasOwnProperty(t))return Promise.resolve(window[t]);const s=window.store.get(t);return a&&typeof s<"u"?Promise.resolve(s):new R().getByName(t).then(u=>Promise.resolve(M(t,u))).catch(()=>{new A().post(t,e).then(n=>Promise.resolve(M(t,n)))})}function M(t,e){let a=e.data.data.attributes.data;return window.store.set(t,a),a}function be(t,e){let a,s;switch(t){case"last365":a=d(g(e,365)),s=l(e);break;case"last90":a=d(g(e,90)),s=l(e);break;case"last30":a=d(g(e,30)),s=l(e);break;case"last7":a=d(g(e,7)),s=l(e);break;case"YTD":a=v(e),s=l(e);break;case"QTD":a=p(e),s=l(e);break;case"MTD":a=c(e),s=l(e);break;case"1D":a=d(e),s=l(e);break;case"1W":a=d(N(e,{weekStartsOn:1})),s=l(P(e,{weekStartsOn:1}));break;case"1M":a=d(c(e)),s=l(b(e));break;case"3M":a=d(p(e)),s=l(_(e));break;case"6M":e.getMonth()<=5&&(a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(5),s.setDate(30),s=l(a)),e.getMonth()>5&&(a=new Date(e),a.setMonth(6),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(a));break;case"1Y":a=new Date(e),a.setMonth(0),a.setDate(1),a=d(a),s=new Date(e),s.setMonth(11),s.setDate(31),s=l(s);break}return{start:a,end:s}}let D=!1;function pe(t){if(D===!1){const e=t.replace("-","_");D=!0;const a=7*24*60*60*1e3;return console.log('Will load language "'+e+'"'),C.use(B).init({load:"languageOnly",fallbackLng:"en",lng:e,debug:!1,backend:{backends:[x,O],backendOptions:[{load:"languageOnly",expirationTime:a},{loadPath:"./v2/i18n/{{lng}}.json"}]}})}return console.warn("Loading translations skipped."),Promise.resolve()}o.addPlugin(E);window.bootstrapped=!1;window.store=o;fe("lastActivity").then(t=>{const e=o.get("lastActivity");o.set("cacheValid",e===t),o.set("lastActivity",t),console.log("Server value: "+t),console.log("Local value: "+e),console.log("Cache valid: "+(e===t))}).then(()=>{Promise.all([w("viewRange"),w("darkMode"),w("locale"),w("language")]).then(t=>{if(!o.get("start")||!o.get("end")){const e=be(t[0],new Date);o.set("start",e.start),o.set("end",e.end)}window.__localeId__=t[2],o.set("language",t[3]),o.set("locale",t[3]),pe(t[3]).then(()=>{const e=new Event("firefly-iii-bootstrapped");document.dispatchEvent(e),window.bootstrapped=!0})})});window.axios=y;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";window.Alpine=T;const f={bg:S,cs:W,da:U,de:I,el:q,enGB:Q,enUS:V,es:Y,ca:$,fi:j,fr:z,hu:X,id:F,it:G,ja:H,ko:J,nb:K,nn:Z,nl:ee,pl:te,ptBR:ae,pt:se,ro:ne,ru:re,sk:le,sl:de,sv:oe,tr:ie,uk:ue,vi:ge,zhTW:ce,zhCN:we};function r(t,e="PP"){let a=window.__localeId__.replace("_","");return L(t,e,{locale:f[a]??f[a.slice(0,2)]??f.enUS})}const Me=()=>({range:{start:null,end:null},defaultRange:{start:null,end:null},language:"en_US",init(){this.range={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.defaultRange={start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))},this.language=window.store.get("language"),this.locale=window.store.get("locale"),this.locale=this.locale==="equal"?this.language:this.locale,window.__localeId__=this.language,this.buildDateRange(),window.store.observe("start",t=>{this.range.start=new Date(t)}),window.store.observe("end",t=>{this.range.end=new Date(t),this.buildDateRange()})},buildDateRange(){let t=this.getNextRange(),e=this.getPrevRange(),a=this.lastDays(7),s=this.lastDays(30),i=this.mtd(),u=this.ytd(),n=document.getElementsByClassName("daterange-holder")[0];n.textContent=r(this.range.start)+" - "+r(this.range.end),n.setAttribute("data-start",r(this.range.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.range.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-current")[0],n.textContent=r(this.defaultRange.start)+" - "+r(this.defaultRange.end),n.setAttribute("data-start",r(this.defaultRange.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(this.defaultRange.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-next")[0],n.textContent=r(t.start)+" - "+r(t.end),n.setAttribute("data-start",r(t.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(t.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-prev")[0],n.textContent=r(e.start)+" - "+r(e.end),n.setAttribute("data-start",r(e.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(e.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-7d")[0],n.setAttribute("data-start",r(a.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(a.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-90d")[0],n.setAttribute("data-start",r(s.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(s.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-mtd")[0],n.setAttribute("data-start",r(i.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(i.end,"yyyy-MM-dd")),n=document.getElementsByClassName("daterange-ytd")[0],n.setAttribute("data-start",r(u.start,"yyyy-MM-dd")),n.setAttribute("data-end",r(u.end,"yyyy-MM-dd"))},getNextRange(){let t=c(this.range.start),e=he(t,1),a=b(e);return{start:e,end:a}},getPrevRange(){let t=c(this.range.start),e=ye(t,1),a=b(e);return{start:e,end:a}},ytd(){let t=new Date;return{start:v(this.range.start),end:t}},mtd(){let t=new Date;return{start:c(this.range.start),end:t}},lastDays(t){let e=new Date;return{start:g(e,t),end:e}},changeDateRange(t){t.preventDefault();let e=t.currentTarget,a=new Date(e.getAttribute("data-start")),s=new Date(e.getAttribute("data-end"));return window.store.set("start",a),window.store.set("end",s),!1}});function De(t,e){let a=window.__localeId__.replace("_","-");return Intl.NumberFormat(a,{style:"currency",currency:e}).format(t)}export{A as P,h as a,r as b,Me as d,De as f,w as g}; diff --git a/public/build/assets/get-eb14a1e7.js b/public/build/assets/get-28b9aa25.js similarity index 81% rename from public/build/assets/get-eb14a1e7.js rename to public/build/assets/get-28b9aa25.js index 3c638ea907..429dc34edc 100644 --- a/public/build/assets/get-eb14a1e7.js +++ b/public/build/assets/get-28b9aa25.js @@ -1 +1 @@ -import{a as s}from"./format-money-0eadc9a5.js";let t=class{list(a){return s.get("/api/v2/subscriptions",{params:a})}paid(a){return s.get("/api/v2/subscriptions/sum/paid",{params:a})}unpaid(a){return s.get("/api/v2/subscriptions/sum/unpaid",{params:a})}};class e{list(a){return s.get("/api/v2/piggy-banks",{params:a})}}export{t as G,e as a}; +import{a as s}from"./format-money-2e5851ad.js";let t=class{list(a){return s.get("/api/v2/subscriptions",{params:a})}paid(a){return s.get("/api/v2/subscriptions/sum/paid",{params:a})}unpaid(a){return s.get("/api/v2/subscriptions/sum/unpaid",{params:a})}};class e{list(a){return s.get("/api/v2/piggy-banks",{params:a})}}export{t as G,e as a}; diff --git a/public/build/assets/get-e91a7549.js b/public/build/assets/get-e0a81c64.js similarity index 75% rename from public/build/assets/get-e91a7549.js rename to public/build/assets/get-e0a81c64.js index ab431ea312..4d023dbe96 100644 --- a/public/build/assets/get-e91a7549.js +++ b/public/build/assets/get-e0a81c64.js @@ -1 +1 @@ -import{a as t}from"./format-money-0eadc9a5.js";class n{list(a){return t.get("/api/v2/transactions",{params:a})}infiniteList(a){return t.get("/api/v2/infinite/transactions",{params:a})}show(a,i){return t.get("/api/v2/transactions/"+a,{params:i})}}export{n as G}; +import{a as t}from"./format-money-2e5851ad.js";class n{list(a){return t.get("/api/v2/transactions",{params:a})}infiniteList(a){return t.get("/api/v2/infinite/transactions",{params:a})}show(a,i){return t.get("/api/v2/transactions/"+a,{params:i})}}export{n as G}; diff --git a/public/build/assets/index-914edd04.js b/public/build/assets/index-90222973.js similarity index 97% rename from public/build/assets/index-914edd04.js rename to public/build/assets/index-90222973.js index 6db718b92a..281c2a2b7f 100644 --- a/public/build/assets/index-914edd04.js +++ b/public/build/assets/index-90222973.js @@ -1 +1 @@ -import{b,d as V,f as u}from"./format-money-0eadc9a5.js";import{M as E,I as j,f as m,i as d,o as C}from"./vendor-29d868f9.js";import{P as c}from"./put-79877c04.js";import{G as T}from"./get-e91a7549.js";class v{init(t){document.addEventListener("cellValueChanged",()=>{console.log("I just realized a cell value has changed.")}),console.log("AmountEditor.init"),this.params=t,this.originalValue=t.value,this.eGui=document.createElement("div"),this.input=document.createElement("input"),this.input.type="number",this.input.min="0",this.input.step="any",this.input.style.overflow="hidden",this.input.style.textOverflow="ellipsis",this.input.autofocus=!0,this.input.value=parseFloat(t.value.amount).toFixed(t.value.decimal_places)}onChange(t){console.log("AmountEditor.onChange"),this.params.onValueChange(t),this.params.stopEditing(t)}afterGuiAttached(){this.input.focus(),this.input.select()}getGui(){return console.log("AmountEditor.getGui"),this.eGui.appendChild(this.input),this.eGui}getValue(){return console.log("AmountEditor.getValue"),this.originalValue.amount=parseFloat(this.input.value),this.submitAmount(this.originalValue),this.originalValue}submitAmount(t){console.log("AmountEditor.submitAmount"),console.log(t);const i=t.amount;console.log('New value for field "amount" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+i+'"');let o={transactions:[{transaction_journal_id:t.transaction_journal_id,amount:i}]};new c().put(o,{id:t.id})}}class x{constructor(){this.type="all",this.rowCount=null,this.sortModel=null}rowCount(){return this.rowCount}getRows(t){console.log("The sort model used is: ",t.sortModel);let i=[];for(let a in t.sortModel)if(t.sortModel.hasOwnProperty(a)){let n=t.sortModel[a];i.push({column:n.colId,direction:n.sort})}new T().infiniteList({start_row:t.startRow,end_row:t.endRow,type:this.type,sorting:i}).then(a=>{this.parseTransactions(a.data.data,t.successCallback),this.rowCount=a.data.meta.pagination.total}).catch(a=>{console.log(a)})}parseTransactions(t,i){let o=[];for(let a in t)if(t.hasOwnProperty(a)){let n=t[a],s=n.attributes.transactions.length>1,f=!0;for(let g in n.attributes.transactions)if(n.attributes.transactions.hasOwnProperty(g)){let r=n.attributes.transactions[g],l={};l.split=s,l.firstSplit=f,l.group_title=n.attributes.group_title,l.created_at=n.attributes.created_at,l.updated_at=n.attributes.updated_at,l.user=n.attributes.user,l.user_group=n.attributes.user_group,l.id=parseInt(n.id),l.transaction_journal_id=parseInt(r.transaction_journal_id),l.description=r.description,l.date=new Date(r.date),l.from={name:r.source_name,id:r.source_id,type:r.source_type},l.to={name:r.destination_name,id:r.destination_id,type:r.destination_type},l.category={name:r.category_name,id:r.category_id},l.budget={name:r.budget_name,id:r.budget_id},l.amount={id:parseInt(n.id),transaction_journal_id:parseInt(r.transaction_journal_id),type:r.type,amount:r.amount,currency_code:r.currency_code,decimal_places:r.currency_decimal_places,foreign_amount:r.foreign_amount,foreign_currency_code:r.foreign_currency_code,foreign_decimal_places:r.foreign_currency_decimal_places},l.icon={classes:"fa fa-solid fa-arrow-left",id:l.id},f=!1,o.push(l)}}return i(o,!1),o}setType(t){this.type=t}}class A{init(t){console.log("DateTimeEditor.init"),this.params=t,this.originalValue=t.value,this.eGui=document.createElement("div"),this.input=document.createElement("input"),this.input.type="datetime-local",this.input.style.overflow="hidden",this.input.style.textOverflow="ellipsis",this.input.value=b(t.value,"yyyy-MM-dd HH:mm")}onChange(t){console.log("DateTimeEditor.onChange"),this.params.onValueChange(t),this.params.stopEditing(t)}afterGuiAttached(){this.input.focus()}getGui(){return console.log("DateTimeEditor.getGui"),this.eGui.appendChild(this.input),this.eGui}getValue(){return console.log("DateTimeEditor.getValue"),this.originalValue=this.input.value,this.originalValue}submitAmount(t){console.log("AmountEditor.submitAmount"),console.log(t);const i=t.amount;console.log('New value for field "amount" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+i+'"');let o={transactions:[{transaction_journal_id:t.transaction_journal_id,amount:i}]};new c().put(o,{id:t.id})}}const _=new x,p=window.location.href.split("/"),M=p[p.length-1];_.setType(M);document.addEventListener("cellEditRequest",()=>{console.log("Loaded through event listener.")});let w;const R=["description","amount","date"],D=e=>{console.log("onCellEditRequestMethod");const t=e.data,i=e.colDef.field;let o=e.newValue;if(!R.includes(i)){console.log("Field "+i+" is not editable.");return}i==="amount"&&(o=e.newValue.amount,console.log("New value is now"+o)),console.log('New value for field "'+i+'" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+o+'"'),t[i]=o,w.getRowNode(String(e.rowIndex)).updateData(t);let n={transactions:[{transaction_journal_id:t.transaction_journal_id}]};n.transactions[0][i]=o,new c().put(n,{id:t.id})};document.addEventListener("cellValueChanged",()=>{console.log("I just realized a cell value has changed.")});document.addEventListener("onCellValueChanged",()=>{console.log("I just realized a cell value has changed.")});const G={rowModelType:"infinite",datasource:_,onCellEditRequest:D,readOnlyEdit:!0,columnDefs:[{field:"icon",editable:!1,headerName:"",sortable:!1,width:40,cellRenderer:function(e){return e.getValue()?'':""}},{field:"description",cellDataType:"text",editable:!0},{field:"amount",editable:function(e){return e.data.amount.foreign_amount===null&&e.data.amount.foreign_currency_code===null},cellEditor:v,cellRenderer(e){if(e.getValue()){let t="",i=parseFloat(e.getValue().amount),o=e.getValue(),a="text-danger";if(o.type==="withdrawal"&&(i=i*-1),o.type==="deposit"&&(a="text-success"),o.type==="transfer"&&(a="text-info"),t+=''+u(i,e.getValue().currency_code)+"",o.foreign_amount){let n=parseFloat(e.getValue().foreign_amount);o.type==="withdrawal"&&(n=n*-1),t+=' ('+u(n,o.foreign_currency_code)+")"}return t}return""}},{field:"date",editable:!0,cellDataType:"date",cellEditor:A,cellEditorPopup:!0,cellEditorPopupPosition:"under",cellRenderer(e){return e.getValue()?m(e.getValue(),d.t("config.date_time_fns_short")):""}},{field:"from",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();return''+t.name+""}return""}},{field:"to",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();return''+t.name+""}return""}},{field:"category",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();if(t.id!==null)return''+t.name+""}return""}},{field:"budget",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();if(t.id!==null)return''+t.name+""}return""}}]};E.registerModules([j]);let P=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},transactions:[],totalPages:1,perPage:50,page:1,tableColumns:{description:{enabled:!0},source:{enabled:!0},destination:{enabled:!0},amount:{enabled:!0}},table:null,formatMoney(e,t){return u(e,t)},format(e){return m(e,d.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=d.t("firefly.wait_loading_data"),w=C(document.querySelector("#grid"),G)},parseTransactions(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t],o=i.attributes.transactions.length>1,a=!0;for(let n in i.attributes.transactions)if(i.attributes.transactions.hasOwnProperty(n)){let s=i.attributes.transactions[n];s.split=o,tranaction.icon="fa fa-solid fa-arrow-left",s.firstSplit=a,s.group_title=i.attributes.group_title,s.id=i.id,s.created_at=i.attributes.created_at,s.updated_at=i.attributes.updated_at,s.user=i.attributes.user,s.user_group=i.attributes.user_group,a=!1,this.transactions.push(s)}}this.notifications.wait.show=!1,console.log("refresh!")}}},h={index:P,dates:V};function y(){Object.keys(h).forEach(e=>{console.log(`Loading page component "${e}"`);let t=h[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),y()});window.bootstrapped&&(console.log("Loaded through window variable."),y()); +import{b,d as V,f as u}from"./format-money-2e5851ad.js";import{M as E,I as j,f as m,i as d,o as C}from"./vendor-50e42c6c.js";import{P as c}from"./put-bb9ad93a.js";import{G as T}from"./get-e0a81c64.js";class v{init(t){document.addEventListener("cellValueChanged",()=>{console.log("I just realized a cell value has changed.")}),console.log("AmountEditor.init"),this.params=t,this.originalValue=t.value,this.eGui=document.createElement("div"),this.input=document.createElement("input"),this.input.type="number",this.input.min="0",this.input.step="any",this.input.style.overflow="hidden",this.input.style.textOverflow="ellipsis",this.input.autofocus=!0,this.input.value=parseFloat(t.value.amount).toFixed(t.value.decimal_places)}onChange(t){console.log("AmountEditor.onChange"),this.params.onValueChange(t),this.params.stopEditing(t)}afterGuiAttached(){this.input.focus(),this.input.select()}getGui(){return console.log("AmountEditor.getGui"),this.eGui.appendChild(this.input),this.eGui}getValue(){return console.log("AmountEditor.getValue"),this.originalValue.amount=parseFloat(this.input.value),this.submitAmount(this.originalValue),this.originalValue}submitAmount(t){console.log("AmountEditor.submitAmount"),console.log(t);const i=t.amount;console.log('New value for field "amount" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+i+'"');let o={transactions:[{transaction_journal_id:t.transaction_journal_id,amount:i}]};new c().put(o,{id:t.id})}}class x{constructor(){this.type="all",this.rowCount=null,this.sortModel=null}rowCount(){return this.rowCount}getRows(t){console.log("The sort model used is: ",t.sortModel);let i=[];for(let a in t.sortModel)if(t.sortModel.hasOwnProperty(a)){let n=t.sortModel[a];i.push({column:n.colId,direction:n.sort})}new T().infiniteList({start_row:t.startRow,end_row:t.endRow,type:this.type,sorting:i}).then(a=>{this.parseTransactions(a.data.data,t.successCallback),this.rowCount=a.data.meta.pagination.total}).catch(a=>{console.log(a)})}parseTransactions(t,i){let o=[];for(let a in t)if(t.hasOwnProperty(a)){let n=t[a],s=n.attributes.transactions.length>1,f=!0;for(let g in n.attributes.transactions)if(n.attributes.transactions.hasOwnProperty(g)){let r=n.attributes.transactions[g],l={};l.split=s,l.firstSplit=f,l.group_title=n.attributes.group_title,l.created_at=n.attributes.created_at,l.updated_at=n.attributes.updated_at,l.user=n.attributes.user,l.user_group=n.attributes.user_group,l.id=parseInt(n.id),l.transaction_journal_id=parseInt(r.transaction_journal_id),l.description=r.description,l.date=new Date(r.date),l.from={name:r.source_name,id:r.source_id,type:r.source_type},l.to={name:r.destination_name,id:r.destination_id,type:r.destination_type},l.category={name:r.category_name,id:r.category_id},l.budget={name:r.budget_name,id:r.budget_id},l.amount={id:parseInt(n.id),transaction_journal_id:parseInt(r.transaction_journal_id),type:r.type,amount:r.amount,currency_code:r.currency_code,decimal_places:r.currency_decimal_places,foreign_amount:r.foreign_amount,foreign_currency_code:r.foreign_currency_code,foreign_decimal_places:r.foreign_currency_decimal_places},l.icon={classes:"fa fa-solid fa-arrow-left",id:l.id},f=!1,o.push(l)}}return i(o,!1),o}setType(t){this.type=t}}class A{init(t){console.log("DateTimeEditor.init"),this.params=t,this.originalValue=t.value,this.eGui=document.createElement("div"),this.input=document.createElement("input"),this.input.type="datetime-local",this.input.style.overflow="hidden",this.input.style.textOverflow="ellipsis",this.input.value=b(t.value,"yyyy-MM-dd HH:mm")}onChange(t){console.log("DateTimeEditor.onChange"),this.params.onValueChange(t),this.params.stopEditing(t)}afterGuiAttached(){this.input.focus()}getGui(){return console.log("DateTimeEditor.getGui"),this.eGui.appendChild(this.input),this.eGui}getValue(){return console.log("DateTimeEditor.getValue"),this.originalValue=this.input.value,this.originalValue}submitAmount(t){console.log("AmountEditor.submitAmount"),console.log(t);const i=t.amount;console.log('New value for field "amount" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+i+'"');let o={transactions:[{transaction_journal_id:t.transaction_journal_id,amount:i}]};new c().put(o,{id:t.id})}}const _=new x,p=window.location.href.split("/"),M=p[p.length-1];_.setType(M);document.addEventListener("cellEditRequest",()=>{console.log("Loaded through event listener.")});let w;const R=["description","amount","date"],D=e=>{console.log("onCellEditRequestMethod");const t=e.data,i=e.colDef.field;let o=e.newValue;if(!R.includes(i)){console.log("Field "+i+" is not editable.");return}i==="amount"&&(o=e.newValue.amount,console.log("New value is now"+o)),console.log('New value for field "'+i+'" in transaction journal #'+t.transaction_journal_id+" of group #"+t.id+' is "'+o+'"'),t[i]=o,w.getRowNode(String(e.rowIndex)).updateData(t);let n={transactions:[{transaction_journal_id:t.transaction_journal_id}]};n.transactions[0][i]=o,new c().put(n,{id:t.id})};document.addEventListener("cellValueChanged",()=>{console.log("I just realized a cell value has changed.")});document.addEventListener("onCellValueChanged",()=>{console.log("I just realized a cell value has changed.")});const G={rowModelType:"infinite",datasource:_,onCellEditRequest:D,readOnlyEdit:!0,columnDefs:[{field:"icon",editable:!1,headerName:"",sortable:!1,width:40,cellRenderer:function(e){return e.getValue()?'':""}},{field:"description",cellDataType:"text",editable:!0},{field:"amount",editable:function(e){return e.data.amount.foreign_amount===null&&e.data.amount.foreign_currency_code===null},cellEditor:v,cellRenderer(e){if(e.getValue()){let t="",i=parseFloat(e.getValue().amount),o=e.getValue(),a="text-danger";if(o.type==="withdrawal"&&(i=i*-1),o.type==="deposit"&&(a="text-success"),o.type==="transfer"&&(a="text-info"),t+=''+u(i,e.getValue().currency_code)+"",o.foreign_amount){let n=parseFloat(e.getValue().foreign_amount);o.type==="withdrawal"&&(n=n*-1),t+=' ('+u(n,o.foreign_currency_code)+")"}return t}return""}},{field:"date",editable:!0,cellDataType:"date",cellEditor:A,cellEditorPopup:!0,cellEditorPopupPosition:"under",cellRenderer(e){return e.getValue()?m(e.getValue(),d.t("config.date_time_fns_short")):""}},{field:"from",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();return''+t.name+""}return""}},{field:"to",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();return''+t.name+""}return""}},{field:"category",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();if(t.id!==null)return''+t.name+""}return""}},{field:"budget",cellDataType:"text",cellRenderer:function(e){if(e.getValue()){let t=e.getValue();if(t.id!==null)return''+t.name+""}return""}}]};E.registerModules([j]);let P=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},transactions:[],totalPages:1,perPage:50,page:1,tableColumns:{description:{enabled:!0},source:{enabled:!0},destination:{enabled:!0},amount:{enabled:!0}},table:null,formatMoney(e,t){return u(e,t)},format(e){return m(e,d.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=d.t("firefly.wait_loading_data"),w=C(document.querySelector("#grid"),G)},parseTransactions(e){for(let t in e)if(e.hasOwnProperty(t)){let i=e[t],o=i.attributes.transactions.length>1,a=!0;for(let n in i.attributes.transactions)if(i.attributes.transactions.hasOwnProperty(n)){let s=i.attributes.transactions[n];s.split=o,tranaction.icon="fa fa-solid fa-arrow-left",s.firstSplit=a,s.group_title=i.attributes.group_title,s.id=i.id,s.created_at=i.attributes.created_at,s.updated_at=i.attributes.updated_at,s.user=i.attributes.user,s.user_group=i.attributes.user_group,a=!1,this.transactions.push(s)}}this.notifications.wait.show=!1,console.log("refresh!")}}},h={index:P,dates:V};function y(){Object.keys(h).forEach(e=>{console.log(`Loading page component "${e}"`);let t=h[e]();Alpine.data(e,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),y()});window.bootstrapped&&(console.log("Loaded through window variable."),y()); diff --git a/public/build/assets/parse-downloaded-splits-c84e4e72.js b/public/build/assets/parse-downloaded-splits-83822d1b.js similarity index 91% rename from public/build/assets/parse-downloaded-splits-c84e4e72.js rename to public/build/assets/parse-downloaded-splits-83822d1b.js index 1cbf821563..73bfaf6392 100644 --- a/public/build/assets/parse-downloaded-splits-c84e4e72.js +++ b/public/build/assets/parse-downloaded-splits-83822d1b.js @@ -1 +1 @@ -import{c as o}from"./create-empty-split-224dd5cc.js";import{f as _}from"./vendor-29d868f9.js";function l(a,r){let n=[];for(let i in a)if(a.hasOwnProperty(i)){let e=a[i],t=o();t.transaction_journal_id=e.transaction_journal_id,t.transaction_group_id=r,t.bill_id=e.bill_id,t.bill_name=e.bill_name,t.budget_id=e.budget_id,t.budget_name=e.budget_name,t.category_name=e.category_name,t.category_id=e.category_id,t.piggy_bank_id=e.piggy_bank_id,t.piggy_bank_name=e.piggy_bank_name,t.book_date=e.book_date,t.due_date=e.due_date,t.interest_date=e.interest_date,t.invoice_date=e.invoice_date,t.payment_date=e.payment_date,t.process_date=e.process_date,t.external_url=e.external_url,t.internal_reference=e.internal_reference,t.notes=e.notes,t.tags=e.tags,t.amount=parseFloat(e.amount).toFixed(e.currency_decimal_places),t.currency_code=e.currency_code,e.foreign_amount!==null&&(t.forein_currency_code=e.foreign_currency_code,t.foreign_amount=parseFloat(e.foreign_amount).toFixed(e.foreign_currency_decimal_places)),t.date=_(new Date(e.date),"yyyy-MM-dd HH:mm"),t.description=e.description,t.destination_account={id:e.destination_id,name:e.destination_name,type:e.destination_type,alpine_name:e.destination_name},t.source_account={id:e.source_id,name:e.source_name,type:e.source_type,alpine_name:e.source_name},e.latitude!==null&&(t.hasLocation=!0,t.latitude=e.latitude,t.longitude=e.longitude,t.zoomLevel=e.zoom_level),n.push(t)}return n}export{l as p}; +import{c as o}from"./create-empty-split-81f71b2e.js";import{f as _}from"./vendor-50e42c6c.js";function l(a,r){let n=[];for(let i in a)if(a.hasOwnProperty(i)){let e=a[i],t=o();t.transaction_journal_id=e.transaction_journal_id,t.transaction_group_id=r,t.bill_id=e.bill_id,t.bill_name=e.bill_name,t.budget_id=e.budget_id,t.budget_name=e.budget_name,t.category_name=e.category_name,t.category_id=e.category_id,t.piggy_bank_id=e.piggy_bank_id,t.piggy_bank_name=e.piggy_bank_name,t.book_date=e.book_date,t.due_date=e.due_date,t.interest_date=e.interest_date,t.invoice_date=e.invoice_date,t.payment_date=e.payment_date,t.process_date=e.process_date,t.external_url=e.external_url,t.internal_reference=e.internal_reference,t.notes=e.notes,t.tags=e.tags,t.amount=parseFloat(e.amount).toFixed(e.currency_decimal_places),t.currency_code=e.currency_code,e.foreign_amount!==null&&(t.forein_currency_code=e.foreign_currency_code,t.foreign_amount=parseFloat(e.foreign_amount).toFixed(e.foreign_currency_decimal_places)),t.date=_(new Date(e.date),"yyyy-MM-dd HH:mm"),t.description=e.description,t.destination_account={id:e.destination_id,name:e.destination_name,type:e.destination_type,alpine_name:e.destination_name},t.source_account={id:e.source_id,name:e.source_name,type:e.source_type,alpine_name:e.source_name},e.latitude!==null&&(t.hasLocation=!0,t.latitude=e.latitude,t.longitude=e.longitude,t.zoomLevel=e.zoom_level),n.push(t)}return n}export{l as p}; diff --git a/public/build/assets/put-79877c04.js b/public/build/assets/put-bb9ad93a.js similarity index 55% rename from public/build/assets/put-79877c04.js rename to public/build/assets/put-bb9ad93a.js index e27d1ed36a..ff7abb5503 100644 --- a/public/build/assets/put-79877c04.js +++ b/public/build/assets/put-bb9ad93a.js @@ -1 +1 @@ -import{a as p}from"./format-money-0eadc9a5.js";class u{put(t,a){let r="/api/v2/transactions/"+parseInt(a.id);return p.put(r,t)}}export{u as P}; +import{a as p}from"./format-money-2e5851ad.js";class u{put(t,a){let r="/api/v2/transactions/"+parseInt(a.id);return p.put(r,t)}}export{u as P}; diff --git a/public/build/assets/show-9c7036f1.js b/public/build/assets/show-3ef1a32a.js similarity index 98% rename from public/build/assets/show-9c7036f1.js rename to public/build/assets/show-3ef1a32a.js index 4822fc8d21..4c808947a4 100644 --- a/public/build/assets/show-9c7036f1.js +++ b/public/build/assets/show-3ef1a32a.js @@ -1 +1 @@ -var y=Object.defineProperty;var w=(i,t,e)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>(w(i,typeof t!="symbol"?t+"":t,e),e);import{d as v,f as b}from"./format-money-0eadc9a5.js";import{f as g,i as h}from"./vendor-29d868f9.js";import{G as E}from"./get-e91a7549.js";import{p as _}from"./parse-downloaded-splits-c84e4e72.js";import"./create-empty-split-224dd5cc.js";class l{constructor(t){if(this.constructor===l)throw new Error("It's abstract class");this.context=t}event_show(){this.context.typeElement.hideError(),this.context.typeElement.element.value=this.context.value,this.context.element.dispatchEvent(new CustomEvent("show"))}event_shown(){this.context.element.dispatchEvent(new CustomEvent("shown"))}event_hide(){this.context.element.dispatchEvent(new CustomEvent("hide"))}event_hidden(){this.context.element.dispatchEvent(new CustomEvent("hidden"))}init(){throw new Error("Method `init` not define!")}enable(){throw new Error("Method `enable` not define!")}disable(){throw new Error("Method `disable` not define!")}hide(){throw new Error("Method `hide` not define!")}}class L extends l{init(){this.popover=new bootstrap.Popover(this.context.element,{container:"body",content:this.context.typeElement.create(),html:!0,customClass:"dark-editable",title:this.context.title}),this.context.element.addEventListener("show.bs.popover",()=>{this.event_show()}),this.context.element.addEventListener("shown.bs.popover",()=>{this.event_shown()}),this.context.element.addEventListener("hide.bs.popover",()=>{this.event_hide()}),this.context.element.addEventListener("hidden.bs.popover",()=>{this.event_hidden()}),document.addEventListener("click",t=>{const e=t.target;if(e===this.popover.tip||e===this.context.element)return;let n=e;for(;n=n.parentNode;)if(n===this.popover.tip)return;this.hide()})}enable(){this.popover.enable()}disable(){this.popover.disable()}hide(){this.popover.hide()}}class T extends l{init(){const t=()=>{if(!this.context.disabled){const e=this.context.typeElement.create();this.event_show(),this.context.element.removeEventListener("click",t),this.context.element.innerHTML="",this.context.element.append(e),this.event_shown()}};this.context.element.addEventListener("click",t)}enable(){}disable(){}hide(){this.event_hide(),this.context.element.innerHTML=this.context.value,setTimeout(()=>{this.init(),this.event_hidden()},100)}}class c{constructor(t){r(this,"context",null);r(this,"element",null);r(this,"error",null);r(this,"form",null);r(this,"load",null);r(this,"buttonGroup",null);r(this,"buttons",{success:null,cancel:null});if(this.constructor===c)throw new Error("It's abstract class");this.context=t}create(){throw new Error("Method `create` not define!")}createContainer(t){const e=document.createElement("div");this.element=t,this.error=this.createContainerError(),this.form=this.createContainerForm(),this.load=this.createContainerLoad(),this.buttons.success=this.createButtonSuccess(),this.buttons.cancel=this.createButtonCancel();const n=document.createElement("div");n.classList.add("col-12");const s=document.createElement("label");s.classList.add("visually-hidden"),s.for=t.id,n.append(s,t);const o=document.createElement("div");return o.classList.add("col-12"),this.buttonGroup=this.createButtonGroup(),this.buttonGroup.append(this.buttons.success,this.buttons.cancel),o.append(this.buttonGroup),this.form.append(n,o),e.append(this.error,this.form),e}createButtonGroup(){const t=document.createElement("div");return t.classList.add("btn-group","btn-group-sm"),t}createContainerError(){const t=document.createElement("div");return t.classList.add("text-danger","fst-italic","mb-2","fw-bold"),t.style.display="none",t}createContainerForm(){const t=document.createElement("form");return t.classList.add("row","row-cols-lg-auto","g-3","align-items-center"),t.addEventListener("submit",async e=>{e.preventDefault();const n=this.getValue();if(this.context.send&&this.context.pk&&this.context.url&&this.context.value!==n){this.showLoad();let s;try{const o=await this.ajax(n);o.ok?s=await this.context.success(o,n):s=await this.context.error(o,n)||`${o.status} ${o.statusText}`}catch(o){console.error(o),s=o}s?(this.setError(s),this.showError()):(this.setError(null),this.hideError(),this.context.value=this.getValue(),this.context.modeElement.hide(),this.initText()),this.hideLoad()}else this.context.value=this.getValue(),this.context.modeElement.hide(),this.initText();this.context.element.dispatchEvent(new CustomEvent("save"))}),t}createContainerLoad(){const t=document.createElement("div");t.style.display="none",t.style.position="absolute",t.style.background="white",t.style.width="100%",t.style.height="100%",t.style.top=0,t.style.left=0;const e=document.createElement("div");return e.classList.add("dark-editable-loader"),t.append(e),t}createButton(){const t=document.createElement("button");return t.type="button",t.classList.add("btn","btn-sm"),t.style.color="transparent",t.style.textShadow="0 0 0 white",t}createButtonSuccess(){const t=this.createButton();return t.type="submit",t.classList.add("btn-success"),t.innerHTML="✔",t}createButtonCancel(){const t=this.createButton();t.classList.add("btn-danger");const e=document.createElement("div");return e.innerHTML="✖",t.append(e),t.addEventListener("click",()=>{this.context.modeElement.hide()}),t}hideLoad(){this.load.style.display="none"}showLoad(){this.load.style.display="block"}ajax(t){let e=this.context.url,n,s=!1;console.log(this.context),this.context.options.formType==="journal_description"&&(s=!0,n={transactions:[{transaction_journal_id:this.context.options.journalId,description:t}]}),s===!1&&console.error('Cannot deal with form type "'+this.context.formType+'"');const o={headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}};return o.method=this.context.ajaxOptions.method,this.context.options.method&&(o.method=this.context.options.method),o.method==="POST"||this.context.options.method==="PUT"?o.body=JSON.stringify(n):e+="?"+new URLSearchParams(form).toString(),fetch(e,o)}async successResponse(t,e){}async errorResponse(t,e){}setError(t){this.error.innerHTML=t}showError(){this.error.style.display="block"}hideError(){this.error&&(this.error.style.display="none")}createElement(t){const e=document.createElement(t);return console.log(e),e.classList.add("form-control"),this.context.required&&(e.required=this.context.required),this.add_focus(e),e}add_focus(t){this.context.element.addEventListener("shown",function(){t.focus()})}initText(){return this.context.value===""?(this.context.element.innerHTML=this.context.emptytext,!0):(this.context.element.innerHTML=this.context.value,!1)}initOptions(){}getValue(){return this.element.value}}class M extends c{create(){const t=this.createElement("input"),e=this.context.element.id+"_input";return t.type=this.context.type,t.id=e,t.autocomplete="off",t.placeholder=this.context.element.innerText,t.classList.add("form-control","form-control-md"),this.createContainer(t)}}class C extends c{create(){const t=this.createElement("textarea");return this.createContainer(t)}}class k extends c{create(){const t=this.createElement("select");return this.context.source.forEach(e=>{const n=document.createElement("option");n.value=e.value,n.innerHTML=e.text,t.append(n)}),this.createContainer(t)}initText(){if(this.context.element.innerHTML=this.context.emptytext,this.context.value!==""&&this.context.source.length>0)for(const t in this.context.source){const e=this.context.source[t];if(e.value==this.context.value)return this.context.element.innerHTML=e.text,!1}return!0}initOptions(){this.context.get_opt("source",[]),typeof this.context.source=="string"&&this.context.source!==""&&(this.context.source=JSON.parse(this.context.source))}}class f extends c{create(){const t=this.createElement("input");return t.type="date",this.createContainer(t)}initText(){return this.value===""?(this.context.element.innerHTML=this.context.emptytext,!0):(this.context.element.innerHTML=moment(this.context.value).format(this.context.viewformat),!1)}initOptions(){this.context.get_opt("format","YYYY-MM-DD"),this.context.get_opt("viewformat","YYYY-MM-DD")}}class D extends f{create(){const t=this.createElement("input");return t.type="datetime-local",this.createContainer(t)}initOptions(){this.context.get_opt("format","YYYY-MM-DD HH:mm"),this.context.get_opt("viewformat","YYYY-MM-DD HH:mm"),this.context.value=moment(this.context.value).format("YYYY-MM-DDTHH:mm")}}class Y{constructor(t,e={}){r(this,"modeElement",null);r(this,"typeElement",null);r(this,"mode",null);r(this,"type",null);r(this,"emptytext",null);r(this,"viewformat",null);r(this,"pk",null);r(this,"name",null);this.element=t,this.options=e,this.init_options(),this.typeElement=this.route_type(),this.typeElement.initOptions(),this.modeElement=this.route_mode(),this.modeElement.init(),this.init_text(),this.init_style(),this.disabled&&this.disable(),this.element.dispatchEvent(new CustomEvent("init"))}get_opt(t,e){var n,s;return this[t]=((n=this.element.dataset)==null?void 0:n[t])??((s=this.options)==null?void 0:s[t])??e}get_opt_bool(t,e){return this.get_opt(t,e),typeof this[t]!="boolean"&&(this[t]==="true"?this[t]=!0:this[t]==="false"?this[t]=!1:this[t]=e),this[t]}init_options(){var t,e,n,s;this.get_opt("value",this.element.innerHTML),this.get_opt("name",this.element.id),this.get_opt("pk",null),this.get_opt("title",""),this.get_opt("type","text"),this.get_opt("emptytext","Empty"),this.get_opt("mode","popup"),this.get_opt("url",null),this.get_opt("ajaxOptions",{}),this.ajaxOptions=Object.assign({method:"POST",dataType:"text"},this.ajaxOptions),this.get_opt_bool("send",!0),this.get_opt_bool("disabled",!1),this.get_opt_bool("required",!1),(t=this.options)!=null&&t.success&&typeof((e=this.options)==null?void 0:e.success)=="function"&&(this.success=this.options.success),(n=this.options)!=null&&n.error&&typeof((s=this.options)==null?void 0:s.error)=="function"&&(this.error=this.options.error)}init_text(){const t="dark-editable-element-empty";this.element.classList.remove(t),this.typeElement.initText()&&this.element.classList.add(t)}init_style(){this.element.classList.add("dark-editable-element")}route_mode(){switch(this.mode){default:throw new Error(`Mode ${this.mode} not found!`);case"popup":return new L(this);case"inline":return new T(this)}}route_type(){if(this.type.prototype instanceof c)return new this.type(this);if(typeof this.type=="string")switch(this.type){case"text":case"password":case"email":case"url":case"tel":case"number":case"range":case"time":return new M(this);case"textarea":return new C(this);case"select":return new k(this);case"date":return new f(this);case"datetime":return new D(this)}throw new Error("Undefined type")}async success(t,e){return await this.typeElement.successResponse(t,e)}async error(t,e){return await this.typeElement.errorResponse(t,e)}enable(){this.disabled=!1,this.element.classList.remove("dark-editable-element-disabled"),this.modeElement.enable()}disable(){this.disabled=!0,this.element.classList.add("dark-editable-element-disabled"),this.modeElement.enable()}setValue(t){this.value=t,this.init_text()}getValue(){return this.value}}function H(i){const t=parseInt(i.dataset.id),e=parseInt(i.dataset.group),n={pk:e,mode:"inline",url:"./api/v2/transactions/"+e,formType:"journal_description",journalId:t,method:"PUT"};new Y(i,n)}let I=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},groupProperties:{id:0,transactionType:"",transactionTypeTranslated:"",title:"",date:new Date},dateFields:["book_date","due_date","interest_date","invoice_date","payment_date","process_date"],metaFields:["external_id","internal_reference","sepa_batch_id","sepa_ct_id","sepa_ct_op","sepa_db","sepa_country","sepa_cc","sepa_ep","sepa_ci","external_url"],amounts:{},entries:[],pageProperties:{},formatMoney(i,t){return console.log("formatting",i,t),t===""&&(t="EUR"),b(i,t)},format(i){return g(i,h.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=h.t("firefly.wait_loading_data");const i=window.location.href.split("/"),t=parseInt(i[i.length-1]);new E().show(t,{}).then(n=>{const s=n.data.data;this.groupProperties.id=parseInt(s.id),this.groupProperties.transactionType=s.attributes.transactions[0].type,this.groupProperties.transactionTypeTranslated=h.t("firefly."+s.attributes.transactions[0].type),this.groupProperties.title=s.attributes.title??s.attributes.transactions[0].description,this.entries=_(s.attributes.transactions,parseInt(s.id)),this.notifications.wait.show=!1}).then(()=>{for(let s in this.entries)if(this.entries.hasOwnProperty(s)){const o=this.entries[s].currency_code,a=this.entries[s].foreign_currency_code;this.amounts[o]===void 0&&(this.amounts[o]=0,this.amounts[o]+=parseFloat(this.entries[s].amount)),a!==null&&a!==""&&this.amounts[a]===void 0&&(this.amounts[a]=0,this.amounts[a]+=parseFloat(this.entries[s].foreign_amount)),parseInt(s)===0&&(this.groupProperties.date=this.entries[s].date)}const n=document.querySelectorAll(".journal_description");for(const s in n)if(n.hasOwnProperty(s)){const o=n[s];o.addEventListener("save",function(a){parseInt(a.currentTarget.dataset.id);const d=parseInt(a.currentTarget.dataset.group),u=parseInt(a.currentTarget.dataset.length),p=a.currentTarget.textContent;console.log(u),u===1&&(document.querySelector('.group_title[data-group="'+d+'"]').textContent=p,document.querySelector('.group_title_title[data-group="'+d+'"]').textContent=p)}),H(o)}}).catch(n=>{this.notifications.error.show=!0,this.notifications.error.text=n.message})}}},m={show:I,dates:v};function x(){Object.keys(m).forEach(i=>{console.log(`Loading page component "${i}"`);let t=m[i]();Alpine.data(i,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),x()});window.bootstrapped&&(console.log("Loaded through window variable."),x()); +var y=Object.defineProperty;var w=(i,t,e)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>(w(i,typeof t!="symbol"?t+"":t,e),e);import{d as v,f as b}from"./format-money-2e5851ad.js";import{f as g,i as h}from"./vendor-50e42c6c.js";import{G as E}from"./get-e0a81c64.js";import{p as _}from"./parse-downloaded-splits-83822d1b.js";import"./create-empty-split-81f71b2e.js";class l{constructor(t){if(this.constructor===l)throw new Error("It's abstract class");this.context=t}event_show(){this.context.typeElement.hideError(),this.context.typeElement.element.value=this.context.value,this.context.element.dispatchEvent(new CustomEvent("show"))}event_shown(){this.context.element.dispatchEvent(new CustomEvent("shown"))}event_hide(){this.context.element.dispatchEvent(new CustomEvent("hide"))}event_hidden(){this.context.element.dispatchEvent(new CustomEvent("hidden"))}init(){throw new Error("Method `init` not define!")}enable(){throw new Error("Method `enable` not define!")}disable(){throw new Error("Method `disable` not define!")}hide(){throw new Error("Method `hide` not define!")}}class L extends l{init(){this.popover=new bootstrap.Popover(this.context.element,{container:"body",content:this.context.typeElement.create(),html:!0,customClass:"dark-editable",title:this.context.title}),this.context.element.addEventListener("show.bs.popover",()=>{this.event_show()}),this.context.element.addEventListener("shown.bs.popover",()=>{this.event_shown()}),this.context.element.addEventListener("hide.bs.popover",()=>{this.event_hide()}),this.context.element.addEventListener("hidden.bs.popover",()=>{this.event_hidden()}),document.addEventListener("click",t=>{const e=t.target;if(e===this.popover.tip||e===this.context.element)return;let n=e;for(;n=n.parentNode;)if(n===this.popover.tip)return;this.hide()})}enable(){this.popover.enable()}disable(){this.popover.disable()}hide(){this.popover.hide()}}class T extends l{init(){const t=()=>{if(!this.context.disabled){const e=this.context.typeElement.create();this.event_show(),this.context.element.removeEventListener("click",t),this.context.element.innerHTML="",this.context.element.append(e),this.event_shown()}};this.context.element.addEventListener("click",t)}enable(){}disable(){}hide(){this.event_hide(),this.context.element.innerHTML=this.context.value,setTimeout(()=>{this.init(),this.event_hidden()},100)}}class c{constructor(t){r(this,"context",null);r(this,"element",null);r(this,"error",null);r(this,"form",null);r(this,"load",null);r(this,"buttonGroup",null);r(this,"buttons",{success:null,cancel:null});if(this.constructor===c)throw new Error("It's abstract class");this.context=t}create(){throw new Error("Method `create` not define!")}createContainer(t){const e=document.createElement("div");this.element=t,this.error=this.createContainerError(),this.form=this.createContainerForm(),this.load=this.createContainerLoad(),this.buttons.success=this.createButtonSuccess(),this.buttons.cancel=this.createButtonCancel();const n=document.createElement("div");n.classList.add("col-12");const s=document.createElement("label");s.classList.add("visually-hidden"),s.for=t.id,n.append(s,t);const o=document.createElement("div");return o.classList.add("col-12"),this.buttonGroup=this.createButtonGroup(),this.buttonGroup.append(this.buttons.success,this.buttons.cancel),o.append(this.buttonGroup),this.form.append(n,o),e.append(this.error,this.form),e}createButtonGroup(){const t=document.createElement("div");return t.classList.add("btn-group","btn-group-sm"),t}createContainerError(){const t=document.createElement("div");return t.classList.add("text-danger","fst-italic","mb-2","fw-bold"),t.style.display="none",t}createContainerForm(){const t=document.createElement("form");return t.classList.add("row","row-cols-lg-auto","g-3","align-items-center"),t.addEventListener("submit",async e=>{e.preventDefault();const n=this.getValue();if(this.context.send&&this.context.pk&&this.context.url&&this.context.value!==n){this.showLoad();let s;try{const o=await this.ajax(n);o.ok?s=await this.context.success(o,n):s=await this.context.error(o,n)||`${o.status} ${o.statusText}`}catch(o){console.error(o),s=o}s?(this.setError(s),this.showError()):(this.setError(null),this.hideError(),this.context.value=this.getValue(),this.context.modeElement.hide(),this.initText()),this.hideLoad()}else this.context.value=this.getValue(),this.context.modeElement.hide(),this.initText();this.context.element.dispatchEvent(new CustomEvent("save"))}),t}createContainerLoad(){const t=document.createElement("div");t.style.display="none",t.style.position="absolute",t.style.background="white",t.style.width="100%",t.style.height="100%",t.style.top=0,t.style.left=0;const e=document.createElement("div");return e.classList.add("dark-editable-loader"),t.append(e),t}createButton(){const t=document.createElement("button");return t.type="button",t.classList.add("btn","btn-sm"),t.style.color="transparent",t.style.textShadow="0 0 0 white",t}createButtonSuccess(){const t=this.createButton();return t.type="submit",t.classList.add("btn-success"),t.innerHTML="✔",t}createButtonCancel(){const t=this.createButton();t.classList.add("btn-danger");const e=document.createElement("div");return e.innerHTML="✖",t.append(e),t.addEventListener("click",()=>{this.context.modeElement.hide()}),t}hideLoad(){this.load.style.display="none"}showLoad(){this.load.style.display="block"}ajax(t){let e=this.context.url,n,s=!1;console.log(this.context),this.context.options.formType==="journal_description"&&(s=!0,n={transactions:[{transaction_journal_id:this.context.options.journalId,description:t}]}),s===!1&&console.error('Cannot deal with form type "'+this.context.formType+'"');const o={headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}};return o.method=this.context.ajaxOptions.method,this.context.options.method&&(o.method=this.context.options.method),o.method==="POST"||this.context.options.method==="PUT"?o.body=JSON.stringify(n):e+="?"+new URLSearchParams(form).toString(),fetch(e,o)}async successResponse(t,e){}async errorResponse(t,e){}setError(t){this.error.innerHTML=t}showError(){this.error.style.display="block"}hideError(){this.error&&(this.error.style.display="none")}createElement(t){const e=document.createElement(t);return console.log(e),e.classList.add("form-control"),this.context.required&&(e.required=this.context.required),this.add_focus(e),e}add_focus(t){this.context.element.addEventListener("shown",function(){t.focus()})}initText(){return this.context.value===""?(this.context.element.innerHTML=this.context.emptytext,!0):(this.context.element.innerHTML=this.context.value,!1)}initOptions(){}getValue(){return this.element.value}}class M extends c{create(){const t=this.createElement("input"),e=this.context.element.id+"_input";return t.type=this.context.type,t.id=e,t.autocomplete="off",t.placeholder=this.context.element.innerText,t.classList.add("form-control","form-control-md"),this.createContainer(t)}}class C extends c{create(){const t=this.createElement("textarea");return this.createContainer(t)}}class k extends c{create(){const t=this.createElement("select");return this.context.source.forEach(e=>{const n=document.createElement("option");n.value=e.value,n.innerHTML=e.text,t.append(n)}),this.createContainer(t)}initText(){if(this.context.element.innerHTML=this.context.emptytext,this.context.value!==""&&this.context.source.length>0)for(const t in this.context.source){const e=this.context.source[t];if(e.value==this.context.value)return this.context.element.innerHTML=e.text,!1}return!0}initOptions(){this.context.get_opt("source",[]),typeof this.context.source=="string"&&this.context.source!==""&&(this.context.source=JSON.parse(this.context.source))}}class f extends c{create(){const t=this.createElement("input");return t.type="date",this.createContainer(t)}initText(){return this.value===""?(this.context.element.innerHTML=this.context.emptytext,!0):(this.context.element.innerHTML=moment(this.context.value).format(this.context.viewformat),!1)}initOptions(){this.context.get_opt("format","YYYY-MM-DD"),this.context.get_opt("viewformat","YYYY-MM-DD")}}class D extends f{create(){const t=this.createElement("input");return t.type="datetime-local",this.createContainer(t)}initOptions(){this.context.get_opt("format","YYYY-MM-DD HH:mm"),this.context.get_opt("viewformat","YYYY-MM-DD HH:mm"),this.context.value=moment(this.context.value).format("YYYY-MM-DDTHH:mm")}}class Y{constructor(t,e={}){r(this,"modeElement",null);r(this,"typeElement",null);r(this,"mode",null);r(this,"type",null);r(this,"emptytext",null);r(this,"viewformat",null);r(this,"pk",null);r(this,"name",null);this.element=t,this.options=e,this.init_options(),this.typeElement=this.route_type(),this.typeElement.initOptions(),this.modeElement=this.route_mode(),this.modeElement.init(),this.init_text(),this.init_style(),this.disabled&&this.disable(),this.element.dispatchEvent(new CustomEvent("init"))}get_opt(t,e){var n,s;return this[t]=((n=this.element.dataset)==null?void 0:n[t])??((s=this.options)==null?void 0:s[t])??e}get_opt_bool(t,e){return this.get_opt(t,e),typeof this[t]!="boolean"&&(this[t]==="true"?this[t]=!0:this[t]==="false"?this[t]=!1:this[t]=e),this[t]}init_options(){var t,e,n,s;this.get_opt("value",this.element.innerHTML),this.get_opt("name",this.element.id),this.get_opt("pk",null),this.get_opt("title",""),this.get_opt("type","text"),this.get_opt("emptytext","Empty"),this.get_opt("mode","popup"),this.get_opt("url",null),this.get_opt("ajaxOptions",{}),this.ajaxOptions=Object.assign({method:"POST",dataType:"text"},this.ajaxOptions),this.get_opt_bool("send",!0),this.get_opt_bool("disabled",!1),this.get_opt_bool("required",!1),(t=this.options)!=null&&t.success&&typeof((e=this.options)==null?void 0:e.success)=="function"&&(this.success=this.options.success),(n=this.options)!=null&&n.error&&typeof((s=this.options)==null?void 0:s.error)=="function"&&(this.error=this.options.error)}init_text(){const t="dark-editable-element-empty";this.element.classList.remove(t),this.typeElement.initText()&&this.element.classList.add(t)}init_style(){this.element.classList.add("dark-editable-element")}route_mode(){switch(this.mode){default:throw new Error(`Mode ${this.mode} not found!`);case"popup":return new L(this);case"inline":return new T(this)}}route_type(){if(this.type.prototype instanceof c)return new this.type(this);if(typeof this.type=="string")switch(this.type){case"text":case"password":case"email":case"url":case"tel":case"number":case"range":case"time":return new M(this);case"textarea":return new C(this);case"select":return new k(this);case"date":return new f(this);case"datetime":return new D(this)}throw new Error("Undefined type")}async success(t,e){return await this.typeElement.successResponse(t,e)}async error(t,e){return await this.typeElement.errorResponse(t,e)}enable(){this.disabled=!1,this.element.classList.remove("dark-editable-element-disabled"),this.modeElement.enable()}disable(){this.disabled=!0,this.element.classList.add("dark-editable-element-disabled"),this.modeElement.enable()}setValue(t){this.value=t,this.init_text()}getValue(){return this.value}}function H(i){const t=parseInt(i.dataset.id),e=parseInt(i.dataset.group),n={pk:e,mode:"inline",url:"./api/v2/transactions/"+e,formType:"journal_description",journalId:t,method:"PUT"};new Y(i,n)}let I=function(){return{notifications:{error:{show:!1,text:"",url:""},success:{show:!1,text:"",url:""},wait:{show:!1,text:""}},groupProperties:{id:0,transactionType:"",transactionTypeTranslated:"",title:"",date:new Date},dateFields:["book_date","due_date","interest_date","invoice_date","payment_date","process_date"],metaFields:["external_id","internal_reference","sepa_batch_id","sepa_ct_id","sepa_ct_op","sepa_db","sepa_country","sepa_cc","sepa_ep","sepa_ci","external_url"],amounts:{},entries:[],pageProperties:{},formatMoney(i,t){return console.log("formatting",i,t),t===""&&(t="EUR"),b(i,t)},format(i){return g(i,h.t("config.date_time_fns"))},init(){this.notifications.wait.show=!0,this.notifications.wait.text=h.t("firefly.wait_loading_data");const i=window.location.href.split("/"),t=parseInt(i[i.length-1]);new E().show(t,{}).then(n=>{const s=n.data.data;this.groupProperties.id=parseInt(s.id),this.groupProperties.transactionType=s.attributes.transactions[0].type,this.groupProperties.transactionTypeTranslated=h.t("firefly."+s.attributes.transactions[0].type),this.groupProperties.title=s.attributes.title??s.attributes.transactions[0].description,this.entries=_(s.attributes.transactions,parseInt(s.id)),this.notifications.wait.show=!1}).then(()=>{for(let s in this.entries)if(this.entries.hasOwnProperty(s)){const o=this.entries[s].currency_code,a=this.entries[s].foreign_currency_code;this.amounts[o]===void 0&&(this.amounts[o]=0,this.amounts[o]+=parseFloat(this.entries[s].amount)),a!==null&&a!==""&&this.amounts[a]===void 0&&(this.amounts[a]=0,this.amounts[a]+=parseFloat(this.entries[s].foreign_amount)),parseInt(s)===0&&(this.groupProperties.date=this.entries[s].date)}const n=document.querySelectorAll(".journal_description");for(const s in n)if(n.hasOwnProperty(s)){const o=n[s];o.addEventListener("save",function(a){parseInt(a.currentTarget.dataset.id);const d=parseInt(a.currentTarget.dataset.group),u=parseInt(a.currentTarget.dataset.length),p=a.currentTarget.textContent;console.log(u),u===1&&(document.querySelector('.group_title[data-group="'+d+'"]').textContent=p,document.querySelector('.group_title_title[data-group="'+d+'"]').textContent=p)}),H(o)}}).catch(n=>{this.notifications.error.show=!0,this.notifications.error.text=n.message})}}},m={show:I,dates:v};function x(){Object.keys(m).forEach(i=>{console.log(`Loading page component "${i}"`);let t=m[i]();Alpine.data(i,()=>t)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{console.log("Loaded through event listener."),x()});window.bootstrapped&&(console.log("Loaded through window variable."),x()); diff --git a/public/build/assets/splice-errors-into-transactions-cff36293.js b/public/build/assets/splice-errors-into-transactions-6727b386.js similarity index 98% rename from public/build/assets/splice-errors-into-transactions-cff36293.js rename to public/build/assets/splice-errors-into-transactions-6727b386.js index 1fbe6892f9..4b2156117c 100644 --- a/public/build/assets/splice-errors-into-transactions-cff36293.js +++ b/public/build/assets/splice-errors-into-transactions-6727b386.js @@ -1 +1 @@ -import{a as l}from"./format-money-0eadc9a5.js";import{a as p,G as f}from"./get-eb14a1e7.js";import{n as m,i as _}from"./vendor-29d868f9.js";function x(r,t,a){let n=[];for(let o in r)if(r.hasOwnProperty(o)){const e=r[o];let i=!1,u={};t!==null&&t.hasOwnProperty(o)&&(i=!0,t[o]);let c={};(i&&u.description!==e.description||!i)&&(c.description=e.description),c.source_name=e.source_account.name,c.destination_name=e.destination_account.name,c.amount=e.amount,c.currency_code=e.currency_code,c.date=e.date,c.interest_date=e.interest_date,c.book_date=e.book_date,c.process_date=e.process_date,c.due_date=e.due_date,c.payment_date=e.payment_date,c.invoice_date=e.invoice_date,c.budget_id=e.budget_id,c.category_name=e.category_name,c.piggy_bank_id=e.piggy_bank_id,c.bill_id=e.bill_id,c.tags=e.tags,c.notes=e.notes,c.internal_reference=e.internal_reference,c.external_url=e.external_url,c.store_location=!1,e.hasLocation&&(c.store_location=!0,c.longitude=e.longitude.toString(),c.latitude=e.latitude.toString(),c.zoom_level=e.zoomLevel),typeof e.foreign_currency_code<"u"&&e.foreign_currency_code.toString()!==""&&(c.foreign_currency_code=e.foreign_currency_code,typeof e.foreign_amount<"u"&&e.foreign_amount.toString()!==""&&(c.foreign_amount=e.foreign_amount),(typeof e.foreign_amount>"u"||e.foreign_amount.toString()==="")&&(delete c.foreign_amount,delete c.foreign_currency_code)),typeof e.source_account.id<"u"&&e.source_account.id.toString()!==""&&(c.source_id=e.source_account.id),typeof e.destination_account.id<"u"&&e.destination_account.id.toString()!==""&&(c.destination_id=e.destination_account.id),c.type=a,n.push(c)}return n}let g=class{list(t){return l.get("/api/v2/currencies",{params:t})}};function C(){let r={page:1,limit:1337};return new g().list(r).then(a=>{let n={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};n.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o];if(e.attributes.enabled){let i={id:e.id,name:e.attributes.name,code:e.attributes.code,default:e.attributes.default,symbol:e.attributes.symbol,decimal_places:e.attributes.decimal_places};i.default&&(n.defaultCurrency=i),n.enabledCurrencies.push(i),n.nativeCurrencies.push(i),n.foreignCurrencies.push(i)}}return n})}class y{list(t){return l.get("/api/v2/budgets",{params:t})}}function $(){let r={page:1,limit:1337};return new y().list(r).then(a=>{let n=[{id:0,name:"(no budget)"}];for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i={id:e.id,name:e.attributes.name};n.push(i)}return n})}function O(){let r={page:1,limit:1337};return new p().list(r).then(a=>{let n={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i=e.attributes.object_group_id??"0",u=e.attributes.object_group_title??"(no group)",c={id:e.id,name:e.attributes.name,order:e.attributes.order};n.hasOwnProperty(i)||(n[i]={id:i,name:u,order:e.attributes.object_group_order??0,piggyBanks:[]}),n[i].piggyBanks.push(c),n[i].piggyBanks.sort((d,s)=>d.order-s.order)}return Object.keys(n).sort().reduce((o,e)=>(o[e]=n[e],o),{})})}function P(){let r={page:1,limit:1337};return new f().list(r).then(a=>{let n={0:{id:0,name:"(no group)",order:0,subscriptions:[{id:0,name:"(no subscription)",order:0}]}};for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i=e.attributes.object_group_id??"0",u=e.attributes.object_group_title??"(no group)",c={id:e.id,name:e.attributes.name,order:e.attributes.order};n.hasOwnProperty(i)||(n[i]={id:i,name:u,order:e.attributes.object_group_order??0,subscriptions:[]}),n[i].subscriptions.push(c),n[i].subscriptions.sort((d,s)=>d.order-s.order)}return Object.keys(n).sort().reduce((o,e)=>(o[e]=n[e],o),{})})}function j(){return{description:"/api/v2/autocomplete/transaction-descriptions",account:"/api/v2/autocomplete/accounts",category:"/api/v2/autocomplete/categories",tag:"/api/v2/autocomplete/tags"}}function A(r){const t={server:r.serverUrl,serverParams:{},fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}},hiddenInput:!0,highlightTyped:!0,liveServer:!0};typeof r.filters<"u"&&r.filters.length>0&&(t.serverParams.types=r.filters),typeof r.onRenderItem<"u"&&r.onRenderItem!==null&&(t.onRenderItem=r.onRenderItem),r.valueField&&(t.valueField=r.valueField),r.labelField&&(t.labelField=r.labelField),r.onSelectItem&&(t.onSelectItem=r.onSelectItem),r.onChange&&(t.onChange=r.onChange),r.hiddenValue&&(t.hiddenValue=r.hiddenValue),m.init(r.selector,t)}function q(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.name){document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=r.name;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=t._searchInput.value}function E(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.description){document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=r.description;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=t._searchInput.value}function B(r,t){if(typeof r>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account.name===t._searchInput.value){console.warn('Ignore hallucinated destination account name change to "'+t._searchInput.value+'"');return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}}function F(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}function G(r,t){if(typeof r>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account.name===t._searchInput.value)return;document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}}function R(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}class h{post(t,a,n){let o="/api/v1/attachments";return l.post(o,{filename:t,attachable_type:a,attachable_id:n})}upload(t,a){let n="./api/v1/attachments/"+t+"/upload";return axios.post(n,a)}}let b=function(r){let t=r.length,a=0,n=!1;for(const o in r)if(r.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&n===!1){let e=new h;e.post(r[o].name,"TransactionJournal",r[o].journal).then(i=>{let u=parseInt(i.data.data.id);e.upload(u,r[o].content).then(c=>{if(a++,a===t){const d=new CustomEvent("upload-success",{some:"details"});document.dispatchEvent(d)}}).catch(c=>{console.error("Could not upload"),console.error(c),a++;const d=new CustomEvent("upload-failed",{error:c});document.dispatchEvent(d),n=!0})}).catch(i=>{console.error("Could not create upload."),console.error(i),a++;const u=new CustomEvent("upload-failed",{error:i});document.dispatchEvent(u),n=!0})}};function T(r,t){t=t.reverse();let a=[],n=0,o=[],e=document.querySelectorAll('input[name="attachments[]"]');for(const i in e)if(e.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294)for(const u in e[i].files)e[i].files.hasOwnProperty(u)&&/^0$|^[1-9]\d*$/.test(u)&&u<=4294967294&&(a.push({journal:t[i].transaction_journal_id,file:e[i].files[u]}),n++);for(const i in a)a.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&function(u,c){let d=new FileReader;d.onloadend=function(s){s.target.readyState===FileReader.DONE&&(o.push({name:a[c].file.name,journal:a[c].journal,content:new Blob([s.target.result])}),o.length===n&&b(o))},d.readAsArrayBuffer(u.file)}(a[i],i);return n}function v(r,t,a){let n=[];for(let o in a)a.hasOwnProperty(o)&&n.push(a[o].replace(r,t));return n}function D(r,t){let a,n,o;for(const e in r)if(r.hasOwnProperty(e)){if(e==="group_title"){console.error("Cannot handle error in group title.");continue}if(a=parseInt(e.split(".")[1]),n=e.split(".")[2],o=v(e,n,r[e]),!t.hasOwnProperty(a)){console.error("Cannot handle errors in index #"+a);continue}switch(n){case"currency_code":case"foreign_currency_code":case"category_name":case"piggy_bank_id":case"notes":case"internal_reference":case"external_url":case"latitude":case"longitude":case"zoom_level":case"interest_date":case"book_date":case"process_date":case"due_date":case"payment_date":case"invoice_date":case"amount":case"date":case"budget_id":case"bill_id":case"description":case"tags":t[a].errors[n]=o;break;case"source_name":case"source_id":t[a].errors.source_account=t[a].errors.source_account.concat(o);break;case"type":t[a].errors.source_account=t[a].errors.source_account.concat([_.t("validation.bad_type_source")]),t[a].errors.destination_account=t[a].errors.destination_account.concat([_.t("validation.bad_type_destination")]);break;case"destination_name":case"destination_id":t[a].errors.destination_account=t[a].errors.destination_account.concat(o);break;case"foreign_amount":case"foreign_currency_id":t[a].errors.foreign_amount=t[a].errors.foreign_amount.concat(o);break}typeof t[a]<"u"&&(t[a].errors.source_account=Array.from(new Set(t[a].errors.source_account)),t[a].errors.destination_account=Array.from(new Set(t[a].errors.destination_account)))}return console.log(t[0].errors),t}export{$ as a,O as b,P as c,T as d,A as e,G as f,R as g,B as h,F as i,j,q as k,C as l,E as m,x as p,D as s}; +import{a as l}from"./format-money-2e5851ad.js";import{a as p,G as f}from"./get-28b9aa25.js";import{n as m,i as _}from"./vendor-50e42c6c.js";function x(r,t,a){let n=[];for(let o in r)if(r.hasOwnProperty(o)){const e=r[o];let i=!1,u={};t!==null&&t.hasOwnProperty(o)&&(i=!0,t[o]);let c={};(i&&u.description!==e.description||!i)&&(c.description=e.description),c.source_name=e.source_account.name,c.destination_name=e.destination_account.name,c.amount=e.amount,c.currency_code=e.currency_code,c.date=e.date,c.interest_date=e.interest_date,c.book_date=e.book_date,c.process_date=e.process_date,c.due_date=e.due_date,c.payment_date=e.payment_date,c.invoice_date=e.invoice_date,c.budget_id=e.budget_id,c.category_name=e.category_name,c.piggy_bank_id=e.piggy_bank_id,c.bill_id=e.bill_id,c.tags=e.tags,c.notes=e.notes,c.internal_reference=e.internal_reference,c.external_url=e.external_url,c.store_location=!1,e.hasLocation&&(c.store_location=!0,c.longitude=e.longitude.toString(),c.latitude=e.latitude.toString(),c.zoom_level=e.zoomLevel),typeof e.foreign_currency_code<"u"&&e.foreign_currency_code.toString()!==""&&(c.foreign_currency_code=e.foreign_currency_code,typeof e.foreign_amount<"u"&&e.foreign_amount.toString()!==""&&(c.foreign_amount=e.foreign_amount),(typeof e.foreign_amount>"u"||e.foreign_amount.toString()==="")&&(delete c.foreign_amount,delete c.foreign_currency_code)),typeof e.source_account.id<"u"&&e.source_account.id.toString()!==""&&(c.source_id=e.source_account.id),typeof e.destination_account.id<"u"&&e.destination_account.id.toString()!==""&&(c.destination_id=e.destination_account.id),c.type=a,n.push(c)}return n}let g=class{list(t){return l.get("/api/v2/currencies",{params:t})}};function C(){let r={page:1,limit:1337};return new g().list(r).then(a=>{let n={defaultCurrency:{},nativeCurrencies:[],foreignCurrencies:[],enabledCurrencies:[]};n.foreignCurrencies.push({id:0,name:"(no foreign currency)",code:"",default:!1,symbol:"",decimal_places:2});for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o];if(e.attributes.enabled){let i={id:e.id,name:e.attributes.name,code:e.attributes.code,default:e.attributes.default,symbol:e.attributes.symbol,decimal_places:e.attributes.decimal_places};i.default&&(n.defaultCurrency=i),n.enabledCurrencies.push(i),n.nativeCurrencies.push(i),n.foreignCurrencies.push(i)}}return n})}class y{list(t){return l.get("/api/v2/budgets",{params:t})}}function $(){let r={page:1,limit:1337};return new y().list(r).then(a=>{let n=[{id:0,name:"(no budget)"}];for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i={id:e.id,name:e.attributes.name};n.push(i)}return n})}function O(){let r={page:1,limit:1337};return new p().list(r).then(a=>{let n={0:{id:0,name:"(no group)",order:0,piggyBanks:[{id:0,name:"(no piggy bank)",order:0}]}};for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i=e.attributes.object_group_id??"0",u=e.attributes.object_group_title??"(no group)",c={id:e.id,name:e.attributes.name,order:e.attributes.order};n.hasOwnProperty(i)||(n[i]={id:i,name:u,order:e.attributes.object_group_order??0,piggyBanks:[]}),n[i].piggyBanks.push(c),n[i].piggyBanks.sort((d,s)=>d.order-s.order)}return Object.keys(n).sort().reduce((o,e)=>(o[e]=n[e],o),{})})}function P(){let r={page:1,limit:1337};return new f().list(r).then(a=>{let n={0:{id:0,name:"(no group)",order:0,subscriptions:[{id:0,name:"(no subscription)",order:0}]}};for(let o in a.data.data)if(a.data.data.hasOwnProperty(o)){let e=a.data.data[o],i=e.attributes.object_group_id??"0",u=e.attributes.object_group_title??"(no group)",c={id:e.id,name:e.attributes.name,order:e.attributes.order};n.hasOwnProperty(i)||(n[i]={id:i,name:u,order:e.attributes.object_group_order??0,subscriptions:[]}),n[i].subscriptions.push(c),n[i].subscriptions.sort((d,s)=>d.order-s.order)}return Object.keys(n).sort().reduce((o,e)=>(o[e]=n[e],o),{})})}function j(){return{description:"/api/v2/autocomplete/transaction-descriptions",account:"/api/v2/autocomplete/accounts",category:"/api/v2/autocomplete/categories",tag:"/api/v2/autocomplete/tags"}}function A(r){const t={server:r.serverUrl,serverParams:{},fetchOptions:{headers:{"X-CSRF-TOKEN":document.head.querySelector('meta[name="csrf-token"]').content}},hiddenInput:!0,highlightTyped:!0,liveServer:!0};typeof r.filters<"u"&&r.filters.length>0&&(t.serverParams.types=r.filters),typeof r.onRenderItem<"u"&&r.onRenderItem!==null&&(t.onRenderItem=r.onRenderItem),r.valueField&&(t.valueField=r.valueField),r.labelField&&(t.labelField=r.labelField),r.onSelectItem&&(t.onSelectItem=r.onSelectItem),r.onChange&&(t.onChange=r.onChange),r.hiddenValue&&(t.hiddenValue=r.hiddenValue),m.init(r.selector,t)}function q(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.name){document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=r.name;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].category_name=t._searchInput.value}function E(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);if(typeof r<"u"&&r.description){document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=r.description;return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].description=t._searchInput.value}function B(r,t){if(typeof r>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account.name===t._searchInput.value){console.warn('Ignore hallucinated destination account name change to "'+t._searchInput.value+'"');return}document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}}function F(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].destination_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedDestinationAccount()}function G(r,t){if(typeof r>"u"){const a=parseInt(t._searchInput.attributes["data-index"].value);if(document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account.name===t._searchInput.value)return;document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={name:t._searchInput.value,alpine_name:t._searchInput.value},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}}function R(r,t){const a=parseInt(t._searchInput.attributes["data-index"].value);document.querySelector("#form")._x_dataStack[0].$data.entries[a].source_account={id:r.id,name:r.name,alpine_name:r.name,type:r.type,currency_code:r.currency_code},document.querySelector("#form")._x_dataStack[0].changedSourceAccount()}class h{post(t,a,n){let o="/api/v1/attachments";return l.post(o,{filename:t,attachable_type:a,attachable_id:n})}upload(t,a){let n="./api/v1/attachments/"+t+"/upload";return axios.post(n,a)}}let b=function(r){let t=r.length,a=0,n=!1;for(const o in r)if(r.hasOwnProperty(o)&&/^0$|^[1-9]\d*$/.test(o)&&o<=4294967294&&n===!1){let e=new h;e.post(r[o].name,"TransactionJournal",r[o].journal).then(i=>{let u=parseInt(i.data.data.id);e.upload(u,r[o].content).then(c=>{if(a++,a===t){const d=new CustomEvent("upload-success",{some:"details"});document.dispatchEvent(d)}}).catch(c=>{console.error("Could not upload"),console.error(c),a++;const d=new CustomEvent("upload-failed",{error:c});document.dispatchEvent(d),n=!0})}).catch(i=>{console.error("Could not create upload."),console.error(i),a++;const u=new CustomEvent("upload-failed",{error:i});document.dispatchEvent(u),n=!0})}};function T(r,t){t=t.reverse();let a=[],n=0,o=[],e=document.querySelectorAll('input[name="attachments[]"]');for(const i in e)if(e.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294)for(const u in e[i].files)e[i].files.hasOwnProperty(u)&&/^0$|^[1-9]\d*$/.test(u)&&u<=4294967294&&(a.push({journal:t[i].transaction_journal_id,file:e[i].files[u]}),n++);for(const i in a)a.hasOwnProperty(i)&&/^0$|^[1-9]\d*$/.test(i)&&i<=4294967294&&function(u,c){let d=new FileReader;d.onloadend=function(s){s.target.readyState===FileReader.DONE&&(o.push({name:a[c].file.name,journal:a[c].journal,content:new Blob([s.target.result])}),o.length===n&&b(o))},d.readAsArrayBuffer(u.file)}(a[i],i);return n}function v(r,t,a){let n=[];for(let o in a)a.hasOwnProperty(o)&&n.push(a[o].replace(r,t));return n}function D(r,t){let a,n,o;for(const e in r)if(r.hasOwnProperty(e)){if(e==="group_title"){console.error("Cannot handle error in group title.");continue}if(a=parseInt(e.split(".")[1]),n=e.split(".")[2],o=v(e,n,r[e]),!t.hasOwnProperty(a)){console.error("Cannot handle errors in index #"+a);continue}switch(n){case"currency_code":case"foreign_currency_code":case"category_name":case"piggy_bank_id":case"notes":case"internal_reference":case"external_url":case"latitude":case"longitude":case"zoom_level":case"interest_date":case"book_date":case"process_date":case"due_date":case"payment_date":case"invoice_date":case"amount":case"date":case"budget_id":case"bill_id":case"description":case"tags":t[a].errors[n]=o;break;case"source_name":case"source_id":t[a].errors.source_account=t[a].errors.source_account.concat(o);break;case"type":t[a].errors.source_account=t[a].errors.source_account.concat([_.t("validation.bad_type_source")]),t[a].errors.destination_account=t[a].errors.destination_account.concat([_.t("validation.bad_type_destination")]);break;case"destination_name":case"destination_id":t[a].errors.destination_account=t[a].errors.destination_account.concat(o);break;case"foreign_amount":case"foreign_currency_id":t[a].errors.foreign_amount=t[a].errors.foreign_amount.concat(o);break}typeof t[a]<"u"&&(t[a].errors.source_account=Array.from(new Set(t[a].errors.source_account)),t[a].errors.destination_account=Array.from(new Set(t[a].errors.destination_account)))}return console.log(t[0].errors),t}export{$ as a,O as b,P as c,T as d,A as e,G as f,R as g,B as h,F as i,j,q as k,C as l,E as m,x as p,D as s}; diff --git a/public/build/assets/vendor-29d868f9.js b/public/build/assets/vendor-50e42c6c.js similarity index 95% rename from public/build/assets/vendor-29d868f9.js rename to public/build/assets/vendor-50e42c6c.js index 04c4e645a5..afdfeab6cb 100644 --- a/public/build/assets/vendor-29d868f9.js +++ b/public/build/assets/vendor-50e42c6c.js @@ -24,18 +24,18 @@ ${t?'Expression: "'+t+`" * (c) 2023 Jukka Kurkela * Released under the MIT License */function round(s){return s+.5|0}const lim=(s,e,t)=>Math.max(Math.min(s,t),e);function p2b(s){return lim(round(s*2.55),0,255)}function n2b(s){return lim(round(s*255),0,255)}function b2n(s){return lim(round(s/2.55)/100,0,1)}function n2p(s){return lim(round(s*100),0,100)}const map$1={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},hex=[..."0123456789ABCDEF"],h1=s=>hex[s&15],h2=s=>hex[(s&240)>>4]+hex[s&15],eq=s=>(s&240)>>4===(s&15),isShort=s=>eq(s.r)&&eq(s.g)&&eq(s.b)&&eq(s.a);function hexParse(s){var e=s.length,t;return s[0]==="#"&&(e===4||e===5?t={r:255&map$1[s[1]]*17,g:255&map$1[s[2]]*17,b:255&map$1[s[3]]*17,a:e===5?map$1[s[4]]*17:255}:(e===7||e===9)&&(t={r:map$1[s[1]]<<4|map$1[s[2]],g:map$1[s[3]]<<4|map$1[s[4]],b:map$1[s[5]]<<4|map$1[s[6]],a:e===9?map$1[s[7]]<<4|map$1[s[8]]:255})),t}const alpha=(s,e)=>s<255?e(s):"";function hexString(s){var e=isShort(s)?h1:h2;return s?"#"+e(s.r)+e(s.g)+e(s.b)+alpha(s.a,e):void 0}const HUE_RE=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function hsl2rgbn(s,e,t){const i=e*Math.min(t,1-t),n=(o,r=(o+s/30)%12)=>t-i*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function hsv2rgbn(s,e,t){const i=(n,o=(n+s/60)%6)=>t-t*e*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function hwb2rgbn(s,e,t){const i=hsl2rgbn(s,1,.5);let n;for(e+t>1&&(n=1/(e+t),e*=n,t*=n),n=0;n<3;n++)i[n]*=1-e-t,i[n]+=e;return i}function hueValue(s,e,t,i,n){return s===n?(e-t)/i+(e.5?h/(2-o-r):h/(o+r),l=hueValue(t,i,n,h,o),l=l*60+.5),[l|0,d||0,a]}function calln(s,e,t,i){return(Array.isArray(e)?s(e[0],e[1],e[2]):s(e,t,i)).map(n2b)}function hsl2rgb(s,e,t){return calln(hsl2rgbn,s,e,t)}function hwb2rgb(s,e,t){return calln(hwb2rgbn,s,e,t)}function hsv2rgb(s,e,t){return calln(hsv2rgbn,s,e,t)}function hue(s){return(s%360+360)%360}function hueParse(s){const e=HUE_RE.exec(s);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?p2b(+e[5]):n2b(+e[5]));const n=hue(+e[2]),o=+e[3]/100,r=+e[4]/100;return e[1]==="hwb"?i=hwb2rgb(n,o,r):e[1]==="hsv"?i=hsv2rgb(n,o,r):i=hsl2rgb(n,o,r),{r:i[0],g:i[1],b:i[2],a:t}}function rotate(s,e){var t=rgb2hsl(s);t[0]=hue(t[0]+e),t=hsl2rgb(t),s.r=t[0],s.g=t[1],s.b=t[2]}function hslString(s){if(!s)return;const e=rgb2hsl(s),t=e[0],i=n2p(e[1]),n=n2p(e[2]);return s.a<255?`hsla(${t}, ${i}%, ${n}%, ${b2n(s.a)})`:`hsl(${t}, ${i}%, ${n}%)`}const map={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"},names$1={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"};function unpack(){const s={},e=Object.keys(names$1),t=Object.keys(map);let i,n,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return s}let names;function nameParse(s){names||(names=unpack(),names.transparent=[0,0,0,0]);const e=names[s.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const RGB_RE=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function rgbParse(s){const e=RGB_RE.exec(s);let t=255,i,n,o;if(e){if(e[7]!==i){const r=+e[7];t=e[8]?p2b(r):lim(r*255,0,255)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?p2b(i):lim(i,0,255)),n=255&(e[4]?p2b(n):lim(n,0,255)),o=255&(e[6]?p2b(o):lim(o,0,255)),{r:i,g:n,b:o,a:t}}}function rgbString(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${b2n(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}const to=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,from=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function interpolate$1(s,e,t){const i=from(b2n(s.r)),n=from(b2n(s.g)),o=from(b2n(s.b));return{r:n2b(to(i+t*(from(b2n(e.r))-i))),g:n2b(to(n+t*(from(b2n(e.g))-n))),b:n2b(to(o+t*(from(b2n(e.b))-o))),a:s.a+t*(e.a-s.a)}}function modHSL(s,e,t){if(s){let i=rgb2hsl(s);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=hsl2rgb(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function clone$1(s,e){return s&&Object.assign(e||{},s)}function fromObject(s){var e={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(e={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(e.a=n2b(s[3]))):(e=clone$1(s,{r:0,g:0,b:0,a:1}),e.a=n2b(e.a)),e}function functionParse(s){return s.charAt(0)==="r"?rgbParse(s):hueParse(s)}class Color{constructor(e){if(e instanceof Color)return e;const t=typeof e;let i;t==="object"?i=fromObject(e):t==="string"&&(i=hexParse(e)||nameParse(e)||functionParse(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=clone$1(this._rgb);return e&&(e.a=b2n(e.a)),e}set rgb(e){this._rgb=fromObject(e)}rgbString(){return this._valid?rgbString(this._rgb):void 0}hexString(){return this._valid?hexString(this._rgb):void 0}hslString(){return this._valid?hslString(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,n=e.rgb;let o;const r=t===o?.5:t,a=2*r-1,l=i.a-n.a,d=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-d,i.r=255&d*i.r+o*n.r+.5,i.g=255&d*i.g+o*n.g+.5,i.b=255&d*i.b+o*n.b+.5,i.a=r*i.a+(1-r)*n.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=interpolate$1(this._rgb,e._rgb,t)),this}clone(){return new Color(this.rgb)}alpha(e){return this._rgb.a=n2b(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=round(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return modHSL(this._rgb,2,e),this}darken(e){return modHSL(this._rgb,2,-e),this}saturate(e){return modHSL(this._rgb,1,e),this}desaturate(e){return modHSL(this._rgb,1,-e),this}rotate(e){return rotate(this._rgb,e),this}}/*! - * Chart.js v4.4.1 + * Chart.js v4.4.2 * https://www.chartjs.org - * (c) 2023 Chart.js Contributors + * (c) 2024 Chart.js Contributors * Released under the MIT License */function noop$1(){}const uid=(()=>{let s=0;return()=>s++})();function isNullOrUndef(s){return s===null||typeof s>"u"}function isArray(s){if(Array.isArray&&Array.isArray(s))return!0;const e=Object.prototype.toString.call(s);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function isObject(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function isNumberFinite(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function finiteOrDefault(s,e){return isNumberFinite(s)?s:e}function valueOrDefault(s,e){return typeof s>"u"?e:s}const toPercentage=(s,e)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/e,toDimension=(s,e)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*e:+s;function callback(s,e,t){if(s&&typeof s.call=="function")return s.apply(t,e)}function each(s,e,t,i){let n,o,r;if(isArray(s))if(o=s.length,i)for(n=o-1;n>=0;n--)e.call(t,s[n],n);else for(n=0;ns,x:s=>s.x,y:s=>s.y};function _splitKey(s){const e=s.split("."),t=[];let i="";for(const n of e)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function _getKeyResolver(s){const e=_splitKey(s);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function resolveObjectKey(s,e){return(keyResolvers[e]||(keyResolvers[e]=_getKeyResolver(e)))(s)}function _capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}const defined$1=s=>typeof s<"u",isFunction$1=s=>typeof s=="function",setsEqual=(s,e)=>{if(s.size!==e.size)return!1;for(const t of s)if(!e.has(t))return!1;return!0};function _isClickEvent(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const PI=Math.PI,TAU=2*PI,PITAU=TAU+PI,INFINITY=Number.POSITIVE_INFINITY,RAD_PER_DEG=PI/180,HALF_PI=PI/2,QUARTER_PI=PI/4,TWO_THIRDS_PI=PI*2/3,log10=Math.log10,sign=Math.sign;function almostEquals(s,e,t){return Math.abs(s-e)n-o).pop(),e}function isNumber(s){return!isNaN(parseFloat(s))&&isFinite(s)}function almostWhole(s,e){const t=Math.round(s);return t-e<=s&&t+e>=s}function _setMinAndMaxByKey(s,e,t){let i,n,o;for(i=0,n=s.length;il&&d=Math.min(e,t)-i&&s<=Math.max(e,t)+i}function _lookup(s,e,t){t=t||(r=>s[r]1;)o=n+i>>1,t(o)?n=o:i=o;return{lo:n,hi:i}}const _lookupByKey=(s,e,t,i)=>_lookup(s,t,i?n=>{const o=s[n][e];return os[n][e]_lookup(s,t,i=>s[i][e]>=t);function _filterBetween(s,e,t){let i=0,n=s.length;for(;ii&&s[n-1]>t;)n--;return i>0||n{const i="_onData"+_capitalize(t),n=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return s._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function unlistenArrayEvents(s,e){const t=s._chartjs;if(!t)return;const i=t.listeners,n=i.indexOf(e);n!==-1&&i.splice(n,1),!(i.length>0)&&(arrayEvents.forEach(o=>{delete s[o]}),delete s._chartjs)}function _arrayUnique(s){const e=new Set(s);return e.size===s.length?s:Array.from(e)}const requestAnimFrame=function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame}();function throttled(s,e){let t=[],i=!1;return function(...n){t=n,i||(i=!0,requestAnimFrame.call(window,()=>{i=!1,s.apply(e,t)}))}}function debounce$3(s,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(s,e,i)):s.apply(this,i),e}}const _toLeftRightCenter=s=>s==="start"?"left":s==="end"?"right":"center",_alignStartEnd=(s,e,t)=>s==="start"?e:s==="end"?t:(e+t)/2,_textX=(s,e,t,i)=>s===(i?"left":"right")?t:s==="center"?(e+t)/2:e;function _getStartAndCountOfVisiblePoints(s,e,t){const i=e.length;let n=0,o=i;if(s._sorted){const{iScale:r,_parsed:a}=s,l=r.axis,{min:d,max:h,minDefined:p,maxDefined:m}=r.getUserBounds();p&&(n=_limitValue(Math.min(_lookupByKey(a,l,d).lo,t?i:_lookupByKey(e,l,r.getPixelForValue(d)).lo),0,i-1)),m?o=_limitValue(Math.max(_lookupByKey(a,r.axis,h,!0).hi+1,t?0:_lookupByKey(e,l,r.getPixelForValue(h),!0).hi+1),n,i)-n:o=i-n}return{start:n,count:o}}function _scaleRangesChanged(s){const{xScale:e,yScale:t,_scaleRanges:i}=s,n={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!i)return s._scaleRanges=n,!0;const o=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==t.min||i.ymax!==t.max;return Object.assign(i,n),o}const atEdge=s=>s===0||s===1,elasticIn=(s,e,t)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-e)*TAU/t)),elasticOut=(s,e,t)=>Math.pow(2,-10*s)*Math.sin((s-e)*TAU/t)+1,effects={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*HALF_PI)+1,easeOutSine:s=>Math.sin(s*HALF_PI),easeInOutSine:s=>-.5*(Math.cos(PI*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>atEdge(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>atEdge(s)?s:elasticIn(s,.075,.3),easeOutElastic:s=>atEdge(s)?s:elasticOut(s,.075,.3),easeInOutElastic(s){return atEdge(s)?s:s<.5?.5*elasticIn(s*2,.1125,.45):.5+.5*elasticOut(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let e=1.70158;return(s/=.5)<1?.5*(s*s*(((e*=1.525)+1)*s-e)):.5*((s-=2)*s*(((e*=1.525)+1)*s+e)+2)},easeInBounce:s=>1-effects.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?effects.easeInBounce(s*2)*.5:effects.easeOutBounce(s*2-1)*.5+.5};function isPatternOrGradient(s){if(s&&typeof s=="object"){const e=s.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function color(s){return isPatternOrGradient(s)?s:new Color(s)}function getHoverColor(s){return isPatternOrGradient(s)?s:new Color(s).saturate(.5).darken(.1).hexString()}const numbers=["x","y","borderWidth","radius","tension"],colors=["color","borderColor","backgroundColor"];function applyAnimationsDefaults(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),s.set("animations",{colors:{type:"color",properties:colors},numbers:{type:"number",properties:numbers}}),s.describe("animations",{_fallback:"animation"}),s.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:e=>e|0}}}})}function applyLayoutsDefaults(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const intlCache=new Map;function getNumberFormat(s,e){e=e||{};const t=s+JSON.stringify(e);let i=intlCache.get(t);return i||(i=new Intl.NumberFormat(s,e),intlCache.set(t,i)),i}function formatNumber(s,e,t){return getNumberFormat(e,t).format(s)}const formatters={values(s){return isArray(s)?s:""+s},numeric(s,e,t){if(s===0)return"0";const i=this.chart.options.locale;let n,o=s;if(t.length>1){const d=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(d<1e-4||d>1e15)&&(n="scientific"),o=calculateDelta(s,t)}const r=log10(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),formatNumber(s,i,l)},logarithmic(s,e,t){if(s===0)return"0";const i=t[e].significand||s/Math.pow(10,Math.floor(log10(s)));return[1,2,3,5,10,15].includes(i)||e>.8*t.length?formatters.numeric.call(this,s,e,t):""}};function calculateDelta(s,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&s!==Math.floor(s)&&(t=s-Math.floor(s)),t}var Ticks={formatters};function applyScaleDefaults(s){s.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:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.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:Ticks.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}const overrides=Object.create(null),descriptors=Object.create(null);function getScope$1(s,e){if(!e)return s;const t=e.split(".");for(let i=0,n=t.length;ii.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=(i,n)=>getHoverColor(n.backgroundColor),this.hoverBorderColor=(i,n)=>getHoverColor(n.borderColor),this.hoverColor=(i,n)=>getHoverColor(n.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(e),this.apply(t)}set(e,t){return set(this,e,t)}get(e){return getScope$1(this,e)}describe(e,t){return set(descriptors,e,t)}override(e,t){return set(overrides,e,t)}route(e,t,i,n){const o=getScope$1(this,e),r=getScope$1(this,i),a="_"+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){const l=this[a],d=r[n];return isObject(l)?Object.assign({},d,l):valueOrDefault(l,d)},set(l){this[a]=l}}})}apply(e){e.forEach(t=>t(this))}}var defaults=new Defaults({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[applyAnimationsDefaults,applyLayoutsDefaults,applyScaleDefaults]);function toFontString(s){return!s||isNullOrUndef(s.size)||isNullOrUndef(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function _measureText(s,e,t,i,n){let o=e[n];return o||(o=e[n]=s.measureText(n).width,t.push(n)),o>i&&(i=o),i}function _longestText(s,e,t,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},o=i.garbageCollect=[],i.font=e),s.save(),s.font=e;let r=0;const a=t.length;let l,d,h,p,m;for(l=0;lt.length){for(l=0;l0&&s.stroke()}}function _isPointInArea(s,e,t){return t=t||.5,!e||s&&s.x>e.left-t&&s.xe.top-t&&s.y0&&o.strokeColor!=="";let l,d;for(s.save(),s.font=n.string,setRenderOpts(s,o),l=0;l+s||0;function _readValueToProps(s,e){const t={},i=isObject(e),n=i?Object.keys(e):e,o=isObject(s)?i?r=>valueOrDefault(s[r],s[e[r]]):r=>s[r]:()=>s;for(const r of n)t[r]=numberOrZero(o(r));return t}function toTRBL(s){return _readValueToProps(s,{top:"y",right:"x",bottom:"y",left:"x"})}function toTRBLCorners(s){return _readValueToProps(s,["topLeft","topRight","bottomLeft","bottomRight"])}function toPadding(s){const e=toTRBL(s);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function toFont(s,e){s=s||{},e=e||defaults.font;let t=valueOrDefault(s.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=valueOrDefault(s.style,e.style);i&&!(""+i).match(FONT_STYLE)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:valueOrDefault(s.family,e.family),lineHeight:toLineHeight(valueOrDefault(s.lineHeight,e.lineHeight),t),size:t,style:i,weight:valueOrDefault(s.weight,e.weight),string:""};return n.string=toFontString(n),n}function resolve(s,e,t,i){let n=!0,o,r,a;for(o=0,r=s.length;ot&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(n,o)}}function createContext(s,e){return Object.assign(Object.create(s),e)}function _createResolver(s,e=[""],t,i,n=()=>s[0]){const o=t||s;typeof i>"u"&&(i=_resolve("_fallback",s));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:a=>_createResolver([a,...s],e,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete s[0][l],!0},get(a,l){return _cached(a,l,()=>_resolveWithPrefixes(l,e,s,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(a,l){return getKeysFromAllScopes(a).includes(l)},ownKeys(a){return getKeysFromAllScopes(a)},set(a,l,d){const h=a._storage||(a._storage=n());return a[l]=h[l]=d,delete a._keys,!0}})}function _attachContext(s,e,t,i){const n={_cacheable:!1,_proxy:s,_context:e,_subProxy:t,_stack:new Set,_descriptors:_descriptors(s,i),setContext:o=>_attachContext(s,o,t,i),override:o=>_attachContext(s.override(o),e,t,i)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete s[r],!0},get(o,r,a){return _cached(o,r,()=>_resolveWithContext(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(s,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,r)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,r){return Reflect.has(s,r)},ownKeys(){return Reflect.ownKeys(s)},set(o,r,a){return s[r]=a,delete o[r],!0}})}function _descriptors(s,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:n=e.allKeys}=s;return{allKeys:n,scriptable:t,indexable:i,isScriptable:isFunction$1(t)?t:()=>t,isIndexable:isFunction$1(i)?i:()=>i}}const readKey=(s,e)=>s?s+_capitalize(e):e,needsSubResolver=(s,e)=>isObject(e)&&s!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function _cached(s,e,t){if(Object.prototype.hasOwnProperty.call(s,e))return s[e];const i=t();return s[e]=i,i}function _resolveWithContext(s,e,t){const{_proxy:i,_context:n,_subProxy:o,_descriptors:r}=s;let a=i[e];return isFunction$1(a)&&r.isScriptable(e)&&(a=_resolveScriptable(e,a,s,t)),isArray(a)&&a.length&&(a=_resolveArray(e,a,s,r.isIndexable)),needsSubResolver(e,a)&&(a=_attachContext(a,n,o&&o[e],r)),a}function _resolveScriptable(s,e,t,i){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=t;if(a.has(s))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+s);a.add(s);let l=e(o,r||i);return a.delete(s),needsSubResolver(s,l)&&(l=createSubResolver(n._scopes,n,s,l)),l}function _resolveArray(s,e,t,i){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=t;if(typeof o.index<"u"&&i(s))return e[o.index%e.length];if(isObject(e[0])){const l=e,d=n._scopes.filter(h=>h!==l);e=[];for(const h of l){const p=createSubResolver(d,n,s,h);e.push(_attachContext(p,o,r&&r[s],a))}}return e}function resolveFallback(s,e,t){return isFunction$1(s)?s(e,t):s}const getScope=(s,e)=>s===!0?e:typeof s=="string"?resolveObjectKey(e,s):void 0;function addScopes(s,e,t,i,n){for(const o of e){const r=getScope(t,o);if(r){s.add(r);const a=resolveFallback(r._fallback,t,n);if(typeof a<"u"&&a!==t&&a!==i)return a}else if(r===!1&&typeof i<"u"&&t!==i)return null}return!1}function createSubResolver(s,e,t,i){const n=e._rootScopes,o=resolveFallback(e._fallback,t,i),r=[...s,...n],a=new Set;a.add(i);let l=addScopesFromKey(a,r,t,o||t,i);return l===null||typeof o<"u"&&o!==t&&(l=addScopesFromKey(a,r,o,l,i),l===null)?!1:_createResolver(Array.from(a),[""],n,o,()=>subGetTarget(e,t,i))}function addScopesFromKey(s,e,t,i,n){for(;t;)t=addScopes(s,e,t,i,n);return t}function subGetTarget(s,e,t){const i=s._getTarget();e in i||(i[e]={});const n=i[e];return isArray(n)&&isObject(t)?t:n||{}}function _resolveWithPrefixes(s,e,t,i){let n;for(const o of e)if(n=_resolve(readKey(o,s),t),typeof n<"u")return needsSubResolver(s,n)?createSubResolver(t,i,s,n):n}function _resolve(s,e){for(const t of e){if(!t)continue;const i=t[s];if(typeof i<"u")return i}}function getKeysFromAllScopes(s){let e=s._keys;return e||(e=s._keys=resolveKeysFromAllScopes(s._scopes)),e}function resolveKeysFromAllScopes(s){const e=new Set;for(const t of s)for(const i of Object.keys(t).filter(n=>!n.startsWith("_")))e.add(i);return Array.from(e)}function _parseObjectDataRadialScale(s,e,t,i){const{iScale:n}=s,{key:o="r"}=this._parsing,r=new Array(i);let a,l,d,h;for(a=0,l=i;aes==="x"?"y":"x";function splineCurve(s,e,t,i){const n=s.skip?e:s,o=e,r=t.skip?e:t,a=distanceBetweenPoints(o,n),l=distanceBetweenPoints(r,o);let d=a/(a+l),h=l/(a+l);d=isNaN(d)?0:d,h=isNaN(h)?0:h;const p=i*d,m=i*h;return{previous:{x:o.x-p*(r.x-n.x),y:o.y-p*(r.y-n.y)},next:{x:o.x+m*(r.x-n.x),y:o.y+m*(r.y-n.y)}}}function monotoneAdjust(s,e,t){const i=s.length;let n,o,r,a,l,d=getPoint(s,0);for(let h=0;h!d.skip)),e.cubicInterpolationMode==="monotone")splineCurveMonotone(s,n);else{let d=i?s[s.length-1]:s[0];for(o=0,r=s.length;os.ownerDocument.defaultView.getComputedStyle(s,null);function getStyle(s,e){return getComputedStyle$1(s).getPropertyValue(e)}const positions=["top","right","bottom","left"];function getPositionedStyle(s,e,t){const i={};t=t?"-"+t:"";for(let n=0;n<4;n++){const o=positions[n];i[o]=parseFloat(s[e+"-"+o+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const useOffsetPos=(s,e,t)=>(s>0||e>0)&&(!t||!t.shadowRoot);function getCanvasPosition(s,e){const t=s.touches,i=t&&t.length?t[0]:s,{offsetX:n,offsetY:o}=i;let r=!1,a,l;if(useOffsetPos(n,o,s.target))a=n,l=o;else{const d=e.getBoundingClientRect();a=i.clientX-d.left,l=i.clientY-d.top,r=!0}return{x:a,y:l,box:r}}function getRelativePosition(s,e){if("native"in s)return s;const{canvas:t,currentDevicePixelRatio:i}=e,n=getComputedStyle$1(t),o=n.boxSizing==="border-box",r=getPositionedStyle(n,"padding"),a=getPositionedStyle(n,"border","width"),{x:l,y:d,box:h}=getCanvasPosition(s,t),p=r.left+(h&&a.left),m=r.top+(h&&a.top);let{width:v,height:y}=e;return o&&(v-=r.width+a.width,y-=r.height+a.height),{x:Math.round((l-p)/v*t.width/i),y:Math.round((d-m)/y*t.height/i)}}function getContainerSize(s,e,t){let i,n;if(e===void 0||t===void 0){const o=_getParentNode(s);if(!o)e=s.clientWidth,t=s.clientHeight;else{const r=o.getBoundingClientRect(),a=getComputedStyle$1(o),l=getPositionedStyle(a,"border","width"),d=getPositionedStyle(a,"padding");e=r.width-d.width-l.width,t=r.height-d.height-l.height,i=parseMaxStyle(a.maxWidth,o,"clientWidth"),n=parseMaxStyle(a.maxHeight,o,"clientHeight")}}return{width:e,height:t,maxWidth:i||INFINITY,maxHeight:n||INFINITY}}const round1=s=>Math.round(s*10)/10;function getMaximumSize(s,e,t,i){const n=getComputedStyle$1(s),o=getPositionedStyle(n,"margin"),r=parseMaxStyle(n.maxWidth,s,"clientWidth")||INFINITY,a=parseMaxStyle(n.maxHeight,s,"clientHeight")||INFINITY,l=getContainerSize(s,e,t);let{width:d,height:h}=l;if(n.boxSizing==="content-box"){const m=getPositionedStyle(n,"border","width"),v=getPositionedStyle(n,"padding");d-=v.width+m.width,h-=v.height+m.height}return d=Math.max(0,d-o.width),h=Math.max(0,i?d/i:h-o.height),d=round1(Math.min(d,r,l.maxWidth)),h=round1(Math.min(h,a,l.maxHeight)),d&&!h&&(h=round1(d/2)),(e!==void 0||t!==void 0)&&i&&l.height&&h>l.height&&(h=l.height,d=round1(Math.floor(h*i))),{width:d,height:h}}function retinaScale(s,e,t){const i=e||1,n=Math.floor(s.height*i),o=Math.floor(s.width*i);s.height=Math.floor(s.height),s.width=Math.floor(s.width);const r=s.canvas;return r.style&&(t||!r.style.height&&!r.style.width)&&(r.style.height=`${s.height}px`,r.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||r.height!==n||r.width!==o?(s.currentDevicePixelRatio=i,r.height=n,r.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}const supportsEventListenerOptions=function(){let s=!1;try{const e={get passive(){return s=!0,!1}};_isDomSupported()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return s}();function readUsedSize(s,e){const t=getStyle(s,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function _pointInLine(s,e,t,i){return{x:s.x+t*(e.x-s.x),y:s.y+t*(e.y-s.y)}}function _steppedInterpolation(s,e,t,i){return{x:s.x+t*(e.x-s.x),y:i==="middle"?t<.5?s.y:e.y:i==="after"?t<1?s.y:e.y:t>0?e.y:s.y}}function _bezierInterpolation(s,e,t,i){const n={x:s.cp2x,y:s.cp2y},o={x:e.cp1x,y:e.cp1y},r=_pointInLine(s,n,t),a=_pointInLine(n,o,t),l=_pointInLine(o,e,t),d=_pointInLine(r,a,t),h=_pointInLine(a,l,t);return _pointInLine(d,h,t)}const getRightToLeftAdapter=function(s,e){return{x(t){return s+s+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},getLeftToRightAdapter=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,e){return s+e},leftForLtr(s,e){return s}}};function getRtlAdapter(s,e,t){return s?getRightToLeftAdapter(e,t):getLeftToRightAdapter()}function overrideTextDirection(s,e){let t,i;(e==="ltr"||e==="rtl")&&(t=s.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),s.prevTextDirection=i)}function restoreTextDirection(s,e){e!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",e[0],e[1]))}function propertyFn(s){return s==="angle"?{between:_angleBetween,compare:_angleDiff,normalize:_normalizeAngle}:{between:_isBetween,compare:(e,t)=>e-t,normalize:e=>e}}function normalizeSegment({start:s,end:e,count:t,loop:i,style:n}){return{start:s%t,end:e%t,loop:i&&(e-s+1)%t===0,style:n}}function getSegment(s,e,t){const{property:i,start:n,end:o}=t,{between:r,normalize:a}=propertyFn(i),l=e.length;let{start:d,end:h,loop:p}=s,m,v;if(p){for(d+=l,h+=l,m=0,v=l;ml(n,R,E)&&a(n,R)!==0,D=()=>a(o,E)===0||l(o,R,E),x=()=>b||A(),M=()=>!b||D();for(let I=h,V=h;I<=p;++I)T=e[I%r],!T.skip&&(E=d(T[i]),E!==R&&(b=l(E,n,o),S===null&&x()&&(S=a(E,n)===0?I:V),S!==null&&M()&&(y.push(normalizeSegment({start:S,end:I,loop:m,count:r,style:v})),S=null),V=I,R=E));return S!==null&&y.push(normalizeSegment({start:S,end:p,loop:m,count:r,style:v})),y}function _boundSegments(s,e){const t=[],i=s.segments;for(let n=0;nn&&s[o%e].skip;)o--;return o%=e,{start:n,end:o}}function solidSegments(s,e,t,i){const n=s.length,o=[];let r=e,a=s[e],l;for(l=e+1;l<=t;++l){const d=s[l%n];d.skip||d.stop?a.skip||(i=!1,o.push({start:e%n,end:(l-1)%n,loop:i}),e=r=d.stop?l:null):(r=l,a.skip&&(e=l)),a=d}return r!==null&&o.push({start:e%n,end:r%n,loop:i}),o}function _computeSegments(s,e){const t=s.points,i=s.options.spanGaps,n=t.length;if(!n)return[];const o=!!s._loop,{start:r,end:a}=findStartAndEnd(t,n,o,i);if(i===!0)return splitByStyles(s,[{start:r,end:a,loop:o}],t,e);const l=aa({chart:e,initial:t.initial,numSteps:r,currentStep:Math.min(i-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,e,"progress")),o.length||(i.running=!1,this._notify(n,i,e,"complete"),i.initial=!1),t+=o.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(s,e,t){return t>.5?e:s},color(s,e,t){const i=color(s||transparent),n=i.valid&&color(e||transparent);return n&&n.valid?n.mix(i,t).hexString():e},number(s,e,t){return s+(e-s)*t}};class Animation{constructor(e,t,i,n){const o=t[i];n=resolve([e.to,n,o,e.from]);const r=resolve([e.from,o,n]);this._active=!0,this._fn=e.fn||interpolators[e.type||typeof r],this._easing=effects[e.easing]||effects.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=resolve([e.to,t,n,e.from]),this._from=resolve([e.from,n,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||t1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let n=0;n{const o=e[n];if(!isObject(o))return;const r={};for(const a of t)r[a]=o[a];(isArray(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(e,t){const i=t.options,n=resolveTargetOptions(e,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&awaitAll(e.options.$animations,i).then(()=>{e.options=i},()=>{}),o}_createAnimations(e,t){const i=this._properties,n=[],o=e.$animations||(e.$animations={}),r=Object.keys(t),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const d=r[l];if(d.charAt(0)==="$")continue;if(d==="options"){n.push(...this._animateOptions(e,t));continue}const h=t[d];let p=o[d];const m=i.get(d);if(p)if(m&&p.active()){p.update(m,h,a);continue}else p.cancel();if(!m||!m.duration){e[d]=h;continue}o[d]=p=new Animation(m,e,d,h),n.push(p)}return n}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return animator.add(this._chart,i),!0}}function awaitAll(s,e){const t=[],i=Object.keys(e);for(let n=0;n0||!t&&o<0)return n.index}return null}function updateStacks(s,e){const{chart:t,_cachedMeta:i}=s,n=t._stacks||(t._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,d=r.axis,h=getStackKey(o,r,i),p=e.length;let m;for(let v=0;vt[i].axis===e).shift()}function createDatasetContext(s,e){return createContext(s,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(s,e,t){return createContext(s,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function clearStacks(s,e){const t=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){e=e||s._parsed;for(const n of e){const o=n._stacks;if(!o||o[i]===void 0||o[i][t]===void 0)return;delete o[i][t],o[i]._visualValues!==void 0&&o[i]._visualValues[t]!==void 0&&delete o[i]._visualValues[t]}}}const isDirectUpdateMode=s=>s==="reset"||s==="none",cloneIfNotShared=(s,e)=>e?s:Object.assign({},s),createStack=(s,e,t)=>s&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(t,!0),values:null};class DatasetController{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=isStacked(e.vScale,e),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(e){this.index!==e&&clearStacks(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),n=(p,m,v,y)=>p==="x"?m:p==="r"?y:v,o=t.xAxisID=valueOrDefault(i.xAxisID,getFirstScaleId(e,"x")),r=t.yAxisID=valueOrDefault(i.yAxisID,getFirstScaleId(e,"y")),a=t.rAxisID=valueOrDefault(i.rAxisID,getFirstScaleId(e,"r")),l=t.indexAxis,d=t.iAxisID=n(l,o,r,a),h=t.vAxisID=n(l,r,o,a);t.xScale=this.getScaleForId(o),t.yScale=this.getScaleForId(r),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(d),t.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&unlistenArrayEvents(this._data,this),e._stacked&&clearStacks(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(isObject(t))this._data=convertObjectDataToArray(t);else if(i!==t){if(i){unlistenArrayEvents(i,this);const n=this._cachedMeta;clearStacks(n),n._parsed=[]}t&&Object.isExtensible(t)&&listenArrayEvents(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=t._stacked;t._stacked=isStacked(t.vScale,t),t.stack!==i.stack&&(n=!0,clearStacks(t),t.stack=i.stack),this._resyncElements(e),(n||o!==t._stacked)&&updateStacks(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=e===0&&t===n.length?!0:i._sorted,d=e>0&&i._parsed[e-1],h,p,m;if(this._parsing===!1)i._parsed=n,i._sorted=!0,m=n;else{isArray(n[e])?m=this.parseArrayData(i,n,e,t):isObject(n[e])?m=this.parseObjectData(i,n,e,t):m=this.parsePrimitiveData(i,n,e,t);const v=()=>p[a]===null||d&&p[a]b||p=0;--m)if(!y()){this.updateRangeFromParsed(d,e,v,l);break}}return d}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let n,o,r;for(n=0,o=t.length;n=0&&ethis.getContext(i,n,t),b=d.resolveNamedOptions(m,v,y,p);return b.$shared&&(b.$shared=l,o[r]=Object.freeze(cloneIfNotShared(b,l))),b}_resolveAnimations(e,t,i){const n=this.chart,o=this._cachedDataOpts,r=`animation-${t}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,p=h.datasetAnimationScopeKeys(this._type,t),m=h.getOptionScopes(this.getDataset(),p);l=h.createResolver(m,this.getContext(e,i,t))}const d=new Animations(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(d)),d}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||isDirectUpdateMode(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),n=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(t,o)||o!==n;return this.updateSharedOptions(o,t,i),{sharedOptions:o,includeOptions:r}}updateElement(e,t,i,n){isDirectUpdateMode(n)?Object.assign(e,i):this._resolveAnimations(t,n).update(e,i)}updateSharedOptions(e,t,i){e&&!isDirectUpdateMode(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,n){e.active=n;const o=this.getStyle(t,n);this._resolveAnimations(t,i,n).update(e,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[a,l,d]of this._syncList)this[a](l,d);this._syncList=[];const n=i.length,o=t.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,e):o{for(d.length+=t,a=d.length-1;a>=r;a--)d[a]=d[a-t]};for(l(o),a=e;an-o))}return s._cache.$bar}function computeMinSampleSize(s){const e=s.iScale,t=getAllScaleValues(e,s.type);let i=e._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(defined$1(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(n=0,o=t.length;n0?n[s-1]:null,a=sMath.abs(a)&&(l=a,d=r),e[t.axis]=d,e._custom={barStart:l,barEnd:d,start:n,end:o,min:r,max:a}}function parseValue(s,e,t,i){return isArray(s)?parseFloatBar(s,e,t,i):e[t.axis]=t.parse(s,i),e}function parseArrayOrPrimitive(s,e,t,i){const n=s.iScale,o=s.vScale,r=n.getLabels(),a=n===o,l=[];let d,h,p,m;for(d=t,h=t+i;d=t?1:-1)}function borderProps(s){let e,t,i,n,o;return s.horizontal?(e=s.base>s.x,t="left",i="right"):(e=s.basel.controller.options.grouped),o=i.options.stacked,r=[],a=l=>{const d=l.controller.getParsed(t),h=d&&d[l.vScale.axis];if(isNullOrUndef(h)||isNaN(h))return!0};for(const l of n)if(!(t!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===e))break;return r.length||r.push(void 0),r}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,i){const n=this._getStacks(e,i),o=t!==void 0?n.indexOf(t):-1;return o===-1?n.length-1:o}_getRuler(){const e=this.options,t=this._cachedMeta,i=t.iScale,n=[];let o,r;for(o=0,r=t.data.length;o_angleBetween(R,a,l,!0)?1:Math.max(A,A*t,D,D*t),y=(R,A,D)=>_angleBetween(R,a,l,!0)?-1:Math.min(A,A*t,D,D*t),b=v(0,d,p),S=v(HALF_PI,h,m),E=y(PI,d,p),T=y(PI+HALF_PI,h,m);i=(b-E)/2,n=(S-T)/2,o=-(b+E)/2,r=-(S+T)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:r}}class DoughnutController extends DatasetController{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let o=l=>+i[l];if(isObject(i[e])){const{key:l="value"}=this._parsing;o=d=>+resolveObjectKey(i[d],l)}let r,a;for(r=e,a=e+t;r0&&!isNaN(e)?TAU*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=formatNumber(t._parsed[e],i.options.locale);return{label:n[e]||"",value:o}}getMaxBorderWidth(e){let t=0;const i=this.chart;let n,o,r,a,l;if(!e){for(n=0,o=i.data.datasets.length;ne!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),G(DoughnutController,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:i,color:n}}=e.legend.options;return t.labels.map((o,r)=>{const l=e.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(r),index:r}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}}});class LineController extends DatasetController{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=t,r=this.chart._animationsDisabled;let{start:a,count:l}=_getStartAndCountOfVisiblePoints(t,n,r);this._drawStart=a,this._drawCount=l,_scaleRangesChanged(t)&&(a=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const d=this.resolveDatasetElementOptions(e);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:d},e),this.updateElements(n,a,l,e)}updateElements(e,t,i,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:d}=this._cachedMeta,{sharedOptions:h,includeOptions:p}=this._getSharedOptions(t,n),m=r.axis,v=a.axis,{spanGaps:y,segment:b}=this.options,S=isNumber(y)?y:Number.POSITIVE_INFINITY,E=this.chart._animationsDisabled||o||n==="none",T=t+i,R=e.length;let A=t>0&&this.getParsed(t-1);for(let D=0;D=T){M.skip=!0;continue}const I=this.getParsed(D),V=isNullOrUndef(I[v]),z=M[m]=r.getPixelForValue(I[m],D),B=M[v]=o||V?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,I,l):I[v],D);M.skip=isNaN(z)||isNaN(B)||V,M.stop=D>0&&Math.abs(I[m]-A[m])>S,b&&(M.parsed=I,M.raw=d.data[D]),p&&(M.options=h||this.resolveDataElementOptions(D,x.active?"active":n)),E||this.updateElement(x,D,M,n),A=I}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,n=e.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,r)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}G(LineController,"id","line"),G(LineController,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),G(LineController,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class PolarAreaController extends DatasetController{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=formatNumber(t._parsed[e].r,i.options.locale);return{label:n[e]||"",value:o}}parseObjectData(e,t,i,n){return _parseObjectDataRadialScale.bind(this)(e,t,i,n)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(ot.max&&(t.max=o))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,i=e.options,n=Math.min(t.right-t.left,t.bottom-t.top),o=Math.max(n/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/e.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,i,n){const o=n==="reset",r=this.chart,l=r.options.animation,d=this._cachedMeta.rScale,h=d.xCenter,p=d.yCenter,m=d.getIndexAngle(0)-.5*PI;let v=m,y;const b=360/this.countVisibleElements();for(y=0;y{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?toRadians(this.resolveDataElementOptions(e,t).angle||i):0}}G(PolarAreaController,"id","polarArea"),G(PolarAreaController,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),G(PolarAreaController,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:i,color:n}}=e.legend.options;return t.labels.map((o,r)=>{const l=e.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(r),index:r}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class PieController extends DoughnutController{}G(PieController,"id","pie"),G(PieController,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function abstract(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class DateAdapterBase{constructor(e){G(this,"options");this.options=e||{}}static override(e){Object.assign(DateAdapterBase.prototype,e)}init(){}formats(){return abstract()}parse(){return abstract()}format(){return abstract()}add(){return abstract()}diff(){return abstract()}startOf(){return abstract()}endOf(){return abstract()}}var adapters={_date:DateAdapterBase};function binarySearch(s,e,t,i){const{controller:n,data:o,_sorted:r}=s,a=n._cachedMeta.iScale;if(a&&e===a.axis&&e!=="r"&&r&&o.length){const l=a._reversePixels?_rlookupByKey:_lookupByKey;if(i){if(n._sharedOptions){const d=o[0],h=typeof d.getRange=="function"&&d.getRange(e);if(h){const p=l(o,e,t-h),m=l(o,e,t+h);return{lo:p.lo,hi:m.hi}}}}else return l(o,e,t)}return{lo:0,hi:o.length-1}}function evaluateInteractionItems(s,e,t,i,n){const o=s.getSortedVisibleDatasetMetas(),r=t[e];for(let a=0,l=o.length;a{l[r](e[t],n)&&(o.push({element:l,datasetIndex:d,index:h}),a=a||l.inRange(e.x,e.y,n))}),i&&!a?[]:o}var Interaction={evaluateInteractionItems,modes:{index(s,e,t,i){const n=getRelativePosition(e,s),o=t.axis||"x",r=t.includeInvisible||!1,a=t.intersect?getIntersectItems(s,n,o,i,r):getNearestItems(s,n,o,!1,i,r),l=[];return a.length?(s.getSortedVisibleDatasetMetas().forEach(d=>{const h=a[0].index,p=d.data[h];p&&!p.skip&&l.push({element:p,datasetIndex:d.index,index:h})}),l):[]},dataset(s,e,t,i){const n=getRelativePosition(e,s),o=t.axis||"xy",r=t.includeInvisible||!1;let a=t.intersect?getIntersectItems(s,n,o,i,r):getNearestItems(s,n,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,d=s.getDatasetMeta(l).data;a=[];for(let h=0;ht.pos===e)}function filterDynamicPositionByAxis(s,e){return s.filter(t=>STATIC_POSITIONS.indexOf(t.pos)===-1&&t.box.axis===e)}function sortByWeight(s,e){return s.sort((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function wrapBoxes(s){const e=[];let t,i,n,o,r,a;for(t=0,i=(s||[]).length;td.box.fullSize),!0),i=sortByWeight(filterByPosition(e,"left"),!0),n=sortByWeight(filterByPosition(e,"right")),o=sortByWeight(filterByPosition(e,"top"),!0),r=sortByWeight(filterByPosition(e,"bottom")),a=filterDynamicPositionByAxis(e,"x"),l=filterDynamicPositionByAxis(e,"y");return{fullSize:t,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:filterByPosition(e,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function getCombinedMax(s,e,t,i){return Math.max(s[t],e[t])+Math.max(s[i],e[i])}function updateMaxPadding(s,e){s.top=Math.max(s.top,e.top),s.left=Math.max(s.left,e.left),s.bottom=Math.max(s.bottom,e.bottom),s.right=Math.max(s.right,e.right)}function updateDims(s,e,t,i){const{pos:n,box:o}=t,r=s.maxPadding;if(!isObject(n)){t.size&&(s[n]-=t.size);const p=i[t.stack]||{size:0,count:1};p.size=Math.max(p.size,t.horizontal?o.height:o.width),t.size=p.size/p.count,s[n]+=t.size}o.getPadding&&updateMaxPadding(r,o.getPadding());const a=Math.max(0,e.outerWidth-getCombinedMax(r,s,"left","right")),l=Math.max(0,e.outerHeight-getCombinedMax(r,s,"top","bottom")),d=a!==s.w,h=l!==s.h;return s.w=a,s.h=l,t.horizontal?{same:d,other:h}:{same:h,other:d}}function handleMaxPadding(s){const e=s.maxPadding;function t(i){const n=Math.max(e[i]-s[i],0);return s[i]+=n,n}s.y+=t("top"),s.x+=t("left"),t("right"),t("bottom")}function getMargins(s,e){const t=e.maxPadding;function i(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(e[r],t[r])}),o}return i(s?["left","right"]:["top","bottom"])}function fitBoxes(s,e,t,i){const n=[];let o,r,a,l,d,h;for(o=0,r=s.length,d=0;o{typeof b.beforeLayout=="function"&&b.beforeLayout()});const h=l.reduce((b,S)=>S.box.options&&S.box.options.display===!1?b:b+1,0)||1,p=Object.freeze({outerWidth:e,outerHeight:t,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),m=Object.assign({},n);updateMaxPadding(m,toPadding(i));const v=Object.assign({maxPadding:m,w:o,h:r,x:n.left,y:n.top},n),y=setLayoutDims(l.concat(d),p);fitBoxes(a.fullSize,v,p,y),fitBoxes(l,v,p,y),fitBoxes(d,v,p,y)&&fitBoxes(l,v,p,y),handleMaxPadding(v),placeBoxes(a.leftAndTop,v,p,y),v.x+=v.w,v.y+=v.h,placeBoxes(a.rightAndBottom,v,p,y),s.chartArea={left:v.left,top:v.top,right:v.left+v.w,bottom:v.top+v.h,height:v.h,width:v.w},each(a.chartArea,b=>{const S=b.box;Object.assign(S,s.chartArea),S.update(v.w,v.h,{left:0,top:0,right:0,bottom:0})})}};class BasePlatform{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,n){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,n?Math.floor(t/n):i)}}isAttached(e){return!0}updateConfig(e){}}class BasicPlatform extends BasePlatform{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=s=>s===null||s==="";function initCanvas(s,e){const t=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[EXPANDO_KEY]={initial:{height:i,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",isNullOrEmpty(n)){const o=readUsedSize(s,"width");o!==void 0&&(s.width=o)}if(isNullOrEmpty(i))if(s.style.height==="")s.height=s.width/(e||2);else{const o=readUsedSize(s,"height");o!==void 0&&(s.height=o)}return s}const eventListenerOptions=supportsEventListenerOptions?{passive:!0}:!1;function addListener(s,e,t){s.addEventListener(e,t,eventListenerOptions)}function removeListener(s,e,t){s.canvas.removeEventListener(e,t,eventListenerOptions)}function fromNativeEvent(s,e){const t=EVENT_TYPES[s.type]||s.type,{x:i,y:n}=getRelativePosition(s,e);return{type:t,chart:e,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function nodeListContains(s,e){for(const t of s)if(t===e||t.contains(e))return!0}function createAttachObserver(s,e,t){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||nodeListContains(a.addedNodes,i),r=r&&!nodeListContains(a.removedNodes,i);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function createDetachObserver(s,e,t){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||nodeListContains(a.removedNodes,i),r=r&&!nodeListContains(a.addedNodes,i);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const s=window.devicePixelRatio;s!==oldDevicePixelRatio&&(oldDevicePixelRatio=s,drpListeningCharts.forEach((e,t)=>{t.currentDevicePixelRatio!==s&&e()}))}function listenDevicePixelRatioChanges(s,e){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(s,e)}function unlistenDevicePixelRatioChanges(s){drpListeningCharts.delete(s),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(s,e,t){const i=s.canvas,n=i&&_getParentNode(i);if(!n)return;const o=throttled((a,l)=>{const d=n.clientWidth;t(a,l),d{const l=a[0],d=l.contentRect.width,h=l.contentRect.height;d===0&&h===0||o(d,h)});return r.observe(n),listenDevicePixelRatioChanges(s,o),r}function releaseObserver(s,e,t){t&&t.disconnect(),e==="resize"&&unlistenDevicePixelRatioChanges(s)}function createProxyAndListen(s,e,t){const i=s.canvas,n=throttled(o=>{s.ctx!==null&&t(fromNativeEvent(o,s))},s);return addListener(i,e,n),n}class DomPlatform extends BasePlatform{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(initCanvas(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[EXPANDO_KEY])return!1;const i=t[EXPANDO_KEY].initial;["height","width"].forEach(o=>{const r=i[o];isNullOrUndef(r)?t.removeAttribute(o):t.setAttribute(o,r)});const n=i.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o]}),t.width=t.width,delete t[EXPANDO_KEY],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const n=e.$proxies||(e.$proxies={}),r={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[t]||createProxyAndListen;n[t]=r(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),n=i[t];if(!n)return;({attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[t]||removeListener)(e,t,n),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,n){return getMaximumSize(e,t,i,n)}isAttached(e){const t=_getParentNode(e);return!!(t&&t.isConnected)}}function _detectPlatform(s){return!_isDomSupported()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?BasicPlatform:DomPlatform}var Qt;let Element$1=(Qt=class{constructor(){G(this,"x");G(this,"y");G(this,"active",!1);G(this,"options");G(this,"$animations")}tooltipPosition(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(e,t){const i=this.$animations;if(!t||!i)return this;const n={};return e.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}},G(Qt,"defaults",{}),G(Qt,"defaultRoutes"),Qt);function autoSkip(s,e){const t=s.options.ticks,i=determineMaxTicks(s),n=Math.min(t.maxTicksLimit||i,i),o=t.major.enabled?getMajorIndices(e):[],r=o.length,a=o[0],l=o[r-1],d=[];if(r>n)return skipMajors(e,d,o,r/n),d;const h=calculateSpacing(o,e,n);if(r>0){let p,m;const v=r>1?Math.round((l-a)/(r-1)):null;for(skip(e,d,h,isNullOrUndef(v)?0:a-v,a),p=0,m=r-1;pn)return l}return Math.max(n,1)}function getMajorIndices(s){const e=[];let t,i;for(t=0,i=s.length;ts==="left"?"right":s==="right"?"left":s,offsetFromEdge=(s,e,t)=>e==="top"||e==="left"?s[e]+t:s[e]-t,getTicksLimit=(s,e)=>Math.min(e||s,s);function sample(s,e){const t=[],i=s.length/e,n=s.length;let o=0;for(;or+a)))return l}function garbageCollect(s,e){each(s,t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;oi?i:t,i=n&&t>i?t:i,{min:finiteOrDefault(t,finiteOrDefault(i,t)),max:finiteOrDefault(i,finiteOrDefault(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,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=_addGrace(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),p=h.widest.width,m=h.highest.height,v=_limitValue(this.chart.width-p,0,this.maxWidth);a=e.offset?this.maxWidth/i:v/(i-1),p+6>a&&(a=v/(i-(e.offset?.5:1)),l=this.maxHeight-getTickMarkLength(e.grid)-t.padding-getTitleHeight(e.title,this.chart.options.font),d=Math.sqrt(p*p+m*m),r=toDegrees(Math.min(Math.asin(_limitValue((h.highest.height+6)/a,-1,1)),Math.asin(_limitValue(l/d,-1,1))-Math.asin(_limitValue(m/d,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){callback(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){callback(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=getTitleHeight(n,t.options.font);if(a?(e.width=this.maxWidth,e.height=getTickMarkLength(o)+l):(e.height=this.maxHeight,e.width=getTickMarkLength(o)+l),i.display&&this.ticks.length){const{first:d,last:h,widest:p,highest:m}=this._getLabelSizes(),v=i.padding*2,y=toRadians(this.labelRotation),b=Math.cos(y),S=Math.sin(y);if(a){const E=i.mirror?0:S*p.width+b*m.height;e.height=Math.min(this.maxHeight,e.height+E+v)}else{const E=i.mirror?0:b*p.width+S*m.height;e.width=Math.min(this.maxWidth,e.width+E+v)}this._calculatePadding(d,h,S,b)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,d=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,p=this.right-this.getPixelForTick(this.ticks.length-1);let m=0,v=0;l?d?(m=n*e.width,v=i*t.height):(m=i*e.height,v=n*t.width):o==="start"?v=t.width:o==="end"?m=e.width:o!=="inner"&&(m=e.width/2,v=t.width/2),this.paddingLeft=Math.max((m-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((v-p+r)*this.width/(this.width-p),0)}else{let h=t.height/2,p=e.height/2;o==="start"?(h=0,p=e.height):o==="end"&&(h=t.height,p=0),this.paddingTop=h+r,this.paddingBottom=p+r}}_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(){callback(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t({width:r[V]||0,height:a[V]||0});return{first:I(0),last:I(t-1),widest:I(x),highest:I(M),widths:r,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return _int16Range(this._alignToPixels?_alignPixel(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&ea*n?a/i:l/n:l*n0}_computeGridLineItems(e){const t=this.axis,i=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,d=this.isHorizontal(),p=this.ticks.length+(l?1:0),m=getTickMarkLength(o),v=[],y=a.setContext(this.getContext()),b=y.display?y.width:0,S=b/2,E=function($){return _alignPixel(i,$,b)};let T,R,A,D,x,M,I,V,z,B,K,J;if(r==="top")T=E(this.bottom),M=this.bottom-m,V=T-S,B=E(e.top)+S,J=e.bottom;else if(r==="bottom")T=E(this.top),B=e.top,J=E(e.bottom)-S,M=T+S,V=this.top+m;else if(r==="left")T=E(this.right),x=this.right-m,I=T-S,z=E(e.left)+S,K=e.right;else if(r==="right")T=E(this.left),z=e.left,K=E(e.right)-S,x=T+S,I=this.left+m;else if(t==="x"){if(r==="center")T=E((e.top+e.bottom)/2+.5);else if(isObject(r)){const $=Object.keys(r)[0],Y=r[$];T=E(this.chart.scales[$].getPixelForValue(Y))}B=e.top,J=e.bottom,M=T+S,V=M+m}else if(t==="y"){if(r==="center")T=E((e.left+e.right)/2);else if(isObject(r)){const $=Object.keys(r)[0],Y=r[$];T=E(this.chart.scales[$].getPixelForValue(Y))}x=T-S,I=x-m,z=e.left,K=e.right}const Z=valueOrDefault(n.ticks.maxTicksLimit,p),F=Math.max(1,Math.ceil(p/Z));for(R=0;R0&&(te-=oe/2);break}se={left:te,top:ie,width:oe+pe.width,height:ae+pe.height,color:F.backdropColor}}S.push({label:A,font:V,textOffset:K,options:{rotation:b,color:Y,strokeColor:W,strokeWidth:X,textAlign:U,textBaseline:J,translation:[D,x],backdrop:se}})}return S}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-toRadians(this.labelRotation))return e==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=e+o,l=r.widest.width;let d,h;return t==="left"?n?(h=this.right+o,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h+=l)):(h=this.right-a,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h=this.left)):t==="right"?n?(h=this.left+o,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h-=l)):(h=this.left+a,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h=this.right)):d="right",{textAlign:d,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:i,top:n,width:o,height:r}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,n,o,r),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex(o=>o.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,r;const a=(l,d,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(t.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,r;for(o=0,r=t.length;o{const i=t.split("."),n=i.pop(),o=[s].concat(i).join("."),r=e[t].split("."),a=r.pop(),l=r.join(".");defaults.route(o,n,l,a)})}function isIChartComponent(s){return"id"in s&&"defaults"in s}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element$1,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(n=>{const o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(e,o,n):each(n,r=>{const a=i||this._getRegistryForType(r);this._exec(e,a,r)})})}_exec(e,t,i){const n=_capitalize(e);callback(i["before"+n],[],i),t[e](i),callback(i["after"+n],[],i)}_getRegistryForType(e){for(let t=0;to.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,i),e,"stop"),this._notify(n(i,t),e,"start")}}function allPlugins(s){const e={},t=[],i=Object.keys(registry.plugins.items);for(let o=0;o1&&idMatchesAxis(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(s,e,t){if(t[e+"AxisID"]===s)return{axis:e}}function retrieveAxisFromDatasets(s,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(t.length)return getAxisFromDataset(s,"x",t[0])||getAxisFromDataset(s,"y",t[0])}return{}}function mergeScaleConfig(s,e){const t=overrides[s.type]||{scales:{}},i=e.scales||{},n=getIndexAxis(s.type,e),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!isObject(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=determineAxis(r,a,retrieveAxisFromDatasets(r,s),defaults.scales[a.type]),d=getDefaultScaleIDFromAxis(l,n),h=t.scales||{};o[r]=mergeIf(Object.create(null),[{axis:l},a,h[l],h[d]])}),s.data.datasets.forEach(r=>{const a=r.type||s.type,l=r.indexAxis||getIndexAxis(a,e),h=(overrides[a]||{}).scales||{};Object.keys(h).forEach(p=>{const m=getAxisFromDefaultScaleID(p,l),v=r[m+"AxisID"]||m;o[v]=o[v]||Object.create(null),mergeIf(o[v],[{axis:m},i[v],h[p]])})}),Object.keys(o).forEach(r=>{const a=o[r];mergeIf(a,[defaults.scales[a.type],defaults.scale])}),o}function initOptions(s){const e=s.options||(s.options={});e.plugins=valueOrDefault(e.plugins,{}),e.scales=mergeScaleConfig(s,e)}function initData(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function initConfig(s){return s=s||{},s.data=initData(s.data),initOptions(s),s}const keyCache=new Map,keysCached=new Set;function cachedKeys(s,e){let t=keyCache.get(s);return t||(t=e(),keyCache.set(s,t),keysCached.add(t)),t}const addIfFound=(s,e,t)=>{const i=resolveObjectKey(e,t);i!==void 0&&s.add(i)};class Config{constructor(e){this._config=initConfig(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=initData(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),initOptions(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return cachedKeys(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return cachedKeys(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return cachedKeys(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return cachedKeys(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let n=i.get(e);return(!n||t)&&(n=new Map,i.set(e,n)),n}getOptionScopes(e,t,i){const{options:n,type:o}=this,r=this._cachedScopes(e,i),a=r.get(t);if(a)return a;const l=new Set;t.forEach(h=>{e&&(l.add(e),h.forEach(p=>addIfFound(l,e,p))),h.forEach(p=>addIfFound(l,n,p)),h.forEach(p=>addIfFound(l,overrides[o]||{},p)),h.forEach(p=>addIfFound(l,defaults,p)),h.forEach(p=>addIfFound(l,descriptors,p))});const d=Array.from(l);return d.length===0&&d.push(Object.create(null)),keysCached.has(t)&&r.set(t,d),d}chartOptionScopes(){const{options:e,type:t}=this;return[e,overrides[t]||{},defaults.datasets[t]||{},{type:t},defaults,descriptors]}resolveNamedOptions(e,t,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=getResolver(this._resolverCache,e,n);let l=r;if(needContext(r,t)){o.$shared=!1,i=isFunction$1(i)?i():i;const d=this.createResolver(e,i,a);l=_attachContext(r,i,d)}for(const d of t)o[d]=l[d];return o}createResolver(e,t,i=[""],n){const{resolver:o}=getResolver(this._resolverCache,e,i);return isObject(t)?_attachContext(o,t,void 0,n):o}}function getResolver(s,e,t){let i=s.get(e);i||(i=new Map,s.set(e,i));const n=t.join();let o=i.get(n);return o||(o={resolver:_createResolver(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},i.set(n,o)),o}const hasFunction=s=>isObject(s)&&Object.getOwnPropertyNames(s).some(e=>isFunction$1(s[e]));function needContext(s,e){const{isScriptable:t,isIndexable:i}=_descriptors(s);for(const n of e){const o=t(n),r=i(n),a=(r||o)&&s[n];if(o&&(isFunction$1(a)||hasFunction(a))||r&&isArray(a))return!0}return!1}var version="4.4.1";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(s,e){return s==="top"||s==="bottom"||KNOWN_POSITIONS.indexOf(s)===-1&&e==="x"}function compare2Level(s,e){return function(t,i){return t[s]===i[s]?t[e]-i[e]:t[s]-i[s]}}function onAnimationsComplete(s){const e=s.chart,t=e.options.animation;e.notifyPlugins("afterRender"),callback(t&&t.onComplete,[s],e)}function onAnimationProgress(s){const e=s.chart,t=e.options.animation;callback(t&&t.onProgress,[s],e)}function getCanvas(s){return _isDomSupported()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const instances={},getChart=s=>{const e=getCanvas(s);return Object.values(instances).filter(t=>t.canvas===e).pop()};function moveNumericKeys(s,e,t){const i=Object.keys(s);for(const n of i){const o=+n;if(o>=e){const r=s[n];delete s[n],(t>0||o>e)&&(s[o+t]=r)}}}function determineLastEvent(s,e,t,i){return!t||s.type==="mouseout"?null:i?e:s}function getSizeForArea(s,e,t){return s.options.clip?s[t]:e[t]}function getDatasetArea(s,e){const{xScale:t,yScale:i}=s;return t&&i?{left:getSizeForArea(t,e,"left"),right:getSizeForArea(t,e,"right"),top:getSizeForArea(i,e,"top"),bottom:getSizeForArea(i,e,"bottom")}:e}class Chart{static register(...e){registry.add(...e),invalidatePlugins()}static unregister(...e){registry.remove(...e),invalidatePlugins()}constructor(e,t){const i=this.config=new Config(t),n=getCanvas(e),o=getChart(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 r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_detectPlatform(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,d=l&&l.height,h=l&&l.width;if(this.id=uid(),this.ctx=a,this.canvas=l,this.width=h,this.height=d,this._options=r,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 PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=debounce$3(p=>this.update(p),r.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:n,_aspectRatio:o}=this;return isNullOrUndef(e)?t&&o?o:n?i/n:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(e,t){animator.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,e,t,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,retinaScale(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),callback(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};each(t,(i,n)=>{i.id=n})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,n=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];t&&(o=o.concat(Object.keys(t).map(r=>{const a=t[r],l=determineAxis(r,a),d=l==="r",h=l==="x";return{options:a,dposition:d?"chartArea":h?"bottom":"left",dtype:d?"radialLinear":h?"category":"linear"}}))),each(o,r=>{const a=r.options,l=a.id,d=determineAxis(l,a),h=valueOrDefault(a.type,r.dtype);(a.position===void 0||positionIsHorizontal(a.position,d)!==positionIsHorizontal(r.dposition))&&(a.position=r.dposition),n[l]=!0;let p=null;if(l in i&&i[l].type===h)p=i[l];else{const m=registry.getScale(h);p=new m({id:l,type:h,ctx:this.ctx,chart:this}),i[p.id]=p}p.init(a,e)}),each(n,(r,a)=>{r||delete i[a]}),each(i,r=>{layouts.configure(this,r,r.options),layouts.addBox(this,r)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((n,o)=>n.index-o.index),i>t){for(let n=t;nt.length&&delete this._stacks,e.forEach((i,n)=>{t.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let d=0,h=this.data.datasets.length;d{d.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(compare2Level("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){each(this.scales,e=>{layouts.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!setsEqual(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of t){const r=i==="_removeElements"?-o:o;moveNumericKeys(e,n,r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=o=>new Set(e.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;layouts.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],each(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,n=!i.disabled,o=getDatasetArea(e,this.chartArea),r={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&clipArea(t,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),e.controller.draw(),n&&unclipArea(t),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return _isPointInArea(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,n){const o=Interaction.modes[t];return typeof o=="function"?o(this,e,i,n):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let n=i.filter(o=>o&&o._dataset===t).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const n=i?"show":"hide",o=this.getDatasetMeta(e),r=o.controller._resolveAnimations(void 0,n);defined$1(t)?(o.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===e?n:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),animator.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,o,r),e[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};each(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(l,d)=>{t.addEventListener(this,l,d),e[l]=d},n=(l,d)=>{e[l]&&(t.removeEventListener(this,l,d),delete e[l])},o=(l,d)=>{this.canvas&&this.resize(l,d)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",a)},t.isAttached(this.canvas)?a():r()}unbindEvents(){each(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},each(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const n=i?"set":"remove";let o,r,a,l;for(t==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!_elementsEqual(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,i){const n=this.options.hover,o=(l,d)=>l.filter(h=>!d.some(p=>h.datasetIndex===p.datasetIndex&&h.index===p.index)),r=o(t,e),a=i?e:o(e,t);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},n=r=>(r.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const o=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:n=[],options:o}=this,r=t,a=this._getActiveElements(e,n,i,r),l=_isClickEvent(e),d=determineLastEvent(e,this._lastEvent,i,l);i&&(this._lastEvent=null,callback(o.onHover,[e,a,this],this),l&&callback(o.onClick,[e,a,this],this));const h=!_elementsEqual(a,n);return(h||t)&&(this._active=a,this._updateHoverStyles(a,n,t)),this._lastEvent=d,h}_getActiveElements(e,t,i,n){if(e.type==="mouseout")return[];if(!i)return t;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,n)}}G(Chart,"defaults",defaults),G(Chart,"instances",instances),G(Chart,"overrides",overrides),G(Chart,"registry",registry),G(Chart,"version",version),G(Chart,"getChart",getChart);function invalidatePlugins(){return each(Chart.instances,s=>s._plugins.invalidate())}function clipArc(s,e,t){const{startAngle:i,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=e;let d=n/a;s.beginPath(),s.arc(o,r,a,i-d,t+d),l>n?(d=n/l,s.arc(o,r,l,t+d,i-d,!0)):s.arc(o,r,n,t+HALF_PI,i-HALF_PI),s.closePath(),s.clip()}function toRadiusCorners(s){return _readValueToProps(s,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(s,e,t,i){const n=toRadiusCorners(s.options.borderRadius),o=(t-e)/2,r=Math.min(o,i*e/2),a=l=>{const d=(t-Math.min(o,l))*i/2;return _limitValue(l,0,Math.min(o,d))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:_limitValue(n.innerStart,0,r),innerEnd:_limitValue(n.innerEnd,0,r)}}function rThetaToXY(s,e,t,i){return{x:t+s*Math.cos(e),y:i+s*Math.sin(e)}}function pathArc(s,e,t,i,n,o){const{x:r,y:a,startAngle:l,pixelMargin:d,innerRadius:h}=e,p=Math.max(e.outerRadius+i+t-d,0),m=h>0?h+i+t+d:0;let v=0;const y=n-l;if(i){const F=h>0?h-i:0,$=p>0?p-i:0,Y=(F+$)/2,W=Y!==0?y*Y/(Y+i):y;v=(y-W)/2}const b=Math.max(.001,y*p-t/PI)/p,S=(y-b)/2,E=l+S+v,T=n-S-v,{outerStart:R,outerEnd:A,innerStart:D,innerEnd:x}=parseBorderRadius$1(e,m,p,T-E),M=p-R,I=p-A,V=E+R/M,z=T-A/I,B=m+D,K=m+x,J=E+D/B,Z=T-x/K;if(s.beginPath(),o){const F=(V+z)/2;if(s.arc(r,a,p,V,F),s.arc(r,a,p,F,z),A>0){const X=rThetaToXY(I,z,r,a);s.arc(X.x,X.y,A,z,T+HALF_PI)}const $=rThetaToXY(K,T,r,a);if(s.lineTo($.x,$.y),x>0){const X=rThetaToXY(K,Z,r,a);s.arc(X.x,X.y,x,T+HALF_PI,Z+Math.PI)}const Y=(T-x/m+(E+D/m))/2;if(s.arc(r,a,m,T-x/m,Y,!0),s.arc(r,a,m,Y,E+D/m,!0),D>0){const X=rThetaToXY(B,J,r,a);s.arc(X.x,X.y,D,J+Math.PI,E-HALF_PI)}const W=rThetaToXY(M,E,r,a);if(s.lineTo(W.x,W.y),R>0){const X=rThetaToXY(M,V,r,a);s.arc(X.x,X.y,R,E-HALF_PI,V)}}else{s.moveTo(r,a);const F=Math.cos(V)*p+r,$=Math.sin(V)*p+a;s.lineTo(F,$);const Y=Math.cos(z)*p+r,W=Math.sin(z)*p+a;s.lineTo(Y,W)}s.closePath()}function drawArc(s,e,t,i,n){const{fullCircles:o,startAngle:r,circumference:a}=e;let l=e.endAngle;if(o){pathArc(s,e,t,i,l,n);for(let d=0;d=TAU||_angleBetween(r,l,d),S=_isBetween(a,h+v,p+v);return b&&S}getCenterPoint(t){const{x:i,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:d,spacing:h}=this.options,p=(o+r)/2,m=(a+l+h+d)/2;return{x:i+Math.cos(p)*m,y:n+Math.sin(p)*m}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:i,circumference:n}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>TAU?Math.floor(n/TAU):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const l=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(l)*o,Math.sin(l)*o);const d=1-Math.sin(Math.min(PI,n||0)),h=o*d;t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,drawArc(t,this,h,r,a),drawBorder(t,this,h,r,a),t.restore()}}G(ArcElement,"id","arc"),G(ArcElement,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),G(ArcElement,"defaultRoutes",{backgroundColor:"backgroundColor"}),G(ArcElement,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"});function setStyle$1(s,e,t=e){s.lineCap=valueOrDefault(t.borderCapStyle,e.borderCapStyle),s.setLineDash(valueOrDefault(t.borderDash,e.borderDash)),s.lineDashOffset=valueOrDefault(t.borderDashOffset,e.borderDashOffset),s.lineJoin=valueOrDefault(t.borderJoinStyle,e.borderJoinStyle),s.lineWidth=valueOrDefault(t.borderWidth,e.borderWidth),s.strokeStyle=valueOrDefault(t.borderColor,e.borderColor)}function lineTo(s,e,t){s.lineTo(t.x,t.y)}function getLineMethod(s){return s.stepped?_steppedLineTo:s.tension||s.cubicInterpolationMode==="monotone"?_bezierCurveTo:lineTo}function pathVars(s,e,t={}){const i=s.length,{start:n=0,end:o=i-1}=t,{start:r,end:a}=e,l=Math.max(n,r),d=Math.min(o,a),h=na&&o>a;return{count:i,start:l,loop:e.loop,ilen:d(r+(d?a-A:A))%o,R=()=>{b!==S&&(s.lineTo(h,S),s.lineTo(h,b),s.lineTo(h,E))};for(l&&(v=n[T(0)],s.moveTo(v.x,v.y)),m=0;m<=a;++m){if(v=n[T(m)],v.skip)continue;const A=v.x,D=v.y,x=A|0;x===y?(DS&&(S=D),h=(p*h+A)/++p):(R(),s.lineTo(A,D),y=x,p=0,b=S=D),E=D}R()}function _getSegmentMethod(s){const e=s.options,t=e.borderDash&&e.borderDash.length;return!s._decimated&&!s._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?fastPathSegment:pathSegment}function _getInterpolationMethod(s){return s.stepped?_steppedInterpolation:s.tension||s.cubicInterpolationMode==="monotone"?_bezierInterpolation:_pointInLine}function strokePathWithCache(s,e,t,i){let n=e._path;n||(n=e._path=new Path2D,e.path(n,t,i)&&n.closePath()),setStyle$1(s,e.options),s.stroke(n)}function strokePathDirect(s,e,t,i){const{segments:n,options:o}=e,r=_getSegmentMethod(e);for(const a of n)setStyle$1(s,o,a.style),s.beginPath(),r(s,e,a,{start:t,end:t+i-1})&&s.closePath(),s.stroke()}const usePath2D=typeof Path2D=="function";function draw(s,e,t,i){usePath2D&&!e.options.segment?strokePathWithCache(s,e,t,i):strokePathDirect(s,e,t,i)}class LineElement extends Element$1{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;_updateBezierControlPoints(this._points,i,e,n,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_computeSegments(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,n=e[t],o=this.points,r=_boundSegments(this,{property:t,start:n,end:n});if(!r.length)return;const a=[],l=_getInterpolationMethod(i);let d,h;for(d=0,h=r.length;de!=="borderDash"&&e!=="fill"});function inRange$1(s,e,t,i){const n=s.options,{[t]:o}=s.getProps([t],i);return Math.abs(e-o)s.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(s){return BORDER_COLORS[s%BORDER_COLORS.length]}function getBackgroundColor(s){return BACKGROUND_COLORS[s%BACKGROUND_COLORS.length]}function colorizeDefaultDataset(s,e){return s.borderColor=getBorderColor(e),s.backgroundColor=getBackgroundColor(e),++e}function colorizeDoughnutDataset(s,e){return s.backgroundColor=s.data.map(()=>getBorderColor(e++)),e}function colorizePolarAreaDataset(s,e){return s.backgroundColor=s.data.map(()=>getBackgroundColor(e++)),e}function getColorizer(s){let e=0;return(t,i)=>{const n=s.getDatasetMeta(i).controller;n instanceof DoughnutController?e=colorizeDoughnutDataset(t,e):n instanceof PolarAreaController?e=colorizePolarAreaDataset(t,e):n&&(e=colorizeDefaultDataset(t,e))}}function containsColorsDefinitions(s){let e;for(e in s)if(s[e].borderColor||s[e].backgroundColor)return!0;return!1}function containsColorsDefinition(s){return s&&(s.borderColor||s.backgroundColor)}var plugin_colors={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,e,t){if(!t.enabled)return;const{data:{datasets:i},options:n}=s.config,{elements:o}=n;if(!t.forceOverride&&(containsColorsDefinitions(i)||containsColorsDefinition(n)||o&&containsColorsDefinitions(o)))return;const r=getColorizer(s);i.forEach(r)}};function _segments(s,e,t){const i=s.segments,n=s.points,o=e.points,r=[];for(const a of i){let{start:l,end:d}=a;d=_findSegmentEnd(l,d,n);const h=_getBounds(t,n[l],n[d],a.loop);if(!e.segments){r.push({source:a,target:h,start:n[l],end:n[d]});continue}const p=_boundSegments(e,h);for(const m of p){const v=_getBounds(t,o[m.start],o[m.end],m.loop),y=_boundSegment(a,n,v);for(const b of y)r.push({source:b,target:m,start:{[t]:_getEdge(h,v,"start",Math.max)},end:{[t]:_getEdge(h,v,"end",Math.min)}})}}return r}function _getBounds(s,e,t,i){if(i)return;let n=e[s],o=t[s];return s==="angle"&&(n=_normalizeAngle(n),o=_normalizeAngle(o)),{property:s,start:n,end:o}}function _pointsFromSegments(s,e){const{x:t=null,y:i=null}=s||{},n=e.points,o=[];return e.segments.forEach(({start:r,end:a})=>{a=_findSegmentEnd(r,a,n);const l=n[r],d=n[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:d.x,y:i})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:d.y}))}),o}function _findSegmentEnd(s,e,t){for(;e>s;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function _getEdge(s,e,t,i){return s&&e?i(s[t],e[t]):s?s[t]:e?e[t]:0}function _createBoundaryLine(s,e){let t=[],i=!1;return isArray(s)?(i=!0,t=s):t=_pointsFromSegments(s,e),t.length?new LineElement({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function _shouldApplyFill(s){return s&&s.fill!==!1}function _resolveTarget(s,e,t){let n=s[e].fill;const o=[e];let r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!isNumberFinite(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function _decodeFill(s,e,t){const i=parseFillOption(s);if(isObject(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return isNumberFinite(n)&&Math.floor(n)===n?decodeTargetIndex(i[0],e,n,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function decodeTargetIndex(s,e,t,i){return(s==="-"||s==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function _getTargetPixel(s,e){let t=null;return s==="start"?t=e.bottom:s==="end"?t=e.top:isObject(s)?t=e.getPixelForValue(s.value):e.getBasePixel&&(t=e.getBasePixel()),t}function _getTargetValue(s,e,t){let i;return s==="start"?i=t:s==="end"?i=e.options.reverse?e.min:e.max:isObject(s)?i=s.value:i=e.getBaseValue(),i}function parseFillOption(s){const e=s.options,t=e.fill;let i=valueOrDefault(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function _buildStackLine(s){const{scale:e,index:t,line:i}=s,n=[],o=i.segments,r=i.points,a=getLinesBelow(e,t);a.push(_createBoundaryLine({x:null,y:e.bottom},i));for(let l=0;l=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&_drawfill(s.ctx,a,o))}},beforeDatasetsDraw(s,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const o=i[n].$filler;_shouldApplyFill(o)&&_drawfill(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,e,t){const i=e.meta.$filler;!_shouldApplyFill(i)||t.drawTime!=="beforeDatasetDraw"||_drawfill(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const getBoxSize=(s,e)=>{let{boxHeight:t=e,boxWidth:i=e}=s;return s.usePointStyle&&(t=Math.min(t,e),i=s.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:t,itemHeight:Math.max(e,t)}},itemsEqual=(s,e)=>s!==null&&e!==null&&s.datasetIndex===e.datasetIndex&&s.index===e.index;class Legend extends Element$1{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t,i){this.maxWidth=e,this.maxHeight=t,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 e=this.options.labels||{};let t=callback(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(i=>e.filter(i,this.chart.data))),e.sort&&(t=t.sort((i,n)=>e.sort(i,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}const i=e.labels,n=toFont(i.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=getBoxSize(i,o);let d,h;t.font=n.string,this.isHorizontal()?(d=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,d=this._fitCols(r,n,a,l)+10),this.width=Math.min(d,e.maxWidth||this.maxWidth),this.height=Math.min(h,e.maxHeight||this.maxHeight)}_fitRows(e,t,i,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.lineWidths=[0],h=n+a;let p=e;o.textAlign="left",o.textBaseline="middle";let m=-1,v=-h;return this.legendItems.forEach((y,b)=>{const S=i+t/2+o.measureText(y.text).width;(b===0||d[d.length-1]+S+2*a>r)&&(p+=h,d[d.length-(b>0?0:1)]=0,v+=h,m++),l[b]={left:0,top:v,row:m,width:S,height:n},d[d.length-1]+=S+a}),p}_fitCols(e,t,i,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.columnSizes=[],h=r-e;let p=a,m=0,v=0,y=0,b=0;return this.legendItems.forEach((S,E)=>{const{itemWidth:T,itemHeight:R}=calculateItemSize(i,t,o,S,n);E>0&&v+R+2*a>h&&(p+=m+a,d.push({width:m,height:v}),y+=m+a,b++,m=v=0),l[E]={left:y,top:v,col:b,width:T,height:R},m=Math.max(m,T),v+=R+a}),p+=m,d.push({width:m,height:v}),p}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:i,labels:{padding:n},rtl:o}}=this,r=getRtlAdapter(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a]);for(const d of t)a!==d.row&&(a=d.row,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a])),d.top+=this.top+e+n,d.left=r.leftForLtr(r.x(l),d.width),l+=d.width+n}else{let a=0,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height);for(const d of t)d.col!==a&&(a=d.col,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height)),d.top=l,d.left+=this.left+n,d.left=r.leftForLtr(r.x(d.left),d.width),l+=d.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;clipArea(e,this),this._draw(),unclipArea(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:i,ctx:n}=this,{align:o,labels:r}=e,a=defaults.color,l=getRtlAdapter(e.rtl,this.left,this.width),d=toFont(r.font),{padding:h}=r,p=d.size,m=p/2;let v;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=d.string;const{boxWidth:y,boxHeight:b,itemHeight:S}=getBoxSize(r,p),E=function(x,M,I){if(isNaN(y)||y<=0||isNaN(b)||b<0)return;n.save();const V=valueOrDefault(I.lineWidth,1);if(n.fillStyle=valueOrDefault(I.fillStyle,a),n.lineCap=valueOrDefault(I.lineCap,"butt"),n.lineDashOffset=valueOrDefault(I.lineDashOffset,0),n.lineJoin=valueOrDefault(I.lineJoin,"miter"),n.lineWidth=V,n.strokeStyle=valueOrDefault(I.strokeStyle,a),n.setLineDash(valueOrDefault(I.lineDash,[])),r.usePointStyle){const z={radius:b*Math.SQRT2/2,pointStyle:I.pointStyle,rotation:I.rotation,borderWidth:V},B=l.xPlus(x,y/2),K=M+m;drawPointLegend(n,z,B,K,r.pointStyleWidth&&y)}else{const z=M+Math.max((p-b)/2,0),B=l.leftForLtr(x,y),K=toTRBLCorners(I.borderRadius);n.beginPath(),Object.values(K).some(J=>J!==0)?addRoundedRectPath(n,{x:B,y:z,w:y,h:b,radius:K}):n.rect(B,z,y,b),n.fill(),V!==0&&n.stroke()}n.restore()},T=function(x,M,I){renderText(n,I.text,x,M+S/2,d,{strikethrough:I.hidden,textAlign:l.textAlign(I.textAlign)})},R=this.isHorizontal(),A=this._computeTitleHeight();R?v={x:_alignStartEnd(o,this.left+h,this.right-i[0]),y:this.top+h+A,line:0}:v={x:this.left+h,y:_alignStartEnd(o,this.top+A+h,this.bottom-t[0].height),line:0},overrideTextDirection(this.ctx,e.textDirection);const D=S+h;this.legendItems.forEach((x,M)=>{n.strokeStyle=x.fontColor,n.fillStyle=x.fontColor;const I=n.measureText(x.text).width,V=l.textAlign(x.textAlign||(x.textAlign=r.textAlign)),z=y+m+I;let B=v.x,K=v.y;l.setWidth(this.width),R?M>0&&B+z+h>this.right&&(K=v.y+=D,v.line++,B=v.x=_alignStartEnd(o,this.left+h,this.right-i[v.line])):M>0&&K+D>this.bottom&&(B=v.x=B+t[v.line].width+h,v.line++,K=v.y=_alignStartEnd(o,this.top+A+h,this.bottom-t[v.line].height));const J=l.x(B);if(E(J,K,x),B=_textX(V,B+y+m,R?B+z:this.right,e.rtl),T(l.x(B),K,x),R)v.x+=z+h;else if(typeof x.text!="string"){const Z=d.lineHeight;v.y+=calculateLegendItemHeight(x,Z)+h}else v.y+=D}),restoreTextDirection(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,i=toFont(t.font),n=toPadding(t.padding);if(!t.display)return;const o=getRtlAdapter(e.rtl,this.left,this.width),r=this.ctx,a=t.position,l=i.size/2,d=n.top+l;let h,p=this.left,m=this.width;if(this.isHorizontal())m=Math.max(...this.lineWidths),h=this.top+d,p=_alignStartEnd(e.align,p,this.right-m);else{const y=this.columnSizes.reduce((b,S)=>Math.max(b,S.height),0);h=d+_alignStartEnd(e.align,this.top,this.bottom-y-e.labels.padding-this._computeTitleHeight())}const v=_alignStartEnd(a,p,p+m);r.textAlign=o.textAlign(_toLeftRightCenter(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=i.string,renderText(r,t.text,v,h,i)}_computeTitleHeight(){const e=this.options.title,t=toFont(e.font),i=toPadding(e.padding);return e.display?t.lineHeight+i.height:0}_getLegendItemAt(e,t){let i,n,o;if(_isBetween(e,this.left,this.right)&&_isBetween(t,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>r.length?o:r)),e+t.size/2+i.measureText(n).width}function calculateItemHeight(s,e,t){let i=s;return typeof e.text!="string"&&(i=calculateLegendItemHeight(e,t)),i}function calculateLegendItemHeight(s,e){const t=s.text?s.text.length:0;return e*t}function isListened(s,e){return!!((s==="mousemove"||s==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(s==="click"||s==="mouseup"))}var plugin_legend={id:"legend",_element:Legend,start(s,e,t){const i=s.legend=new Legend({ctx:s.ctx,options:t,chart:s});layouts.configure(s,i,t),layouts.addBox(s,i)},stop(s){layouts.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,e,t){const i=s.legend;layouts.configure(s,i,t),i.options=t},afterUpdate(s){const e=s.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(s,e){e.replay||s.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,e,t){const i=e.datasetIndex,n=t.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const e=s.data.datasets,{labels:{usePointStyle:t,pointStyle:i,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(t?0:void 0),h=toPadding(d.borderWidth);return{text:e[l.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:n||d.textAlign,borderRadius:r&&(a||d.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};const positioners={average(s){if(!s.length)return!1;let e,t,i=0,n=0,o=0;for(e=0,t=s.length;ea({chart:e,initial:t.initial,numSteps:r,currentStep:Math.min(i-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,e,"progress")),o.length||(i.running=!1,this._notify(n,i,e,"complete"),i.initial=!1),t+=o.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(s,e,t){return t>.5?e:s},color(s,e,t){const i=color(s||transparent),n=i.valid&&color(e||transparent);return n&&n.valid?n.mix(i,t).hexString():e},number(s,e,t){return s+(e-s)*t}};class Animation{constructor(e,t,i,n){const o=t[i];n=resolve([e.to,n,o,e.from]);const r=resolve([e.from,o,n]);this._active=!0,this._fn=e.fn||interpolators[e.type||typeof r],this._easing=effects[e.easing]||effects.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=resolve([e.to,t,n,e.from]),this._from=resolve([e.from,n,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||t1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let n=0;n{const o=e[n];if(!isObject(o))return;const r={};for(const a of t)r[a]=o[a];(isArray(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(e,t){const i=t.options,n=resolveTargetOptions(e,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&awaitAll(e.options.$animations,i).then(()=>{e.options=i},()=>{}),o}_createAnimations(e,t){const i=this._properties,n=[],o=e.$animations||(e.$animations={}),r=Object.keys(t),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const d=r[l];if(d.charAt(0)==="$")continue;if(d==="options"){n.push(...this._animateOptions(e,t));continue}const h=t[d];let p=o[d];const m=i.get(d);if(p)if(m&&p.active()){p.update(m,h,a);continue}else p.cancel();if(!m||!m.duration){e[d]=h;continue}o[d]=p=new Animation(m,e,d,h),n.push(p)}return n}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return animator.add(this._chart,i),!0}}function awaitAll(s,e){const t=[],i=Object.keys(e);for(let n=0;n0||!t&&o<0)return n.index}return null}function updateStacks(s,e){const{chart:t,_cachedMeta:i}=s,n=t._stacks||(t._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,d=r.axis,h=getStackKey(o,r,i),p=e.length;let m;for(let v=0;vt[i].axis===e).shift()}function createDatasetContext(s,e){return createContext(s,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(s,e,t){return createContext(s,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function clearStacks(s,e){const t=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){e=e||s._parsed;for(const n of e){const o=n._stacks;if(!o||o[i]===void 0||o[i][t]===void 0)return;delete o[i][t],o[i]._visualValues!==void 0&&o[i]._visualValues[t]!==void 0&&delete o[i]._visualValues[t]}}}const isDirectUpdateMode=s=>s==="reset"||s==="none",cloneIfNotShared=(s,e)=>e?s:Object.assign({},s),createStack=(s,e,t)=>s&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(t,!0),values:null};class DatasetController{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=isStacked(e.vScale,e),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(e){this.index!==e&&clearStacks(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),n=(p,m,v,y)=>p==="x"?m:p==="r"?y:v,o=t.xAxisID=valueOrDefault(i.xAxisID,getFirstScaleId(e,"x")),r=t.yAxisID=valueOrDefault(i.yAxisID,getFirstScaleId(e,"y")),a=t.rAxisID=valueOrDefault(i.rAxisID,getFirstScaleId(e,"r")),l=t.indexAxis,d=t.iAxisID=n(l,o,r,a),h=t.vAxisID=n(l,r,o,a);t.xScale=this.getScaleForId(o),t.yScale=this.getScaleForId(r),t.rScale=this.getScaleForId(a),t.iScale=this.getScaleForId(d),t.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&unlistenArrayEvents(this._data,this),e._stacked&&clearStacks(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(isObject(t))this._data=convertObjectDataToArray(t);else if(i!==t){if(i){unlistenArrayEvents(i,this);const n=this._cachedMeta;clearStacks(n),n._parsed=[]}t&&Object.isExtensible(t)&&listenArrayEvents(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=t._stacked;t._stacked=isStacked(t.vScale,t),t.stack!==i.stack&&(n=!0,clearStacks(t),t.stack=i.stack),this._resyncElements(e),(n||o!==t._stacked)&&updateStacks(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=e===0&&t===n.length?!0:i._sorted,d=e>0&&i._parsed[e-1],h,p,m;if(this._parsing===!1)i._parsed=n,i._sorted=!0,m=n;else{isArray(n[e])?m=this.parseArrayData(i,n,e,t):isObject(n[e])?m=this.parseObjectData(i,n,e,t):m=this.parsePrimitiveData(i,n,e,t);const v=()=>p[a]===null||d&&p[a]b||p=0;--m)if(!y()){this.updateRangeFromParsed(d,e,v,l);break}}return d}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let n,o,r;for(n=0,o=t.length;n=0&&ethis.getContext(i,n,t),b=d.resolveNamedOptions(m,v,y,p);return b.$shared&&(b.$shared=l,o[r]=Object.freeze(cloneIfNotShared(b,l))),b}_resolveAnimations(e,t,i){const n=this.chart,o=this._cachedDataOpts,r=`animation-${t}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,p=h.datasetAnimationScopeKeys(this._type,t),m=h.getOptionScopes(this.getDataset(),p);l=h.createResolver(m,this.getContext(e,i,t))}const d=new Animations(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(d)),d}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||isDirectUpdateMode(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),n=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(t,o)||o!==n;return this.updateSharedOptions(o,t,i),{sharedOptions:o,includeOptions:r}}updateElement(e,t,i,n){isDirectUpdateMode(n)?Object.assign(e,i):this._resolveAnimations(t,n).update(e,i)}updateSharedOptions(e,t,i){e&&!isDirectUpdateMode(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,n){e.active=n;const o=this.getStyle(t,n);this._resolveAnimations(t,i,n).update(e,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[a,l,d]of this._syncList)this[a](l,d);this._syncList=[];const n=i.length,o=t.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,e):o{for(d.length+=t,a=d.length-1;a>=r;a--)d[a]=d[a-t]};for(l(o),a=e;an-o))}return s._cache.$bar}function computeMinSampleSize(s){const e=s.iScale,t=getAllScaleValues(e,s.type);let i=e._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(defined$1(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(n=0,o=t.length;n0?n[s-1]:null,a=sMath.abs(a)&&(l=a,d=r),e[t.axis]=d,e._custom={barStart:l,barEnd:d,start:n,end:o,min:r,max:a}}function parseValue(s,e,t,i){return isArray(s)?parseFloatBar(s,e,t,i):e[t.axis]=t.parse(s,i),e}function parseArrayOrPrimitive(s,e,t,i){const n=s.iScale,o=s.vScale,r=n.getLabels(),a=n===o,l=[];let d,h,p,m;for(d=t,h=t+i;d=t?1:-1)}function borderProps(s){let e,t,i,n,o;return s.horizontal?(e=s.base>s.x,t="left",i="right"):(e=s.basel.controller.options.grouped),o=i.options.stacked,r=[],a=l=>{const d=l.controller.getParsed(t),h=d&&d[l.vScale.axis];if(isNullOrUndef(h)||isNaN(h))return!0};for(const l of n)if(!(t!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===e))break;return r.length||r.push(void 0),r}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,i){const n=this._getStacks(e,i),o=t!==void 0?n.indexOf(t):-1;return o===-1?n.length-1:o}_getRuler(){const e=this.options,t=this._cachedMeta,i=t.iScale,n=[];let o,r;for(o=0,r=t.data.length;o_angleBetween(R,a,l,!0)?1:Math.max(A,A*t,D,D*t),y=(R,A,D)=>_angleBetween(R,a,l,!0)?-1:Math.min(A,A*t,D,D*t),b=v(0,d,p),S=v(HALF_PI,h,m),E=y(PI,d,p),T=y(PI+HALF_PI,h,m);i=(b-E)/2,n=(S-T)/2,o=-(b+E)/2,r=-(S+T)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:r}}class DoughnutController extends DatasetController{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const i=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=i;else{let o=l=>+i[l];if(isObject(i[e])){const{key:l="value"}=this._parsing;o=d=>+resolveObjectKey(i[d],l)}let r,a;for(r=e,a=e+t;r0&&!isNaN(e)?TAU*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=formatNumber(t._parsed[e],i.options.locale);return{label:n[e]||"",value:o}}getMaxBorderWidth(e){let t=0;const i=this.chart;let n,o,r,a,l;if(!e){for(n=0,o=i.data.datasets.length;ne!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),G(DoughnutController,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:i,color:n}}=e.legend.options;return t.labels.map((o,r)=>{const l=e.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(r),index:r}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}}});class LineController extends DatasetController{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=t,r=this.chart._animationsDisabled;let{start:a,count:l}=_getStartAndCountOfVisiblePoints(t,n,r);this._drawStart=a,this._drawCount=l,_scaleRangesChanged(t)&&(a=0,l=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const d=this.resolveDatasetElementOptions(e);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:d},e),this.updateElements(n,a,l,e)}updateElements(e,t,i,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:d}=this._cachedMeta,{sharedOptions:h,includeOptions:p}=this._getSharedOptions(t,n),m=r.axis,v=a.axis,{spanGaps:y,segment:b}=this.options,S=isNumber(y)?y:Number.POSITIVE_INFINITY,E=this.chart._animationsDisabled||o||n==="none",T=t+i,R=e.length;let A=t>0&&this.getParsed(t-1);for(let D=0;D=T){M.skip=!0;continue}const I=this.getParsed(D),V=isNullOrUndef(I[v]),z=M[m]=r.getPixelForValue(I[m],D),B=M[v]=o||V?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,I,l):I[v],D);M.skip=isNaN(z)||isNaN(B)||V,M.stop=D>0&&Math.abs(I[m]-A[m])>S,b&&(M.parsed=I,M.raw=d.data[D]),p&&(M.options=h||this.resolveDataElementOptions(D,x.active?"active":n)),E||this.updateElement(x,D,M,n),A=I}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,n=e.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,r)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}G(LineController,"id","line"),G(LineController,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),G(LineController,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class PolarAreaController extends DatasetController{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=formatNumber(t._parsed[e].r,i.options.locale);return{label:n[e]||"",value:o}}parseObjectData(e,t,i,n){return _parseObjectDataRadialScale.bind(this)(e,t,i,n)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(ot.max&&(t.max=o))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,i=e.options,n=Math.min(t.right-t.left,t.bottom-t.top),o=Math.max(n/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/e.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,i,n){const o=n==="reset",r=this.chart,l=r.options.animation,d=this._cachedMeta.rScale,h=d.xCenter,p=d.yCenter,m=d.getIndexAngle(0)-.5*PI;let v=m,y;const b=360/this.countVisibleElements();for(y=0;y{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?toRadians(this.resolveDataElementOptions(e,t).angle||i):0}}G(PolarAreaController,"id","polarArea"),G(PolarAreaController,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),G(PolarAreaController,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const t=e.data;if(t.labels.length&&t.datasets.length){const{labels:{pointStyle:i,color:n}}=e.legend.options;return t.labels.map((o,r)=>{const l=e.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(r),index:r}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class PieController extends DoughnutController{}G(PieController,"id","pie"),G(PieController,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function abstract(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class DateAdapterBase{constructor(e){G(this,"options");this.options=e||{}}static override(e){Object.assign(DateAdapterBase.prototype,e)}init(){}formats(){return abstract()}parse(){return abstract()}format(){return abstract()}add(){return abstract()}diff(){return abstract()}startOf(){return abstract()}endOf(){return abstract()}}var adapters={_date:DateAdapterBase};function binarySearch(s,e,t,i){const{controller:n,data:o,_sorted:r}=s,a=n._cachedMeta.iScale;if(a&&e===a.axis&&e!=="r"&&r&&o.length){const l=a._reversePixels?_rlookupByKey:_lookupByKey;if(i){if(n._sharedOptions){const d=o[0],h=typeof d.getRange=="function"&&d.getRange(e);if(h){const p=l(o,e,t-h),m=l(o,e,t+h);return{lo:p.lo,hi:m.hi}}}}else return l(o,e,t)}return{lo:0,hi:o.length-1}}function evaluateInteractionItems(s,e,t,i,n){const o=s.getSortedVisibleDatasetMetas(),r=t[e];for(let a=0,l=o.length;a{l[r](e[t],n)&&(o.push({element:l,datasetIndex:d,index:h}),a=a||l.inRange(e.x,e.y,n))}),i&&!a?[]:o}var Interaction={evaluateInteractionItems,modes:{index(s,e,t,i){const n=getRelativePosition(e,s),o=t.axis||"x",r=t.includeInvisible||!1,a=t.intersect?getIntersectItems(s,n,o,i,r):getNearestItems(s,n,o,!1,i,r),l=[];return a.length?(s.getSortedVisibleDatasetMetas().forEach(d=>{const h=a[0].index,p=d.data[h];p&&!p.skip&&l.push({element:p,datasetIndex:d.index,index:h})}),l):[]},dataset(s,e,t,i){const n=getRelativePosition(e,s),o=t.axis||"xy",r=t.includeInvisible||!1;let a=t.intersect?getIntersectItems(s,n,o,i,r):getNearestItems(s,n,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,d=s.getDatasetMeta(l).data;a=[];for(let h=0;ht.pos===e)}function filterDynamicPositionByAxis(s,e){return s.filter(t=>STATIC_POSITIONS.indexOf(t.pos)===-1&&t.box.axis===e)}function sortByWeight(s,e){return s.sort((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function wrapBoxes(s){const e=[];let t,i,n,o,r,a;for(t=0,i=(s||[]).length;td.box.fullSize),!0),i=sortByWeight(filterByPosition(e,"left"),!0),n=sortByWeight(filterByPosition(e,"right")),o=sortByWeight(filterByPosition(e,"top"),!0),r=sortByWeight(filterByPosition(e,"bottom")),a=filterDynamicPositionByAxis(e,"x"),l=filterDynamicPositionByAxis(e,"y");return{fullSize:t,leftAndTop:i.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:filterByPosition(e,"chartArea"),vertical:i.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function getCombinedMax(s,e,t,i){return Math.max(s[t],e[t])+Math.max(s[i],e[i])}function updateMaxPadding(s,e){s.top=Math.max(s.top,e.top),s.left=Math.max(s.left,e.left),s.bottom=Math.max(s.bottom,e.bottom),s.right=Math.max(s.right,e.right)}function updateDims(s,e,t,i){const{pos:n,box:o}=t,r=s.maxPadding;if(!isObject(n)){t.size&&(s[n]-=t.size);const p=i[t.stack]||{size:0,count:1};p.size=Math.max(p.size,t.horizontal?o.height:o.width),t.size=p.size/p.count,s[n]+=t.size}o.getPadding&&updateMaxPadding(r,o.getPadding());const a=Math.max(0,e.outerWidth-getCombinedMax(r,s,"left","right")),l=Math.max(0,e.outerHeight-getCombinedMax(r,s,"top","bottom")),d=a!==s.w,h=l!==s.h;return s.w=a,s.h=l,t.horizontal?{same:d,other:h}:{same:h,other:d}}function handleMaxPadding(s){const e=s.maxPadding;function t(i){const n=Math.max(e[i]-s[i],0);return s[i]+=n,n}s.y+=t("top"),s.x+=t("left"),t("right"),t("bottom")}function getMargins(s,e){const t=e.maxPadding;function i(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(e[r],t[r])}),o}return i(s?["left","right"]:["top","bottom"])}function fitBoxes(s,e,t,i){const n=[];let o,r,a,l,d,h;for(o=0,r=s.length,d=0;o{typeof b.beforeLayout=="function"&&b.beforeLayout()});const h=l.reduce((b,S)=>S.box.options&&S.box.options.display===!1?b:b+1,0)||1,p=Object.freeze({outerWidth:e,outerHeight:t,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),m=Object.assign({},n);updateMaxPadding(m,toPadding(i));const v=Object.assign({maxPadding:m,w:o,h:r,x:n.left,y:n.top},n),y=setLayoutDims(l.concat(d),p);fitBoxes(a.fullSize,v,p,y),fitBoxes(l,v,p,y),fitBoxes(d,v,p,y)&&fitBoxes(l,v,p,y),handleMaxPadding(v),placeBoxes(a.leftAndTop,v,p,y),v.x+=v.w,v.y+=v.h,placeBoxes(a.rightAndBottom,v,p,y),s.chartArea={left:v.left,top:v.top,right:v.left+v.w,bottom:v.top+v.h,height:v.h,width:v.w},each(a.chartArea,b=>{const S=b.box;Object.assign(S,s.chartArea),S.update(v.w,v.h,{left:0,top:0,right:0,bottom:0})})}};class BasePlatform{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,n){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,n?Math.floor(t/n):i)}}isAttached(e){return!0}updateConfig(e){}}class BasicPlatform extends BasePlatform{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=s=>s===null||s==="";function initCanvas(s,e){const t=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[EXPANDO_KEY]={initial:{height:i,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",isNullOrEmpty(n)){const o=readUsedSize(s,"width");o!==void 0&&(s.width=o)}if(isNullOrEmpty(i))if(s.style.height==="")s.height=s.width/(e||2);else{const o=readUsedSize(s,"height");o!==void 0&&(s.height=o)}return s}const eventListenerOptions=supportsEventListenerOptions?{passive:!0}:!1;function addListener(s,e,t){s&&s.addEventListener(e,t,eventListenerOptions)}function removeListener(s,e,t){s&&s.canvas&&s.canvas.removeEventListener(e,t,eventListenerOptions)}function fromNativeEvent(s,e){const t=EVENT_TYPES[s.type]||s.type,{x:i,y:n}=getRelativePosition(s,e);return{type:t,chart:e,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function nodeListContains(s,e){for(const t of s)if(t===e||t.contains(e))return!0}function createAttachObserver(s,e,t){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||nodeListContains(a.addedNodes,i),r=r&&!nodeListContains(a.removedNodes,i);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function createDetachObserver(s,e,t){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||nodeListContains(a.removedNodes,i),r=r&&!nodeListContains(a.addedNodes,i);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const s=window.devicePixelRatio;s!==oldDevicePixelRatio&&(oldDevicePixelRatio=s,drpListeningCharts.forEach((e,t)=>{t.currentDevicePixelRatio!==s&&e()}))}function listenDevicePixelRatioChanges(s,e){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(s,e)}function unlistenDevicePixelRatioChanges(s){drpListeningCharts.delete(s),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(s,e,t){const i=s.canvas,n=i&&_getParentNode(i);if(!n)return;const o=throttled((a,l)=>{const d=n.clientWidth;t(a,l),d{const l=a[0],d=l.contentRect.width,h=l.contentRect.height;d===0&&h===0||o(d,h)});return r.observe(n),listenDevicePixelRatioChanges(s,o),r}function releaseObserver(s,e,t){t&&t.disconnect(),e==="resize"&&unlistenDevicePixelRatioChanges(s)}function createProxyAndListen(s,e,t){const i=s.canvas,n=throttled(o=>{s.ctx!==null&&t(fromNativeEvent(o,s))},s);return addListener(i,e,n),n}class DomPlatform extends BasePlatform{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(initCanvas(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[EXPANDO_KEY])return!1;const i=t[EXPANDO_KEY].initial;["height","width"].forEach(o=>{const r=i[o];isNullOrUndef(r)?t.removeAttribute(o):t.setAttribute(o,r)});const n=i.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o]}),t.width=t.width,delete t[EXPANDO_KEY],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const n=e.$proxies||(e.$proxies={}),r={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[t]||createProxyAndListen;n[t]=r(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),n=i[t];if(!n)return;({attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[t]||removeListener)(e,t,n),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,n){return getMaximumSize(e,t,i,n)}isAttached(e){const t=_getParentNode(e);return!!(t&&t.isConnected)}}function _detectPlatform(s){return!_isDomSupported()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?BasicPlatform:DomPlatform}var Qt;let Element$1=(Qt=class{constructor(){G(this,"x");G(this,"y");G(this,"active",!1);G(this,"options");G(this,"$animations")}tooltipPosition(e){const{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(e,t){const i=this.$animations;if(!t||!i)return this;const n={};return e.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}},G(Qt,"defaults",{}),G(Qt,"defaultRoutes"),Qt);function autoSkip(s,e){const t=s.options.ticks,i=determineMaxTicks(s),n=Math.min(t.maxTicksLimit||i,i),o=t.major.enabled?getMajorIndices(e):[],r=o.length,a=o[0],l=o[r-1],d=[];if(r>n)return skipMajors(e,d,o,r/n),d;const h=calculateSpacing(o,e,n);if(r>0){let p,m;const v=r>1?Math.round((l-a)/(r-1)):null;for(skip(e,d,h,isNullOrUndef(v)?0:a-v,a),p=0,m=r-1;pn)return l}return Math.max(n,1)}function getMajorIndices(s){const e=[];let t,i;for(t=0,i=s.length;ts==="left"?"right":s==="right"?"left":s,offsetFromEdge=(s,e,t)=>e==="top"||e==="left"?s[e]+t:s[e]-t,getTicksLimit=(s,e)=>Math.min(e||s,s);function sample(s,e){const t=[],i=s.length/e,n=s.length;let o=0;for(;or+a)))return l}function garbageCollect(s,e){each(s,t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;oi?i:t,i=n&&t>i?t:i,{min:finiteOrDefault(t,finiteOrDefault(i,t)),max:finiteOrDefault(i,finiteOrDefault(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,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=_addGrace(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),p=h.widest.width,m=h.highest.height,v=_limitValue(this.chart.width-p,0,this.maxWidth);a=e.offset?this.maxWidth/i:v/(i-1),p+6>a&&(a=v/(i-(e.offset?.5:1)),l=this.maxHeight-getTickMarkLength(e.grid)-t.padding-getTitleHeight(e.title,this.chart.options.font),d=Math.sqrt(p*p+m*m),r=toDegrees(Math.min(Math.asin(_limitValue((h.highest.height+6)/a,-1,1)),Math.asin(_limitValue(l/d,-1,1))-Math.asin(_limitValue(m/d,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){callback(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){callback(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=getTitleHeight(n,t.options.font);if(a?(e.width=this.maxWidth,e.height=getTickMarkLength(o)+l):(e.height=this.maxHeight,e.width=getTickMarkLength(o)+l),i.display&&this.ticks.length){const{first:d,last:h,widest:p,highest:m}=this._getLabelSizes(),v=i.padding*2,y=toRadians(this.labelRotation),b=Math.cos(y),S=Math.sin(y);if(a){const E=i.mirror?0:S*p.width+b*m.height;e.height=Math.min(this.maxHeight,e.height+E+v)}else{const E=i.mirror?0:b*p.width+S*m.height;e.width=Math.min(this.maxWidth,e.width+E+v)}this._calculatePadding(d,h,S,b)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,d=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,p=this.right-this.getPixelForTick(this.ticks.length-1);let m=0,v=0;l?d?(m=n*e.width,v=i*t.height):(m=i*e.height,v=n*t.width):o==="start"?v=t.width:o==="end"?m=e.width:o!=="inner"&&(m=e.width/2,v=t.width/2),this.paddingLeft=Math.max((m-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((v-p+r)*this.width/(this.width-p),0)}else{let h=t.height/2,p=e.height/2;o==="start"?(h=0,p=e.height):o==="end"&&(h=t.height,p=0),this.paddingTop=h+r,this.paddingBottom=p+r}}_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(){callback(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t({width:r[V]||0,height:a[V]||0});return{first:I(0),last:I(t-1),widest:I(x),highest:I(M),widths:r,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return _int16Range(this._alignToPixels?_alignPixel(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&ea*n?a/i:l/n:l*n0}_computeGridLineItems(e){const t=this.axis,i=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,d=this.isHorizontal(),p=this.ticks.length+(l?1:0),m=getTickMarkLength(o),v=[],y=a.setContext(this.getContext()),b=y.display?y.width:0,S=b/2,E=function($){return _alignPixel(i,$,b)};let T,R,A,D,x,M,I,V,z,B,K,J;if(r==="top")T=E(this.bottom),M=this.bottom-m,V=T-S,B=E(e.top)+S,J=e.bottom;else if(r==="bottom")T=E(this.top),B=e.top,J=E(e.bottom)-S,M=T+S,V=this.top+m;else if(r==="left")T=E(this.right),x=this.right-m,I=T-S,z=E(e.left)+S,K=e.right;else if(r==="right")T=E(this.left),z=e.left,K=E(e.right)-S,x=T+S,I=this.left+m;else if(t==="x"){if(r==="center")T=E((e.top+e.bottom)/2+.5);else if(isObject(r)){const $=Object.keys(r)[0],Y=r[$];T=E(this.chart.scales[$].getPixelForValue(Y))}B=e.top,J=e.bottom,M=T+S,V=M+m}else if(t==="y"){if(r==="center")T=E((e.left+e.right)/2);else if(isObject(r)){const $=Object.keys(r)[0],Y=r[$];T=E(this.chart.scales[$].getPixelForValue(Y))}x=T-S,I=x-m,z=e.left,K=e.right}const Z=valueOrDefault(n.ticks.maxTicksLimit,p),F=Math.max(1,Math.ceil(p/Z));for(R=0;R0&&(te-=oe/2);break}se={left:te,top:ie,width:oe+pe.width,height:ae+pe.height,color:F.backdropColor}}S.push({label:A,font:V,textOffset:K,options:{rotation:b,color:Y,strokeColor:W,strokeWidth:X,textAlign:U,textBaseline:J,translation:[D,x],backdrop:se}})}return S}_getXAxisLabelAlignment(){const{position:e,ticks:t}=this.options;if(-toRadians(this.labelRotation))return e==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(e){const{position:t,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=e+o,l=r.widest.width;let d,h;return t==="left"?n?(h=this.right+o,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h+=l)):(h=this.right-a,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h=this.left)):t==="right"?n?(h=this.left+o,i==="near"?d="right":i==="center"?(d="center",h-=l/2):(d="left",h-=l)):(h=this.left+a,i==="near"?d="left":i==="center"?(d="center",h+=l/2):(d="right",h=this.right)):d="right",{textAlign:d,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:t},left:i,top:n,width:o,height:r}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,n,o,r),e.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex(o=>o.value===e);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,r;const a=(l,d,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(d.x,d.y),i.stroke(),i.restore())};if(t.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,r;for(o=0,r=t.length;o{const i=t.split("."),n=i.pop(),o=[s].concat(i).join("."),r=e[t].split("."),a=r.pop(),l=r.join(".");defaults.route(o,n,l,a)})}function isIChartComponent(s){return"id"in s&&"defaults"in s}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element$1,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(n=>{const o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(e,o,n):each(n,r=>{const a=i||this._getRegistryForType(r);this._exec(e,a,r)})})}_exec(e,t,i){const n=_capitalize(e);callback(i["before"+n],[],i),t[e](i),callback(i["after"+n],[],i)}_getRegistryForType(e){for(let t=0;to.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,i),e,"stop"),this._notify(n(i,t),e,"start")}}function allPlugins(s){const e={},t=[],i=Object.keys(registry.plugins.items);for(let o=0;o1&&idMatchesAxis(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(s,e,t){if(t[e+"AxisID"]===s)return{axis:e}}function retrieveAxisFromDatasets(s,e){if(e.data&&e.data.datasets){const t=e.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(t.length)return getAxisFromDataset(s,"x",t[0])||getAxisFromDataset(s,"y",t[0])}return{}}function mergeScaleConfig(s,e){const t=overrides[s.type]||{scales:{}},i=e.scales||{},n=getIndexAxis(s.type,e),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!isObject(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=determineAxis(r,a,retrieveAxisFromDatasets(r,s),defaults.scales[a.type]),d=getDefaultScaleIDFromAxis(l,n),h=t.scales||{};o[r]=mergeIf(Object.create(null),[{axis:l},a,h[l],h[d]])}),s.data.datasets.forEach(r=>{const a=r.type||s.type,l=r.indexAxis||getIndexAxis(a,e),h=(overrides[a]||{}).scales||{};Object.keys(h).forEach(p=>{const m=getAxisFromDefaultScaleID(p,l),v=r[m+"AxisID"]||m;o[v]=o[v]||Object.create(null),mergeIf(o[v],[{axis:m},i[v],h[p]])})}),Object.keys(o).forEach(r=>{const a=o[r];mergeIf(a,[defaults.scales[a.type],defaults.scale])}),o}function initOptions(s){const e=s.options||(s.options={});e.plugins=valueOrDefault(e.plugins,{}),e.scales=mergeScaleConfig(s,e)}function initData(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function initConfig(s){return s=s||{},s.data=initData(s.data),initOptions(s),s}const keyCache=new Map,keysCached=new Set;function cachedKeys(s,e){let t=keyCache.get(s);return t||(t=e(),keyCache.set(s,t),keysCached.add(t)),t}const addIfFound=(s,e,t)=>{const i=resolveObjectKey(e,t);i!==void 0&&s.add(i)};class Config{constructor(e){this._config=initConfig(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=initData(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),initOptions(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return cachedKeys(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return cachedKeys(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return cachedKeys(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return cachedKeys(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let n=i.get(e);return(!n||t)&&(n=new Map,i.set(e,n)),n}getOptionScopes(e,t,i){const{options:n,type:o}=this,r=this._cachedScopes(e,i),a=r.get(t);if(a)return a;const l=new Set;t.forEach(h=>{e&&(l.add(e),h.forEach(p=>addIfFound(l,e,p))),h.forEach(p=>addIfFound(l,n,p)),h.forEach(p=>addIfFound(l,overrides[o]||{},p)),h.forEach(p=>addIfFound(l,defaults,p)),h.forEach(p=>addIfFound(l,descriptors,p))});const d=Array.from(l);return d.length===0&&d.push(Object.create(null)),keysCached.has(t)&&r.set(t,d),d}chartOptionScopes(){const{options:e,type:t}=this;return[e,overrides[t]||{},defaults.datasets[t]||{},{type:t},defaults,descriptors]}resolveNamedOptions(e,t,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=getResolver(this._resolverCache,e,n);let l=r;if(needContext(r,t)){o.$shared=!1,i=isFunction$1(i)?i():i;const d=this.createResolver(e,i,a);l=_attachContext(r,i,d)}for(const d of t)o[d]=l[d];return o}createResolver(e,t,i=[""],n){const{resolver:o}=getResolver(this._resolverCache,e,i);return isObject(t)?_attachContext(o,t,void 0,n):o}}function getResolver(s,e,t){let i=s.get(e);i||(i=new Map,s.set(e,i));const n=t.join();let o=i.get(n);return o||(o={resolver:_createResolver(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},i.set(n,o)),o}const hasFunction=s=>isObject(s)&&Object.getOwnPropertyNames(s).some(e=>isFunction$1(s[e]));function needContext(s,e){const{isScriptable:t,isIndexable:i}=_descriptors(s);for(const n of e){const o=t(n),r=i(n),a=(r||o)&&s[n];if(o&&(isFunction$1(a)||hasFunction(a))||r&&isArray(a))return!0}return!1}var version="4.4.2";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(s,e){return s==="top"||s==="bottom"||KNOWN_POSITIONS.indexOf(s)===-1&&e==="x"}function compare2Level(s,e){return function(t,i){return t[s]===i[s]?t[e]-i[e]:t[s]-i[s]}}function onAnimationsComplete(s){const e=s.chart,t=e.options.animation;e.notifyPlugins("afterRender"),callback(t&&t.onComplete,[s],e)}function onAnimationProgress(s){const e=s.chart,t=e.options.animation;callback(t&&t.onProgress,[s],e)}function getCanvas(s){return _isDomSupported()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const instances={},getChart=s=>{const e=getCanvas(s);return Object.values(instances).filter(t=>t.canvas===e).pop()};function moveNumericKeys(s,e,t){const i=Object.keys(s);for(const n of i){const o=+n;if(o>=e){const r=s[n];delete s[n],(t>0||o>e)&&(s[o+t]=r)}}}function determineLastEvent(s,e,t,i){return!t||s.type==="mouseout"?null:i?e:s}function getSizeForArea(s,e,t){return s.options.clip?s[t]:e[t]}function getDatasetArea(s,e){const{xScale:t,yScale:i}=s;return t&&i?{left:getSizeForArea(t,e,"left"),right:getSizeForArea(t,e,"right"),top:getSizeForArea(i,e,"top"),bottom:getSizeForArea(i,e,"bottom")}:e}class Chart{static register(...e){registry.add(...e),invalidatePlugins()}static unregister(...e){registry.remove(...e),invalidatePlugins()}constructor(e,t){const i=this.config=new Config(t),n=getCanvas(e),o=getChart(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 r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_detectPlatform(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,d=l&&l.height,h=l&&l.width;if(this.id=uid(),this.ctx=a,this.canvas=l,this.width=h,this.height=d,this._options=r,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 PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=debounce$3(p=>this.update(p),r.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:n,_aspectRatio:o}=this;return isNullOrUndef(e)?t&&o?o:n?i/n:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(e,t){animator.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,e,t,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,retinaScale(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),callback(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};each(t,(i,n)=>{i.id=n})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,n=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];t&&(o=o.concat(Object.keys(t).map(r=>{const a=t[r],l=determineAxis(r,a),d=l==="r",h=l==="x";return{options:a,dposition:d?"chartArea":h?"bottom":"left",dtype:d?"radialLinear":h?"category":"linear"}}))),each(o,r=>{const a=r.options,l=a.id,d=determineAxis(l,a),h=valueOrDefault(a.type,r.dtype);(a.position===void 0||positionIsHorizontal(a.position,d)!==positionIsHorizontal(r.dposition))&&(a.position=r.dposition),n[l]=!0;let p=null;if(l in i&&i[l].type===h)p=i[l];else{const m=registry.getScale(h);p=new m({id:l,type:h,ctx:this.ctx,chart:this}),i[p.id]=p}p.init(a,e)}),each(n,(r,a)=>{r||delete i[a]}),each(i,r=>{layouts.configure(this,r,r.options),layouts.addBox(this,r)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((n,o)=>n.index-o.index),i>t){for(let n=t;nt.length&&delete this._stacks,e.forEach((i,n)=>{t.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let d=0,h=this.data.datasets.length;d{d.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(compare2Level("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){each(this.scales,e=>{layouts.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!setsEqual(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of t){const r=i==="_removeElements"?-o:o;moveNumericKeys(e,n,r)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=o=>new Set(e.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;layouts.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],each(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,n=!i.disabled,o=getDatasetArea(e,this.chartArea),r={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&clipArea(t,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),e.controller.draw(),n&&unclipArea(t),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(e){return _isPointInArea(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,n){const o=Interaction.modes[t];return typeof o=="function"?o(this,e,i,n):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let n=i.filter(o=>o&&o._dataset===t).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const n=i?"show":"hide",o=this.getDatasetMeta(e),r=o.controller._resolveAnimations(void 0,n);defined$1(t)?(o.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===e?n:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),animator.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,o,r),e[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};each(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(l,d)=>{t.addEventListener(this,l,d),e[l]=d},n=(l,d)=>{e[l]&&(t.removeEventListener(this,l,d),delete e[l])},o=(l,d)=>{this.canvas&&this.resize(l,d)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",a)},t.isAttached(this.canvas)?a():r()}unbindEvents(){each(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},each(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const n=i?"set":"remove";let o,r,a,l;for(t==="dataset"&&(o=this.getDatasetMeta(e[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=e.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!_elementsEqual(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return this._plugins._cache.filter(t=>t.plugin.id===e).length===1}_updateHoverStyles(e,t,i){const n=this.options.hover,o=(l,d)=>l.filter(h=>!d.some(p=>h.datasetIndex===p.datasetIndex&&h.index===p.index)),r=o(t,e),a=i?e:o(e,t);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},n=r=>(r.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const o=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:n=[],options:o}=this,r=t,a=this._getActiveElements(e,n,i,r),l=_isClickEvent(e),d=determineLastEvent(e,this._lastEvent,i,l);i&&(this._lastEvent=null,callback(o.onHover,[e,a,this],this),l&&callback(o.onClick,[e,a,this],this));const h=!_elementsEqual(a,n);return(h||t)&&(this._active=a,this._updateHoverStyles(a,n,t)),this._lastEvent=d,h}_getActiveElements(e,t,i,n){if(e.type==="mouseout")return[];if(!i)return t;const o=this.options.hover;return this.getElementsAtEventForMode(e,o.mode,o,n)}}G(Chart,"defaults",defaults),G(Chart,"instances",instances),G(Chart,"overrides",overrides),G(Chart,"registry",registry),G(Chart,"version",version),G(Chart,"getChart",getChart);function invalidatePlugins(){return each(Chart.instances,s=>s._plugins.invalidate())}function clipArc(s,e,t){const{startAngle:i,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=e;let d=n/a;s.beginPath(),s.arc(o,r,a,i-d,t+d),l>n?(d=n/l,s.arc(o,r,l,t+d,i-d,!0)):s.arc(o,r,n,t+HALF_PI,i-HALF_PI),s.closePath(),s.clip()}function toRadiusCorners(s){return _readValueToProps(s,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(s,e,t,i){const n=toRadiusCorners(s.options.borderRadius),o=(t-e)/2,r=Math.min(o,i*e/2),a=l=>{const d=(t-Math.min(o,l))*i/2;return _limitValue(l,0,Math.min(o,d))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:_limitValue(n.innerStart,0,r),innerEnd:_limitValue(n.innerEnd,0,r)}}function rThetaToXY(s,e,t,i){return{x:t+s*Math.cos(e),y:i+s*Math.sin(e)}}function pathArc(s,e,t,i,n,o){const{x:r,y:a,startAngle:l,pixelMargin:d,innerRadius:h}=e,p=Math.max(e.outerRadius+i+t-d,0),m=h>0?h+i+t+d:0;let v=0;const y=n-l;if(i){const F=h>0?h-i:0,$=p>0?p-i:0,Y=(F+$)/2,W=Y!==0?y*Y/(Y+i):y;v=(y-W)/2}const b=Math.max(.001,y*p-t/PI)/p,S=(y-b)/2,E=l+S+v,T=n-S-v,{outerStart:R,outerEnd:A,innerStart:D,innerEnd:x}=parseBorderRadius$1(e,m,p,T-E),M=p-R,I=p-A,V=E+R/M,z=T-A/I,B=m+D,K=m+x,J=E+D/B,Z=T-x/K;if(s.beginPath(),o){const F=(V+z)/2;if(s.arc(r,a,p,V,F),s.arc(r,a,p,F,z),A>0){const X=rThetaToXY(I,z,r,a);s.arc(X.x,X.y,A,z,T+HALF_PI)}const $=rThetaToXY(K,T,r,a);if(s.lineTo($.x,$.y),x>0){const X=rThetaToXY(K,Z,r,a);s.arc(X.x,X.y,x,T+HALF_PI,Z+Math.PI)}const Y=(T-x/m+(E+D/m))/2;if(s.arc(r,a,m,T-x/m,Y,!0),s.arc(r,a,m,Y,E+D/m,!0),D>0){const X=rThetaToXY(B,J,r,a);s.arc(X.x,X.y,D,J+Math.PI,E-HALF_PI)}const W=rThetaToXY(M,E,r,a);if(s.lineTo(W.x,W.y),R>0){const X=rThetaToXY(M,V,r,a);s.arc(X.x,X.y,R,E-HALF_PI,V)}}else{s.moveTo(r,a);const F=Math.cos(V)*p+r,$=Math.sin(V)*p+a;s.lineTo(F,$);const Y=Math.cos(z)*p+r,W=Math.sin(z)*p+a;s.lineTo(Y,W)}s.closePath()}function drawArc(s,e,t,i,n){const{fullCircles:o,startAngle:r,circumference:a}=e;let l=e.endAngle;if(o){pathArc(s,e,t,i,l,n);for(let d=0;d=TAU||_angleBetween(r,l,d),S=_isBetween(a,h+v,p+v);return b&&S}getCenterPoint(t){const{x:i,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:d,spacing:h}=this.options,p=(o+r)/2,m=(a+l+h+d)/2;return{x:i+Math.cos(p)*m,y:n+Math.sin(p)*m}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:i,circumference:n}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>TAU?Math.floor(n/TAU):0,n===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const l=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(l)*o,Math.sin(l)*o);const d=1-Math.sin(Math.min(PI,n||0)),h=o*d;t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,drawArc(t,this,h,r,a),drawBorder(t,this,h,r,a),t.restore()}}G(ArcElement,"id","arc"),G(ArcElement,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),G(ArcElement,"defaultRoutes",{backgroundColor:"backgroundColor"}),G(ArcElement,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"});function setStyle$1(s,e,t=e){s.lineCap=valueOrDefault(t.borderCapStyle,e.borderCapStyle),s.setLineDash(valueOrDefault(t.borderDash,e.borderDash)),s.lineDashOffset=valueOrDefault(t.borderDashOffset,e.borderDashOffset),s.lineJoin=valueOrDefault(t.borderJoinStyle,e.borderJoinStyle),s.lineWidth=valueOrDefault(t.borderWidth,e.borderWidth),s.strokeStyle=valueOrDefault(t.borderColor,e.borderColor)}function lineTo(s,e,t){s.lineTo(t.x,t.y)}function getLineMethod(s){return s.stepped?_steppedLineTo:s.tension||s.cubicInterpolationMode==="monotone"?_bezierCurveTo:lineTo}function pathVars(s,e,t={}){const i=s.length,{start:n=0,end:o=i-1}=t,{start:r,end:a}=e,l=Math.max(n,r),d=Math.min(o,a),h=na&&o>a;return{count:i,start:l,loop:e.loop,ilen:d(r+(d?a-A:A))%o,R=()=>{b!==S&&(s.lineTo(h,S),s.lineTo(h,b),s.lineTo(h,E))};for(l&&(v=n[T(0)],s.moveTo(v.x,v.y)),m=0;m<=a;++m){if(v=n[T(m)],v.skip)continue;const A=v.x,D=v.y,x=A|0;x===y?(DS&&(S=D),h=(p*h+A)/++p):(R(),s.lineTo(A,D),y=x,p=0,b=S=D),E=D}R()}function _getSegmentMethod(s){const e=s.options,t=e.borderDash&&e.borderDash.length;return!s._decimated&&!s._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?fastPathSegment:pathSegment}function _getInterpolationMethod(s){return s.stepped?_steppedInterpolation:s.tension||s.cubicInterpolationMode==="monotone"?_bezierInterpolation:_pointInLine}function strokePathWithCache(s,e,t,i){let n=e._path;n||(n=e._path=new Path2D,e.path(n,t,i)&&n.closePath()),setStyle$1(s,e.options),s.stroke(n)}function strokePathDirect(s,e,t,i){const{segments:n,options:o}=e,r=_getSegmentMethod(e);for(const a of n)setStyle$1(s,o,a.style),s.beginPath(),r(s,e,a,{start:t,end:t+i-1})&&s.closePath(),s.stroke()}const usePath2D=typeof Path2D=="function";function draw(s,e,t,i){usePath2D&&!e.options.segment?strokePathWithCache(s,e,t,i):strokePathDirect(s,e,t,i)}class LineElement extends Element$1{constructor(e){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,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;_updateBezierControlPoints(this._points,i,e,n,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=_computeSegments(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,n=e[t],o=this.points,r=_boundSegments(this,{property:t,start:n,end:n});if(!r.length)return;const a=[],l=_getInterpolationMethod(i);let d,h;for(d=0,h=r.length;de!=="borderDash"&&e!=="fill"});function inRange$1(s,e,t,i){const n=s.options,{[t]:o}=s.getProps([t],i);return Math.abs(e-o)s.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(s){return BORDER_COLORS[s%BORDER_COLORS.length]}function getBackgroundColor(s){return BACKGROUND_COLORS[s%BACKGROUND_COLORS.length]}function colorizeDefaultDataset(s,e){return s.borderColor=getBorderColor(e),s.backgroundColor=getBackgroundColor(e),++e}function colorizeDoughnutDataset(s,e){return s.backgroundColor=s.data.map(()=>getBorderColor(e++)),e}function colorizePolarAreaDataset(s,e){return s.backgroundColor=s.data.map(()=>getBackgroundColor(e++)),e}function getColorizer(s){let e=0;return(t,i)=>{const n=s.getDatasetMeta(i).controller;n instanceof DoughnutController?e=colorizeDoughnutDataset(t,e):n instanceof PolarAreaController?e=colorizePolarAreaDataset(t,e):n&&(e=colorizeDefaultDataset(t,e))}}function containsColorsDefinitions(s){let e;for(e in s)if(s[e].borderColor||s[e].backgroundColor)return!0;return!1}function containsColorsDefinition(s){return s&&(s.borderColor||s.backgroundColor)}var plugin_colors={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,e,t){if(!t.enabled)return;const{data:{datasets:i},options:n}=s.config,{elements:o}=n;if(!t.forceOverride&&(containsColorsDefinitions(i)||containsColorsDefinition(n)||o&&containsColorsDefinitions(o)))return;const r=getColorizer(s);i.forEach(r)}};function _segments(s,e,t){const i=s.segments,n=s.points,o=e.points,r=[];for(const a of i){let{start:l,end:d}=a;d=_findSegmentEnd(l,d,n);const h=_getBounds(t,n[l],n[d],a.loop);if(!e.segments){r.push({source:a,target:h,start:n[l],end:n[d]});continue}const p=_boundSegments(e,h);for(const m of p){const v=_getBounds(t,o[m.start],o[m.end],m.loop),y=_boundSegment(a,n,v);for(const b of y)r.push({source:b,target:m,start:{[t]:_getEdge(h,v,"start",Math.max)},end:{[t]:_getEdge(h,v,"end",Math.min)}})}}return r}function _getBounds(s,e,t,i){if(i)return;let n=e[s],o=t[s];return s==="angle"&&(n=_normalizeAngle(n),o=_normalizeAngle(o)),{property:s,start:n,end:o}}function _pointsFromSegments(s,e){const{x:t=null,y:i=null}=s||{},n=e.points,o=[];return e.segments.forEach(({start:r,end:a})=>{a=_findSegmentEnd(r,a,n);const l=n[r],d=n[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:d.x,y:i})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:d.y}))}),o}function _findSegmentEnd(s,e,t){for(;e>s;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function _getEdge(s,e,t,i){return s&&e?i(s[t],e[t]):s?s[t]:e?e[t]:0}function _createBoundaryLine(s,e){let t=[],i=!1;return isArray(s)?(i=!0,t=s):t=_pointsFromSegments(s,e),t.length?new LineElement({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function _shouldApplyFill(s){return s&&s.fill!==!1}function _resolveTarget(s,e,t){let n=s[e].fill;const o=[e];let r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!isNumberFinite(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function _decodeFill(s,e,t){const i=parseFillOption(s);if(isObject(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return isNumberFinite(n)&&Math.floor(n)===n?decodeTargetIndex(i[0],e,n,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function decodeTargetIndex(s,e,t,i){return(s==="-"||s==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function _getTargetPixel(s,e){let t=null;return s==="start"?t=e.bottom:s==="end"?t=e.top:isObject(s)?t=e.getPixelForValue(s.value):e.getBasePixel&&(t=e.getBasePixel()),t}function _getTargetValue(s,e,t){let i;return s==="start"?i=t:s==="end"?i=e.options.reverse?e.min:e.max:isObject(s)?i=s.value:i=e.getBaseValue(),i}function parseFillOption(s){const e=s.options,t=e.fill;let i=valueOrDefault(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function _buildStackLine(s){const{scale:e,index:t,line:i}=s,n=[],o=i.segments,r=i.points,a=getLinesBelow(e,t);a.push(_createBoundaryLine({x:null,y:e.bottom},i));for(let l=0;l=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&_drawfill(s.ctx,a,o))}},beforeDatasetsDraw(s,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const o=i[n].$filler;_shouldApplyFill(o)&&_drawfill(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,e,t){const i=e.meta.$filler;!_shouldApplyFill(i)||t.drawTime!=="beforeDatasetDraw"||_drawfill(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const getBoxSize=(s,e)=>{let{boxHeight:t=e,boxWidth:i=e}=s;return s.usePointStyle&&(t=Math.min(t,e),i=s.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:t,itemHeight:Math.max(e,t)}},itemsEqual=(s,e)=>s!==null&&e!==null&&s.datasetIndex===e.datasetIndex&&s.index===e.index;class Legend extends Element$1{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,t,i){this.maxWidth=e,this.maxHeight=t,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 e=this.options.labels||{};let t=callback(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(i=>e.filter(i,this.chart.data))),e.sort&&(t=t.sort((i,n)=>e.sort(i,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}const i=e.labels,n=toFont(i.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=getBoxSize(i,o);let d,h;t.font=n.string,this.isHorizontal()?(d=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,d=this._fitCols(r,n,a,l)+10),this.width=Math.min(d,e.maxWidth||this.maxWidth),this.height=Math.min(h,e.maxHeight||this.maxHeight)}_fitRows(e,t,i,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.lineWidths=[0],h=n+a;let p=e;o.textAlign="left",o.textBaseline="middle";let m=-1,v=-h;return this.legendItems.forEach((y,b)=>{const S=i+t/2+o.measureText(y.text).width;(b===0||d[d.length-1]+S+2*a>r)&&(p+=h,d[d.length-(b>0?0:1)]=0,v+=h,m++),l[b]={left:0,top:v,row:m,width:S,height:n},d[d.length-1]+=S+a}),p}_fitCols(e,t,i,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],d=this.columnSizes=[],h=r-e;let p=a,m=0,v=0,y=0,b=0;return this.legendItems.forEach((S,E)=>{const{itemWidth:T,itemHeight:R}=calculateItemSize(i,t,o,S,n);E>0&&v+R+2*a>h&&(p+=m+a,d.push({width:m,height:v}),y+=m+a,b++,m=v=0),l[E]={left:y,top:v,col:b,width:T,height:R},m=Math.max(m,T),v+=R+a}),p+=m,d.push({width:m,height:v}),p}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:i,labels:{padding:n},rtl:o}}=this,r=getRtlAdapter(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a]);for(const d of t)a!==d.row&&(a=d.row,l=_alignStartEnd(i,this.left+n,this.right-this.lineWidths[a])),d.top+=this.top+e+n,d.left=r.leftForLtr(r.x(l),d.width),l+=d.width+n}else{let a=0,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height);for(const d of t)d.col!==a&&(a=d.col,l=_alignStartEnd(i,this.top+e+n,this.bottom-this.columnSizes[a].height)),d.top=l,d.left+=this.left+n,d.left=r.leftForLtr(r.x(d.left),d.width),l+=d.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;clipArea(e,this),this._draw(),unclipArea(e)}}_draw(){const{options:e,columnSizes:t,lineWidths:i,ctx:n}=this,{align:o,labels:r}=e,a=defaults.color,l=getRtlAdapter(e.rtl,this.left,this.width),d=toFont(r.font),{padding:h}=r,p=d.size,m=p/2;let v;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=d.string;const{boxWidth:y,boxHeight:b,itemHeight:S}=getBoxSize(r,p),E=function(x,M,I){if(isNaN(y)||y<=0||isNaN(b)||b<0)return;n.save();const V=valueOrDefault(I.lineWidth,1);if(n.fillStyle=valueOrDefault(I.fillStyle,a),n.lineCap=valueOrDefault(I.lineCap,"butt"),n.lineDashOffset=valueOrDefault(I.lineDashOffset,0),n.lineJoin=valueOrDefault(I.lineJoin,"miter"),n.lineWidth=V,n.strokeStyle=valueOrDefault(I.strokeStyle,a),n.setLineDash(valueOrDefault(I.lineDash,[])),r.usePointStyle){const z={radius:b*Math.SQRT2/2,pointStyle:I.pointStyle,rotation:I.rotation,borderWidth:V},B=l.xPlus(x,y/2),K=M+m;drawPointLegend(n,z,B,K,r.pointStyleWidth&&y)}else{const z=M+Math.max((p-b)/2,0),B=l.leftForLtr(x,y),K=toTRBLCorners(I.borderRadius);n.beginPath(),Object.values(K).some(J=>J!==0)?addRoundedRectPath(n,{x:B,y:z,w:y,h:b,radius:K}):n.rect(B,z,y,b),n.fill(),V!==0&&n.stroke()}n.restore()},T=function(x,M,I){renderText(n,I.text,x,M+S/2,d,{strikethrough:I.hidden,textAlign:l.textAlign(I.textAlign)})},R=this.isHorizontal(),A=this._computeTitleHeight();R?v={x:_alignStartEnd(o,this.left+h,this.right-i[0]),y:this.top+h+A,line:0}:v={x:this.left+h,y:_alignStartEnd(o,this.top+A+h,this.bottom-t[0].height),line:0},overrideTextDirection(this.ctx,e.textDirection);const D=S+h;this.legendItems.forEach((x,M)=>{n.strokeStyle=x.fontColor,n.fillStyle=x.fontColor;const I=n.measureText(x.text).width,V=l.textAlign(x.textAlign||(x.textAlign=r.textAlign)),z=y+m+I;let B=v.x,K=v.y;l.setWidth(this.width),R?M>0&&B+z+h>this.right&&(K=v.y+=D,v.line++,B=v.x=_alignStartEnd(o,this.left+h,this.right-i[v.line])):M>0&&K+D>this.bottom&&(B=v.x=B+t[v.line].width+h,v.line++,K=v.y=_alignStartEnd(o,this.top+A+h,this.bottom-t[v.line].height));const J=l.x(B);if(E(J,K,x),B=_textX(V,B+y+m,R?B+z:this.right,e.rtl),T(l.x(B),K,x),R)v.x+=z+h;else if(typeof x.text!="string"){const Z=d.lineHeight;v.y+=calculateLegendItemHeight(x,Z)+h}else v.y+=D}),restoreTextDirection(this.ctx,e.textDirection)}drawTitle(){const e=this.options,t=e.title,i=toFont(t.font),n=toPadding(t.padding);if(!t.display)return;const o=getRtlAdapter(e.rtl,this.left,this.width),r=this.ctx,a=t.position,l=i.size/2,d=n.top+l;let h,p=this.left,m=this.width;if(this.isHorizontal())m=Math.max(...this.lineWidths),h=this.top+d,p=_alignStartEnd(e.align,p,this.right-m);else{const y=this.columnSizes.reduce((b,S)=>Math.max(b,S.height),0);h=d+_alignStartEnd(e.align,this.top,this.bottom-y-e.labels.padding-this._computeTitleHeight())}const v=_alignStartEnd(a,p,p+m);r.textAlign=o.textAlign(_toLeftRightCenter(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=i.string,renderText(r,t.text,v,h,i)}_computeTitleHeight(){const e=this.options.title,t=toFont(e.font),i=toPadding(e.padding);return e.display?t.lineHeight+i.height:0}_getLegendItemAt(e,t){let i,n,o;if(_isBetween(e,this.left,this.right)&&_isBetween(t,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>r.length?o:r)),e+t.size/2+i.measureText(n).width}function calculateItemHeight(s,e,t){let i=s;return typeof e.text!="string"&&(i=calculateLegendItemHeight(e,t)),i}function calculateLegendItemHeight(s,e){const t=s.text?s.text.length:0;return e*t}function isListened(s,e){return!!((s==="mousemove"||s==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(s==="click"||s==="mouseup"))}var plugin_legend={id:"legend",_element:Legend,start(s,e,t){const i=s.legend=new Legend({ctx:s.ctx,options:t,chart:s});layouts.configure(s,i,t),layouts.addBox(s,i)},stop(s){layouts.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,e,t){const i=s.legend;layouts.configure(s,i,t),i.options=t},afterUpdate(s){const e=s.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(s,e){e.replay||s.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,e,t){const i=e.datasetIndex,n=t.chart;n.isDatasetVisible(i)?(n.hide(i),e.hidden=!0):(n.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const e=s.data.datasets,{labels:{usePointStyle:t,pointStyle:i,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{const d=l.controller.getStyle(t?0:void 0),h=toPadding(d.borderWidth);return{text:e[l.index].label,fillStyle:d.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:d.borderColor,pointStyle:i||d.pointStyle,rotation:d.rotation,textAlign:n||d.textAlign,borderRadius:r&&(a||d.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};const positioners={average(s){if(!s.length)return!1;let e,t,i=new Set,n=0,o=0;for(e=0,t=s.length;ea+l)/i.size,y:n/o}},nearest(s,e){if(!s.length)return!1;let t=e.x,i=e.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=s.length;o-1?s.split(` -`):s}function createTooltipItem(s,e){const{element:t,datasetIndex:i,index:n}=e,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:t}}function getTooltipSize(s,e){const t=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=e,l=toFont(e.bodyFont),d=toFont(e.titleFont),h=toFont(e.footerFont),p=o.length,m=n.length,v=i.length,y=toPadding(e.padding);let b=y.height,S=0,E=i.reduce((A,D)=>A+D.before.length+D.lines.length+D.after.length,0);if(E+=s.beforeBody.length+s.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),E){const A=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;b+=v*A+(E-v)*l.lineHeight+(E-1)*e.bodySpacing}m&&(b+=e.footerMarginTop+m*h.lineHeight+(m-1)*e.footerSpacing);let T=0;const R=function(A){S=Math.max(S,t.measureText(A).width+T)};return t.save(),t.font=d.string,each(s.title,R),t.font=l.string,each(s.beforeBody.concat(s.afterBody),R),T=e.displayColors?r+2+e.boxPadding:0,each(i,A=>{each(A.before,R),each(A.lines,R),each(A.after,R)}),T=0,t.font=h.string,each(s.footer,R),t.restore(),S+=y.width,{width:S,height:b}}function determineYAlign(s,e){const{y:t,height:i}=e;return ts.height-i/2?"bottom":"center"}function doesNotFitWithAlign(s,e,t,i){const{x:n,width:o}=i,r=t.caretSize+t.caretPadding;if(s==="left"&&n+o+r>e.width||s==="right"&&n-o-r<0)return!0}function determineXAlign(s,e,t,i){const{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=s;let d="center";return i==="center"?d=n<=(a+l)/2?"left":"right":n<=o/2?d="left":n>=r-o/2&&(d="right"),doesNotFitWithAlign(d,s,e,t)&&(d="center"),d}function determineAlignment(s,e,t){const i=t.yAlign||e.yAlign||determineYAlign(s,t);return{xAlign:t.xAlign||e.xAlign||determineXAlign(s,e,t,i),yAlign:i}}function alignX(s,e){let{x:t,width:i}=s;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function alignY(s,e,t){let{y:i,height:n}=s;return e==="top"?i+=t:e==="bottom"?i-=n+t:i-=n/2,i}function getBackgroundPoint(s,e,t,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=t,d=n+o,{topLeft:h,topRight:p,bottomLeft:m,bottomRight:v}=toTRBLCorners(r);let y=alignX(e,a);const b=alignY(e,l,d);return l==="center"?a==="left"?y+=d:a==="right"&&(y-=d):a==="left"?y-=Math.max(h,m)+n:a==="right"&&(y+=Math.max(p,v)+n),{x:_limitValue(y,0,i.width-e.width),y:_limitValue(b,0,i.height-e.height)}}function getAlignedX(s,e,t){const i=toPadding(t.padding);return e==="center"?s.x+s.width/2:e==="right"?s.x+s.width-i.right:s.x+i.left}function getBeforeAfterBodyLines(s){return pushOrConcat([],splitNewlines(s))}function createTooltipContext(s,e,t){return createContext(s,{tooltip:e,tooltipItems:t,type:"tooltip"})}function overrideCallbacks(s,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?s.override(t):s}const defaultCallbacks={beforeTitle:noop$1,title(s){if(s.length>0){const e=s[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?defaultCallbacks[e].call(t,i):n}class Tooltip extends Element$1{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&t.options.animation&&i.animations,o=new Animations(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeTitle",this,e),o=invokeCallbackWithFallback(i,"title",this,e),r=invokeCallbackWithFallback(i,"afterTitle",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}getBeforeBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,n=[];return each(e,o=>{const r={before:[],lines:[],after:[]},a=overrideCallbacks(i,o);pushOrConcat(r.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,o))),pushOrConcat(r.lines,invokeCallbackWithFallback(a,"label",this,o)),pushOrConcat(r.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeFooter",this,e),o=invokeCallbackWithFallback(i,"footer",this,e),r=invokeCallbackWithFallback(i,"afterFooter",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}_createItems(e){const t=this._active,i=this.chart.data,n=[],o=[],r=[];let a=[],l,d;for(l=0,d=t.length;le.filter(h,p,m,i))),e.itemSort&&(a=a.sort((h,p)=>e.itemSort(h,p,i))),each(a,h=>{const p=overrideCallbacks(e.callbacks,h);n.push(invokeCallbackWithFallback(p,"labelColor",this,h)),o.push(invokeCallbackWithFallback(p,"labelPointStyle",this,h)),r.push(invokeCallbackWithFallback(p,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(e,t){const i=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=positioners[i.position].call(this,n,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=getTooltipSize(this,i),d=Object.assign({},a,l),h=determineAlignment(this.chart,i,d),p=getBackgroundPoint(i,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:p.x,y:p.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,n){const o=this.getCaretPosition(e,i,n);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,i){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:d,bottomLeft:h,bottomRight:p}=toTRBLCorners(a),{x:m,y:v}=e,{width:y,height:b}=t;let S,E,T,R,A,D;return o==="center"?(A=v+b/2,n==="left"?(S=m,E=S-r,R=A+r,D=A-r):(S=m+y,E=S+r,R=A-r,D=A+r),T=S):(n==="left"?E=m+Math.max(l,h)+r:n==="right"?E=m+y-Math.max(d,p)-r:E=this.caretX,o==="top"?(R=v,A=R-r,S=E-r,T=E+r):(R=v+b,A=R+r,S=E+r,T=E-r),D=R),{x1:S,x2:E,x3:T,y1:R,y2:A,y3:D}}drawTitle(e,t,i){const n=this.title,o=n.length;let r,a,l;if(o){const d=getRtlAdapter(i.rtl,this.x,this.width);for(e.x=getAlignedX(this,i.titleAlign,i),t.textAlign=d.textAlign(i.titleAlign),t.textBaseline="middle",r=toFont(i.titleFont),a=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string,l=0;lT!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,addRoundedRectPath(e,{x:b,y,w:d,h:l,radius:E}),e.fill(),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),addRoundedRectPath(e,{x:S,y:y+1,w:d-2,h:l-2,radius:E}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(b,y,d,l),e.strokeRect(b,y,d,l),e.fillStyle=r.backgroundColor,e.fillRect(S,y+1,d-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:d,boxPadding:h}=i,p=toFont(i.bodyFont);let m=p.lineHeight,v=0;const y=getRtlAdapter(i.rtl,this.x,this.width),b=function(I){t.fillText(I,y.x(e.x+v),e.y+m/2),e.y+=m+o},S=y.textAlign(r);let E,T,R,A,D,x,M;for(t.textAlign=r,t.textBaseline="middle",t.font=p.string,e.x=getAlignedX(this,S,i),t.fillStyle=i.bodyColor,each(this.beforeBody,b),v=a&&S!=="right"?r==="center"?d/2+h:d+2+h:0,A=0,x=n.length;A0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const r=positioners[e.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=getTooltipSize(this,e),l=Object.assign({},r,this._size),d=determineAlignment(t,e,l),h=getBackgroundPoint(e,l,d,t);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=toPadding(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(o,e,n,t),overrideTextDirection(e,t.textDirection),o.y+=r.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),restoreTextDirection(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,n=e.map(({datasetIndex:a,index:l})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[l],index:l}}),o=!_elementsEqual(i,n),r=this._positionChanged(n,t);(o||r)&&(this._active=n,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(e,o,t,i),a=this._positionChanged(r,e),l=t||!_elementsEqual(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,i,n){const o=this.options;if(e.type==="mouseout")return[];if(!n)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(e,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(e,t){const{caretX:i,caretY:n,options:o}=this,r=positioners[o.position].call(this,e,t);return r!==!1&&(i!==r.x||n!==r.y)}}G(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(s,e,t){t&&(s.tooltip=new Tooltip({chart:s,options:t}))},beforeUpdate(s,e,t){s.tooltip&&s.tooltip.initialize(t)},reset(s,e,t){s.tooltip&&s.tooltip.initialize(t)},afterDraw(s){const e=s.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(s.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",t)}},afterEvent(s,e){if(s.tooltip){const t=e.replay;s.tooltip.handleEvent(e.event,t,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:(s,e)=>e.bodyFont.size,boxWidth:(s,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:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(s,e,t,i)=>(typeof e=="string"?(t=s.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function findOrAddLabel(s,e,t,i){const n=s.indexOf(e);if(n===-1)return addIfString(s,e,t,i);const o=s.lastIndexOf(e);return n!==o?t:n}const validIndex=(s,e)=>s===null?null:_limitValue(Math.round(s),0,e);function _getLabelForValue(s){const e=this.getLabels();return s>=0&&st.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}G(CategoryScale,"id","category"),G(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(s,e){const t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:d,maxTicks:h,maxDigits:p,includeBounds:m}=s,v=o||1,y=h-1,{min:b,max:S}=e,E=!isNullOrUndef(r),T=!isNullOrUndef(a),R=!isNullOrUndef(d),A=(S-b)/(p+1);let D=niceNum((S-b)/y/v)*v,x,M,I,V;if(D<1e-14&&!E&&!T)return[{value:b},{value:S}];V=Math.ceil(S/D)-Math.floor(b/D),V>y&&(D=niceNum(V*D/y/v)*v),isNullOrUndef(l)||(x=Math.pow(10,l),D=Math.ceil(D*x)/x),n==="ticks"?(M=Math.floor(b/D)*D,I=Math.ceil(S/D)*D):(M=b,I=S),E&&T&&o&&almostWhole((a-r)/o,D/1e3)?(V=Math.round(Math.min((a-r)/D,h)),D=(a-r)/V,M=r,I=a):R?(M=E?r:M,I=T?a:I,V=d-1,D=(I-M)/V):(V=(I-M)/D,almostEquals(V,Math.round(V),D/1e3)?V=Math.round(V):V=Math.ceil(V));const z=Math.max(_decimalPlaces(D),_decimalPlaces(M));x=Math.pow(10,isNullOrUndef(l)?z:l),M=Math.round(M*x)/x,I=Math.round(I*x)/x;let B=0;for(E&&(m&&M!==r?(t.push({value:r}),Ma)break;t.push({value:K})}return T&&m&&I!==a?t.length&&almostEquals(t[t.length-1].value,a,relativeLabelSize(a,A,s))?t[t.length-1].value=a:t.push({value:a}):(!T||I===a)&&t.push({value:I}),t}function relativeLabelSize(s,e,{horizontal:t,minRotation:i}){const n=toRadians(i),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+s).length;return Math.min(e/o,r)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return isNullOrUndef(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=t?n:l,a=l=>o=i?o:l;if(e){const l=sign(n),d=sign(o);l<0&&d<0?a(0):l>0&&d>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||r(n-l)}this.min=n,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=generateTicks$1(n,o);return e.bounds==="ticks"&&_setMinAndMaxByKey(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const n=(i-t)/Math.max(e.length-1,1)/2;t-=n,i+=n}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return formatNumber(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?e:0,this.max=isNumberFinite(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=toRadians(this.options.ticks.minRotation),n=(e?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}G(LinearScale,"id","linear"),G(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=s=>Math.floor(log10(s)),changeExponent=(s,e)=>Math.pow(10,log10Floor(s)+e);function isMajor(s){return s/Math.pow(10,log10Floor(s))===1}function steps(s,e,t){const i=Math.pow(10,t),n=Math.floor(s/i);return Math.ceil(e/i)-n}function startExp(s,e){const t=e-s;let i=log10Floor(t);for(;steps(s,e,i)>10;)i++;for(;steps(s,e,i)<10;)i--;return Math.min(i,log10Floor(s))}function generateTicks(s,{min:e,max:t}){e=finiteOrDefault(s.min,e);const i=[],n=log10Floor(e);let o=startExp(e,t),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let p=Math.floor((d-h)/Math.pow(10,o)),m=finiteOrDefault(s.min,Math.round((l+h+p*Math.pow(10,o))*r)/r);for(;m=10?p=p<15?15:20:p++,p>=20&&(o++,p=2,r=o>=0?1:r),m=Math.round((l+h+p*Math.pow(10,o))*r)/r;const v=finiteOrDefault(s.max,m);return i.push({value:v,major:isMajor(v),significand:p}),i}class LogarithmicScale extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const i=LinearScaleBase.prototype.parse.apply(this,[e,t]);if(i===0){this._zero=!0;return}return isNumberFinite(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?Math.max(0,e):null,this.max=isNumberFinite(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=e===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,n=this.max;const o=a=>i=e?i:a,r=a=>n=t?n:a;i===n&&(i<=0?(o(1),r(10)):(o(changeExponent(i,-1)),r(changeExponent(n,1)))),i<=0&&o(changeExponent(n,-1)),n<=0&&r(changeExponent(i,1)),this.min=i,this.max=n}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=generateTicks(t,this);return e.bounds==="ticks"&&_setMinAndMaxByKey(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":formatNumber(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=log10(e),this._valueRange=log10(this.max)-log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}G(LogarithmicScale,"id","logarithmic"),G(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(s){const e=s.ticks;if(e.display&&s.display){const t=toPadding(e.backdropPadding);return valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height}return 0}function measureLabelSize(s,e,t){return t=isArray(t)?t:[t],{w:_longestText(s,e.string,t),h:t.length*e.lineHeight}}function determineLimits(s,e,t,i,n){return s===i||s===n?{start:e-t/2,end:e+t/2}:sn?{start:e-t,end:e}:{start:e,end:e+t}}function fitWithPointLabels(s){const e={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},t=Object.assign({},e),i=[],n=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?PI/o:0;for(let l=0;le.r&&(a=(i.end-e.r)/o,s.r=Math.max(s.r,e.r+a)),n.starte.b&&(l=(n.end-e.b)/r,s.b=Math.max(s.b,e.b+l))}function createPointLabelItem(s,e,t){const i=s.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=s.getPointPosition(e,i+n+r,o),d=Math.round(toDegrees(_normalizeAngle(l.angle+HALF_PI))),h=yForAngle(l.y,a.h,d),p=getTextAlignForAngle(d),m=leftForTextAlign(l.x,a.w,p);return{visible:!0,x:l.x,y:h,textAlign:p,left:m,top:h,right:m+a.w,bottom:h+a.h}}function isNotOverlapped(s,e){if(!e)return!0;const{left:t,top:i,right:n,bottom:o}=s;return!(_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:o},e)||_isPointInArea({x:n,y:i},e)||_isPointInArea({x:n,y:o},e))}function buildPointLabelItems(s,e,t){const i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:getTickBackdropHeight(o)/2,additionalAngle:r?PI/n:0};let d;for(let h=0;h270||t<90)&&(s-=e),s}function drawPointLabelBox(s,e,t){const{left:i,top:n,right:o,bottom:r}=t,{backdropColor:a}=e;if(!isNullOrUndef(a)){const l=toTRBLCorners(e.borderRadius),d=toPadding(e.backdropPadding);s.fillStyle=a;const h=i-d.left,p=n-d.top,m=o-i+d.width,v=r-n+d.height;Object.values(l).some(y=>y!==0)?(s.beginPath(),addRoundedRectPath(s,{x:h,y:p,w:m,h:v,radius:l}),s.fill()):s.fillRect(h,p,m,v)}}function drawPointLabels(s,e){const{ctx:t,options:{pointLabels:i}}=s;for(let n=e-1;n>=0;n--){const o=s._pointLabelItems[n];if(!o.visible)continue;const r=i.setContext(s.getPointLabelContext(n));drawPointLabelBox(t,r,o);const a=toFont(r.font),{x:l,y:d,textAlign:h}=o;renderText(t,s._pointLabels[n],l,d+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function pathRadiusLine(s,e,t,i){const{ctx:n}=s;if(t)n.arc(s.xCenter,s.yCenter,e,0,TAU);else{let o=s.getPointPosition(0,e);n.moveTo(o.x,o.y);for(let r=1;r{const n=callback(this.options.pointLabels.callback,[t,i],this);return n||n===0?n:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,n){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,n))}getIndexAngle(e){const t=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(e*t+toRadians(i))}getDistanceFromCenterForValue(e){if(isNullOrUndef(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(isNullOrUndef(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(p!==0){l=this.getDistanceFromCenterForValue(h.value);const m=this.getContext(p),v=n.setContext(m),y=o.setContext(m);drawRadiusLine(this,v,l,r,y)}}),i.display){for(e.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:m}=h;!m||!p||(e.lineWidth=m,e.strokeStyle=p,e.setLineDash(h.borderDash),e.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),d=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(n),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!t.reverse)return;const d=i.setContext(this.getContext(l)),h=toFont(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),d.showLabelBackdrop){e.font=h.string,r=e.measureText(a.label).width,e.fillStyle=d.backdropColor;const p=toPadding(d.backdropPadding);e.fillRect(-r/2-p.left,-o-h.size/2-p.top,r+p.width,h.size+p.height)}renderText(e,a.label,0,-o,h,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}G(RadialLinearScale,"id","radialLinear"),G(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),G(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),G(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(s,e){return s-e}function parse(s,e){if(isNullOrUndef(e))return null;const t=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let r=e;return typeof i=="function"&&(r=i(r)),isNumberFinite(r)||(r=typeof i=="string"?t.parse(r,i):t.parse(r)),r===null?null:(n&&(r=n==="week"&&(isNumber(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function determineUnitForAutoTicks(s,e,t,i){const n=UNITS.length;for(let o=UNITS.indexOf(s);o=UNITS.indexOf(t);o--){const r=UNITS[o];if(INTERVALS[r].common&&s._adapter.diff(n,i,r)>=e-1)return r}return UNITS[t?UNITS.indexOf(t):0]}function determineMajorUnit(s){for(let e=UNITS.indexOf(s)+1,t=UNITS.length;e=e?t[i]:t[n];s[o]=!0}}function setMajorTicks(s,e,t,i){const n=s._adapter,o=+n.startOf(e[0].value,i),r=e[e.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,i))l=t[a],l>=0&&(e[l].major=!0);return e}function ticksFromTimestamps(s,e,t){const i=[],n={},o=e.length;let r,a;for(r=0;r+e.value))}initOffsets(e=[]){let t=0,i=0,n,o;this.options.offset&&e.length&&(n=this.getDecimalForValue(e[0]),e.length===1?t=1-n:t=(this.getDecimalForValue(e[1])-n)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?i=o:i=(o-this.getDecimalForValue(e[e.length-2]))/2);const r=e.length<3?.5:.25;t=_limitValue(t,0,r),i=_limitValue(i,0,r),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||determineUnitForAutoTicks(o.minUnit,t,i,this._getLabelCapacity(t)),a=valueOrDefault(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,d=isNumber(l)||l===!0,h={};let p=t,m,v;if(d&&(p=+e.startOf(p,"isoWeek",l)),p=+e.startOf(p,d?"day":r),e.diff(i,t,r)>1e5*a)throw new Error(t+" and "+i+" are too far apart with stepSize of "+a+" "+r);const y=n.ticks.source==="data"&&this.getDataTimestamps();for(m=p,v=0;m+b)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const n=this.options.time.displayFormats,o=this._unit,r=t||n[o];return this._adapter.format(e,r)}_tickFormatFunction(e,t,i,n){const o=this.options,r=o.ticks.callback;if(r)return callback(r,[e,t,i],this);const a=o.time.displayFormats,l=this._unit,d=this._majorUnit,h=l&&a[l],p=d&&a[d],m=i[t],v=d&&p&&m&&m.major;return this._adapter.format(e,n||(v?p:h))}generateTickLabels(e){let t,i,n;for(t=0,i=e.length;t0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,i=n.length;t=s[i].pos&&e<=s[n].pos&&({lo:i,hi:n}=_lookupByKey(s,"pos",e)),{pos:o,time:a}=s[i],{pos:r,time:l}=s[n]):(e>=s[i].time&&e<=s[n].time&&({lo:i,hi:n}=_lookupByKey(s,"time",e)),{time:o,pos:a}=s[i],{time:r,pos:l}=s[n]);const d=r-o;return d?a+(l-a)*(e-o)/d:a}class TimeSeriesScale extends TimeScale{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=interpolate(t,this.min),this._tableRange=interpolate(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,n=[],o=[];let r,a,l,d,h;for(r=0,a=e.length;r=t&&d<=i&&n.push(d);if(n.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(interpolate(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}G(TimeSeriesScale,"id","timeseries"),G(TimeSeriesScale,"defaults",TimeScale.defaults);/*! +`):s}function createTooltipItem(s,e){const{element:t,datasetIndex:i,index:n}=e,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:t}}function getTooltipSize(s,e){const t=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=e,l=toFont(e.bodyFont),d=toFont(e.titleFont),h=toFont(e.footerFont),p=o.length,m=n.length,v=i.length,y=toPadding(e.padding);let b=y.height,S=0,E=i.reduce((A,D)=>A+D.before.length+D.lines.length+D.after.length,0);if(E+=s.beforeBody.length+s.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),E){const A=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;b+=v*A+(E-v)*l.lineHeight+(E-1)*e.bodySpacing}m&&(b+=e.footerMarginTop+m*h.lineHeight+(m-1)*e.footerSpacing);let T=0;const R=function(A){S=Math.max(S,t.measureText(A).width+T)};return t.save(),t.font=d.string,each(s.title,R),t.font=l.string,each(s.beforeBody.concat(s.afterBody),R),T=e.displayColors?r+2+e.boxPadding:0,each(i,A=>{each(A.before,R),each(A.lines,R),each(A.after,R)}),T=0,t.font=h.string,each(s.footer,R),t.restore(),S+=y.width,{width:S,height:b}}function determineYAlign(s,e){const{y:t,height:i}=e;return ts.height-i/2?"bottom":"center"}function doesNotFitWithAlign(s,e,t,i){const{x:n,width:o}=i,r=t.caretSize+t.caretPadding;if(s==="left"&&n+o+r>e.width||s==="right"&&n-o-r<0)return!0}function determineXAlign(s,e,t,i){const{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=s;let d="center";return i==="center"?d=n<=(a+l)/2?"left":"right":n<=o/2?d="left":n>=r-o/2&&(d="right"),doesNotFitWithAlign(d,s,e,t)&&(d="center"),d}function determineAlignment(s,e,t){const i=t.yAlign||e.yAlign||determineYAlign(s,t);return{xAlign:t.xAlign||e.xAlign||determineXAlign(s,e,t,i),yAlign:i}}function alignX(s,e){let{x:t,width:i}=s;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function alignY(s,e,t){let{y:i,height:n}=s;return e==="top"?i+=t:e==="bottom"?i-=n+t:i-=n/2,i}function getBackgroundPoint(s,e,t,i){const{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=t,d=n+o,{topLeft:h,topRight:p,bottomLeft:m,bottomRight:v}=toTRBLCorners(r);let y=alignX(e,a);const b=alignY(e,l,d);return l==="center"?a==="left"?y+=d:a==="right"&&(y-=d):a==="left"?y-=Math.max(h,m)+n:a==="right"&&(y+=Math.max(p,v)+n),{x:_limitValue(y,0,i.width-e.width),y:_limitValue(b,0,i.height-e.height)}}function getAlignedX(s,e,t){const i=toPadding(t.padding);return e==="center"?s.x+s.width/2:e==="right"?s.x+s.width-i.right:s.x+i.left}function getBeforeAfterBodyLines(s){return pushOrConcat([],splitNewlines(s))}function createTooltipContext(s,e,t){return createContext(s,{tooltip:e,tooltipItems:t,type:"tooltip"})}function overrideCallbacks(s,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?s.override(t):s}const defaultCallbacks={beforeTitle:noop$1,title(s){if(s.length>0){const e=s[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?defaultCallbacks[e].call(t,i):n}class Tooltip extends Element$1{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&t.options.animation&&i.animations,o=new Animations(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeTitle",this,e),o=invokeCallbackWithFallback(i,"title",this,e),r=invokeCallbackWithFallback(i,"afterTitle",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}getBeforeBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"beforeBody",this,e))}getBody(e,t){const{callbacks:i}=t,n=[];return each(e,o=>{const r={before:[],lines:[],after:[]},a=overrideCallbacks(i,o);pushOrConcat(r.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,o))),pushOrConcat(r.lines,invokeCallbackWithFallback(a,"label",this,o)),pushOrConcat(r.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(e,t){return getBeforeAfterBodyLines(invokeCallbackWithFallback(t.callbacks,"afterBody",this,e))}getFooter(e,t){const{callbacks:i}=t,n=invokeCallbackWithFallback(i,"beforeFooter",this,e),o=invokeCallbackWithFallback(i,"footer",this,e),r=invokeCallbackWithFallback(i,"afterFooter",this,e);let a=[];return a=pushOrConcat(a,splitNewlines(n)),a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a}_createItems(e){const t=this._active,i=this.chart.data,n=[],o=[],r=[];let a=[],l,d;for(l=0,d=t.length;le.filter(h,p,m,i))),e.itemSort&&(a=a.sort((h,p)=>e.itemSort(h,p,i))),each(a,h=>{const p=overrideCallbacks(e.callbacks,h);n.push(invokeCallbackWithFallback(p,"labelColor",this,h)),o.push(invokeCallbackWithFallback(p,"labelPointStyle",this,h)),r.push(invokeCallbackWithFallback(p,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(e,t){const i=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=positioners[i.position].call(this,n,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);const l=this._size=getTooltipSize(this,i),d=Object.assign({},a,l),h=determineAlignment(this.chart,i,d),p=getBackgroundPoint(i,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:p.x,y:p.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,n){const o=this.getCaretPosition(e,i,n);t.lineTo(o.x1,o.y1),t.lineTo(o.x2,o.y2),t.lineTo(o.x3,o.y3)}getCaretPosition(e,t,i){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:d,bottomLeft:h,bottomRight:p}=toTRBLCorners(a),{x:m,y:v}=e,{width:y,height:b}=t;let S,E,T,R,A,D;return o==="center"?(A=v+b/2,n==="left"?(S=m,E=S-r,R=A+r,D=A-r):(S=m+y,E=S+r,R=A-r,D=A+r),T=S):(n==="left"?E=m+Math.max(l,h)+r:n==="right"?E=m+y-Math.max(d,p)-r:E=this.caretX,o==="top"?(R=v,A=R-r,S=E-r,T=E+r):(R=v+b,A=R+r,S=E+r,T=E-r),D=R),{x1:S,x2:E,x3:T,y1:R,y2:A,y3:D}}drawTitle(e,t,i){const n=this.title,o=n.length;let r,a,l;if(o){const d=getRtlAdapter(i.rtl,this.x,this.width);for(e.x=getAlignedX(this,i.titleAlign,i),t.textAlign=d.textAlign(i.titleAlign),t.textBaseline="middle",r=toFont(i.titleFont),a=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string,l=0;lT!==0)?(e.beginPath(),e.fillStyle=o.multiKeyBackground,addRoundedRectPath(e,{x:b,y,w:d,h:l,radius:E}),e.fill(),e.stroke(),e.fillStyle=r.backgroundColor,e.beginPath(),addRoundedRectPath(e,{x:S,y:y+1,w:d-2,h:l-2,radius:E}),e.fill()):(e.fillStyle=o.multiKeyBackground,e.fillRect(b,y,d,l),e.strokeRect(b,y,d,l),e.fillStyle=r.backgroundColor,e.fillRect(S,y+1,d-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:d,boxPadding:h}=i,p=toFont(i.bodyFont);let m=p.lineHeight,v=0;const y=getRtlAdapter(i.rtl,this.x,this.width),b=function(I){t.fillText(I,y.x(e.x+v),e.y+m/2),e.y+=m+o},S=y.textAlign(r);let E,T,R,A,D,x,M;for(t.textAlign=r,t.textBaseline="middle",t.font=p.string,e.x=getAlignedX(this,S,i),t.fillStyle=i.bodyColor,each(this.beforeBody,b),v=a&&S!=="right"?r==="center"?d/2+h:d+2+h:0,A=0,x=n.length;A0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const r=positioners[e.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=getTooltipSize(this,e),l=Object.assign({},r,this._size),d=determineAlignment(t,e,l),h=getBackgroundPoint(e,l,d,t);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=toPadding(t.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&a&&(e.save(),e.globalAlpha=i,this.drawBackground(o,e,n,t),overrideTextDirection(e,t.textDirection),o.y+=r.top,this.drawTitle(o,e,t),this.drawBody(o,e,t),this.drawFooter(o,e,t),restoreTextDirection(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,n=e.map(({datasetIndex:a,index:l})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[l],index:l}}),o=!_elementsEqual(i,n),r=this._positionChanged(n,t);(o||r)&&(this._active=n,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(e,o,t,i),a=this._positionChanged(r,e),l=t||!_elementsEqual(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),l}_getActiveElements(e,t,i,n){const o=this.options;if(e.type==="mouseout")return[];if(!n)return t.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(e,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(e,t){const{caretX:i,caretY:n,options:o}=this,r=positioners[o.position].call(this,e,t);return r!==!1&&(i!==r.x||n!==r.y)}}G(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(s,e,t){t&&(s.tooltip=new Tooltip({chart:s,options:t}))},beforeUpdate(s,e,t){s.tooltip&&s.tooltip.initialize(t)},reset(s,e,t){s.tooltip&&s.tooltip.initialize(t)},afterDraw(s){const e=s.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(s.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0})===!1)return;e.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",t)}},afterEvent(s,e){if(s.tooltip){const t=e.replay;s.tooltip.handleEvent(e.event,t,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:(s,e)=>e.bodyFont.size,boxWidth:(s,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:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(s,e,t,i)=>(typeof e=="string"?(t=s.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function findOrAddLabel(s,e,t,i){const n=s.indexOf(e);if(n===-1)return addIfString(s,e,t,i);const o=s.lastIndexOf(e);return n!==o?t:n}const validIndex=(s,e)=>s===null?null:_limitValue(Math.round(s),0,e);function _getLabelForValue(s){const e=this.getLabels();return s>=0&&st.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}G(CategoryScale,"id","category"),G(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(s,e){const t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:d,maxTicks:h,maxDigits:p,includeBounds:m}=s,v=o||1,y=h-1,{min:b,max:S}=e,E=!isNullOrUndef(r),T=!isNullOrUndef(a),R=!isNullOrUndef(d),A=(S-b)/(p+1);let D=niceNum((S-b)/y/v)*v,x,M,I,V;if(D<1e-14&&!E&&!T)return[{value:b},{value:S}];V=Math.ceil(S/D)-Math.floor(b/D),V>y&&(D=niceNum(V*D/y/v)*v),isNullOrUndef(l)||(x=Math.pow(10,l),D=Math.ceil(D*x)/x),n==="ticks"?(M=Math.floor(b/D)*D,I=Math.ceil(S/D)*D):(M=b,I=S),E&&T&&o&&almostWhole((a-r)/o,D/1e3)?(V=Math.round(Math.min((a-r)/D,h)),D=(a-r)/V,M=r,I=a):R?(M=E?r:M,I=T?a:I,V=d-1,D=(I-M)/V):(V=(I-M)/D,almostEquals(V,Math.round(V),D/1e3)?V=Math.round(V):V=Math.ceil(V));const z=Math.max(_decimalPlaces(D),_decimalPlaces(M));x=Math.pow(10,isNullOrUndef(l)?z:l),M=Math.round(M*x)/x,I=Math.round(I*x)/x;let B=0;for(E&&(m&&M!==r?(t.push({value:r}),Ma)break;t.push({value:K})}return T&&m&&I!==a?t.length&&almostEquals(t[t.length-1].value,a,relativeLabelSize(a,A,s))?t[t.length-1].value=a:t.push({value:a}):(!T||I===a)&&t.push({value:I}),t}function relativeLabelSize(s,e,{horizontal:t,minRotation:i}){const n=toRadians(i),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+s).length;return Math.min(e/o,r)}class LinearScaleBase extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return isNullOrUndef(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=t?n:l,a=l=>o=i?o:l;if(e){const l=sign(n),d=sign(o);l<0&&d<0?a(0):l>0&&d>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||r(n-l)}this.min=n,this.max=o}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=generateTicks$1(n,o);return e.bounds==="ticks"&&_setMinAndMaxByKey(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const n=(i-t)/Math.max(e.length-1,1)/2;t-=n,i+=n}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return formatNumber(e,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?e:0,this.max=isNumberFinite(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=toRadians(this.options.ticks.minRotation),n=(e?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}G(LinearScale,"id","linear"),G(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=s=>Math.floor(log10(s)),changeExponent=(s,e)=>Math.pow(10,log10Floor(s)+e);function isMajor(s){return s/Math.pow(10,log10Floor(s))===1}function steps(s,e,t){const i=Math.pow(10,t),n=Math.floor(s/i);return Math.ceil(e/i)-n}function startExp(s,e){const t=e-s;let i=log10Floor(t);for(;steps(s,e,i)>10;)i++;for(;steps(s,e,i)<10;)i--;return Math.min(i,log10Floor(s))}function generateTicks(s,{min:e,max:t}){e=finiteOrDefault(s.min,e);const i=[],n=log10Floor(e);let o=startExp(e,t),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,d=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let p=Math.floor((d-h)/Math.pow(10,o)),m=finiteOrDefault(s.min,Math.round((l+h+p*Math.pow(10,o))*r)/r);for(;m=10?p=p<15?15:20:p++,p>=20&&(o++,p=2,r=o>=0?1:r),m=Math.round((l+h+p*Math.pow(10,o))*r)/r;const v=finiteOrDefault(s.max,m);return i.push({value:v,major:isMajor(v),significand:p}),i}class LogarithmicScale extends Scale{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const i=LinearScaleBase.prototype.parse.apply(this,[e,t]);if(i===0){this._zero=!0;return}return isNumberFinite(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=isNumberFinite(e)?Math.max(0,e):null,this.max=isNumberFinite(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=e===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,n=this.max;const o=a=>i=e?i:a,r=a=>n=t?n:a;i===n&&(i<=0?(o(1),r(10)):(o(changeExponent(i,-1)),r(changeExponent(n,1)))),i<=0&&o(changeExponent(n,-1)),n<=0&&r(changeExponent(i,1)),this.min=i,this.max=n}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=generateTicks(t,this);return e.bounds==="ticks"&&_setMinAndMaxByKey(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":formatNumber(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=log10(e),this._valueRange=log10(this.max)-log10(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(log10(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}G(LogarithmicScale,"id","logarithmic"),G(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(s){const e=s.ticks;if(e.display&&s.display){const t=toPadding(e.backdropPadding);return valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height}return 0}function measureLabelSize(s,e,t){return t=isArray(t)?t:[t],{w:_longestText(s,e.string,t),h:t.length*e.lineHeight}}function determineLimits(s,e,t,i,n){return s===i||s===n?{start:e-t/2,end:e+t/2}:sn?{start:e-t,end:e}:{start:e,end:e+t}}function fitWithPointLabels(s){const e={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},t=Object.assign({},e),i=[],n=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?PI/o:0;for(let l=0;le.r&&(a=(i.end-e.r)/o,s.r=Math.max(s.r,e.r+a)),n.starte.b&&(l=(n.end-e.b)/r,s.b=Math.max(s.b,e.b+l))}function createPointLabelItem(s,e,t){const i=s.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=s.getPointPosition(e,i+n+r,o),d=Math.round(toDegrees(_normalizeAngle(l.angle+HALF_PI))),h=yForAngle(l.y,a.h,d),p=getTextAlignForAngle(d),m=leftForTextAlign(l.x,a.w,p);return{visible:!0,x:l.x,y:h,textAlign:p,left:m,top:h,right:m+a.w,bottom:h+a.h}}function isNotOverlapped(s,e){if(!e)return!0;const{left:t,top:i,right:n,bottom:o}=s;return!(_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:o},e)||_isPointInArea({x:n,y:i},e)||_isPointInArea({x:n,y:o},e))}function buildPointLabelItems(s,e,t){const i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:getTickBackdropHeight(o)/2,additionalAngle:r?PI/n:0};let d;for(let h=0;h270||t<90)&&(s-=e),s}function drawPointLabelBox(s,e,t){const{left:i,top:n,right:o,bottom:r}=t,{backdropColor:a}=e;if(!isNullOrUndef(a)){const l=toTRBLCorners(e.borderRadius),d=toPadding(e.backdropPadding);s.fillStyle=a;const h=i-d.left,p=n-d.top,m=o-i+d.width,v=r-n+d.height;Object.values(l).some(y=>y!==0)?(s.beginPath(),addRoundedRectPath(s,{x:h,y:p,w:m,h:v,radius:l}),s.fill()):s.fillRect(h,p,m,v)}}function drawPointLabels(s,e){const{ctx:t,options:{pointLabels:i}}=s;for(let n=e-1;n>=0;n--){const o=s._pointLabelItems[n];if(!o.visible)continue;const r=i.setContext(s.getPointLabelContext(n));drawPointLabelBox(t,r,o);const a=toFont(r.font),{x:l,y:d,textAlign:h}=o;renderText(t,s._pointLabels[n],l,d+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function pathRadiusLine(s,e,t,i){const{ctx:n}=s;if(t)n.arc(s.xCenter,s.yCenter,e,0,TAU);else{let o=s.getPointPosition(0,e);n.moveTo(o.x,o.y);for(let r=1;r{const n=callback(this.options.pointLabels.callback,[t,i],this);return n||n===0?n:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,n){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,n))}getIndexAngle(e){const t=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(e*t+toRadians(i))}getDistanceFromCenterForValue(e){if(isNullOrUndef(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(isNullOrUndef(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(p!==0||p===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const m=this.getContext(p),v=n.setContext(m),y=o.setContext(m);drawRadiusLine(this,v,l,r,y)}}),i.display){for(e.save(),a=r-1;a>=0;a--){const h=i.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:m}=h;!m||!p||(e.lineWidth=m,e.strokeStyle=p,e.setLineDash(h.borderDash),e.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),d=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(n),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;const d=i.setContext(this.getContext(l)),h=toFont(d.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),d.showLabelBackdrop){e.font=h.string,r=e.measureText(a.label).width,e.fillStyle=d.backdropColor;const p=toPadding(d.backdropPadding);e.fillRect(-r/2-p.left,-o-h.size/2-p.top,r+p.width,h.size+p.height)}renderText(e,a.label,0,-o,h,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}G(RadialLinearScale,"id","radialLinear"),G(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),G(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),G(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(s,e){return s-e}function parse(s,e){if(isNullOrUndef(e))return null;const t=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let r=e;return typeof i=="function"&&(r=i(r)),isNumberFinite(r)||(r=typeof i=="string"?t.parse(r,i):t.parse(r)),r===null?null:(n&&(r=n==="week"&&(isNumber(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function determineUnitForAutoTicks(s,e,t,i){const n=UNITS.length;for(let o=UNITS.indexOf(s);o=UNITS.indexOf(t);o--){const r=UNITS[o];if(INTERVALS[r].common&&s._adapter.diff(n,i,r)>=e-1)return r}return UNITS[t?UNITS.indexOf(t):0]}function determineMajorUnit(s){for(let e=UNITS.indexOf(s)+1,t=UNITS.length;e=e?t[i]:t[n];s[o]=!0}}function setMajorTicks(s,e,t,i){const n=s._adapter,o=+n.startOf(e[0].value,i),r=e[e.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,i))l=t[a],l>=0&&(e[l].major=!0);return e}function ticksFromTimestamps(s,e,t){const i=[],n={},o=e.length;let r,a;for(r=0;r+e.value))}initOffsets(e=[]){let t=0,i=0,n,o;this.options.offset&&e.length&&(n=this.getDecimalForValue(e[0]),e.length===1?t=1-n:t=(this.getDecimalForValue(e[1])-n)/2,o=this.getDecimalForValue(e[e.length-1]),e.length===1?i=o:i=(o-this.getDecimalForValue(e[e.length-2]))/2);const r=e.length<3?.5:.25;t=_limitValue(t,0,r),i=_limitValue(i,0,r),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||determineUnitForAutoTicks(o.minUnit,t,i,this._getLabelCapacity(t)),a=valueOrDefault(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,d=isNumber(l)||l===!0,h={};let p=t,m,v;if(d&&(p=+e.startOf(p,"isoWeek",l)),p=+e.startOf(p,d?"day":r),e.diff(i,t,r)>1e5*a)throw new Error(t+" and "+i+" are too far apart with stepSize of "+a+" "+r);const y=n.ticks.source==="data"&&this.getDataTimestamps();for(m=p,v=0;m+b)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){const n=this.options.time.displayFormats,o=this._unit,r=t||n[o];return this._adapter.format(e,r)}_tickFormatFunction(e,t,i,n){const o=this.options,r=o.ticks.callback;if(r)return callback(r,[e,t,i],this);const a=o.time.displayFormats,l=this._unit,d=this._majorUnit,h=l&&a[l],p=d&&a[d],m=i[t],v=d&&p&&m&&m.major;return this._adapter.format(e,n||(v?p:h))}generateTickLabels(e){let t,i,n;for(t=0,i=e.length;t0?a:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,i=n.length;t=s[i].pos&&e<=s[n].pos&&({lo:i,hi:n}=_lookupByKey(s,"pos",e)),{pos:o,time:a}=s[i],{pos:r,time:l}=s[n]):(e>=s[i].time&&e<=s[n].time&&({lo:i,hi:n}=_lookupByKey(s,"time",e)),{time:o,pos:a}=s[i],{time:r,pos:l}=s[n]);const d=r-o;return d?a+(l-a)*(e-o)/d:a}class TimeSeriesScale extends TimeScale{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=interpolate(t,this.min),this._tableRange=interpolate(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,n=[],o=[];let r,a,l,d,h;for(r=0,a=e.length;r=t&&d<=i&&n.push(d);if(n.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const t=this.getDataTimestamps(),i=this.getLabelTimestamps();return t.length&&i.length?e=this.normalize(t.concat(i)):e=t.length?t:i,e=this._cache.all=e,e}getDecimalForValue(e){return(interpolate(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}G(TimeSeriesScale,"id","timeseries"),G(TimeSeriesScale,"defaults",TimeScale.defaults);/*! * chartjs-chart-sankey v0.12.0 * https://github.com/kurkle/chartjs-chart-sankey#readme * (c) 2022 Jukka Kurkela diff --git a/public/build/manifest.json b/public/build/manifest.json index e46e139243..390507980e 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -1,57 +1,57 @@ { - "_create-empty-split-224dd5cc.js": { - "file": "assets/create-empty-split-224dd5cc.js", + "_create-empty-split-81f71b2e.js": { + "file": "assets/create-empty-split-81f71b2e.js", "imports": [ - "_vendor-29d868f9.js" + "_vendor-50e42c6c.js" ], - "integrity": "sha384-Fe4EFJyqGnKJtlPnsEmK9bgqfm3ME+peYLok4zFWW2E8Jw/DFrfWPutOuy51zo7k" + "integrity": "sha384-iCRJ+fmYZVSXY4L5+Q8vhQKqcjSi6lnglG7yW8deRAjJwiVaANm0EzriQPOAgQMS" }, - "_format-money-0eadc9a5.js": { - "file": "assets/format-money-0eadc9a5.js", + "_format-money-2e5851ad.js": { + "file": "assets/format-money-2e5851ad.js", "imports": [ - "_vendor-29d868f9.js" + "_vendor-50e42c6c.js" ], - "integrity": "sha384-V+tvR2m7nSG2M4f1nCws0Vblszq/fUzQP/4WHGwxTjPiT4Bx7Yp5joFuQqHtvCZc" + "integrity": "sha384-kzF0fVkQWinHDsR1R190XjenILJ0VYvD2H1rQJW23dJvcA18qRrGRyb9q+3RADZU" }, - "_get-e91a7549.js": { - "file": "assets/get-e91a7549.js", + "_get-28b9aa25.js": { + "file": "assets/get-28b9aa25.js", "imports": [ - "_format-money-0eadc9a5.js" + "_format-money-2e5851ad.js" ], - "integrity": "sha384-taM3BY7w0UYLnnDkW+yUjJ0mjVGevf/nQX0aF1QLp/29bjEoZG9FIwIQmiob+dV/" + "integrity": "sha384-pKOfaG0JCi2+ROk2Tt8poQvr+uMK7u4BUCUKRcvEU/bREr4YReZnqSNBWtvdP3dW" }, - "_get-eb14a1e7.js": { - "file": "assets/get-eb14a1e7.js", + "_get-e0a81c64.js": { + "file": "assets/get-e0a81c64.js", "imports": [ - "_format-money-0eadc9a5.js" + "_format-money-2e5851ad.js" ], - "integrity": "sha384-oOTTX2GJ9favH5eEgKdLByQFPLOL+uEV8YuDB0G2Fr+VkTXWvAm+wTPPNRoeSBna" + "integrity": "sha384-3OBZFmOXNyobpHvnLUfs5EdHG9fjwBAhQRszBlMtAO55MsE+OrB0/xnuNfMN+R7N" }, - "_parse-downloaded-splits-c84e4e72.js": { - "file": "assets/parse-downloaded-splits-c84e4e72.js", + "_parse-downloaded-splits-83822d1b.js": { + "file": "assets/parse-downloaded-splits-83822d1b.js", "imports": [ - "_create-empty-split-224dd5cc.js", - "_vendor-29d868f9.js" + "_create-empty-split-81f71b2e.js", + "_vendor-50e42c6c.js" ], - "integrity": "sha384-GyxMGgAOGUGeGS8GopF2E91A4aYAxkCOrEUGzaTmo7TR7DexiJaMU1hBtEKW0Zrg" + "integrity": "sha384-dPB0/W3hHYE/2m/HPqibSEe2N2XD7wMTePDsRd6fv03fKwgFu6mwOjUx1t3q6Gn6" }, - "_put-79877c04.js": { - "file": "assets/put-79877c04.js", + "_put-bb9ad93a.js": { + "file": "assets/put-bb9ad93a.js", "imports": [ - "_format-money-0eadc9a5.js" + "_format-money-2e5851ad.js" ], - "integrity": "sha384-nSv+7TrBp3yUaWf50t2s5NVoNKUbc0K5BXhYuEtemv1hmKdmdfg2XTAxlCwsER5h" + "integrity": "sha384-jk8bB684G+XotWRFO6k57GF1QGy6BUgFBb55JPsvU3clT6DBNA42ELW8vPyX9HbB" }, - "_splice-errors-into-transactions-cff36293.js": { - "file": "assets/splice-errors-into-transactions-cff36293.js", + "_splice-errors-into-transactions-6727b386.js": { + "file": "assets/splice-errors-into-transactions-6727b386.js", "imports": [ - "_format-money-0eadc9a5.js", - "_get-eb14a1e7.js", - "_vendor-29d868f9.js" + "_format-money-2e5851ad.js", + "_get-28b9aa25.js", + "_vendor-50e42c6c.js" ], - "integrity": "sha384-O1jAp6eMTgnWh9y/37DmSdkXmSPqn+yuOI9GNkKst2LXoQdNuSXXsUYdlY/XQ++B" + "integrity": "sha384-x5WY5RRt7J6TLl+7nLZi1TBBKgUmjNokUh2ezaofCTQp0sEkHQrmJYAGUX/ZwPY4" }, - "_vendor-29d868f9.js": { + "_vendor-50e42c6c.js": { "assets": [ "assets/layers-1dbbe9d0.png", "assets/layers-2x-066daca8.png", @@ -60,8 +60,8 @@ "css": [ "assets/vendor-6fbf50c2.css" ], - "file": "assets/vendor-29d868f9.js", - "integrity": "sha384-b6NeUOA/F71YH766Rxtqtj4DCc+ZvbSVfDKd7vnZR9LilLr3wu/7SaEQn6wnqZ2f" + "file": "assets/vendor-50e42c6c.js", + "integrity": "sha384-dsSpdnRISp7bIdL3fpyygvNfUizujkwhA11RPZehiEUvEt52ESLYt+Hlp3c9/iZp" }, "node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.ttf": { "file": "assets/fa-brands-400-5656d596.ttf", @@ -109,45 +109,45 @@ "integrity": "sha384-wg83fCOXjBtqzFAWhTL9Sd9vmLUNhfEEzfmNUX9zwv2igKlz/YQbdapF4ObdxF+R" }, "resources/assets/v2/pages/dashboard/dashboard.js": { - "file": "assets/dashboard-79f411ba.js", + "file": "assets/dashboard-5f195194.js", "imports": [ - "_format-money-0eadc9a5.js", - "_vendor-29d868f9.js", - "_get-e91a7549.js", - "_get-eb14a1e7.js" + "_format-money-2e5851ad.js", + "_vendor-50e42c6c.js", + "_get-e0a81c64.js", + "_get-28b9aa25.js" ], "isEntry": true, "src": "resources/assets/v2/pages/dashboard/dashboard.js", - "integrity": "sha384-GwYZ6LoKmasmU8xSqpuaHMVc7pD9gcb0k3eoeHhfdYh2ZLbPqfAV0aFKMSUfDb/T" + "integrity": "sha384-/MzTdILeI9XL/Q9uFEP734/m9XlPpRFcLFQxe8i+di4fuU218Q4W+NSG3DGcKQ11" }, "resources/assets/v2/pages/transactions/create.js": { - "file": "assets/create-865d3a86.js", + "file": "assets/create-5a4939e8.js", "imports": [ - "_format-money-0eadc9a5.js", - "_create-empty-split-224dd5cc.js", - "_splice-errors-into-transactions-cff36293.js", - "_vendor-29d868f9.js", - "_get-eb14a1e7.js" + "_format-money-2e5851ad.js", + "_create-empty-split-81f71b2e.js", + "_splice-errors-into-transactions-6727b386.js", + "_vendor-50e42c6c.js", + "_get-28b9aa25.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/create.js", - "integrity": "sha384-oZDLG4pTlcJE3tQVXKsnfuCVGg8b4NwbrJWN969rtIymjNU8EyvS3ZavT5dOsq/n" + "integrity": "sha384-o9vKV/iUV+9XIsX8rG9jk8bMPSxuV827U7ScOca2b6I6f/lyJBUDmzoMqMIfaqce" }, "resources/assets/v2/pages/transactions/edit.js": { - "file": "assets/edit-5b2f31e3.js", + "file": "assets/edit-4c7ba005.js", "imports": [ - "_format-money-0eadc9a5.js", - "_get-e91a7549.js", - "_parse-downloaded-splits-c84e4e72.js", - "_splice-errors-into-transactions-cff36293.js", - "_vendor-29d868f9.js", - "_create-empty-split-224dd5cc.js", - "_put-79877c04.js", - "_get-eb14a1e7.js" + "_format-money-2e5851ad.js", + "_get-e0a81c64.js", + "_parse-downloaded-splits-83822d1b.js", + "_splice-errors-into-transactions-6727b386.js", + "_vendor-50e42c6c.js", + "_create-empty-split-81f71b2e.js", + "_put-bb9ad93a.js", + "_get-28b9aa25.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/edit.js", - "integrity": "sha384-0cKgNr169FUfm4fZWDchcbD4iUvaJvudytdMpwy2XcV89r8OS1kDIiiTdDr8rnuo" + "integrity": "sha384-MOmzHUGTHwnuic0yw3wUp8MJO+Y9iLdXGy+V5iWtiZLpG2ts8z8R8Ms9Gp9L7Rc0" }, "resources/assets/v2/pages/transactions/index.css": { "file": "assets/index-badb0a41.css", @@ -158,16 +158,16 @@ "css": [ "assets/index-badb0a41.css" ], - "file": "assets/index-914edd04.js", + "file": "assets/index-90222973.js", "imports": [ - "_format-money-0eadc9a5.js", - "_vendor-29d868f9.js", - "_put-79877c04.js", - "_get-e91a7549.js" + "_format-money-2e5851ad.js", + "_vendor-50e42c6c.js", + "_put-bb9ad93a.js", + "_get-e0a81c64.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/index.js", - "integrity": "sha384-I1nmsMl3NamObjMGO9FejfgfHD9YH4MTbwyemaQMk6s87pWgY5Y5PeWtTLmnAubR" + "integrity": "sha384-Sl6bKzSJxtyjnJoamDiBSZwdCi+AA8ZV/s40dXKFznm6RfYLiBLSS2qmQMlrVPZT" }, "resources/assets/v2/pages/transactions/show.css": { "file": "assets/show-8b1429e5.css", @@ -178,17 +178,17 @@ "css": [ "assets/show-8b1429e5.css" ], - "file": "assets/show-9c7036f1.js", + "file": "assets/show-3ef1a32a.js", "imports": [ - "_format-money-0eadc9a5.js", - "_vendor-29d868f9.js", - "_get-e91a7549.js", - "_parse-downloaded-splits-c84e4e72.js", - "_create-empty-split-224dd5cc.js" + "_format-money-2e5851ad.js", + "_vendor-50e42c6c.js", + "_get-e0a81c64.js", + "_parse-downloaded-splits-83822d1b.js", + "_create-empty-split-81f71b2e.js" ], "isEntry": true, "src": "resources/assets/v2/pages/transactions/show.js", - "integrity": "sha384-2XV3HPlPXYyJzcBmOQ3rTFIRpCxSeFpkdpGCCZyAShCgQO2JgR5wZpbo5qdLoyti" + "integrity": "sha384-SbD7zS5YgCmKGz4yqp3mEIvEye39FouSpd2+WCld8l7Wij23HCUdfGgF/cD+b21y" }, "resources/assets/v2/sass/app.scss": { "file": "assets/app-fb7b26ec.css", diff --git a/resources/lang/bg_BG/firefly.php b/resources/lang/bg_BG/firefly.php index f481a3389d..e676399137 100644 --- a/resources/lang/bg_BG/firefly.php +++ b/resources/lang/bg_BG/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Тази транзакция вече е теглене', diff --git a/resources/lang/ca_ES/firefly.php b/resources/lang/ca_ES/firefly.php index 3bb188cdf0..28cdbb9538 100644 --- a/resources/lang/ca_ES/firefly.php +++ b/resources/lang/ca_ES/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opcions de tramesa', 'apply_rules_checkbox' => 'Aplicar regles', 'fire_webhooks_checkbox' => 'Disparar webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Aquesta transacció ja és una retirada', diff --git a/resources/lang/cs_CZ/firefly.php b/resources/lang/cs_CZ/firefly.php index 678c3652ba..8f6ea41fc6 100644 --- a/resources/lang/cs_CZ/firefly.php +++ b/resources/lang/cs_CZ/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Tato transakce už je výběrem', diff --git a/resources/lang/da_DK/firefly.php b/resources/lang/da_DK/firefly.php index 8603b419c7..c8a82f6c52 100644 --- a/resources/lang/da_DK/firefly.php +++ b/resources/lang/da_DK/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Denne transaktion er allerede en udbetaling', diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index 2d8d6ab492..e1c0f29edb 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Übermittlungsoptionen', 'apply_rules_checkbox' => 'Regeln anwenden', 'fire_webhooks_checkbox' => 'Webhooks abfeuern', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Diese Buchung ist bereits eine Ausgabe', diff --git a/resources/lang/el_GR/firefly.php b/resources/lang/el_GR/firefly.php index 0e21cbe47e..edc8ecd9d5 100644 --- a/resources/lang/el_GR/firefly.php +++ b/resources/lang/el_GR/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Ενεργοποίηση των webhook', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Αυτή η συναλλαγή είναι ήδη μία ανάληψη', diff --git a/resources/lang/en_GB/firefly.php b/resources/lang/en_GB/firefly.php index 386865ff7e..f3e1e11391 100644 --- a/resources/lang/en_GB/firefly.php +++ b/resources/lang/en_GB/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal', diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index f700910810..f70126cbb0 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -1541,8 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', - 'select_source_account' => 'Please select or type a valid source account name', - 'select_dest_account' => 'Please select or type a valid destination account name', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal', diff --git a/resources/lang/es_ES/firefly.php b/resources/lang/es_ES/firefly.php index 4e36a3fb56..a8cf735c0c 100644 --- a/resources/lang/es_ES/firefly.php +++ b/resources/lang/es_ES/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opciones de envío', 'apply_rules_checkbox' => 'Aplicar reglas', 'fire_webhooks_checkbox' => 'Disparar webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Esta transferencia ya es un gasto', diff --git a/resources/lang/fi_FI/firefly.php b/resources/lang/fi_FI/firefly.php index e7e071f14c..5c1ee64e77 100644 --- a/resources/lang/fi_FI/firefly.php +++ b/resources/lang/fi_FI/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Tämä tapahtuma on jo nosto', diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php index 49f4a49f01..94770d0f25 100644 --- a/resources/lang/fr_FR/firefly.php +++ b/resources/lang/fr_FR/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Options de soumission', 'apply_rules_checkbox' => 'Appliquer les règles', 'fire_webhooks_checkbox' => 'Lancer les webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Cette opération est déjà une dépense', diff --git a/resources/lang/hu_HU/firefly.php b/resources/lang/hu_HU/firefly.php index a37105e1bb..5e0a1005c4 100644 --- a/resources/lang/hu_HU/firefly.php +++ b/resources/lang/hu_HU/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Ez a tranzakció már egy költség', diff --git a/resources/lang/id_ID/firefly.php b/resources/lang/id_ID/firefly.php index ad308f711f..ab40187dc0 100644 --- a/resources/lang/id_ID/firefly.php +++ b/resources/lang/id_ID/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Transaksi ini sudah menjadi penarikan', diff --git a/resources/lang/it_IT/firefly.php b/resources/lang/it_IT/firefly.php index 71a1fdaa1e..bf72a240af 100644 --- a/resources/lang/it_IT/firefly.php +++ b/resources/lang/it_IT/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opzioni di invio', 'apply_rules_checkbox' => 'Applica le regole', 'fire_webhooks_checkbox' => 'Esegui webhook', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Questa transazione è già un\'uscita', diff --git a/resources/lang/ja_JP/firefly.php b/resources/lang/ja_JP/firefly.php index f54db53365..28110f3590 100644 --- a/resources/lang/ja_JP/firefly.php +++ b/resources/lang/ja_JP/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => '送信オプション', 'apply_rules_checkbox' => 'ルールを適用', 'fire_webhooks_checkbox' => 'Webhookを実行', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'この取引はすでに出金です', diff --git a/resources/lang/ko_KR/firefly.php b/resources/lang/ko_KR/firefly.php index a9e53aab8e..9f2d5e8f8b 100644 --- a/resources/lang/ko_KR/firefly.php +++ b/resources/lang/ko_KR/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => '제출 옵션', 'apply_rules_checkbox' => '규칙 적용', 'fire_webhooks_checkbox' => '웹훅 실행', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => '이 거래는 이미 출금되었습니다', diff --git a/resources/lang/nb_NO/firefly.php b/resources/lang/nb_NO/firefly.php index 480718b1bc..b52f1dd8fa 100644 --- a/resources/lang/nb_NO/firefly.php +++ b/resources/lang/nb_NO/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Alternativer for innsending', 'apply_rules_checkbox' => 'Bruk regler', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Denne transaksjonen er allerede et uttak', diff --git a/resources/lang/nl_NL/firefly.php b/resources/lang/nl_NL/firefly.php index 89f37168a8..04ceedc1fb 100644 --- a/resources/lang/nl_NL/firefly.php +++ b/resources/lang/nl_NL/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Inzending opties', 'apply_rules_checkbox' => 'Regels toepassen', 'fire_webhooks_checkbox' => 'Webhooks starten', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Deze transactie is al een uitgave', diff --git a/resources/lang/nn_NO/firefly.php b/resources/lang/nn_NO/firefly.php index ce88fb7f14..511b2cfe92 100644 --- a/resources/lang/nn_NO/firefly.php +++ b/resources/lang/nn_NO/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Alternativer for innsending', 'apply_rules_checkbox' => 'Bruk reglar', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Denne transaksjonen er allereie eit uttak', diff --git a/resources/lang/pl_PL/firefly.php b/resources/lang/pl_PL/firefly.php index 4a3c7e844f..269b73696c 100644 --- a/resources/lang/pl_PL/firefly.php +++ b/resources/lang/pl_PL/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opcje zapisu', 'apply_rules_checkbox' => 'Zastosuj reguły', 'fire_webhooks_checkbox' => 'Uruchom webhooki', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Ta transakcja jest już wypłatą', diff --git a/resources/lang/pt_BR/firefly.php b/resources/lang/pt_BR/firefly.php index ca8a35bc37..366592710f 100644 --- a/resources/lang/pt_BR/firefly.php +++ b/resources/lang/pt_BR/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opções de envio', 'apply_rules_checkbox' => 'Aplicar regras', 'fire_webhooks_checkbox' => 'Acionar webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Esta transação já é uma saída', diff --git a/resources/lang/pt_PT/firefly.php b/resources/lang/pt_PT/firefly.php index 82fd5dfa8e..81e1be5275 100644 --- a/resources/lang/pt_PT/firefly.php +++ b/resources/lang/pt_PT/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Opções de submissão', 'apply_rules_checkbox' => 'Aplicar regras', 'fire_webhooks_checkbox' => 'Ativar webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Esta transação já e um levantamento', diff --git a/resources/lang/ro_RO/firefly.php b/resources/lang/ro_RO/firefly.php index 81f2448389..f23abadb3c 100644 --- a/resources/lang/ro_RO/firefly.php +++ b/resources/lang/ro_RO/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Această tranzacție este deja o retragere', diff --git a/resources/lang/ru_RU/firefly.php b/resources/lang/ru_RU/firefly.php index 1b4132e942..f822eb35f9 100644 --- a/resources/lang/ru_RU/firefly.php +++ b/resources/lang/ru_RU/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Опции отправки', 'apply_rules_checkbox' => 'Применить правила', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Эта транзакция уже является расходом', diff --git a/resources/lang/sk_SK/firefly.php b/resources/lang/sk_SK/firefly.php index c0719f688b..8ce8b2c749 100644 --- a/resources/lang/sk_SK/firefly.php +++ b/resources/lang/sk_SK/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Tato transakcia už je výber', diff --git a/resources/lang/sl_SI/firefly.php b/resources/lang/sl_SI/firefly.php index abb18abe25..94b63abd52 100644 --- a/resources/lang/sl_SI/firefly.php +++ b/resources/lang/sl_SI/firefly.php @@ -1526,7 +1526,7 @@ return [ 'delete_attachment' => 'Izbriši prilogo ":name"', 'attachment_deleted' => 'Priloga ":name" izbrisana', 'liabilities_deleted' => 'Izbrisana odgovornost ":name"', - 'attachment_updated' => 'Priloga ":name" je posodobljenaj', + 'attachment_updated' => 'Priloga ":name" je posodobljena', 'upload_max_file_size' => 'Največja velikost datoteke: :size', 'list_all_attachments' => 'Seznam vseh prilog', @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Možnosti oddaje', 'apply_rules_checkbox' => 'Uporabite pravila', 'fire_webhooks_checkbox' => 'Sprožite Webhooke', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Ta transakcija je že odliv', diff --git a/resources/lang/sv_SE/firefly.php b/resources/lang/sv_SE/firefly.php index 9caae382df..20d28d18a9 100644 --- a/resources/lang/sv_SE/firefly.php +++ b/resources/lang/sv_SE/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Transaktionen är redan ett uttag', diff --git a/resources/lang/th_TH/firefly.php b/resources/lang/th_TH/firefly.php index d1262eb301..9f7754dee2 100644 --- a/resources/lang/th_TH/firefly.php +++ b/resources/lang/th_TH/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal', diff --git a/resources/lang/tr_TR/firefly.php b/resources/lang/tr_TR/firefly.php index 6d3a9c883e..4de85dcca6 100644 --- a/resources/lang/tr_TR/firefly.php +++ b/resources/lang/tr_TR/firefly.php @@ -1542,6 +1542,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Bu işlem zaten bir para çekme işlemidir', diff --git a/resources/lang/uk_UA/firefly.php b/resources/lang/uk_UA/firefly.php index 533a400cbc..ec874d9be6 100644 --- a/resources/lang/uk_UA/firefly.php +++ b/resources/lang/uk_UA/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Застосувати правила', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Ця транзакція вже є витратою', diff --git a/resources/lang/vi_VN/firefly.php b/resources/lang/vi_VN/firefly.php index 31ea0d0dcb..52bd7a8e2b 100644 --- a/resources/lang/vi_VN/firefly.php +++ b/resources/lang/vi_VN/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => 'Giao dịch này đã được rút tiền', diff --git a/resources/lang/zh_CN/firefly.php b/resources/lang/zh_CN/firefly.php index f5a06a7398..26e8dbdd32 100644 --- a/resources/lang/zh_CN/firefly.php +++ b/resources/lang/zh_CN/firefly.php @@ -1542,6 +1542,8 @@ return [ 'submission_options' => '提交选项', 'apply_rules_checkbox' => '应用规则', 'fire_webhooks_checkbox' => '触发 webhook', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => '此交易已经为支出', diff --git a/resources/lang/zh_TW/firefly.php b/resources/lang/zh_TW/firefly.php index 91d12b3c0c..4ad3cbc675 100644 --- a/resources/lang/zh_TW/firefly.php +++ b/resources/lang/zh_TW/firefly.php @@ -1541,6 +1541,8 @@ return [ 'submission_options' => 'Submission options', 'apply_rules_checkbox' => 'Apply rules', 'fire_webhooks_checkbox' => 'Fire webhooks', + 'select_source_account' => 'Please select or type a valid source account name', + 'select_dest_account' => 'Please select or type a valid destination account name', // convert stuff: 'convert_is_already_type_Withdrawal' => '此交易已是一筆提款',