diff --git a/config/firefly.php b/config/firefly.php index 8e72089804..1cce3cfab2 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -114,7 +114,7 @@ return [ 'handle_debts' => true, // see cer.php for exchange rates feature flag. ], - 'version' => '6.1.0', + 'version' => '6.1.0-alpha.1', 'api_version' => '2.0.12', 'db_version' => 22, diff --git a/package-lock.json b/package-lock.json index 7383bbe1b8..947ae4e8d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,8 +21,8 @@ "axios": "^1.6.1", "laravel-vite-plugin": "^0.8.1", "sass": "^1.69.4", - "vite": "^5.0.4", - "vite-plugin-manifest-sri": "^0.2.0" + "vite": "^4.5.1", + "vite-plugin-manifest-sri": "^0.1.0" } }, "node_modules/@babel/runtime": { @@ -37,9 +37,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.8.tgz", - "integrity": "sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", "cpu": [ "arm" ], @@ -53,9 +53,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz", - "integrity": "sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", "cpu": [ "arm64" ], @@ -69,9 +69,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.8.tgz", - "integrity": "sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", "cpu": [ "x64" ], @@ -85,9 +85,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz", - "integrity": "sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", "cpu": [ "arm64" ], @@ -101,9 +101,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz", - "integrity": "sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", "cpu": [ "x64" ], @@ -117,9 +117,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz", - "integrity": "sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", "cpu": [ "arm64" ], @@ -133,9 +133,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz", - "integrity": "sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", "cpu": [ "x64" ], @@ -149,9 +149,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz", - "integrity": "sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", "cpu": [ "arm" ], @@ -165,9 +165,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz", - "integrity": "sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", "cpu": [ "arm64" ], @@ -181,9 +181,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz", - "integrity": "sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", "cpu": [ "ia32" ], @@ -197,9 +197,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz", - "integrity": "sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", "cpu": [ "loong64" ], @@ -213,9 +213,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz", - "integrity": "sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", "cpu": [ "mips64el" ], @@ -229,9 +229,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz", - "integrity": "sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", "cpu": [ "ppc64" ], @@ -245,9 +245,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz", - "integrity": "sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", "cpu": [ "riscv64" ], @@ -261,9 +261,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz", - "integrity": "sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", "cpu": [ "s390x" ], @@ -277,9 +277,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz", - "integrity": "sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", "cpu": [ "x64" ], @@ -293,9 +293,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz", - "integrity": "sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", "cpu": [ "x64" ], @@ -309,9 +309,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz", - "integrity": "sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", "cpu": [ "x64" ], @@ -325,9 +325,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz", - "integrity": "sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", "cpu": [ "x64" ], @@ -341,9 +341,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz", - "integrity": "sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", "cpu": [ "arm64" ], @@ -357,9 +357,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz", - "integrity": "sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", "cpu": [ "ia32" ], @@ -373,9 +373,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz", - "integrity": "sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "cpu": [ "x64" ], @@ -411,162 +411,6 @@ "url": "https://opencollective.com/popperjs" } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.6.1.tgz", - "integrity": "sha512-0WQ0ouLejaUCRsL93GD4uft3rOmB8qoQMU05Kb8CmMtMBe7XUDLAltxVZI1q6byNqEtU7N1ZX1Vw5lIpgulLQA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.6.1.tgz", - "integrity": "sha512-1TKm25Rn20vr5aTGGZqo6E4mzPicCUD79k17EgTLAsXc1zysyi4xXKACfUbwyANEPAEIxkzwue6JZ+stYzWUTA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.6.1.tgz", - "integrity": "sha512-cEXJQY/ZqMACb+nxzDeX9IPLAg7S94xouJJCNVE5BJM8JUEP4HeTF+ti3cmxWeSJo+5D+o8Tc0UAWUkfENdeyw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.6.1.tgz", - "integrity": "sha512-LoSU9Xu56isrkV2jLldcKspJ7sSXmZWkAxg7sW/RfF7GS4F5/v4EiqKSMCFbZtDu2Nc1gxxFdQdKwkKS4rwxNg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.6.1.tgz", - "integrity": "sha512-EfI3hzYAy5vFNDqpXsNxXcgRDcFHUWSx5nnRSCKwXuQlI5J9dD84g2Usw81n3FLBNsGCegKGwwTVsSKK9cooSQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.6.1.tgz", - "integrity": "sha512-9lhc4UZstsegbNLhH0Zu6TqvDfmhGzuCWtcTFXY10VjLLUe4Mr0Ye2L3rrtHaDd/J5+tFMEuo5LTCSCMXWfUKw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.6.1.tgz", - "integrity": "sha512-FfoOK1yP5ksX3wwZ4Zk1NgyGHZyuRhf99j64I5oEmirV8EFT7+OhUZEnP+x17lcP/QHJNWGsoJwrz4PJ9fBEXw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.6.1.tgz", - "integrity": "sha512-DNGZvZDO5YF7jN5fX8ZqmGLjZEXIJRdJEdTFMhiyXqyXubBa0WVLDWSNlQ5JR2PNgDbEV1VQowhVRUh+74D+RA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.6.1.tgz", - "integrity": "sha512-RkJVNVRM+piYy87HrKmhbexCHg3A6Z6MU0W9GHnJwBQNBeyhCJG9KDce4SAMdicQnpURggSvtbGo9xAWOfSvIQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.6.1.tgz", - "integrity": "sha512-v2FVT6xfnnmTe3W9bJXl6r5KwJglMK/iRlkKiIFfO6ysKs0rDgz7Cwwf3tjldxQUrHL9INT/1r4VA0n9L/F1vQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.6.1.tgz", - "integrity": "sha512-YEeOjxRyEjqcWphH9dyLbzgkF8wZSKAKUkldRY6dgNR5oKs2LZazqGB41cWJ4Iqqcy9/zqYgmzBkRoVz3Q9MLw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.6.1.tgz", - "integrity": "sha512-0zfTlFAIhgz8V2G8STq8toAjsYYA6eci1hnXuyOTUFnymrtJwnS6uGKiv3v5UrPZkBlamLvrLV2iiaeqCKzb0A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@vue/reactivity": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz", @@ -671,9 +515,9 @@ } }, "node_modules/chart.js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.0.tgz", - "integrity": "sha512-vQEj6d+z0dcsKLlQvbKIMYFHd3t8W/7L2vfJIbYcfyPcRx92CsHqECpueN8qVGNlKyDcr5wBrYAYKnfu/9Q1hQ==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz", + "integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==", "dependencies": { "@kurkle/color": "^0.3.0" }, @@ -762,9 +606,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.8", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.8.tgz", - "integrity": "sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w==", + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "hasInstallScript": true, "bin": { @@ -774,28 +618,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.8", - "@esbuild/android-arm64": "0.19.8", - "@esbuild/android-x64": "0.19.8", - "@esbuild/darwin-arm64": "0.19.8", - "@esbuild/darwin-x64": "0.19.8", - "@esbuild/freebsd-arm64": "0.19.8", - "@esbuild/freebsd-x64": "0.19.8", - "@esbuild/linux-arm": "0.19.8", - "@esbuild/linux-arm64": "0.19.8", - "@esbuild/linux-ia32": "0.19.8", - "@esbuild/linux-loong64": "0.19.8", - "@esbuild/linux-mips64el": "0.19.8", - "@esbuild/linux-ppc64": "0.19.8", - "@esbuild/linux-riscv64": "0.19.8", - "@esbuild/linux-s390x": "0.19.8", - "@esbuild/linux-x64": "0.19.8", - "@esbuild/netbsd-x64": "0.19.8", - "@esbuild/openbsd-x64": "0.19.8", - "@esbuild/sunos-x64": "0.19.8", - "@esbuild/win32-arm64": "0.19.8", - "@esbuild/win32-ia32": "0.19.8", - "@esbuild/win32-x64": "0.19.8" + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, "node_modules/fill-range": { @@ -1072,30 +916,18 @@ "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" }, "node_modules/rollup": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.6.1.tgz", - "integrity": "sha512-jZHaZotEHQaHLgKr8JnQiDT1rmatjgKlMekyksz+yk9jt/8z9quNjnKNRoaM0wd9DC2QKXjmWWuDYtM3jfF8pQ==", + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=18.0.0", + "node": ">=14.18.0", "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.6.1", - "@rollup/rollup-android-arm64": "4.6.1", - "@rollup/rollup-darwin-arm64": "4.6.1", - "@rollup/rollup-darwin-x64": "4.6.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.6.1", - "@rollup/rollup-linux-arm64-gnu": "4.6.1", - "@rollup/rollup-linux-arm64-musl": "4.6.1", - "@rollup/rollup-linux-x64-gnu": "4.6.1", - "@rollup/rollup-linux-x64-musl": "4.6.1", - "@rollup/rollup-win32-arm64-msvc": "4.6.1", - "@rollup/rollup-win32-ia32-msvc": "4.6.1", - "@rollup/rollup-win32-x64-msvc": "4.6.1", "fsevents": "~2.3.2" } }, @@ -1146,29 +978,29 @@ } }, "node_modules/vite": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz", - "integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz", + "integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==", "dev": true, "dependencies": { - "esbuild": "^0.19.3", - "postcss": "^8.4.31", - "rollup": "^4.2.0" + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^14.18.0 || >=16.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { - "fsevents": "~2.3.3" + "fsevents": "~2.3.2" }, "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", + "@types/node": ">= 14", "less": "*", "lightningcss": "^1.21.0", "sass": "*", @@ -1211,9 +1043,9 @@ } }, "node_modules/vite-plugin-manifest-sri": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/vite-plugin-manifest-sri/-/vite-plugin-manifest-sri-0.2.0.tgz", - "integrity": "sha512-Zt5jt19xTIJ91LOuQTCtNG7rTFc5OziAjBz2H5NdCGqaOD1nxrWExLhcKW+W4/q8/jOPCg/n5ncYEQmqCxiGQQ==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vite-plugin-manifest-sri/-/vite-plugin-manifest-sri-0.1.0.tgz", + "integrity": "sha512-m4gcEXwcA1MfCVYTLVHYsB03Xsc6L4VYfhxXmcYcS+rN3kTjuWkXMaA8OuOV1gFdi1bMJFkLTJCPciYApvCm/g==", "dev": true } } diff --git a/package.json b/package.json index c60b5ca1f3..5a098f9429 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "axios": "^1.6.1", "laravel-vite-plugin": "^0.8.1", "sass": "^1.69.4", - "vite": "^5.0.4", - "vite-plugin-manifest-sri": "^0.2.0" + "vite": "^4.5.1", + "vite-plugin-manifest-sri": "^0.1.0" }, "dependencies": { "@fortawesome/fontawesome-free": "^6.4.0", diff --git a/public/build/assets/dashboard-bbfa9fdd.js b/public/build/assets/dashboard-bfc72cdb.js similarity index 57% rename from public/build/assets/dashboard-bbfa9fdd.js rename to public/build/assets/dashboard-bfc72cdb.js index 3dea9b9105..a3b0bbe79b 100644 --- a/public/build/assets/dashboard-bbfa9fdd.js +++ b/public/build/assets/dashboard-bfc72cdb.js @@ -1,30 +1,30 @@ -var Sa=Object.defineProperty;var Oa=(n,t,e)=>t in n?Sa(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var k=(n,t,e)=>(Oa(n,typeof t!="symbol"?t+"":t,e),e);import{r as z,a as ai,t as wt,s as Yi,g as ji,b as ls,c as mr,d as j,e as br,f as yr,_ as an,h as Aa,i as Ui,j as _r,k as La,l as Ra,m as xr,n as Fa,o as Os,p as Ia,q as As,u as Ea,v as za,w as vt,x as J,y as V,z as bt,P as Ba,I as li,A as ci,B as Na,C as Wa,D as Ha,E as Va,F as Ls,G as Ya,H as ja,J as Ua}from"./load-translations-85b093de.js";var $a=36e5;function qa(n,t){z(2,arguments);var e=wt(t);return ai(n,e*$a)}var Xa=864e5;function Ka(n,t){z(2,arguments);var e=Yi(n),i=Yi(t),s=e.getTime()-ji(e),o=i.getTime()-ji(i);return Math.round((s-o)/Xa)}var Ga=6e4;function Qa(n,t){z(2,arguments);var e=wt(t);return ai(n,e*Ga)}function Za(n,t){z(2,arguments);var e=wt(t),i=e*3;return ls(n,i)}function Ja(n,t){z(2,arguments);var e=wt(t);return ai(n,e*1e3)}function tl(n,t){z(2,arguments);var e=wt(t),i=e*7;return mr(n,i)}function el(n,t){z(2,arguments);var e=wt(t);return ls(n,e*12)}function tn(n,t){z(2,arguments);var e=j(n),i=j(t),s=e.getTime()-i.getTime();return s<0?-1:s>0?1:s}var ui=6e4,hi=36e5,nl=1e3;function il(n,t){z(2,arguments);var e=j(n),i=j(t),s=e.getFullYear()-i.getFullYear(),o=e.getMonth()-i.getMonth();return s*12+o}function sl(n,t){z(2,arguments);var e=j(n),i=j(t);return e.getFullYear()-i.getFullYear()}function Rs(n,t){var e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function vr(n,t){z(2,arguments);var e=j(n),i=j(t),s=Rs(e,i),o=Math.abs(Ka(e,i));e.setDate(e.getDate()-s*o);var r=+(Rs(e,i)===-s),a=s*(o-r);return a===0?0:a}function di(n,t){return z(2,arguments),j(n).getTime()-j(t).getTime()}var Fs={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},ol="trunc";function bn(n){return n?Fs[n]:Fs[ol]}function rl(n,t,e){z(2,arguments);var i=di(n,t)/hi;return bn(e==null?void 0:e.roundingMethod)(i)}function al(n,t,e){z(2,arguments);var i=di(n,t)/ui;return bn(e==null?void 0:e.roundingMethod)(i)}function ll(n){z(1,arguments);var t=j(n);return br(t).getTime()===yr(t).getTime()}function wr(n,t){z(2,arguments);var e=j(n),i=j(t),s=tn(e,i),o=Math.abs(il(e,i)),r;if(o<1)r=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*o);var a=tn(e,i)===-s;ll(j(n))&&o===1&&tn(n,i)===1&&(a=!1),r=s*(o-Number(a))}return r===0?0:r}function cl(n,t,e){z(2,arguments);var i=wr(n,t)/3;return bn(e==null?void 0:e.roundingMethod)(i)}function ul(n,t,e){z(2,arguments);var i=di(n,t)/1e3;return bn(e==null?void 0:e.roundingMethod)(i)}function hl(n,t,e){z(2,arguments);var i=vr(n,t)/7;return bn(e==null?void 0:e.roundingMethod)(i)}function dl(n,t){z(2,arguments);var e=j(n),i=j(t),s=tn(e,i),o=Math.abs(sl(e,i));e.setFullYear(1584),i.setFullYear(1584);var r=tn(e,i)===-s,a=s*(o-Number(r));return a===0?0:a}function fl(n){z(1,arguments);var t=j(n);return t.setSeconds(0,0),t}function gl(n){z(1,arguments);var t=j(n),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function pl(n){z(1,arguments);var t=j(n);return t.setMinutes(59,59,999),t}function ml(n){z(1,arguments);var t=j(n);return t.setSeconds(59,999),t}function bl(n){z(1,arguments);var t=j(n);return t.setMilliseconds(999),t}function yl(n,t){if(n==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}function Is(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,i=new Array(t);e=n.length?{done:!0}:{done:!1,value:n[i++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,r=!1,a;return{s:function(){e=e.call(n)},n:function(){var c=e.next();return o=c.done,c},e:function(c){r=!0,a=c},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(r)throw a}}}}function D(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function $i(n,t){return $i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,s){return i.__proto__=s,i},$i(n,t)}function B(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&$i(n,t)}function Gn(n){return Gn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gn(n)}function xl(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vl(n,t){if(t&&(an(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return D(n)}function N(n){var t=xl();return function(){var i=Gn(n),s;if(t){var o=Gn(this).constructor;s=Reflect.construct(i,arguments,o)}else s=i.apply(this,arguments);return vl(this,s)}}function I(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function wl(n,t){if(an(n)!=="object"||n===null)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(an(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function Mr(n){var t=wl(n,"string");return an(t)==="symbol"?t:String(t)}function zs(n,t){for(var e=0;e0,i=e?t:1-t,s;if(i<=50)s=n||100;else{var o=i+50,r=Math.floor(o/100)*100,a=n>=o%100;s=n+r-(a?100:0)}return e?s:1-s}function Dr(n){return n%400===0||n%4===0&&n%100!==0}var Dl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r0}},{key:"set",value:function(s,o,r){var a=s.getUTCFullYear();if(r.isTwoDigitYear){var l=Pr(r.year,a);return s.setUTCFullYear(l,0,1),s.setUTCHours(0,0,0,0),s}var c=!("era"in o)||o.era===1?r.year:1-r.year;return s.setUTCFullYear(c,0,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Tl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r0}},{key:"set",value:function(s,o,r,a){var l=Aa(s,a);if(r.isTwoDigitYear){var c=Pr(r.year,l);return s.setUTCFullYear(c,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Ui(s,a)}var u=!("era"in o)||o.era===1?r.year:1-r.year;return s.setUTCFullYear(u,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Ui(s,a)}}]),e}(Y),Sl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=4}},{key:"set",value:function(s,o,r){return s.setUTCMonth((r-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Ll=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=4}},{key:"set",value:function(s,o,r){return s.setUTCMonth((r-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Rl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){return s.setUTCMonth(r,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Fl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){return s.setUTCMonth(r,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function Il(n,t,e){z(2,arguments);var i=j(n),s=wt(t),o=La(i,e)-s;return i.setUTCDate(i.getUTCDate()-o*7),i}var El=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=53}},{key:"set",value:function(s,o,r,a){return Ui(Il(s,r,a),a)}}]),e}(Y);function zl(n,t){z(2,arguments);var e=j(n),i=wt(t),s=Ra(e)-i;return e.setUTCDate(e.getUTCDate()-s*7),e}var Bl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=53}},{key:"set",value:function(s,o,r){return _r(zl(s,r))}}]),e}(Y),Nl=[31,28,31,30,31,30,31,31,30,31,30,31],Wl=[31,29,31,30,31,30,31,31,30,31,30,31],Hl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=Wl[l]:o>=1&&o<=Nl[l]}},{key:"set",value:function(s,o,r){return s.setUTCDate(r),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Vl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=366:o>=1&&o<=365}},{key:"set",value:function(s,o,r){return s.setUTCMonth(0,r),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function us(n,t,e){var i,s,o,r,a,l,c,u;z(2,arguments);var h=xr(),d=wt((i=(s=(o=(r=e==null?void 0:e.weekStartsOn)!==null&&r!==void 0?r:e==null||(a=e.locale)===null||a===void 0||(l=a.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&o!==void 0?o:h.weekStartsOn)!==null&&s!==void 0?s:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&i!==void 0?i:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=j(n),g=wt(t),p=f.getUTCDay(),m=g%7,b=(m+7)%7,y=(b=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y),jl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Ul=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function $l(n,t){z(2,arguments);var e=wt(t);e%7===0&&(e=e-7);var i=1,s=j(n),o=s.getUTCDay(),r=e%7,a=(r+7)%7,l=(a=1&&o<=7}},{key:"set",value:function(s,o,r){return s=$l(s,r),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Xl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=12}},{key:"set",value:function(s,o,r){var a=s.getUTCHours()>=12;return a&&r<12?s.setUTCHours(r+12,0,0,0):!a&&r===12?s.setUTCHours(0,0,0,0):s.setUTCHours(r,0,0,0),s}}]),e}(Y),Zl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=23}},{key:"set",value:function(s,o,r){return s.setUTCHours(r,0,0,0),s}}]),e}(Y),Jl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){var a=s.getUTCHours()>=12;return a&&r<12?s.setUTCHours(r+12,0,0,0):s.setUTCHours(r,0,0,0),s}}]),e}(Y),tc=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=24}},{key:"set",value:function(s,o,r){var a=r<=24?r%24:r;return s.setUTCHours(a,0,0,0),s}}]),e}(Y),ec=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=59}},{key:"set",value:function(s,o,r){return s.setUTCMinutes(r,0,0),s}}]),e}(Y),nc=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=59}},{key:"set",value:function(s,o,r){return s.setUTCSeconds(r,0),s}}]),e}(Y),ic=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=wt((g=(p=(m=(b=i==null?void 0:i.weekStartsOn)!==null&&b!==void 0?b:i==null||(y=i.locale)===null||y===void 0||(x=y.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&m!==void 0?m:M.weekStartsOn)!==null&&p!==void 0?p:(v=M.locale)===null||v===void 0||(_=v.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&g!==void 0?g:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(C==="")return w===""?j(e):new Date(NaN);var R={firstWeekContainsDate:A,weekStartsOn:O,locale:T},st=[new Cl],gt=C.match(uc).map(function(ct){var q=ct[0];if(q in Os){var St=Os[q];return St(ct,T.formatLong)}return ct}).join("").match(cc),W=[],U=Es(gt),Q;try{var Mt=function(){var q=Q.value;!(i!=null&&i.useAdditionalWeekYearTokens)&&Ia(q)&&As(q,C,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&Ea(q)&&As(q,C,n);var St=q[0],wn=lc[St];if(wn){var Ds=wn.incompatibleTokens;if(Array.isArray(Ds)){var Ts=W.find(function(Ss){return Ds.includes(Ss.token)||Ss.token===St});if(Ts)throw new RangeError("The format string mustn't contain `".concat(Ts.fullToken,"` and `").concat(q,"` at the same time"))}else if(wn.incompatibleTokens==="*"&&W.length>0)throw new RangeError("The format string mustn't contain `".concat(q,"` and any other token at the same time"));W.push({token:St,fullToken:q});var xi=wn.run(w,q,T.match,R);if(!xi)return{v:new Date(NaN)};st.push(xi.setter),w=xi.rest}else{if(St.match(gc))throw new RangeError("Format string contains an unescaped latin alphabet character `"+St+"`");if(q==="''"?q="'":St==="'"&&(q=mc(q)),w.indexOf(q)===0)w=w.slice(q.length);else return{v:new Date(NaN)}}};for(U.s();!(Q=U.n()).done;){var lt=Mt();if(an(lt)==="object")return lt.v}}catch(ct){U.e(ct)}finally{U.f()}if(w.length>0&&fc.test(w))return new Date(NaN);var Kt=st.map(function(ct){return ct.priority}).sort(function(ct,q){return q-ct}).filter(function(ct,q,St){return St.indexOf(ct)===q}).map(function(ct){return st.filter(function(q){return q.priority===ct}).sort(function(q,St){return St.subPriority-q.subPriority})}).map(function(ct){return ct[0]}),Gt=j(e);if(isNaN(Gt.getTime()))return new Date(NaN);var Tt=za(Gt,ji(Gt)),Qt={},Rt=Es(Kt),Zt;try{for(Rt.s();!(Zt=Rt.n()).done;){var Jt=Zt.value;if(!Jt.validate(Tt,R))return new Date(NaN);var vn=Jt.set(Tt,Qt,R);Array.isArray(vn)?(Tt=vn[0],yl(Qt,vn[1])):Tt=vn}}catch(ct){Rt.e(ct)}finally{Rt.f()}return Tt}function mc(n){return n.match(hc)[1].replace(dc,"'")}function bc(n){z(1,arguments);var t=j(n);return t.setMinutes(0,0,0),t}function yc(n){z(1,arguments);var t=j(n);return t.setMilliseconds(0),t}function _c(n,t){var e;z(1,arguments);var i=wt((e=t==null?void 0:t.additionalDigits)!==null&&e!==void 0?e:2);if(i!==2&&i!==1&&i!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof n=="string"||Object.prototype.toString.call(n)==="[object String]"))return new Date(NaN);var s=Mc(n),o;if(s.date){var r=kc(s.date,i);o=Cc(r.restDateString,r.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var a=o.getTime(),l=0,c;if(s.time&&(l=Pc(s.time),isNaN(l)))return new Date(NaN);if(s.timezone){if(c=Dc(s.timezone),isNaN(c))return new Date(NaN)}else{var u=new Date(a+l),h=new Date(0);return h.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),h.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),h}return new Date(a+l+c)}var Mn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},xc=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vc=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,wc=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Mc(n){var t={},e=n.split(Mn.dateTimeDelimiter),i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Mn.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Mn.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){var s=Mn.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function kc(n,t){var e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};var s=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:o===null?s:o*100,restDateString:n.slice((i[1]||i[2]).length)}}function Cc(n,t){if(t===null)return new Date(NaN);var e=n.match(xc);if(!e)return new Date(NaN);var i=!!e[4],s=Be(e[1]),o=Be(e[2])-1,r=Be(e[3]),a=Be(e[4]),l=Be(e[5])-1;if(i)return Lc(t,a,l)?Tc(t,a,l):new Date(NaN);var c=new Date(0);return!Oc(t,o,r)||!Ac(t,s)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(s,r)),c)}function Be(n){return n?parseInt(n):1}function Pc(n){var t=n.match(vc);if(!t)return NaN;var e=vi(t[1]),i=vi(t[2]),s=vi(t[3]);return Rc(e,i,s)?e*hi+i*ui+s*1e3:NaN}function vi(n){return n&&parseFloat(n.replace(",","."))||0}function Dc(n){if(n==="Z")return 0;var t=n.match(wc);if(!t)return 0;var e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Fc(i,s)?e*(i*hi+s*ui):NaN}function Tc(n,t,e){var i=new Date(0);i.setUTCFullYear(n,0,4);var s=i.getUTCDay()||7,o=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+o),i}var Sc=[31,null,31,30,31,30,31,31,30,31,30,31];function Tr(n){return n%400===0||n%4===0&&n%100!==0}function Oc(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(Sc[t]||(Tr(n)?29:28))}function Ac(n,t){return t>=1&&t<=(Tr(n)?366:365)}function Lc(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function Rc(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function Fc(n,t){return t>=0&&t<=59}class Ic{get(t,e,i){return vt.get("/api/v2/summary/basic",{params:{start:t,end:e,code:i}})}}function Nt(n,t,e){const i=J(t,"y-MM-dd")+"_"+J(e,"y-MM-dd")+"_"+n;return console.log("getCacheKey: "+i),String(i)}let wi=!1;const Ec=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt("dashboard-boxes-data",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){this.boxData=s,this.generateOptions(this.boxData);return}new Ic().get(J(n,"yyyy-MM-dd"),J(t,"yyyy-MM-dd"),null).then(r=>{this.boxData=r.data,window.store.set(e,r.data),this.generateOptions(this.boxData)})},generateOptions(n){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let t={};for(const e in n)if(n.hasOwnProperty(e)){const i=n[e];if(!i.hasOwnProperty("key"))continue;let s=i.key;if(this.autoConversion){if(s.startsWith("balance-in-native")){this.balanceBox.amounts.push(V(i.value,i.currency_code)),t.hasOwnProperty(i.currency_code)||(t[i.currency_code]="");continue}if(s.startsWith("spent-in-native")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=t[i.currency_code]+V(i.value,i.currency_code);continue}if(s.startsWith("earned-in-native")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=V(i.value,i.currency_code)+" + "+t[i.currency_code];continue}if(s.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(V(i.value,i.currency_code));continue}if(s.startsWith("bills-paid-in-native")){this.billBox.paid.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-to-spend-in-native")){this.leftBox.left.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(V(i.value,i.currency_code));continue}if(s.startsWith("net-worth-in-native")){this.netBox.net.push(V(i.value,i.currency_code));continue}}if(!this.autoConversion&&!s.endsWith("native")){if(s.startsWith("balance-in-")){this.balanceBox.amounts.push(V(i.value,i.currency_code));continue}if(s.startsWith("spent-in-")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=t[i.currency_code]+V(i.value,i.currency_code);continue}if(s.startsWith("earned-in-")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=V(i.value,i.currency_code)+" + "+t[i.currency_code];continue}if(s.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(V(i.value,i.currency_code));continue}if(s.startsWith("bills-paid-in-")){this.billBox.paid.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-to-spend-in-")){this.leftBox.left.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(V(i.value,i.currency_code));continue}s.startsWith("net-worth-in-")&&this.netBox.net.push(V(i.value,i.currency_code))}}for(let e in t)t.hasOwnProperty(e)&&this.balanceBox.subtitles.push(t[e]);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([bt("viewRange"),bt("autoConversion",!1)]).then(n=>{wi=!0,this.autoConversion=n[1],this.loadBoxes()}),window.store.observe("end",()=>{wi&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",n=>{wi&&(this.autoConversion=n,this.loadBoxes())})}});class zc{put(t,e){let i="/api/v1/preferences/"+t;return vt.put(i,{data:e})}}function Bc(n,t=null){window.store.set(n,t),new zc().put(n,t).then(i=>{}).catch(()=>{new Ba().post(n,t).then(s=>{})})}let Nc=class{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/account/dashboard",{params:{start:i,end:s}})}expense(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/account/expense-dashboard",{params:{start:i,end:s}})}},Bs=class{get(t,e){let i={date:J(e,"y-MM-dd").slice(0,10)};return e?vt.get("/api/v2/accounts/"+t,{params:i}):vt.get("/api/v2/accounts/"+t)}transactions(t,e){const i={page:e.page??1};return e.hasOwnProperty("start")&&(i.start=J(e.start,"y-MM-dd")),e.hasOwnProperty("end")&&(i.end=J(e.end,"y-MM-dd")),vt.get("/api/v2/accounts/"+t+"/transactions",{params:i})}};/*! +var Sa=Object.defineProperty;var Oa=(n,t,e)=>t in n?Sa(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var k=(n,t,e)=>(Oa(n,typeof t!="symbol"?t+"":t,e),e);import{r as z,a as ai,t as wt,s as Yi,g as ji,b as ls,c as br,d as j,e as yr,f as _r,_ as an,h as Aa,i as Ui,j as xr,k as La,l as Ra,m as vr,n as Fa,o as As,p as Ia,q as Ls,u as Ea,v as za,w as vt,x as J,y as V,z as bt,P as Ba,I as li,A as ci,B as Na,C as Wa,D as Ha,E as Va,F as Rs,G as Ya,H as ja,J as Ua}from"./load-translations-85b093de.js";var $a=36e5;function qa(n,t){z(2,arguments);var e=wt(t);return ai(n,e*$a)}var Xa=864e5;function Ka(n,t){z(2,arguments);var e=Yi(n),i=Yi(t),s=e.getTime()-ji(e),o=i.getTime()-ji(i);return Math.round((s-o)/Xa)}var Ga=6e4;function Qa(n,t){z(2,arguments);var e=wt(t);return ai(n,e*Ga)}function Za(n,t){z(2,arguments);var e=wt(t),i=e*3;return ls(n,i)}function Ja(n,t){z(2,arguments);var e=wt(t);return ai(n,e*1e3)}function tl(n,t){z(2,arguments);var e=wt(t),i=e*7;return br(n,i)}function el(n,t){z(2,arguments);var e=wt(t);return ls(n,e*12)}function tn(n,t){z(2,arguments);var e=j(n),i=j(t),s=e.getTime()-i.getTime();return s<0?-1:s>0?1:s}var ui=6e4,hi=36e5,nl=1e3;function il(n,t){z(2,arguments);var e=j(n),i=j(t),s=e.getFullYear()-i.getFullYear(),o=e.getMonth()-i.getMonth();return s*12+o}function sl(n,t){z(2,arguments);var e=j(n),i=j(t);return e.getFullYear()-i.getFullYear()}function Fs(n,t){var e=n.getFullYear()-t.getFullYear()||n.getMonth()-t.getMonth()||n.getDate()-t.getDate()||n.getHours()-t.getHours()||n.getMinutes()-t.getMinutes()||n.getSeconds()-t.getSeconds()||n.getMilliseconds()-t.getMilliseconds();return e<0?-1:e>0?1:e}function wr(n,t){z(2,arguments);var e=j(n),i=j(t),s=Fs(e,i),o=Math.abs(Ka(e,i));e.setDate(e.getDate()-s*o);var r=+(Fs(e,i)===-s),a=s*(o-r);return a===0?0:a}function di(n,t){return z(2,arguments),j(n).getTime()-j(t).getTime()}var Is={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},ol="trunc";function bn(n){return n?Is[n]:Is[ol]}function rl(n,t,e){z(2,arguments);var i=di(n,t)/hi;return bn(e==null?void 0:e.roundingMethod)(i)}function al(n,t,e){z(2,arguments);var i=di(n,t)/ui;return bn(e==null?void 0:e.roundingMethod)(i)}function ll(n){z(1,arguments);var t=j(n);return yr(t).getTime()===_r(t).getTime()}function Mr(n,t){z(2,arguments);var e=j(n),i=j(t),s=tn(e,i),o=Math.abs(il(e,i)),r;if(o<1)r=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*o);var a=tn(e,i)===-s;ll(j(n))&&o===1&&tn(n,i)===1&&(a=!1),r=s*(o-Number(a))}return r===0?0:r}function cl(n,t,e){z(2,arguments);var i=Mr(n,t)/3;return bn(e==null?void 0:e.roundingMethod)(i)}function ul(n,t,e){z(2,arguments);var i=di(n,t)/1e3;return bn(e==null?void 0:e.roundingMethod)(i)}function hl(n,t,e){z(2,arguments);var i=wr(n,t)/7;return bn(e==null?void 0:e.roundingMethod)(i)}function dl(n,t){z(2,arguments);var e=j(n),i=j(t),s=tn(e,i),o=Math.abs(sl(e,i));e.setFullYear(1584),i.setFullYear(1584);var r=tn(e,i)===-s,a=s*(o-Number(r));return a===0?0:a}function fl(n){z(1,arguments);var t=j(n);return t.setSeconds(0,0),t}function gl(n){z(1,arguments);var t=j(n),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function pl(n){z(1,arguments);var t=j(n);return t.setMinutes(59,59,999),t}function ml(n){z(1,arguments);var t=j(n);return t.setSeconds(59,999),t}function bl(n){z(1,arguments);var t=j(n);return t.setMilliseconds(999),t}function yl(n,t){if(n==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}function Es(n,t){(t==null||t>n.length)&&(t=n.length);for(var e=0,i=new Array(t);e=n.length?{done:!0}:{done:!1,value:n[i++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,r=!1,a;return{s:function(){e=e.call(n)},n:function(){var c=e.next();return o=c.done,c},e:function(c){r=!0,a=c},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(r)throw a}}}}function D(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function $i(n,t){return $i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,s){return i.__proto__=s,i},$i(n,t)}function B(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&$i(n,t)}function Gn(n){return Gn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gn(n)}function xl(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vl(n,t){if(t&&(an(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return D(n)}function N(n){var t=xl();return function(){var i=Gn(n),s;if(t){var o=Gn(this).constructor;s=Reflect.construct(i,arguments,o)}else s=i.apply(this,arguments);return vl(this,s)}}function I(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function wl(n,t){if(an(n)!=="object"||n===null)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t||"default");if(an(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function kr(n){var t=wl(n,"string");return an(t)==="symbol"?t:String(t)}function Bs(n,t){for(var e=0;e0,i=e?t:1-t,s;if(i<=50)s=n||100;else{var o=i+50,r=Math.floor(o/100)*100,a=n>=o%100;s=n+r-(a?100:0)}return e?s:1-s}function Tr(n){return n%400===0||n%4===0&&n%100!==0}var Dl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r0}},{key:"set",value:function(s,o,r){var a=s.getUTCFullYear();if(r.isTwoDigitYear){var l=Dr(r.year,a);return s.setUTCFullYear(l,0,1),s.setUTCHours(0,0,0,0),s}var c=!("era"in o)||o.era===1?r.year:1-r.year;return s.setUTCFullYear(c,0,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Tl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r0}},{key:"set",value:function(s,o,r,a){var l=Aa(s,a);if(r.isTwoDigitYear){var c=Dr(r.year,l);return s.setUTCFullYear(c,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Ui(s,a)}var u=!("era"in o)||o.era===1?r.year:1-r.year;return s.setUTCFullYear(u,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Ui(s,a)}}]),e}(Y),Sl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=4}},{key:"set",value:function(s,o,r){return s.setUTCMonth((r-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Ll=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=4}},{key:"set",value:function(s,o,r){return s.setUTCMonth((r-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Rl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){return s.setUTCMonth(r,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Fl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){return s.setUTCMonth(r,1),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function Il(n,t,e){z(2,arguments);var i=j(n),s=wt(t),o=La(i,e)-s;return i.setUTCDate(i.getUTCDate()-o*7),i}var El=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=53}},{key:"set",value:function(s,o,r,a){return Ui(Il(s,r,a),a)}}]),e}(Y);function zl(n,t){z(2,arguments);var e=j(n),i=wt(t),s=Ra(e)-i;return e.setUTCDate(e.getUTCDate()-s*7),e}var Bl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=53}},{key:"set",value:function(s,o,r){return xr(zl(s,r))}}]),e}(Y),Nl=[31,28,31,30,31,30,31,31,30,31,30,31],Wl=[31,29,31,30,31,30,31,31,30,31,30,31],Hl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=Wl[l]:o>=1&&o<=Nl[l]}},{key:"set",value:function(s,o,r){return s.setUTCDate(r),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Vl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=366:o>=1&&o<=365}},{key:"set",value:function(s,o,r){return s.setUTCMonth(0,r),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function us(n,t,e){var i,s,o,r,a,l,c,u;z(2,arguments);var h=vr(),d=wt((i=(s=(o=(r=e==null?void 0:e.weekStartsOn)!==null&&r!==void 0?r:e==null||(a=e.locale)===null||a===void 0||(l=a.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&o!==void 0?o:h.weekStartsOn)!==null&&s!==void 0?s:(c=h.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&i!==void 0?i:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=j(n),g=wt(t),p=f.getUTCDay(),m=g%7,b=(m+7)%7,y=(b=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y),jl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Ul=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=6}},{key:"set",value:function(s,o,r,a){return s=us(s,r,a),s.setUTCHours(0,0,0,0),s}}]),e}(Y);function $l(n,t){z(2,arguments);var e=wt(t);e%7===0&&(e=e-7);var i=1,s=j(n),o=s.getUTCDay(),r=e%7,a=(r+7)%7,l=(a=1&&o<=7}},{key:"set",value:function(s,o,r){return s=$l(s,r),s.setUTCHours(0,0,0,0),s}}]),e}(Y),Xl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=12}},{key:"set",value:function(s,o,r){var a=s.getUTCHours()>=12;return a&&r<12?s.setUTCHours(r+12,0,0,0):!a&&r===12?s.setUTCHours(0,0,0,0):s.setUTCHours(r,0,0,0),s}}]),e}(Y),Zl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=23}},{key:"set",value:function(s,o,r){return s.setUTCHours(r,0,0,0),s}}]),e}(Y),Jl=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=11}},{key:"set",value:function(s,o,r){var a=s.getUTCHours()>=12;return a&&r<12?s.setUTCHours(r+12,0,0,0):s.setUTCHours(r,0,0,0),s}}]),e}(Y),tc=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&o<=24}},{key:"set",value:function(s,o,r){var a=r<=24?r%24:r;return s.setUTCHours(a,0,0,0),s}}]),e}(Y),ec=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=59}},{key:"set",value:function(s,o,r){return s.setUTCMinutes(r,0,0),s}}]),e}(Y),nc=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=0&&o<=59}},{key:"set",value:function(s,o,r){return s.setUTCSeconds(r,0),s}}]),e}(Y),ic=function(n){B(e,n);var t=N(e);function e(){var i;I(this,e);for(var s=arguments.length,o=new Array(s),r=0;r=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var O=wt((g=(p=(m=(b=i==null?void 0:i.weekStartsOn)!==null&&b!==void 0?b:i==null||(y=i.locale)===null||y===void 0||(x=y.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&m!==void 0?m:M.weekStartsOn)!==null&&p!==void 0?p:(v=M.locale)===null||v===void 0||(_=v.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&g!==void 0?g:0);if(!(O>=0&&O<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(C==="")return w===""?j(e):new Date(NaN);var R={firstWeekContainsDate:A,weekStartsOn:O,locale:T},st=[new Cl],gt=C.match(uc).map(function(ct){var q=ct[0];if(q in As){var Ot=As[q];return Ot(ct,T.formatLong)}return ct}).join("").match(cc),W=[],U=zs(gt),Q;try{var Mt=function(){var q=Q.value;!(i!=null&&i.useAdditionalWeekYearTokens)&&Ia(q)&&Ls(q,C,n),!(i!=null&&i.useAdditionalDayOfYearTokens)&&Ea(q)&&Ls(q,C,n);var Ot=q[0],wn=lc[Ot];if(wn){var Ts=wn.incompatibleTokens;if(Array.isArray(Ts)){var Ss=W.find(function(Os){return Ts.includes(Os.token)||Os.token===Ot});if(Ss)throw new RangeError("The format string mustn't contain `".concat(Ss.fullToken,"` and `").concat(q,"` at the same time"))}else if(wn.incompatibleTokens==="*"&&W.length>0)throw new RangeError("The format string mustn't contain `".concat(q,"` and any other token at the same time"));W.push({token:Ot,fullToken:q});var xi=wn.run(w,q,T.match,R);if(!xi)return{v:new Date(NaN)};st.push(xi.setter),w=xi.rest}else{if(Ot.match(gc))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Ot+"`");if(q==="''"?q="'":Ot==="'"&&(q=mc(q)),w.indexOf(q)===0)w=w.slice(q.length);else return{v:new Date(NaN)}}};for(U.s();!(Q=U.n()).done;){var lt=Mt();if(an(lt)==="object")return lt.v}}catch(ct){U.e(ct)}finally{U.f()}if(w.length>0&&fc.test(w))return new Date(NaN);var Gt=st.map(function(ct){return ct.priority}).sort(function(ct,q){return q-ct}).filter(function(ct,q,Ot){return Ot.indexOf(ct)===q}).map(function(ct){return st.filter(function(q){return q.priority===ct}).sort(function(q,Ot){return Ot.subPriority-q.subPriority})}).map(function(ct){return ct[0]}),Qt=j(e);if(isNaN(Qt.getTime()))return new Date(NaN);var Tt=za(Qt,ji(Qt)),Zt={},St=zs(Gt),Jt;try{for(St.s();!(Jt=St.n()).done;){var Ft=Jt.value;if(!Ft.validate(Tt,R))return new Date(NaN);var vn=Ft.set(Tt,Zt,R);Array.isArray(vn)?(Tt=vn[0],yl(Zt,vn[1])):Tt=vn}}catch(ct){St.e(ct)}finally{St.f()}return Tt}function mc(n){return n.match(hc)[1].replace(dc,"'")}function bc(n){z(1,arguments);var t=j(n);return t.setMinutes(0,0,0),t}function yc(n){z(1,arguments);var t=j(n);return t.setMilliseconds(0),t}function _c(n,t){var e;z(1,arguments);var i=wt((e=t==null?void 0:t.additionalDigits)!==null&&e!==void 0?e:2);if(i!==2&&i!==1&&i!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(!(typeof n=="string"||Object.prototype.toString.call(n)==="[object String]"))return new Date(NaN);var s=Mc(n),o;if(s.date){var r=kc(s.date,i);o=Cc(r.restDateString,r.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var a=o.getTime(),l=0,c;if(s.time&&(l=Pc(s.time),isNaN(l)))return new Date(NaN);if(s.timezone){if(c=Dc(s.timezone),isNaN(c))return new Date(NaN)}else{var u=new Date(a+l),h=new Date(0);return h.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),h.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),h}return new Date(a+l+c)}var Mn={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},xc=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vc=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,wc=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Mc(n){var t={},e=n.split(Mn.dateTimeDelimiter),i;if(e.length>2)return t;if(/:/.test(e[0])?i=e[0]:(t.date=e[0],i=e[1],Mn.timeZoneDelimiter.test(t.date)&&(t.date=n.split(Mn.timeZoneDelimiter)[0],i=n.substr(t.date.length,n.length))),i){var s=Mn.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function kc(n,t){var e=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=n.match(e);if(!i)return{year:NaN,restDateString:""};var s=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:o===null?s:o*100,restDateString:n.slice((i[1]||i[2]).length)}}function Cc(n,t){if(t===null)return new Date(NaN);var e=n.match(xc);if(!e)return new Date(NaN);var i=!!e[4],s=Be(e[1]),o=Be(e[2])-1,r=Be(e[3]),a=Be(e[4]),l=Be(e[5])-1;if(i)return Lc(t,a,l)?Tc(t,a,l):new Date(NaN);var c=new Date(0);return!Oc(t,o,r)||!Ac(t,s)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(s,r)),c)}function Be(n){return n?parseInt(n):1}function Pc(n){var t=n.match(vc);if(!t)return NaN;var e=vi(t[1]),i=vi(t[2]),s=vi(t[3]);return Rc(e,i,s)?e*hi+i*ui+s*1e3:NaN}function vi(n){return n&&parseFloat(n.replace(",","."))||0}function Dc(n){if(n==="Z")return 0;var t=n.match(wc);if(!t)return 0;var e=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Fc(i,s)?e*(i*hi+s*ui):NaN}function Tc(n,t,e){var i=new Date(0);i.setUTCFullYear(n,0,4);var s=i.getUTCDay()||7,o=(t-1)*7+e+1-s;return i.setUTCDate(i.getUTCDate()+o),i}var Sc=[31,null,31,30,31,30,31,31,30,31,30,31];function Sr(n){return n%400===0||n%4===0&&n%100!==0}function Oc(n,t,e){return t>=0&&t<=11&&e>=1&&e<=(Sc[t]||(Sr(n)?29:28))}function Ac(n,t){return t>=1&&t<=(Sr(n)?366:365)}function Lc(n,t,e){return t>=1&&t<=53&&e>=0&&e<=6}function Rc(n,t,e){return n===24?t===0&&e===0:e>=0&&e<60&&t>=0&&t<60&&n>=0&&n<25}function Fc(n,t){return t>=0&&t<=59}class Ic{get(t,e,i){return vt.get("/api/v2/summary/basic",{params:{start:t,end:e,code:i}})}}function Wt(n,t,e){const i=J(t,"y-MM-dd")+"_"+J(e,"y-MM-dd")+"_"+n;return console.log("getCacheKey: "+i),String(i)}let wi=!1;const Ec=()=>({balanceBox:{amounts:[],subtitles:[]},billBox:{paid:[],unpaid:[]},leftBox:{left:[],perDay:[]},netBox:{net:[]},autoConversion:!1,loading:!1,boxData:null,boxOptions:null,getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt("dashboard-boxes-data",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){this.boxData=s,this.generateOptions(this.boxData);return}new Ic().get(J(n,"yyyy-MM-dd"),J(t,"yyyy-MM-dd"),null).then(r=>{this.boxData=r.data,window.store.set(e,r.data),this.generateOptions(this.boxData)})},generateOptions(n){this.balanceBox={amounts:[],subtitles:[]},this.billBox={paid:[],unpaid:[]},this.leftBox={left:[],perDay:[]},this.netBox={net:[]};let t={};for(const e in n)if(n.hasOwnProperty(e)){const i=n[e];if(!i.hasOwnProperty("key"))continue;let s=i.key;if(this.autoConversion){if(s.startsWith("balance-in-native")){this.balanceBox.amounts.push(V(i.value,i.currency_code)),t.hasOwnProperty(i.currency_code)||(t[i.currency_code]="");continue}if(s.startsWith("spent-in-native")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=t[i.currency_code]+V(i.value,i.currency_code);continue}if(s.startsWith("earned-in-native")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=V(i.value,i.currency_code)+" + "+t[i.currency_code];continue}if(s.startsWith("bills-unpaid-in-native")){this.billBox.unpaid.push(V(i.value,i.currency_code));continue}if(s.startsWith("bills-paid-in-native")){this.billBox.paid.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-to-spend-in-native")){this.leftBox.left.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-per-day-to-spend-in-native")){this.leftBox.perDay.push(V(i.value,i.currency_code));continue}if(s.startsWith("net-worth-in-native")){this.netBox.net.push(V(i.value,i.currency_code));continue}}if(!this.autoConversion&&!s.endsWith("native")){if(s.startsWith("balance-in-")){this.balanceBox.amounts.push(V(i.value,i.currency_code));continue}if(s.startsWith("spent-in-")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=t[i.currency_code]+V(i.value,i.currency_code);continue}if(s.startsWith("earned-in-")){t.hasOwnProperty(i.currency_code)||(t[i.currency_code]=""),t[i.currency_code]=V(i.value,i.currency_code)+" + "+t[i.currency_code];continue}if(s.startsWith("bills-unpaid-in-")){this.billBox.unpaid.push(V(i.value,i.currency_code));continue}if(s.startsWith("bills-paid-in-")){this.billBox.paid.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-to-spend-in-")){this.leftBox.left.push(V(i.value,i.currency_code));continue}if(s.startsWith("left-per-day-to-spend-in-")){this.leftBox.perDay.push(V(i.value,i.currency_code));continue}s.startsWith("net-worth-in-")&&this.netBox.net.push(V(i.value,i.currency_code))}}for(let e in t)t.hasOwnProperty(e)&&this.balanceBox.subtitles.push(t[e]);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([bt("viewRange"),bt("autoConversion",!1)]).then(n=>{wi=!0,this.autoConversion=n[1],this.loadBoxes()}),window.store.observe("end",()=>{wi&&(this.boxData=null,this.loadBoxes())}),window.store.observe("autoConversion",n=>{wi&&(this.autoConversion=n,this.loadBoxes())})}});class zc{put(t,e){let i="/api/v1/preferences/"+t;return vt.put(i,{data:e})}}function Bc(n,t=null){window.store.set(n,t),new zc().put(n,t).then(i=>{}).catch(()=>{new Ba().post(n,t).then(s=>{})})}let Nc=class{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/account/dashboard",{params:{start:i,end:s}})}expense(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/account/expense-dashboard",{params:{start:i,end:s}})}},Ns=class{get(t,e){let i={date:J(e,"y-MM-dd").slice(0,10)};return e?vt.get("/api/v2/accounts/"+t,{params:i}):vt.get("/api/v2/accounts/"+t)}transactions(t,e){const i={page:e.page??1};return e.hasOwnProperty("start")&&(i.start=J(e.start,"y-MM-dd")),e.hasOwnProperty("end")&&(i.end=J(e.end,"y-MM-dd")),vt.get("/api/v2/accounts/"+t+"/transactions",{params:i})}};/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License - */function yn(n){return n+.5|0}const ne=(n,t,e)=>Math.max(Math.min(n,e),t);function Ge(n){return ne(yn(n*2.55),0,255)}function le(n){return ne(yn(n*255),0,255)}function Ut(n){return ne(yn(n/2.55)/100,0,1)}function Ns(n){return ne(yn(n*100),0,100)}const Ot={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},qi=[..."0123456789ABCDEF"],Wc=n=>qi[n&15],Hc=n=>qi[(n&240)>>4]+qi[n&15],kn=n=>(n&240)>>4===(n&15),Vc=n=>kn(n.r)&&kn(n.g)&&kn(n.b)&&kn(n.a);function Yc(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&Ot[n[1]]*17,g:255&Ot[n[2]]*17,b:255&Ot[n[3]]*17,a:t===5?Ot[n[4]]*17:255}:(t===7||t===9)&&(e={r:Ot[n[1]]<<4|Ot[n[2]],g:Ot[n[3]]<<4|Ot[n[4]],b:Ot[n[5]]<<4|Ot[n[6]],a:t===9?Ot[n[7]]<<4|Ot[n[8]]:255})),e}const jc=(n,t)=>n<255?t(n):"";function Uc(n){var t=Vc(n)?Wc:Hc;return n?"#"+t(n.r)+t(n.g)+t(n.b)+jc(n.a,t):void 0}const $c=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Sr(n,t,e){const i=t*Math.min(e,1-e),s=(o,r=(o+n/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function qc(n,t,e){const i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Xc(n,t,e){const i=Sr(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Kc(n,t,e,i,s){return n===s?(t-e)/i+(t.5?u/(2-o-r):u/(o+r),l=Kc(e,i,s,u,o),l=l*60+.5),[l|0,c||0,a]}function ds(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(le)}function fs(n,t,e){return ds(Sr,n,t,e)}function Gc(n,t,e){return ds(Xc,n,t,e)}function Qc(n,t,e){return ds(qc,n,t,e)}function Or(n){return(n%360+360)%360}function Zc(n){const t=$c.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ge(+t[5]):le(+t[5]));const s=Or(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Gc(s,o,r):t[1]==="hsv"?i=Qc(s,o,r):i=fs(s,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function Jc(n,t){var e=hs(n);e[0]=Or(e[0]+t),e=fs(e),n.r=e[0],n.g=e[1],n.b=e[2]}function tu(n){if(!n)return;const t=hs(n),e=t[0],i=Ns(t[1]),s=Ns(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ut(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Ws={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"},Hs={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 eu(){const n={},t=Object.keys(Hs),e=Object.keys(Ws);let i,s,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return n}let Cn;function nu(n){Cn||(Cn=eu(),Cn.transparent=[0,0,0,0]);const t=Cn[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const iu=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function su(n){const t=iu.exec(n);let e=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];e=t[8]?Ge(r):ne(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?Ge(i):ne(i,0,255)),s=255&(t[4]?Ge(s):ne(s,0,255)),o=255&(t[6]?Ge(o):ne(o,0,255)),{r:i,g:s,b:o,a:e}}}function ou(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ut(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Mi=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Ce=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function ru(n,t,e){const i=Ce(Ut(n.r)),s=Ce(Ut(n.g)),o=Ce(Ut(n.b));return{r:le(Mi(i+e*(Ce(Ut(t.r))-i))),g:le(Mi(s+e*(Ce(Ut(t.g))-s))),b:le(Mi(o+e*(Ce(Ut(t.b))-o))),a:n.a+e*(t.a-n.a)}}function Pn(n,t,e){if(n){let i=hs(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=fs(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ar(n,t){return n&&Object.assign(t||{},n)}function Vs(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=le(n[3]))):(t=Ar(n,{r:0,g:0,b:0,a:1}),t.a=le(t.a)),t}function au(n){return n.charAt(0)==="r"?su(n):Zc(n)}class dt{constructor(t){if(t instanceof dt)return t;const e=typeof t;let i;e==="object"?i=Vs(t):e==="string"&&(i=Yc(t)||nu(t)||au(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Ar(this._rgb);return t&&(t.a=Ut(t.a)),t}set rgb(t){this._rgb=Vs(t)}rgbString(){return this._valid?ou(this._rgb):void 0}hexString(){return this._valid?Uc(this._rgb):void 0}hslString(){return this._valid?tu(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=ru(this._rgb,t._rgb,e)),this}clone(){return new dt(this.rgb)}alpha(t){return this._rgb.a=le(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=yn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Pn(this._rgb,2,t),this}darken(t){return Pn(this._rgb,2,-t),this}saturate(t){return Pn(this._rgb,1,t),this}desaturate(t){return Pn(this._rgb,1,-t),this}rotate(t){return Jc(this._rgb,t),this}}/*! - * Chart.js v4.4.0 + */function yn(n){return n+.5|0}const ne=(n,t,e)=>Math.max(Math.min(n,e),t);function Ge(n){return ne(yn(n*2.55),0,255)}function le(n){return ne(yn(n*255),0,255)}function $t(n){return ne(yn(n/2.55)/100,0,1)}function Ws(n){return ne(yn(n*100),0,100)}const At={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},qi=[..."0123456789ABCDEF"],Wc=n=>qi[n&15],Hc=n=>qi[(n&240)>>4]+qi[n&15],kn=n=>(n&240)>>4===(n&15),Vc=n=>kn(n.r)&&kn(n.g)&&kn(n.b)&&kn(n.a);function Yc(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&At[n[1]]*17,g:255&At[n[2]]*17,b:255&At[n[3]]*17,a:t===5?At[n[4]]*17:255}:(t===7||t===9)&&(e={r:At[n[1]]<<4|At[n[2]],g:At[n[3]]<<4|At[n[4]],b:At[n[5]]<<4|At[n[6]],a:t===9?At[n[7]]<<4|At[n[8]]:255})),e}const jc=(n,t)=>n<255?t(n):"";function Uc(n){var t=Vc(n)?Wc:Hc;return n?"#"+t(n.r)+t(n.g)+t(n.b)+jc(n.a,t):void 0}const $c=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Or(n,t,e){const i=t*Math.min(e,1-e),s=(o,r=(o+n/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function qc(n,t,e){const i=(s,o=(s+n/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function Xc(n,t,e){const i=Or(n,1,.5);let s;for(t+e>1&&(s=1/(t+e),t*=s,e*=s),s=0;s<3;s++)i[s]*=1-t-e,i[s]+=t;return i}function Kc(n,t,e,i,s){return n===s?(t-e)/i+(t.5?u/(2-o-r):u/(o+r),l=Kc(e,i,s,u,o),l=l*60+.5),[l|0,c||0,a]}function ds(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(le)}function fs(n,t,e){return ds(Or,n,t,e)}function Gc(n,t,e){return ds(Xc,n,t,e)}function Qc(n,t,e){return ds(qc,n,t,e)}function Ar(n){return(n%360+360)%360}function Zc(n){const t=$c.exec(n);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Ge(+t[5]):le(+t[5]));const s=Ar(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=Gc(s,o,r):t[1]==="hsv"?i=Qc(s,o,r):i=fs(s,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function Jc(n,t){var e=hs(n);e[0]=Ar(e[0]+t),e=fs(e),n.r=e[0],n.g=e[1],n.b=e[2]}function tu(n){if(!n)return;const t=hs(n),e=t[0],i=Ws(t[1]),s=Ws(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${$t(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}const Hs={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"},Vs={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 eu(){const n={},t=Object.keys(Vs),e=Object.keys(Hs);let i,s,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return n}let Cn;function nu(n){Cn||(Cn=eu(),Cn.transparent=[0,0,0,0]);const t=Cn[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const iu=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function su(n){const t=iu.exec(n);let e=255,i,s,o;if(t){if(t[7]!==i){const r=+t[7];e=t[8]?Ge(r):ne(r*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?Ge(i):ne(i,0,255)),s=255&(t[4]?Ge(s):ne(s,0,255)),o=255&(t[6]?Ge(o):ne(o,0,255)),{r:i,g:s,b:o,a:e}}}function ou(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${$t(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const Mi=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Ce=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function ru(n,t,e){const i=Ce($t(n.r)),s=Ce($t(n.g)),o=Ce($t(n.b));return{r:le(Mi(i+e*(Ce($t(t.r))-i))),g:le(Mi(s+e*(Ce($t(t.g))-s))),b:le(Mi(o+e*(Ce($t(t.b))-o))),a:n.a+e*(t.a-n.a)}}function Pn(n,t,e){if(n){let i=hs(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=fs(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Lr(n,t){return n&&Object.assign(t||{},n)}function Ys(n){var t={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(t={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(t.a=le(n[3]))):(t=Lr(n,{r:0,g:0,b:0,a:1}),t.a=le(t.a)),t}function au(n){return n.charAt(0)==="r"?su(n):Zc(n)}class dt{constructor(t){if(t instanceof dt)return t;const e=typeof t;let i;e==="object"?i=Ys(t):e==="string"&&(i=Yc(t)||nu(t)||au(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Lr(this._rgb);return t&&(t.a=$t(t.a)),t}set rgb(t){this._rgb=Ys(t)}rgbString(){return this._valid?ou(this._rgb):void 0}hexString(){return this._valid?Uc(this._rgb):void 0}hslString(){return this._valid?tu(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=i.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=r*i.a+(1-r)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=ru(this._rgb,t._rgb,e)),this}clone(){return new dt(this.rgb)}alpha(t){return this._rgb.a=le(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=yn(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Pn(this._rgb,2,t),this}darken(t){return Pn(this._rgb,2,-t),this}saturate(t){return Pn(this._rgb,1,t),this}desaturate(t){return Pn(this._rgb,1,-t),this}rotate(t){return Jc(this._rgb,t),this}}/*! + * Chart.js v4.4.1 * https://www.chartjs.org * (c) 2023 Chart.js Contributors * Released under the MIT License - */function Wt(){}const lu=(()=>{let n=0;return()=>n++})();function H(n){return n===null||typeof n>"u"}function K(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function F(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function et(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Pt(n,t){return et(n)?n:t}function S(n,t){return typeof n>"u"?t:n}const cu=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Lr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function X(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function $(n,t,e,i){let s,o,r;if(K(n))if(o=n.length,i)for(s=o-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function du(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function fu(n){const t=du(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function ce(n,t){return(Ys[t]||(Ys[t]=fu(t)))(n)}function gs(n){return n.charAt(0).toUpperCase()+n.slice(1)}const cn=n=>typeof n<"u",ue=n=>typeof n=="function",js=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function gu(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const tt=Math.PI,G=2*tt,pu=G+tt,ti=Number.POSITIVE_INFINITY,mu=tt/180,at=tt/2,de=tt/4,Us=tt*2/3,ie=Math.log10,Bt=Math.sign;function nn(n,t,e){return Math.abs(n-t)s-o).pop(),t}function un(n){return!isNaN(parseFloat(n))&&isFinite(n)}function yu(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Fr(n,t,e){let i,s,o;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function ms(n,t,e){e=e||(r=>n[r]1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}const xe=(n,t,e,i)=>ms(n,e,i?s=>{const o=n[s][t];return on[s][t]ms(n,e,i=>n[i][t]>=e);function wu(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+gs(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function Xs(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(Er.forEach(o=>{delete n[o]}),delete n._chartjs)}function zr(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const Br=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Nr(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Br.call(window,()=>{i=!1,n.apply(t,e)}))}}function ku(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Wr=n=>n==="start"?"left":n==="end"?"right":"center",kt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Cu=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Pu(n,t,e){const i=t.length;let s=0,o=i;if(n._sorted){const{iScale:r,_parsed:a}=n,l=r.axis,{min:c,max:u,minDefined:h,maxDefined:d}=r.getUserBounds();h&&(s=ft(Math.min(xe(a,l,c).lo,e?i:xe(t,l,r.getPixelForValue(c)).lo),0,i-1)),d?o=ft(Math.max(xe(a,r.axis,u,!0).hi+1,e?0:xe(t,l,r.getPixelForValue(u),!0).hi+1),s,i)-s:o=i-s}return{start:s,count:o}}function Du(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}const Dn=n=>n===0||n===1,Ks=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*G/e)),Gs=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*G/e)+1,sn={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*at)+1,easeOutSine:n=>Math.sin(n*at),easeInOutSine:n=>-.5*(Math.cos(tt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Dn(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Dn(n)?n:Ks(n,.075,.3),easeOutElastic:n=>Dn(n)?n:Gs(n,.075,.3),easeInOutElastic(n){return Dn(n)?n:n<.5?.5*Ks(n*2,.1125,.45):.5+.5*Gs(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-sn.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?sn.easeInBounce(n*2)*.5:sn.easeOutBounce(n*2-1)*.5+.5};function bs(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ae(n){return bs(n)?n:new dt(n)}function on(n){return bs(n)?n:new dt(n).saturate(.5).darken(.1).hexString()}const Tu=["x","y","borderWidth","radius","tension"],Su=["color","borderColor","backgroundColor"];function Ou(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Su},numbers:{type:"number",properties:Tu}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Au(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Qs=new Map;function Lu(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Qs.get(e);return i||(i=new Intl.NumberFormat(n,t),Qs.set(e,i)),i}function _n(n,t,e){return Lu(t,e).format(n)}const Hr={values(n){return K(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,o=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Ru(n,e)}const r=ie(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),_n(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(ie(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Hr.numeric.call(this,n,t,e):""}};function Ru(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var fi={formatters:Hr};function Fu(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Me=Object.create(null),Ki=Object.create(null);function rn(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.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,s)=>on(s.backgroundColor),this.hoverBorderColor=(i,s)=>on(s.borderColor),this.hoverColor=(i,s)=>on(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ki(this,t,e)}get(t){return rn(this,t)}describe(t,e){return ki(Ki,t,e)}override(t,e){return ki(Me,t,e)}route(t,e,i,s){const o=rn(this,t),r=rn(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return F(l)?Object.assign({},c,l):S(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var nt=new Iu({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ou,Au,Fu]);function Eu(n){return!n||H(n.size)||H(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function ei(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function zu(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let r=0;const a=e.length;let l,c,u,h,d;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function qt(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&o.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,Wu(n,o),l=0;l+n||0;function ys(n,t){const e={},i=F(t),s=i?Object.keys(t):t,o=F(n)?i?r=>S(n[r],n[t[r]]):r=>n[r]:()=>n;for(const r of s)e[r]=$u(o(r));return e}function Yr(n){return ys(n,{top:"y",right:"x",bottom:"y",left:"x"})}function ve(n){return ys(n,["topLeft","topRight","bottomLeft","bottomRight"])}function yt(n){const t=Yr(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ut(n,t){n=n||{},t=t||nt.font;let e=S(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=S(n.style,t.style);i&&!(""+i).match(ju)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:S(n.family,t.family),lineHeight:Uu(S(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:S(n.weight,t.weight),string:""};return s.string=Eu(s),s}function Tn(n,t,e,i){let s=!0,o,r,a;for(o=0,r=n.length;oe&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function he(n,t){return Object.assign(Object.create(n),t)}function _s(n,t=[""],e,i,s=()=>n[0]){const o=e||n;typeof i>"u"&&(i=qr("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>_s([a,...n],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return Ur(a,l,()=>eh(l,t,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return to(a).includes(l)},ownKeys(a){return to(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function Ee(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:jr(n,i),setContext:o=>Ee(n,o,e,i),override:o=>Ee(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete n[r],!0},get(o,r,a){return Ur(o,r,()=>Ku(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(o,r,a){return n[r]=a,delete o[r],!0}})}function jr(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:ue(e)?e:()=>e,isIndexable:ue(i)?i:()=>i}}const Xu=(n,t)=>n?n+gs(t):t,xs=(n,t)=>F(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ur(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function Ku(n,t,e){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=n;let a=i[t];return ue(a)&&r.isScriptable(t)&&(a=Gu(t,a,n,e)),K(a)&&a.length&&(a=Qu(t,a,n,r.isIndexable)),xs(t,a)&&(a=Ee(a,s,o&&o[t],r)),a}function Gu(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=t(o,r||i);return a.delete(n),xs(n,l)&&(l=vs(s._scopes,s,n,l)),l}function Qu(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(F(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const h=vs(c,s,n,u);t.push(Ee(h,o,r&&r[n],a))}}return t}function $r(n,t,e){return ue(n)?n(t,e):n}const Zu=(n,t)=>n===!0?t:typeof n=="string"?ce(t,n):void 0;function Ju(n,t,e,i,s){for(const o of t){const r=Zu(e,o);if(r){n.add(r);const a=$r(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function vs(n,t,e,i){const s=t._rootScopes,o=$r(t._fallback,e,i),r=[...n,...s],a=new Set;a.add(i);let l=Js(a,r,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=Js(a,r,o,l,i),l===null)?!1:_s(Array.from(a),[""],s,o,()=>th(t,e,i))}function Js(n,t,e,i,s){for(;e;)e=Ju(n,t,e,i,s);return e}function th(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return K(s)&&F(e)?e:s||{}}function eh(n,t,e,i){let s;for(const o of t)if(s=qr(Xu(o,n),e),typeof s<"u")return xs(n,s)?vs(e,i,n,s):s}function qr(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function to(n){let t=n._keys;return t||(t=n._keys=nh(n._scopes)),t}function nh(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function ih(n,t,e,i){const{iScale:s}=n,{key:o="r"}=this._parsing,r=new Array(i);let a,l,c,u;for(a=0,l=i;atn==="x"?"y":"x";function oh(n,t,e,i){const s=n.skip?t:n,o=t,r=e.skip?t:e,a=Xi(o,s),l=Xi(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=i*c,d=i*u;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function rh(n,t,e){const i=n.length;let s,o,r,a,l,c=ze(n,0);for(let u=0;u!c.skip)),t.cubicInterpolationMode==="monotone")lh(n,s);else{let c=i?n[n.length-1]:n[0];for(o=0,r=n.length;on.ownerDocument.defaultView.getComputedStyle(n,null);function hh(n,t){return mi(n).getPropertyValue(t)}const dh=["top","right","bottom","left"];function we(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=dh[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const fh=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function gh(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(fh(s,o,n.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function be(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=mi(e),o=s.boxSizing==="border-box",r=we(s,"padding"),a=we(s,"border","width"),{x:l,y:c,box:u}=gh(n,e),h=r.left+(u&&a.left),d=r.top+(u&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-h)/f*e.width/i),y:Math.round((c-d)/g*e.height/i)}}function ph(n,t,e){let i,s;if(t===void 0||e===void 0){const o=ws(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{const r=o.getBoundingClientRect(),a=mi(o),l=we(a,"border","width"),c=we(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,i=ni(a.maxWidth,o,"clientWidth"),s=ni(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||ti,maxHeight:s||ti}}const On=n=>Math.round(n*10)/10;function mh(n,t,e,i){const s=mi(n),o=we(s,"margin"),r=ni(s.maxWidth,n,"clientWidth")||ti,a=ni(s.maxHeight,n,"clientHeight")||ti,l=ph(n,t,e);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const d=we(s,"border","width"),f=we(s,"padding");c-=f.width+d.width,u-=f.height+d.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=On(Math.min(c,r,l.maxWidth)),u=On(Math.min(u,a,l.maxHeight)),c&&!u&&(u=On(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=On(Math.floor(u*i))),{width:c,height:u}}function eo(n,t,e){const i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const r=n.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(n.currentDevicePixelRatio=i,r.height=s,r.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const bh=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch{}return n}();function no(n,t){const e=hh(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function ye(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function yh(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function _h(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},r=ye(n,s,e),a=ye(s,o,e),l=ye(o,t,e),c=ye(r,a,e),u=ye(a,l,e);return ye(c,u,e)}const xh=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},vh=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Fe(n,t,e){return n?xh(t,e):vh()}function Gr(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function Qr(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Zr(n){return n==="angle"?{between:hn,compare:_u,normalize:Dt}:{between:$t,compare:(t,e)=>t-e,normalize:t=>t}}function io({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function wh(n,t,e){const{property:i,start:s,end:o}=e,{between:r,normalize:a}=Zr(i),l=t.length;let{start:c,end:u,loop:h}=n,d,f;if(h){for(c+=l,u+=l,d=0,f=l;dl(s,x,b)&&a(s,x)!==0,_=()=>a(o,b)===0||l(o,x,b),w=()=>p||v(),C=()=>!p||_();for(let M=u,T=u;M<=h;++M)y=t[M%r],!y.skip&&(b=c(y[i]),b!==x&&(p=l(b,s,o),m===null&&w()&&(m=a(b,s)===0?M:T),m!==null&&C()&&(g.push(io({start:m,end:M,loop:d,count:r,style:f})),m=null),T=M,x=b));return m!==null&&g.push(io({start:m,end:h,loop:d,count:r,style:f})),g}function ta(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function kh(n,t,e,i){const s=n.length,o=[];let r=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Ch(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const o=!!n._loop,{start:r,end:a}=Mh(e,s,o,i);if(i===!0)return so(n,[{start:r,end:a,loop:o}],e,t);const l=a{let n=0;return()=>n++})();function H(n){return n===null||typeof n>"u"}function K(n){if(Array.isArray&&Array.isArray(n))return!0;const t=Object.prototype.toString.call(n);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function F(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}function et(n){return(typeof n=="number"||n instanceof Number)&&isFinite(+n)}function Pt(n,t){return et(n)?n:t}function S(n,t){return typeof n>"u"?t:n}const cu=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:+n/t,Rr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function X(n,t,e){if(n&&typeof n.call=="function")return n.apply(e,t)}function $(n,t,e,i){let s,o,r;if(K(n))if(o=n.length,i)for(s=o-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function du(n){const t=n.split("."),e=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function fu(n){const t=du(n);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function ce(n,t){return(js[t]||(js[t]=fu(t)))(n)}function gs(n){return n.charAt(0).toUpperCase()+n.slice(1)}const cn=n=>typeof n<"u",ue=n=>typeof n=="function",Us=(n,t)=>{if(n.size!==t.size)return!1;for(const e of n)if(!t.has(e))return!1;return!0};function gu(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const tt=Math.PI,G=2*tt,pu=G+tt,ti=Number.POSITIVE_INFINITY,mu=tt/180,at=tt/2,de=tt/4,$s=tt*2/3,ie=Math.log10,Nt=Math.sign;function nn(n,t,e){return Math.abs(n-t)s-o).pop(),t}function un(n){return!isNaN(parseFloat(n))&&isFinite(n)}function yu(n,t){const e=Math.round(n);return e-t<=n&&e+t>=n}function Ir(n,t,e){let i,s,o;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function ms(n,t,e){e=e||(r=>n[r]1;)o=s+i>>1,e(o)?s=o:i=o;return{lo:s,hi:i}}const xe=(n,t,e,i)=>ms(n,e,i?s=>{const o=n[s][t];return on[s][t]ms(n,e,i=>n[i][t]>=e);function wu(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{const i="_onData"+gs(e),s=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value(...o){const r=s.apply(this,o);return n._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function Ks(n,t){const e=n._chartjs;if(!e)return;const i=e.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(zr.forEach(o=>{delete n[o]}),delete n._chartjs)}function Br(n){const t=new Set(n);return t.size===n.length?n:Array.from(t)}const Nr=function(){return typeof window>"u"?function(n){return n()}:window.requestAnimationFrame}();function Wr(n,t){let e=[],i=!1;return function(...s){e=s,i||(i=!0,Nr.call(window,()=>{i=!1,n.apply(t,e)}))}}function ku(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}const Hr=n=>n==="start"?"left":n==="end"?"right":"center",kt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Cu=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Pu(n,t,e){const i=t.length;let s=0,o=i;if(n._sorted){const{iScale:r,_parsed:a}=n,l=r.axis,{min:c,max:u,minDefined:h,maxDefined:d}=r.getUserBounds();h&&(s=ft(Math.min(xe(a,l,c).lo,e?i:xe(t,l,r.getPixelForValue(c)).lo),0,i-1)),d?o=ft(Math.max(xe(a,r.axis,u,!0).hi+1,e?0:xe(t,l,r.getPixelForValue(u),!0).hi+1),s,i)-s:o=i-s}return{start:s,count:o}}function Du(n){const{xScale:t,yScale:e,_scaleRanges:i}=n,s={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,s),o}const Dn=n=>n===0||n===1,Gs=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*G/e)),Qs=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*G/e)+1,sn={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*at)+1,easeOutSine:n=>Math.sin(n*at),easeInOutSine:n=>-.5*(Math.cos(tt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Dn(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Dn(n)?n:Gs(n,.075,.3),easeOutElastic:n=>Dn(n)?n:Qs(n,.075,.3),easeInOutElastic(n){return Dn(n)?n:n<.5?.5*Gs(n*2,.1125,.45):.5+.5*Qs(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let t=1.70158;return(n/=.5)<1?.5*(n*n*(((t*=1.525)+1)*n-t)):.5*((n-=2)*n*(((t*=1.525)+1)*n+t)+2)},easeInBounce:n=>1-sn.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?sn.easeInBounce(n*2)*.5:sn.easeOutBounce(n*2-1)*.5+.5};function bs(n){if(n&&typeof n=="object"){const t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ae(n){return bs(n)?n:new dt(n)}function on(n){return bs(n)?n:new dt(n).saturate(.5).darken(.1).hexString()}const Tu=["x","y","borderWidth","radius","tension"],Su=["color","borderColor","backgroundColor"];function Ou(n){n.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),n.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),n.set("animations",{colors:{type:"color",properties:Su},numbers:{type:"number",properties:Tu}}),n.describe("animations",{_fallback:"animation"}),n.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Au(n){n.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Zs=new Map;function Lu(n,t){t=t||{};const e=n+JSON.stringify(t);let i=Zs.get(e);return i||(i=new Intl.NumberFormat(n,t),Zs.set(e,i)),i}function _n(n,t,e){return Lu(t,e).format(n)}const Vr={values(n){return K(n)?n:""+n},numeric(n,t,e){if(n===0)return"0";const i=this.chart.options.locale;let s,o=n;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Ru(n,e)}const r=ie(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),_n(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";const i=e[t].significand||n/Math.pow(10,Math.floor(ie(n)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Vr.numeric.call(this,n,t,e):""}};function Ru(n,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),e}var fi={formatters:Vr};function Fu(n){n.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:fi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),n.route("scale.ticks","color","","color"),n.route("scale.grid","color","","borderColor"),n.route("scale.border","color","","borderColor"),n.route("scale.title","color","","color"),n.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),n.describe("scales",{_fallback:"scale"}),n.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Me=Object.create(null),Ki=Object.create(null);function rn(n,t){if(!t)return n;const e=t.split(".");for(let i=0,s=e.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,s)=>on(s.backgroundColor),this.hoverBorderColor=(i,s)=>on(s.borderColor),this.hoverColor=(i,s)=>on(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ki(this,t,e)}get(t){return rn(this,t)}describe(t,e){return ki(Ki,t,e)}override(t,e){return ki(Me,t,e)}route(t,e,i,s){const o=rn(this,t),r=rn(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[s];return F(l)?Object.assign({},c,l):S(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var nt=new Iu({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ou,Au,Fu]);function Eu(n){return!n||H(n.size)||H(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function ei(n,t,e,i,s){let o=t[s];return o||(o=t[s]=n.measureText(s).width,e.push(s)),o>i&&(i=o),i}function zu(n,t,e,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),n.save(),n.font=t;let r=0;const a=e.length;let l,c,u,h,d;for(l=0;le.length){for(l=0;l0&&n.stroke()}}function Xt(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&o.strokeColor!=="";let l,c;for(n.save(),n.font=s.string,Wu(n,o),l=0;l+n||0;function ys(n,t){const e={},i=F(t),s=i?Object.keys(t):t,o=F(n)?i?r=>S(n[r],n[t[r]]):r=>n[r]:()=>n;for(const r of s)e[r]=$u(o(r));return e}function jr(n){return ys(n,{top:"y",right:"x",bottom:"y",left:"x"})}function ve(n){return ys(n,["topLeft","topRight","bottomLeft","bottomRight"])}function yt(n){const t=jr(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function ut(n,t){n=n||{},t=t||nt.font;let e=S(n.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=S(n.style,t.style);i&&!(""+i).match(ju)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:S(n.family,t.family),lineHeight:Uu(S(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:S(n.weight,t.weight),string:""};return s.string=Eu(s),s}function Tn(n,t,e,i){let s=!0,o,r,a;for(o=0,r=n.length;oe&&a===0?0:a+l;return{min:r(i,-Math.abs(o)),max:r(s,o)}}function he(n,t){return Object.assign(Object.create(n),t)}function _s(n,t=[""],e,i,s=()=>n[0]){const o=e||n;typeof i>"u"&&(i=Xr("_fallback",n));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:o,_fallback:i,_getTarget:s,override:a=>_s([a,...n],t,o,i)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete n[0][l],!0},get(a,l){return $r(a,l,()=>eh(l,t,n,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,l){return eo(a).includes(l)},ownKeys(a){return eo(a)},set(a,l,c){const u=a._storage||(a._storage=s());return a[l]=u[l]=c,delete a._keys,!0}})}function Ee(n,t,e,i){const s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:Ur(n,i),setContext:o=>Ee(n,o,e,i),override:o=>Ee(n.override(o),t,e,i)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete n[r],!0},get(o,r,a){return $r(o,r,()=>Ku(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(n,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,r)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(o,r){return Reflect.has(n,r)},ownKeys(){return Reflect.ownKeys(n)},set(o,r,a){return n[r]=a,delete o[r],!0}})}function Ur(n,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=n;return{allKeys:s,scriptable:e,indexable:i,isScriptable:ue(e)?e:()=>e,isIndexable:ue(i)?i:()=>i}}const Xu=(n,t)=>n?n+gs(t):t,xs=(n,t)=>F(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function $r(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];const i=e();return n[t]=i,i}function Ku(n,t,e){const{_proxy:i,_context:s,_subProxy:o,_descriptors:r}=n;let a=i[t];return ue(a)&&r.isScriptable(t)&&(a=Gu(t,a,n,e)),K(a)&&a.length&&(a=Qu(t,a,n,r.isIndexable)),xs(t,a)&&(a=Ee(a,s,o&&o[t],r)),a}function Gu(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_stack:a}=e;if(a.has(n))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+n);a.add(n);let l=t(o,r||i);return a.delete(n),xs(n,l)&&(l=vs(s._scopes,s,n,l)),l}function Qu(n,t,e,i){const{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&i(n))return t[o.index%t.length];if(F(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const h=vs(c,s,n,u);t.push(Ee(h,o,r&&r[n],a))}}return t}function qr(n,t,e){return ue(n)?n(t,e):n}const Zu=(n,t)=>n===!0?t:typeof n=="string"?ce(t,n):void 0;function Ju(n,t,e,i,s){for(const o of t){const r=Zu(e,o);if(r){n.add(r);const a=qr(r._fallback,e,s);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function vs(n,t,e,i){const s=t._rootScopes,o=qr(t._fallback,e,i),r=[...n,...s],a=new Set;a.add(i);let l=to(a,r,e,o||e,i);return l===null||typeof o<"u"&&o!==e&&(l=to(a,r,o,l,i),l===null)?!1:_s(Array.from(a),[""],s,o,()=>th(t,e,i))}function to(n,t,e,i,s){for(;e;)e=Ju(n,t,e,i,s);return e}function th(n,t,e){const i=n._getTarget();t in i||(i[t]={});const s=i[t];return K(s)&&F(e)?e:s||{}}function eh(n,t,e,i){let s;for(const o of t)if(s=Xr(Xu(o,n),e),typeof s<"u")return xs(n,s)?vs(e,i,n,s):s}function Xr(n,t){for(const e of t){if(!e)continue;const i=e[n];if(typeof i<"u")return i}}function eo(n){let t=n._keys;return t||(t=n._keys=nh(n._scopes)),t}function nh(n){const t=new Set;for(const e of n)for(const i of Object.keys(e).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function ih(n,t,e,i){const{iScale:s}=n,{key:o="r"}=this._parsing,r=new Array(i);let a,l,c,u;for(a=0,l=i;atn==="x"?"y":"x";function oh(n,t,e,i){const s=n.skip?t:n,o=t,r=e.skip?t:e,a=Xi(o,s),l=Xi(r,o);let c=a/(a+l),u=l/(a+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=i*c,d=i*u;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+d*(r.x-s.x),y:o.y+d*(r.y-s.y)}}}function rh(n,t,e){const i=n.length;let s,o,r,a,l,c=ze(n,0);for(let u=0;u!c.skip)),t.cubicInterpolationMode==="monotone")lh(n,s);else{let c=i?n[n.length-1]:n[0];for(o=0,r=n.length;on.ownerDocument.defaultView.getComputedStyle(n,null);function hh(n,t){return mi(n).getPropertyValue(t)}const dh=["top","right","bottom","left"];function we(n,t,e){const i={};e=e?"-"+e:"";for(let s=0;s<4;s++){const o=dh[s];i[o]=parseFloat(n[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const fh=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function gh(n,t){const e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:o}=i;let r=!1,a,l;if(fh(s,o,n.target))a=s,l=o;else{const c=t.getBoundingClientRect();a=i.clientX-c.left,l=i.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function be(n,t){if("native"in n)return n;const{canvas:e,currentDevicePixelRatio:i}=t,s=mi(e),o=s.boxSizing==="border-box",r=we(s,"padding"),a=we(s,"border","width"),{x:l,y:c,box:u}=gh(n,e),h=r.left+(u&&a.left),d=r.top+(u&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-h)/f*e.width/i),y:Math.round((c-d)/g*e.height/i)}}function ph(n,t,e){let i,s;if(t===void 0||e===void 0){const o=Ms(n);if(!o)t=n.clientWidth,e=n.clientHeight;else{const r=o.getBoundingClientRect(),a=mi(o),l=we(a,"border","width"),c=we(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,i=ni(a.maxWidth,o,"clientWidth"),s=ni(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||ti,maxHeight:s||ti}}const On=n=>Math.round(n*10)/10;function mh(n,t,e,i){const s=mi(n),o=we(s,"margin"),r=ni(s.maxWidth,n,"clientWidth")||ti,a=ni(s.maxHeight,n,"clientHeight")||ti,l=ph(n,t,e);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const d=we(s,"border","width"),f=we(s,"padding");c-=f.width+d.width,u-=f.height+d.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=On(Math.min(c,r,l.maxWidth)),u=On(Math.min(u,a,l.maxHeight)),c&&!u&&(u=On(c/2)),(t!==void 0||e!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=On(Math.floor(u*i))),{width:c,height:u}}function no(n,t,e){const i=t||1,s=Math.floor(n.height*i),o=Math.floor(n.width*i);n.height=Math.floor(n.height),n.width=Math.floor(n.width);const r=n.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${n.height}px`,r.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||r.height!==s||r.width!==o?(n.currentDevicePixelRatio=i,r.height=s,r.width=o,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const bh=function(){let n=!1;try{const t={get passive(){return n=!0,!1}};ws()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return n}();function io(n,t){const e=hh(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function ye(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function yh(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:i==="middle"?e<.5?n.y:t.y:i==="after"?e<1?n.y:t.y:e>0?t.y:n.y}}function _h(n,t,e,i){const s={x:n.cp2x,y:n.cp2y},o={x:t.cp1x,y:t.cp1y},r=ye(n,s,e),a=ye(s,o,e),l=ye(o,t,e),c=ye(r,a,e),u=ye(a,l,e);return ye(c,u,e)}const xh=function(n,t){return{x(e){return n+n+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},vh=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Fe(n,t,e){return n?xh(t,e):vh()}function Gr(n,t){let e,i;(t==="ltr"||t==="rtl")&&(e=n.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),n.prevTextDirection=i)}function Qr(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Zr(n){return n==="angle"?{between:hn,compare:_u,normalize:Dt}:{between:qt,compare:(t,e)=>t-e,normalize:t=>t}}function so({start:n,end:t,count:e,loop:i,style:s}){return{start:n%e,end:t%e,loop:i&&(t-n+1)%e===0,style:s}}function wh(n,t,e){const{property:i,start:s,end:o}=e,{between:r,normalize:a}=Zr(i),l=t.length;let{start:c,end:u,loop:h}=n,d,f;if(h){for(c+=l,u+=l,d=0,f=l;dl(s,x,b)&&a(s,x)!==0,_=()=>a(o,b)===0||l(o,x,b),w=()=>p||v(),C=()=>!p||_();for(let M=u,T=u;M<=h;++M)y=t[M%r],!y.skip&&(b=c(y[i]),b!==x&&(p=l(b,s,o),m===null&&w()&&(m=a(b,s)===0?M:T),m!==null&&C()&&(g.push(so({start:m,end:M,loop:d,count:r,style:f})),m=null),T=M,x=b));return m!==null&&g.push(so({start:m,end:h,loop:d,count:r,style:f})),g}function ta(n,t){const e=[],i=n.segments;for(let s=0;ss&&n[o%t].skip;)o--;return o%=t,{start:s,end:o}}function kh(n,t,e,i){const s=n.length,o=[];let r=t,a=n[t],l;for(l=t+1;l<=e;++l){const c=n[l%s];c.skip||c.stop?a.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%s,end:r%s,loop:i}),o}function Ch(n,t){const e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];const o=!!n._loop,{start:r,end:a}=Mh(e,s,o,i);if(i===!0)return oo(n,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Br.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const 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(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Yt=new Th;const ro="transparent",Sh={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Ae(n||ro),s=i.valid&&Ae(t||ro);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Oh{constructor(t,e,i,s){const o=e[i];s=Tn([t.to,s,o,t.from]);const r=Tn([t.from,o,s]);this._active=!0,this._fn=t.fn||Sh[t.type||typeof r],this._easing=sn[t.easing]||sn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Tn([t.to,e,s,t.from]),this._from=Tn([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s{const o=t[s];if(!F(o))return;const r={};for(const a of e)r[a]=o[a];(K(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,s=Lh(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Ah(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[c];let h=o[c];const d=i.get(c);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[c]=u;continue}o[c]=h=new Oh(d,t,c,u),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return Yt.add(this._chart,i),!0}}function Ah(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function ho(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=Eh(o,r,i),h=t.length;let d;for(let f=0;fe[i].axis===t).shift()}function Nh(n,t){return he(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wh(n,t,e){return he(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ne(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Pi=n=>n==="reset"||n==="none",fo=(n,t)=>t?n:Object.assign({},n),Hh=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:na(e,!0),values:null};class Xt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=co(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ne(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,d,f,g)=>h==="x"?d:h==="r"?g:f,o=e.xAxisID=S(i.xAxisID,Ci(t,"x")),r=e.yAxisID=S(i.yAxisID,Ci(t,"y")),a=e.rAxisID=S(i.rAxisID,Ci(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),u=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Xs(this._data,this),t._stacked&&Ne(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(F(e))this._data=Ih(e);else if(i!==e){if(i){Xs(i,this);const s=this._cachedMeta;Ne(s),s._parsed=[]}e&&Object.isExtensible(e)&&Mu(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=co(e.vScale,e),e.stack!==i.stack&&(s=!0,Ne(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&ho(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,h,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{K(s[t])?d=this.parseArrayData(i,s,t,e):F(s[t])?d=this.parseObjectData(i,s,t,e):d=this.parsePrimitiveData(i,s,t,e);const f=()=>h[a]===null||c&&h[a]p||h=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(i,s,e),p=c.resolveNamedOptions(d,f,g,h);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(fo(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,e),d=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(d,this.getContext(t,i,e))}const c=new ea(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Pi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,s){Pi(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Pi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return n._cache.$bar}function Yh(n){const t=n.iScale,e=Vh(t,n.type);let i=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(cn(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(s=0,o=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function ia(n,t,e,i){return K(n)?$h(n,t,e,i):t[e.axis]=e.parse(n,i),t}function go(n,t,e,i){const s=n.iScale,o=n.vScale,r=s.getLabels(),a=s===o,l=[];let c,u,h,d;for(c=e,u=e+i;c=e?1:-1)}function Xh(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),o=i.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),u=c&&c[l.vScale.axis];if(H(u)||isNaN(u))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;ohn(x,a,l,!0)?1:Math.max(v,v*e,_,_*e),g=(x,v,_)=>hn(x,a,l,!0)?-1:Math.min(v,v*e,_,_*e),p=f(0,c,h),m=f(at,u,d),b=g(tt,c,h),y=g(tt+at,u,d);i=(p-b)/2,s=(m-y)/2,o=-(p+b)/2,r=-(m+y)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class Le extends Xt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(F(i[t])){const{key:l="value"}=this._parsing;o=c=>+ce(i[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?G*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=_n(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=i.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),k(Le,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class jn extends Xt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=Pu(e,s,r);this._drawStart=a,this._drawCount=l,Du(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=un(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",y=e+i,x=t.length;let v=e>0&&this.getParsed(e-1);for(let _=0;_=y){C.skip=!0;continue}const M=this.getParsed(_),T=H(M[f]),A=C[d]=r.getPixelForValue(M[d],_),O=C[f]=o||T?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[f],_);C.skip=isNaN(A)||isNaN(O)||T,C.stop=_>0&&Math.abs(M[d]-v[d])>m,p&&(C.parsed=M,C.raw=c.data[_]),h&&(C.options=u||this.resolveDataElementOptions(_,w.active?"active":s)),b||this.updateElement(w,_,C,s),v=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}k(jn,"id","line"),k(jn,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),k(jn,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Un extends Xt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=_n(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return ih.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,h=c.yCenter,d=c.getIndexAngle(0)-.5*tt;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?At(this.resolveDataElementOptions(t,e).angle||i):0}}k(Un,"id","polarArea"),k(Un,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),k(Un,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Qi extends Le{}k(Qi,"id","pie"),k(Qi,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function ge(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ms{constructor(t){k(this,"options");this.options=t||{}}static override(t){Object.assign(Ms.prototype,t)}init(){}formats(){return ge()}parse(){return ge()}format(){return ge()}add(){return ge()}diff(){return ge()}startOf(){return ge()}endOf(){return ge()}}var sa={_date:Ms};function Jh(n,t,e,i){const{controller:s,data:o,_sorted:r}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?vu:xe;if(i){if(s._sharedOptions){const c=o[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const h=l(o,t,e-u),d=l(o,t,e+u);return{lo:h.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function xn(n,t,e,i,s){const o=n.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var id={evaluateInteractionItems:xn,modes:{index(n,t,e,i){const s=be(t,n),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Ti(n,s,o,i,r):Si(n,s,o,!1,i,r),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){const s=be(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Ti(n,s,o,i,r):Si(n,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let u=0;ue.pos===t)}function yo(n,t){return n.filter(e=>oa.indexOf(e.pos)===-1&&e.box.axis===t)}function He(n,t){return n.sort((e,i)=>{const s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function sd(n){const t=[];let e,i,s,o,r,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=He(We(t,"left"),!0),s=He(We(t,"right")),o=He(We(t,"top"),!0),r=He(We(t,"bottom")),a=yo(t,"x"),l=yo(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:We(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function _o(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function ra(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ld(n,t,e,i){const{pos:s,box:o}=e,r=n.maxPadding;if(!F(s)){e.size&&(n[s]-=e.size);const h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&ra(r,o.getPadding());const a=Math.max(0,t.outerWidth-_o(r,n,"left","right")),l=Math.max(0,t.outerHeight-_o(r,n,"top","bottom")),c=a!==n.w,u=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function cd(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function ud(n,t){const e=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(n?["left","right"]:["top","bottom"])}function Qe(n,t,e,i){const s=[];let o,r,a,l,c,u;for(o=0,r=n.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const u=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},s);ra(d,yt(i));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=rd(l.concat(c),h);Qe(a.fullSize,f,h,g),Qe(l,f,h,g),Qe(c,f,h,g)&&Qe(l,f,h,g),cd(f),xo(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,xo(a.rightAndBottom,f,h,g),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(a.chartArea,p=>{const m=p.box;Object.assign(m,n.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class aa{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class hd extends aa{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $n="$chartjs",dd={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},vo=n=>n===null||n==="";function fd(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[$n]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",vo(s)){const o=no(n,"width");o!==void 0&&(n.width=o)}if(vo(i))if(n.style.height==="")n.height=n.width/(t||2);else{const o=no(n,"height");o!==void 0&&(n.height=o)}return n}const la=bh?{passive:!0}:!1;function gd(n,t,e){n.addEventListener(t,e,la)}function pd(n,t,e){n.canvas.removeEventListener(t,e,la)}function md(n,t){const e=dd[n.type]||n.type,{x:i,y:s}=be(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ii(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function bd(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ii(a.addedNodes,i),r=r&&!ii(a.removedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function yd(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ii(a.removedNodes,i),r=r&&!ii(a.addedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const fn=new Map;let wo=0;function ca(){const n=window.devicePixelRatio;n!==wo&&(wo=n,fn.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function _d(n,t){fn.size||window.addEventListener("resize",ca),fn.set(n,t)}function xd(n){fn.delete(n),fn.size||window.removeEventListener("resize",ca)}function vd(n,t,e){const i=n.canvas,s=i&&ws(i);if(!s)return;const o=Nr((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),_d(n,o),r}function Oi(n,t,e){e&&e.disconnect(),t==="resize"&&xd(n)}function wd(n,t,e){const i=n.canvas,s=Nr(o=>{n.ctx!==null&&e(md(o,n))},n);return gd(i,t,s),s}class Md extends aa{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(fd(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[$n])return!1;const i=e[$n].initial;["height","width"].forEach(o=>{const r=i[o];H(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[$n],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:bd,detach:yd,resize:vd}[e]||wd;s[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Oi,detach:Oi,resize:Oi}[e]||pd)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return mh(t,e,i,s)}isAttached(t){const e=ws(t);return!!(e&&e.isConnected)}}function kd(n){return!Kr()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?hd:Md}class Lt{constructor(){k(this,"x");k(this,"y");k(this,"active",!1);k(this,"options");k(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return un(this.x)&&un(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}k(Lt,"defaults",{}),k(Lt,"defaultRoutes");function Cd(n,t){const e=n.options.ticks,i=Pd(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Td(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Sd(t,c,o,r/s),c;const u=Dd(o,t,s);if(r>0){let h,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(Ln(t,c,u,H(f)?0:a-f,a),h=0,d=r-1;hs)return l}return Math.max(s,1)}function Td(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,Mo=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,ko=(n,t)=>Math.min(t||n,n);function Co(n,t){const e=[],i=n.length/t,s=n.length;let o=0;for(;or+a)))return l}function Rd(n,t){$(n,e=>{const i=e.gc,s=i.length/2;let o;if(s>t){for(o=0;oi?i:e,i=s&&e>i?e:i,{min:Pt(e,Pt(i,e)),max:Pt(i,Pt(e,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 t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){X(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=qu(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,f=ft(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),h+6>a&&(a=f/(i-(t.offset?.5:1)),l=this.maxHeight-Ve(t.grid)-e.padding-Po(t.title,this.chart.options.font),c=Math.sqrt(h*h+d*d),r=ps(Math.min(Math.asin(ft((u.highest.height+6)/a,-1,1)),Math.asin(ft(l/c,-1,1))-Math.asin(ft(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){X(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){X(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Po(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ve(o)+l):(t.height=this.maxHeight,t.width=Ve(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:d}=this._getLabelSizes(),f=i.padding*2,g=At(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=i.mirror?0:m*h.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=i.mirror?0:p*h.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,u,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=i*e.height):(d=i*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let u=e.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=e.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+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(){X(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[T]||0,height:a[T]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(C),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return xu(this._alignToPixels?fe(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=Ve(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(U){return fe(i,U,p)};let y,x,v,_,w,C,M,T,A,O,R,st;if(r==="top")y=b(this.bottom),C=this.bottom-d,T=y-m,O=b(t.top)+m,st=t.bottom;else if(r==="bottom")y=b(this.top),O=t.top,st=b(t.bottom)-m,C=y+m,T=this.top+d;else if(r==="left")y=b(this.right),w=this.right-d,M=y-m,A=b(t.left)+m,R=t.right;else if(r==="right")y=b(this.left),A=t.left,R=b(t.right)-m,w=y+m,M=this.left+d;else if(e==="x"){if(r==="center")y=b((t.top+t.bottom)/2+.5);else if(F(r)){const U=Object.keys(r)[0],Q=r[U];y=b(this.chart.scales[U].getPixelForValue(Q))}O=t.top,st=t.bottom,C=y+m,T=C+d}else if(e==="y"){if(r==="center")y=b((t.left+t.right)/2);else if(F(r)){const U=Object.keys(r)[0],Q=r[U];y=b(this.chart.scales[U].getPixelForValue(Q))}w=y-m,M=w-d,A=t.left,R=t.right}const gt=S(s.ticks.maxTicksLimit,h),W=Math.max(1,Math.ceil(h/gt));for(x=0;xo.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");nt.route(o,s,l,a)})}function Wd(n){return"id"in n&&"defaults"in n}class Hd{constructor(){this.controllers=new Rn(Xt,"datasets",!0),this.elements=new Rn(Lt,"elements"),this.plugins=new Rn(Object,"plugins"),this.scales=new Rn(ke,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):$(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){const s=gs(t);X(i["before"+s],[],i),e[t](i),X(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Yd(n){const t={},e=[],i=Object.keys(It.plugins.items);for(let o=0;o1&&Do(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function To(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function Gd(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return To(n,"x",e[0])||To(n,"y",e[0])}return{}}function Qd(n,t){const e=Me[n.type]||{scales:{}},i=t.scales||{},s=Zi(n.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!F(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=Ji(r,a,Gd(r,n),nt.scales[a.type]),c=Xd(l,s),u=e.scales||{};o[r]=en(Object.create(null),[{axis:l},a,u[l],u[c]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,l=r.indexAxis||Zi(a,t),u=(Me[a]||{}).scales||{};Object.keys(u).forEach(h=>{const d=qd(h,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),en(o[f],[{axis:d},i[f],u[h]])})}),Object.keys(o).forEach(r=>{const a=o[r];en(a,[nt.scales[a.type],nt.scale])}),o}function ua(n){const t=n.options||(n.options={});t.plugins=S(t.plugins,{}),t.scales=Qd(n,t)}function ha(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Zd(n){return n=n||{},n.data=ha(n.data),ua(n),n}const So=new Map,da=new Set;function Fn(n,t){let e=So.get(n);return e||(e=t(),So.set(n,e),da.add(e)),e}const Ye=(n,t,e)=>{const i=ce(t,e);i!==void 0&&n.add(i)};class Jd{constructor(t){this._config=Zd(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=ha(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ua(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Fn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Fn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Fn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Fn(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;const l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(h=>Ye(l,t,h))),u.forEach(h=>Ye(l,s,h)),u.forEach(h=>Ye(l,Me[o]||{},h)),u.forEach(h=>Ye(l,nt,h)),u.forEach(h=>Ye(l,Ki,h))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),da.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Me[e]||{},nt.datasets[e]||{},{type:e},nt,Ki]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Oo(this._resolverCache,t,s);let l=r;if(ef(r,e)){o.$shared=!1,i=ue(i)?i():i;const c=this.createResolver(t,i,a);l=Ee(r,i,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],s){const{resolver:o}=Oo(this._resolverCache,t,i);return F(e)?Ee(o,e,void 0,s):o}}function Oo(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let o=i.get(s);return o||(o={resolver:_s(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const tf=n=>F(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||ue(n[e]),!1);function ef(n,t){const{isScriptable:e,isIndexable:i}=jr(n);for(const s of t){const o=e(s),r=i(s),a=(r||o)&&n[s];if(o&&(ue(a)||tf(a))||r&&K(a))return!0}return!1}var nf="4.4.0";const sf=["top","bottom","left","right","chartArea"];function Ao(n,t){return n==="top"||n==="bottom"||sf.indexOf(n)===-1&&t==="x"}function Lo(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Ro(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),X(e&&e.onComplete,[n],t)}function of(n){const t=n.chart,e=t.options.animation;X(e&&e.onProgress,[n],t)}function fa(n){return Kr()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const qn={},Fo=n=>{const t=fa(n);return Object.values(qn).filter(e=>e.canvas===t).pop()};function rf(n,t,e){const i=Object.keys(n);for(const s of i){const o=+s;if(o>=t){const r=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=r)}}}function af(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function In(n,t,e){return n.options.clip?n[e]:t[e]}function lf(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:In(e,t,"left"),right:In(e,t,"right"),top:In(i,t,"top"),bottom:In(i,t,"bottom")}:t}class mt{static register(...t){It.add(...t),Io()}static unregister(...t){It.remove(...t),Io()}constructor(t,e){const i=this.config=new Jd(e),s=fa(t),o=Fo(s);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||kd(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=lu(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,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 Vd,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ku(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],qn[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Yt.listen(this,"complete",Ro),Yt.listen(this,"progress",of),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return H(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return It}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():eo(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Zs(this.canvas,this.ctx),this}stop(){return Yt.stop(this),this}resize(t,e){Yt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,eo(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),X(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};$(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ji(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),$(o,r=>{const a=r.options,l=a.id,c=Ji(l,a),u=S(a.type,r.dtype);(a.position===void 0||Ao(a.position,c)!==Ao(r.dposition))&&(a.position=r.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===u)h=i[l];else{const d=It.getScale(u);h=new d({id:l,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,t)}),$(s,(r,a)=>{r||delete i[a]}),$(i,r=>{se.configure(this,r,r.options),se.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Lo("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){$(this.scales,t=>{se.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!js(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of e){const r=i==="_removeElements"?-o:o;rf(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;se.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],$(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,o=lf(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&gi(e,{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}),t.controller.draw(),s&&pi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return qt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const o=id.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=he(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);cn(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Yt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};$(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){$(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},$(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.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}});!Zn(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,i,r),l=gu(t),c=af(t,this._lastEvent,i,l);i&&(this._lastEvent=null,X(o.onHover,[t,a,this],this),l&&X(o.onClick,[t,a,this],this));const u=!Zn(a,s);return(u||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}k(mt,"defaults",nt),k(mt,"instances",qn),k(mt,"overrides",Me),k(mt,"registry",It),k(mt,"version",nf),k(mt,"getChart",Fo);function Io(){return $(mt.instances,n=>n._plugins.invalidate())}function cf(n,t,e){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(o,r,a,i-c,e+c),l>s?(c=s/l,n.arc(o,r,l,e+c,i-c,!0)):n.arc(o,r,s,e+at,i-at),n.closePath(),n.clip()}function uf(n){return ys(n,["outerStart","outerEnd","innerStart","innerEnd"])}function hf(n,t,e,i){const s=uf(n.options.borderRadius),o=(e-t)/2,r=Math.min(o,i*t/2),a=l=>{const c=(e-Math.min(o,l))*i/2;return ft(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:ft(s.innerStart,0,r),innerEnd:ft(s.innerEnd,0,r)}}function Pe(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function si(n,t,e,i,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+i+e-c,0),d=u>0?u+i+e+c:0;let f=0;const g=s-l;if(i){const W=u>0?u-i:0,U=h>0?h-i:0,Q=(W+U)/2,Mt=Q!==0?g*Q/(Q+i):g;f=(g-Mt)/2}const p=Math.max(.001,g*h-e/tt)/h,m=(g-p)/2,b=l+m+f,y=s-m-f,{outerStart:x,outerEnd:v,innerStart:_,innerEnd:w}=hf(t,d,h,y-b),C=h-x,M=h-v,T=b+x/C,A=y-v/M,O=d+_,R=d+w,st=b+_/O,gt=y-w/R;if(n.beginPath(),o){const W=(T+A)/2;if(n.arc(r,a,h,T,W),n.arc(r,a,h,W,A),v>0){const lt=Pe(M,A,r,a);n.arc(lt.x,lt.y,v,A,y+at)}const U=Pe(R,y,r,a);if(n.lineTo(U.x,U.y),w>0){const lt=Pe(R,gt,r,a);n.arc(lt.x,lt.y,w,y+at,gt+Math.PI)}const Q=(y-w/d+(b+_/d))/2;if(n.arc(r,a,d,y-w/d,Q,!0),n.arc(r,a,d,Q,b+_/d,!0),_>0){const lt=Pe(O,st,r,a);n.arc(lt.x,lt.y,_,st+Math.PI,b-at)}const Mt=Pe(C,b,r,a);if(n.lineTo(Mt.x,Mt.y),x>0){const lt=Pe(C,T,r,a);n.arc(lt.x,lt.y,x,b-at,T)}}else{n.moveTo(r,a);const W=Math.cos(T)*h+r,U=Math.sin(T)*h+a;n.lineTo(W,U);const Q=Math.cos(A)*h+r,Mt=Math.sin(A)*h+a;n.lineTo(Q,Mt)}n.closePath()}function df(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){si(n,t,e,i,l,s);for(let c=0;c=G||hn(r,l,c),m=$t(a,u+f,h+f);return p&&m}getCenterPoint(e){const{x:i,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:u}=this.options,h=(o+r)/2,d=(a+l+u+c)/2;return{x:i+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>G?Math.floor(s/G):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(tt,s||0)),u=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,df(e,this,u,r,a),ff(e,this,u,r,a),e.restore()}}k(Ze,"id","arc"),k(Ze,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),k(Ze,"defaultRoutes",{backgroundColor:"backgroundColor"}),k(Ze,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function ga(n,t,e=t){n.lineCap=S(e.borderCapStyle,t.borderCapStyle),n.setLineDash(S(e.borderDash,t.borderDash)),n.lineDashOffset=S(e.borderDashOffset,t.borderDashOffset),n.lineJoin=S(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=S(e.borderWidth,t.borderWidth),n.strokeStyle=S(e.borderColor,t.borderColor)}function gf(n,t,e){n.lineTo(e.x,e.y)}function pf(n){return n.stepped?Bu:n.tension||n.cubicInterpolationMode==="monotone"?Nu:gf}function pa(n,t,e={}){const i=n.length,{start:s=0,end:o=i-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=sa&&o>a;return{count:i,start:l,loop:t.loop,ilen:c(r+(c?a-v:v))%o,x=()=>{p!==m&&(n.lineTo(u,m),n.lineTo(u,p),n.lineTo(u,b))};for(l&&(f=s[y(0)],n.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[y(d)],f.skip)continue;const v=f.x,_=f.y,w=v|0;w===g?(_m&&(m=_),u=(h*u+v)/++h):(x(),n.lineTo(v,_),g=w,h=0,p=m=_),b=_}x()}function ts(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?bf:mf}function yf(n){return n.stepped?yh:n.tension||n.cubicInterpolationMode==="monotone"?_h:ye}function _f(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),ga(n,t.options),n.stroke(s)}function xf(n,t,e,i){const{segments:s,options:o}=t,r=ts(t);for(const a of s)ga(n,o,a.style),n.beginPath(),r(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const vf=typeof Path2D=="function";function wf(n,t,e,i){vf&&!t.options.segment?_f(n,t,e,i):xf(n,t,e,i)}class oe extends Lt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;uh(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ch(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],o=this.points,r=ta(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=yf(i);let c,u;for(c=0,u=r.length;ct!=="borderDash"&&t!=="fill"});function Eo(n,t,e,i){const s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)n.replace("rgb(","rgba(").replace(")",", 0.5)"));function ba(n){return es[n%es.length]}function ya(n){return zo[n%zo.length]}function Tf(n,t){return n.borderColor=ba(t),n.backgroundColor=ya(t),++t}function Sf(n,t){return n.backgroundColor=n.data.map(()=>ba(t++)),t}function Of(n,t){return n.backgroundColor=n.data.map(()=>ya(t++)),t}function Af(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof Le?t=Sf(e,t):s instanceof Un?t=Of(e,t):s&&(t=Tf(e,t))}}function Bo(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Lf(n){return n&&(n.borderColor||n.backgroundColor)}var Rf={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:o}=s;if(!e.forceOverride&&(Bo(i)||Lf(s)||o&&Bo(o)))return;const r=Af(n);i.forEach(r)}};function Ff(n,t,e){const i=n.segments,s=n.points,o=t.points,r=[];for(const a of i){let{start:l,end:c}=a;c=ks(l,c,s);const u=ns(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:u,start:s[l],end:s[c]});continue}const h=ta(t,u);for(const d of h){const f=ns(e,o[d.start],o[d.end],d.loop),g=Jr(a,s,f);for(const p of g)r.push({source:p,target:d,start:{[e]:No(u,f,"start",Math.max)},end:{[e]:No(u,f,"end",Math.min)}})}}return r}function ns(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=Dt(s),o=Dt(o)),{property:n,start:s,end:o}}function If(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=ks(r,a,s);const l=s[r],c=s[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function ks(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function No(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function _a(n,t){let e=[],i=!1;return K(n)?(i=!0,e=n):e=If(n,t),e.length?new oe({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Wo(n){return n&&n.fill!==!1}function Ef(n,t,e){let s=n[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!et(s))return s;if(r=n[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function zf(n,t,e){const i=Hf(n);if(F(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return et(s)&&Math.floor(s)===s?Bf(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Bf(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function Nf(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:F(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Wf(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:F(n)?i=n.value:i=t.getBaseValue(),i}function Hf(n){const t=n.options,e=t.fill;let i=S(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Vf(n){const{scale:t,index:e,line:i}=n,s=[],o=i.segments,r=i.points,a=Yf(t,e);a.push(_a({x:null,y:t.bottom},i));for(let l=0;l=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&Ri(n.ctx,a,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;Wo(o)&&Ri(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!Wo(i)||e.drawTime!=="beforeDatasetDraw"||Ri(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const jo=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},tg=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class Uo extends Lt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=X(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ut(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=jo(i,o);let c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-u;return this.legendItems.forEach((g,p)=>{const m=i+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(h+=u,c[c.length-(p>0?0:1)]=0,f+=u,d++),l[p]={left:0,top:f,row:d,width:m,height:s},c[c.length-1]+=m+a}),h}_fitCols(t,e,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let h=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:y,itemHeight:x}=eg(i,e,o,m,s);b>0&&f+x+2*a>u&&(h+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[b]={left:g,top:f,col:p,width:y,height:x},d=Math.max(d,y),f+=x+a}),h+=d,c.push({width:d,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Fe(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=kt(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=kt(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=kt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=kt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;gi(t,this),this._draw(),pi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=nt.color,l=Fe(t.rtl,this.left,this.width),c=ut(r.font),{padding:u}=r,h=c.size,d=h/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=jo(r,h),b=function(w,C,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const T=S(M.lineWidth,1);if(s.fillStyle=S(M.fillStyle,a),s.lineCap=S(M.lineCap,"butt"),s.lineDashOffset=S(M.lineDashOffset,0),s.lineJoin=S(M.lineJoin,"miter"),s.lineWidth=T,s.strokeStyle=S(M.strokeStyle,a),s.setLineDash(S(M.lineDash,[])),r.usePointStyle){const A={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:T},O=l.xPlus(w,g/2),R=C+d;Vr(s,A,O,R,r.pointStyleWidth&&g)}else{const A=C+Math.max((h-p)/2,0),O=l.leftForLtr(w,g),R=ve(M.borderRadius);s.beginPath(),Object.values(R).some(st=>st!==0)?dn(s,{x:O,y:A,w:g,h:p,radius:R}):s.rect(O,A,g,p),s.fill(),T!==0&&s.stroke()}s.restore()},y=function(w,C,M){Ie(s,M.text,w,C+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},x=this.isHorizontal(),v=this._computeTitleHeight();x?f={x:kt(o,this.left+u,this.right-i[0]),y:this.top+u+v,line:0}:f={x:this.left+u,y:kt(o,this.top+v+u,this.bottom-e[0].height),line:0},Gr(this.ctx,t.textDirection);const _=m+u;this.legendItems.forEach((w,C)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const M=s.measureText(w.text).width,T=l.textAlign(w.textAlign||(w.textAlign=r.textAlign)),A=g+d+M;let O=f.x,R=f.y;l.setWidth(this.width),x?C>0&&O+A+u>this.right&&(R=f.y+=_,f.line++,O=f.x=kt(o,this.left+u,this.right-i[f.line])):C>0&&R+_>this.bottom&&(O=f.x=O+e[f.line].width+u,f.line++,R=f.y=kt(o,this.top+v+u,this.bottom-e[f.line].height));const st=l.x(O);if(b(st,R,w),O=Cu(T,O+g+d,x?O+A:this.right,t.rtl),y(l.x(O),R,w),x)f.x+=A+u;else if(typeof w.text!="string"){const gt=c.lineHeight;f.y+=va(w,gt)+u}else f.y+=_}),Qr(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ut(e.font),s=yt(e.padding);if(!e.display)return;const o=Fe(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let u,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,h=kt(t.align,h,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);u=c+kt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=kt(a,h,h+d);r.textAlign=o.textAlign(Wr(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,Ie(r,e.text,f,u,i)}_computeTitleHeight(){const t=this.options.title,e=ut(t.font),i=yt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if($t(t,this.left,this.right)&&$t(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>r.length?o:r)),t+e.size/2+i.measureText(s).width}function ig(n,t,e){let i=n;return typeof t.text!="string"&&(i=va(t,e)),i}function va(n,t){const e=n.text?n.text.length:0;return t*e}function sg(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var og={id:"legend",_element:Uo,start(n,t,e){const i=n.legend=new Uo({ctx:n.ctx,options:e,chart:n});se.configure(n,i,e),se.addBox(n,i)},stop(n){se.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;se.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),u=yt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};const Je={average(n){if(!n.length)return!1;let t,e,i=0,s=0,o=0;for(t=0,e=n.length;ta({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Nr.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const 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(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var jt=new Th;const ao="transparent",Sh={boolean(n,t,e){return e>.5?t:n},color(n,t,e){const i=Ae(n||ao),s=i.valid&&Ae(t||ao);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}};class Oh{constructor(t,e,i,s){const o=e[i];s=Tn([t.to,s,o,t.from]);const r=Tn([t.from,o,s]);this._active=!0,this._fn=t.fn||Sh[t.type||typeof r],this._easing=sn[t.easing]||sn.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Tn([t.to,e,s,t.from]),this._from=Tn([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s{const o=t[s];if(!F(o))return;const r={};for(const a of e)r[a]=o[a];(K(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,s=Lh(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Ah(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,e));continue}const u=e[c];let h=o[c];const d=i.get(c);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[c]=u;continue}o[c]=h=new Oh(d,t,c,u),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return jt.add(this._chart,i),!0}}function Ah(n,t){const e=[],i=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function fo(n,t){const{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,l=o.axis,c=r.axis,u=Eh(o,r,i),h=t.length;let d;for(let f=0;fe[i].axis===t).shift()}function Nh(n,t){return he(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wh(n,t,e){return he(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ne(n,t){const e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Pi=n=>n==="reset"||n==="none",go=(n,t)=>t?n:Object.assign({},n),Hh=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:na(e,!0),values:null};class Kt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=uo(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ne(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,d,f,g)=>h==="x"?d:h==="r"?g:f,o=e.xAxisID=S(i.xAxisID,Ci(t,"x")),r=e.yAxisID=S(i.yAxisID,Ci(t,"y")),a=e.rAxisID=S(i.rAxisID,Ci(t,"r")),l=e.indexAxis,c=e.iAxisID=s(l,o,r,a),u=e.vAxisID=s(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Ks(this._data,this),t._stacked&&Ne(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(F(e))this._data=Ih(e);else if(i!==e){if(i){Ks(i,this);const s=this._cachedMeta;Ne(s),s._parsed=[]}e&&Object.isExtensible(e)&&Mu(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=e._stacked;e._stacked=uo(e.vScale,e),e.stack!==i.stack&&(s=!0,Ne(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&fo(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:r}=i,a=o.axis;let l=t===0&&e===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,h,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{K(s[t])?d=this.parseArrayData(i,s,t,e):F(s[t])?d=this.parseObjectData(i,s,t,e):d=this.parsePrimitiveData(i,s,t,e);const f=()=>h[a]===null||c&&h[a]p||h=0;--d)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,o,r;for(s=0,o=e.length;s=0&&tthis.getContext(i,s,e),p=c.resolveNamedOptions(d,f,g,h);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(go(p,l))),p}_resolveAnimations(t,e,i){const s=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,e),d=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(d,this.getContext(t,i,e))}const c=new ea(s,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Pi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,s){Pi(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Pi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const s=i.length,o=e.length,r=Math.min(o,s);r&&this.parse(0,r),o>s?this._insertElements(s,o-s,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;as-o))}return n._cache.$bar}function Yh(n){const t=n.iScale,e=Vh(t,n.type);let i=t._length,s,o,r,a;const l=()=>{r===32767||r===-32768||(cn(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(s=0,o=e.length;s0?s[n-1]:null,a=nMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function ia(n,t,e,i){return K(n)?$h(n,t,e,i):t[e.axis]=e.parse(n,i),t}function po(n,t,e,i){const s=n.iScale,o=n.vScale,r=s.getLabels(),a=s===o,l=[];let c,u,h,d;for(c=e,u=e+i;c=e?1:-1)}function Xh(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basel.controller.options.grouped),o=i.options.stacked,r=[],a=l=>{const c=l.controller.getParsed(e),u=c&&c[l.vScale.axis];if(H(u)||isNaN(u))return!0};for(const l of s)if(!(e!==void 0&&a(l))&&((o===!1||r.indexOf(l.stack)===-1||o===void 0&&l.stack===void 0)&&r.push(l.stack),l.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let o,r;for(o=0,r=e.data.length;ohn(x,a,l,!0)?1:Math.max(v,v*e,_,_*e),g=(x,v,_)=>hn(x,a,l,!0)?-1:Math.min(v,v*e,_,_*e),p=f(0,c,h),m=f(at,u,d),b=g(tt,c,h),y=g(tt+at,u,d);i=(p-b)/2,s=(m-y)/2,o=-(p+b)/2,r=-(m+y)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:r}}class Le extends Kt{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(F(i[t])){const{key:l="value"}=this._parsing;o=c=>+ce(i[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?G*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=_n(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,o,r,a,l;if(!t){for(s=0,o=i.data.datasets.length;st!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),k(Le,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});class jn extends Kt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=Pu(e,s,r);this._drawStart=a,this._drawCount=l,Du(e)&&(a=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:c},t),this.updateElements(s,a,l,t)}updateElements(t,e,i,s){const o=s==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(e,s),d=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=un(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||s==="none",y=e+i,x=t.length;let v=e>0&&this.getParsed(e-1);for(let _=0;_=y){C.skip=!0;continue}const M=this.getParsed(_),T=H(M[f]),A=C[d]=r.getPixelForValue(M[d],_),O=C[f]=o||T?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[f],_);C.skip=isNaN(A)||isNaN(O)||T,C.stop=_>0&&Math.abs(M[d]-v[d])>m,p&&(C.parsed=M,C.raw=c.data[_]),h&&(C.options=u||this.resolveDataElementOptions(_,w.active?"active":s)),b||this.updateElement(w,_,C,s),v=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),r=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}k(jn,"id","line"),k(jn,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),k(jn,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class Un extends Kt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=_n(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return ih.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,s){const o=s==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,h=c.yCenter,d=c.getIndexAngle(0)-.5*tt;let f=d,g;const p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Lt(this.resolveDataElementOptions(t,e).angle||i):0}}k(Un,"id","polarArea"),k(Un,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),k(Un,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Qi extends Le{}k(Qi,"id","pie"),k(Qi,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function ge(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ks{constructor(t){k(this,"options");this.options=t||{}}static override(t){Object.assign(ks.prototype,t)}init(){}formats(){return ge()}parse(){return ge()}format(){return ge()}add(){return ge()}diff(){return ge()}startOf(){return ge()}endOf(){return ge()}}var sa={_date:ks};function Jh(n,t,e,i){const{controller:s,data:o,_sorted:r}=n,a=s._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?vu:xe;if(i){if(s._sharedOptions){const c=o[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const h=l(o,t,e-u),d=l(o,t,e+u);return{lo:h.lo,hi:d.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function xn(n,t,e,i,s){const o=n.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r](t[e],s)&&(o.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,s))}),i&&!a?[]:o}var id={evaluateInteractionItems:xn,modes:{index(n,t,e,i){const s=be(t,n),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Ti(n,s,o,i,r):Si(n,s,o,!1,i,r),l=[];return a.length?(n.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(n,t,e,i){const s=be(t,n),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Ti(n,s,o,i,r):Si(n,s,o,!1,i,r);if(a.length>0){const l=a[0].datasetIndex,c=n.getDatasetMeta(l).data;a=[];for(let u=0;ue.pos===t)}function _o(n,t){return n.filter(e=>oa.indexOf(e.pos)===-1&&e.box.axis===t)}function He(n,t){return n.sort((e,i)=>{const s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function sd(n){const t=[];let e,i,s,o,r,a;for(e=0,i=(n||[]).length;ec.box.fullSize),!0),i=He(We(t,"left"),!0),s=He(We(t,"right")),o=He(We(t,"top"),!0),r=He(We(t,"bottom")),a=_o(t,"x"),l=_o(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:We(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function xo(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function ra(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ld(n,t,e,i){const{pos:s,box:o}=e,r=n.maxPadding;if(!F(s)){e.size&&(n[s]-=e.size);const h=i[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,n[s]+=e.size}o.getPadding&&ra(r,o.getPadding());const a=Math.max(0,t.outerWidth-xo(r,n,"left","right")),l=Math.max(0,t.outerHeight-xo(r,n,"top","bottom")),c=a!==n.w,u=l!==n.h;return n.w=a,n.h=l,e.horizontal?{same:c,other:u}:{same:u,other:c}}function cd(n){const t=n.maxPadding;function e(i){const s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function ud(n,t){const e=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(n?["left","right"]:["top","bottom"])}function Qe(n,t,e,i){const s=[];let o,r,a,l,c,u;for(o=0,r=n.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const u=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/u,hBoxMaxHeight:r/2}),d=Object.assign({},s);ra(d,yt(i));const f=Object.assign({maxPadding:d,w:o,h:r,x:s.left,y:s.top},s),g=rd(l.concat(c),h);Qe(a.fullSize,f,h,g),Qe(l,f,h,g),Qe(c,f,h,g)&&Qe(l,f,h,g),cd(f),vo(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,vo(a.rightAndBottom,f,h,g),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},$(a.chartArea,p=>{const m=p.box;Object.assign(m,n.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class aa{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class hd extends aa{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $n="$chartjs",dd={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},wo=n=>n===null||n==="";function fd(n,t){const e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[$n]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",wo(s)){const o=io(n,"width");o!==void 0&&(n.width=o)}if(wo(i))if(n.style.height==="")n.height=n.width/(t||2);else{const o=io(n,"height");o!==void 0&&(n.height=o)}return n}const la=bh?{passive:!0}:!1;function gd(n,t,e){n.addEventListener(t,e,la)}function pd(n,t,e){n.canvas.removeEventListener(t,e,la)}function md(n,t){const e=dd[n.type]||n.type,{x:i,y:s}=be(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function ii(n,t){for(const e of n)if(e===t||e.contains(t))return!0}function bd(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ii(a.addedNodes,i),r=r&&!ii(a.removedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function yd(n,t,e){const i=n.canvas,s=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ii(a.removedNodes,i),r=r&&!ii(a.addedNodes,i);r&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}const fn=new Map;let Mo=0;function ca(){const n=window.devicePixelRatio;n!==Mo&&(Mo=n,fn.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function _d(n,t){fn.size||window.addEventListener("resize",ca),fn.set(n,t)}function xd(n){fn.delete(n),fn.size||window.removeEventListener("resize",ca)}function vd(n,t,e){const i=n.canvas,s=i&&Ms(i);if(!s)return;const o=Wr((a,l)=>{const c=s.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return r.observe(s),_d(n,o),r}function Oi(n,t,e){e&&e.disconnect(),t==="resize"&&xd(n)}function wd(n,t,e){const i=n.canvas,s=Wr(o=>{n.ctx!==null&&e(md(o,n))},n);return gd(i,t,s),s}class Md extends aa{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(fd(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[$n])return!1;const i=e[$n].initial;["height","width"].forEach(o=>{const r=i[o];H(r)?e.removeAttribute(o):e.setAttribute(o,r)});const s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[$n],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),r={attach:bd,detach:yd,resize:vd}[e]||wd;s[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Oi,detach:Oi,resize:Oi}[e]||pd)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return mh(t,e,i,s)}isAttached(t){const e=Ms(t);return!!(e&&e.isConnected)}}function kd(n){return!ws()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?hd:Md}class Rt{constructor(){k(this,"x");k(this,"y");k(this,"active",!1);k(this,"options");k(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return un(this.x)&&un(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}k(Rt,"defaults",{}),k(Rt,"defaultRoutes");function Cd(n,t){const e=n.options.ticks,i=Pd(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Td(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Sd(t,c,o,r/s),c;const u=Dd(o,t,s);if(r>0){let h,d;const f=r>1?Math.round((l-a)/(r-1)):null;for(Ln(t,c,u,H(f)?0:a-f,a),h=0,d=r-1;hs)return l}return Math.max(s,1)}function Td(n){const t=[];let e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,ko=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Co=(n,t)=>Math.min(t||n,n);function Po(n,t){const e=[],i=n.length/t,s=n.length;let o=0;for(;or+a)))return l}function Rd(n,t){$(n,e=>{const i=e.gc,s=i.length/2;let o;if(s>t){for(o=0;oi?i:e,i=s&&e>i?e:i,{min:Pt(e,Pt(i,e)),max:Pt(i,Pt(e,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 t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){X(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=qu(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,f=ft(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:f/(i-1),h+6>a&&(a=f/(i-(t.offset?.5:1)),l=this.maxHeight-Ve(t.grid)-e.padding-Do(t.title,this.chart.options.font),c=Math.sqrt(h*h+d*d),r=ps(Math.min(Math.asin(ft((u.highest.height+6)/a,-1,1)),Math.asin(ft(l/c,-1,1))-Math.asin(ft(d/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){X(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){X(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Do(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Ve(o)+l):(t.height=this.maxHeight,t.width=Ve(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:d}=this._getLabelSizes(),f=i.padding*2,g=Lt(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=i.mirror?0:m*h.width+p*d.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=i.mirror?0:p*h.width+m*d.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,u,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,f=0;l?c?(d=s*t.width,f=i*e.height):(d=i*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,f=e.width/2),this.paddingLeft=Math.max((d-u+r)*this.width/(this.width-u),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let u=e.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=e.height,h=0),this.paddingTop=u+r,this.paddingBottom=h+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(){X(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[T]||0,height:a[T]||0});return{first:M(0),last:M(e-1),widest:M(w),highest:M(C),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return xu(this._alignToPixels?fe(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:l/s:l*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=Ve(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(U){return fe(i,U,p)};let y,x,v,_,w,C,M,T,A,O,R,st;if(r==="top")y=b(this.bottom),C=this.bottom-d,T=y-m,O=b(t.top)+m,st=t.bottom;else if(r==="bottom")y=b(this.top),O=t.top,st=b(t.bottom)-m,C=y+m,T=this.top+d;else if(r==="left")y=b(this.right),w=this.right-d,M=y-m,A=b(t.left)+m,R=t.right;else if(r==="right")y=b(this.left),A=t.left,R=b(t.right)-m,w=y+m,M=this.left+d;else if(e==="x"){if(r==="center")y=b((t.top+t.bottom)/2+.5);else if(F(r)){const U=Object.keys(r)[0],Q=r[U];y=b(this.chart.scales[U].getPixelForValue(Q))}O=t.top,st=t.bottom,C=y+m,T=C+d}else if(e==="y"){if(r==="center")y=b((t.left+t.right)/2);else if(F(r)){const U=Object.keys(r)[0],Q=r[U];y=b(this.chart.scales[U].getPixelForValue(Q))}w=y-m,M=w-d,A=t.left,R=t.right}const gt=S(s.ticks.maxTicksLimit,h),W=Math.max(1,Math.ceil(h/gt));for(x=0;x0&&(Ft-=St/2);break}Qt={left:Ft,top:Jt,width:St+Tt.width,height:Zt+Tt.height,color:W.backdropColor}}m.push({label:v,font:T,textOffset:R,options:{rotation:p,color:Q,strokeColor:Mt,strokeWidth:lt,textAlign:Gt,textBaseline:st,translation:[_,w],backdrop:Qt}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Lt(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,u;return e==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=s.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,r;for(o=0,r=e.length;o{const i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");nt.route(o,s,l,a)})}function Wd(n){return"id"in n&&"defaults"in n}class Hd{constructor(){this.controllers=new Rn(Kt,"datasets",!0),this.elements=new Rn(Rt,"elements"),this.plugins=new Rn(Object,"plugins"),this.scales=new Rn(ke,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):$(s,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){const s=gs(t);X(i["before"+s],[],i),e[t](i),X(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Yd(n){const t={},e=[],i=Object.keys(Et.plugins.items);for(let o=0;o1&&To(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function So(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function Gd(n,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return So(n,"x",e[0])||So(n,"y",e[0])}return{}}function Qd(n,t){const e=Me[n.type]||{scales:{}},i=t.scales||{},s=Zi(n.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!F(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=Ji(r,a,Gd(r,n),nt.scales[a.type]),c=Xd(l,s),u=e.scales||{};o[r]=en(Object.create(null),[{axis:l},a,u[l],u[c]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,l=r.indexAxis||Zi(a,t),u=(Me[a]||{}).scales||{};Object.keys(u).forEach(h=>{const d=qd(h,l),f=r[d+"AxisID"]||d;o[f]=o[f]||Object.create(null),en(o[f],[{axis:d},i[f],u[h]])})}),Object.keys(o).forEach(r=>{const a=o[r];en(a,[nt.scales[a.type],nt.scale])}),o}function ua(n){const t=n.options||(n.options={});t.plugins=S(t.plugins,{}),t.scales=Qd(n,t)}function ha(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Zd(n){return n=n||{},n.data=ha(n.data),ua(n),n}const Oo=new Map,da=new Set;function Fn(n,t){let e=Oo.get(n);return e||(e=t(),Oo.set(n,e),da.add(e)),e}const Ye=(n,t,e)=>{const i=ce(t,e);i!==void 0&&n.add(i)};class Jd{constructor(t){this._config=Zd(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=ha(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ua(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Fn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Fn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Fn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return Fn(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;const l=new Set;e.forEach(u=>{t&&(l.add(t),u.forEach(h=>Ye(l,t,h))),u.forEach(h=>Ye(l,s,h)),u.forEach(h=>Ye(l,Me[o]||{},h)),u.forEach(h=>Ye(l,nt,h)),u.forEach(h=>Ye(l,Ki,h))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),da.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Me[e]||{},nt.datasets[e]||{},{type:e},nt,Ki]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Ao(this._resolverCache,t,s);let l=r;if(ef(r,e)){o.$shared=!1,i=ue(i)?i():i;const c=this.createResolver(t,i,a);l=Ee(r,i,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,i=[""],s){const{resolver:o}=Ao(this._resolverCache,t,i);return F(e)?Ee(o,e,void 0,s):o}}function Ao(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));const s=e.join();let o=i.get(s);return o||(o={resolver:_s(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(s,o)),o}const tf=n=>F(n)&&Object.getOwnPropertyNames(n).some(t=>ue(n[t]));function ef(n,t){const{isScriptable:e,isIndexable:i}=Ur(n);for(const s of t){const o=e(s),r=i(s),a=(r||o)&&n[s];if(o&&(ue(a)||tf(a))||r&&K(a))return!0}return!1}var nf="4.4.1";const sf=["top","bottom","left","right","chartArea"];function Lo(n,t){return n==="top"||n==="bottom"||sf.indexOf(n)===-1&&t==="x"}function Ro(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Fo(n){const t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),X(e&&e.onComplete,[n],t)}function of(n){const t=n.chart,e=t.options.animation;X(e&&e.onProgress,[n],t)}function fa(n){return ws()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const qn={},Io=n=>{const t=fa(n);return Object.values(qn).filter(e=>e.canvas===t).pop()};function rf(n,t,e){const i=Object.keys(n);for(const s of i){const o=+s;if(o>=t){const r=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=r)}}}function af(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}function In(n,t,e){return n.options.clip?n[e]:t[e]}function lf(n,t){const{xScale:e,yScale:i}=n;return e&&i?{left:In(e,t,"left"),right:In(e,t,"right"),top:In(i,t,"top"),bottom:In(i,t,"bottom")}:t}class mt{static register(...t){Et.add(...t),Eo()}static unregister(...t){Et.remove(...t),Eo()}constructor(t,e){const i=this.config=new Jd(e),s=fa(t),o=Io(s);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||kd(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=lu(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,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 Vd,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ku(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],qn[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}jt.listen(this,"complete",Fo),jt.listen(this,"progress",of),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return H(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Et}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():no(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Js(this.canvas,this.ctx),this}stop(){return jt.stop(this),this}resize(t,e){jt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,no(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),X(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};$(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ji(r,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),$(o,r=>{const a=r.options,l=a.id,c=Ji(l,a),u=S(a.type,r.dtype);(a.position===void 0||Lo(a.position,c)!==Lo(r.dposition))&&(a.position=r.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===u)h=i[l];else{const d=Et.getScale(u);h=new d({id:l,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,t)}),$(s,(r,a)=>{r||delete i[a]}),$(i,r=>{se.configure(this,r,r.options),se.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,u=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ro("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){$(this.scales,t=>{se.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Us(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of e){const r=i==="_removeElements"?-o:o;rf(t,s,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),s=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;se.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],$(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,o=lf(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(s&&gi(e,{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}),t.controller.draw(),s&&pi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Xt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const o=id.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=he(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,s);cn(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),jt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},s=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};$(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){$(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},$(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),a=0,l=t.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}});!Zn(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:o}=this,r=e,a=this._getActiveElements(t,s,i,r),l=gu(t),c=af(t,this._lastEvent,i,l);i&&(this._lastEvent=null,X(o.onHover,[t,a,this],this),l&&X(o.onClick,[t,a,this],this));const u=!Zn(a,s);return(u||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=c,u}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}}k(mt,"defaults",nt),k(mt,"instances",qn),k(mt,"overrides",Me),k(mt,"registry",Et),k(mt,"version",nf),k(mt,"getChart",Io);function Eo(){return $(mt.instances,n=>n._plugins.invalidate())}function cf(n,t,e){const{startAngle:i,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=s/a;n.beginPath(),n.arc(o,r,a,i-c,e+c),l>s?(c=s/l,n.arc(o,r,l,e+c,i-c,!0)):n.arc(o,r,s,e+at,i-at),n.closePath(),n.clip()}function uf(n){return ys(n,["outerStart","outerEnd","innerStart","innerEnd"])}function hf(n,t,e,i){const s=uf(n.options.borderRadius),o=(e-t)/2,r=Math.min(o,i*t/2),a=l=>{const c=(e-Math.min(o,l))*i/2;return ft(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:ft(s.innerStart,0,r),innerEnd:ft(s.innerEnd,0,r)}}function Pe(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function si(n,t,e,i,s,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+i+e-c,0),d=u>0?u+i+e+c:0;let f=0;const g=s-l;if(i){const W=u>0?u-i:0,U=h>0?h-i:0,Q=(W+U)/2,Mt=Q!==0?g*Q/(Q+i):g;f=(g-Mt)/2}const p=Math.max(.001,g*h-e/tt)/h,m=(g-p)/2,b=l+m+f,y=s-m-f,{outerStart:x,outerEnd:v,innerStart:_,innerEnd:w}=hf(t,d,h,y-b),C=h-x,M=h-v,T=b+x/C,A=y-v/M,O=d+_,R=d+w,st=b+_/O,gt=y-w/R;if(n.beginPath(),o){const W=(T+A)/2;if(n.arc(r,a,h,T,W),n.arc(r,a,h,W,A),v>0){const lt=Pe(M,A,r,a);n.arc(lt.x,lt.y,v,A,y+at)}const U=Pe(R,y,r,a);if(n.lineTo(U.x,U.y),w>0){const lt=Pe(R,gt,r,a);n.arc(lt.x,lt.y,w,y+at,gt+Math.PI)}const Q=(y-w/d+(b+_/d))/2;if(n.arc(r,a,d,y-w/d,Q,!0),n.arc(r,a,d,Q,b+_/d,!0),_>0){const lt=Pe(O,st,r,a);n.arc(lt.x,lt.y,_,st+Math.PI,b-at)}const Mt=Pe(C,b,r,a);if(n.lineTo(Mt.x,Mt.y),x>0){const lt=Pe(C,T,r,a);n.arc(lt.x,lt.y,x,b-at,T)}}else{n.moveTo(r,a);const W=Math.cos(T)*h+r,U=Math.sin(T)*h+a;n.lineTo(W,U);const Q=Math.cos(A)*h+r,Mt=Math.sin(A)*h+a;n.lineTo(Q,Mt)}n.closePath()}function df(n,t,e,i,s){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){si(n,t,e,i,l,s);for(let c=0;c=G||hn(r,l,c),m=qt(a,u+f,h+f);return p&&m}getCenterPoint(e){const{x:i,y:s,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:u}=this.options,h=(o+r)/2,d=(a+l+u+c)/2;return{x:i+Math.cos(h)*d,y:s+Math.sin(h)*d}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:i,circumference:s}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=s>G?Math.floor(s/G):0,s===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(tt,s||0)),u=o*c;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,df(e,this,u,r,a),ff(e,this,u,r,a),e.restore()}}k(Ze,"id","arc"),k(Ze,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),k(Ze,"defaultRoutes",{backgroundColor:"backgroundColor"}),k(Ze,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function ga(n,t,e=t){n.lineCap=S(e.borderCapStyle,t.borderCapStyle),n.setLineDash(S(e.borderDash,t.borderDash)),n.lineDashOffset=S(e.borderDashOffset,t.borderDashOffset),n.lineJoin=S(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=S(e.borderWidth,t.borderWidth),n.strokeStyle=S(e.borderColor,t.borderColor)}function gf(n,t,e){n.lineTo(e.x,e.y)}function pf(n){return n.stepped?Bu:n.tension||n.cubicInterpolationMode==="monotone"?Nu:gf}function pa(n,t,e={}){const i=n.length,{start:s=0,end:o=i-1}=e,{start:r,end:a}=t,l=Math.max(s,r),c=Math.min(o,a),u=sa&&o>a;return{count:i,start:l,loop:t.loop,ilen:c(r+(c?a-v:v))%o,x=()=>{p!==m&&(n.lineTo(u,m),n.lineTo(u,p),n.lineTo(u,b))};for(l&&(f=s[y(0)],n.moveTo(f.x,f.y)),d=0;d<=a;++d){if(f=s[y(d)],f.skip)continue;const v=f.x,_=f.y,w=v|0;w===g?(_m&&(m=_),u=(h*u+v)/++h):(x(),n.lineTo(v,_),g=w,h=0,p=m=_),b=_}x()}function ts(n){const t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?bf:mf}function yf(n){return n.stepped?yh:n.tension||n.cubicInterpolationMode==="monotone"?_h:ye}function _f(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),ga(n,t.options),n.stroke(s)}function xf(n,t,e,i){const{segments:s,options:o}=t,r=ts(t);for(const a of s)ga(n,o,a.style),n.beginPath(),r(n,t,a,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}const vf=typeof Path2D=="function";function wf(n,t,e,i){vf&&!t.options.segment?_f(n,t,e,i):xf(n,t,e,i)}class oe extends Rt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;uh(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ch(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],o=this.points,r=ta(this,{property:e,start:s,end:s});if(!r.length)return;const a=[],l=yf(i);let c,u;for(c=0,u=r.length;ct!=="borderDash"&&t!=="fill"});function zo(n,t,e,i){const s=n.options,{[e]:o}=n.getProps([e],i);return Math.abs(t-o)n.replace("rgb(","rgba(").replace(")",", 0.5)"));function ba(n){return es[n%es.length]}function ya(n){return Bo[n%Bo.length]}function Tf(n,t){return n.borderColor=ba(t),n.backgroundColor=ya(t),++t}function Sf(n,t){return n.backgroundColor=n.data.map(()=>ba(t++)),t}function Of(n,t){return n.backgroundColor=n.data.map(()=>ya(t++)),t}function Af(n){let t=0;return(e,i)=>{const s=n.getDatasetMeta(i).controller;s instanceof Le?t=Sf(e,t):s instanceof Un?t=Of(e,t):s&&(t=Tf(e,t))}}function No(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Lf(n){return n&&(n.borderColor||n.backgroundColor)}var Rf={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;const{data:{datasets:i},options:s}=n.config,{elements:o}=s;if(!e.forceOverride&&(No(i)||Lf(s)||o&&No(o)))return;const r=Af(n);i.forEach(r)}};function Ff(n,t,e){const i=n.segments,s=n.points,o=t.points,r=[];for(const a of i){let{start:l,end:c}=a;c=Cs(l,c,s);const u=ns(e,s[l],s[c],a.loop);if(!t.segments){r.push({source:a,target:u,start:s[l],end:s[c]});continue}const h=ta(t,u);for(const d of h){const f=ns(e,o[d.start],o[d.end],d.loop),g=Jr(a,s,f);for(const p of g)r.push({source:p,target:d,start:{[e]:Wo(u,f,"start",Math.max)},end:{[e]:Wo(u,f,"end",Math.min)}})}}return r}function ns(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=Dt(s),o=Dt(o)),{property:n,start:s,end:o}}function If(n,t){const{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Cs(r,a,s);const l=s[r],c=s[a];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Cs(n,t,e){for(;t>n;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Wo(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function _a(n,t){let e=[],i=!1;return K(n)?(i=!0,e=n):e=If(n,t),e.length?new oe({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Ho(n){return n&&n.fill!==!1}function Ef(n,t,e){let s=n[t].fill;const o=[t];let r;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!et(s))return s;if(r=n[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function zf(n,t,e){const i=Hf(n);if(F(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return et(s)&&Math.floor(s)===s?Bf(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Bf(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function Nf(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:F(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Wf(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:F(n)?i=n.value:i=t.getBaseValue(),i}function Hf(n){const t=n.options,e=t.fill;let i=S(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Vf(n){const{scale:t,index:e,line:i}=n,s=[],o=i.segments,r=i.points,a=Yf(t,e);a.push(_a({x:null,y:t.bottom},i));for(let l=0;l=0;--r){const a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&Ri(n.ctx,a,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;Ho(o)&&Ri(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){const i=t.meta.$filler;!Ho(i)||e.drawTime!=="beforeDatasetDraw"||Ri(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Uo=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},tg=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index;class $o extends Rt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=X(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=ut(i.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Uo(i,o);let c,u;e.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(r,o,a,l)+10):(u=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+a;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,f=-u;return this.legendItems.forEach((g,p)=>{const m=i+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(h+=u,c[c.length-(p>0?0:1)]=0,f+=u,d++),l[p]={left:0,top:f,row:d,width:m,height:s},c[c.length-1]+=m+a}),h}_fitCols(t,e,i,s){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=r-t;let h=a,d=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:y,itemHeight:x}=eg(i,e,o,m,s);b>0&&f+x+2*a>u&&(h+=d+a,c.push({width:d,height:f}),g+=d+a,p++,d=f=0),l[b]={left:g,top:f,col:p,width:y,height:x},d=Math.max(d,y),f+=x+a}),h+=d,c.push({width:d,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,r=Fe(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=kt(i,this.left+s,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=kt(i,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+t+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=kt(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=kt(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;gi(t,this),this._draw(),pi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:r}=t,a=nt.color,l=Fe(t.rtl,this.left,this.width),c=ut(r.font),{padding:u}=r,h=c.size,d=h/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=Uo(r,h),b=function(w,C,M){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const T=S(M.lineWidth,1);if(s.fillStyle=S(M.fillStyle,a),s.lineCap=S(M.lineCap,"butt"),s.lineDashOffset=S(M.lineDashOffset,0),s.lineJoin=S(M.lineJoin,"miter"),s.lineWidth=T,s.strokeStyle=S(M.strokeStyle,a),s.setLineDash(S(M.lineDash,[])),r.usePointStyle){const A={radius:p*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:T},O=l.xPlus(w,g/2),R=C+d;Yr(s,A,O,R,r.pointStyleWidth&&g)}else{const A=C+Math.max((h-p)/2,0),O=l.leftForLtr(w,g),R=ve(M.borderRadius);s.beginPath(),Object.values(R).some(st=>st!==0)?dn(s,{x:O,y:A,w:g,h:p,radius:R}):s.rect(O,A,g,p),s.fill(),T!==0&&s.stroke()}s.restore()},y=function(w,C,M){Ie(s,M.text,w,C+m/2,c,{strikethrough:M.hidden,textAlign:l.textAlign(M.textAlign)})},x=this.isHorizontal(),v=this._computeTitleHeight();x?f={x:kt(o,this.left+u,this.right-i[0]),y:this.top+u+v,line:0}:f={x:this.left+u,y:kt(o,this.top+v+u,this.bottom-e[0].height),line:0},Gr(this.ctx,t.textDirection);const _=m+u;this.legendItems.forEach((w,C)=>{s.strokeStyle=w.fontColor,s.fillStyle=w.fontColor;const M=s.measureText(w.text).width,T=l.textAlign(w.textAlign||(w.textAlign=r.textAlign)),A=g+d+M;let O=f.x,R=f.y;l.setWidth(this.width),x?C>0&&O+A+u>this.right&&(R=f.y+=_,f.line++,O=f.x=kt(o,this.left+u,this.right-i[f.line])):C>0&&R+_>this.bottom&&(O=f.x=O+e[f.line].width+u,f.line++,R=f.y=kt(o,this.top+v+u,this.bottom-e[f.line].height));const st=l.x(O);if(b(st,R,w),O=Cu(T,O+g+d,x?O+A:this.right,t.rtl),y(l.x(O),R,w),x)f.x+=A+u;else if(typeof w.text!="string"){const gt=c.lineHeight;f.y+=va(w,gt)+u}else f.y+=_}),Qr(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ut(e.font),s=yt(e.padding);if(!e.display)return;const o=Fe(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=i.size/2,c=s.top+l;let u,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,h=kt(t.align,h,this.right-d);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);u=c+kt(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=kt(a,h,h+d);r.textAlign=o.textAlign(Hr(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,Ie(r,e.text,f,u,i)}_computeTitleHeight(){const t=this.options.title,e=ut(t.font),i=yt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(qt(t,this.left,this.right)&&qt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>r.length?o:r)),t+e.size/2+i.measureText(s).width}function ig(n,t,e){let i=n;return typeof t.text!="string"&&(i=va(t,e)),i}function va(n,t){const e=n.text?n.text.length:0;return t*e}function sg(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var og={id:"legend",_element:$o,start(n,t,e){const i=n.legend=new $o({ctx:n.ctx,options:e,chart:n});se.configure(n,i,e),se.addBox(n,i)},stop(n){se.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){const i=n.legend;se.configure(n,i,e),i.options=e},afterUpdate(n){const t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){const i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){const t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),u=yt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}};const Je={average(n){if(!n.length)return!1;let t,e,i=0,s=0,o=0;for(t=0,e=n.length;t-1?n.split(` -`):n}function rg(n,t){const{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:n,label:r,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function $o(n,t){const e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:r,boxHeight:a}=t,l=ut(t.bodyFont),c=ut(t.titleFont),u=ut(t.footerFont),h=o.length,d=s.length,f=i.length,g=yt(t.padding);let p=g.height,m=0,b=i.reduce((v,_)=>v+_.before.length+_.lines.length+_.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let y=0;const x=function(v){m=Math.max(m,e.measureText(v).width+y)};return e.save(),e.font=c.string,$(n.title,x),e.font=l.string,$(n.beforeBody.concat(n.afterBody),x),y=t.displayColors?r+2+t.boxPadding:0,$(i,v=>{$(v.before,x),$(v.lines,x),$(v.after,x)}),y=0,e.font=u.string,$(n.footer,x),e.restore(),m+=g.width,{width:m,height:p}}function ag(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function lg(n,t,e,i){const{x:s,width:o}=i,r=e.caretSize+e.caretPadding;if(n==="left"&&s+o+r>t.width||n==="right"&&s-o-r<0)return!0}function cg(n,t,e,i){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),lg(c,n,t,e)&&(c="center"),c}function qo(n,t,e){const i=e.yAlign||t.yAlign||ag(n,e);return{xAlign:e.xAlign||t.xAlign||cg(n,t,e,i),yAlign:i}}function ug(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function hg(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Xo(n,t,e,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=n,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:f}=ve(r);let g=ug(t,a);const p=hg(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(u,d)+s:a==="right"&&(g+=Math.max(h,f)+s),{x:ft(g,0,i.width-t.width),y:ft(p,0,i.height-t.height)}}function En(n,t,e){const i=yt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Ko(n){return Ft([],jt(n))}function dg(n,t,e){return he(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Go(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const wa={beforeTitle:Wt,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?wa[t].call(e,i):s}class is extends Lt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new ea(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=dg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=_t(i,"beforeTitle",this,t),o=_t(i,"title",this,t),r=_t(i,"afterTitle",this,t);let a=[];return a=Ft(a,jt(s)),a=Ft(a,jt(o)),a=Ft(a,jt(r)),a}getBeforeBody(t,e){return Ko(_t(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return $(t,o=>{const r={before:[],lines:[],after:[]},a=Go(i,o);Ft(r.before,jt(_t(a,"beforeLabel",this,o))),Ft(r.lines,_t(a,"label",this,o)),Ft(r.after,jt(_t(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return Ko(_t(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=_t(i,"beforeFooter",this,t),o=_t(i,"footer",this,t),r=_t(i,"afterFooter",this,t);let a=[];return a=Ft(a,jt(s)),a=Ft(a,jt(o)),a=Ft(a,jt(r)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(u,h,d,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),$(a,u=>{const h=Go(t.callbacks,u);s.push(_t(h,"labelColor",this,u)),o.push(_t(h,"labelPointStyle",this,u)),r.push(_t(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Je[i.position].call(this,s,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=$o(this,i),c=Object.assign({},a,l),u=qo(this.chart,i,c),h=Xo(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.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),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=ve(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,b,y,x,v,_;return o==="center"?(v=f+p/2,s==="left"?(m=d,b=m-r,x=v+r,_=v-r):(m=d+g,b=m+r,x=v-r,_=v+r),y=m):(s==="left"?b=d+Math.max(l,u)+r:s==="right"?b=d+g-Math.max(c,h)-r:b=this.caretX,o==="top"?(x=f,v=x-r,m=b-r,y=b+r):(x=f+p,v=x+r,m=b+r,y=b-r),_=x),{x1:m,x2:b,x3:y,y1:x,y2:v,y3:_}}drawTitle(t,e,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Fe(i.rtl,this.x,this.width);for(t.x=En(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",r=ut(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,l=0;ly!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,dn(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),dn(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,h=ut(i.bodyFont);let d=h.lineHeight,f=0;const g=Fe(i.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,y,x,v,_,w,C;for(e.textAlign=r,e.textBaseline="middle",e.font=h.string,t.x=En(this,m,i),e.fillStyle=i.bodyColor,$(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+u:c+2+u:0,v=0,w=s.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Je[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=$o(this,t),l=Object.assign({},r,this._size),c=qo(e,t,l),u=Xo(t,l,c,e);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=yt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),Gr(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Qr(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Zn(i,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),a=this._positionChanged(r,t),l=e||!Zn(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e;const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:i,caretY:s,options:o}=this,r=Je[o.position].call(this,t,e);return r!==!1&&(i!==r.x||s!==r.y)}}k(is,"positioners",Je);var fg={id:"tooltip",_element:is,positioners:Je,afterInit(n,t,e){e&&(n.tooltip=new is({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.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:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.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:wa},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const gg=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function pg(n,t,e,i){const s=n.indexOf(t);if(s===-1)return gg(n,t,e,i);const o=n.lastIndexOf(t);return s!==o?e:s}const mg=(n,t)=>n===null?null:ft(Math.round(n),0,t);function Qo(n){const t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}k(ss,"id","category"),k(ss,"defaults",{ticks:{callback:Qo}});function bg(n,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=n,f=o||1,g=u-1,{min:p,max:m}=t,b=!H(r),y=!H(a),x=!H(c),v=(m-p)/(h+1);let _=$s((m-p)/g/f)*f,w,C,M,T;if(_<1e-14&&!b&&!y)return[{value:p},{value:m}];T=Math.ceil(m/_)-Math.floor(p/_),T>g&&(_=$s(T*_/g/f)*f),H(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(C=Math.floor(p/_)*_,M=Math.ceil(m/_)*_):(C=p,M=m),b&&y&&o&&yu((a-r)/o,_/1e3)?(T=Math.round(Math.min((a-r)/_,u)),_=(a-r)/T,C=r,M=a):x?(C=b?r:C,M=y?a:M,T=c-1,_=(M-C)/T):(T=(M-C)/_,nn(T,Math.round(T),_/1e3)?T=Math.round(T):T=Math.ceil(T));const A=Math.max(qs(_),qs(C));w=Math.pow(10,H(l)?A:l),C=Math.round(C*w)/w,M=Math.round(M*w)/w;let O=0;for(b&&(d&&C!==r?(e.push({value:r}),Ca)break;e.push({value:R})}return y&&d&&M!==a?e.length&&nn(e[e.length-1].value,a,Zo(a,v,n))?e[e.length-1].value=a:e.push({value:a}):(!y||M===a)&&e.push({value:M}),e}function Zo(n,t,{horizontal:e,minRotation:i}){const s=At(i),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+n).length;return Math.min(t/o,r)}class oi extends ke{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return H(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=i?o:l;if(t){const l=Bt(s),c=Bt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=bg(s,o);return t.bounds==="ticks"&&Fr(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return _n(t,this.chart.options.locale,this.options.ticks.format)}}class os extends oi{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=et(t)?t:0,this.max=et(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=At(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}k(os,"id","linear"),k(os,"defaults",{ticks:{callback:fi.formatters.numeric}});const gn=n=>Math.floor(ie(n)),pe=(n,t)=>Math.pow(10,gn(n)+t);function Jo(n){return n/Math.pow(10,gn(n))===1}function tr(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function yg(n,t){const e=t-n;let i=gn(e);for(;tr(n,t,i)>10;)i++;for(;tr(n,t,i)<10;)i--;return Math.min(i,gn(n))}function _g(n,{min:t,max:e}){t=Pt(n.min,t);const i=[],s=gn(t);let o=yg(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,u=Math.floor((t-l)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,o)),d=Pt(n.min,Math.round((l+u+h*Math.pow(10,o))*r)/r);for(;d=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),d=Math.round((l+u+h*Math.pow(10,o))*r)/r;const f=Pt(n.max,d);return i.push({value:f,major:Jo(f),significand:h}),i}class er extends ke{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=oi.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return et(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=et(t)?Math.max(0,t):null,this.max=et(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!et(this._userMin)&&(this.min=t===pe(this.min,0)?pe(this.min,-1):pe(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const o=a=>i=t?i:a,r=a=>s=e?s:a;i===s&&(i<=0?(o(1),r(10)):(o(pe(i,-1)),r(pe(s,1)))),i<=0&&o(pe(s,-1)),s<=0&&r(pe(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=_g(e,this);return t.bounds==="ticks"&&Fr(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":_n(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ie(t),this._valueRange=ie(this.max)-ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}k(er,"id","logarithmic"),k(er,"defaults",{ticks:{callback:fi.formatters.logarithmic,major:{enabled:!0}}});function rs(n){const t=n.ticks;if(t.display&&n.display){const e=yt(t.backdropPadding);return S(t.font&&t.font.size,nt.font.size)+e.height}return 0}function xg(n,t,e){return e=K(e)?e:[e],{w:zu(n,t.string,e),h:e.length*t.lineHeight}}function nr(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function vg(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,r=n.options.pointLabels,a=r.centerPointLabels?tt/o:0;for(let l=0;lt.r&&(a=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,n.b=Math.max(n.b,t.b+l))}function Mg(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=n.getPointPosition(t,i+s+r,o),c=Math.round(ps(Dt(l.angle+at))),u=Tg(l.y,a.h,c),h=Pg(c),d=Dg(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function kg(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:o}=n;return!(qt({x:e,y:i},t)||qt({x:e,y:o},t)||qt({x:s,y:i},t)||qt({x:s,y:o},t))}function Cg(n,t,e){const i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:rs(o)/2,additionalAngle:r?tt/s:0};let c;for(let u=0;u270||e<90)&&(n-=t),n}function Sg(n,t,e){const{left:i,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!H(a)){const l=ve(t.borderRadius),c=yt(t.backdropPadding);n.fillStyle=a;const u=i-c.left,h=s-c.top,d=o-i+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),dn(n,{x:u,y:h,w:d,h:f,radius:l}),n.fill()):n.fillRect(u,h,d,f)}}function Og(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const o=n._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(n.getPointLabelContext(s));Sg(e,r,o);const a=ut(r.font),{x:l,y:c,textAlign:u}=o;Ie(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function Ma(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,G);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=X(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?vg(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=G/(this._pointLabels.length||1),i=this.options.startAngle||0;return Dt(t*e+At(i))}getDistanceFromCenterForValue(t){if(H(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(H(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){l=this.getDistanceFromCenterForValue(u.value);const d=this.getContext(h),f=s.setContext(d),g=o.setContext(d);Ag(this,f,l,r,g)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=ut(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=yt(c.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}Ie(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}k(zn,"id","radialLinear"),k(zn,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),k(zn,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),k(zn,"descriptors",{angleLines:{_fallback:"grid"}});const bi={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}},xt=Object.keys(bi);function ir(n,t){return n-t}function sr(n,t){if(H(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),et(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(un(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function or(n,t,e,i){const s=xt.length;for(let o=xt.indexOf(n);o=xt.indexOf(e);o--){const r=xt[o];if(bi[r].common&&n._adapter.diff(s,i,r)>=t-1)return r}return xt[e?xt.indexOf(e):0]}function Fg(n){for(let t=xt.indexOf(n)+1,e=xt.length;t=t?e[i]:e[s];n[o]=!0}}function Ig(n,t,e,i){const s=n._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function ar(n,t,e){const i=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=ft(e,0,r),i=ft(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||or(o.minUnit,e,i,this._getLabelCapacity(e)),a=S(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=un(l)||l===!0,u={};let h=e,d,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,s){const o=this.options,r=o.ticks.callback;if(r)return X(r,[t,e,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=i[e],f=c&&h&&d&&d.major;return this._adapter.format(t,s||(f?h:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=xe(n,"pos",t)),{pos:o,time:a}=n[i],{pos:r,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=xe(n,"time",t)),{time:o,pos:a}=n[i],{time:r,pos:l}=n[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class lr extends pn{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Bn(e,this.min),this._tableRange=Bn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=s.length;rs-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Bn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Bn(this._table,i*this._tableRange+this._minPos,!0)}}k(lr,"id","timeseries"),k(lr,"defaults",pn.defaults);function yi(n){return n==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:n==="pie"?{type:"pie",data:{datasets:[]}}:n==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(t){let e=t.dataset.currency_code;return V(t.raw,e)}}}},maintainAspectRatio:!1,scales:{}}}:n==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(t){let e=t.dataset.currency_code;return V(t.raw,e)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let ri=new dt("#36a2eb"),Re=new dt("#ff6384"),mn=new dt("#4bc0c0"),ka=new dt("#ff9f40"),Eg=new dt("#9966ff"),zg=new dt("#ffcd56"),Bg=new dt("#c9cbcf"),cr=0;window.theme==="dark"&&(Re.darken(.3).desaturate(.3),mn.darken(.3).desaturate(.3),ri.darken(.3).desaturate(.3),ka.darken(.3).desaturate(.3));let Fi=[Re,ka,ri,mn,Eg,zg,Bg,mn];function De(n,t){let e={borderColor:Re.rgbString(),backgroundColor:Re.rgbString()},i;switch(n){default:let o=Math.floor(cr/2)%Fi.length;i=new dt(Fi[o].rgbString()),i.lighten(.38),e={borderColor:Fi[o].hexString(),backgroundColor:i.hexString()};break;case"spent":i=new dt(ri.rgbString()),i.lighten(.38),e={borderColor:ri.rgbString(),backgroundColor:i.rgbString()};break;case"left":i=new dt(mn.rgbString()),i.lighten(.38),e={borderColor:mn.rgbString(),backgroundColor:i.rgbString()};break;case"overspent":i=new dt(Re.rgbString()),i.lighten(.22),e={borderColor:Re.rgbString(),backgroundColor:i.rgbString()};break}return cr++,t==="border"?e.borderColor:t==="background"?e.backgroundColor:"#FF0000"}let me=[],je=null,Ii=null,Ei=!1;const Ng=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Bc("autoConversion",this.autoConversion)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt("dashboard-accounts-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){console.log(s),this.drawChart(this.generateOptions(s)),this.loading=!1;return}new Nc().dashboard(n,t,null).then(r=>{this.chartData=r.data,window.store.set(e,r.data),console.log(r.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(n){me=[];let t=yi("line");for(let e=0;e0){this.loadingAccounts=!1;return}const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt("dashboard-accounts-data",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){this.accountList=s,this.loadingAccounts=!1;return}const o=10;let r=0,a=0,l=[];Promise.all([bt("frontpageAccounts")]).then(c=>{r=c[0].length;for(let u in c[0]){let h=c[0];if(h.hasOwnProperty(u)){let d=h[u];new Bs().get(d,new Date(window.store.get("end"))).then(f=>{let g=f.data.data;const p={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new Bs().transactions(g.id,p).then(m=>{let b=[];for(let y=0;y=o);y++){let x=m.data.data[y],v={title:x.attributes.group_title===null?"":x.attributes.group_title,id:x.id,transactions:[]};for(let _=0;_y.order-x.order),this.accountList=l,this.loadingAccounts=!1,window.store.set(e,l))})})}}})},init(){Promise.all([bt("viewRange","1M"),bt("autoConversion",!1),bt("language","en_US")]).then(n=>{this.autoConversion=n[1],Ei=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{Ei&&(Ii=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{Ei&&(this.loadChart(),this.loadAccounts())})}});let Wg=class{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/budget/dashboard",{params:{start:i,end:s}})}},Ue=[],Nn=null,te=null,zi=!1,Te;const Hg=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,te!==null){this.drawChart(this.generateOptions(te)),this.loading=!1;return}this.getFreshData()}},drawChart(n){if(Nn!==null){Nn.data.datasets=n.data.datasets,Nn.update();return}Nn=new mt(document.querySelector("#budget-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt("dashboard-budgets-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){te=s,this.drawChart(this.generateOptions(te)),this.loading=!1;return}new Wg().dashboard(n,t,null).then(r=>{te=r.data,this.drawChart(this.generateOptions(te)),window.store.set(e,te),this.loading=!1})},generateOptions(n){Ue=[];let t=yi("column");t.options.locale=window.store.get("locale").replace("_","-"),t.options.plugins={tooltip:{callbacks:{title:function(e){return e.label},label:function(e){let i=e.dataset.label||"";return i&&(i+=": "),i+" "+V(e.parsed.y,Ue[e.parsed.x]??"EUR")}}}},t.data={labels:[],datasets:[{label:Te.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:De("spent","background"),borderColor:De("spent","border")},{label:Te.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:De("left","background"),borderColor:De("left","border")},{label:Te.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:De("overspent","background"),borderColor:De("overspent","border")}]};for(const e in n)if(n.hasOwnProperty(e)){let i=n[e],s=i.label+" ("+i.currency_code+")";t.data.labels.push(s),this.autoConversion&&(Ue.push(i.native_currency_code),t.data.datasets[0].data.push(parseFloat(i.native_entries.spent)*-1),t.data.datasets[1].data.push(parseFloat(i.native_entries.left)),t.data.datasets[2].data.push(parseFloat(i.native_entries.overspent))),this.autoConversion||(Ue.push(i.currency_code),t.data.datasets[0].data.push(parseFloat(i.entries.spent)*-1),t.data.datasets[1].data.push(parseFloat(i.entries.left)),t.data.datasets[2].data.push(parseFloat(i.entries.overspent)))}return t.options.scales={y:{ticks:{callback:function(e){return V(e,Ue[0]??"EUR")}}}},t},init(){Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{Te=new li;const t=n[1].replace("-","_");Te.locale=t,ci(Te,t).then(()=>{this.autoConversion=n[0],zi=!0,this.loading===!1&&this.loadChart()})}),window.store.observe("end",()=>{zi&&this.loading===!1&&(te=null,this.loadChart())}),window.store.observe("autoConversion",n=>{zi&&(this.autoConversion=n,this.loading===!1&&this.loadChart())})}});class Vg{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/category/dashboard",{params:{start:i,end:s}})}}let ur=[],$e=null,Se=null,Bi=!1;const Yg=()=>({loading:!1,autoConversion:!1,generateOptions(n){ur=[];let t=yi("column"),e={};for(const s in n)if(n.hasOwnProperty(s)){let o=n[s],r=o.currency_code;this.autoConversion&&(r=o.native_currency_code),e.hasOwnProperty(r)||(e[r]={name:r,yAxisID:"",data:{}},ur.push(r))}for(const s in n)if(n.hasOwnProperty(s)){let o=n[s],r=o.currency_code;this.autoConversion&&(r=o.native_currency_code);for(const a in e)if(e.hasOwnProperty(a)){let l=0;r===a&&(l=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(l=parseFloat(o.native_amount),""+o.native_currency_code)),e[a].data.hasOwnProperty(o.label)&&(e[a].data[o.label]=e[a].data[o.label]+l),e[a].data.hasOwnProperty(o.label)||(e[a].data[o.label]=l)}t.data.labels.includes(o.label)||t.data.labels.push(o.label)}let i=0;for(const s in e){let o="y"+s,r={label:s,currency_code:s,yAxisID:o,data:[]};for(const a in e[s].data)r.data.push(e[s].data[a]);t.data.datasets.push(r),t.options.scales.hasOwnProperty(o)||(t.options.scales[o]={beginAtZero:!0,type:"linear",position:i===1?"right":"left",ticks:{callback:function(a,l,c){return V(a,s)}}},i++)}return t},drawChart(n){if($e!==null){$e.options=n.options,$e.data=n.data,$e.update();return}$e=new mt(document.querySelector("#category-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt("dashboard-categories-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Se=s,this.drawChart(this.generateOptions(Se)),this.loading=!1;return}new Vg().dashboard(n,t,null).then(r=>{Se=r.data,this.drawChart(this.generateOptions(r.data)),window.store.set(e,Se),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,Se!==null){this.drawChart(this.generateOptions(Se)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([bt("autoConversion",!1)]).then(n=>{this.autoConversion=n[0],Bi=!0,this.loadChart()}),window.store.observe("end",()=>{Bi&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",n=>{Bi&&(this.autoConversion=n,this.loadChart())})}});let jg=class{list(t){return vt.get("/api/v2/transactions",{params:t})}};/*! +`):n}function rg(n,t){const{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:n,label:r,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function qo(n,t){const e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:r,boxHeight:a}=t,l=ut(t.bodyFont),c=ut(t.titleFont),u=ut(t.footerFont),h=o.length,d=s.length,f=i.length,g=yt(t.padding);let p=g.height,m=0,b=i.reduce((v,_)=>v+_.before.length+_.lines.length+_.after.length,0);if(b+=n.beforeBody.length+n.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}d&&(p+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let y=0;const x=function(v){m=Math.max(m,e.measureText(v).width+y)};return e.save(),e.font=c.string,$(n.title,x),e.font=l.string,$(n.beforeBody.concat(n.afterBody),x),y=t.displayColors?r+2+t.boxPadding:0,$(i,v=>{$(v.before,x),$(v.lines,x),$(v.after,x)}),y=0,e.font=u.string,$(n.footer,x),e.restore(),m+=g.width,{width:m,height:p}}function ag(n,t){const{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function lg(n,t,e,i){const{x:s,width:o}=i,r=e.caretSize+e.caretPadding;if(n==="left"&&s+o+r>t.width||n==="right"&&s-o-r<0)return!0}function cg(n,t,e,i){const{x:s,width:o}=e,{width:r,chartArea:{left:a,right:l}}=n;let c="center";return i==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),lg(c,n,t,e)&&(c="center"),c}function Xo(n,t,e){const i=e.yAlign||t.yAlign||ag(n,e);return{xAlign:e.xAlign||t.xAlign||cg(n,t,e,i),yAlign:i}}function ug(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function hg(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function Ko(n,t,e,i){const{caretSize:s,caretPadding:o,cornerRadius:r}=n,{xAlign:a,yAlign:l}=e,c=s+o,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:f}=ve(r);let g=ug(t,a);const p=hg(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(u,d)+s:a==="right"&&(g+=Math.max(h,f)+s),{x:ft(g,0,i.width-t.width),y:ft(p,0,i.height-t.height)}}function En(n,t,e){const i=yt(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function Go(n){return It([],Ut(n))}function dg(n,t,e){return he(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Qo(n,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}const wa={beforeTitle:Ht,title(n){if(n.length>0){const t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?wa[t].call(e,i):s}class is extends Rt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new ea(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=dg(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=_t(i,"beforeTitle",this,t),o=_t(i,"title",this,t),r=_t(i,"afterTitle",this,t);let a=[];return a=It(a,Ut(s)),a=It(a,Ut(o)),a=It(a,Ut(r)),a}getBeforeBody(t,e){return Go(_t(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return $(t,o=>{const r={before:[],lines:[],after:[]},a=Qo(i,o);It(r.before,Ut(_t(a,"beforeLabel",this,o))),It(r.lines,_t(a,"label",this,o)),It(r.after,Ut(_t(a,"afterLabel",this,o))),s.push(r)}),s}getAfterBody(t,e){return Go(_t(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=_t(i,"beforeFooter",this,t),o=_t(i,"footer",this,t),r=_t(i,"afterFooter",this,t);let a=[];return a=It(a,Ut(s)),a=It(a,Ut(o)),a=It(a,Ut(r)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(u,h,d,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),$(a,u=>{const h=Qo(t.callbacks,u);s.push(_t(h,"labelColor",this,u)),o.push(_t(h,"labelPointStyle",this,u)),r.push(_t(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let o,r=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const a=Je[i.position].call(this,s,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=qo(this,i),c=Object.assign({},a,l),u=Xo(this.chart,i,c),h=Ko(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.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),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=ve(a),{x:d,y:f}=t,{width:g,height:p}=e;let m,b,y,x,v,_;return o==="center"?(v=f+p/2,s==="left"?(m=d,b=m-r,x=v+r,_=v-r):(m=d+g,b=m+r,x=v-r,_=v+r),y=m):(s==="left"?b=d+Math.max(l,u)+r:s==="right"?b=d+g-Math.max(c,h)-r:b=this.caretX,o==="top"?(x=f,v=x-r,m=b-r,y=b+r):(x=f+p,v=x+r,m=b+r,y=b-r),_=x),{x1:m,x2:b,x3:y,y1:x,y2:v,y3:_}}drawTitle(t,e,i){const s=this.title,o=s.length;let r,a,l;if(o){const c=Fe(i.rtl,this.x,this.width);for(t.x=En(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",r=ut(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,l=0;ly!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,dn(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),dn(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,h=ut(i.bodyFont);let d=h.lineHeight,f=0;const g=Fe(i.rtl,this.x,this.width),p=function(M){e.fillText(M,g.x(t.x+f),t.y+d/2),t.y+=d+o},m=g.textAlign(r);let b,y,x,v,_,w,C;for(e.textAlign=r,e.textBaseline="middle",e.font=h.string,t.x=En(this,m,i),e.fillStyle=i.bodyColor,$(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+u:c+2+u:0,v=0,w=s.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const r=Je[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=qo(this,t),l=Object.assign({},r,this._size),c=Xo(e,t,l),u=Ko(t,l,c,e);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const r=yt(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),Gr(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Qr(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Zn(i,s),r=this._positionChanged(s,e);(o||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),a=this._positionChanged(r,t),l=e||!Zn(r,o)||a;return l&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:i,caretY:s,options:o}=this,r=Je[o.position].call(this,t,e);return r!==!1&&(i!==r.x||s!==r.y)}}k(is,"positioners",Je);var fg={id:"tooltip",_element:is,positioners:Je,afterInit(n,t,e){e&&(n.tooltip=new is({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){const t=n.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){const e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.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:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.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:wa},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const gg=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function pg(n,t,e,i){const s=n.indexOf(t);if(s===-1)return gg(n,t,e,i);const o=n.lastIndexOf(t);return s!==o?e:s}const mg=(n,t)=>n===null?null:ft(Math.round(n),0,t);function Zo(n){const t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}k(ss,"id","category"),k(ss,"defaults",{ticks:{callback:Zo}});function bg(n,t){const e=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=n,f=o||1,g=u-1,{min:p,max:m}=t,b=!H(r),y=!H(a),x=!H(c),v=(m-p)/(h+1);let _=qs((m-p)/g/f)*f,w,C,M,T;if(_<1e-14&&!b&&!y)return[{value:p},{value:m}];T=Math.ceil(m/_)-Math.floor(p/_),T>g&&(_=qs(T*_/g/f)*f),H(l)||(w=Math.pow(10,l),_=Math.ceil(_*w)/w),s==="ticks"?(C=Math.floor(p/_)*_,M=Math.ceil(m/_)*_):(C=p,M=m),b&&y&&o&&yu((a-r)/o,_/1e3)?(T=Math.round(Math.min((a-r)/_,u)),_=(a-r)/T,C=r,M=a):x?(C=b?r:C,M=y?a:M,T=c-1,_=(M-C)/T):(T=(M-C)/_,nn(T,Math.round(T),_/1e3)?T=Math.round(T):T=Math.ceil(T));const A=Math.max(Xs(_),Xs(C));w=Math.pow(10,H(l)?A:l),C=Math.round(C*w)/w,M=Math.round(M*w)/w;let O=0;for(b&&(d&&C!==r?(e.push({value:r}),Ca)break;e.push({value:R})}return y&&d&&M!==a?e.length&&nn(e[e.length-1].value,a,Jo(a,v,n))?e[e.length-1].value=a:e.push({value:a}):(!y||M===a)&&e.push({value:M}),e}function Jo(n,t,{horizontal:e,minRotation:i}){const s=Lt(i),o=(e?Math.sin(s):Math.cos(s))||.001,r=.75*t*(""+n).length;return Math.min(t/o,r)}class oi extends ke{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return H(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const r=l=>s=e?s:l,a=l=>o=i?o:l;if(t){const l=Nt(s),c=Nt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=bg(s,o);return t.bounds==="ticks"&&Ir(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return _n(t,this.chart.options.locale,this.options.ticks.format)}}class os extends oi{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=et(t)?t:0,this.max=et(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=Lt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}k(os,"id","linear"),k(os,"defaults",{ticks:{callback:fi.formatters.numeric}});const gn=n=>Math.floor(ie(n)),pe=(n,t)=>Math.pow(10,gn(n)+t);function tr(n){return n/Math.pow(10,gn(n))===1}function er(n,t,e){const i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function yg(n,t){const e=t-n;let i=gn(e);for(;er(n,t,i)>10;)i++;for(;er(n,t,i)<10;)i--;return Math.min(i,gn(n))}function _g(n,{min:t,max:e}){t=Pt(n.min,t);const i=[],s=gn(t);let o=yg(t,e),r=o<0?Math.pow(10,Math.abs(o)):1;const a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*r)/r,u=Math.floor((t-l)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,o)),d=Pt(n.min,Math.round((l+u+h*Math.pow(10,o))*r)/r);for(;d=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),d=Math.round((l+u+h*Math.pow(10,o))*r)/r;const f=Pt(n.max,d);return i.push({value:f,major:tr(f),significand:h}),i}class nr extends ke{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=oi.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return et(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=et(t)?Math.max(0,t):null,this.max=et(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!et(this._userMin)&&(this.min=t===pe(this.min,0)?pe(this.min,-1):pe(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const o=a=>i=t?i:a,r=a=>s=e?s:a;i===s&&(i<=0?(o(1),r(10)):(o(pe(i,-1)),r(pe(s,1)))),i<=0&&o(pe(s,-1)),s<=0&&r(pe(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e={min:this._userMin,max:this._userMax},i=_g(e,this);return t.bounds==="ticks"&&Ir(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":_n(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ie(t),this._valueRange=ie(this.max)-ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}k(nr,"id","logarithmic"),k(nr,"defaults",{ticks:{callback:fi.formatters.logarithmic,major:{enabled:!0}}});function rs(n){const t=n.ticks;if(t.display&&n.display){const e=yt(t.backdropPadding);return S(t.font&&t.font.size,nt.font.size)+e.height}return 0}function xg(n,t,e){return e=K(e)?e:[e],{w:zu(n,t.string,e),h:e.length*t.lineHeight}}function ir(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function vg(n){const t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,r=n.options.pointLabels,a=r.centerPointLabels?tt/o:0;for(let l=0;lt.r&&(a=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+a)),s.startt.b&&(l=(s.end-t.b)/r,n.b=Math.max(n.b,t.b+l))}function Mg(n,t,e){const i=n.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=e,l=n.getPointPosition(t,i+s+r,o),c=Math.round(ps(Dt(l.angle+at))),u=Tg(l.y,a.h,c),h=Pg(c),d=Dg(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function kg(n,t){if(!t)return!0;const{left:e,top:i,right:s,bottom:o}=n;return!(Xt({x:e,y:i},t)||Xt({x:e,y:o},t)||Xt({x:s,y:i},t)||Xt({x:s,y:o},t))}function Cg(n,t,e){const i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:rs(o)/2,additionalAngle:r?tt/s:0};let c;for(let u=0;u270||e<90)&&(n-=t),n}function Sg(n,t,e){const{left:i,top:s,right:o,bottom:r}=e,{backdropColor:a}=t;if(!H(a)){const l=ve(t.borderRadius),c=yt(t.backdropPadding);n.fillStyle=a;const u=i-c.left,h=s-c.top,d=o-i+c.width,f=r-s+c.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),dn(n,{x:u,y:h,w:d,h:f,radius:l}),n.fill()):n.fillRect(u,h,d,f)}}function Og(n,t){const{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){const o=n._pointLabelItems[s];if(!o.visible)continue;const r=i.setContext(n.getPointLabelContext(s));Sg(e,r,o);const a=ut(r.font),{x:l,y:c,textAlign:u}=o;Ie(e,n._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:u,textBaseline:"middle"})}}function Ma(n,t,e,i){const{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,G);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let r=1;r{const s=X(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?vg(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=G/(this._pointLabels.length||1),i=this.options.startAngle||0;return Dt(t*e+Lt(i))}getDistanceFromCenterForValue(t){if(H(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(H(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t{if(h!==0){l=this.getDistanceFromCenterForValue(u.value);const d=this.getContext(h),f=s.setContext(d),g=o.setContext(d);Ag(this,f,l,r,g)}}),i.display){for(t.save(),a=r-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!e.reverse)return;const c=i.setContext(this.getContext(l)),u=ut(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=yt(c.backdropPadding);t.fillRect(-r/2-h.left,-o-u.size/2-h.top,r+h.width,u.size+h.height)}Ie(t,a.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}k(zn,"id","radialLinear"),k(zn,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:fi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),k(zn,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),k(zn,"descriptors",{angleLines:{_fallback:"grid"}});const bi={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}},xt=Object.keys(bi);function sr(n,t){return n-t}function or(n,t){if(H(t))return null;const e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),et(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(s&&(r=s==="week"&&(un(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,s)),+r)}function rr(n,t,e,i){const s=xt.length;for(let o=xt.indexOf(n);o=xt.indexOf(e);o--){const r=xt[o];if(bi[r].common&&n._adapter.diff(s,i,r)>=t-1)return r}return xt[e?xt.indexOf(e):0]}function Fg(n){for(let t=xt.indexOf(n)+1,e=xt.length;t=t?e[i]:e[s];n[o]=!0}}function Ig(n,t,e,i){const s=n._adapter,o=+s.startOf(t[0].value,i),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+s.add(a,1,i))l=e[a],l>=0&&(t[l].major=!0);return t}function lr(n,t,e){const i=[],s={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=ft(e,0,r),i=ft(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,r=o.unit||rr(o.minUnit,e,i,this._getLabelCapacity(e)),a=S(s.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=un(l)||l===!0,u={};let h=e,d,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=h,f=0;d+p)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const s=this.options.time.displayFormats,o=this._unit,r=e||s[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,s){const o=this.options,r=o.ticks.callback;if(r)return X(r,[t,e,i],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=i[e],f=c&&h&&d&&d.major;return this._adapter.format(t,s||(f?h:u))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=xe(n,"pos",t)),{pos:o,time:a}=n[i],{pos:r,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=xe(n,"time",t)),{time:o,pos:a}=n[i],{time:r,pos:l}=n[s]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class cr extends pn{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Bn(e,this.min),this._tableRange=Bn(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],o=[];let r,a,l,c,u;for(r=0,a=t.length;r=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=s.length;rs-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Bn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return Bn(this._table,i*this._tableRange+this._minPos,!0)}}k(cr,"id","timeseries"),k(cr,"defaults",pn.defaults);function yi(n){return n==="sankey"?{type:"sankey",data:{datasets:[]},options:{animations:!1}}:n==="pie"?{type:"pie",data:{datasets:[]}}:n==="column"?{type:"bar",data:{labels:[],datasets:[]},options:{plugins:{tooltip:{callbacks:{label:function(t){let e=t.dataset.currency_code;return V(t.raw,e)}}}},maintainAspectRatio:!1,scales:{}}}:n==="line"?{options:{plugins:{tooltip:{callbacks:{label:function(t){let e=t.dataset.currency_code;return V(t.raw,e)}}}},maintainAspectRatio:!1,scales:{x:{type:"time",time:{tooltipFormat:"PP"}}}},type:"line",data:{labels:[],datasets:[]}}:{}}let ri=new dt("#36a2eb"),Re=new dt("#ff6384"),mn=new dt("#4bc0c0"),ka=new dt("#ff9f40"),Eg=new dt("#9966ff"),zg=new dt("#ffcd56"),Bg=new dt("#c9cbcf"),ur=0;window.theme==="dark"&&(Re.darken(.3).desaturate(.3),mn.darken(.3).desaturate(.3),ri.darken(.3).desaturate(.3),ka.darken(.3).desaturate(.3));let Fi=[Re,ka,ri,mn,Eg,zg,Bg,mn];function De(n,t){let e={borderColor:Re.rgbString(),backgroundColor:Re.rgbString()},i;switch(n){default:let o=Math.floor(ur/2)%Fi.length;i=new dt(Fi[o].rgbString()),i.lighten(.38),e={borderColor:Fi[o].hexString(),backgroundColor:i.hexString()};break;case"spent":i=new dt(ri.rgbString()),i.lighten(.38),e={borderColor:ri.rgbString(),backgroundColor:i.rgbString()};break;case"left":i=new dt(mn.rgbString()),i.lighten(.38),e={borderColor:mn.rgbString(),backgroundColor:i.rgbString()};break;case"overspent":i=new dt(Re.rgbString()),i.lighten(.22),e={borderColor:Re.rgbString(),backgroundColor:i.rgbString()};break}return ur++,t==="border"?e.borderColor:t==="background"?e.backgroundColor:"#FF0000"}let me=[],je=null,Ii=null,Ei=!1;const Ng=()=>({loading:!1,loadingAccounts:!1,accountList:[],autoConversion:!1,chartOptions:null,switchAutoConversion(){this.autoConversion=!this.autoConversion,Bc("autoConversion",this.autoConversion)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt("dashboard-accounts-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){console.log(s),this.drawChart(this.generateOptions(s)),this.loading=!1;return}new Nc().dashboard(n,t,null).then(r=>{this.chartData=r.data,window.store.set(e,r.data),console.log(r.data),this.drawChart(this.generateOptions(this.chartData)),this.loading=!1})},generateOptions(n){me=[];let t=yi("line");for(let e=0;e0){this.loadingAccounts=!1;return}const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt("dashboard-accounts-data",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){this.accountList=s,this.loadingAccounts=!1;return}const o=10;let r=0,a=0,l=[];Promise.all([bt("frontpageAccounts")]).then(c=>{r=c[0].length;for(let u in c[0]){let h=c[0];if(h.hasOwnProperty(u)){let d=h[u];new Ns().get(d,new Date(window.store.get("end"))).then(f=>{let g=f.data.data;const p={page:1,start:new Date(window.store.get("start")),end:new Date(window.store.get("end"))};new Ns().transactions(g.id,p).then(m=>{let b=[];for(let y=0;y=o);y++){let x=m.data.data[y],v={title:x.attributes.group_title===null?"":x.attributes.group_title,id:x.id,transactions:[]};for(let _=0;_y.order-x.order),this.accountList=l,this.loadingAccounts=!1,window.store.set(e,l))})})}}})},init(){Promise.all([bt("viewRange","1M"),bt("autoConversion",!1),bt("language","en_US")]).then(n=>{this.autoConversion=n[1],Ei=!0,this.loadChart(),this.loadAccounts()}),window.store.observe("end",()=>{Ei&&(Ii=null,this.accountList=[],this.loadChart(),this.loadAccounts())}),window.store.observe("autoConversion",()=>{Ei&&(this.loadChart(),this.loadAccounts())})}});let Wg=class{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/budget/dashboard",{params:{start:i,end:s}})}},Ue=[],Nn=null,te=null,zi=!1,Te;const Hg=()=>({loading:!1,autoConversion:!1,loadChart(){if(this.loading!==!0){if(this.loading=!0,te!==null){this.drawChart(this.generateOptions(te)),this.loading=!1;return}this.getFreshData()}},drawChart(n){if(Nn!==null){Nn.data.datasets=n.data.datasets,Nn.update();return}Nn=new mt(document.querySelector("#budget-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt("dashboard-budgets-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){te=s,this.drawChart(this.generateOptions(te)),this.loading=!1;return}new Wg().dashboard(n,t,null).then(r=>{te=r.data,this.drawChart(this.generateOptions(te)),window.store.set(e,te),this.loading=!1})},generateOptions(n){Ue=[];let t=yi("column");t.options.locale=window.store.get("locale").replace("_","-"),t.options.plugins={tooltip:{callbacks:{title:function(e){return e.label},label:function(e){let i=e.dataset.label||"";return i&&(i+=": "),i+" "+V(e.parsed.y,Ue[e.parsed.x]??"EUR")}}}},t.data={labels:[],datasets:[{label:Te.t("firefly.spent"),data:[],borderWidth:1,stack:1,backgroundColor:De("spent","background"),borderColor:De("spent","border")},{label:Te.t("firefly.left"),data:[],borderWidth:1,stack:1,backgroundColor:De("left","background"),borderColor:De("left","border")},{label:Te.t("firefly.overspent"),data:[],borderWidth:1,stack:1,backgroundColor:De("overspent","background"),borderColor:De("overspent","border")}]};for(const e in n)if(n.hasOwnProperty(e)){let i=n[e],s=i.label+" ("+i.currency_code+")";t.data.labels.push(s),this.autoConversion&&(Ue.push(i.native_currency_code),t.data.datasets[0].data.push(parseFloat(i.native_entries.spent)*-1),t.data.datasets[1].data.push(parseFloat(i.native_entries.left)),t.data.datasets[2].data.push(parseFloat(i.native_entries.overspent))),this.autoConversion||(Ue.push(i.currency_code),t.data.datasets[0].data.push(parseFloat(i.entries.spent)*-1),t.data.datasets[1].data.push(parseFloat(i.entries.left)),t.data.datasets[2].data.push(parseFloat(i.entries.overspent)))}return t.options.scales={y:{ticks:{callback:function(e){return V(e,Ue[0]??"EUR")}}}},t},init(){Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{Te=new li;const t=n[1].replace("-","_");Te.locale=t,ci(Te,t).then(()=>{this.autoConversion=n[0],zi=!0,this.loading===!1&&this.loadChart()})}),window.store.observe("end",()=>{zi&&this.loading===!1&&(te=null,this.loadChart())}),window.store.observe("autoConversion",n=>{zi&&(this.autoConversion=n,this.loading===!1&&this.loadChart())})}});class Vg{dashboard(t,e){let i=J(t,"y-MM-dd"),s=J(e,"y-MM-dd");return vt.get("/api/v2/chart/category/dashboard",{params:{start:i,end:s}})}}let hr=[],$e=null,Se=null,Bi=!1;const Yg=()=>({loading:!1,autoConversion:!1,generateOptions(n){hr=[];let t=yi("column"),e={};for(const s in n)if(n.hasOwnProperty(s)){let o=n[s],r=o.currency_code;this.autoConversion&&(r=o.native_currency_code),e.hasOwnProperty(r)||(e[r]={name:r,yAxisID:"",data:{}},hr.push(r))}for(const s in n)if(n.hasOwnProperty(s)){let o=n[s],r=o.currency_code;this.autoConversion&&(r=o.native_currency_code);for(const a in e)if(e.hasOwnProperty(a)){let l=0;r===a&&(l=parseFloat(o.amount),""+o.currency_code,this.autoConversion&&(l=parseFloat(o.native_amount),""+o.native_currency_code)),e[a].data.hasOwnProperty(o.label)&&(e[a].data[o.label]=e[a].data[o.label]+l),e[a].data.hasOwnProperty(o.label)||(e[a].data[o.label]=l)}t.data.labels.includes(o.label)||t.data.labels.push(o.label)}let i=0;for(const s in e){let o="y"+s,r={label:s,currency_code:s,yAxisID:o,data:[]};for(const a in e[s].data)r.data.push(e[s].data[a]);t.data.datasets.push(r),t.options.scales.hasOwnProperty(o)||(t.options.scales[o]={beginAtZero:!0,type:"linear",position:i===1?"right":"left",ticks:{callback:function(a,l,c){return V(a,s)}}},i++)}return t},drawChart(n){if($e!==null){$e.options=n.options,$e.data=n.data,$e.update();return}$e=new mt(document.querySelector("#category-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt("dashboard-categories-chart",n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Se=s,this.drawChart(this.generateOptions(Se)),this.loading=!1;return}new Vg().dashboard(n,t,null).then(r=>{Se=r.data,this.drawChart(this.generateOptions(r.data)),window.store.set(e,Se),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,Se!==null){this.drawChart(this.generateOptions(Se)),this.loading=!1;return}this.getFreshData()}},init(){Promise.all([bt("autoConversion",!1)]).then(n=>{this.autoConversion=n[0],Bi=!0,this.loadChart()}),window.store.observe("end",()=>{Bi&&(this.chartData=null,this.loadChart())}),window.store.observe("autoConversion",n=>{Bi&&(this.autoConversion=n,this.loadChart())})}});let jg=class{list(t){return vt.get("/api/v2/transactions",{params:t})}};/*! * chartjs-chart-sankey v0.12.0 * https://github.com/kurkle/chartjs-chart-sankey#readme * (c) 2022 Jukka Kurkela * Released under the MIT license */function Ug(n){const t=[],e=K(n)?n:H(n)?[]:[n];for(;e.length;){const i=e.pop();typeof i=="string"?t.unshift.apply(t,i.split(` -`)):Array.isArray(i)?e.push.apply(e,i):H(e)||t.unshift(""+i)}return t}function Ni(n){return!n||["min","max"].indexOf(n)===-1?"max":n}const ae=n=>n!==void 0;function $g(n,t){const e=new Set(t.map(r=>r.to)),i=new Set(t.map(r=>r.from)),s=new Set([...n.keys()]);let o=0;for(;s.size;){const r=qg([...s],e);for(const a of r){const l=n.get(a);ae(l.x)||(l.x=o),s.delete(a)}s.size&&(e.clear(),t.filter(a=>s.has(a.from)).forEach(a=>e.add(a.to)),o++)}return[...n.keys()].filter(r=>!i.has(r)).forEach(r=>{const a=n.get(r);a.column||(a.x=o)}),o}function qg(n,t){const e=n.filter(i=>!t.has(i));return e.length?e:n.slice(0,1)}const Xg=(n,t)=>n.x!==t.x?n.x-t.x:n.y-t.y;let Wn=-1;function Kg(){return Wn=Wn<100?Wn+1:0,Wn}function as(n,t,e=Kg()){let i=0;for(const s of n)s.node._visited!==e&&(s.node._visited=e,i+=s.node[t].length+as(s.node[t],t,e));return i}const Ca=n=>(t,e)=>as(t.node[n],n)-as(e.node[n],n)||t.node[n].length-e.node[n].length;function Cs(n,t){n.from.sort(Ca("from"));for(const e of n.from){const i=e.node;ae(i.y)||(i.y=t,Cs(i,t)),t=Math.max(i.y+i.out,t)}return t}function _e(n,t){n.to.sort(Ca("to"));for(const e of n.to){const i=e.node;ae(i.y)||(i.y=t,_e(i,t)),t=Math.max(i.y+i.in,t)}return t}function qe(n,t){return ae(n.y)?n.y:(n.y=t,t)}function Gg(n,t){const e=n.filter(u=>u.x===0),i=n.filter(u=>u.x===t),s=e.filter(u=>!ae(u.y)),o=i.filter(u=>!ae(u.y)),r=n.filter(u=>u.x>0&&u.xMath.max(u,h.y+h.out||0),0),l=i.reduce((u,h)=>Math.max(u,h.y+h.in||0),0),c=0;return a>=l?(s.forEach(u=>{a=qe(u,a),a=Math.max(a+u.out,_e(u,a))}),o.forEach(u=>{l=qe(u,l),l=Math.max(l+u.in,_e(u,l))})):(o.forEach(u=>{l=qe(u,l),l=Math.max(l+u.in,_e(u,l))}),s.forEach(u=>{a=qe(u,a),a=Math.max(a+u.out,_e(u,a))})),r.forEach(u=>{let h=n.filter(d=>d.x===u.x&&ae(d.y)).reduce((d,f)=>Math.max(d,f.y+Math.max(f.in,f.out)),0);h=qe(u,h),h=Math.max(h+u.in,Cs(u,h)),h=Math.max(h+u.out,_e(u,h)),c=Math.max(c,h)}),Math.max(a,l,c)}function Qg(n,t){n.sort((r,a)=>Math.max(a.in,a.out)-Math.max(r.in,r.out));const e=n[0];e.y=0;const i=Cs(e,0),s=_e(e,0),o=Gg(n,t);return Math.max(i,s,o)}function Zg(n,t){let e=0,i=0;for(let s=0;s<=t;s++){let o=i;const r=n.filter(a=>a.x===s).sort((a,l)=>a.priority-l.priority);i=r[0].to.filter(a=>a.node.x>s+1).reduce((a,l)=>a+l.flow,0)||0;for(const a of r)a.y=o,o+=Math.max(a.out,a.in);e=Math.max(o,e)}return e}function Jg(n,t){let e=1,i=0,s=0,o=0;const r=[];n.sort(Xg);for(const a of n){if(a.y){if(a.x===0)r.push(a.y);else{for(i!==a.x&&(i=a.x,s=0),e=s+1;ea.y);e++);s=e}a.y+=e*t,e++}o=Math.max(o,a.y+Math.max(a.in,a.out))}return o}function tp(n,t){n.forEach(e=>{const i=Math[t](e.in||e.out,e.out||e.in),s=il.node.y+l.node.out/2-(c.node.y+c.node.out/2)).forEach((l,c)=>{s?l.addY=c*(i-l.flow)/(a-1):(l.addY=r,r+=l.flow)}),r=0,a=e.to.length,e.to.sort((l,c)=>l.node.y+l.node.in/2-(c.node.y+c.node.in/2)).forEach((l,c)=>{o?l.addY=c*(i-l.flow)/(a-1):(l.addY=r,r+=l.flow)})})}function ep(n,t,e,i){const s=[...n.values()],o=$g(n,t),a=(e?Zg(s,o):Qg(s,o))*.03,l=Jg(s,a);return tp(s,i),{maxX:o,maxY:l}}function np(n){const t=new Map;for(let i=0;is.flow-i.flow;return[...t.values()].forEach(i=>{i.from=i.from.sort(e),i.from.forEach(s=>{s.node=t.get(s.key)}),i.to=i.to.sort(e),i.to.forEach(s=>{s.node=t.get(s.key)})}),t}function hr(n,t,e){for(const i of n)if(i.key===t&&i.index===e)return i.addY;return 0}class _i extends Xt{parseObjectData(t,e,i,s){const{from:o="from",to:r="to",flow:a="flow"}=this.options.parsing,l=e.map(({[o]:y,[r]:x,[a]:v})=>({from:y,to:x,flow:v})),{xScale:c,yScale:u}=t,h=[],d=this._nodes=np(l),{column:f,priority:g,size:p}=this.getDataset();if(g)for(const y of d.values())y.key in g&&(y.priority=g[y.key]);if(f)for(const y of d.values())y.key in f&&(y.column=!0,y.x=f[y.key]);const{maxX:m,maxY:b}=ep(d,l,!!g,Ni(p));this._maxX=m,this._maxY=b;for(let y=0,x=l.length;y1){const d=c-u*l/2+h;for(let f=0;fn.type==="data"?(n.parsed._custom.x-n.parsed.x)*200:void 0,delay:n=>n.type==="data"?n.parsed.x*500+n.dataIndex*20:void 0},colors:{type:"color",properties:["colorFrom","colorTo"]}},transitions:{hide:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],to:"transparent"}}},show:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],from:"transparent"}}}}};_i.overrides={interaction:{mode:"nearest",intersect:!0},datasets:{clip:!1,parsing:!0},plugins:{tooltip:{callbacks:{title(){return""},label(n){const t=n.dataset.data[n.dataIndex];return t.from+" -> "+t.to+": "+t.flow}}},legend:{display:!1}},scales:{x:{type:"linear",bounds:"data",display:!1,min:0,offset:!1},y:{type:"linear",bounds:"data",display:!1,min:0,reverse:!0,offset:!1}},layout:{padding:{top:3,left:3,right:13,bottom:3}}};const dr=(n,t,e,i)=>n({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)});function ip(n,{x:t,x2:e,options:i}){let s;i.colorMode==="from"?s=Ae(i.colorFrom).alpha(.5).rgbString():i.colorMode==="to"?s=Ae(i.colorTo).alpha(.5).rgbString():(s=n.createLinearGradient(t,0,e,0),s.addColorStop(0,Ae(i.colorFrom).alpha(.5).rgbString()),s.addColorStop(1,Ae(i.colorTo).alpha(.5).rgbString())),n.fillStyle=s,n.strokeStyle=s,n.lineWidth=.5}class Ps extends Lt{constructor(t){super(),this.options=void 0,this.x=void 0,this.y=void 0,this.x2=void 0,this.y2=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this,{x:i,x2:s,y:o,y2:r,height:a,progress:l}=e,{cp1:c,cp2:u}=dr(i,o,s,r);l!==0&&(t.save(),l<1&&(t.beginPath(),t.rect(i,Math.min(o,r),(s-i)*l+1,Math.abs(r-o)+a+1),t.clip()),ip(t,e),t.beginPath(),t.moveTo(i,o),t.bezierCurveTo(c.x,c.y,u.x,u.y,s,r),t.lineTo(s,r+a),t.bezierCurveTo(u.x,u.y+a,c.x,c.y+a,i,o+a),t.lineTo(i,o),t.stroke(),t.closePath(),t.fill(),t.restore())}inRange(t,e,i){const{x:s,y:o,x2:r,y2:a,height:l}=this.getProps(["x","y","x2","y2","height"],i);if(tr)return!1;const{cp1:c,cp2:u}=dr(s,o,r,a),h=(t-s)/(r-s),d={x:s,y:o},f={x:r,y:a},g=Oe(d,c,h),p=Oe(c,u,h),m=Oe(u,f,h),b=Oe(g,p,h),y=Oe(p,m,h),x=Oe(b,y,h).y;return e>=x&&e<=x+l}inXRange(t,e){const{x:i,x2:s}=this.getProps(["x","x2"],e);return t>=i&&t<=s}inYRange(t,e){const{y:i,y2:s,height:o}=this.getProps(["y","y2","height"],e),r=Math.min(i,s),a=Math.max(i,s)+o;return t>=r&&t<=a}getCenterPoint(t){const{x:e,y:i,x2:s,y2:o,height:r}=this.getProps(["x","y","x2","y2","height"],t);return{x:(e+s)/2,y:(i+o+r)/2}}tooltipPosition(t){return this.getCenterPoint(t)}getRange(t){return t==="x"?this.width/2:this.height/2}}Ps.id="flow";Ps.defaults={colorFrom:"red",colorTo:"green",colorMode:"gradient",hoverColorFrom:(n,t)=>on(t.colorFrom),hoverColorTo:(n,t)=>on(t.colorTo)};mt.register({SankeyController:_i,Flow:Ps});const fr="dashboard-sankey-data";let pt,Wi=!1,Hn=null,Ht=[],ht=!1,L={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 gr=function(n){return n.includes(L.revenue_account)?"forestgreen":n.includes("("+L.in+",")?"green":n.includes(L.budget)||n.includes(L.unknown_budget)?"Orchid":n.includes("("+L.out+",")?"MediumOrchid":n.includes(L.all_money)?"blue":"red"};function Xe(n,t,e,i){if(n==="category"&&t!==null&&e==="in")return L.category+' "'+t+'" ('+L.in+(ht?", "+i+")":")");if(n==="category"&&t===null&&e==="in")return L.unknown_category+" ("+L.in+(ht?", "+i+")":")");if(n==="category"&&t!==null&&e==="out")return L.category+' "'+t+'" ('+L.out+(ht?", "+i+")":")");if(n==="category"&&t===null&&e==="out")return L.unknown_category+" ("+L.out+(ht?", "+i+")":")");if(n==="account"&&t===null&&e==="in")return L.unknown_source+(ht?" ("+i+")":"");if(n==="account"&&t!==null&&e==="in")return L.revenue_account+'"'+t+'"'+(ht?" ("+i+")":"");if(n==="account"&&t===null&&e==="out")return L.unknown_dest+(ht?" ("+i+")":"");if(n==="account"&&t!==null&&e==="out")return L.expense_account+' "'+t+'"'+(ht?" ("+i+")":"");if(n==="budget"&&t!==null)return L.budget+' "'+t+'"'+(ht?" ("+i+")":"");if(n==="budget"&&t===null)return L.unknown_budget+(ht?" ("+i+")":"");console.error('Cannot handle: type:"'+n+'", dir: "'+e+'"')}function Ke(n,t,e){if(n==="category"&&t!==null)return L.category+' "'+t+'"'+(ht?" ("+e+")":"");if(n==="category"&&t===null)return L.unknown_category+(ht?" ("+e+")":"");if(n==="account"&&t===null)return L.unknown_account+(ht?" ("+e+")":"");if(n==="account"&&t!==null)return t+(ht?" ("+e+")":"");if(n==="budget"&&t!==null)return L.budget+' "'+t+'"'+(ht?" ("+e+")":"");if(n==="budget"&&t===null)return L.unknown_budget+(ht?" ("+e+")":"");console.error('Cannot handle: type:"'+n+'"')}const sp=()=>({loading:!1,autoConversion:!1,generateOptions(){let n=yi("sankey"),t={},e={};for(let s in Ht)if(Ht.hasOwnProperty(s)){let o=Ht[s];for(let r in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(r)){let a=o.attributes.transactions[r],l=this.autoConversion?a.native_currency_code:a.currency_code,c=this.autoConversion?parseFloat(a.native_amount):parseFloat(a.amount),u;if(a.type==="deposit"){let h=Xe("category",a.category_name,"in",l),d=Xe("account",a.source_name,"in",l);e[h]=Ke("category",a.category_name,l),e[d]=Ke("account",a.source_name,l),u=d+"-"+h+"-"+l,t.hasOwnProperty(u)||(t[u]={from:d,to:h,amount:0}),t[u].amount+=c,u=h+"-"+L.all_money+"-"+l,t.hasOwnProperty(u)||(t[u]={from:h,to:L.all_money+(this.autoConversion?" ("+l+")":""),amount:0}),t[u].amount+=c}if(a.type==="withdrawal"){let h=Xe("budget",a.budget_name,"out",l);e[h]=Ke("budget",a.budget_name,l),u=L.all_money+"-"+h+"-"+l,t.hasOwnProperty(u)||(t[u]={from:L.all_money+(this.autoConversion?" ("+l+")":""),to:h,amount:0}),t[u].amount+=c;let d=Xe("category",a.category_name,"out",l);e[d]=Ke("category",a.category_name,l),u=h+"-"+d+"-"+l,t.hasOwnProperty(u)||(t[u]={from:h,to:d,amount:0}),t[u].amount+=c;let f=Xe("account",a.destination_name,"out",l);e[f]=Ke("account",a.destination_name,l),u=d+"-"+f+"-"+l,t.hasOwnProperty(u)||(t[u]={from:d,to:f,amount:0}),t[u].amount+=c}}}let i={label:"Firefly III dashboard sankey chart",data:[],colorFrom:s=>gr(s.dataset.data[s.dataIndex]?s.dataset.data[s.dataIndex].from:""),colorTo:s=>gr(s.dataset.data[s.dataIndex]?s.dataset.data[s.dataIndex].to:""),colorMode:"gradient",labels:e,size:"min"};for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];i.data.push({from:o.from,to:o.to,flow:o.amount})}return n.data.datasets.push(i),n},drawChart(n){if(Hn!==null){Hn.data.datasets=n.data.datasets,Hn.update();return}Hn=new mt(document.querySelector("#sankey-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt(fr,n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Ht=s,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(n){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),i=Nt(fr,t,e);new jg().list(n).then(o=>{if(Ht=[...Ht,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>n.page){n.page++,this.downloadTransactions(n);return}window.store.set(i,Ht),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,Ht.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){Ht=[],Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{this.autoConversion=n[0],ht=n[0],pt=new li;const t=n[1].replace("-","_");pt.locale=t,ci(pt,t).then(()=>{L.all_money=pt.t("firefly.all_money"),L.category=pt.t("firefly.category"),L.in=pt.t("firefly.money_flowing_in"),L.out=pt.t("firefly.money_flowing_out"),L.unknown_category=pt.t("firefly.unknown_category_plain"),L.unknown_source=pt.t("firefly.unknown_source_plain"),L.unknown_dest=pt.t("firefly.unknown_dest_plain"),L.unknown_account=pt.t("firefly.unknown_any_plain"),L.unknown_budget=pt.t("firefly.unknown_budget_plain"),L.expense_account=pt.t("firefly.expense_account"),L.revenue_account=pt.t("firefly.revenue_account"),L.budget=pt.t("firefly.budget"),Wi=!0,this.loadChart()})}),window.store.observe("end",()=>{Wi&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",n=>{Wi&&(this.autoConversion=n,this.loadChart())})}});let op=class{list(t){return vt.get("/api/v2/subscriptions",{params:t})}paid(t){return vt.get("/api/v2/subscriptions/sum/paid",{params:t})}unpaid(t){return vt.get("/api/v2/subscriptions/sum/unpaid",{params:t})}},Hi=!1,ee,Ct={};function Pa(n){return new op().list(n).then(e=>{let i=e.data.data;for(let s in i)if(i.hasOwnProperty(s)){let o=i[s];if(o.attributes.active&&o.attributes.pay_dates.length>0){let r=o.attributes.object_group_id===null?0:o.attributes.object_group_id,a=o.attributes.object_group_title===null?ee.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,l=o.attributes.object_group_order===null?0:o.attributes.object_group_order;Ct.hasOwnProperty(r)||(Ct[r]={id:r,title:a,order:l,payment_info:{},bills:[]});let c={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};c.expected_amount=n.autoConversion?V(c.native_amount,c.native_currency_code):V(c.amount,c.currency_code),c.expected_times=ee.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:c.expected_amount});for(let u in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(u)){const h=o.attributes.paid_dates[u];let d=100;n.autoConversion&&(d=Math.round(-100+parseFloat(h.native_amount)*-1/parseFloat(c.native_amount)*100)),n.autoConversion||(d=Math.round(-100+parseFloat(h.amount)*-1/parseFloat(c.amount)*100));let f={amount:n.autoConversion?V(h.native_amount,h.native_currency_code):V(h.amount,h.currency_code),percentage:d,date:J(new Date(h.date),"PP"),foreign_amount:null};h.foreign_currency_code!==null&&(f.foreign_amount=n.autoConversion?h.foreign_native_amount:h.foreign_amount,f.foreign_currency_code=n.autoConversion?h.native_currency_code:h.foreign_currency_code),c.transactions.push(f)}if(Ct[r].bills.push(c),o.attributes.paid_dates.length===0){const u=o.attributes.pay_dates.length*c.amount,h=o.attributes.pay_dates.length*c.native_amount;Ct[r].payment_info.hasOwnProperty(c.currency_code)||(Ct[r].payment_info[c.currency_code]={currency_code:c.currency_code,paid:0,unpaid:0,native_currency_code:c.native_currency_code,native_paid:0,native_unpaid:0}),Ct[r].payment_info[c.currency_code].unpaid+=u,Ct[r].payment_info[c.currency_code].native_unpaid+=h}if(o.attributes.paid_dates.length>0){for(let u in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(u)){let h=o.attributes.paid_dates[u];Ct[r].payment_info.hasOwnProperty(h.currency_code)||(Ct[r].payment_info[h.currency_code]={currency_code:c.currency_code,paid:0,unpaid:0,native_currency_code:c.native_currency_code,native_paid:0,native_unpaid:0});const d=parseFloat(h.amount)*-1,f=parseFloat(h.native_amount)*-1;Ct[r].payment_info[h.currency_code].paid+=d,Ct[r].payment_info[h.currency_code].native_paid+=f}}}}return parseInt(e.data.meta.pagination.total_pages)>n.page?(n.page++,Pa(n)):Promise.resolve()})}const rp=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let n=new Date(window.store.get("start")),t=new Date(window.store.get("end"));console.log("here we are");const e=window.store.get("cacheValid");let i=window.store.get(Nt("subscriptions-data-dashboard",n,t));e&&typeof i<"u",Ct={},this.subscriptions=[],console.log("cache is invalid, must download");let s={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),autoConversion:this.autoConversion,page:1};Pa(s).then(()=>{console.log("Done with download!");let o=Object.values(Ct);for(let r in o)if(o.hasOwnProperty(r)){let a=o[r];const l=Object.keys(a.payment_info);a.col_size=l.length===1?"col-6 offset-3":"col-6",a.chart_width=l.length===1?"50%":"100%",a.payment_length=l.length,this.subscriptions.push(a)}this.loading=!1})},drawPieChart(n,t,e){let i="#pie_"+n+"_"+e.currency_code;const s=this.autoConversion?e.native_unpaid:e.unpaid,o=this.autoConversion?e.native_paid:e.paid,r=this.autoConversion?e.native_currency_code:e.currency_code,l={type:"doughnut",data:{labels:[ee.t("firefly.paid"),ee.t("firefly.unpaid")],datasets:[{label:ee.t("firefly.subscriptions_in_group",{title:t}),data:[o,s],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(u){return u.dataset.label+": "+V(u.raw,r)}}}}}};var c=mt.getChart(document.querySelector(i));typeof c<"u"&&c.destroy(),new mt(document.querySelector(i),l)},init(){console.log("subscriptions init"),Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{console.log("subscriptions after promises"),this.autoConversion=n[0],Hi=!0,ee=new li;const t=n[1].replace("-","_");ee.locale=t,ci(ee,t).then(()=>{this.loading===!1&&this.startSubscriptions()})}),window.store.observe("end",()=>{Hi&&(console.log("subscriptions observe end"),this.loading===!1&&this.startSubscriptions())}),window.store.observe("autoConversion",n=>{Hi&&(console.log("subscriptions observe autoConversion"),this.autoConversion=n,this.loading===!1&&this.startSubscriptions())})}});class ap{list(t){return vt.get("/api/v2/piggy-banks",{params:t})}}let Vt={},Vi=!1,Vn;const pr="dashboard-piggies-data",lp=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Nt(pr,n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Vt=s,this.parsePiggies(),this.loading=!1;return}let o={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(n){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),i=Nt(pr,t,e);new ap().list(n).then(o=>{if(Vt=[...Vt,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>n.page){n.page++,this.downloadPiggyBanks(n);return}window.store.set(i,Vt),this.parsePiggies(),this.loading=!1})},parsePiggies(){let n=[];for(let t in Vt)if(Vt.hasOwnProperty(t)){let e=Vt[t];if(e.attributes.percentage>=100||e.attributes.percentage===0)continue;let i=e.object_group_title??Vn.t("firefly.default_group_title_name_plain");n.hasOwnProperty(i)||(n[i]={id:e.object_group_id??0,title:i,order:e.object_group_order??0,piggies:[]});let s={id:e.id,name:e.attributes.name,percentage:parseInt(e.attributes.percentage),amount:this.autoConversion?e.attributes.native_current_amount:e.attributes.current_amount,left_to_save:this.autoConversion?e.attributes.native_left_to_save:e.attributes.left_to_save,target_amount:this.autoConversion?e.attributes.native_target_amount:e.attributes.target_amount,save_per_month:this.autoConversion?e.attributes.native_save_per_month:e.attributes.save_per_month,currency_code:this.autoConversion?e.attributes.native_currency_code:e.attributes.currency_code};n[i].piggies.push(s)}this.piggies=Object.values(n)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){Vt=[],Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{Vn=new li;const t=n[1].replace("-","_");Vn.locale=t,ci(Vn,t).then(()=>{Vi=!0,this.autoConversion=n[0],this.loadPiggyBanks()})}),window.store.observe("end",()=>{Vi&&(Vt=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",n=>{Vi&&(this.autoConversion=n,this.loadPiggyBanks())})}});/*! +`)):Array.isArray(i)?e.push.apply(e,i):H(e)||t.unshift(""+i)}return t}function Ni(n){return!n||["min","max"].indexOf(n)===-1?"max":n}const ae=n=>n!==void 0;function $g(n,t){const e=new Set(t.map(r=>r.to)),i=new Set(t.map(r=>r.from)),s=new Set([...n.keys()]);let o=0;for(;s.size;){const r=qg([...s],e);for(const a of r){const l=n.get(a);ae(l.x)||(l.x=o),s.delete(a)}s.size&&(e.clear(),t.filter(a=>s.has(a.from)).forEach(a=>e.add(a.to)),o++)}return[...n.keys()].filter(r=>!i.has(r)).forEach(r=>{const a=n.get(r);a.column||(a.x=o)}),o}function qg(n,t){const e=n.filter(i=>!t.has(i));return e.length?e:n.slice(0,1)}const Xg=(n,t)=>n.x!==t.x?n.x-t.x:n.y-t.y;let Wn=-1;function Kg(){return Wn=Wn<100?Wn+1:0,Wn}function as(n,t,e=Kg()){let i=0;for(const s of n)s.node._visited!==e&&(s.node._visited=e,i+=s.node[t].length+as(s.node[t],t,e));return i}const Ca=n=>(t,e)=>as(t.node[n],n)-as(e.node[n],n)||t.node[n].length-e.node[n].length;function Ps(n,t){n.from.sort(Ca("from"));for(const e of n.from){const i=e.node;ae(i.y)||(i.y=t,Ps(i,t)),t=Math.max(i.y+i.out,t)}return t}function _e(n,t){n.to.sort(Ca("to"));for(const e of n.to){const i=e.node;ae(i.y)||(i.y=t,_e(i,t)),t=Math.max(i.y+i.in,t)}return t}function qe(n,t){return ae(n.y)?n.y:(n.y=t,t)}function Gg(n,t){const e=n.filter(u=>u.x===0),i=n.filter(u=>u.x===t),s=e.filter(u=>!ae(u.y)),o=i.filter(u=>!ae(u.y)),r=n.filter(u=>u.x>0&&u.xMath.max(u,h.y+h.out||0),0),l=i.reduce((u,h)=>Math.max(u,h.y+h.in||0),0),c=0;return a>=l?(s.forEach(u=>{a=qe(u,a),a=Math.max(a+u.out,_e(u,a))}),o.forEach(u=>{l=qe(u,l),l=Math.max(l+u.in,_e(u,l))})):(o.forEach(u=>{l=qe(u,l),l=Math.max(l+u.in,_e(u,l))}),s.forEach(u=>{a=qe(u,a),a=Math.max(a+u.out,_e(u,a))})),r.forEach(u=>{let h=n.filter(d=>d.x===u.x&&ae(d.y)).reduce((d,f)=>Math.max(d,f.y+Math.max(f.in,f.out)),0);h=qe(u,h),h=Math.max(h+u.in,Ps(u,h)),h=Math.max(h+u.out,_e(u,h)),c=Math.max(c,h)}),Math.max(a,l,c)}function Qg(n,t){n.sort((r,a)=>Math.max(a.in,a.out)-Math.max(r.in,r.out));const e=n[0];e.y=0;const i=Ps(e,0),s=_e(e,0),o=Gg(n,t);return Math.max(i,s,o)}function Zg(n,t){let e=0,i=0;for(let s=0;s<=t;s++){let o=i;const r=n.filter(a=>a.x===s).sort((a,l)=>a.priority-l.priority);i=r[0].to.filter(a=>a.node.x>s+1).reduce((a,l)=>a+l.flow,0)||0;for(const a of r)a.y=o,o+=Math.max(a.out,a.in);e=Math.max(o,e)}return e}function Jg(n,t){let e=1,i=0,s=0,o=0;const r=[];n.sort(Xg);for(const a of n){if(a.y){if(a.x===0)r.push(a.y);else{for(i!==a.x&&(i=a.x,s=0),e=s+1;ea.y);e++);s=e}a.y+=e*t,e++}o=Math.max(o,a.y+Math.max(a.in,a.out))}return o}function tp(n,t){n.forEach(e=>{const i=Math[t](e.in||e.out,e.out||e.in),s=il.node.y+l.node.out/2-(c.node.y+c.node.out/2)).forEach((l,c)=>{s?l.addY=c*(i-l.flow)/(a-1):(l.addY=r,r+=l.flow)}),r=0,a=e.to.length,e.to.sort((l,c)=>l.node.y+l.node.in/2-(c.node.y+c.node.in/2)).forEach((l,c)=>{o?l.addY=c*(i-l.flow)/(a-1):(l.addY=r,r+=l.flow)})})}function ep(n,t,e,i){const s=[...n.values()],o=$g(n,t),a=(e?Zg(s,o):Qg(s,o))*.03,l=Jg(s,a);return tp(s,i),{maxX:o,maxY:l}}function np(n){const t=new Map;for(let i=0;is.flow-i.flow;return[...t.values()].forEach(i=>{i.from=i.from.sort(e),i.from.forEach(s=>{s.node=t.get(s.key)}),i.to=i.to.sort(e),i.to.forEach(s=>{s.node=t.get(s.key)})}),t}function dr(n,t,e){for(const i of n)if(i.key===t&&i.index===e)return i.addY;return 0}class _i extends Kt{parseObjectData(t,e,i,s){const{from:o="from",to:r="to",flow:a="flow"}=this.options.parsing,l=e.map(({[o]:y,[r]:x,[a]:v})=>({from:y,to:x,flow:v})),{xScale:c,yScale:u}=t,h=[],d=this._nodes=np(l),{column:f,priority:g,size:p}=this.getDataset();if(g)for(const y of d.values())y.key in g&&(y.priority=g[y.key]);if(f)for(const y of d.values())y.key in f&&(y.column=!0,y.x=f[y.key]);const{maxX:m,maxY:b}=ep(d,l,!!g,Ni(p));this._maxX=m,this._maxY=b;for(let y=0,x=l.length;y1){const d=c-u*l/2+h;for(let f=0;fn.type==="data"?(n.parsed._custom.x-n.parsed.x)*200:void 0,delay:n=>n.type==="data"?n.parsed.x*500+n.dataIndex*20:void 0},colors:{type:"color",properties:["colorFrom","colorTo"]}},transitions:{hide:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],to:"transparent"}}},show:{animations:{colors:{type:"color",properties:["colorFrom","colorTo"],from:"transparent"}}}}};_i.overrides={interaction:{mode:"nearest",intersect:!0},datasets:{clip:!1,parsing:!0},plugins:{tooltip:{callbacks:{title(){return""},label(n){const t=n.dataset.data[n.dataIndex];return t.from+" -> "+t.to+": "+t.flow}}},legend:{display:!1}},scales:{x:{type:"linear",bounds:"data",display:!1,min:0,offset:!1},y:{type:"linear",bounds:"data",display:!1,min:0,reverse:!0,offset:!1}},layout:{padding:{top:3,left:3,right:13,bottom:3}}};const fr=(n,t,e,i)=>n({x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)});function ip(n,{x:t,x2:e,options:i}){let s;i.colorMode==="from"?s=Ae(i.colorFrom).alpha(.5).rgbString():i.colorMode==="to"?s=Ae(i.colorTo).alpha(.5).rgbString():(s=n.createLinearGradient(t,0,e,0),s.addColorStop(0,Ae(i.colorFrom).alpha(.5).rgbString()),s.addColorStop(1,Ae(i.colorTo).alpha(.5).rgbString())),n.fillStyle=s,n.strokeStyle=s,n.lineWidth=.5}class Ds extends Rt{constructor(t){super(),this.options=void 0,this.x=void 0,this.y=void 0,this.x2=void 0,this.y2=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this,{x:i,x2:s,y:o,y2:r,height:a,progress:l}=e,{cp1:c,cp2:u}=fr(i,o,s,r);l!==0&&(t.save(),l<1&&(t.beginPath(),t.rect(i,Math.min(o,r),(s-i)*l+1,Math.abs(r-o)+a+1),t.clip()),ip(t,e),t.beginPath(),t.moveTo(i,o),t.bezierCurveTo(c.x,c.y,u.x,u.y,s,r),t.lineTo(s,r+a),t.bezierCurveTo(u.x,u.y+a,c.x,c.y+a,i,o+a),t.lineTo(i,o),t.stroke(),t.closePath(),t.fill(),t.restore())}inRange(t,e,i){const{x:s,y:o,x2:r,y2:a,height:l}=this.getProps(["x","y","x2","y2","height"],i);if(tr)return!1;const{cp1:c,cp2:u}=fr(s,o,r,a),h=(t-s)/(r-s),d={x:s,y:o},f={x:r,y:a},g=Oe(d,c,h),p=Oe(c,u,h),m=Oe(u,f,h),b=Oe(g,p,h),y=Oe(p,m,h),x=Oe(b,y,h).y;return e>=x&&e<=x+l}inXRange(t,e){const{x:i,x2:s}=this.getProps(["x","x2"],e);return t>=i&&t<=s}inYRange(t,e){const{y:i,y2:s,height:o}=this.getProps(["y","y2","height"],e),r=Math.min(i,s),a=Math.max(i,s)+o;return t>=r&&t<=a}getCenterPoint(t){const{x:e,y:i,x2:s,y2:o,height:r}=this.getProps(["x","y","x2","y2","height"],t);return{x:(e+s)/2,y:(i+o+r)/2}}tooltipPosition(t){return this.getCenterPoint(t)}getRange(t){return t==="x"?this.width/2:this.height/2}}Ds.id="flow";Ds.defaults={colorFrom:"red",colorTo:"green",colorMode:"gradient",hoverColorFrom:(n,t)=>on(t.colorFrom),hoverColorTo:(n,t)=>on(t.colorTo)};mt.register({SankeyController:_i,Flow:Ds});const gr="dashboard-sankey-data";let pt,Wi=!1,Hn=null,Vt=[],ht=!1,L={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 pr=function(n){return n.includes(L.revenue_account)?"forestgreen":n.includes("("+L.in+",")?"green":n.includes(L.budget)||n.includes(L.unknown_budget)?"Orchid":n.includes("("+L.out+",")?"MediumOrchid":n.includes(L.all_money)?"blue":"red"};function Xe(n,t,e,i){if(n==="category"&&t!==null&&e==="in")return L.category+' "'+t+'" ('+L.in+(ht?", "+i+")":")");if(n==="category"&&t===null&&e==="in")return L.unknown_category+" ("+L.in+(ht?", "+i+")":")");if(n==="category"&&t!==null&&e==="out")return L.category+' "'+t+'" ('+L.out+(ht?", "+i+")":")");if(n==="category"&&t===null&&e==="out")return L.unknown_category+" ("+L.out+(ht?", "+i+")":")");if(n==="account"&&t===null&&e==="in")return L.unknown_source+(ht?" ("+i+")":"");if(n==="account"&&t!==null&&e==="in")return L.revenue_account+'"'+t+'"'+(ht?" ("+i+")":"");if(n==="account"&&t===null&&e==="out")return L.unknown_dest+(ht?" ("+i+")":"");if(n==="account"&&t!==null&&e==="out")return L.expense_account+' "'+t+'"'+(ht?" ("+i+")":"");if(n==="budget"&&t!==null)return L.budget+' "'+t+'"'+(ht?" ("+i+")":"");if(n==="budget"&&t===null)return L.unknown_budget+(ht?" ("+i+")":"");console.error('Cannot handle: type:"'+n+'", dir: "'+e+'"')}function Ke(n,t,e){if(n==="category"&&t!==null)return L.category+' "'+t+'"'+(ht?" ("+e+")":"");if(n==="category"&&t===null)return L.unknown_category+(ht?" ("+e+")":"");if(n==="account"&&t===null)return L.unknown_account+(ht?" ("+e+")":"");if(n==="account"&&t!==null)return t+(ht?" ("+e+")":"");if(n==="budget"&&t!==null)return L.budget+' "'+t+'"'+(ht?" ("+e+")":"");if(n==="budget"&&t===null)return L.unknown_budget+(ht?" ("+e+")":"");console.error('Cannot handle: type:"'+n+'"')}const sp=()=>({loading:!1,autoConversion:!1,generateOptions(){let n=yi("sankey"),t={},e={};for(let s in Vt)if(Vt.hasOwnProperty(s)){let o=Vt[s];for(let r in o.attributes.transactions)if(o.attributes.transactions.hasOwnProperty(r)){let a=o.attributes.transactions[r],l=this.autoConversion?a.native_currency_code:a.currency_code,c=this.autoConversion?parseFloat(a.native_amount):parseFloat(a.amount),u;if(a.type==="deposit"){let h=Xe("category",a.category_name,"in",l),d=Xe("account",a.source_name,"in",l);e[h]=Ke("category",a.category_name,l),e[d]=Ke("account",a.source_name,l),u=d+"-"+h+"-"+l,t.hasOwnProperty(u)||(t[u]={from:d,to:h,amount:0}),t[u].amount+=c,u=h+"-"+L.all_money+"-"+l,t.hasOwnProperty(u)||(t[u]={from:h,to:L.all_money+(this.autoConversion?" ("+l+")":""),amount:0}),t[u].amount+=c}if(a.type==="withdrawal"){let h=Xe("budget",a.budget_name,"out",l);e[h]=Ke("budget",a.budget_name,l),u=L.all_money+"-"+h+"-"+l,t.hasOwnProperty(u)||(t[u]={from:L.all_money+(this.autoConversion?" ("+l+")":""),to:h,amount:0}),t[u].amount+=c;let d=Xe("category",a.category_name,"out",l);e[d]=Ke("category",a.category_name,l),u=h+"-"+d+"-"+l,t.hasOwnProperty(u)||(t[u]={from:h,to:d,amount:0}),t[u].amount+=c;let f=Xe("account",a.destination_name,"out",l);e[f]=Ke("account",a.destination_name,l),u=d+"-"+f+"-"+l,t.hasOwnProperty(u)||(t[u]={from:d,to:f,amount:0}),t[u].amount+=c}}}let i={label:"Firefly III dashboard sankey chart",data:[],colorFrom:s=>pr(s.dataset.data[s.dataIndex]?s.dataset.data[s.dataIndex].from:""),colorTo:s=>pr(s.dataset.data[s.dataIndex]?s.dataset.data[s.dataIndex].to:""),colorMode:"gradient",labels:e,size:"min"};for(let s in t)if(t.hasOwnProperty(s)){let o=t[s];i.data.push({from:o.from,to:o.to,flow:o.amount})}return n.data.datasets.push(i),n},drawChart(n){if(Hn!==null){Hn.data.datasets=n.data.datasets,Hn.update();return}Hn=new mt(document.querySelector("#sankey-chart"),n)},getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt(gr,n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Vt=s,this.drawChart(this.generateOptions()),this.loading=!1;return}let o={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),type:"withdrawal,deposit",page:1};this.downloadTransactions(o)},downloadTransactions(n){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),i=Wt(gr,t,e);new jg().list(n).then(o=>{if(Vt=[...Vt,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>n.page){n.page++,this.downloadTransactions(n);return}window.store.set(i,Vt),this.drawChart(this.generateOptions()),this.loading=!1})},loadChart(){if(this.loading!==!0){if(this.loading=!0,Vt.length!==0){this.drawChart(this.generateOptions()),this.loading=!1;return}this.getFreshData()}},init(){Vt=[],Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{this.autoConversion=n[0],ht=n[0],pt=new li;const t=n[1].replace("-","_");pt.locale=t,ci(pt,t).then(()=>{L.all_money=pt.t("firefly.all_money"),L.category=pt.t("firefly.category"),L.in=pt.t("firefly.money_flowing_in"),L.out=pt.t("firefly.money_flowing_out"),L.unknown_category=pt.t("firefly.unknown_category_plain"),L.unknown_source=pt.t("firefly.unknown_source_plain"),L.unknown_dest=pt.t("firefly.unknown_dest_plain"),L.unknown_account=pt.t("firefly.unknown_any_plain"),L.unknown_budget=pt.t("firefly.unknown_budget_plain"),L.expense_account=pt.t("firefly.expense_account"),L.revenue_account=pt.t("firefly.revenue_account"),L.budget=pt.t("firefly.budget"),Wi=!0,this.loadChart()})}),window.store.observe("end",()=>{Wi&&(this.transactions=[],this.loadChart())}),window.store.observe("autoConversion",n=>{Wi&&(this.autoConversion=n,this.loadChart())})}});let op=class{list(t){return vt.get("/api/v2/subscriptions",{params:t})}paid(t){return vt.get("/api/v2/subscriptions/sum/paid",{params:t})}unpaid(t){return vt.get("/api/v2/subscriptions/sum/unpaid",{params:t})}},Hi=!1,ee,Ct={};function Pa(n){return new op().list(n).then(e=>{let i=e.data.data;for(let s in i)if(i.hasOwnProperty(s)){let o=i[s];if(o.attributes.active&&o.attributes.pay_dates.length>0){let r=o.attributes.object_group_id===null?0:o.attributes.object_group_id,a=o.attributes.object_group_title===null?ee.t("firefly.default_group_title_name_plain"):o.attributes.object_group_title,l=o.attributes.object_group_order===null?0:o.attributes.object_group_order;Ct.hasOwnProperty(r)||(Ct[r]={id:r,title:a,order:l,payment_info:{},bills:[]});let c={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};c.expected_amount=n.autoConversion?V(c.native_amount,c.native_currency_code):V(c.amount,c.currency_code),c.expected_times=ee.t("firefly.subscr_expected_x_times",{times:o.attributes.pay_dates.length,amount:c.expected_amount});for(let u in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(u)){const h=o.attributes.paid_dates[u];let d=100;n.autoConversion&&(d=Math.round(-100+parseFloat(h.native_amount)*-1/parseFloat(c.native_amount)*100)),n.autoConversion||(d=Math.round(-100+parseFloat(h.amount)*-1/parseFloat(c.amount)*100));let f={amount:n.autoConversion?V(h.native_amount,h.native_currency_code):V(h.amount,h.currency_code),percentage:d,date:J(new Date(h.date),"PP"),foreign_amount:null};h.foreign_currency_code!==null&&(f.foreign_amount=n.autoConversion?h.foreign_native_amount:h.foreign_amount,f.foreign_currency_code=n.autoConversion?h.native_currency_code:h.foreign_currency_code),c.transactions.push(f)}if(Ct[r].bills.push(c),o.attributes.paid_dates.length===0){const u=o.attributes.pay_dates.length*c.amount,h=o.attributes.pay_dates.length*c.native_amount;Ct[r].payment_info.hasOwnProperty(c.currency_code)||(Ct[r].payment_info[c.currency_code]={currency_code:c.currency_code,paid:0,unpaid:0,native_currency_code:c.native_currency_code,native_paid:0,native_unpaid:0}),Ct[r].payment_info[c.currency_code].unpaid+=u,Ct[r].payment_info[c.currency_code].native_unpaid+=h}if(o.attributes.paid_dates.length>0){for(let u in o.attributes.paid_dates)if(o.attributes.paid_dates.hasOwnProperty(u)){let h=o.attributes.paid_dates[u];Ct[r].payment_info.hasOwnProperty(h.currency_code)||(Ct[r].payment_info[h.currency_code]={currency_code:c.currency_code,paid:0,unpaid:0,native_currency_code:c.native_currency_code,native_paid:0,native_unpaid:0});const d=parseFloat(h.amount)*-1,f=parseFloat(h.native_amount)*-1;Ct[r].payment_info[h.currency_code].paid+=d,Ct[r].payment_info[h.currency_code].native_paid+=f}}}}return parseInt(e.data.meta.pagination.total_pages)>n.page?(n.page++,Pa(n)):Promise.resolve()})}const rp=()=>({loading:!1,autoConversion:!1,subscriptions:[],startSubscriptions(){this.loading=!0;let n=new Date(window.store.get("start")),t=new Date(window.store.get("end"));console.log("here we are");const e=window.store.get("cacheValid");let i=window.store.get(Wt("subscriptions-data-dashboard",n,t));e&&typeof i<"u",Ct={},this.subscriptions=[],console.log("cache is invalid, must download");let s={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),autoConversion:this.autoConversion,page:1};Pa(s).then(()=>{console.log("Done with download!");let o=Object.values(Ct);for(let r in o)if(o.hasOwnProperty(r)){let a=o[r];const l=Object.keys(a.payment_info);a.col_size=l.length===1?"col-6 offset-3":"col-6",a.chart_width=l.length===1?"50%":"100%",a.payment_length=l.length,this.subscriptions.push(a)}this.loading=!1})},drawPieChart(n,t,e){let i="#pie_"+n+"_"+e.currency_code;const s=this.autoConversion?e.native_unpaid:e.unpaid,o=this.autoConversion?e.native_paid:e.paid,r=this.autoConversion?e.native_currency_code:e.currency_code,l={type:"doughnut",data:{labels:[ee.t("firefly.paid"),ee.t("firefly.unpaid")],datasets:[{label:ee.t("firefly.subscriptions_in_group",{title:t}),data:[o,s],backgroundColor:["rgb(54, 162, 235)","rgb(255, 99, 132)"],hoverOffset:4}]},options:{plugins:{tooltip:{callbacks:{label:function(u){return u.dataset.label+": "+V(u.raw,r)}}}}}};var c=mt.getChart(document.querySelector(i));typeof c<"u"&&c.destroy(),new mt(document.querySelector(i),l)},init(){console.log("subscriptions init"),Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{console.log("subscriptions after promises"),this.autoConversion=n[0],Hi=!0,ee=new li;const t=n[1].replace("-","_");ee.locale=t,ci(ee,t).then(()=>{this.loading===!1&&this.startSubscriptions()})}),window.store.observe("end",()=>{Hi&&(console.log("subscriptions observe end"),this.loading===!1&&this.startSubscriptions())}),window.store.observe("autoConversion",n=>{Hi&&(console.log("subscriptions observe autoConversion"),this.autoConversion=n,this.loading===!1&&this.startSubscriptions())})}});class ap{list(t){return vt.get("/api/v2/piggy-banks",{params:t})}}let Yt={},Vi=!1,Vn;const mr="dashboard-piggies-data",lp=()=>({loading:!1,autoConversion:!1,sankeyGrouping:"account",piggies:[],getFreshData(){const n=new Date(window.store.get("start")),t=new Date(window.store.get("end")),e=Wt(mr,n,t),i=window.store.get("cacheValid");let s=window.store.get(e);if(i&&typeof s<"u"){Yt=s,this.parsePiggies(),this.loading=!1;return}let o={start:J(n,"y-MM-dd"),end:J(t,"y-MM-dd"),page:1};this.downloadPiggyBanks(o)},downloadPiggyBanks(n){const t=new Date(window.store.get("start")),e=new Date(window.store.get("end")),i=Wt(mr,t,e);new ap().list(n).then(o=>{if(Yt=[...Yt,...o.data.data],parseInt(o.data.meta.pagination.total_pages)>n.page){n.page++,this.downloadPiggyBanks(n);return}window.store.set(i,Yt),this.parsePiggies(),this.loading=!1})},parsePiggies(){let n=[];for(let t in Yt)if(Yt.hasOwnProperty(t)){let e=Yt[t];if(e.attributes.percentage>=100||e.attributes.percentage===0)continue;let i=e.object_group_title??Vn.t("firefly.default_group_title_name_plain");n.hasOwnProperty(i)||(n[i]={id:e.object_group_id??0,title:i,order:e.object_group_order??0,piggies:[]});let s={id:e.id,name:e.attributes.name,percentage:parseInt(e.attributes.percentage),amount:this.autoConversion?e.attributes.native_current_amount:e.attributes.current_amount,left_to_save:this.autoConversion?e.attributes.native_left_to_save:e.attributes.left_to_save,target_amount:this.autoConversion?e.attributes.native_target_amount:e.attributes.target_amount,save_per_month:this.autoConversion?e.attributes.native_save_per_month:e.attributes.save_per_month,currency_code:this.autoConversion?e.attributes.native_currency_code:e.attributes.currency_code};n[i].piggies.push(s)}this.piggies=Object.values(n)},loadPiggyBanks(){if(this.loading!==!0){if(this.loading=!0,this.piggies.length!==0){this.parsePiggies(),this.loading=!1;return}this.getFreshData()}},init(){Yt=[],Promise.all([bt("autoConversion",!1),bt("language","en_US")]).then(n=>{Vn=new li;const t=n[1].replace("-","_");Vn.locale=t,ci(Vn,t).then(()=>{Vi=!0,this.autoConversion=n[0],this.loadPiggyBanks()})}),window.store.observe("end",()=>{Vi&&(Yt=[],this.loadPiggyBanks())}),window.store.observe("autoConversion",n=>{Vi&&(this.autoConversion=n,this.loadPiggyBanks())})}});/*! * chartjs-adapter-date-fns v3.0.0 * https://www.chartjs.org * (c) 2022 chartjs-adapter-date-fns Contributors * Released under the MIT license - */const cp={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};sa._date.override({_id:"date-fns",formats:function(){return cp},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=j(n):e==="string"&&(typeof t=="string"?n=pc(n,t,new Date,this.options):n=_c(n,this.options)),Na(n)?n.getTime():null},format:function(n,t){return J(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return ai(n,t);case"second":return Ja(n,t);case"minute":return Qa(n,t);case"hour":return qa(n,t);case"day":return mr(n,t);case"week":return tl(n,t);case"month":return ls(n,t);case"quarter":return Za(n,t);case"year":return el(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return di(n,t);case"second":return ul(n,t);case"minute":return al(n,t);case"hour":return rl(n,t);case"day":return vr(n,t);case"week":return hl(n,t);case"month":return wr(n,t);case"quarter":return cl(n,t);case"year":return dl(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return yc(n);case"minute":return fl(n);case"hour":return bc(n);case"day":return Yi(n);case"week":return Ls(n);case"isoWeek":return Ls(n,{weekStartsOn:+e});case"month":return Va(n);case"quarter":return Ha(n);case"year":return Wa(n);default:return n}},endOf:function(n,t){switch(t){case"second":return bl(n);case"minute":return ml(n);case"hour":return pl(n);case"day":return br(n);case"week":return ja(n);case"month":return yr(n);case"quarter":return Ya(n);case"year":return gl(n);default:return n}}});mt.register({LineController:jn,LineElement:oe,ArcElement:Ze,BarController:Yn,TimeScale:pn,PieController:Qi,BarElement:Kn,Filler:Jf,Colors:Rf,LinearScale:os,CategoryScale:ss,PointElement:Xn,Tooltip:fg,Legend:og});const Da={dates:Ua,boxes:Ec,accounts:Ng,budgets:Hg,categories:Yg,sankey:sp,subscriptions:rp,piggies:lp};function Ta(n){Object.keys(n).forEach(t=>{console.log(`Loading page component "${t}"`);let e=n[t]();Alpine.data(t,()=>e)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{Ta(Da)});window.bootstrapped&&Ta(Da); + */const cp={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};sa._date.override({_id:"date-fns",formats:function(){return cp},parse:function(n,t){if(n===null||typeof n>"u")return null;const e=typeof n;return e==="number"||n instanceof Date?n=j(n):e==="string"&&(typeof t=="string"?n=pc(n,t,new Date,this.options):n=_c(n,this.options)),Na(n)?n.getTime():null},format:function(n,t){return J(n,t,this.options)},add:function(n,t,e){switch(e){case"millisecond":return ai(n,t);case"second":return Ja(n,t);case"minute":return Qa(n,t);case"hour":return qa(n,t);case"day":return br(n,t);case"week":return tl(n,t);case"month":return ls(n,t);case"quarter":return Za(n,t);case"year":return el(n,t);default:return n}},diff:function(n,t,e){switch(e){case"millisecond":return di(n,t);case"second":return ul(n,t);case"minute":return al(n,t);case"hour":return rl(n,t);case"day":return wr(n,t);case"week":return hl(n,t);case"month":return Mr(n,t);case"quarter":return cl(n,t);case"year":return dl(n,t);default:return 0}},startOf:function(n,t,e){switch(t){case"second":return yc(n);case"minute":return fl(n);case"hour":return bc(n);case"day":return Yi(n);case"week":return Rs(n);case"isoWeek":return Rs(n,{weekStartsOn:+e});case"month":return Va(n);case"quarter":return Ha(n);case"year":return Wa(n);default:return n}},endOf:function(n,t){switch(t){case"second":return bl(n);case"minute":return ml(n);case"hour":return pl(n);case"day":return yr(n);case"week":return ja(n);case"month":return _r(n);case"quarter":return Ya(n);case"year":return gl(n);default:return n}}});mt.register({LineController:jn,LineElement:oe,ArcElement:Ze,BarController:Yn,TimeScale:pn,PieController:Qi,BarElement:Kn,Filler:Jf,Colors:Rf,LinearScale:os,CategoryScale:ss,PointElement:Xn,Tooltip:fg,Legend:og});const Da={dates:Ua,boxes:Ec,accounts:Ng,budgets:Hg,categories:Yg,sankey:sp,subscriptions:rp,piggies:lp};function Ta(n){Object.keys(n).forEach(t=>{console.log(`Loading page component "${t}"`);let e=n[t]();Alpine.data(t,()=>e)}),Alpine.start()}document.addEventListener("firefly-iii-bootstrapped",()=>{Ta(Da)});window.bootstrapped&&Ta(Da); diff --git a/public/build/manifest.json b/public/build/manifest.json index 96dc409ca4..bf57cba6f8 100644 --- a/public/build/manifest.json +++ b/public/build/manifest.json @@ -34,13 +34,13 @@ "integrity": "sha384-YxWlWCDksuL6Ljn1HkJNPH8l+jSRIWPpMpPw3pFa0QnmLXjwV/uPwpDm/b9vn/o1" }, "resources/assets/v2/pages/dashboard/dashboard.js": { - "file": "assets/dashboard-bbfa9fdd.js", + "file": "assets/dashboard-bfc72cdb.js", "imports": [ "_load-translations-85b093de.js" ], "isEntry": true, "src": "resources/assets/v2/pages/dashboard/dashboard.js", - "integrity": "sha384-D9wIrG50TM969uTxbreMoPpYTclflCeTXoB0Ca5slHzHoHsXkoeEPB4XGdck6zEE" + "integrity": "sha384-kE37MWn3DWfTheoMqJM1SS56PGlwlaaoJEIf66eW+ROFo88rAWyrwX52Jy0Q/0yU" }, "resources/assets/v2/pages/transactions/create.js": { "file": "assets/create-46a6e026.js",