Showing preview only (1,726K chars total). Download the full file or copy to clipboard to get everything.
Repository: ankane/pghero
Branch: master
Commit: c11401560bda
Files: 120
Total size: 1.6 MB
Directory structure:
gitextract_se7u5gh2/
├── .gitattributes
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── config.yml
│ │ └── issue.md
│ └── workflows/
│ └── build.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── app/
│ ├── assets/
│ │ ├── javascripts/
│ │ │ └── pghero/
│ │ │ ├── Chart.bundle.js
│ │ │ ├── application.js
│ │ │ ├── chartkick.js
│ │ │ ├── jquery.js
│ │ │ └── nouislider.js
│ │ └── stylesheets/
│ │ └── pghero/
│ │ ├── application.css
│ │ ├── arduino-light.css
│ │ └── nouislider.css
│ ├── controllers/
│ │ └── pg_hero/
│ │ └── home_controller.rb
│ ├── helpers/
│ │ └── pg_hero/
│ │ └── home_helper.rb
│ └── views/
│ ├── layouts/
│ │ └── pg_hero/
│ │ └── application.html.erb
│ └── pg_hero/
│ └── home/
│ ├── _connections_table.html.erb
│ ├── _live_queries_table.html.erb
│ ├── _queries_table.html.erb
│ ├── _query_stats_slider.html.erb
│ ├── _suggested_index.html.erb
│ ├── connections.html.erb
│ ├── explain.html.erb
│ ├── index.html.erb
│ ├── index_bloat.html.erb
│ ├── live_queries.html.erb
│ ├── maintenance.html.erb
│ ├── queries.html.erb
│ ├── relation_space.html.erb
│ ├── show_query.html.erb
│ ├── space.html.erb
│ ├── system.html.erb
│ └── tune.html.erb
├── config/
│ └── routes.rb
├── gemfiles/
│ ├── activerecord71.gemfile
│ ├── activerecord72.gemfile
│ └── activerecord80.gemfile
├── guides/
│ ├── Contributing.md
│ ├── Docker.md
│ ├── Linux.md
│ ├── Permissions.md
│ ├── Query-Stats.md
│ ├── Rails.md
│ └── Suggested-Indexes.md
├── lib/
│ ├── generators/
│ │ └── pghero/
│ │ ├── config_generator.rb
│ │ ├── query_stats_generator.rb
│ │ ├── space_stats_generator.rb
│ │ └── templates/
│ │ ├── config.yml.tt
│ │ ├── query_stats.rb.tt
│ │ └── space_stats.rb.tt
│ ├── pghero/
│ │ ├── connection.rb
│ │ ├── database.rb
│ │ ├── engine.rb
│ │ ├── methods/
│ │ │ ├── basic.rb
│ │ │ ├── connections.rb
│ │ │ ├── constraints.rb
│ │ │ ├── explain.rb
│ │ │ ├── indexes.rb
│ │ │ ├── kill.rb
│ │ │ ├── maintenance.rb
│ │ │ ├── queries.rb
│ │ │ ├── query_stats.rb
│ │ │ ├── replication.rb
│ │ │ ├── sequences.rb
│ │ │ ├── settings.rb
│ │ │ ├── space.rb
│ │ │ ├── suggested_indexes.rb
│ │ │ ├── system.rb
│ │ │ ├── tables.rb
│ │ │ └── users.rb
│ │ ├── query_stats.rb
│ │ ├── space_stats.rb
│ │ ├── stats.rb
│ │ └── version.rb
│ ├── pghero.rb
│ └── tasks/
│ └── pghero.rake
├── licenses/
│ ├── LICENSE-chart.js.txt
│ ├── LICENSE-chartjs-adapter-date-fns.txt
│ ├── LICENSE-chartkick.js.txt
│ ├── LICENSE-date-fns.txt
│ ├── LICENSE-highlight.js.txt
│ ├── LICENSE-jquery.txt
│ ├── LICENSE-kurkle-color.txt
│ └── LICENSE-nouislider.txt
├── pghero.gemspec
└── test/
├── basic_test.rb
├── best_index_test.rb
├── config_generator_test.rb
├── connections_test.rb
├── constraints_test.rb
├── controller_test.rb
├── database_test.rb
├── explain_test.rb
├── indexes_test.rb
├── internal/
│ ├── app/
│ │ └── assets/
│ │ └── config/
│ │ └── manifest.js
│ ├── config/
│ │ ├── database.yml
│ │ └── routes.rb
│ └── db/
│ └── schema.rb
├── kill_test.rb
├── maintenance_test.rb
├── module_test.rb
├── queries_test.rb
├── query_stats_generator_test.rb
├── query_stats_test.rb
├── replication_test.rb
├── sequences_test.rb
├── settings_test.rb
├── space_stats_generator_test.rb
├── space_test.rb
├── suggested_indexes_test.rb
├── system_test.rb
├── tables_test.rb
├── test_helper.rb
└── users_test.rb
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
app/assets/** linguist-vendored
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
================================================
FILE: .github/ISSUE_TEMPLATE/issue.md
================================================
---
name: Issue
about: Create an issue
---
Hi,
Before creating an issue, please check out the Contributing Guide:
https://github.com/ankane/pghero/blob/master/CONTRIBUTING.md
Thanks!
================================================
FILE: .github/workflows/build.yml
================================================
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- ruby: "4.0"
gemfile: Gemfile
postgres: 18
- ruby: 3.4
gemfile: gemfiles/activerecord80.gemfile
postgres: 16
- ruby: 3.3
gemfile: gemfiles/activerecord72.gemfile
postgres: 15
- ruby: 3.2
gemfile: gemfiles/activerecord71.gemfile
postgres: 13
os: ubuntu-22.04
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ matrix.postgres }}
database: pghero_test
config: |
shared_preload_libraries = 'pg_stat_statements'
- run: bundle exec rake test
================================================
FILE: .gitignore
================================================
*.gem
*.rbc
.bundle
.config
.yardoc
*.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
*.bundle
*.so
*.o
*.a
*.log
================================================
FILE: CHANGELOG.md
================================================
## 3.7.0 (2025-05-26)
- Dropped support for Linux package for Ubuntu 20.04
- Dropped support for Ruby < 3.2 and Rails < 7.1
## 3.6.2 (2025-03-21)
- Improved query in `sequences` method
## 3.6.1 (2024-10-14)
- Fixed error when Propshaft is installed but not used
## 3.6.0 (2024-07-10)
- Improved CSP support
- Dropped support for Linux packages for Ubuntu 18.04, CentOS 7, and SLES 12
- Dropped support for Ruby < 3.1 and Rails < 6.1
## 3.5.0 (2024-05-21)
- Added materialized views to space page and `relation_sizes` method
- Added Linux package for Debian 12
- Fixed error with `slow_queries` method
## 3.4.1 (2024-02-07)
- Added current stats to query details page
- Improved tune page for latest PgTune
## 3.4.0 (2023-11-28)
- Added support for explaining normalized queries with Postgres 16
- Added Docker image for `linux/arm64`
## 3.3.4 (2023-09-05)
- Fixed support for aliases in config file
## 3.3.3 (2023-04-18)
- Fixed error with system stats for Azure Database
## 3.3.2 (2023-04-12)
- Fixed error with suggested indexes and empty statements
## 3.3.1 (2023-03-15)
- Fixed error with Uglifier
## 3.3.0 (2023-03-11)
- Improved handling of lock timeouts
- Improved syntax highlighting
## 3.2.0 (2023-02-21)
- Added support for pg_query 4
- Added `pghero:clean_space_stats` rake task
- Added support for specifying retention period with `clean_query_stats` and `clean_space_stats`
- Removed reset button when historical query stats are enabled
## 3.1.0 (2023-01-04)
- Fixed explain error message leaking data - [more info](https://github.com/ankane/pghero/issues/439)
- Explain analyze is now opt-in - [more info](https://github.com/ankane/pghero/issues/438)
- Added support for disabling explain and explain analyze
- Added support for visualize without explain analyze
- Added `explain_v2` method
## 3.0.1 (2022-10-09)
- Fixed message when database user does not have permission to reset query stats
## 3.0.0 (2022-09-13)
- Changed `capture_query_stats` to only reset stats for current database in Postgres 12+
- Changed `reset_query_stats` to only reset stats for current database (use `reset_instance_query_stats` to reset stats for entire instance)
- Added `visualize_url` option to config
- Removed `access_key_id`, `secret_access_key`, `region`, and `db_instance_identifier` methods (use `aws_` prefixed methods instead)
- Dropped support for Linux packages for EOL versions
- Dropped support for Ruby < 2.7 and Rails < 6
- Dropped support for pg_query < 2
- Dropped support for aws-sdk < 2
## 2.8.3 (2022-05-01)
- Added support for `google-apis-monitoring_v3`
- Added experimental support for Propshaft
- Fixed error with walsender queries on live queries page
## 2.8.2 (2021-12-15)
- Fixed sorting by name on space page when historical space stats are not enabled
- Fixed deprecation warnings with Active Record 7
## 2.8.1 (2021-03-25)
- Added support for pg_query 2
## 2.8.0 (2021-03-14)
- No longer show walsender in long running queries
- Show relative time on maintenance page
- Added support for `PGHERO_TZ` for Docker and Linux
## 2.7.4 (2021-02-01)
- Fixed error on redirect with Ruby 3
- Fixed error with unparsable sequences
## 2.7.3 (2020-11-23)
- Improved index suggestions when hash, GiST, GIN, or BRIN index present
## 2.7.2 (2020-09-10)
- Fixed error with historical query stats
## 2.7.1 (2020-09-07)
- Added `/health` endpoint to Docker image and Linux packages
- Fixed error with `cast_value`
## 2.7.0 (2020-08-04)
- Fixed CSRF vulnerability with non-session based authentication - [more info](https://github.com/ankane/pghero/issues/330)
- Added `database`, `user`, and `query_hash` options to `reset_query_stats` method
## 2.6.0 (2020-07-09)
- Added support for Postgres 13 beta 2
- Added support for non-integer explain timeout
## 2.5.1 (2020-06-23)
- Added support for `google-cloud-monitoring` >= 1
- Added support for `google-cloud-monitoring-v3`
- Fixed system stats not showing up in Rails 6 with environment variables
## 2.5.0 (2020-05-24)
- Added system stats for Google Cloud SQL and Azure Database
- Added experimental `filter_data` option
- Localized times on maintenance page
- Improved connection pooling
- Improved error message for non-Postgres connections
- Fixed more deprecation warnings in Ruby 2.7
## 2.4.2 (2020-04-16)
- Added `connections` method
- Fixed deprecation warnings in Ruby 2.7
## 2.4.1 (2019-11-21)
- Fixed file permissions on `highlight.pack.js`
## 2.4.0 (2019-11-11)
- Added `invalid_constraints` method
- Added `spec` option
- Added `override_csp` option
- Show all databases in Rails 6 when no config
## 2.3.0 (2019-08-18)
- Added support for Postgres 12 beta 1
- Added methods and tasks for cleaning up stats
- Dropped support for Rails < 5
## 2.2.1 (2019-06-04)
- Added `config_path` option
- Fixed error with sequences when temporary tables
- Fixed error when `config.action_controller.include_all_helpers = false`
## 2.2.0 (2018-09-03)
- Added check for connections idle in transaction
- Improved duplicate index logic to detect more duplicates
- Don't report concurrent indexes in-progress as invalid on dashboard
- Fixed error with large number of sequences
- Bumped `total_connections_threshold` to 500 by default
## 2.1.1 (2018-04-24)
- Added `explain_timeout_sec` option
- Fixed error with unparsable sequences
- Stopped throwing `Same sequence name in multiple schemas` error
## 2.1.0 (2017-11-30)
- Fixed issue with sequences in different schema than table
- No longer throw errors for unreadable sequences
- Fixed replication lag for Amazon Aurora
- Added `vacuum_progress` method
## 2.0.8 (2017-11-12)
- Added support for Postgres 10 replicas
- Added support for pg_query 1.0.0
- Show queries with insufficient privilege on live queries page
- Default to table schema for sequences
## 2.0.7 (2017-10-28)
- Fixed issue with sequences in different schema than table
- Fixed query details when multiple users have same query hash
- Fixed error with invalid indexes in non-public schema
- Raise error when capture query stats fails
## 2.0.6 (2017-09-24)
- More robust methods for multiple databases
- Added support for `RAILS_RELATIVE_URL_ROOT` for Linux and Docker
## 2.0.5 (2017-09-14)
- Fixed error with sequences in different schemas
- Better advice
## 2.0.4 (2017-08-28)
- Fixed `AssetNotPrecompiled` error
- Do not silently ignore sequence danger when user does not have permissions
## 2.0.3 (2017-08-22)
- Added SQL to recreate invalid indexes
- Added unused index marker to Space page
- Fixed `capture_query_stats` on Postgres < 9.4
## 2.0.2 (2017-08-09)
- Fixed error with suggested indexes
- Fixed error with `pg_replication_slots`
## 2.0.1 (2017-08-08)
- Fixed capture space stats
## 2.0.0 (2017-08-08)
New features
- Query details page
- Added check for inactive replication slots
- Added `table_sizes` method for full table sizes
- Added syntax highlighting
- Added `min_size` option to `analyze_tables`
Breaking changes
- Methods now return symbols for keys instead of strings
- Methods raise `PgHero::NotEnabled` error when a feature isn’t enabled
- Requires pg_query 0.9.0+ for suggested indexes
- Historical query stats require the `pghero_query_stats` table to have `query_hash` and `user` columns
- Removed `with` option - use:
```ruby
PgHero.databases[:database2].running_queries
```
instead of
```ruby
PgHero.with(:database2) { PgHero.running_queries }
```
- Removed options from `connection_sources` method
- Removed `locks` method
## 1.7.0 (2017-05-01)
- Fixed migrations for Rails 5.1+
- Added `analyze`, `analyze_tables`, and `analyze_all` methods
- Added `pghero:analyze` rake task
- Fixed system stats display issue
## 1.6.5 (2017-04-19)
- Added support for Rails API
- Added support for Amazon STS
- Fixed replica check when `hot_standby = on` for primary
## 1.6.4 (2017-03-12)
- Only show connection charts if there are connections
- Fixed duplicate indexes for multiple schemas
- Fixed display issue for queries without word break
- Removed maintenance tab for replicas
## 1.6.3 (2017-02-09)
- Added 10 second timeout for explain
- No longer show autovacuum in long running queries
- Added charts for connections
- Added new config format
- Removed Chartkick gem dependency for charts
- Fixed error when primary database is not PostgreSQL
## 1.6.2 (2016-10-26)
- Suggest GiST over GIN for `LIKE` queries again (seeing better performance)
## 1.6.1 (2016-10-24)
- Suggest GIN over GiST for `LIKE` queries
## 1.6.0 (2016-10-20)
- Removed mostly inactionable items (cache hit rate and index usage)
- Restored duplicate indexes to homepage
- Fixed issue with exact duplicate indexes
- Way better `blocked_queries` method
## 1.5.3 (2016-10-06)
- Fixed Rails 5 error with multiple databases
- Fixed duplicate index detection with expressions
## 1.5.2 (2016-10-01)
- Added support for PostgreSQL 9.6
- Fixed incorrect query start for live queries in transactions
## 1.5.1 (2016-09-27)
- Better tune page for PostgreSQL 9.5
## 1.5.0 (2016-09-21)
- Added user to query stats (opt-in)
- Added user to connection sources
- Added `capture_space_stats` method and rake task
- Added visualize button to explain page
- Better charts for system stats
## 1.4.2 (2016-09-06)
- Fixed `wrong constant name` error in development
- Added different periods for system stats
## 1.4.1 (2016-08-25)
- Removed external assets
## 1.4.0 (2016-08-24)
- Updated for Rails 5
- Fixed error when `pg_stat_statements` not enabled in `shared_libraries`
## 1.3.2 (2016-08-03)
- Improved performance of query stats
## 1.3.1 (2016-07-10)
- Improved grouping of query stats
- Added `blocked_queries` method
## 1.3.0 (2016-06-27)
- Added query hash for better query stats grouping
- Added sequence danger check
- Added `capture_query_stats` option to config
## 1.2.4 (2016-05-06)
- Fixed user methods
## 1.2.3 (2016-04-20)
- Added schema to queries
- Fixed deprecation warning on Rails 5
- Fix for pg_query >= 0.9.0
## 1.2.2 (2016-01-20)
- Better suggested indexes
- Removed duplicate indexes noise
- Fixed partial and expression indexes
## 1.2.1 (2016-01-07)
- Better suggested indexes
- Removed unused indexes noise
- Removed autovacuum danger noise
- Removed maintenance tab
- Fixed suggested indexes for replicas
- Fixed issue w/ suggested indexes where same table name exists in multiple schemas
## 1.2.0 (2015-12-31)
- Added suggested indexes
- Added duplicate indexes
- Added maintenance tab
- Added load stats for RDS
- Added `table_caching` and `index_caching` methods
- Added configurable cache hit rate threshold
- Show all connections in connections tab
## 1.1.4 (2015-12-08)
- Added check for transaction ID wraparound failure
- Added check for autovacuum danger
## 1.1.3 (2015-10-21)
- Fixed system stats
## 1.1.2 (2015-10-18)
- Added invalid indexes
- Fixed RDS stats for aws-sdk 2
## 1.1.1 (2015-07-23)
- Added `tables` option to `create_user` method
- Added ability to sort query stats by average_time and calls
- Only show unused indexes with no index scans in UI
## 1.1.0 (2015-06-26)
- Added historical query stats
## 1.0.1 (2015-04-17)
- Fixed connection bad errors
- Restore previous connection properly for nested with blocks
- Added analyze button to explain page
- Added explain button to live queries page
## 1.0.0 (2015-04-11)
- More platforms!
- Support for multiple databases!
- Added `replica?` method
- Added `replication_lag` method
- Added `ssl_used?` method
- Added `kill_long_running_queries` method
- Added env vars for settings
## 0.1.10 (2015-03-20)
- Added connections page
- Added message for insufficient privilege
- Added `ip` to `connection_sources`
## 0.1.9 (2015-01-25)
- Added tune page
- Removed minimum size for unused indexes
## 0.1.8 (2015-01-19)
- Added `total_percent` to `query_stats`
- Added `total_connections`
- Added `connection_stats` for Amazon RDS
## 0.1.7 (2014-11-12)
- Added support for pg_stat_statements on Amazon RDS
- Added `long_running_query_sec`, `slow_query_ms` and `slow_query_calls` options
## 0.1.6 (2014-10-09)
- Added methods to create and drop users
- Added locks
## 0.1.5 (2014-09-03)
- Added system stats for Amazon RDS
- Added code to remove unused indexes
- Require unused indexes to be at least 1 MB
- Use `pg_terminate_backend` to ensure queries are killed
## 0.1.4 (2014-08-31)
- Reduced long running queries threshold to 1 minute
- Fixed duration
- Fixed wrapping
- Friendlier dependencies for JRuby
## 0.1.3 (2014-08-04)
- Reverted `query_stats_available?` fix
## 0.1.2 (2014-08-03)
- Fixed `query_stats_available?` method
## 0.1.1 (2014-08-03)
- Added explain
- Added query stats
- Fixed CSS issues
## 0.1.0 (2014-07-23)
- Improved explanations
- Updated design
## 0.0.3 (2014-07-22)
- Fixed `missing_indexes` method
## 0.0.2 (2014-07-21)
- Added `unused_tables` method
- Added `database_size` method
## 0.0.1 (2014-07-21)
- First release
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
First, thanks for wanting to contribute. You’re awesome! :heart:
## Help
We’re not able to provide support through GitHub Issues. If you’re looking for help with your code, try posting on [Stack Overflow](https://stackoverflow.com/).
All features should be documented. If you don’t see a feature in the docs, assume it doesn’t exist.
## Bugs
Think you’ve discovered a bug?
1. Search existing issues to see if it’s been reported.
2. Try the `master` branch to make sure it hasn’t been fixed.
```rb
gem "pghero", github: "ankane/pghero"
```
If the above steps don’t help, create an issue. Include:
- Detailed steps to reproduce
- Complete backtraces for exceptions
## New Features
If you’d like to discuss a new feature, create an issue and start the title with `[Idea]`.
## Pull Requests
Fork the project and create a pull request. A few tips:
- Keep changes to a minimum. If you have multiple features or fixes, submit multiple pull requests.
- Follow the existing style. The code should read like it’s written by a single person.
Feel free to open an issue to get feedback on your idea before spending too much time on it.
---
This contributing guide is released under [CCO](https://creativecommons.org/publicdomain/zero/1.0/) (public domain). Use it for your own project without attribution.
================================================
FILE: Gemfile
================================================
source "https://rubygems.org"
gemspec
gem "rake"
gem "minitest"
gem "activerecord", "~> 8.1.0"
gem "combustion"
gem "pg"
gem "pg_query", platform: [:ruby, :windows]
gem "tzinfo-data", platform: :windows
================================================
FILE: LICENSE.txt
================================================
Copyright (c) 2014-2025 Andrew Kane, 2008-2014 Heroku (initial queries)
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# PgHero
A performance dashboard for Postgres
[See it in action](https://pghero.dokkuapp.com/)
[](https://pghero.dokkuapp.com/)
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
[](https://github.com/ankane/pghero/actions)
## Documentation
PgHero is available as a Docker image, Linux package, and Rails engine.
Select your preferred method of installation to get started.
- [Docker](guides/Docker.md)
- [Linux](guides/Linux.md)
- [Rails](guides/Rails.md)
## Related Projects
- [Dexter](https://github.com/ankane/dexter) - The automatic indexer for Postgres
- [PgBouncerHero](https://github.com/kwent/pgbouncerhero) - A dashboard for PgBouncer
- [pgsync](https://github.com/ankane/pgsync) - Sync Postgres data between databases
- [pgslice](https://github.com/ankane/pgslice) - Postgres partitioning as easy as pie
## Credits
A big thanks to [Craig Kerstiens](https://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/) and [Heroku](https://blog.heroku.com/archives/2013/5/10/more_insight_into_your_database_with_pgextras) for the initial queries and [Bootswatch](https://github.com/thomaspark/bootswatch) for the theme.
## History
View the [changelog](https://github.com/ankane/pghero/blob/master/CHANGELOG.md)
## Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- [Report bugs](https://github.com/ankane/pghero/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/pghero/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features
================================================
FILE: Rakefile
================================================
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.pattern = "test/**/*_test.rb"
end
task default: :test
================================================
FILE: app/assets/javascripts/pghero/Chart.bundle.js
================================================
/*!
* Chart.js v4.2.0
* https://www.chartjs.org
* (c) 2023 Chart.js Contributors
* Released under the MIT License
*
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*
* chartjs-adapter-date-fns v3.0.0
* https://www.chartjs.org
* (c) 2022 chartjs-adapter-date-fns Contributors
* Released under the MIT license
*
* date-fns v2.29.3
* https://date-fns.org
* (c) 2021 Sasha Koss and Lesha Koss
* Released under the MIT License
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Chart = factory());
})(this, (function () { 'use strict';
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty$w(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _typeof$z(obj) {
"@babel/helpers - typeof";
return _typeof$z = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof$z(obj);
}
function _classCallCheck$x(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties$x(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass$x(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties$x(Constructor.prototype, protoProps);
if (staticProps) _defineProperties$x(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty$w(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits$w(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf$w(subClass, superClass);
}
function _getPrototypeOf$w(o) {
_getPrototypeOf$w = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf$w(o);
}
function _setPrototypeOf$w(o, p) {
_setPrototypeOf$w = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf$w(o, p);
}
function _isNativeReflectConstruct$w() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized$w(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn$w(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized$w(self);
}
function _createSuper$w(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct$w();
return function _createSuperInternal() {
var Super = _getPrototypeOf$w(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf$w(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn$w(this, result);
};
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf$w(object);
if (object === null) break;
}
return object;
}
function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get.bind();
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(arguments.length < 3 ? target : receiver);
}
return desc.value;
};
}
return _get.apply(this, arguments);
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray$1(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
}
function _arrayLikeToArray$1(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _createForOfIteratorHelper$1(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function () {};
return {
s: F,
n: function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function (e) {
throw e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function () {
it = it.call(o);
},
n: function () {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function (e) {
didErr = true;
err = e;
},
f: function () {
try {
if (!normalCompletion && it.return != null) it.return();
} finally {
if (didErr) throw err;
}
}
};
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
/*!
* @kurkle/color v0.3.2
* https://github.com/kurkle/color#readme
* (c) 2023 Jukka Kurkela
* Released under the MIT License
*/
function round(v) {
return v + 0.5 | 0;
}
var lim = function lim(v, l, h) {
return Math.max(Math.min(v, h), l);
};
function p2b(v) {
return lim(round(v * 2.55), 0, 255);
}
function n2b(v) {
return lim(round(v * 255), 0, 255);
}
function b2n(v) {
return lim(round(v / 2.55) / 100, 0, 1);
}
function n2p(v) {
return lim(round(v * 100), 0, 100);
}
var map$1 = {
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
A: 10,
B: 11,
C: 12,
D: 13,
E: 14,
F: 15,
a: 10,
b: 11,
c: 12,
d: 13,
e: 14,
f: 15
};
var hex = _toConsumableArray('0123456789ABCDEF');
var h1 = function h1(b) {
return hex[b & 0xF];
};
var h2 = function h2(b) {
return hex[(b & 0xF0) >> 4] + hex[b & 0xF];
};
var eq = function eq(b) {
return (b & 0xF0) >> 4 === (b & 0xF);
};
var isShort = function isShort(v) {
return eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);
};
function hexParse(str) {
var len = str.length;
var ret;
if (str[0] === '#') {
if (len === 4 || len === 5) {
ret = {
r: 255 & map$1[str[1]] * 17,
g: 255 & map$1[str[2]] * 17,
b: 255 & map$1[str[3]] * 17,
a: len === 5 ? map$1[str[4]] * 17 : 255
};
} else if (len === 7 || len === 9) {
ret = {
r: map$1[str[1]] << 4 | map$1[str[2]],
g: map$1[str[3]] << 4 | map$1[str[4]],
b: map$1[str[5]] << 4 | map$1[str[6]],
a: len === 9 ? map$1[str[7]] << 4 | map$1[str[8]] : 255
};
}
}
return ret;
}
var alpha = function alpha(a, f) {
return a < 255 ? f(a) : '';
};
function _hexString(v) {
var f = isShort(v) ? h1 : h2;
return v ? '#' + f(v.r) + f(v.g) + f(v.b) + alpha(v.a, f) : undefined;
}
var HUE_RE = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
function hsl2rgbn(h, s, l) {
var a = s * Math.min(l, 1 - l);
var f = function f(n) {
var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (n + h / 30) % 12;
return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
};
return [f(0), f(8), f(4)];
}
function hsv2rgbn(h, s, v) {
var f = function f(n) {
var k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (n + h / 60) % 6;
return v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
};
return [f(5), f(3), f(1)];
}
function hwb2rgbn(h, w, b) {
var rgb = hsl2rgbn(h, 1, 0.5);
var i;
if (w + b > 1) {
i = 1 / (w + b);
w *= i;
b *= i;
}
for (i = 0; i < 3; i++) {
rgb[i] *= 1 - w - b;
rgb[i] += w;
}
return rgb;
}
function hueValue(r, g, b, d, max) {
if (r === max) {
return (g - b) / d + (g < b ? 6 : 0);
}
if (g === max) {
return (b - r) / d + 2;
}
return (r - g) / d + 4;
}
function rgb2hsl(v) {
var range = 255;
var r = v.r / range;
var g = v.g / range;
var b = v.b / range;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var l = (max + min) / 2;
var h, s, d;
if (max !== min) {
d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
h = hueValue(r, g, b, d, max);
h = h * 60 + 0.5;
}
return [h | 0, s || 0, l];
}
function calln(f, a, b, c) {
return (Array.isArray(a) ? f(a[0], a[1], a[2]) : f(a, b, c)).map(n2b);
}
function hsl2rgb(h, s, l) {
return calln(hsl2rgbn, h, s, l);
}
function hwb2rgb(h, w, b) {
return calln(hwb2rgbn, h, w, b);
}
function hsv2rgb(h, s, v) {
return calln(hsv2rgbn, h, s, v);
}
function hue(h) {
return (h % 360 + 360) % 360;
}
function hueParse(str) {
var m = HUE_RE.exec(str);
var a = 255;
var v;
if (!m) {
return;
}
if (m[5] !== v) {
a = m[6] ? p2b(+m[5]) : n2b(+m[5]);
}
var h = hue(+m[2]);
var p1 = +m[3] / 100;
var p2 = +m[4] / 100;
if (m[1] === 'hwb') {
v = hwb2rgb(h, p1, p2);
} else if (m[1] === 'hsv') {
v = hsv2rgb(h, p1, p2);
} else {
v = hsl2rgb(h, p1, p2);
}
return {
r: v[0],
g: v[1],
b: v[2],
a: a
};
}
function _rotate(v, deg) {
var h = rgb2hsl(v);
h[0] = hue(h[0] + deg);
h = hsl2rgb(h);
v.r = h[0];
v.g = h[1];
v.b = h[2];
}
function _hslString(v) {
if (!v) {
return;
}
var a = rgb2hsl(v);
var h = a[0];
var s = n2p(a[1]);
var l = n2p(a[2]);
return v.a < 255 ? "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(b2n(v.a), ")") : "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)");
}
var map$2 = {
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'
};
var names$1 = {
OiceXe: 'f0f8ff',
antiquewEte: 'faebd7',
aqua: 'ffff',
aquamarRe: '7fffd4',
azuY: 'f0ffff',
beige: 'f5f5dc',
bisque: 'ffe4c4',
black: '0',
blanKedOmond: 'ffebcd',
Xe: 'ff',
XeviTet: '8a2be2',
bPwn: 'a52a2a',
burlywood: 'deb887',
caMtXe: '5f9ea0',
KartYuse: '7fff00',
KocTate: 'd2691e',
cSO: 'ff7f50',
cSnflowerXe: '6495ed',
cSnsilk: 'fff8dc',
crimson: 'dc143c',
cyan: 'ffff',
xXe: '8b',
xcyan: '8b8b',
xgTMnPd: 'b8860b',
xWay: 'a9a9a9',
xgYF: '6400',
xgYy: 'a9a9a9',
xkhaki: 'bdb76b',
xmagFta: '8b008b',
xTivegYF: '556b2f',
xSange: 'ff8c00',
xScEd: '9932cc',
xYd: '8b0000',
xsOmon: 'e9967a',
xsHgYF: '8fbc8f',
xUXe: '483d8b',
xUWay: '2f4f4f',
xUgYy: '2f4f4f',
xQe: 'ced1',
xviTet: '9400d3',
dAppRk: 'ff1493',
dApskyXe: 'bfff',
dimWay: '696969',
dimgYy: '696969',
dodgerXe: '1e90ff',
fiYbrick: 'b22222',
flSOwEte: 'fffaf0',
foYstWAn: '228b22',
fuKsia: 'ff00ff',
gaRsbSo: 'dcdcdc',
ghostwEte: 'f8f8ff',
gTd: 'ffd700',
gTMnPd: 'daa520',
Way: '808080',
gYF: '8000',
gYFLw: 'adff2f',
gYy: '808080',
honeyMw: 'f0fff0',
hotpRk: 'ff69b4',
RdianYd: 'cd5c5c',
Rdigo: '4b0082',
ivSy: 'fffff0',
khaki: 'f0e68c',
lavFMr: 'e6e6fa',
lavFMrXsh: 'fff0f5',
lawngYF: '7cfc00',
NmoncEffon: 'fffacd',
ZXe: 'add8e6',
ZcSO: 'f08080',
Zcyan: 'e0ffff',
ZgTMnPdLw: 'fafad2',
ZWay: 'd3d3d3',
ZgYF: '90ee90',
ZgYy: 'd3d3d3',
ZpRk: 'ffb6c1',
ZsOmon: 'ffa07a',
ZsHgYF: '20b2aa',
ZskyXe: '87cefa',
ZUWay: '778899',
ZUgYy: '778899',
ZstAlXe: 'b0c4de',
ZLw: 'ffffe0',
lime: 'ff00',
limegYF: '32cd32',
lRF: 'faf0e6',
magFta: 'ff00ff',
maPon: '800000',
VaquamarRe: '66cdaa',
VXe: 'cd',
VScEd: 'ba55d3',
VpurpN: '9370db',
VsHgYF: '3cb371',
VUXe: '7b68ee',
VsprRggYF: 'fa9a',
VQe: '48d1cc',
VviTetYd: 'c71585',
midnightXe: '191970',
mRtcYam: 'f5fffa',
mistyPse: 'ffe4e1',
moccasR: 'ffe4b5',
navajowEte: 'ffdead',
navy: '80',
Tdlace: 'fdf5e6',
Tive: '808000',
TivedBb: '6b8e23',
Sange: 'ffa500',
SangeYd: 'ff4500',
ScEd: 'da70d6',
pOegTMnPd: 'eee8aa',
pOegYF: '98fb98',
pOeQe: 'afeeee',
pOeviTetYd: 'db7093',
papayawEp: 'ffefd5',
pHKpuff: 'ffdab9',
peru: 'cd853f',
pRk: 'ffc0cb',
plum: 'dda0dd',
powMrXe: 'b0e0e6',
purpN: '800080',
YbeccapurpN: '663399',
Yd: 'ff0000',
Psybrown: 'bc8f8f',
PyOXe: '4169e1',
saddNbPwn: '8b4513',
sOmon: 'fa8072',
sandybPwn: 'f4a460',
sHgYF: '2e8b57',
sHshell: 'fff5ee',
siFna: 'a0522d',
silver: 'c0c0c0',
skyXe: '87ceeb',
UXe: '6a5acd',
UWay: '708090',
UgYy: '708090',
snow: 'fffafa',
sprRggYF: 'ff7f',
stAlXe: '4682b4',
tan: 'd2b48c',
teO: '8080',
tEstN: 'd8bfd8',
tomato: 'ff6347',
Qe: '40e0d0',
viTet: 'ee82ee',
JHt: 'f5deb3',
wEte: 'ffffff',
wEtesmoke: 'f5f5f5',
Lw: 'ffff00',
LwgYF: '9acd32'
};
function unpack() {
var unpacked = {};
var keys = Object.keys(names$1);
var tkeys = Object.keys(map$2);
var i, j, k, ok, nk;
for (i = 0; i < keys.length; i++) {
ok = nk = keys[i];
for (j = 0; j < tkeys.length; j++) {
k = tkeys[j];
nk = nk.replace(k, map$2[k]);
}
k = parseInt(names$1[ok], 16);
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];
}
return unpacked;
}
var names;
function nameParse(str) {
if (!names) {
names = unpack();
names.transparent = [0, 0, 0, 0];
}
var a = names[str.toLowerCase()];
return a && {
r: a[0],
g: a[1],
b: a[2],
a: a.length === 4 ? a[3] : 255
};
}
var RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
function rgbParse(str) {
var m = RGB_RE.exec(str);
var a = 255;
var r, g, b;
if (!m) {
return;
}
if (m[7] !== r) {
var v = +m[7];
a = m[8] ? p2b(v) : lim(v * 255, 0, 255);
}
r = +m[1];
g = +m[3];
b = +m[5];
r = 255 & (m[2] ? p2b(r) : lim(r, 0, 255));
g = 255 & (m[4] ? p2b(g) : lim(g, 0, 255));
b = 255 & (m[6] ? p2b(b) : lim(b, 0, 255));
return {
r: r,
g: g,
b: b,
a: a
};
}
function _rgbString(v) {
return v && (v.a < 255 ? "rgba(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ", ").concat(b2n(v.a), ")") : "rgb(".concat(v.r, ", ").concat(v.g, ", ").concat(v.b, ")"));
}
var to = function to(v) {
return v <= 0.0031308 ? v * 12.92 : Math.pow(v, 1.0 / 2.4) * 1.055 - 0.055;
};
var from = function from(v) {
return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
};
function _interpolate(rgb1, rgb2, t) {
var r = from(b2n(rgb1.r));
var g = from(b2n(rgb1.g));
var b = from(b2n(rgb1.b));
return {
r: n2b(to(r + t * (from(b2n(rgb2.r)) - r))),
g: n2b(to(g + t * (from(b2n(rgb2.g)) - g))),
b: n2b(to(b + t * (from(b2n(rgb2.b)) - b))),
a: rgb1.a + t * (rgb2.a - rgb1.a)
};
}
function modHSL(v, i, ratio) {
if (v) {
var tmp = rgb2hsl(v);
tmp[i] = Math.max(0, Math.min(tmp[i] + tmp[i] * ratio, i === 0 ? 360 : 1));
tmp = hsl2rgb(tmp);
v.r = tmp[0];
v.g = tmp[1];
v.b = tmp[2];
}
}
function clone$1(v, proto) {
return v ? Object.assign(proto || {}, v) : v;
}
function fromObject(input) {
var v = {
r: 0,
g: 0,
b: 0,
a: 255
};
if (Array.isArray(input)) {
if (input.length >= 3) {
v = {
r: input[0],
g: input[1],
b: input[2],
a: 255
};
if (input.length > 3) {
v.a = n2b(input[3]);
}
}
} else {
v = clone$1(input, {
r: 0,
g: 0,
b: 0,
a: 1
});
v.a = n2b(v.a);
}
return v;
}
function functionParse(str) {
if (str.charAt(0) === 'r') {
return rgbParse(str);
}
return hueParse(str);
}
var Color = /*#__PURE__*/function () {
function Color(input) {
_classCallCheck$x(this, Color);
if (input instanceof Color) {
return input;
}
var type = _typeof$z(input);
var v;
if (type === 'object') {
v = fromObject(input);
} else if (type === 'string') {
v = hexParse(input) || nameParse(input) || functionParse(input);
}
this._rgb = v;
this._valid = !!v;
}
_createClass$x(Color, [{
key: "valid",
get: function get() {
return this._valid;
}
}, {
key: "rgb",
get: function get() {
var v = clone$1(this._rgb);
if (v) {
v.a = b2n(v.a);
}
return v;
},
set: function set(obj) {
this._rgb = fromObject(obj);
}
}, {
key: "rgbString",
value: function rgbString() {
return this._valid ? _rgbString(this._rgb) : undefined;
}
}, {
key: "hexString",
value: function hexString() {
return this._valid ? _hexString(this._rgb) : undefined;
}
}, {
key: "hslString",
value: function hslString() {
return this._valid ? _hslString(this._rgb) : undefined;
}
}, {
key: "mix",
value: function mix(color, weight) {
if (color) {
var c1 = this.rgb;
var c2 = color.rgb;
var w2;
var p = weight === w2 ? 0.5 : weight;
var w = 2 * p - 1;
var a = c1.a - c2.a;
var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
w2 = 1 - w1;
c1.r = 0xFF & w1 * c1.r + w2 * c2.r + 0.5;
c1.g = 0xFF & w1 * c1.g + w2 * c2.g + 0.5;
c1.b = 0xFF & w1 * c1.b + w2 * c2.b + 0.5;
c1.a = p * c1.a + (1 - p) * c2.a;
this.rgb = c1;
}
return this;
}
}, {
key: "interpolate",
value: function interpolate(color, t) {
if (color) {
this._rgb = _interpolate(this._rgb, color._rgb, t);
}
return this;
}
}, {
key: "clone",
value: function clone() {
return new Color(this.rgb);
}
}, {
key: "alpha",
value: function alpha(a) {
this._rgb.a = n2b(a);
return this;
}
}, {
key: "clearer",
value: function clearer(ratio) {
var rgb = this._rgb;
rgb.a *= 1 - ratio;
return this;
}
}, {
key: "greyscale",
value: function greyscale() {
var rgb = this._rgb;
var val = round(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);
rgb.r = rgb.g = rgb.b = val;
return this;
}
}, {
key: "opaquer",
value: function opaquer(ratio) {
var rgb = this._rgb;
rgb.a *= 1 + ratio;
return this;
}
}, {
key: "negate",
value: function negate() {
var v = this._rgb;
v.r = 255 - v.r;
v.g = 255 - v.g;
v.b = 255 - v.b;
return this;
}
}, {
key: "lighten",
value: function lighten(ratio) {
modHSL(this._rgb, 2, ratio);
return this;
}
}, {
key: "darken",
value: function darken(ratio) {
modHSL(this._rgb, 2, -ratio);
return this;
}
}, {
key: "saturate",
value: function saturate(ratio) {
modHSL(this._rgb, 1, ratio);
return this;
}
}, {
key: "desaturate",
value: function desaturate(ratio) {
modHSL(this._rgb, 1, -ratio);
return this;
}
}, {
key: "rotate",
value: function rotate(deg) {
_rotate(this._rgb, deg);
return this;
}
}]);
return Color;
}();
/**
* @namespace Chart.helpers
*/ /**
* An empty function that can be used, for example, for optional callback.
*/
function noop() {
/* noop */}
/**
* Returns a unique id, sequentially generated from a global variable.
*/
var uid = function () {
var id = 0;
return function () {
return id++;
};
}();
/**
* Returns true if `value` is neither null nor undefined, else returns false.
* @param value - The value to test.
* @since 2.7.0
*/
function isNullOrUndef(value) {
return value === null || typeof value === 'undefined';
}
/**
* Returns true if `value` is an array (including typed arrays), else returns false.
* @param value - The value to test.
* @function
*/
function isArray(value) {
if (Array.isArray && Array.isArray(value)) {
return true;
}
var type = Object.prototype.toString.call(value);
if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') {
return true;
}
return false;
}
/**
* Returns true if `value` is an object (excluding null), else returns false.
* @param value - The value to test.
* @since 2.7.0
*/
function isObject(value) {
return value !== null && Object.prototype.toString.call(value) === '[object Object]';
}
/**
* Returns true if `value` is a finite number, else returns false
* @param value - The value to test.
*/
function isNumberFinite(value) {
return (typeof value === 'number' || value instanceof Number) && isFinite(+value);
}
/**
* Returns `value` if finite, else returns `defaultValue`.
* @param value - The value to return if defined.
* @param defaultValue - The value to return if `value` is not finite.
*/
function finiteOrDefault(value, defaultValue) {
return isNumberFinite(value) ? value : defaultValue;
}
/**
* Returns `value` if defined, else returns `defaultValue`.
* @param value - The value to return if defined.
* @param defaultValue - The value to return if `value` is undefined.
*/
function valueOrDefault(value, defaultValue) {
return typeof value === 'undefined' ? defaultValue : value;
}
var toPercentage = function toPercentage(value, dimension) {
return typeof value === 'string' && value.endsWith('%') ? parseFloat(value) / 100 : +value / dimension;
};
var toDimension = function toDimension(value, dimension) {
return typeof value === 'string' && value.endsWith('%') ? parseFloat(value) / 100 * dimension : +value;
};
/**
* Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
* value returned by `fn`. If `fn` is not a function, this method returns undefined.
* @param fn - The function to call.
* @param args - The arguments with which `fn` should be called.
* @param [thisArg] - The value of `this` provided for the call to `fn`.
*/
function callback(fn, args, thisArg) {
if (fn && typeof fn.call === 'function') {
return fn.apply(thisArg, args);
}
}
function each(loopable, fn, thisArg, reverse) {
var i, len, keys;
if (isArray(loopable)) {
len = loopable.length;
if (reverse) {
for (i = len - 1; i >= 0; i--) {
fn.call(thisArg, loopable[i], i);
}
} else {
for (i = 0; i < len; i++) {
fn.call(thisArg, loopable[i], i);
}
}
} else if (isObject(loopable)) {
keys = Object.keys(loopable);
len = keys.length;
for (i = 0; i < len; i++) {
fn.call(thisArg, loopable[keys[i]], keys[i]);
}
}
}
/**
* Returns true if the `a0` and `a1` arrays have the same content, else returns false.
* @param a0 - The array to compare
* @param a1 - The array to compare
* @private
*/
function _elementsEqual(a0, a1) {
var i, ilen, v0, v1;
if (!a0 || !a1 || a0.length !== a1.length) {
return false;
}
for (i = 0, ilen = a0.length; i < ilen; ++i) {
v0 = a0[i];
v1 = a1[i];
if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {
return false;
}
}
return true;
}
/**
* Returns a deep copy of `source` without keeping references on objects and arrays.
* @param source - The value to clone.
*/
function clone(source) {
if (isArray(source)) {
return source.map(clone);
}
if (isObject(source)) {
var target = Object.create(null);
var keys = Object.keys(source);
var klen = keys.length;
var k = 0;
for (; k < klen; ++k) {
target[keys[k]] = clone(source[keys[k]]);
}
return target;
}
return source;
}
function isValidKey(key) {
return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;
}
/**
* The default merger when Chart.helpers.merge is called without merger option.
* Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.
* @private
*/
function _merger(key, target, source, options) {
if (!isValidKey(key)) {
return;
}
var tval = target[key];
var sval = source[key];
if (isObject(tval) && isObject(sval)) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
merge(tval, sval, options);
} else {
target[key] = clone(sval);
}
}
function merge(target, source, options) {
var sources = isArray(source) ? source : [source];
var ilen = sources.length;
if (!isObject(target)) {
return target;
}
options = options || {};
var merger = options.merger || _merger;
var current;
for (var i = 0; i < ilen; ++i) {
current = sources[i];
if (!isObject(current)) {
continue;
}
var keys = Object.keys(current);
for (var k = 0, klen = keys.length; k < klen; ++k) {
merger(keys[k], target, current, options);
}
}
return target;
}
function mergeIf(target, source) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return merge(target, source, {
merger: _mergerIf
});
}
/**
* Merges source[key] in target[key] only if target[key] is undefined.
* @private
*/
function _mergerIf(key, target, source) {
if (!isValidKey(key)) {
return;
}
var tval = target[key];
var sval = source[key];
if (isObject(tval) && isObject(sval)) {
mergeIf(tval, sval);
} else if (!Object.prototype.hasOwnProperty.call(target, key)) {
target[key] = clone(sval);
}
}
/**
* @private
*/
function _deprecated(scope, value, previous, current) {
if (value !== undefined) {
console.warn(scope + ': "' + previous + '" is deprecated. Please use "' + current + '" instead');
}
}
// resolveObjectKey resolver cache
var keyResolvers = {
// Chart.helpers.core resolveObjectKey should resolve empty key to root object
'': function _(v) {
return v;
},
// default resolvers
x: function x(o) {
return o.x;
},
y: function y(o) {
return o.y;
}
};
/**
* @private
*/
function _splitKey(key) {
var parts = key.split('.');
var keys = [];
var tmp = '';
var _iterator = _createForOfIteratorHelper$1(parts),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var part = _step.value;
tmp += part;
if (tmp.endsWith('\\')) {
tmp = tmp.slice(0, -1) + '.';
} else {
keys.push(tmp);
tmp = '';
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return keys;
}
function _getKeyResolver(key) {
var keys = _splitKey(key);
return function (obj) {
var _iterator2 = _createForOfIteratorHelper$1(keys),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var k = _step2.value;
if (k === '') {
break;
}
obj = obj && obj[k];
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
return obj;
};
}
function resolveObjectKey(obj, key) {
var resolver = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));
return resolver(obj);
}
/**
* @private
*/
function _capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
var defined = function defined(value) {
return typeof value !== 'undefined';
};
var isFunction = function isFunction(value) {
return typeof value === 'function';
};
// Adapted from https://stackoverflow.com/questions/31128855/comparing-ecma6-sets-for-equality#31129384
var setsEqual = function setsEqual(a, b) {
if (a.size !== b.size) {
return false;
}
var _iterator3 = _createForOfIteratorHelper$1(a),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var item = _step3.value;
if (!b.has(item)) {
return false;
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return true;
};
/**
* @param e - The event
* @private
*/
function _isClickEvent(e) {
return e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu';
}
/**
* @alias Chart.helpers.math
* @namespace
*/
var PI = Math.PI;
var TAU = 2 * PI;
var PITAU = TAU + PI;
var INFINITY = Number.POSITIVE_INFINITY;
var RAD_PER_DEG = PI / 180;
var HALF_PI = PI / 2;
var QUARTER_PI = PI / 4;
var TWO_THIRDS_PI = PI * 2 / 3;
var log10 = Math.log10;
var sign = Math.sign;
function almostEquals(x, y, epsilon) {
return Math.abs(x - y) < epsilon;
}
/**
* Implementation of the nice number algorithm used in determining where axis labels will go
*/
function niceNum(range) {
var roundedRange = Math.round(range);
range = almostEquals(range, roundedRange, range / 1000) ? roundedRange : range;
var niceRange = Math.pow(10, Math.floor(log10(range)));
var fraction = range / niceRange;
var niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;
return niceFraction * niceRange;
}
/**
* Returns an array of factors sorted from 1 to sqrt(value)
* @private
*/
function _factorize(value) {
var result = [];
var sqrt = Math.sqrt(value);
var i;
for (i = 1; i < sqrt; i++) {
if (value % i === 0) {
result.push(i);
result.push(value / i);
}
}
if (sqrt === (sqrt | 0)) {
result.push(sqrt);
}
result.sort(function (a, b) {
return a - b;
}).pop();
return result;
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function almostWhole(x, epsilon) {
var rounded = Math.round(x);
return rounded - epsilon <= x && rounded + epsilon >= x;
}
/**
* @private
*/
function _setMinAndMaxByKey(array, target, property) {
var i, ilen, value;
for (i = 0, ilen = array.length; i < ilen; i++) {
value = array[i][property];
if (!isNaN(value)) {
target.min = Math.min(target.min, value);
target.max = Math.max(target.max, value);
}
}
}
function toRadians(degrees) {
return degrees * (PI / 180);
}
function toDegrees(radians) {
return radians * (180 / PI);
}
/**
* Returns the number of decimal places
* i.e. the number of digits after the decimal point, of the value of this Number.
* @param x - A number.
* @returns The number of decimal places.
* @private
*/
function _decimalPlaces(x) {
if (!isNumberFinite(x)) {
return;
}
var e = 1;
var p = 0;
while (Math.round(x * e) / e !== x) {
e *= 10;
p++;
}
return p;
}
// Gets the angle from vertical upright to the point about a centre.
function getAngleFromPoint(centrePoint, anglePoint) {
var distanceFromXCenter = anglePoint.x - centrePoint.x;
var distanceFromYCenter = anglePoint.y - centrePoint.y;
var radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
var angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
if (angle < -0.5 * PI) {
angle += TAU; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
}
return {
angle: angle,
distance: radialDistanceFromCenter
};
}
function distanceBetweenPoints(pt1, pt2) {
return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
}
/**
* Shortest distance between angles, in either direction.
* @private
*/
function _angleDiff(a, b) {
return (a - b + PITAU) % TAU - PI;
}
/**
* Normalize angle to be between 0 and 2*PI
* @private
*/
function _normalizeAngle(a) {
return (a % TAU + TAU) % TAU;
}
/**
* @private
*/
function _angleBetween(angle, start, end, sameAngleIsFullCircle) {
var a = _normalizeAngle(angle);
var s = _normalizeAngle(start);
var e = _normalizeAngle(end);
var angleToStart = _normalizeAngle(s - a);
var angleToEnd = _normalizeAngle(e - a);
var startToAngle = _normalizeAngle(a - s);
var endToAngle = _normalizeAngle(a - e);
return a === s || a === e || sameAngleIsFullCircle && s === e || angleToStart > angleToEnd && startToAngle < endToAngle;
}
/**
* Limit `value` between `min` and `max`
* @param value
* @param min
* @param max
* @private
*/
function _limitValue(value, min, max) {
return Math.max(min, Math.min(max, value));
}
/**
* @param {number} value
* @private
*/
function _int16Range(value) {
return _limitValue(value, -32768, 32767);
}
/**
* @param value
* @param start
* @param end
* @param [epsilon]
* @private
*/
function _isBetween(value, start, end) {
var epsilon = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1e-6;
return value >= Math.min(start, end) - epsilon && value <= Math.max(start, end) + epsilon;
}
function _lookup(table, value, cmp) {
cmp = cmp || function (index) {
return table[index] < value;
};
var hi = table.length - 1;
var lo = 0;
var mid;
while (hi - lo > 1) {
mid = lo + hi >> 1;
if (cmp(mid)) {
lo = mid;
} else {
hi = mid;
}
}
return {
lo: lo,
hi: hi
};
}
/**
* Binary search
* @param table - the table search. must be sorted!
* @param key - property name for the value in each entry
* @param value - value to find
* @param last - lookup last index
* @private
*/
var _lookupByKey = function _lookupByKey(table, key, value, last) {
return _lookup(table, value, last ? function (index) {
var ti = table[index][key];
return ti < value || ti === value && table[index + 1][key] === value;
} : function (index) {
return table[index][key] < value;
});
};
/**
* Reverse binary search
* @param table - the table search. must be sorted!
* @param key - property name for the value in each entry
* @param value - value to find
* @private
*/
var _rlookupByKey = function _rlookupByKey(table, key, value) {
return _lookup(table, value, function (index) {
return table[index][key] >= value;
});
};
/**
* Return subset of `values` between `min` and `max` inclusive.
* Values are assumed to be in sorted order.
* @param values - sorted array of values
* @param min - min value
* @param max - max value
*/
function _filterBetween(values, min, max) {
var start = 0;
var end = values.length;
while (start < end && values[start] < min) {
start++;
}
while (end > start && values[end - 1] > max) {
end--;
}
return start > 0 || end < values.length ? values.slice(start, end) : values;
}
var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
function listenArrayEvents(array, listener) {
if (array._chartjs) {
array._chartjs.listeners.push(listener);
return;
}
Object.defineProperty(array, '_chartjs', {
configurable: true,
enumerable: false,
value: {
listeners: [listener]
}
});
arrayEvents.forEach(function (key) {
var method = '_onData' + _capitalize(key);
var base = array[key];
Object.defineProperty(array, key, {
configurable: true,
enumerable: false,
value: function value() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var res = base.apply(this, args);
array._chartjs.listeners.forEach(function (object) {
if (typeof object[method] === 'function') {
object[method].apply(object, args);
}
});
return res;
}
});
});
}
function unlistenArrayEvents(array, listener) {
var stub = array._chartjs;
if (!stub) {
return;
}
var listeners = stub.listeners;
var index = listeners.indexOf(listener);
if (index !== -1) {
listeners.splice(index, 1);
}
if (listeners.length > 0) {
return;
}
arrayEvents.forEach(function (key) {
delete array[key];
});
delete array._chartjs;
}
/**
* @param items
*/
function _arrayUnique(items) {
var set = new Set();
var i, ilen;
for (i = 0, ilen = items.length; i < ilen; ++i) {
set.add(items[i]);
}
if (set.size === ilen) {
return items;
}
return Array.from(set);
}
function fontString(pixelSize, fontStyle, fontFamily) {
return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
}
/**
* Request animation polyfill
*/
var requestAnimFrame = function () {
if (typeof window === 'undefined') {
return function (callback) {
return callback();
};
}
return window.requestAnimationFrame;
}();
/**
* Throttles calling `fn` once per animation frame
* Latest arguments are used on the actual call
*/
function throttled(fn, thisArg) {
var argsToUse = [];
var ticking = false;
return function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
// Save the args for use later
argsToUse = args;
if (!ticking) {
ticking = true;
requestAnimFrame.call(window, function () {
ticking = false;
fn.apply(thisArg, argsToUse);
});
}
};
}
/**
* Debounces calling `fn` for `delay` ms
*/
function debounce(fn, delay) {
var timeout;
return function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
if (delay) {
clearTimeout(timeout);
timeout = setTimeout(fn, delay, args);
} else {
fn.apply(this, args);
}
return delay;
};
}
/**
* Converts 'start' to 'left', 'end' to 'right' and others to 'center'
* @private
*/
var _toLeftRightCenter = function _toLeftRightCenter(align) {
return align === 'start' ? 'left' : align === 'end' ? 'right' : 'center';
};
/**
* Returns `start`, `end` or `(start + end) / 2` depending on `align`. Defaults to `center`
* @private
*/
var _alignStartEnd = function _alignStartEnd(align, start, end) {
return align === 'start' ? start : align === 'end' ? end : (start + end) / 2;
};
/**
* Returns `left`, `right` or `(left + right) / 2` depending on `align`. Defaults to `left`
* @private
*/
var _textX = function _textX(align, left, right, rtl) {
var check = rtl ? 'left' : 'right';
return align === check ? right : align === 'center' ? (left + right) / 2 : left;
};
/**
* Return start and count of visible points.
* @private
*/
function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
var pointCount = points.length;
var start = 0;
var count = pointCount;
if (meta._sorted) {
var iScale = meta.iScale,
_parsed = meta._parsed;
var axis = iScale.axis;
var _iScale$getUserBounds = iScale.getUserBounds(),
min = _iScale$getUserBounds.min,
max = _iScale$getUserBounds.max,
minDefined = _iScale$getUserBounds.minDefined,
maxDefined = _iScale$getUserBounds.maxDefined;
if (minDefined) {
start = _limitValue(Math.min(
// @ts-expect-error Need to type _parsed
_lookupByKey(_parsed, iScale.axis, min).lo,
// @ts-expect-error Need to fix types on _lookupByKey
animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo), 0, pointCount - 1);
}
if (maxDefined) {
count = _limitValue(Math.max(
// @ts-expect-error Need to type _parsed
_lookupByKey(_parsed, iScale.axis, max, true).hi + 1,
// @ts-expect-error Need to fix types on _lookupByKey
animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1), start, pointCount) - start;
} else {
count = pointCount - start;
}
}
return {
start: start,
count: count
};
}
/**
* Checks if the scale ranges have changed.
* @param {object} meta - dataset meta.
* @returns {boolean}
* @private
*/
function _scaleRangesChanged(meta) {
var xScale = meta.xScale,
yScale = meta.yScale,
_scaleRanges = meta._scaleRanges;
var newRanges = {
xmin: xScale.min,
xmax: xScale.max,
ymin: yScale.min,
ymax: yScale.max
};
if (!_scaleRanges) {
meta._scaleRanges = newRanges;
return true;
}
var changed = _scaleRanges.xmin !== xScale.min || _scaleRanges.xmax !== xScale.max || _scaleRanges.ymin !== yScale.min || _scaleRanges.ymax !== yScale.max;
Object.assign(_scaleRanges, newRanges);
return changed;
}
var atEdge = function atEdge(t) {
return t === 0 || t === 1;
};
var elasticIn = function elasticIn(t, s, p) {
return -(Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * TAU / p));
};
var elasticOut = function elasticOut(t, s, p) {
return Math.pow(2, -10 * t) * Math.sin((t - s) * TAU / p) + 1;
};
/**
* Easing functions adapted from Robert Penner's easing equations.
* @namespace Chart.helpers.easing.effects
* @see http://www.robertpenner.com/easing/
*/
var effects = {
linear: function linear(t) {
return t;
},
easeInQuad: function easeInQuad(t) {
return t * t;
},
easeOutQuad: function easeOutQuad(t) {
return -t * (t - 2);
},
easeInOutQuad: function easeInOutQuad(t) {
return (t /= 0.5) < 1 ? 0.5 * t * t : -0.5 * (--t * (t - 2) - 1);
},
easeInCubic: function easeInCubic(t) {
return t * t * t;
},
easeOutCubic: function easeOutCubic(t) {
return (t -= 1) * t * t + 1;
},
easeInOutCubic: function easeInOutCubic(t) {
return (t /= 0.5) < 1 ? 0.5 * t * t * t : 0.5 * ((t -= 2) * t * t + 2);
},
easeInQuart: function easeInQuart(t) {
return t * t * t * t;
},
easeOutQuart: function easeOutQuart(t) {
return -((t -= 1) * t * t * t - 1);
},
easeInOutQuart: function easeInOutQuart(t) {
return (t /= 0.5) < 1 ? 0.5 * t * t * t * t : -0.5 * ((t -= 2) * t * t * t - 2);
},
easeInQuint: function easeInQuint(t) {
return t * t * t * t * t;
},
easeOutQuint: function easeOutQuint(t) {
return (t -= 1) * t * t * t * t + 1;
},
easeInOutQuint: function easeInOutQuint(t) {
return (t /= 0.5) < 1 ? 0.5 * t * t * t * t * t : 0.5 * ((t -= 2) * t * t * t * t + 2);
},
easeInSine: function easeInSine(t) {
return -Math.cos(t * HALF_PI) + 1;
},
easeOutSine: function easeOutSine(t) {
return Math.sin(t * HALF_PI);
},
easeInOutSine: function easeInOutSine(t) {
return -0.5 * (Math.cos(PI * t) - 1);
},
easeInExpo: function easeInExpo(t) {
return t === 0 ? 0 : Math.pow(2, 10 * (t - 1));
},
easeOutExpo: function easeOutExpo(t) {
return t === 1 ? 1 : -Math.pow(2, -10 * t) + 1;
},
easeInOutExpo: function easeInOutExpo(t) {
return atEdge(t) ? t : t < 0.5 ? 0.5 * Math.pow(2, 10 * (t * 2 - 1)) : 0.5 * (-Math.pow(2, -10 * (t * 2 - 1)) + 2);
},
easeInCirc: function easeInCirc(t) {
return t >= 1 ? t : -(Math.sqrt(1 - t * t) - 1);
},
easeOutCirc: function easeOutCirc(t) {
return Math.sqrt(1 - (t -= 1) * t);
},
easeInOutCirc: function easeInOutCirc(t) {
return (t /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - t * t) - 1) : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
},
easeInElastic: function easeInElastic(t) {
return atEdge(t) ? t : elasticIn(t, 0.075, 0.3);
},
easeOutElastic: function easeOutElastic(t) {
return atEdge(t) ? t : elasticOut(t, 0.075, 0.3);
},
easeInOutElastic: function easeInOutElastic(t) {
var s = 0.1125;
var p = 0.45;
return atEdge(t) ? t : t < 0.5 ? 0.5 * elasticIn(t * 2, s, p) : 0.5 + 0.5 * elasticOut(t * 2 - 1, s, p);
},
easeInBack: function easeInBack(t) {
var s = 1.70158;
return t * t * ((s + 1) * t - s);
},
easeOutBack: function easeOutBack(t) {
var s = 1.70158;
return (t -= 1) * t * ((s + 1) * t + s) + 1;
},
easeInOutBack: function easeInOutBack(t) {
var s = 1.70158;
if ((t /= 0.5) < 1) {
return 0.5 * (t * t * (((s *= 1.525) + 1) * t - s));
}
return 0.5 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2);
},
easeInBounce: function easeInBounce(t) {
return 1 - effects.easeOutBounce(1 - t);
},
easeOutBounce: function easeOutBounce(t) {
var m = 7.5625;
var d = 2.75;
if (t < 1 / d) {
return m * t * t;
}
if (t < 2 / d) {
return m * (t -= 1.5 / d) * t + 0.75;
}
if (t < 2.5 / d) {
return m * (t -= 2.25 / d) * t + 0.9375;
}
return m * (t -= 2.625 / d) * t + 0.984375;
},
easeInOutBounce: function easeInOutBounce(t) {
return t < 0.5 ? effects.easeInBounce(t * 2) * 0.5 : effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
}
};
function isPatternOrGradient(value) {
if (value && _typeof$z(value) === 'object') {
var type = value.toString();
return type === '[object CanvasPattern]' || type === '[object CanvasGradient]';
}
return false;
}
function color(value) {
return isPatternOrGradient(value) ? value : new Color(value);
}
function getHoverColor(value) {
return isPatternOrGradient(value) ? value : new Color(value).saturate(0.5).darken(0.1).hexString();
}
var numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];
var colors = ['color', 'borderColor', 'backgroundColor'];
function applyAnimationsDefaults(defaults) {
defaults.set('animation', {
delay: undefined,
duration: 1000,
easing: 'easeOutQuart',
fn: undefined,
from: undefined,
loop: undefined,
to: undefined,
type: undefined
});
defaults.describe('animation', {
_fallback: false,
_indexable: false,
_scriptable: function _scriptable(name) {
return name !== 'onProgress' && name !== 'onComplete' && name !== 'fn';
}
});
defaults.set('animations', {
colors: {
type: 'color',
properties: colors
},
numbers: {
type: 'number',
properties: numbers
}
});
defaults.describe('animations', {
_fallback: 'animation'
});
defaults.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: function fn(v) {
return v | 0;
}
}
}
}
});
}
function applyLayoutsDefaults(defaults) {
defaults.set('layout', {
autoPadding: true,
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
}
});
}
var intlCache = new Map();
function getNumberFormat(locale, options) {
options = options || {};
var cacheKey = locale + JSON.stringify(options);
var formatter = intlCache.get(cacheKey);
if (!formatter) {
formatter = new Intl.NumberFormat(locale, options);
intlCache.set(cacheKey, formatter);
}
return formatter;
}
function formatNumber(num, locale, options) {
return getNumberFormat(locale, options).format(num);
}
var formatters$4 = {
values: function values(value) {
return isArray(value) ? value : '' + value;
},
numeric: function numeric(tickValue, index, ticks) {
if (tickValue === 0) {
return '0';
}
var locale = this.chart.options.locale;
var notation;
var delta = tickValue;
if (ticks.length > 1) {
var maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));
if (maxTick < 1e-4 || maxTick > 1e+15) {
notation = 'scientific';
}
delta = calculateDelta(tickValue, ticks);
}
var logDelta = log10(Math.abs(delta));
var numDecimal = Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
var options = {
notation: notation,
minimumFractionDigits: numDecimal,
maximumFractionDigits: numDecimal
};
Object.assign(options, this.options.ticks.format);
return formatNumber(tickValue, locale, options);
},
logarithmic: function logarithmic(tickValue, index, ticks) {
if (tickValue === 0) {
return '0';
}
var remain = ticks[index].significand || tickValue / Math.pow(10, Math.floor(log10(tickValue)));
if ([1, 2, 3, 5, 10, 15].includes(remain) || index > 0.8 * ticks.length) {
return formatters$4.numeric.call(this, tickValue, index, ticks);
}
return '';
}
};
function calculateDelta(tickValue, ticks) {
var delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
delta = tickValue - Math.floor(tickValue);
}
return delta;
}
var Ticks = {
formatters: formatters$4
};
function applyScaleDefaults(defaults) {
defaults.set('scale', {
display: true,
offset: false,
reverse: false,
beginAtZero: false,
bounds: 'ticks',
grace: 0,
grid: {
display: true,
lineWidth: 1,
drawOnChartArea: true,
drawTicks: true,
tickLength: 8,
tickWidth: function tickWidth(_ctx, options) {
return options.lineWidth;
},
tickColor: function tickColor(_ctx, options) {
return options.color;
},
offset: false
},
border: {
display: true,
dash: [],
dashOffset: 0.0,
width: 1
},
title: {
display: false,
text: '',
padding: {
top: 4,
bottom: 4
}
},
ticks: {
minRotation: 0,
maxRotation: 50,
mirror: false,
textStrokeWidth: 0,
textStrokeColor: '',
padding: 3,
display: true,
autoSkip: true,
autoSkipPadding: 3,
labelOffset: 0,
callback: Ticks.formatters.values,
minor: {},
major: {},
align: 'center',
crossAlign: 'near',
showLabelBackdrop: false,
backdropColor: 'rgba(255, 255, 255, 0.75)',
backdropPadding: 2
}
});
defaults.route('scale.ticks', 'color', '', 'color');
defaults.route('scale.grid', 'color', '', 'borderColor');
defaults.route('scale.border', 'color', '', 'borderColor');
defaults.route('scale.title', 'color', '', 'color');
defaults.describe('scale', {
_fallback: false,
_scriptable: function _scriptable(name) {
return !name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser';
},
_indexable: function _indexable(name) {
return name !== 'borderDash' && name !== 'tickBorderDash' && name !== 'dash';
}
});
defaults.describe('scales', {
_fallback: 'scale'
});
defaults.describe('scale.ticks', {
_scriptable: function _scriptable(name) {
return name !== 'backdropPadding' && name !== 'callback';
},
_indexable: function _indexable(name) {
return name !== 'backdropPadding';
}
});
}
var overrides = Object.create(null);
var descriptors = Object.create(null);
function getScope$1(node, key) {
if (!key) {
return node;
}
var keys = key.split('.');
for (var i = 0, n = keys.length; i < n; ++i) {
var k = keys[i];
node = node[k] || (node[k] = Object.create(null));
}
return node;
}
function _set(root, scope, values) {
if (typeof scope === 'string') {
return merge(getScope$1(root, scope), values);
}
return merge(getScope$1(root, ''), scope);
}
var Defaults = /*#__PURE__*/function () {
function Defaults(_descriptors, _appliers) {
_classCallCheck$x(this, Defaults);
this.animation = undefined;
this.backgroundColor = 'rgba(0,0,0,0.1)';
this.borderColor = 'rgba(0,0,0,0.1)';
this.color = '#666';
this.datasets = {};
this.devicePixelRatio = function (context) {
return context.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 = function (ctx, options) {
return getHoverColor(options.backgroundColor);
};
this.hoverBorderColor = function (ctx, options) {
return getHoverColor(options.borderColor);
};
this.hoverColor = function (ctx, options) {
return getHoverColor(options.color);
};
this.indexAxis = 'x';
this.interaction = {
mode: 'nearest',
intersect: true,
includeInvisible: false
};
this.maintainAspectRatio = true;
this.onHover = null;
this.onClick = null;
this.parsing = true;
this.plugins = {};
this.responsive = true;
this.scale = undefined;
this.scales = {};
this.showLine = true;
this.drawActiveElementsOnTop = true;
this.describe(_descriptors);
this.apply(_appliers);
}
_createClass$x(Defaults, [{
key: "set",
value: function set(scope, values) {
return _set(this, scope, values);
}
}, {
key: "get",
value: function get(scope) {
return getScope$1(this, scope);
}
}, {
key: "describe",
value: function describe(scope, values) {
return _set(descriptors, scope, values);
}
}, {
key: "override",
value: function override(scope, values) {
return _set(overrides, scope, values);
}
}, {
key: "route",
value: function route(scope, name, targetScope, targetName) {
var _Object$definePropert;
var scopeObject = getScope$1(this, scope);
var targetScopeObject = getScope$1(this, targetScope);
var privateName = '_' + name;
Object.defineProperties(scopeObject, (_Object$definePropert = {}, _defineProperty$w(_Object$definePropert, privateName, {
value: scopeObject[name],
writable: true
}), _defineProperty$w(_Object$definePropert, name, {
enumerable: true,
get: function get() {
var local = this[privateName];
var target = targetScopeObject[targetName];
if (isObject(local)) {
return Object.assign({}, target, local);
}
return valueOrDefault(local, target);
},
set: function set(value) {
this[privateName] = value;
}
}), _Object$definePropert));
}
}, {
key: "apply",
value: function apply(appliers) {
var _this = this;
appliers.forEach(function (apply) {
return apply(_this);
});
}
}]);
return Defaults;
}();
var defaults = /* #__PURE__ */new Defaults({
_scriptable: function _scriptable(name) {
return !name.startsWith('on');
},
_indexable: function _indexable(name) {
return name !== 'events';
},
hover: {
_fallback: 'interaction'
},
interaction: {
_scriptable: false,
_indexable: false
}
}, [applyAnimationsDefaults, applyLayoutsDefaults, applyScaleDefaults]);
function toFontString(font) {
if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {
return null;
}
return (font.style ? font.style + ' ' : '') + (font.weight ? font.weight + ' ' : '') + font.size + 'px ' + font.family;
}
function _measureText(ctx, data, gc, longest, string) {
var textWidth = data[string];
if (!textWidth) {
textWidth = data[string] = ctx.measureText(string).width;
gc.push(string);
}
if (textWidth > longest) {
longest = textWidth;
}
return longest;
}
function _longestText(ctx, font, arrayOfThings, cache) {
cache = cache || {};
var data = cache.data = cache.data || {};
var gc = cache.garbageCollect = cache.garbageCollect || [];
if (cache.font !== font) {
data = cache.data = {};
gc = cache.garbageCollect = [];
cache.font = font;
}
ctx.save();
ctx.font = font;
var longest = 0;
var ilen = arrayOfThings.length;
var i, j, jlen, thing, nestedThing;
for (i = 0; i < ilen; i++) {
thing = arrayOfThings[i];
if (thing !== undefined && thing !== null && isArray(thing) !== true) {
longest = _measureText(ctx, data, gc, longest, thing);
} else if (isArray(thing)) {
for (j = 0, jlen = thing.length; j < jlen; j++) {
nestedThing = thing[j];
if (nestedThing !== undefined && nestedThing !== null && !isArray(nestedThing)) {
longest = _measureText(ctx, data, gc, longest, nestedThing);
}
}
}
}
ctx.restore();
var gcLen = gc.length / 2;
if (gcLen > arrayOfThings.length) {
for (i = 0; i < gcLen; i++) {
delete data[gc[i]];
}
gc.splice(0, gcLen);
}
return longest;
}
function _alignPixel(chart, pixel, width) {
var devicePixelRatio = chart.currentDevicePixelRatio;
var halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
}
function clearCanvas(canvas, ctx) {
ctx = ctx || canvas.getContext('2d');
ctx.save();
ctx.resetTransform();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.restore();
}
function drawPoint(ctx, options, x, y) {
drawPointLegend(ctx, options, x, y, null);
}
function drawPointLegend(ctx, options, x, y, w) {
var type, xOffset, yOffset, size, cornerRadius, width, xOffsetW, yOffsetW;
var style = options.pointStyle;
var rotation = options.rotation;
var radius = options.radius;
var rad = (rotation || 0) * RAD_PER_DEG;
if (style && _typeof$z(style) === 'object') {
type = style.toString();
if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
ctx.save();
ctx.translate(x, y);
ctx.rotate(rad);
ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);
ctx.restore();
return;
}
}
if (isNaN(radius) || radius <= 0) {
return;
}
ctx.beginPath();
switch (style) {
default:
if (w) {
ctx.ellipse(x, y, w / 2, radius, 0, 0, TAU);
} else {
ctx.arc(x, y, radius, 0, TAU);
}
ctx.closePath();
break;
case 'triangle':
width = w ? w / 2 : radius;
ctx.moveTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
rad += TWO_THIRDS_PI;
ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
rad += TWO_THIRDS_PI;
ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
ctx.closePath();
break;
case 'rectRounded':
cornerRadius = radius * 0.516;
size = radius - cornerRadius;
xOffset = Math.cos(rad + QUARTER_PI) * size;
xOffsetW = Math.cos(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);
yOffset = Math.sin(rad + QUARTER_PI) * size;
yOffsetW = Math.sin(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);
ctx.arc(x - xOffsetW, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
ctx.arc(x + yOffsetW, y - xOffset, cornerRadius, rad - HALF_PI, rad);
ctx.arc(x + xOffsetW, y + yOffset, cornerRadius, rad, rad + HALF_PI);
ctx.arc(x - yOffsetW, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
ctx.closePath();
break;
case 'rect':
if (!rotation) {
size = Math.SQRT1_2 * radius;
width = w ? w / 2 : size;
ctx.rect(x - width, y - size, 2 * width, 2 * size);
break;
}
rad += QUARTER_PI;
case 'rectRot':
xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
xOffset = Math.cos(rad) * radius;
yOffset = Math.sin(rad) * radius;
yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
ctx.moveTo(x - xOffsetW, y - yOffset);
ctx.lineTo(x + yOffsetW, y - xOffset);
ctx.lineTo(x + xOffsetW, y + yOffset);
ctx.lineTo(x - yOffsetW, y + xOffset);
ctx.closePath();
break;
case 'crossRot':
rad += QUARTER_PI;
case 'cross':
xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
xOffset = Math.cos(rad) * radius;
yOffset = Math.sin(rad) * radius;
yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
ctx.moveTo(x - xOffsetW, y - yOffset);
ctx.lineTo(x + xOffsetW, y + yOffset);
ctx.moveTo(x + yOffsetW, y - xOffset);
ctx.lineTo(x - yOffsetW, y + xOffset);
break;
case 'star':
xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
xOffset = Math.cos(rad) * radius;
yOffset = Math.sin(rad) * radius;
yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
ctx.moveTo(x - xOffsetW, y - yOffset);
ctx.lineTo(x + xOffsetW, y + yOffset);
ctx.moveTo(x + yOffsetW, y - xOffset);
ctx.lineTo(x - yOffsetW, y + xOffset);
rad += QUARTER_PI;
xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
xOffset = Math.cos(rad) * radius;
yOffset = Math.sin(rad) * radius;
yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
ctx.moveTo(x - xOffsetW, y - yOffset);
ctx.lineTo(x + xOffsetW, y + yOffset);
ctx.moveTo(x + yOffsetW, y - xOffset);
ctx.lineTo(x - yOffsetW, y + xOffset);
break;
case 'line':
xOffset = w ? w / 2 : Math.cos(rad) * radius;
yOffset = Math.sin(rad) * radius;
ctx.moveTo(x - xOffset, y - yOffset);
ctx.lineTo(x + xOffset, y + yOffset);
break;
case 'dash':
ctx.moveTo(x, y);
ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);
break;
case false:
ctx.closePath();
break;
}
ctx.fill();
if (options.borderWidth > 0) {
ctx.stroke();
}
}
function _isPointInArea(point, area, margin) {
margin = margin || 0.5;
return !area || point && point.x > area.left - margin && point.x < area.right + margin && point.y > area.top - margin && point.y < area.bottom + margin;
}
function clipArea(ctx, area) {
ctx.save();
ctx.beginPath();
ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
ctx.clip();
}
function unclipArea(ctx) {
ctx.restore();
}
function _steppedLineTo(ctx, previous, target, flip, mode) {
if (!previous) {
return ctx.lineTo(target.x, target.y);
}
if (mode === 'middle') {
var midpoint = (previous.x + target.x) / 2.0;
ctx.lineTo(midpoint, previous.y);
ctx.lineTo(midpoint, target.y);
} else if (mode === 'after' !== !!flip) {
ctx.lineTo(previous.x, target.y);
} else {
ctx.lineTo(target.x, previous.y);
}
ctx.lineTo(target.x, target.y);
}
function _bezierCurveTo(ctx, previous, target, flip) {
if (!previous) {
return ctx.lineTo(target.x, target.y);
}
ctx.bezierCurveTo(flip ? previous.cp1x : previous.cp2x, flip ? previous.cp1y : previous.cp2y, flip ? target.cp2x : target.cp1x, flip ? target.cp2y : target.cp1y, target.x, target.y);
}
function renderText(ctx, text, x, y, font) {
var opts = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
var lines = isArray(text) ? text : [text];
var stroke = opts.strokeWidth > 0 && opts.strokeColor !== '';
var i, line;
ctx.save();
ctx.font = font.string;
setRenderOpts(ctx, opts);
for (i = 0; i < lines.length; ++i) {
line = lines[i];
if (opts.backdrop) {
drawBackdrop(ctx, opts.backdrop);
}
if (stroke) {
if (opts.strokeColor) {
ctx.strokeStyle = opts.strokeColor;
}
if (!isNullOrUndef(opts.strokeWidth)) {
ctx.lineWidth = opts.strokeWidth;
}
ctx.strokeText(line, x, y, opts.maxWidth);
}
ctx.fillText(line, x, y, opts.maxWidth);
decorateText(ctx, x, y, line, opts);
y += font.lineHeight;
}
ctx.restore();
}
function setRenderOpts(ctx, opts) {
if (opts.translation) {
ctx.translate(opts.translation[0], opts.translation[1]);
}
if (!isNullOrUndef(opts.rotation)) {
ctx.rotate(opts.rotation);
}
if (opts.color) {
ctx.fillStyle = opts.color;
}
if (opts.textAlign) {
ctx.textAlign = opts.textAlign;
}
if (opts.textBaseline) {
ctx.textBaseline = opts.textBaseline;
}
}
function decorateText(ctx, x, y, line, opts) {
if (opts.strikethrough || opts.underline) {
var metrics = ctx.measureText(line);
var left = x - metrics.actualBoundingBoxLeft;
var right = x + metrics.actualBoundingBoxRight;
var top = y - metrics.actualBoundingBoxAscent;
var bottom = y + metrics.actualBoundingBoxDescent;
var yDecoration = opts.strikethrough ? (top + bottom) / 2 : bottom;
ctx.strokeStyle = ctx.fillStyle;
ctx.beginPath();
ctx.lineWidth = opts.decorationWidth || 2;
ctx.moveTo(left, yDecoration);
ctx.lineTo(right, yDecoration);
ctx.stroke();
}
}
function drawBackdrop(ctx, opts) {
var oldColor = ctx.fillStyle;
ctx.fillStyle = opts.color;
ctx.fillRect(opts.left, opts.top, opts.width, opts.height);
ctx.fillStyle = oldColor;
}
function addRoundedRectPath(ctx, rect) {
var x = rect.x,
y = rect.y,
w = rect.w,
h = rect.h,
radius = rect.radius;
ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, -HALF_PI, PI, true);
ctx.lineTo(x, y + h - radius.bottomLeft);
ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
ctx.lineTo(x + w - radius.bottomRight, y + h);
ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
ctx.lineTo(x + w, y + radius.topRight);
ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);
ctx.lineTo(x + radius.topLeft, y);
}
var LINE_HEIGHT = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/;
var FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;
/**
* @alias Chart.helpers.options
* @namespace
*/ /**
* Converts the given line height `value` in pixels for a specific font `size`.
* @param value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
* @param size - The font size (in pixels) used to resolve relative `value`.
* @returns The effective line height in pixels (size * 1.2 if value is invalid).
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
* @since 2.7.0
*/
function toLineHeight(value, size) {
var matches = ('' + value).match(LINE_HEIGHT);
if (!matches || matches[1] === 'normal') {
return size * 1.2;
}
value = +matches[2];
switch (matches[3]) {
case 'px':
return value;
case '%':
value /= 100;
break;
}
return size * value;
}
var numberOrZero = function numberOrZero(v) {
return +v || 0;
};
function _readValueToProps(value, props) {
var ret = {};
var objProps = isObject(props);
var keys = objProps ? Object.keys(props) : props;
var read = isObject(value) ? objProps ? function (prop) {
return valueOrDefault(value[prop], value[props[prop]]);
} : function (prop) {
return value[prop];
} : function () {
return value;
};
var _iterator4 = _createForOfIteratorHelper$1(keys),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var prop = _step4.value;
ret[prop] = numberOrZero(read(prop));
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
return ret;
}
/**
* Converts the given value into a TRBL object.
* @param value - If a number, set the value to all TRBL component,
* else, if an object, use defined properties and sets undefined ones to 0.
* x / y are shorthands for same value for left/right and top/bottom.
* @returns The padding values (top, right, bottom, left)
* @since 3.0.0
*/
function toTRBL(value) {
return _readValueToProps(value, {
top: 'y',
right: 'x',
bottom: 'y',
left: 'x'
});
}
/**
* Converts the given value into a TRBL corners object (similar with css border-radius).
* @param value - If a number, set the value to all TRBL corner components,
* else, if an object, use defined properties and sets undefined ones to 0.
* @returns The TRBL corner values (topLeft, topRight, bottomLeft, bottomRight)
* @since 3.0.0
*/
function toTRBLCorners(value) {
return _readValueToProps(value, ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']);
}
/**
* Converts the given value into a padding object with pre-computed width/height.
* @param value - If a number, set the value to all TRBL component,
* else, if an object, use defined properties and sets undefined ones to 0.
* x / y are shorthands for same value for left/right and top/bottom.
* @returns The padding values (top, right, bottom, left, width, height)
* @since 2.7.0
*/
function toPadding(value) {
var obj = toTRBL(value);
obj.width = obj.left + obj.right;
obj.height = obj.top + obj.bottom;
return obj;
}
/**
* Parses font options and returns the font object.
* @param options - A object that contains font options to be parsed.
* @param fallback - A object that contains fallback font options.
* @return The font object.
* @private
*/
function toFont(options, fallback) {
options = options || {};
fallback = fallback || defaults.font;
var size = valueOrDefault(options.size, fallback.size);
if (typeof size === 'string') {
size = parseInt(size, 10);
}
var style = valueOrDefault(options.style, fallback.style);
if (style && !('' + style).match(FONT_STYLE)) {
console.warn('Invalid font style specified: "' + style + '"');
style = undefined;
}
var font = {
family: valueOrDefault(options.family, fallback.family),
lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback.lineHeight), size),
size: size,
style: style,
weight: valueOrDefault(options.weight, fallback.weight),
string: ''
};
font.string = toFontString(font);
return font;
}
/**
* Evaluates the given `inputs` sequentially and returns the first defined value.
* @param inputs - An array of values, falling back to the last value.
* @param context - If defined and the current value is a function, the value
* is called with `context` as first argument and the result becomes the new input.
* @param index - If defined and the current value is an array, the value
* at `index` become the new input.
* @param info - object to return information about resolution in
* @param info.cacheable - Will be set to `false` if option is not cacheable.
* @since 2.7.0
*/
function resolve(inputs, context, index, info) {
var cacheable = true;
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
if (value === undefined) {
continue;
}
if (context !== undefined && typeof value === 'function') {
value = value(context);
cacheable = false;
}
if (index !== undefined && isArray(value)) {
value = value[index % value.length];
cacheable = false;
}
if (value !== undefined) {
if (info && !cacheable) {
info.cacheable = false;
}
return value;
}
}
}
/**
* @param minmax
* @param grace
* @param beginAtZero
* @private
*/
function _addGrace(minmax, grace, beginAtZero) {
var min = minmax.min,
max = minmax.max;
var change = toDimension(grace, (max - min) / 2);
var keepZero = function keepZero(value, add) {
return beginAtZero && value === 0 ? 0 : value + add;
};
return {
min: keepZero(min, -Math.abs(change)),
max: keepZero(max, change)
};
}
function createContext(parentContext, context) {
return Object.assign(Object.create(parentContext), context);
}
function _createResolver(scopes) {
var _cache;
var prefixes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [''];
var rootScopes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : scopes;
var fallback = arguments.length > 3 ? arguments[3] : undefined;
var getTarget = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
return scopes[0];
};
if (!defined(fallback)) {
fallback = _resolve('_fallback', scopes);
}
var cache = (_cache = {}, _defineProperty$w(_cache, Symbol.toStringTag, 'Object'), _defineProperty$w(_cache, "_cacheable", true), _defineProperty$w(_cache, "_scopes", scopes), _defineProperty$w(_cache, "_rootScopes", rootScopes), _defineProperty$w(_cache, "_fallback", fallback), _defineProperty$w(_cache, "_getTarget", getTarget), _defineProperty$w(_cache, "override", function override(scope) {
return _createResolver([scope].concat(_toConsumableArray(scopes)), prefixes, rootScopes, fallback);
}), _cache);
return new Proxy(cache, {
deleteProperty: function deleteProperty(target, prop) {
delete target[prop];
delete target._keys;
delete scopes[0][prop];
return true;
},
get: function get(target, prop) {
return _cached(target, prop, function () {
return _resolveWithPrefixes(prop, prefixes, scopes, target);
});
},
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, prop) {
return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);
},
getPrototypeOf: function getPrototypeOf() {
return Reflect.getPrototypeOf(scopes[0]);
},
has: function has(target, prop) {
return getKeysFromAllScopes(target).includes(prop);
},
ownKeys: function ownKeys(target) {
return getKeysFromAllScopes(target);
},
set: function set(target, prop, value) {
var storage = target._storage || (target._storage = getTarget());
target[prop] = storage[prop] = value;
delete target._keys;
return true;
}
});
}
function _attachContext(proxy, context, subProxy, descriptorDefaults) {
var cache = {
_cacheable: false,
_proxy: proxy,
_context: context,
_subProxy: subProxy,
_stack: new Set(),
_descriptors: _descriptors(proxy, descriptorDefaults),
setContext: function setContext(ctx) {
return _attachContext(proxy, ctx, subProxy, descriptorDefaults);
},
override: function override(scope) {
return _attachContext(proxy.override(scope), context, subProxy, descriptorDefaults);
}
};
return new Proxy(cache, {
deleteProperty: function deleteProperty(target, prop) {
delete target[prop];
delete proxy[prop];
return true;
},
get: function get(target, prop, receiver) {
return _cached(target, prop, function () {
return _resolveWithContext(target, prop, receiver);
});
},
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, prop) {
return target._descriptors.allKeys ? Reflect.has(proxy, prop) ? {
enumerable: true,
configurable: true
} : undefined : Reflect.getOwnPropertyDescriptor(proxy, prop);
},
getPrototypeOf: function getPrototypeOf() {
return Reflect.getPrototypeOf(proxy);
},
has: function has(target, prop) {
return Reflect.has(proxy, prop);
},
ownKeys: function ownKeys() {
return Reflect.ownKeys(proxy);
},
set: function set(target, prop, value) {
proxy[prop] = value;
delete target[prop];
return true;
}
});
}
function _descriptors(proxy) {
var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
scriptable: true,
indexable: true
};
var _proxy$_scriptable = proxy._scriptable,
_scriptable = _proxy$_scriptable === void 0 ? defaults.scriptable : _proxy$_scriptable,
_proxy$_indexable = proxy._indexable,
_indexable = _proxy$_indexable === void 0 ? defaults.indexable : _proxy$_indexable,
_proxy$_allKeys = proxy._allKeys,
_allKeys = _proxy$_allKeys === void 0 ? defaults.allKeys : _proxy$_allKeys;
return {
allKeys: _allKeys,
scriptable: _scriptable,
indexable: _indexable,
isScriptable: isFunction(_scriptable) ? _scriptable : function () {
return _scriptable;
},
isIndexable: isFunction(_indexable) ? _indexable : function () {
return _indexable;
}
};
}
var readKey = function readKey(prefix, name) {
return prefix ? prefix + _capitalize(name) : name;
};
var needsSubResolver = function needsSubResolver(prop, value) {
return isObject(value) && prop !== 'adapters' && (Object.getPrototypeOf(value) === null || value.constructor === Object);
};
function _cached(target, prop, resolve) {
if (Object.prototype.hasOwnProperty.call(target, prop)) {
return target[prop];
}
var value = resolve();
target[prop] = value;
return value;
}
function _resolveWithContext(target, prop, receiver) {
var _proxy = target._proxy,
_context = target._context,
_subProxy = target._subProxy,
descriptors = target._descriptors;
var value = _proxy[prop];
if (isFunction(value) && descriptors.isScriptable(prop)) {
value = _resolveScriptable(prop, value, target, receiver);
}
if (isArray(value) && value.length) {
value = _resolveArray(prop, value, target, descriptors.isIndexable);
}
if (needsSubResolver(prop, value)) {
value = _attachContext(value, _context, _subProxy && _subProxy[prop], descriptors);
}
return value;
}
function _resolveScriptable(prop, value, target, receiver) {
var _proxy = target._proxy,
_context = target._context,
_subProxy = target._subProxy,
_stack = target._stack;
if (_stack.has(prop)) {
throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);
}
_stack.add(prop);
value = value(_context, _subProxy || receiver);
_stack["delete"](prop);
if (needsSubResolver(prop, value)) {
value = createSubResolver(_proxy._scopes, _proxy, prop, value);
}
return value;
}
function _resolveArray(prop, value, target, isIndexable) {
var _proxy = target._proxy,
_context = target._context,
_subProxy = target._subProxy,
descriptors = target._descriptors;
if (defined(_context.index) && isIndexable(prop)) {
value = value[_context.index % value.length];
} else if (isObject(value[0])) {
var arr = value;
var scopes = _proxy._scopes.filter(function (s) {
return s !== arr;
});
value = [];
var _iterator5 = _createForOfIteratorHelper$1(arr),
_step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
var item = _step5.value;
var resolver = createSubResolver(scopes, _proxy, prop, item);
value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors));
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
}
return value;
}
function resolveFallback(fallback, prop, value) {
return isFunction(fallback) ? fallback(prop, value) : fallback;
}
var getScope = function getScope(key, parent) {
return key === true ? parent : typeof key === 'string' ? resolveObjectKey(parent, key) : undefined;
};
function addScopes(set, parentScopes, key, parentFallback, value) {
var _iterator6 = _createForOfIteratorHelper$1(parentScopes),
_step6;
try {
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
var parent = _step6.value;
var scope = getScope(key, parent);
if (scope) {
set.add(scope);
var fallback = resolveFallback(scope._fallback, key, value);
if (defined(fallback) && fallback !== key && fallback !== parentFallback) {
return fallback;
}
} else if (scope === false && defined(parentFallback) && key !== parentFallback) {
return null;
}
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
}
return false;
}
function createSubResolver(parentScopes, resolver, prop, value) {
var rootScopes = resolver._rootScopes;
var fallback = resolveFallback(resolver._fallback, prop, value);
var allScopes = [].concat(_toConsumableArray(parentScopes), _toConsumableArray(rootScopes));
var set = new Set();
set.add(value);
var key = addScopesFromKey(set, allScopes, prop, fallback || prop, value);
if (key === null) {
return false;
}
if (defined(fallback) && fallback !== prop) {
key = addScopesFromKey(set, allScopes, fallback, key, value);
if (key === null) {
return false;
}
}
return _createResolver(Array.from(set), [''], rootScopes, fallback, function () {
return subGetTarget(resolver, prop, value);
});
}
function addScopesFromKey(set, allScopes, key, fallback, item) {
while (key) {
key = addScopes(set, allScopes, key, fallback, item);
}
return key;
}
function subGetTarget(resolver, prop, value) {
var parent = resolver._getTarget();
if (!(prop in parent)) {
parent[prop] = {};
}
var target = parent[prop];
if (isArray(target) && isObject(value)) {
return value;
}
return target || {};
}
function _resolveWithPrefixes(prop, prefixes, scopes, proxy) {
var value;
var _iterator7 = _createForOfIteratorHelper$1(prefixes),
_step7;
try {
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
var prefix = _step7.value;
value = _resolve(readKey(prefix, prop), scopes);
if (defined(value)) {
return needsSubResolver(prop, value) ? createSubResolver(scopes, proxy, prop, value) : value;
}
}
} catch (err) {
_iterator7.e(err);
} finally {
_iterator7.f();
}
}
function _resolve(key, scopes) {
var _iterator8 = _createForOfIteratorHelper$1(scopes),
_step8;
try {
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
var scope = _step8.value;
if (!scope) {
continue;
}
var value = scope[key];
if (defined(value)) {
return value;
}
}
} catch (err) {
_iterator8.e(err);
} finally {
_iterator8.f();
}
}
function getKeysFromAllScopes(target) {
var keys = target._keys;
if (!keys) {
keys = target._keys = resolveKeysFromAllScopes(target._scopes);
}
return keys;
}
function resolveKeysFromAllScopes(scopes) {
var set = new Set();
var _iterator9 = _createForOfIteratorHelper$1(scopes),
_step9;
try {
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
var scope = _step9.value;
var _iterator10 = _createForOfIteratorHelper$1(Object.keys(scope).filter(function (k) {
return !k.startsWith('_');
})),
_step10;
try {
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
var key = _step10.value;
set.add(key);
}
} catch (err) {
_iterator10.e(err);
} finally {
_iterator10.f();
}
}
} catch (err) {
_iterator9.e(err);
} finally {
_iterator9.f();
}
return Array.from(set);
}
function _parseObjectDataRadialScale(meta, data, start, count) {
var iScale = meta.iScale;
var _this$_parsing$key = this._parsing.key,
key = _this$_parsing$key === void 0 ? 'r' : _this$_parsing$key;
var parsed = new Array(count);
var i, ilen, index, item;
for (i = 0, ilen = count; i < ilen; ++i) {
index = i + start;
item = data[index];
parsed[i] = {
r: iScale.parse(resolveObjectKey(item, key), index)
};
}
return parsed;
}
var EPSILON = Number.EPSILON || 1e-14;
var getPoint = function getPoint(points, i) {
return i < points.length && !points[i].skip && points[i];
};
var getValueAxis = function getValueAxis(indexAxis) {
return indexAxis === 'x' ? 'y' : 'x';
};
function splineCurve(firstPoint, middlePoint, afterPoint, t) {
// Props to Rob Spencer at scaled innovation for his post on splining between points
// http://scaledinnovation.com/analytics/splines/aboutSplines.html
// This function must also respect "skipped" points
var previous = firstPoint.skip ? middlePoint : firstPoint;
var current = middlePoint;
var next = afterPoint.skip ? middlePoint : afterPoint;
var d01 = distanceBetweenPoints(current, previous);
var d12 = distanceBetweenPoints(next, current);
var s01 = d01 / (d01 + d12);
var s12 = d12 / (d01 + d12);
// If all points are the same, s01 & s02 will be inf
s01 = isNaN(s01) ? 0 : s01;
s12 = isNaN(s12) ? 0 : s12;
var fa = t * s01; // scaling factor for triangle Ta
var fb = t * s12;
return {
previous: {
x: current.x - fa * (next.x - previous.x),
y: current.y - fa * (next.y - previous.y)
},
next: {
x: current.x + fb * (next.x - previous.x),
y: current.y + fb * (next.y - previous.y)
}
};
}
/**
* Adjust tangents to ensure monotonic properties
*/
function monotoneAdjust(points, deltaK, mK) {
var pointsLen = points.length;
var alphaK, betaK, tauK, squaredMagnitude, pointCurrent;
var pointAfter = getPoint(points, 0);
for (var i = 0; i < pointsLen - 1; ++i) {
pointCurrent = pointAfter;
pointAfter = getPoint(points, i + 1);
if (!pointCurrent || !pointAfter) {
continue;
}
if (almostEquals(deltaK[i], 0, EPSILON)) {
mK[i] = mK[i + 1] = 0;
continue;
}
alphaK = mK[i] / deltaK[i];
betaK = mK[i + 1] / deltaK[i];
squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
if (squaredMagnitude <= 9) {
continue;
}
tauK = 3 / Math.sqrt(squaredMagnitude);
mK[i] = alphaK * tauK * deltaK[i];
mK[i + 1] = betaK * tauK * deltaK[i];
}
}
function monotoneCompute(points, mK) {
var indexAxis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'x';
var valueAxis = getValueAxis(indexAxis);
var pointsLen = points.length;
var delta, pointBefore, pointCurrent;
var pointAfter = getPoint(points, 0);
for (var i = 0; i < pointsLen; ++i) {
pointBefore = pointCurrent;
pointCurrent = pointAfter;
pointAfter = getPoint(points, i + 1);
if (!pointCurrent) {
continue;
}
var iPixel = pointCurrent[indexAxis];
var vPixel = pointCurrent[valueAxis];
if (pointBefore) {
delta = (iPixel - pointBefore[indexAxis]) / 3;
pointCurrent["cp1".concat(indexAxis)] = iPixel - delta;
pointCurrent["cp1".concat(valueAxis)] = vPixel - delta * mK[i];
}
if (pointAfter) {
delta = (pointAfter[indexAxis] - iPixel) / 3;
pointCurrent["cp2".concat(indexAxis)] = iPixel + delta;
pointCurrent["cp2".concat(valueAxis)] = vPixel + delta * mK[i];
}
}
}
/**
* This function calculates Bézier control points in a similar way than |splineCurve|,
* but preserves monotonicity of the provided data and ensures no local extremums are added
* between the dataset discrete points due to the interpolation.
* See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
*/
function splineCurveMonotone(points) {
var indexAxis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';
var valueAxis = getValueAxis(indexAxis);
var pointsLen = points.length;
var deltaK = Array(pointsLen).fill(0);
var mK = Array(pointsLen);
// Calculate slopes (deltaK) and initialize tangents (mK)
var i, pointBefore, pointCurrent;
var pointAfter = getPoint(points, 0);
for (i = 0; i < pointsLen; ++i) {
pointBefore = pointCurrent;
pointCurrent = pointAfter;
pointAfter = getPoint(points, i + 1);
if (!pointCurrent) {
continue;
}
if (pointAfter) {
var slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];
// In the case of two points that appear at the same x pixel, slopeDeltaX is 0
deltaK[i] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;
}
mK[i] = !pointBefore ? deltaK[i] : !pointAfter ? deltaK[i - 1] : sign(deltaK[i - 1]) !== sign(deltaK[i]) ? 0 : (deltaK[i - 1] + deltaK[i]) / 2;
}
monotoneAdjust(points, deltaK, mK);
monotoneCompute(points, mK, indexAxis);
}
function capControlPoint(pt, min, max) {
return Math.max(Math.min(pt, max), min);
}
function capBezierPoints(points, area) {
var i, ilen, point, inArea, inAreaPrev;
var inAreaNext = _isPointInArea(points[0], area);
for (i = 0, ilen = points.length; i < ilen; ++i) {
inAreaPrev = inArea;
inArea = inAreaNext;
inAreaNext = i < ilen - 1 && _isPointInArea(points[i + 1], area);
if (!inArea) {
continue;
}
point = points[i];
if (inAreaPrev) {
point.cp1x = capControlPoint(point.cp1x, area.left, area.right);
point.cp1y = capControlPoint(point.cp1y, area.top, area.bottom);
}
if (inAreaNext) {
point.cp2x = capControlPoint(point.cp2x, area.left, area.right);
point.cp2y = capControlPoint(point.cp2y, area.top, area.bottom);
}
}
}
/**
* @private
*/
function _updateBezierControlPoints(points, options, area, loop, indexAxis) {
var i, ilen, point, controlPoints;
// Only consider points that are drawn in case the spanGaps option is used
if (options.spanGaps) {
points = points.filter(function (pt) {
return !pt.skip;
});
}
if (options.cubicInterpolationMode === 'monotone') {
splineCurveMonotone(points, indexAxis);
} else {
var prev = loop ? points[points.length - 1] : points[0];
for (i = 0, ilen = points.length; i < ilen; ++i) {
point = points[i];
controlPoints = splineCurve(prev, point, points[Math.min(i + 1, ilen - (loop ? 0 : 1)) % ilen], options.tension);
point.cp1x = controlPoints.previous.x;
point.cp1y = controlPoints.previous.y;
point.cp2x = controlPoints.next.x;
point.cp2y = controlPoints.next.y;
prev = point;
}
}
if (options.capBezierPoints) {
capBezierPoints(points, area);
}
}
/**
* Note: typedefs are auto-exported, so use a made-up `dom` namespace where
* necessary to avoid duplicates with `export * from './helpers`; see
* https://github.com/microsoft/TypeScript/issues/46011
* @typedef { import('../core/core.controller.js').default } dom.Chart
* @typedef { import('../../types').ChartEvent } ChartEvent
*/ /**
* @private
*/
function _isDomSupported() {
return typeof window !== 'undefined' && typeof document !== 'undefined';
}
/**
* @private
*/
function _getParentNode(domNode) {
var parent = domNode.parentNode;
if (parent && parent.toString() === '[object ShadowRoot]') {
parent = parent.host;
}
return parent;
}
/**
* convert max-width/max-height values that may be percentages into a number
* @private
*/
function parseMaxStyle(styleValue, node, parentProperty) {
var valueInPixels;
if (typeof styleValue === 'string') {
valueInPixels = parseInt(styleValue, 10);
if (styleValue.indexOf('%') !== -1) {
// percentage * size in dimension
valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
}
} else {
valueInPixels = styleValue;
}
return valueInPixels;
}
var getComputedStyle = function getComputedStyle(element) {
return element.ownerDocument.defaultView.getComputedStyle(element, null);
};
function getStyle(el, property) {
return getComputedStyle(el).getPropertyValue(property);
}
var positions = ['top', 'right', 'bottom', 'left'];
function getPositionedStyle(styles, style, suffix) {
var result = {};
suffix = suffix ? '-' + suffix : '';
for (var i = 0; i < 4; i++) {
var pos = positions[i];
result[pos] = parseFloat(styles[style + '-' + pos + suffix]) || 0;
}
result.width = result.left + result.right;
result.height = result.top + result.bottom;
return result;
}
var useOffsetPos = function useOffsetPos(x, y, target) {
return (x > 0 || y > 0) && (!target || !target.shadowRoot);
};
/**
* @param e
* @param canvas
* @returns Canvas position
*/
function getCanvasPosition(e, canvas) {
var touches = e.touches;
var source = touches && touches.length ? touches[0] : e;
var offsetX = source.offsetX,
offsetY = source.offsetY;
var box = false;
var x, y;
if (useOffsetPos(offsetX, offsetY, e.target)) {
x = offsetX;
y = offsetY;
} else {
var rect = canvas.getBoundingClientRect();
x = source.clientX - rect.left;
y = source.clientY - rect.top;
box = true;
}
return {
x: x,
y: y,
box: box
};
}
/**
* Gets an event's x, y coordinates, relative to the chart area
* @param event
* @param chart
* @returns x and y coordinates of the event
*/
function getRelativePosition(event, chart) {
if ('native' in event) {
return event;
}
var canvas = chart.canvas,
currentDevicePixelRatio = chart.currentDevicePixelRatio;
var style = getComputedStyle(canvas);
var borderBox = style.boxSizing === 'border-box';
var paddings = getPositionedStyle(style, 'padding');
var borders = getPositionedStyle(style, 'border', 'width');
var _getCanvasPosition = getCanvasPosition(event, canvas),
x = _getCanvasPosition.x,
y = _getCanvasPosition.y,
box = _getCanvasPosition.box;
var xOffset = paddings.left + (box && borders.left);
var yOffset = paddings.top + (box && borders.top);
var width = chart.width,
height = chart.height;
if (borderBox) {
width -= paddings.width + borders.width;
height -= paddings.height + borders.height;
}
return {
x: Math.round((x - xOffset) / width * canvas.width / currentDevicePixelRatio),
y: Math.round((y - yOffset) / height * canvas.height / currentDevicePixelRatio)
};
}
function getContainerSize(canvas, width, height) {
var maxWidth, maxHeight;
if (width === undefined || height === undefined) {
var container = _getParentNode(canvas);
if (!container) {
width = canvas.clientWidth;
height = canvas.clientHeight;
} else {
var rect = container.getBoundingClientRect(); // this is the border box of the container
var containerStyle = getComputedStyle(container);
var containerBorder = getPositionedStyle(containerStyle, 'border', 'width');
var containerPadding = getPositionedStyle(containerStyle, 'padding');
width = rect.width - containerPadding.width - containerBorder.width;
height = rect.height - containerPadding.height - containerBorder.height;
maxWidth = parseMaxStyle(containerStyle.maxWidth, container, 'clientWidth');
maxHeight = parseMaxStyle(containerStyle.maxHeight, container, 'clientHeight');
}
}
return {
width: width,
height: height,
maxWidth: maxWidth || INFINITY,
maxHeight: maxHeight || INFINITY
};
}
var round1 = function round1(v) {
return Math.round(v * 10) / 10;
};
// eslint-disable-next-line complexity
function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio) {
var style = getComputedStyle(canvas);
var margins = getPositionedStyle(style, 'margin');
var maxWidth = parseMaxStyle(style.maxWidth, canvas, 'clientWidth') || INFINITY;
var maxHeight = parseMaxStyle(style.maxHeight, canvas, 'clientHeight') || INFINITY;
var containerSize = getContainerSize(canvas, bbWidth, bbHeight);
var width = containerSize.width,
height = containerSize.height;
if (style.boxSizing === 'content-box') {
var borders = getPositionedStyle(style, 'border', 'width');
var paddings = getPositionedStyle(style, 'padding');
width -= paddings.width + borders.width;
height -= paddings.height + borders.height;
}
width = Math.max(0, width - margins.width);
height = Math.max(0, aspectRatio ? width / aspectRatio : height - margins.height);
width = round1(Math.min(width, maxWidth, containerSize.maxWidth));
height = round1(Math.min(height, maxHeight, containerSize.maxHeight));
if (width && !height) {
// https://github.com/chartjs/Chart.js/issues/4659
// If the canvas has width, but no height, default to aspectRatio of 2 (canvas default)
height = round1(width / 2);
}
var maintainHeight = bbWidth !== undefined || bbHeight !== undefined;
if (maintainHeight && aspectRatio && containerSize.height && height > containerSize.height) {
height = containerSize.height;
width = round1(Math.floor(height * aspectRatio));
}
return {
width: width,
height: height
};
}
/**
* @param chart
* @param forceRatio
* @param forceStyle
* @returns True if the canvas context size or transformation has changed.
*/
function retinaScale(chart, forceRatio, forceStyle) {
var pixelRatio = forceRatio || 1;
var deviceHeight = Math.floor(chart.height * pixelRatio);
var deviceWidth = Math.floor(chart.width * pixelRatio);
chart.height = Math.floor(chart.height);
chart.width = Math.floor(chart.width);
var canvas = chart.canvas;
// If no style has been set on the canvas, the render size is used as display size,
// making the chart visually bigger, so let's enforce it to the "correct" values.
// See https://github.com/chartjs/Chart.js/issues/3575
if (canvas.style && (forceStyle || !canvas.style.height && !canvas.style.width)) {
canvas.style.height = "".concat(chart.height, "px");
canvas.style.width = "".concat(chart.width, "px");
}
if (chart.currentDevicePixelRatio !== pixelRatio || canvas.height !== deviceHeight || canvas.width !== deviceWidth) {
chart.currentDevicePixelRatio = pixelRatio;
canvas.height = deviceHeight;
canvas.width = deviceWidth;
chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
return true;
}
return false;
}
/**
* Detects support for options object argument in addEventListener.
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
* @private
*/
var supportsEventListenerOptions = function () {
var passiveSupported = false;
try {
var options = {
get passive() {
passiveSupported = true;
return false;
}
};
window.addEventListener('test', null, options);
window.removeEventListener('test', null, options);
} catch (e) {
// continue regardless of error
}
return passiveSupported;
}();
/**
* The "used" size is the final value of a dimension property after all calculations have
* been performed. This method uses the computed style of `element` but returns undefined
* if the computed style is not expressed in pixels. That can happen in some cases where
* `element` has a size relative to its parent and this last one is not yet displayed,
* for example because of `display: none` on a parent node.
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
* @returns Size in pixels or undefined if unknown.
*/
function readUsedSize(element, property) {
var value = getStyle(element, property);
var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
return matches ? +matches[1] : undefined;
}
/**
* @private
*/
function _pointInLine(p1, p2, t, mode) {
return {
x: p1.x + t * (p2.x - p1.x),
y: p1.y + t * (p2.y - p1.y)
};
}
/**
* @private
*/
function _steppedInterpolation(p1, p2, t, mode) {
return {
x: p1.x + t * (p2.x - p1.x),
y: mode === 'middle' ? t < 0.5 ? p1.y : p2.y : mode === 'after' ? t < 1 ? p1.y : p2.y : t > 0 ? p2.y : p1.y
};
}
/**
* @private
*/
function _bezierInterpolation(p1, p2, t, mode) {
var cp1 = {
x: p1.cp2x,
y: p1.cp2y
};
var cp2 = {
x: p2.cp1x,
y: p2.cp1y
};
var a = _pointInLine(p1, cp1, t);
var b = _pointInLine(cp1, cp2, t);
var c = _pointInLine(cp2, p2, t);
var d = _pointInLine(a, b, t);
var e = _pointInLine(b, c, t);
return _pointInLine(d, e, t);
}
var getRightToLeftAdapter = function getRightToLeftAdapter(rectX, width) {
return {
x: function x(_x) {
return rectX + rectX + width - _x;
},
setWidth: function setWidth(w) {
width = w;
},
textAlign: function textAlign(align) {
if (align === 'center') {
return align;
}
return align === 'right' ? 'left' : 'right';
},
xPlus: function xPlus(x, value) {
return x - value;
},
leftForLtr: function leftForLtr(x, itemWidth) {
return x - itemWidth;
}
};
};
var getLeftToRightAdapter = function getLeftToRightAdapter() {
return {
x: function x(_x2) {
return _x2;
},
setWidth: function setWidth(w) {},
textAlign: function textAlign(align) {
return align;
},
xPlus: function xPlus(x, value) {
return x + value;
},
leftForLtr: function leftForLtr(x, _itemWidth) {
return x;
}
};
};
function getRtlAdapter(rtl, rectX, width) {
return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();
}
function overrideTextDirection(ctx, direction) {
var style, original;
if (direction === 'ltr' || direction === 'rtl') {
style = ctx.canvas.style;
original = [style.getPropertyValue('direction'), style.getPropertyPriority('direction')];
style.setProperty('direction', direction, 'important');
ctx.prevTextDirection = original;
}
}
function restoreTextDirection(ctx, original) {
if (original !== undefined) {
delete ctx.prevTextDirection;
ctx.canvas.style.setProperty('direction', original[0], original[1]);
}
}
function propertyFn(property) {
if (property === 'angle') {
return {
between: _angleBetween,
compare: _angleDiff,
normalize: _normalizeAngle
};
}
return {
between: _isBetween,
compare: function compare(a, b) {
return a - b;
},
normalize: function normalize(x) {
return x;
}
};
}
function normalizeSegment(_ref) {
var start = _ref.start,
end = _ref.end,
count = _ref.count,
loop = _ref.loop,
style = _ref.style;
return {
start: start % count,
end: end % count,
loop: loop && (end - start + 1) % count === 0,
style: style
};
}
function getSegment(segment, points, bounds) {
var property = bounds.property,
startBound = bounds.start,
endBound = bounds.end;
var _propertyFn = propertyFn(property),
between = _propertyFn.between,
normalize = _propertyFn.normalize;
var count = points.length;
var start = segment.start,
end = segment.end,
loop = segment.loop;
var i, ilen;
if (loop) {
start += count;
end += count;
for (i = 0, ilen = count; i < ilen; ++i) {
if (!between(normalize(points[start % count][property]), startBound, endBound)) {
break;
}
start--;
end--;
}
start %= count;
end %= count;
}
if (end < start) {
end += count;
}
return {
start: start,
end: end,
loop: loop,
style: segment.style
};
}
function _boundSegment(segment, points, bounds) {
if (!bounds) {
return [segment];
}
var property = bounds.property,
startBound = bounds.start,
endBound = bounds.end;
var count = points.length;
var _propertyFn2 = propertyFn(property),
compare = _propertyFn2.compare,
between = _propertyFn2.between,
normalize = _propertyFn2.normalize;
var _getSegment = getSegment(segment, points, bounds),
start = _getSegment.start,
end = _getSegment.end,
loop = _getSegment.loop,
style = _getSegment.style;
var result = [];
var inside = false;
var subStart = null;
var value, point, prevValue;
var startIsBefore = function startIsBefore() {
return between(startBound, prevValue, value) && compare(startBound, prevValue) !== 0;
};
var endIsBefore = function endIsBefore() {
return compare(endBound, value) === 0 || between(endBound, prevValue, value);
};
var shouldStart = function shouldStart() {
return inside || startIsBefore();
};
var shouldStop = function shouldStop() {
return !inside || endIsBefore();
};
for (var i = start, prev = start; i <= end; ++i) {
point = points[i % count];
if (point.skip) {
continue;
}
value = normalize(point[property]);
if (value === prevValue) {
continue;
}
inside = between(value, startBound, endBound);
if (subStart === null && shouldStart()) {
subStart = compare(value, startBound) === 0 ? i : prev;
}
if (subStart !== null && shouldStop()) {
result.push(normalizeSegment({
start: subStart,
end: i,
loop: loop,
count: count,
style: style
}));
subStart = null;
}
prev = i;
prevValue = value;
}
if (subStart !== null) {
result.push(normalizeSegment({
start: subStart,
end: end,
loop: loop,
count: count,
style: style
}));
}
return result;
}
function _boundSegments(line, bounds) {
var result = [];
var segments = line.segments;
for (var i = 0; i < segments.length; i++) {
var sub = _boundSegment(segments[i], line.points, bounds);
if (sub.length) {
result.push.apply(result, _toConsumableArray(sub));
}
}
return result;
}
function findStartAndEnd(points, count, loop, spanGaps) {
var start = 0;
var end = count - 1;
if (loop && !spanGaps) {
while (start < count && !points[start].skip) {
start++;
}
}
while (start < count && points[start].skip) {
start++;
}
start %= count;
if (loop) {
end += start;
}
while (end > start && points[end % count].skip) {
end--;
}
end %= count;
return {
start: start,
end: end
};
}
function solidSegments(points, start, max, loop) {
var count = points.length;
var result = [];
var last = start;
var prev = points[start];
var end;
for (end = start + 1; end <= max; ++end) {
var cur = points[end % count];
if (cur.skip || cur.stop) {
if (!prev.skip) {
loop = false;
result.push({
start: start % count,
end: (end - 1) % count,
loop: loop
});
start = last = cur.stop ? end : null;
}
} else {
last = end;
if (prev.skip) {
start = end;
}
}
prev = cur;
}
if (last !== null) {
result.push({
start: start % count,
end: last % count,
loop: loop
});
}
return result;
}
function _computeSegments(line, segmentOptions) {
var points = line.points;
var spanGaps = line.options.spanGaps;
var count = points.length;
if (!count) {
return [];
}
var loop = !!line._loop;
var _findStartAndEnd = findStartAndEnd(points, count, loop, spanGaps),
start = _findStartAndEnd.start,
end = _findStartAndEnd.end;
if (spanGaps === true) {
return splitByStyles(line, [{
start: start,
end: end,
loop: loop
}], points, segmentOptions);
}
var max = end < start ? end + count : end;
var completeLoop = !!line._fullLoop && start === 0 && end === count - 1;
return splitByStyles(line, solidSegments(points, start, max, completeLoop), points, segmentOptions);
}
function splitByStyles(line, segments, points, segmentOptions) {
if (!segmentOptions || !segmentOptions.setContext || !points) {
return segments;
}
return doSplitByStyles(line, segments, points, segmentOptions);
}
function doSplitByStyles(line, segments, points, segmentOptions) {
var chartContext = line._chart.getContext();
var baseStyle = readStyle(line.options);
var datasetIndex = line._datasetIndex,
spanGaps = line.options.spanGaps;
var count = points.length;
var result = [];
var prevStyle = baseStyle;
var start = segments[0].start;
var i = start;
function addStyle(s, e, l, st) {
var dir = spanGaps ? -1 : 1;
if (s === e) {
return;
}
s += count;
while (points[s % count].skip) {
s -= dir;
}
while (points[e % count].skip) {
e += dir;
}
if (s % count !== e % count) {
result.push({
start: s % count,
end: e % count,
loop: l,
style: st
});
prevStyle = st;
start = e % count;
}
}
var _iterator11 = _createForOfIteratorHelper$1(segments),
_step11;
try {
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
var segment = _step11.value;
start = spanGaps ? start : segment.start;
var prev = points[start % count];
var style = void 0;
for (i = start + 1; i <= segment.end; i++) {
var pt = points[i % count];
style = readStyle(segmentOptions.setContext(createContext(chartContext, {
type: 'segment',
p0: prev,
p1: pt,
p0DataIndex: (i - 1) % count,
p1DataIndex: i % count,
datasetIndex: datasetIndex
})));
if (styleChanged(style, prevStyle)) {
addStyle(start, i - 1, segment.loop, prevStyle);
}
prev = pt;
prevStyle = style;
}
if (start < i - 1) {
addStyle(start, i - 1, segment.loop, prevStyle);
}
}
} catch (err) {
_iterator11.e(err);
} finally {
_iterator11.f();
}
return result;
}
function readStyle(options) {
return {
backgroundColor: options.backgroundColor,
borderCapStyle: options.borderCapStyle,
borderDash: options.borderDash,
borderDashOffset: options.borderDashOffset,
borderJoinStyle: options.borderJoinStyle,
borderWidth: options.borderWidth,
borderColor: options.borderColor
};
}
function styleChanged(style, prevStyle) {
return prevStyle && JSON.stringify(style) !== JSON.stringify(prevStyle);
}
var Animator = /*#__PURE__*/function () {
function Animator() {
_classCallCheck$x(this, Animator);
this._request = null;
this._charts = new Map();
this._running = false;
this._lastDate = undefined;
}
_createClass$x(Animator, [{
key: "_notify",
value: function _notify(chart, anims, date, type) {
var callbacks = anims.listeners[type];
var numSteps = anims.duration;
callbacks.forEach(function (fn) {
return fn({
chart: chart,
initial: anims.initial,
numSteps: numSteps,
currentStep: Math.min(date - anims.start, numSteps)
});
});
}
}, {
key: "_refresh",
value: function _refresh() {
var _this = this;
if (this._request) {
return;
}
this._running = true;
this._request = requestAnimFrame.call(window, function () {
_this._update();
_this._request = null;
if (_this._running) {
_this._refresh();
}
});
}
}, {
key: "_update",
value: function _update() {
var _this2 = this;
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Date.now();
var remaining = 0;
this._charts.forEach(function (anims, chart) {
if (!anims.running || !anims.items.length) {
return;
}
var items = anims.items;
var i = items.length - 1;
var draw = false;
var item;
for (; i >= 0; --i) {
item = items[i];
if (item._active) {
if (item._total > anims.duration) {
anims.duration = item._total;
}
item.tick(date);
draw = true;
} else {
items[i] = items[items.length - 1];
items.pop();
}
}
if (draw) {
chart.draw();
_this2._notify(chart, anims, date, 'progress');
}
if (!items.length) {
anims.running = false;
_this2._notify(chart, anims, date, 'complete');
anims.initial = false;
}
remaining += items.length;
});
this._lastDate = date;
if (remaining === 0) {
this._running = false;
}
}
}, {
key: "_getAnims",
value: function _getAnims(chart) {
var charts = this._charts;
var anims = charts.get(chart);
if (!anims) {
anims = {
running: false,
initial: true,
items: [],
listeners: {
complete: [],
progress: []
}
};
charts.set(chart, anims);
}
return anims;
}
}, {
key: "listen",
value: function listen(chart, event, cb) {
this._getAnims(chart).listeners[event].push(cb);
}
}, {
key: "add",
value: function add(chart, items) {
var _this$_getAnims$items;
if (!items || !items.length) {
return;
}
(_this$_getAnims$items = this._getAnims(chart).items).push.apply(_this$_getAnims$items, _toConsumableArray(items));
}
}, {
key: "has",
value: function has(chart) {
return this._getAnims(chart).items.length > 0;
}
}, {
key: "start",
value: function start(chart) {
var anims = this._charts.get(chart);
if (!anims) {
return;
}
anims.running = true;
anims.start = Date.now();
anims.duration = anims.items.reduce(function (acc, cur) {
return Math.max(acc, cur._duration);
}, 0);
this._refresh();
}
}, {
key: "running",
value: function running(chart) {
if (!this._running) {
return false;
}
var anims = this._charts.get(chart);
if (!anims || !anims.running || !anims.items.length) {
return false;
}
return true;
}
}, {
key: "stop",
value: function stop(chart) {
var anims = this._charts.get(chart);
if (!anims || !anims.items.length) {
return;
}
var items = anims.items;
var i = items.length - 1;
for (; i >= 0; --i) {
items[i].cancel();
}
anims.items = [];
this._notify(chart, anims, Date.now(), 'complete');
}
}, {
key: "remove",
value: function remove(chart) {
return this._charts["delete"](chart);
}
}]);
return Animator;
}();
var animator = /* #__PURE__ */new Animator();
var transparent = 'transparent';
var interpolators = {
"boolean": function boolean(from, to, factor) {
return factor > 0.5 ? to : from;
},
color: function color$1(from, to, factor) {
var c0 = color(from || transparent);
var c1 = c0.valid && color(to || transparent);
return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to;
},
number: function number(from, to, factor) {
return from + (to - from) * factor;
}
};
var Animation = /*#__PURE__*/function () {
function Animation(cfg, target, prop, to) {
_classCallCheck$x(this, Animation);
var currentValue = target[prop];
to = resolve([cfg.to, to, currentValue, cfg.from]);
var from = resolve([cfg.from, currentValue, to]);
this._active = true;
this._fn = cfg.fn || interpolators[cfg.type || _typeof$z(from)];
this._easing = effects[cfg.easing] || effects.linear;
this._start = Math.floor(Date.now() + (cfg.delay || 0));
this._duration = this._total = Math.floor(cfg.duration);
this._loop = !!cfg.loop;
this._target = target;
this._prop = prop;
this._from = from;
this._to = to;
this._promises = undefined;
}
_createClass$x(Animation, [{
key: "active",
value: function active() {
return this._active;
}
}, {
key: "update",
value: function update(cfg, to, date) {
if (this._active) {
this._notify(false);
var currentValue = this._target[this._prop];
var elapsed = date - this._start;
var remain = this._duration - elapsed;
this._start = date;
this._duration = Math.floor(Math.max(remain, cfg.duration));
this._total += elapsed;
this._loop = !!cfg.loop;
this._to = resolve([cfg.to, to, currentValue, cfg.from]);
this._from = resolve([cfg.from, currentValue, to]);
}
}
}, {
key: "cancel",
value: function cancel() {
if (this._active) {
this.tick(Date.now());
this._active = false;
this._notify(false);
}
}
}, {
key: "tick",
value: function tick(date) {
var elapsed = date - this._start;
var duration = this._duration;
var prop = this._prop;
var from = this._from;
var loop = this._loop;
var to = this._to;
var factor;
this._active = from !== to && (loop || elapsed < duration);
if (!this._active) {
this._target[prop] = to;
this._notify(true);
return;
}
if (elapsed < 0) {
this._target[prop] = from;
return;
}
factor = elapsed / duration % 2;
factor = loop && factor > 1 ? 2 - factor : factor;
factor = this._easing(Math.min(1, Math.max(0, factor)));
this._target[prop] = this._fn(from, to, factor);
}
}, {
key: "wait",
value: function wait() {
var promises = this._promises || (this._promises = []);
return new Promise(function (res, rej) {
promises.push({
res: res,
rej: rej
});
});
}
}, {
key: "_notify",
value: function _notify(resolved) {
var method = resolved ? 'res' : 'rej';
var promises = this._promises || [];
for (var i = 0; i < promises.length; i++) {
promises[i][method]();
}
}
}]);
return Animation;
}();
var Animations = /*#__PURE__*/function () {
function Animations(chart, config) {
_classCallCheck$x(this, Animations);
this._chart = chart;
this._properties = new Map();
this.configure(config);
}
_createClass$x(Animations, [{
key: "configure",
value: function configure(config) {
if (!isObject(config)) {
return;
}
var animationOptions = Object.keys(defaults.animation);
var animatedProps = this._properties;
Object.getOwnPropertyNames(config).forEach(function (key) {
var cfg = config[key];
if (!isObject(cfg)) {
return;
}
var resolved = {};
for (var _i = 0, _animationOptions = animationOptions; _i < _animationOptions.length; _i++) {
var option = _animationOptions[_i];
resolved[option] = cfg[option];
}
(isArray(cfg.properties) && cfg.properties || [key]).forEach(function (prop) {
if (prop === key || !animatedProps.has(prop)) {
animatedProps.set(prop, resolved);
}
});
});
}
}, {
key: "_animateOptions",
value: function _animateOptions(target, values) {
var newOptions = values.options;
var options = resolveTargetOptions(target, newOptions);
if (!options) {
return [];
}
var animations = this._createAnimations(options, newOptions);
if (newOptions.$shared) {
awaitAll(target.options.$animations, newOptions).then(function () {
target.options = newOptions;
}, function () {});
}
return animations;
}
}, {
key: "_createAnimations",
value: function _createAnimations(target, values) {
var animatedProps = this._properties;
var animations = [];
var running = target.$animations || (target.$animations = {});
var props = Object.keys(values);
var date = Date.now();
var i;
for (i = props.length - 1; i >= 0; --i) {
var prop = props[i];
if (prop.charAt(0) === '$') {
continue;
}
if (prop === 'options') {
animations.push.apply(animations, _toConsumableArray(this._animateOptions(target, values)));
continue;
}
var value = values[prop];
var animation = running[prop];
var cfg = animatedProps.get(prop);
if (animation) {
if (cfg && animation.active()) {
animation.update(cfg, value, date);
continue;
} else {
animation.cancel();
}
}
if (!cfg || !cfg.duration) {
target[prop] = value;
continue;
}
running[prop] = animation = new Animation(cfg, target, prop, value);
animations.push(animation);
}
return animations;
}
}, {
key: "update",
value: function update(target, values) {
if (this._properties.size === 0) {
Object.assign(target, values);
return;
}
var animations = this._createAnimations(target, values);
if (animations.length) {
animator.add(this._chart, animations);
return true;
}
}
}]);
return Animations;
}();
function awaitAll(animations, properties) {
var running = [];
var keys = Object.keys(properties);
for (var i = 0; i < keys.length; i++) {
var anim = animations[keys[i]];
if (anim && anim.active()) {
running.push(anim.wait());
}
}
return Promise.all(running);
}
function resolveTargetOptions(target, newOptions) {
if (!newOptions) {
return;
}
var options = target.options;
if (!options) {
target.options = newOptions;
return;
}
if (options.$shared) {
target.options = options = Object.assign({}, options, {
$shared: false,
$animations: {}
});
}
return options;
}
function scaleClip(scale, allowedOverflow) {
var opts = scale && scale.options || {};
var reverse = opts.reverse;
var min = opts.min === undefined ? allowedOverflow : 0;
var max = opts.max === undefined ? allowedOverflow : 0;
return {
start: reverse ? max : min,
end: reverse ? min : max
};
}
function defaultClip(xScale, yScale, allowedOverflow) {
if (allowedOverflow === false) {
return false;
}
var x = scaleClip(xScale, allowedOverflow);
var y = scaleClip(yScale, allowedOverflow);
return {
top: y.end,
right: x.end,
bottom: y.start,
left: x.start
};
}
function toClip(value) {
var t, r, b, l;
if (isObject(value)) {
t = value.top;
r = value.right;
b = value.bottom;
l = value.left;
} else {
t = r = b = l = value;
}
return {
top: t,
right: r,
bottom: b,
left: l,
disabled: value === false
};
}
function getSortedDatasetIndices(chart, filterVisible) {
var keys = [];
var metasets = chart._getSortedDatasetMetas(filterVisible);
var i, ilen;
for (i = 0, ilen = metasets.length; i < ilen; ++i) {
keys.push(metasets[i].index);
}
return keys;
}
function _applyStack(stack, value, dsIndex) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var keys = stack.keys;
var singleMode = options.mode === 'single';
var i, ilen, datasetIndex, otherValue;
if (value === null) {
return;
}
for (i = 0, ilen = keys.length; i < ilen; ++i) {
datasetIndex = +keys[i];
if (datasetIndex === dsIndex) {
if (options.all) {
continue;
}
break;
}
otherValue = stack.values[datasetIndex];
if (isNumberFinite(otherValue) && (singleMode || value === 0 || sign(value) === sign(otherValue))) {
value += otherValue;
}
}
return value;
}
function convertObjectDataToArray(data) {
var keys = Object.keys(data);
var adata = new Array(keys.length);
var i, ilen, key;
for (i = 0, ilen = keys.length; i < ilen; ++i) {
key = keys[i];
adata[i] = {
x: key,
y: data[key]
};
}
return adata;
}
function isStacked(scale, meta) {
var stacked = scale && scale.options.stacked;
return stacked || stacked === undefined && meta.stack !== undefined;
}
function getStackKey(indexScale, valueScale, meta) {
return "".concat(indexScale.id, ".").concat(valueScale.id, ".").concat(meta.stack || meta.type);
}
function getUserBounds(scale) {
var _scale$getUserBounds = scale.getUserBounds(),
min = _scale$getUserBounds.min,
max = _scale$getUserBounds.max,
minDefined = _scale$getUserBounds.minDefined,
maxDefined = _scale$getUserBounds.maxDefined;
return {
min: minDefined ? min : Number.NEGATIVE_INFINITY,
max: maxDefined ? max : Number.POSITIVE_INFINITY
};
}
function getOrCreateStack(stacks, stackKey, indexValue) {
var subStack = stacks[stackKey] || (stacks[stackKey] = {});
return subStack[indexValue] || (subStack[indexValue] = {});
}
function getLastIndexInStack(stack, vScale, positive, type) {
var _iterator = _createForOfIteratorHelper$1(vScale.getMatchingVisibleMetas(type).reverse()),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var meta = _step.value;
var value = stack[meta.index];
if (positive && value > 0 || !positive && value < 0) {
return meta.index;
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return null;
}
function updateStacks(controller, parsed) {
var chart = controller.chart,
meta = controller._cachedMeta;
var stacks = chart._stacks || (chart._stacks = {});
var iScale = meta.iScale,
vScale = meta.vScale,
datasetIndex = meta.index;
var iAxis = iScale.axis;
var vAxis = vScale.axis;
var key = getStackKey(iScale, vScale, meta);
var ilen = parsed.length;
var stack;
for (var i = 0; i < ilen; ++i) {
var item = parsed[i];
var _index = item[iAxis],
value = item[vAxis];
var itemStacks = item._stacks || (item._stacks = {});
stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, _index);
stack[datasetIndex] = value;
stack._top = getLastIndexInStack(stack, vScale, true, meta.type);
stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);
var visualValues = stack._visualValues || (stack._visualValues = {});
visualValues[datasetIndex] = value;
}
}
function getFirstScaleId(chart, axis) {
var scales = chart.scales;
return Object.keys(scales).filter(function (key) {
return scales[key].axis === axis;
}).shift();
}
function createDatasetContext(parent, index) {
return createContext(parent, {
active: false,
dataset: undefined,
datasetIndex: index,
index: index,
mode: 'default',
type: 'dataset'
});
}
function createDataContext(parent, index, element) {
return createContext(parent, {
active: false,
dataIndex: index,
parsed: undefined,
raw: undefined,
element: element,
index: index,
mode: 'default',
type: 'data'
});
}
function clearStacks(meta, items) {
var datasetIndex = meta.controller.index;
var axis = meta.vScale && meta.vScale.axis;
if (!axis) {
return;
}
items = items || meta._parsed;
var _iterator2 = _createForOfIteratorHelper$1(items),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var parsed = _step2.value;
var stacks = parsed._stacks;
if (!stacks || stacks[axis] === undefined || stacks[axis][datasetIndex] === undefined) {
return;
}
delete stacks[axis][datasetIndex];
if (stacks[axis]._visualValues !== undefined && stacks[axis]._visualValues[datasetIndex] !== undefined) {
delete stacks[axis]._visualValues[datasetIndex];
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
}
var isDirectUpdateMode = function isDirectUpdateMode(mode) {
return mode === 'reset' || mode === 'none';
};
var cloneIfNotShared = function cloneIfNotShared(cached, shared) {
return shared ? cached : Object.assign({}, cached);
};
var createStack = function createStack(canStack, meta, chart) {
return canStack && !meta.hidden && meta._stacked && {
keys: getSortedDatasetIndices(chart, true),
values: null
};
};
var DatasetController = /*#__PURE__*/function () {
function DatasetController(chart, datasetIndex) {
_classCallCheck$x(this, DatasetController);
this.chart = chart;
this._ctx = chart.ctx;
this.index = datasetIndex;
this._cachedDataOpts = {};
this._cachedMeta = this.getMeta();
this._type = this._cachedMeta.type;
this.options = undefined;
this._parsing = false;
this._data = undefined;
this._objectData = undefined;
this._sharedOptions = undefined;
this._drawStart = undefined;
this._drawCount = undefined;
this.enableOptionSharing = false;
this.supportsDecimation = false;
this.$context = undefined;
this._syncList = [];
this.datasetElementType = (this instanceof DatasetController ? this.constructor : void 0).datasetElementType;
this.dataElementType = (this instanceof DatasetController ? this.constructor : void 0).dataElementType;
this.initialize();
}
_createClass$x(DatasetController, [{
key: "initialize",
value: function initialize() {
var meta = this._cachedMeta;
this.configure();
this.linkScales();
meta._stacked = isStacked(meta.vScale, meta);
this.addElements();
if (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");
}
}
}, {
key: "updateIndex",
value: function updateIndex(datasetIndex) {
if (this.index !== datasetIndex) {
clearStacks(this._cachedMeta);
}
this.index = datasetIndex;
}
}, {
key: "linkScales",
value: function linkScales() {
var chart = this.chart;
var meta = this._cachedMeta;
var dataset = this.getDataset();
var chooseId = function chooseId(axis, x, y, r) {
return axis === 'x' ? x : axis === 'r' ? r : y;
};
var xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, 'x'));
var yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, 'y'));
var rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, 'r'));
var indexAxis = meta.indexAxis;
var iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);
var vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);
meta.xScale = this.getScaleForId(xid);
meta.yScale = this.getScaleForId(yid);
meta.rScale = this.getScaleForId(rid);
meta.iScale = this.getScaleForId(iid);
meta.vScale = this.getScaleForId(vid);
}
}, {
key: "getDataset",
value: function getDataset() {
return this.chart.data.datasets[this.index];
}
}, {
key: "getMeta",
value: function getMeta() {
return this.chart.getDatasetMeta(this.index);
}
}, {
key: "getScaleForId",
value: function getScaleForId(scaleID) {
return this.chart.scales[scaleID];
}
}, {
key: "_getOtherScale",
value: function _getOtherScale(scale) {
var meta = this._cachedMeta;
return scale === meta.iScale ? meta.vScale : meta.iScale;
}
}, {
key: "reset",
value: function reset() {
this._update('reset');
}
}, {
key: "_destroy",
value: function _destroy() {
var meta = this._cachedMeta;
if (this._data) {
unlistenArrayEvents(this._data, this);
}
if (meta._stacked) {
clearStacks(meta);
}
}
}, {
key: "_dataCheck",
value: function _dataCheck() {
var dataset = this.getDataset();
var data = dataset.data || (dataset.data = []);
var _data = this._data;
if (isObject(data)) {
this._data = convertObjectDataToArray(data);
} else if (_data !== data) {
if (_data) {
unlistenArrayEvents(_data, this);
var meta = this._cachedMeta;
clearStacks(meta);
meta._parsed = [];
}
if (data && Object.isExtensible(data)) {
listenArrayEvents(data, this);
}
this._syncList = [];
this._data = data;
}
}
}, {
key: "addElements",
value: function addElements() {
var meta = this._cachedMeta;
this._dataCheck();
if (this.datasetElementType) {
meta.dataset = new this.datasetElementType();
}
}
}, {
key: "buildOrUpdateElements",
value: function buildOrUpdateElements(resetNewElements) {
var meta = this._cachedMeta;
var dataset = this.getDataset();
var stackChanged = false;
this._dataCheck();
var oldStacked = meta._stacked;
meta._stacked = isStacked(meta.vScale, meta);
if (meta.stack !== dataset.stack) {
stackChanged = true;
clearStacks(meta);
meta.stack = dataset.stack;
}
this._resyncElements(resetNewElements);
if (stackChanged || oldStacked !== meta._stacked) {
updateStacks(this, meta._parsed);
}
}
}, {
key: "configure",
value: function configure() {
var config = this.chart.config;
var scopeKeys = config.datasetScopeKeys(this._type);
var scopes = config.getOptionScopes(this.getDataset(), scopeKeys, true);
this.options = config.createResolver(scopes, this.getContext());
this._parsing = this.options.parsing;
this._cachedDataOpts = {};
}
}, {
key: "parse",
value: function parse(start, count) {
var meta = this._cachedMeta,
data = this._data;
var iScale = meta.iScale,
_stacked = meta._stacked;
var iAxis = iScale.axis;
var sorted = start === 0 && count === data.length ? true : meta._sorted;
var prev = start > 0 && meta._parsed[start - 1];
var i, cur, parsed;
if (this._parsing === false) {
meta._parsed = data;
meta._sorted = true;
parsed = data;
} else {
if (isArray(data[start])) {
parsed = this.parseArrayData(meta, data, start, count);
} else if (isObject(data[start])) {
parsed = this.parseObjectData(meta, data, start, count);
} else {
parsed = this.parsePrimitiveData(meta, data, start, count);
}
var isNotInOrderComparedToPrev = function isNotInOrderComparedToPrev() {
return cur[iAxis] === null || prev && cur[iAxis] < prev[iAxis];
};
for (i = 0; i < count; ++i) {
meta._parsed[i + start] = cur = parsed[i];
if (sorted) {
if (isNotInOrderComparedToPrev()) {
sorted = false;
}
prev = cur;
}
}
meta._sorted = sorted;
}
if (_stacked) {
updateStacks(this, parsed);
}
}
}, {
key: "parsePrimitiveData",
value: function parsePrimitiveData(meta, data, start, count) {
var iScale = meta.iScale,
vScale = meta.vScale;
var iAxis = iScale.axis;
var vAxis = vScale.axis;
var labels = iScale.getLabels();
var singleScale = iScale === vScale;
var parsed = new Array(count);
var i, ilen, index;
for (i = 0, ilen = count; i < ilen; ++i) {
var _parsed$i;
index = i + start;
parsed[i] = (_parsed$i = {}, _defineProperty$w(_parsed$i, iAxis, singleScale || iScale.parse(labels[index], index)), _defineProperty$w(_parsed$i, vAxis, vScale.parse(data[index], index)), _parsed$i);
}
return parsed;
}
}, {
key: "parseArrayData",
value: function parseArrayData(meta, data, start, count) {
var xScale = meta.xScale,
yScale = meta.yScale;
var parsed = new Array(count);
var i, ilen, index, item;
for (i = 0, ilen = count; i < ilen; ++i) {
index = i + start;
item = data[index];
parsed[i] = {
x: xScale.parse(item[0], index),
y: yScale.parse(item[1], index)
};
}
return parsed;
}
}, {
key: "parseObjectData",
value: function parseObjectData(meta, data, start, count) {
var xScale = meta.xScale,
yScale = meta.yScale;
var _this$_parsing = this._parsing,
_this$_parsing$xAxisK = _this$_parsing.xAxisKey,
xAxisKey = _this$_parsing$xAxisK === void 0 ? 'x' : _this$_parsing$xAxisK,
_this$_parsing$yAxisK = _this$_parsing.yAxisKey,
yAxisKey = _this$_parsing$yAxisK === void 0 ? 'y' : _this$_parsing$yAxisK;
var parsed = new Array(count);
var i, ilen, index, item;
for (i = 0, ilen = count; i < ilen; ++i) {
index = i + start;
item = data[index];
parsed[i] = {
x: xScale.parse(resolveObjectKey(item, xAxisKey), index),
y: yScale.parse(resolveObjectKey(item, yAxisKey), index)
};
}
return parsed;
}
}, {
key: "getParsed",
value: function getParsed(index) {
return this._cachedMeta._parsed[index];
}
}, {
key: "getDataElement",
value: function getDataElement(index) {
return this._cachedMeta.data[index];
}
}, {
key: "applyStack",
value: function applyStack(scale, parsed, mode) {
var chart = this.chart;
var meta = this._cachedMeta;
var value = parsed[scale.axis];
var stack = {
keys: getSortedDatasetIndices(chart, true),
values: parsed._stacks[scale.axis]._visualValues
};
return _applyStack(stack, value, meta.index, {
mode: mode
});
}
}, {
key: "updateRangeFromParsed",
value: function updateRangeFromParsed(range, scale, parsed, stack) {
var parsedValue = parsed[scale.axis];
var value = parsedValue === null ? NaN : parsedValue;
var values = stack && parsed._stacks[scale.axis];
if (stack && values) {
stack.values = values;
value = _applyStack(stack, parsedValue, this._cachedMeta.index);
}
range.min = Math.min(range.min, value);
range.max = Math.max(range.max, value);
}
}, {
key: "getMinMax",
value: function getMinMax(scale, canStack) {
var meta = this._cachedMeta;
var _parsed = meta._parsed;
var sorted = meta._sorted && scale === meta.iScale;
var ilen = _parsed.length;
var otherScale = this._getOtherScale(scale);
var stack = createStack(canStack, meta, this.chart);
var range = {
min: Number.POSITIVE_INFINITY,
max: Number.NEGATIVE_INFINITY
};
var _getUserBounds = getUserBounds(otherScale),
otherMin = _getUserBounds.min,
otherMax = _getUserBounds.max;
var i, parsed;
function _skip() {
parsed = _parsed[i];
var otherValue = parsed[otherScale.axis];
return !isNumberFinite(parsed[scale.axis]) || otherMin > otherValue || otherMax < otherValue;
}
for (i = 0; i < ilen; ++i) {
if (_skip()) {
continue;
}
this.updateRangeFromParsed(range, scale, parsed, stack);
if (sorted) {
break;
}
}
if (sorted) {
for (i = ilen - 1; i >= 0; --i) {
if (_skip()) {
continue;
}
this.updateRangeFromParsed(range, scale, parsed, stack);
break;
}
}
return range;
}
}, {
key: "getAllParsedValues",
value: function getAllParsedValues(scale) {
var parsed = this._cachedMeta._parsed;
var values = [];
var i, ilen, value;
for (i = 0, ilen = parsed.length; i < ilen; ++i) {
value = parsed[i][scale.axis];
if (isNumberFinite(value)) {
values.push(value);
}
}
return values;
}
}, {
key: "getMaxOverflow",
value: function getMaxOverflow() {
return false;
}
}, {
key: "getLabelAndValue",
value: function getLabelAndValue(index) {
var meta = this._cachedMeta;
var iScale = meta.iScale;
var vScale = meta.vScale;
var parsed = this.getParsed(index);
return {
label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',
value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''
};
}
}, {
key: "_update",
value: function _update(mode) {
var meta = this._cachedMeta;
this.update(mode || 'default');
meta._clip = toClip(valueOrDefault(this.options.clip, defaultClip(meta.xScale, meta.yScale, this.getMaxOverflow())));
}
}, {
key: "update",
value: function update(mode) {}
}, {
key: "draw",
value: function draw() {
var ctx = this._ctx;
var chart = this.chart;
var meta = this._cachedMeta;
var elements = meta.data || [];
var area = chart.chartArea;
var active = [];
var start = this._drawStart || 0;
var count = this._drawCount || elements.length - start;
var drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;
var i;
if (meta.dataset) {
meta.dataset.draw(ctx, area, start, count);
}
for (i = start; i < start + count; ++i) {
var element = elements[i];
if (element.hidden) {
continue;
}
if (element.active && drawActiveElementsOnTop) {
active.push(element);
} else {
element.draw(ctx, area);
}
}
for (i = 0; i < active.length; ++i) {
active[i].draw(ctx, area);
}
}
}, {
key: "getStyle",
value: function getStyle(index, active) {
var mode = active ? 'active' : 'default';
return index === undefined && this._cachedMeta.dataset ? this.resolveDatasetElementOptions(mode) : this.resolveDataElementOptions(index || 0, mode);
}
}, {
key: "getContext",
value: function getContext(index, active, mode) {
var dataset = this.getDataset();
var context;
if (index >= 0 && index < this._cachedMeta.data.length) {
var element = this._cachedMeta.data[index];
context = element.$context || (element.$context = createDataContext(this.getContext(), index, element));
context.parsed = this.getParsed(index);
context.raw = dataset.data[index];
context.index = context.dataIndex = index;
} else {
context = this.$context || (this.$context = createDatasetContext(this.chart.getContext(), this.index));
context.dataset = dataset;
context.index = context.datasetIndex = this.index;
}
context.active = !!active;
context.mode = mode;
return context;
}
}, {
key: "resolveDatasetElementOptions",
value: function resolveDatasetElementOptions(mode) {
return this._resolveElementOptions(this.datasetElementType.id, mode);
}
}, {
key: "resolveDataElementOptions",
value: function resolveDataElementOptions(index, mode) {
return this._resolveElementOptions(this.dataElementType.id, mode, index);
}
}, {
key: "_resolveElementOptions",
value: function _resolveElementOptions(elementType) {
var _this3 = this;
var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
var index = arguments.length > 2 ? arguments[2] : undefined;
var active = mode === 'active';
var cache = this._cachedDataOpts;
var cacheKey = elementType + '-' + mode;
var cached = cache[cacheKey];
var sharing = this.enableOptionSharing && defined(index);
if (cached) {
return cloneIfNotShared(cached, sharing);
}
var config = this.chart.config;
var scopeKeys = config.datasetElementScopeKeys(this._type, elementType);
var prefixes = active ? ["".concat(elementType, "Hover"), 'hover', elementType, ''] : [elementType, ''];
var scopes = config.getOptionScopes(this.getDataset(), scopeKeys);
var names = Object.keys(defaults.elements[elementType]);
var context = function context() {
return _this3.getContext(index, active, mode);
};
var values = config.resolveNamedOptions(scopes, names, context, prefixes);
if (values.$shared) {
values.$shared = sharing;
cache[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));
}
return values;
}
}, {
key: "_resolveAnimations",
value: function _resolveAnimations(index, transition, active) {
var chart = this.chart;
var cache = this._cachedDataOpts;
var cacheKey = "animation-".concat(transition);
var cached = cache[cacheKey];
if (cached) {
return cached;
}
var options;
if (chart.options.animation !== false) {
var config = this.chart.config;
var scopeKeys = config.datasetAnimationScopeKeys(this._type, transition);
var scopes = config.getOptionScopes(this.getDataset(), scopeKeys);
options = config.createResolver(scopes, this.getContext(index, active, transition));
}
var animations = new Animations(chart, options && options.animations);
if (options && options._cacheable) {
cache[cacheKey] = Object.freeze(animations);
}
return animations;
}
}, {
key: "getSharedOptions",
value: function getSharedOptions(options) {
if (!options.$shared) {
return;
}
return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));
}
}, {
key: "includeOptions",
value: function includeOptions(mode, sharedOptions) {
return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;
}
}, {
key: "_getSharedOptions",
value: function _getSharedOptions(start, mode) {
var firstOpts = this.resolveDataElementOptions(start, mode);
var previouslySharedOptions = this._sharedOptions;
var sharedOptions = this.getSharedOptions(firstOpts);
var includeOptions = this.includeOptions(mode, sharedOptions) || sharedOptions !== previouslySharedOptions;
this.updateSharedOptions(sharedOptions, mode, firstOpts);
return {
sharedOptions: sharedOptions,
includeOptions: includeOptions
};
}
}, {
key: "updateElement",
value: function updateElement(element, index, properties, mode) {
if (isDirectUpdateMode(mode)) {
Object.assign(element, properties);
} else {
this._resolveAnimations(index, mode).update(element, properties);
}
}
}, {
key: "updateSharedOptions",
value: function updateSharedOptions(sharedOptions, mode, newOptions) {
if (sharedOptions && !isDirectUpdateMode(mode)) {
this._resolveAnimations(undefined, mode).update(sharedOptions, newOptions);
}
}
}, {
key: "_setStyle",
value: function _setStyle(element, index, mode, active) {
element.active = active;
var options = this.getStyle(index, active);
this._resolveAnimations(index, mode, active).update(element, {
options: !active && this.getSharedOptions(options) || options
});
}
}, {
key: "removeHoverStyle",
value: function removeHoverStyle(element, datasetIndex, index) {
this._setStyle(element, index, 'active', false);
}
}, {
key: "setHoverStyle",
value: function setHoverStyle(element, datasetIndex, index) {
this._setStyle(element, index, 'active', true);
}
}, {
key: "_removeDatasetHoverStyle",
value: function _removeDatasetHoverStyle() {
var element = this._cachedMeta.dataset;
if (element) {
this._setStyle(element, undefined, 'active', false);
}
}
}, {
key: "_setDatasetHoverStyle",
value: function _setDatasetHoverStyle() {
var element = this._cachedMeta.dataset;
if (element) {
this._setStyle(element, undefined, 'active', true);
}
}
}, {
key: "_resyncElements",
value: function _resyncElements(resetNewElements) {
var data = this._data;
var elements = this._cachedMeta.data;
var _iterator3 = _createForOfIteratorHelper$1(this._syncList),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var _step3$value = _slicedToArray(_step3.value, 3),
method = _step3$value[0],
arg1 = _step3$value[1],
arg2 = _step3$value[2];
this[method](arg1, arg2);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
this._syncList = [];
var numMeta = elements.length;
var numData = data.length;
var count = Math.min(numData, numMeta);
if (count) {
this.parse(0, count);
}
if (numData > numMeta) {
this._insertElements(numMeta, numData - numMeta, resetNewElements);
} else if (numData < numMeta) {
this._removeElements(numData, numMeta - numData);
}
}
}, {
key: "_insertElements",
value: function _insertElements(start, count) {
var resetNewElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var meta = this._cachedMeta;
var data = meta.data;
var end = start + count;
var i;
var move = function move(arr) {
arr.length += count;
for (i = arr.length - 1; i >= end; i--) {
arr[i] = arr[i - count];
}
};
move(data);
for (i = start; i < end; ++i) {
data[i] = new this.dataElementType();
}
if (this._parsing) {
move(meta._parsed);
}
this.parse(start, count);
if (resetNewElements) {
this.updateElements(data, start, count, 'reset');
}
}
}, {
key: "updateElements",
value: function updateElements(element, start, count, mode) {}
}, {
key: "_removeElements",
value: function _removeElements(start, count) {
var meta = this._cachedMeta;
if (this._parsing) {
var removed = meta._parsed.splice(start, count);
if (meta._stacked) {
clearStacks(meta, removed);
}
}
meta.data.splice(start, count);
}
}, {
key: "_sync",
value: function _sync(args) {
if (this._parsing) {
this._syncList.push(args);
} else {
var _args2 = _slicedToArray(args, 3),
method = _args2[0],
arg1 = _args2[1],
arg2 = _args2[2];
this[method](arg1, arg2);
}
this.chart._dataChanges.push([this.index].concat(_toConsumableArray(args)));
}
}, {
key: "_onDataPush",
value: function _onDataPush() {
var count = arguments.length;
this._sync(['_insertElements', this.getDataset().data.length - count, count]);
}
}, {
key: "_onDataPop",
value: function _onDataPop() {
this._sync(['_removeElements', this._cachedMeta.data.length - 1, 1]);
}
}, {
key: "_onDataShift",
value: function _onDataShift() {
this._sync(['_removeElements', 0, 1]);
}
}, {
key: "_onDataSplice",
value: function _onDataSplice(start, count) {
if (count) {
this._sync(['_removeElements', start, count]);
}
var newCount = arguments.length - 2;
if (newCount) {
this._sync(['_insertElements', start, newCount]);
}
}
}, {
key: "_onDataUnshift",
value: function _onDataUnshift() {
this._sync(['_insertElements', 0, arguments.length]);
}
}]);
return DatasetController;
}();
_defineProperty$w(DatasetController, "defaults", {});
_defineProperty$w(DatasetController, "datasetElementType", null);
_defineProperty$w(DatasetController, "dataElementType", null);
function getAllScaleValues(scale, type) {
if (!scale._cache.$bar) {
var visibleMetas = scale.getMatchingVisibleMetas(type);
var values = [];
for (var i = 0, ilen = visibleMetas.length; i < ilen; i++) {
values = values.concat(visibleMetas[i].controller.getAllParsedValues(scale));
}
scale._cache.$bar = _arrayUnique(values.sort(function (a, b) {
return a - b;
}));
}
return scale._cache.$bar;
}
function computeMinSampleSize(meta) {
var scale = meta.iScale;
var values = getAllScaleValues(scale, meta.type);
var min = scale._length;
var i, ilen, curr, prev;
var updateMinAndPrev = function updateMinAndPrev() {
if (curr === 32767 || curr === -32768) {
return;
}
if (defined(prev)) {
min = Math.min(min, Math.abs(curr - prev) || min);
}
prev = curr;
};
for (i = 0, ilen = values.length; i < ilen; ++i) {
curr = scale.getPixelForValue(values[i]);
updateMinAndPrev();
}
prev = undefined;
for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {
curr = scale.getPixelForTick(i);
updateMinAndPrev();
}
return min;
}
function computeFitCategoryTraits(index, ruler, options, stackCount) {
var thickness = options.barThickness;
var size, ratio;
if (isNullOrUndef(thickness)) {
size = ruler.min * options.categoryPercentage;
ratio = options.barPercentage;
} else {
size = thickness * stackCount;
ratio = 1;
}
return {
chunk: size / stackCount,
ratio: ratio,
start: ruler.pixels[index] - size / 2
};
}
function computeFlexCategoryTraits(index, ruler, options, stackCount) {
var pixels = ruler.pixels;
var curr = pixels[index];
var prev = index > 0 ? pixels[index - 1] : null;
var next = index < pixels.length - 1 ? pixels[index + 1] : null;
var percent = options.categoryPercentage;
if (prev === null) {
prev = curr - (next === null ? ruler.end - ruler.start : next - curr);
}
if (next === null) {
next = curr + curr - prev;
}
var start = curr - (curr - Math.min(prev, next)) / 2 * percent;
var size = Math.abs(next - prev) / 2 * percent;
return {
chunk: size / stackCount,
ratio: options.barPercentage,
start: start
};
}
function parseFloatBar(entry, item, vScale, i) {
var startValue = vScale.parse(entry[0], i);
var endValue = vScale.parse(entry[1], i);
var min = Math.min(startValue, endValue);
var max = Math.max(startValue, endValue);
var barStart = min;
var barEnd = max;
if (Math.abs(min) > Math.abs(max)) {
barStart = max;
barEnd = min;
}
item[vScale.axis] = barEnd;
item._custom = {
barStart: barStart,
barEnd: barEnd,
start: startValue,
end: endValue,
min: min,
max: max
};
}
function parseValue(entry, item, vScale, i) {
if (isArray(entry)) {
parseFloatBar(entry, item, vScale, i);
} else {
item[vScale.axis] = vScale.parse(entry, i);
}
return item;
}
function parseArrayOrPrimitive(meta, data, start, count) {
var iScale = meta.iScale;
var vScale = meta.vScale;
var labels = iScale.getLabels();
var singleScale = iScale === vScale;
var parsed = [];
var i, ilen, item, entry;
for (i = start, ilen = start + count; i < ilen; ++i) {
entry = data[i];
item = {};
item[iScale.axis] = singleScale || iScale.parse(labels[i], i);
parsed.push(parseValue(entry, item, vScale, i));
}
return parsed;
}
function isFloatBar(custom) {
return custom && custom.barStart !== undefined && custom.barEnd !== undefined;
}
function barSign(size, vScale, actualBase) {
if (size !== 0) {
return sign(size);
}
return (vScale.isHorizontal() ? 1 : -1) * (vScale.min >= actualBase ? 1 : -1);
}
function borderProps(properties) {
var reverse, start, end, top, bottom;
if (properties.horizontal) {
reverse = properties.base > properties.x;
start = 'left';
end = 'right';
} else {
reverse = properties.base < properties.y;
start = 'bottom';
end = 'top';
}
if (reverse) {
top = 'end';
bottom = 'start';
} else {
top = 'start';
bottom = 'end';
}
return {
start: start,
end: end,
reverse: reverse,
top: top,
bottom: bottom
};
}
function setBorderSkipped(properties, options, stack, index) {
var edge = options.borderSkipped;
var res = {};
if (!edge) {
properties.borderSkipped = res;
return;
}
if (edge === true) {
properties.borderSkipped = {
top: true,
right: true,
bottom: true,
left: true
};
return;
}
var _borderProps = borderProps(properties),
start = _borderProps.start,
end = _borderProps.end,
reverse = _borderProps.reverse,
top = _borderProps.top,
bottom = _borderProps.bottom;
if (edge === 'middle' && stack) {
properties.enableBorderRadius = true;
if ((stack._top || 0) === index) {
edge = top;
} else if ((stack._bottom || 0) === index) {
edge = bottom;
} else {
res[parseEdge(bottom, start, end, reverse)] = true;
edge = top;
}
}
res[parseEdge(edge, start, end, reverse)] = true;
properties.borderSkipped = res;
}
function parseEdge(edge, a, b, reverse) {
if (reverse) {
edge = swap(edge, a, b);
edge = startEnd(edge, b, a);
} else {
edge = startEnd(edge, a, b);
}
return edge;
}
function swap(orig, v1, v2) {
return orig === v1 ? v2 : orig === v2 ? v1 : orig;
}
function startEnd(v, start, end) {
return v === 'start' ? start : v === 'end' ? end : v;
}
function setInflateAmount(properties, _ref, ratio) {
var inflateAmount = _ref.inflateAmount;
properties.inflateAmount = inflateAmount === 'auto' ? ratio === 1 ? 0.33 : 0 : inflateAmount;
}
var BarController = /*#__PURE__*/function (_DatasetController) {
_inherits$w(BarController, _DatasetController);
var _super = _createSuper$w(BarController);
function BarController() {
_classCallCheck$x(this, BarController);
return _super.apply(this, arguments);
}
_createClass$x(BarController, [{
key: "parsePrimitiveData",
value: function parsePrimitiveData(meta, data, start, count) {
return parseArrayOrPrimitive(meta, data, start, count);
}
}, {
key: "parseArrayData",
value: function parseArrayData(meta, data, start, count) {
return parseArrayOrPrimitive(meta, data, start, count);
}
}, {
key: "parseObjectData",
value: function parseObjectData(meta, data, start, count) {
var iScale = meta.iScale,
vScale = meta.vScale;
var _this$_parsing2 = this._parsing,
_this$_parsing2$xAxis = _this$_parsing2.xAxisKey,
xAxisKey = _this$_parsing2$xAxis === void 0 ? 'x' : _this$_parsing2$xAxis,
_this$_parsing2$yAxis = _this$_parsing2.yAxisKey,
yAxisKey = _this$_parsing2$yAxis === void 0 ? 'y' : _this$_parsing2$yAxis;
var iAxisKey = iScale.axis === 'x' ? xAxisKey : yAxisKey;
var vAxisKey = vScale.axis === 'x' ? xAxisKey : yAxisKey;
var parsed = [];
var i, ilen, item, obj;
for (i = start, ilen = start + count; i < ilen; ++i) {
obj = data[i];
item = {};
item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i);
parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i));
}
return parsed;
}
}, {
key: "updateRangeFromParsed",
value: function updateRangeFromParsed(range, scale, parsed, stack) {
_get(_getPrototypeOf$w(BarController.prototype), "updateRangeFromParsed", this).call(this, range, scale, parsed, stack);
var custom = parsed._custom;
if (custom && scale === this._cachedMeta.vScale) {
range.min = Math.min(range.min, custom.min);
range.max = Math.max(range.max, custom.max);
}
}
}, {
key: "getMaxOverflow",
value: function getMaxOverflow() {
return 0;
}
}, {
key: "getLabelAndValue",
value: function getLabelAndValue(index) {
var meta = this._cachedMeta;
var iScale = meta.iScale,
vScale = meta.vScale;
var parsed = this.getParsed(index);
var custom = parsed._custom;
var value = isFloatBar(custom) ? '[' + custom.start + ', ' + custom.end + ']' : '' + vScale.getLabelForValue(parsed[vScale.axis]);
return {
label: '' + iScale.getLabelForValue(parsed[iScale.axis]),
value: value
};
}
}, {
key: "initialize",
value: function initialize() {
this.enableOptionSharing = true;
_get(_getPrototypeOf$w(BarController.prototype), "initialize", this).call(this);
var meta = this._cachedMeta;
meta.stack = this.getDataset().stack;
}
}, {
key: "update",
value: function update(mode) {
var meta = this._cachedMeta;
this.updateElements(meta.data, 0, meta.data.length, mode);
}
}, {
key: "updateElements",
value: function updateElements(bars, start, count, mode) {
var reset = mode === 'reset';
var index = this.index,
vScale = this._cachedMeta.vScale;
var base = vScale.getBasePixel();
var horizontal = vScale.isHorizontal();
var ruler = this._getRuler();
var _this$_getSharedOptio = this._getSharedOptions(start, mode),
sharedOptions = _this$_getSharedOptio.sharedOptions,
includeOptions = _this$_getSharedOptio.includeOptions;
for (var i = start; i < start + count; i++) {
var parsed = this.getParsed(i);
var vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {
base: base,
head: base
} : this._calculateBarValuePixels(i);
var ipixels = this._calculateBarIndexPixels(i, ruler);
var stack = (parsed._stacks || {})[vScale.axis];
var properties = {
horizontal: horizontal,
base: vpixels.base,
enableBorderRadius: !stack || isFloatBar(parsed._custom) || index === stack._top || index === stack._bottom,
x: horizontal ? vpixels.head : ipixels.center,
y: horizontal ? ipixels.center : vpixels.head,
height: horizontal ? ipixels.size : Math.abs(vpixels.size),
width: horizontal ? Math.abs(vpixels.size) : ipixels.size
};
if (includeOptions) {
properties.options = sharedOptions || this.resolveDataElementOptions(i, bars[i].active ? 'active' : mode);
}
var options = properties.options || bars[i].options;
setBorderSkipped(properties, options, stack, index);
setInflateAmount(properties, options, ruler.ratio);
this.updateElement(bars[i], i, properties, mode);
}
}
}, {
key: "_getStacks",
value: function _getStacks(last, dataIndex) {
var iScale = this._cachedMeta.iScale;
var metasets = iScale.getMatchingVisibleMetas(this._type).filter(function (meta) {
return meta.controller.options.grouped;
});
var stacked = iScale.options.stacked;
var stacks = [];
var skipNull = function skipNull(meta) {
var parsed = meta.controller.getParsed(dataIndex);
var val = parsed && parsed[meta.vScale.axis];
if (isNullOrUndef(val) || isNaN(val)) {
return true;
}
};
var _iterator4 = _createForOfIteratorHelper$1(metasets),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var meta = _step4.value;
if (dataIndex !== undefined && skipNull(meta)) {
continue;
}
if (stacked === false || stacks.indexOf(meta.stack) === -1 || stacked === undefined && meta.stack === undefined) {
stacks.push(meta.stack);
}
if (meta.index === last) {
break;
}
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
if (!stacks.length) {
stacks.push(undefined);
}
return stacks;
}
}, {
key: "_getStackCount",
value: function _getStackCount(index) {
return this._getStacks(undefined, index).length;
}
}, {
key: "_getStackIndex",
value: function _getStackIndex(datasetIndex, name, dataIndex) {
var stacks = this._getStacks(datasetIndex, dataIndex);
var index = name !== undefined ? stacks.indexOf(name) : -1;
return index === -1 ? stacks.length - 1 : index;
}
}, {
key: "_getRuler",
value: function _getRuler() {
var opts = this.options;
var meta = this._cachedMeta;
var iScale = meta.iScale;
var pixels = [];
var i, ilen;
for (i = 0, ilen = meta.data.length; i < ilen; ++i) {
pixels.push(iScale.getPixelForValue(this.getParsed(i)[iScale.axis], i));
}
var barThickness = opts.barThickness;
var min = barThickness || computeMinSampleSize(meta);
return {
min: min,
pixels: pixels,
start: iScale._startPixel,
end: iScale._endPixel,
stackCount: this._getStackCount(),
scale: iScale,
grouped: opts.grouped,
ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage
};
}
}, {
key: "_calculateBarValuePixels",
value: function _calculateBarValuePixels(index) {
var _this$_cachedMeta = this._cachedMeta,
vScale = _this$_cachedMeta.vScale,
_stacked = _this$_cachedMeta._stacked,
datasetIndex = _this$_cachedMeta.index,
_this$options = this.options,
baseValue = _this$options.base,
minBarLength = _this$options.minBarLength;
var actualBase = baseValue || 0;
var parsed = this.getParsed(index);
var custom = parsed._custom;
var floating = isFloatBar(custom);
var value = parsed[vScale.axis];
gitextract_se7u5gh2/
├── .gitattributes
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── config.yml
│ │ └── issue.md
│ └── workflows/
│ └── build.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── app/
│ ├── assets/
│ │ ├── javascripts/
│ │ │ └── pghero/
│ │ │ ├── Chart.bundle.js
│ │ │ ├── application.js
│ │ │ ├── chartkick.js
│ │ │ ├── jquery.js
│ │ │ └── nouislider.js
│ │ └── stylesheets/
│ │ └── pghero/
│ │ ├── application.css
│ │ ├── arduino-light.css
│ │ └── nouislider.css
│ ├── controllers/
│ │ └── pg_hero/
│ │ └── home_controller.rb
│ ├── helpers/
│ │ └── pg_hero/
│ │ └── home_helper.rb
│ └── views/
│ ├── layouts/
│ │ └── pg_hero/
│ │ └── application.html.erb
│ └── pg_hero/
│ └── home/
│ ├── _connections_table.html.erb
│ ├── _live_queries_table.html.erb
│ ├── _queries_table.html.erb
│ ├── _query_stats_slider.html.erb
│ ├── _suggested_index.html.erb
│ ├── connections.html.erb
│ ├── explain.html.erb
│ ├── index.html.erb
│ ├── index_bloat.html.erb
│ ├── live_queries.html.erb
│ ├── maintenance.html.erb
│ ├── queries.html.erb
│ ├── relation_space.html.erb
│ ├── show_query.html.erb
│ ├── space.html.erb
│ ├── system.html.erb
│ └── tune.html.erb
├── config/
│ └── routes.rb
├── gemfiles/
│ ├── activerecord71.gemfile
│ ├── activerecord72.gemfile
│ └── activerecord80.gemfile
├── guides/
│ ├── Contributing.md
│ ├── Docker.md
│ ├── Linux.md
│ ├── Permissions.md
│ ├── Query-Stats.md
│ ├── Rails.md
│ └── Suggested-Indexes.md
├── lib/
│ ├── generators/
│ │ └── pghero/
│ │ ├── config_generator.rb
│ │ ├── query_stats_generator.rb
│ │ ├── space_stats_generator.rb
│ │ └── templates/
│ │ ├── config.yml.tt
│ │ ├── query_stats.rb.tt
│ │ └── space_stats.rb.tt
│ ├── pghero/
│ │ ├── connection.rb
│ │ ├── database.rb
│ │ ├── engine.rb
│ │ ├── methods/
│ │ │ ├── basic.rb
│ │ │ ├── connections.rb
│ │ │ ├── constraints.rb
│ │ │ ├── explain.rb
│ │ │ ├── indexes.rb
│ │ │ ├── kill.rb
│ │ │ ├── maintenance.rb
│ │ │ ├── queries.rb
│ │ │ ├── query_stats.rb
│ │ │ ├── replication.rb
│ │ │ ├── sequences.rb
│ │ │ ├── settings.rb
│ │ │ ├── space.rb
│ │ │ ├── suggested_indexes.rb
│ │ │ ├── system.rb
│ │ │ ├── tables.rb
│ │ │ └── users.rb
│ │ ├── query_stats.rb
│ │ ├── space_stats.rb
│ │ ├── stats.rb
│ │ └── version.rb
│ ├── pghero.rb
│ └── tasks/
│ └── pghero.rake
├── licenses/
│ ├── LICENSE-chart.js.txt
│ ├── LICENSE-chartjs-adapter-date-fns.txt
│ ├── LICENSE-chartkick.js.txt
│ ├── LICENSE-date-fns.txt
│ ├── LICENSE-highlight.js.txt
│ ├── LICENSE-jquery.txt
│ ├── LICENSE-kurkle-color.txt
│ └── LICENSE-nouislider.txt
├── pghero.gemspec
└── test/
├── basic_test.rb
├── best_index_test.rb
├── config_generator_test.rb
├── connections_test.rb
├── constraints_test.rb
├── controller_test.rb
├── database_test.rb
├── explain_test.rb
├── indexes_test.rb
├── internal/
│ ├── app/
│ │ └── assets/
│ │ └── config/
│ │ └── manifest.js
│ ├── config/
│ │ ├── database.yml
│ │ └── routes.rb
│ └── db/
│ └── schema.rb
├── kill_test.rb
├── maintenance_test.rb
├── module_test.rb
├── queries_test.rb
├── query_stats_generator_test.rb
├── query_stats_test.rb
├── replication_test.rb
├── sequences_test.rb
├── settings_test.rb
├── space_stats_generator_test.rb
├── space_test.rb
├── suggested_indexes_test.rb
├── system_test.rb
├── tables_test.rb
├── test_helper.rb
└── users_test.rb
SYMBOL INDEX (1766 symbols across 60 files)
FILE: app/assets/javascripts/pghero/Chart.bundle.js
function _iterableToArrayLimit (line 29) | function _iterableToArrayLimit(arr, i) {
function ownKeys (line 56) | function ownKeys(object, enumerableOnly) {
function _objectSpread2 (line 66) | function _objectSpread2(target) {
function _typeof$z (line 77) | function _typeof$z(obj) {
function _classCallCheck$x (line 86) | function _classCallCheck$x(instance, Constructor) {
function _defineProperties$x (line 91) | function _defineProperties$x(target, props) {
function _createClass$x (line 100) | function _createClass$x(Constructor, protoProps, staticProps) {
function _defineProperty$w (line 108) | function _defineProperty$w(obj, key, value) {
function _inherits$w (line 122) | function _inherits$w(subClass, superClass) {
function _getPrototypeOf$w (line 138) | function _getPrototypeOf$w(o) {
function _setPrototypeOf$w (line 144) | function _setPrototypeOf$w(o, p) {
function _isNativeReflectConstruct$w (line 151) | function _isNativeReflectConstruct$w() {
function _assertThisInitialized$w (line 162) | function _assertThisInitialized$w(self) {
function _possibleConstructorReturn$w (line 168) | function _possibleConstructorReturn$w(self, call) {
function _createSuper$w (line 176) | function _createSuper$w(Derived) {
function _superPropBase (line 190) | function _superPropBase(object, property) {
function _get (line 197) | function _get() {
function _slicedToArray (line 213) | function _slicedToArray(arr, i) {
function _toConsumableArray (line 216) | function _toConsumableArray(arr) {
function _arrayWithoutHoles (line 219) | function _arrayWithoutHoles(arr) {
function _arrayWithHoles (line 222) | function _arrayWithHoles(arr) {
function _iterableToArray (line 225) | function _iterableToArray(iter) {
function _unsupportedIterableToArray$1 (line 228) | function _unsupportedIterableToArray$1(o, minLen) {
function _arrayLikeToArray$1 (line 236) | function _arrayLikeToArray$1(arr, len) {
function _nonIterableSpread (line 241) | function _nonIterableSpread() {
function _nonIterableRest (line 244) | function _nonIterableRest() {
function _createForOfIteratorHelper$1 (line 247) | function _createForOfIteratorHelper$1(o, allowArrayLike) {
function _toPrimitive (line 298) | function _toPrimitive(input, hint) {
function _toPropertyKey (line 308) | function _toPropertyKey(arg) {
function round (line 319) | function round(v) {
function p2b (line 325) | function p2b(v) {
function n2b (line 328) | function n2b(v) {
function b2n (line 331) | function b2n(v) {
function n2p (line 334) | function n2p(v) {
function hexParse (line 374) | function hexParse(str) {
function _hexString (line 399) | function _hexString(v) {
function hsl2rgbn (line 404) | function hsl2rgbn(h, s, l) {
function hsv2rgbn (line 412) | function hsv2rgbn(h, s, v) {
function hwb2rgbn (line 419) | function hwb2rgbn(h, w, b) {
function hueValue (line 433) | function hueValue(r, g, b, d, max) {
function rgb2hsl (line 442) | function rgb2hsl(v) {
function calln (line 459) | function calln(f, a, b, c) {
function hsl2rgb (line 462) | function hsl2rgb(h, s, l) {
function hwb2rgb (line 465) | function hwb2rgb(h, w, b) {
function hsv2rgb (line 468) | function hsv2rgb(h, s, v) {
function hue (line 471) | function hue(h) {
function hueParse (line 474) | function hueParse(str) {
function _rotate (line 501) | function _rotate(v, deg) {
function _hslString (line 509) | function _hslString(v) {
function unpack (line 698) | function unpack() {
function nameParse (line 715) | function nameParse(str) {
function rgbParse (line 729) | function rgbParse(str) {
function _rgbString (line 753) | function _rgbString(v) {
function _interpolate (line 762) | function _interpolate(rgb1, rgb2, t) {
function modHSL (line 773) | function modHSL(v, i, ratio) {
function clone$1 (line 783) | function clone$1(v, proto) {
function fromObject (line 786) | function fromObject(input) {
function functionParse (line 816) | function functionParse(str) {
function Color (line 823) | function Color(input) {
function noop (line 979) | function noop() {
function isNullOrUndef (line 995) | function isNullOrUndef(value) {
function isArray (line 1003) | function isArray(value) {
function isObject (line 1018) | function isObject(value) {
function isNumberFinite (line 1025) | function isNumberFinite(value) {
function finiteOrDefault (line 1033) | function finiteOrDefault(value, defaultValue) {
function valueOrDefault (line 1041) | function valueOrDefault(value, defaultValue) {
function callback (line 1057) | function callback(fn, args, thisArg) {
function each (line 1062) | function each(loopable, fn, thisArg, reverse) {
function _elementsEqual (line 1089) | function _elementsEqual(a0, a1) {
function clone (line 1107) | function clone(source) {
function isValidKey (line 1123) | function isValidKey(key) {
function _merger (line 1131) | function _merger(key, target, source, options) {
function merge (line 1144) | function merge(target, source, options) {
function mergeIf (line 1165) | function mergeIf(target, source) {
function _mergerIf (line 1175) | function _mergerIf(key, target, source) {
function _deprecated (line 1190) | function _deprecated(scope, value, previous, current) {
function _splitKey (line 1212) | function _splitKey(key) {
function _getKeyResolver (line 1236) | function _getKeyResolver(key) {
function resolveObjectKey (line 1257) | function resolveObjectKey(obj, key) {
function _capitalize (line 1264) | function _capitalize(str) {
function _isClickEvent (line 1298) | function _isClickEvent(e) {
function almostEquals (line 1316) | function almostEquals(x, y, epsilon) {
function niceNum (line 1322) | function niceNum(range) {
function _factorize (line 1334) | function _factorize(value) {
function isNumber (line 1352) | function isNumber(n) {
function almostWhole (line 1355) | function almostWhole(x, epsilon) {
function _setMinAndMaxByKey (line 1362) | function _setMinAndMaxByKey(array, target, property) {
function toRadians (line 1372) | function toRadians(degrees) {
function toDegrees (line 1375) | function toDegrees(radians) {
function _decimalPlaces (line 1385) | function _decimalPlaces(x) {
function getAngleFromPoint (line 1398) | function getAngleFromPoint(centrePoint, anglePoint) {
function distanceBetweenPoints (line 1412) | function distanceBetweenPoints(pt1, pt2) {
function _angleDiff (line 1419) | function _angleDiff(a, b) {
function _normalizeAngle (line 1426) | function _normalizeAngle(a) {
function _angleBetween (line 1432) | function _angleBetween(angle, start, end, sameAngleIsFullCircle) {
function _limitValue (line 1449) | function _limitValue(value, min, max) {
function _int16Range (line 1456) | function _int16Range(value) {
function _isBetween (line 1466) | function _isBetween(value, start, end) {
function _lookup (line 1470) | function _lookup(table, value, cmp) {
function _filterBetween (line 1525) | function _filterBetween(values, min, max) {
function listenArrayEvents (line 1537) | function listenArrayEvents(array, listener) {
function unlistenArrayEvents (line 1570) | function unlistenArrayEvents(array, listener) {
function _arrayUnique (line 1591) | function _arrayUnique(items) {
function fontString (line 1602) | function fontString(pixelSize, fontStyle, fontFamily) {
function throttled (line 1620) | function throttled(fn, thisArg) {
function debounce (line 1641) | function debounce(fn, delay) {
function _getStartAndCountOfVisiblePoints (line 1682) | function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabl...
function _scaleRangesChanged (line 1723) | function _scaleRangesChanged(meta) {
function isPatternOrGradient (line 1869) | function isPatternOrGradient(value) {
function color (line 1876) | function color(value) {
function getHoverColor (line 1879) | function getHoverColor(value) {
function applyAnimationsDefaults (line 1884) | function applyAnimationsDefaults(defaults) {
function applyLayoutsDefaults (line 1953) | function applyLayoutsDefaults(defaults) {
function getNumberFormat (line 1965) | function getNumberFormat(locale, options) {
function formatNumber (line 1975) | function formatNumber(num, locale, options) {
function calculateDelta (line 2017) | function calculateDelta(tickValue, ticks) {
function applyScaleDefaults (line 2027) | function applyScaleDefaults(defaults) {
function getScope$1 (line 2111) | function getScope$1(node, key) {
function _set (line 2122) | function _set(root, scope, values) {
function Defaults (line 2129) | function Defaults(_descriptors, _appliers) {
function toFontString (line 2248) | function toFontString(font) {
function _measureText (line 2254) | function _measureText(ctx, data, gc, longest, string) {
function _longestText (line 2265) | function _longestText(ctx, font, arrayOfThings, cache) {
function _alignPixel (line 2302) | function _alignPixel(chart, pixel, width) {
function clearCanvas (line 2307) | function clearCanvas(canvas, ctx) {
function drawPoint (line 2314) | function drawPoint(ctx, options, x, y) {
function drawPointLegend (line 2317) | function drawPointLegend(ctx, options, x, y, w) {
function _isPointInArea (line 2438) | function _isPointInArea(point, area, margin) {
function clipArea (line 2442) | function clipArea(ctx, area) {
function unclipArea (line 2448) | function unclipArea(ctx) {
function _steppedLineTo (line 2451) | function _steppedLineTo(ctx, previous, target, flip, mode) {
function _bezierCurveTo (line 2466) | function _bezierCurveTo(ctx, previous, target, flip) {
function renderText (line 2472) | function renderText(ctx, text, x, y, font) {
function setRenderOpts (line 2500) | function setRenderOpts(ctx, opts) {
function decorateText (line 2517) | function decorateText(ctx, x, y, line, opts) {
function drawBackdrop (line 2533) | function drawBackdrop(ctx, opts) {
function addRoundedRectPath (line 2539) | function addRoundedRectPath(ctx, rect) {
function toLineHeight (line 2567) | function toLineHeight(value, size) {
function _readValueToProps (line 2585) | function _readValueToProps(value, props) {
function toTRBL (line 2618) | function toTRBL(value) {
function toTRBLCorners (line 2633) | function toTRBLCorners(value) {
function toPadding (line 2644) | function toPadding(value) {
function toFont (line 2657) | function toFont(options, fallback) {
function resolve (line 2691) | function resolve(inputs, context, index, info) {
function _addGrace (line 2721) | function _addGrace(minmax, grace, beginAtZero) {
function createContext (line 2733) | function createContext(parentContext, context) {
function _createResolver (line 2736) | function _createResolver(scopes) {
function _attachContext (line 2782) | function _attachContext(proxy, context, subProxy, descriptorDefaults) {
function _descriptors (line 2830) | function _descriptors(proxy) {
function _cached (line 2859) | function _cached(target, prop, resolve) {
function _resolveWithContext (line 2867) | function _resolveWithContext(target, prop, receiver) {
function _resolveScriptable (line 2884) | function _resolveScriptable(prop, value, target, receiver) {
function _resolveArray (line 2900) | function _resolveArray(prop, value, target, isIndexable) {
function resolveFallback (line 2929) | function resolveFallback(fallback, prop, value) {
function addScopes (line 2935) | function addScopes(set, parentScopes, key, parentFallback, value) {
function createSubResolver (line 2959) | function createSubResolver(parentScopes, resolver, prop, value) {
function addScopesFromKey (line 2979) | function addScopesFromKey(set, allScopes, key, fallback, item) {
function subGetTarget (line 2985) | function subGetTarget(resolver, prop, value) {
function _resolveWithPrefixes (line 2996) | function _resolveWithPrefixes(prop, prefixes, scopes, proxy) {
function _resolve (line 3014) | function _resolve(key, scopes) {
function getKeysFromAllScopes (line 3034) | function getKeysFromAllScopes(target) {
function resolveKeysFromAllScopes (line 3041) | function resolveKeysFromAllScopes(scopes) {
function _parseObjectDataRadialScale (line 3070) | function _parseObjectDataRadialScale(meta, data, start, count) {
function splineCurve (line 3092) | function splineCurve(firstPoint, middlePoint, afterPoint, t) {
function monotoneAdjust (line 3122) | function monotoneAdjust(points, deltaK, mK) {
function monotoneCompute (line 3147) | function monotoneCompute(points, mK) {
function splineCurveMonotone (line 3180) | function splineCurveMonotone(points) {
function capControlPoint (line 3206) | function capControlPoint(pt, min, max) {
function capBezierPoints (line 3209) | function capBezierPoints(points, area) {
function _updateBezierControlPoints (line 3233) | function _updateBezierControlPoints(points, options, area, loop, indexAx...
function _isDomSupported (line 3269) | function _isDomSupported() {
function _getParentNode (line 3275) | function _getParentNode(domNode) {
function parseMaxStyle (line 3286) | function parseMaxStyle(styleValue, node, parentProperty) {
function getStyle (line 3302) | function getStyle(el, property) {
function getPositionedStyle (line 3306) | function getPositionedStyle(styles, style, suffix) {
function getCanvasPosition (line 3325) | function getCanvasPosition(e, canvas) {
function getRelativePosition (line 3353) | function getRelativePosition(event, chart) {
function getContainerSize (line 3380) | function getContainerSize(canvas, width, height) {
function getMaximumSize (line 3409) | function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio) {
function retinaScale (line 3448) | function retinaScale(chart, forceRatio, forceStyle) {
method passive (line 3480) | get passive() {
function readUsedSize (line 3501) | function readUsedSize(element, property) {
function _pointInLine (line 3510) | function _pointInLine(p1, p2, t, mode) {
function _steppedInterpolation (line 3519) | function _steppedInterpolation(p1, p2, t, mode) {
function _bezierInterpolation (line 3528) | function _bezierInterpolation(p1, p2, t, mode) {
function getRtlAdapter (line 3583) | function getRtlAdapter(rtl, rectX, width) {
function overrideTextDirection (line 3586) | function overrideTextDirection(ctx, direction) {
function restoreTextDirection (line 3595) | function restoreTextDirection(ctx, original) {
function propertyFn (line 3601) | function propertyFn(property) {
function normalizeSegment (line 3619) | function normalizeSegment(_ref) {
function getSegment (line 3632) | function getSegment(segment, points, bounds) {
function _boundSegment (line 3667) | function _boundSegment(segment, points, bounds) {
function _boundSegments (line 3737) | function _boundSegments(line, bounds) {
function findStartAndEnd (line 3748) | function findStartAndEnd(points, count, loop, spanGaps) {
function solidSegments (line 3772) | function solidSegments(points, start, max, loop) {
function _computeSegments (line 3807) | function _computeSegments(line, segmentOptions) {
function splitByStyles (line 3829) | function splitByStyles(line, segments, points, segmentOptions) {
function doSplitByStyles (line 3835) | function doSplitByStyles(line, segments, points, segmentOptions) {
function readStyle (line 3903) | function readStyle(options) {
function styleChanged (line 3914) | function styleChanged(style, prevStyle) {
function Animator (line 3919) | function Animator() {
function Animation (line 4102) | function Animation(cfg, target, prop, to) {
function Animations (line 4198) | function Animations(chart, config) {
function awaitAll (line 4299) | function awaitAll(animations, properties) {
function resolveTargetOptions (line 4310) | function resolveTargetOptions(target, newOptions) {
function scaleClip (line 4327) | function scaleClip(scale, allowedOverflow) {
function defaultClip (line 4337) | function defaultClip(xScale, yScale, allowedOverflow) {
function toClip (line 4350) | function toClip(value) {
function getSortedDatasetIndices (line 4368) | function getSortedDatasetIndices(chart, filterVisible) {
function _applyStack (line 4377) | function _applyStack(stack, value, dsIndex) {
function convertObjectDataToArray (line 4400) | function convertObjectDataToArray(data) {
function isStacked (line 4413) | function isStacked(scale, meta) {
function getStackKey (line 4417) | function getStackKey(indexScale, valueScale, meta) {
function getUserBounds (line 4420) | function getUserBounds(scale) {
function getOrCreateStack (line 4431) | function getOrCreateStack(stacks, stackKey, indexValue) {
function getLastIndexInStack (line 4435) | function getLastIndexInStack(stack, vScale, positive, type) {
function updateStacks (line 4453) | function updateStacks(controller, parsed) {
function getFirstScaleId (line 4478) | function getFirstScaleId(chart, axis) {
function createDatasetContext (line 4484) | function createDatasetContext(parent, index) {
function createDataContext (line 4494) | function createDataContext(parent, index, element) {
function clearStacks (line 4506) | function clearStacks(meta, items) {
function DatasetController (line 4546) | function DatasetController(chart, datasetIndex) {
function _skip (line 4859) | function _skip() {
function getAllScaleValues (line 5247) | function getAllScaleValues(scale, type) {
function computeMinSampleSize (line 5260) | function computeMinSampleSize(meta) {
function computeFitCategoryTraits (line 5285) | function computeFitCategoryTraits(index, ruler, options, stackCount) {
function computeFlexCategoryTraits (line 5301) | function computeFlexCategoryTraits(index, ruler, options, stackCount) {
function parseFloatBar (line 5321) | function parseFloatBar(entry, item, vScale, i) {
function parseValue (line 5342) | function parseValue(entry, item, vScale, i) {
function parseArrayOrPrimitive (line 5350) | function parseArrayOrPrimitive(meta, data, start, count) {
function isFloatBar (line 5365) | function isFloatBar(custom) {
function barSign (line 5368) | function barSign(size, vScale, actualBase) {
function borderProps (line 5374) | function borderProps(properties) {
function setBorderSkipped (line 5400) | function setBorderSkipped(properties, options, stack, index) {
function parseEdge (line 5436) | function parseEdge(edge, a, b, reverse) {
function swap (line 5445) | function swap(orig, v1, v2) {
function startEnd (line 5448) | function startEnd(v, start, end) {
function setInflateAmount (line 5451) | function setInflateAmount(properties, _ref, ratio) {
function BarController (line 5458) | function BarController() {
function BubbleController (line 5791) | function BubbleController() {
function getRatioAndOffset (line 5931) | function getRatioAndOffset(rotation, circumference, cutout) {
function DoughnutController (line 5968) | function DoughnutController(chart, datasetIndex) {
function LineController (line 6283) | function LineController() {
function PolarAreaController (line 6419) | function PolarAreaController(chart, datasetIndex) {
function PieController (line 6621) | function PieController() {
function RadarController (line 6637) | function RadarController() {
function ScatterController (line 6725) | function ScatterController() {
function _abstract (line 6889) | function _abstract() {
function DateAdapterBase (line 6899) | function DateAdapterBase(options) {
function binarySearch (line 6964) | function binarySearch(metaset, axis, value, intersect) {
function evaluateInteractionItems (line 6991) | function evaluateInteractionItems(chart, axis, position, handler, inters...
function getDistanceMetricForAxis (line 7009) | function getDistanceMetricForAxis(axis) {
function getIntersectItems (line 7018) | function getIntersectItems(chart, position, axis, useFinalPosition, incl...
function getNearestRadialItems (line 7038) | function getNearestRadialItems(chart, position, axis, useFinalPosition) {
function getNearestCartesianItems (line 7060) | function getNearestCartesianItems(chart, position, axis, intersect, useF...
function getNearestItems (line 7093) | function getNearestItems(chart, position, axis, intersect, useFinalPosit...
function getAxisItems (line 7099) | function getAxisItems(chart, position, axis, intersect, useFinalPosition) {
function filterByPosition (line 7185) | function filterByPosition(array, position) {
function filterDynamicPositionByAxis (line 7190) | function filterDynamicPositionByAxis(array, axis) {
function sortByWeight (line 7195) | function sortByWeight(array, reverse) {
function wrapBoxes (line 7202) | function wrapBoxes(boxes) {
function buildStacks (line 7225) | function buildStacks(layouts) {
function setLayoutDims (line 7254) | function setLayoutDims(layouts, params) {
function buildLayoutBoxes (line 7274) | function buildLayoutBoxes(boxes) {
function getCombinedMax (line 7294) | function getCombinedMax(maxPadding, chartArea, a, b) {
function updateMaxPadding (line 7297) | function updateMaxPadding(maxPadding, boxPadding) {
function updateDims (line 7303) | function updateDims(chartArea, params, layout, stacks) {
function handleMaxPadding (line 7336) | function handleMaxPadding(chartArea) {
function getMargins (line 7348) | function getMargins(horizontal, chartArea) {
function fitBoxes (line 7364) | function fitBoxes(boxes, chartArea, params, stacks) {
function setBoxDims (line 7382) | function setBoxDims(box, left, top, width, height) {
function placeBoxes (line 7390) | function placeBoxes(boxes, chartArea, params, stacks) {
function BasePlatform (line 7541) | function BasePlatform() {
function BasicPlatform (line 7587) | function BasicPlatform() {
function initCanvas (line 7619) | function initCanvas(canvas, aspectRatio) {
function addListener (line 7657) | function addListener(node, type, listener) {
function removeListener (line 7660) | function removeListener(chart, type, listener) {
function fromNativeEvent (line 7663) | function fromNativeEvent(event, chart) {
function nodeListContains (line 7676) | function nodeListContains(nodeList, canvas) {
function createAttachObserver (line 7692) | function createAttachObserver(chart, type, listener) {
function createDetachObserver (line 7719) | function createDetachObserver(chart, type, listener) {
function onWindowResize (line 7748) | function onWindowResize() {
function listenDevicePixelRatioChanges (line 7760) | function listenDevicePixelRatioChanges(chart, resize) {
function unlistenDevicePixelRatioChanges (line 7766) | function unlistenDevicePixelRatioChanges(chart) {
function createResizeObserver (line 7772) | function createResizeObserver(chart, type, listener) {
function releaseObserver (line 7798) | function releaseObserver(chart, type, observer) {
function createProxyAndListen (line 7806) | function createProxyAndListen(chart, type, listener) {
function DomPlatform (line 7819) | function DomPlatform() {
function _detectPlatform (line 7906) | function _detectPlatform(canvas) {
function Element (line 7913) | function Element() {
function autoSkip (line 7953) | function autoSkip(scale, ticks) {
function determineMaxTicks (line 7980) | function determineMaxTicks(scale) {
function calculateSpacing (line 7987) | function calculateSpacing(majorIndices, ticks, ticksLimit) {
function getMajorIndices (line 8002) | function getMajorIndices(ticks) {
function skipMajors (line 8012) | function skipMajors(ticks, newTicks, majorIndices, spacing) {
function skip (line 8025) | function skip(ticks, newTicks, spacing, majorStart, majorEnd) {
function getEvenSpacing (line 8048) | function getEvenSpacing(arr) {
function sample (line 8067) | function sample(arr, numItems) {
function getPixelForGridLine (line 8077) | function getPixelForGridLine(scale, index, offsetGridLines) {
function garbageCollect (line 8100) | function garbageCollect(caches, length) {
function getTickMarkLength (line 8113) | function getTickMarkLength(options) {
function getTitleHeight (line 8116) | function getTitleHeight(options, fallback) {
function createScaleContext (line 8125) | function createScaleContext(parent, scale) {
function createTickContext (line 8131) | function createTickContext(parent, index, tick) {
function titleAlign (line 8138) | function titleAlign(align, position, reverse) {
function titleArgs (line 8145) | function titleArgs(scale, offset, position, align) {
function Scale (line 8192) | function Scale(cfg) {
function TypedRegistry (line 9507) | function TypedRegistry(type, scope, override) {
function registerDefaults (line 9567) | function registerDefaults(item, scope, parentScope) {
function routeDefaults (line 9577) | function routeDefaults(scope, routes) {
function isIChartComponent (line 9588) | function isIChartComponent(proto) {
function Registry (line 9592) | function Registry() {
function PluginService (line 9749) | function PluginService() {
function allPlugins (line 9835) | function allPlugins(config) {
function getOpts (line 9855) | function getOpts(options, all) {
function createDescriptors (line 9864) | function createDescriptors(chart, _ref2, options, all) {
function pluginOpts (line 9894) | function pluginOpts(config, _ref3, opts, context) {
function getIndexAxis (line 9908) | function getIndexAxis(type, options) {
function getAxisFromDefaultScaleID (line 9913) | function getAxisFromDefaultScaleID(id, indexAxis) {
function getDefaultScaleIDFromAxis (line 9922) | function getDefaultScaleIDFromAxis(axis, indexAxis) {
function axisFromPosition (line 9925) | function axisFromPosition(position) {
function determineAxis (line 9933) | function determineAxis(id, scaleOptions) {
function mergeScaleConfig (line 9943) | function mergeScaleConfig(config, options) {
function initOptions (line 9985) | function initOptions(config) {
function initData (line 9990) | function initData(data) {
function initConfig (line 9996) | function initConfig(config) {
function cachedKeys (line 10004) | function cachedKeys(cacheKey, generate) {
function Config (line 10020) | function Config(config) {
function getResolver (line 10206) | function getResolver(resolverCache, scopes, prefixes) {
function needContext (line 10231) | function needContext(proxy, names) {
function positionIsHorizontal (line 10256) | function positionIsHorizontal(position, axis) {
function compare2Level (line 10259) | function compare2Level(l1, l2) {
function onAnimationsComplete (line 10264) | function onAnimationsComplete(context) {
function onAnimationProgress (line 10270) | function onAnimationProgress(context) {
function getCanvas (line 10275) | function getCanvas(item) {
function moveNumericKeys (line 10293) | function moveNumericKeys(obj, start, move) {
function determineLastEvent (line 10307) | function determineLastEvent(e, lastEvent, inChartArea, isClick) {
function getDatasetArea (line 10316) | function getDatasetArea(meta) {
function Chart (line 10329) | function Chart(item, userConfig) {
function invalidatePlugins (line 11343) | function invalidatePlugins() {
function clipArc (line 11348) | function clipArc(ctx, element, endAngle) {
function toRadiusCorners (line 11369) | function toRadiusCorners(value) {
function parseBorderRadius$1 (line 11375) | function parseBorderRadius$1(arc, innerRadius, outerRadius, angleDelta) {
function rThetaToXY (line 11400) | function rThetaToXY(r, theta, x, y) {
function pathArc (line 11420) | function pathArc(ctx, element, offset, spacing, end, circular) {
function drawArc (line 11504) | function drawArc(ctx, element, offset, spacing, circular) {
function drawBorder (line 11522) | function drawBorder(ctx, element, offset, spacing, circular) {
function ArcElement (line 11561) | function ArcElement(cfg) {
function setStyle (line 11667) | function setStyle(ctx, options) {
function lineTo (line 11676) | function lineTo(ctx, previous, target) {
function getLineMethod (line 11679) | function getLineMethod(options) {
function pathVars (line 11688) | function pathVars(points, segment) {
function pathSegment (line 11707) | function pathSegment(ctx, line, segment, params) {
function fastPathSegment (line 11739) | function fastPathSegment(ctx, line, segment, params) {
function _getSegmentMethod (line 11792) | function _getSegmentMethod(line) {
function _getInterpolationMethod (line 11798) | function _getInterpolationMethod(options) {
function strokePathWithCache (line 11807) | function strokePathWithCache(ctx, line, start, count) {
function strokePathDirect (line 11818) | function strokePathDirect(ctx, line, start, count) {
function _draw (line 11844) | function _draw(ctx, line, start, count) {
function LineElement (line 11854) | function LineElement(cfg) {
function inRange$1 (line 12022) | function inRange$1(el, pos, axis, useFinalPosition) {
function PointElement (line 12039) | function PointElement(cfg) {
function getBarBounds (line 12127) | function getBarBounds(bar, useFinalPosition) {
function skipOrLimit (line 12155) | function skipOrLimit(skip, value, min, max) {
function parseBorderWidth (line 12158) | function parseBorderWidth(bar, maxW, maxH) {
function parseBorderRadius (line 12169) | function parseBorderRadius(bar, maxW, maxH) {
function boundingRects (line 12184) | function boundingRects(bar) {
function _inRange (line 12212) | function _inRange(bar, x, y, useFinalPosition) {
function hasRadius (line 12219) | function hasRadius(radius) {
function addNormalRectPath (line 12222) | function addNormalRectPath(ctx, rect) {
function inflateRect (line 12225) | function inflateRect(rect, amount) {
function BarElement (line 12242) | function BarElement(cfg) {
function getBorderColor (line 12344) | function getBorderColor(i) {
function getBackgroundColor (line 12347) | function getBackgroundColor(i) {
function colorizeDefaultDataset (line 12350) | function colorizeDefaultDataset(dataset, i) {
function colorizeDoughnutDataset (line 12355) | function colorizeDoughnutDataset(dataset, i) {
function colorizePolarAreaDataset (line 12361) | function colorizePolarAreaDataset(dataset, i) {
function getColorizer (line 12367) | function getColorizer(chart) {
function containsColorsDefinitions (line 12380) | function containsColorsDefinitions(descriptors) {
function containsColorsDefinition (line 12389) | function containsColorsDefinition(descriptor) {
function lttbDecimation (line 12413) | function lttbDecimation(data, start, count, availableWidth, options) {
function minMaxDecimation (line 12458) | function minMaxDecimation(data, start, count, availableWidth) {
function cleanDecimatedDataset (line 12509) | function cleanDecimatedDataset(dataset) {
function cleanDecimatedData (line 12519) | function cleanDecimatedData(chart) {
function getStartAndCountOfVisiblePointsSimplified (line 12524) | function getStartAndCountOfVisiblePointsSimplified(meta, points) {
function _segments (line 12617) | function _segments(line, target, property) {
function _getBounds (line 12679) | function _getBounds(property, first, last, loop) {
function _pointsFromSegments (line 12695) | function _pointsFromSegments(boundary, line) {
function _findSegmentEnd (line 12731) | function _findSegmentEnd(start, end, points) {
function _getEdge (line 12740) | function _getEdge(a, b, prop, fn) {
function _createBoundaryLine (line 12746) | function _createBoundaryLine(boundary, line) {
function _shouldApplyFill (line 12764) | function _shouldApplyFill(source) {
function _resolveTarget (line 12767) | function _resolveTarget(sources, index, propagate) {
function _decodeFill (line 12791) | function _decodeFill(line, index, count) {
function decodeTargetIndex (line 12802) | function decodeTargetIndex(firstCh, index, target, count) {
function _getTargetPixel (line 12811) | function _getTargetPixel(fill, scale) {
function _getTargetValue (line 12824) | function _getTargetValue(fill, scale, startValue) {
function parseFillOption (line 12837) | function parseFillOption(line) {
function _buildStackLine (line 12852) | function _buildStackLine(source) {
function getLinesBelow (line 12875) | function getLinesBelow(scale, index) {
function addPointsBelow (line 12889) | function addPointsBelow(points, sourcePoint, linesBelow) {
function findPoint (line 12911) | function findPoint(line, sourcePoint, property) {
function simpleArc (line 12938) | function simpleArc(opts) {
function _getTarget (line 12973) | function _getTarget(source) {
function getLineByIndex (line 12992) | function getLineByIndex(chart, index) {
function computeBoundary (line 12997) | function computeBoundary(source) {
function computeLinearBoundary (line 13004) | function computeLinearBoundary(source) {
function computeCircularBoundary (line 13018) | function computeCircularBoundary(source) {
function _drawfill (line 13039) | function _drawfill(ctx, source, area) {
function doFill (line 13066) | function doFill(ctx, cfg) {
function clipVertical (line 13097) | function clipVertical(ctx, target, clipY) {
function fill (line 13137) | function fill(ctx, cfg) {
function clipBounds (line 13189) | function clipBounds(ctx, scale, bounds) {
function interpolatedLineTo (line 13203) | function interpolatedLineTo(ctx, target, point, property) {
function Legend (line 13301) | function Legend(config) {
function calculateItemSize (line 13768) | function calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHe...
function calculateItemWidth (line 13776) | function calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {
function calculateItemHeight (line 13785) | function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
function calculateLegendItemHeight (line 13792) | function calculateLegendItemHeight(legendItem, fontLineHeight) {
function isListened (line 13796) | function isListened(type, opts) {
function Title (line 13917) | function Title(config) {
function createTitle (line 14025) | function createTitle(chart, titleOpts) {
function pushOrConcat (line 14166) | function pushOrConcat(base, toPush) {
function splitNewlines (line 14176) | function splitNewlines(str) {
function createTooltipItem (line 14182) | function createTooltipItem(chart, item) {
function getTooltipSize (line 14202) | function getTooltipSize(tooltip, options) {
function determineYAlign (line 14257) | function determineYAlign(chart, size) {
function doesNotFitWithAlign (line 14267) | function doesNotFitWithAlign(xAlign, chart, options, size) {
function determineXAlign (line 14278) | function determineXAlign(chart, options, size, yAlign) {
function determineAlignment (line 14298) | function determineAlignment(chart, options, size) {
function alignX (line 14305) | function alignX(size, xAlign) {
function alignY (line 14315) | function alignY(size, yAlign, paddingAndSize) {
function getBackgroundPoint (line 14327) | function getBackgroundPoint(options, size, alignment, chart) {
function getAlignedX (line 14357) | function getAlignedX(tooltip, align, options) {
function getBeforeAfterBodyLines (line 14361) | function getBeforeAfterBodyLines(callback) {
function createTooltipContext (line 14364) | function createTooltipContext(parent, tooltip, tooltipItems) {
function overrideCallbacks (line 14371) | function overrideCallbacks(callbacks, context) {
function invokeCallbackWithFallback (line 14438) | function invokeCallbackWithFallback(callbacks, name, ctx, arg) {
function Tooltip (line 14448) | function Tooltip(config) {
function findOrAddLabel (line 15223) | function findOrAddLabel(labels, raw, index, addedLabels) {
function _getLabelForValue (line 15234) | function _getLabelForValue(value) {
function CategoryScale (line 15244) | function CategoryScale(cfg) {
function generateTicks$1 (line 15376) | function generateTicks$1(generationOptions, dataRange) {
function relativeLabelSize (line 15478) | function relativeLabelSize(value, minSpacing, _ref12) {
function LinearScaleBase (line 15489) | function LinearScaleBase(cfg) {
function LinearScale (line 15634) | function LinearScale() {
function isMajor (line 15683) | function isMajor(tickVal) {
function steps (line 15687) | function steps(min, max, rangeExp) {
function startExp (line 15693) | function startExp(min, max) {
function generateTicks (line 15704) | function generateTicks(generationOptions, _ref13) {
function LogarithmicScale (line 15747) | function LogarithmicScale(cfg) {
function getTickBackdropHeight (line 15879) | function getTickBackdropHeight(opts) {
function measureLabelSize (line 15887) | function measureLabelSize(ctx, font, label) {
function determineLimits (line 15894) | function determineLimits(angle, pos, size, min, max) {
function fitWithPointLabels (line 15911) | function fitWithPointLabels(scale) {
function updateLimits (line 15940) | function updateLimits(limits, orig, angle, hLimits, vLimits) {
function buildPointLabelItems (line 15960) | function buildPointLabelItems(scale, labelSizes, padding) {
function getTextAlignForAngle (line 15986) | function getTextAlignForAngle(angle) {
function leftForTextAlign (line 15994) | function leftForTextAlign(x, w, align) {
function yForAngle (line 16002) | function yForAngle(y, h, angle) {
function drawPointLabels (line 16010) | function drawPointLabels(scale, labelCount) {
function pathRadiusLine (line 16056) | function pathRadiusLine(scale, radius, circular, labelCount) {
function drawRadiusLine (line 16069) | function drawRadiusLine(scale, gridLineOpts, radius, labelCount, borderO...
function createPointLabelContext (line 16088) | function createPointLabelContext(parent, index, label) {
function RadialLinearScale (line 16098) | function RadialLinearScale(cfg) {
function sorter (line 16437) | function sorter(a, b) {
function _parse (line 16440) | function _parse(scale, input) {
function determineUnitForAutoTicks (line 16464) | function determineUnitForAutoTicks(minUnit, min, max, capacity) {
function determineUnitForFormatting (line 16475) | function determineUnitForFormatting(scale, numTicks, minUnit, min, max) {
function determineMajorUnit (line 16484) | function determineMajorUnit(unit) {
function addTick (line 16491) | function addTick(ticks, time, timestamps) {
function setMajorTicks (line 16502) | function setMajorTicks(scale, ticks, map, majorUnit) {
function ticksFromTimestamps (line 16515) | function ticksFromTimestamps(scale, values, majorUnit) {
function TimeScale (line 16533) | function TimeScale(props) {
function _applyBounds (line 16594) | function _applyBounds(bounds) {
function interpolate (line 16872) | function interpolate(table, val, reverse) {
function TimeSeriesScale (line 16907) | function TimeSeriesScale(props) {
function toInteger (line 17134) | function toInteger(dirtyNumber) {
function requiredArgs (line 17145) | function requiredArgs(required, args) {
function _typeof$y (line 17151) | function _typeof$y(obj) {
function toDate (line 17196) | function toDate(argument) {
function addDays (line 17235) | function addDays(dirtyDate, dirtyAmount) {
function addMonths (line 17269) | function addMonths(dirtyDate, dirtyAmount) {
function addMilliseconds (line 17328) | function addMilliseconds(dirtyDate, dirtyAmount) {
function addHours (line 17355) | function addHours(dirtyDate, dirtyAmount) {
function getDefaultOptions (line 17362) | function getDefaultOptions() {
function startOfWeek (line 17394) | function startOfWeek(dirtyDate, options) {
function getTimezoneOffsetInMilliseconds (line 17422) | function getTimezoneOffsetInMilliseconds(date) {
function startOfDay (line 17447) | function startOfDay(dirtyDate) {
function differenceInCalendarDays (line 17486) | function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) {
function addMinutes (line 17518) | function addMinutes(dirtyDate, dirtyAmount) {
function addQuarters (line 17543) | function addQuarters(dirtyDate, dirtyAmount) {
function addSeconds (line 17569) | function addSeconds(dirtyDate, dirtyAmount) {
function addWeeks (line 17594) | function addWeeks(dirtyDate, dirtyAmount) {
function addYears (line 17620) | function addYears(dirtyDate, dirtyAmount) {
function compareAsc (line 17659) | function compareAsc(dirtyDateLeft, dirtyDateRight) {
function _typeof$x (line 17712) | function _typeof$x(obj) {
function isDate (line 17759) | function isDate(value) {
function isValid (line 17796) | function isValid(dirtyDate) {
function differenceInCalendarMonths (line 17827) | function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) {
function differenceInCalendarYears (line 17858) | function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
function compareLocalAsc (line 17869) | function compareLocalAsc(dateLeft, dateRight) {
function differenceInDays (line 17929) | function differenceInDays(dirtyDateLeft, dirtyDateRight) {
function differenceInMilliseconds (line 17967) | function differenceInMilliseconds(dateLeft, dateRight) {
function getRoundingMethod (line 17982) | function getRoundingMethod(method) {
function differenceInHours (line 18010) | function differenceInHours(dateLeft, dateRight, options) {
function differenceInMinutes (line 18048) | function differenceInMinutes(dateLeft, dateRight, options) {
function endOfDay (line 18073) | function endOfDay(dirtyDate) {
function endOfMonth (line 18099) | function endOfMonth(dirtyDate) {
function isLastDayOfMonth (line 18126) | function isLastDayOfMonth(dirtyDate) {
function differenceInMonths (line 18151) | function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
function differenceInQuarters (line 18202) | function differenceInQuarters(dateLeft, dateRight, options) {
function differenceInSeconds (line 18233) | function differenceInSeconds(dateLeft, dateRight, options) {
function differenceInWeeks (line 18281) | function differenceInWeeks(dateLeft, dateRight, options) {
function differenceInYears (line 18306) | function differenceInYears(dirtyDateLeft, dirtyDateRight) {
function startOfMinute (line 18343) | function startOfMinute(dirtyDate) {
function startOfQuarter (line 18369) | function startOfQuarter(dirtyDate) {
function startOfMonth (line 18398) | function startOfMonth(dirtyDate) {
function endOfYear (line 18425) | function endOfYear(dirtyDate) {
function startOfYear (line 18453) | function startOfYear(dirtyDate) {
function endOfHour (line 18481) | function endOfHour(dirtyDate) {
function endOfWeek (line 18515) | function endOfWeek(dirtyDate, options) {
function endOfMinute (line 18551) | function endOfMinute(dirtyDate) {
function endOfQuarter (line 18577) | function endOfQuarter(dirtyDate) {
function endOfSecond (line 18606) | function endOfSecond(dirtyDate) {
function subMilliseconds (line 18632) | function subMilliseconds(dirtyDate, dirtyAmount) {
function getUTCDayOfYear (line 18639) | function getUTCDayOfYear(dirtyDate) {
function startOfUTCISOWeek (line 18650) | function startOfUTCISOWeek(dirtyDate) {
function getUTCISOWeekYear (line 18661) | function getUTCISOWeekYear(dirtyDate) {
function startOfUTCISOWeekYear (line 18682) | function startOfUTCISOWeekYear(dirtyDate) {
function getUTCISOWeek (line 18693) | function getUTCISOWeek(dirtyDate) {
function startOfUTCWeek (line 18703) | function startOfUTCWeek(dirtyDate, options) {
function getUTCWeekYear (line 18720) | function getUTCWeekYear(dirtyDate, options) {
function startOfUTCWeekYear (line 18748) | function startOfUTCWeekYear(dirtyDate, options) {
function getUTCWeek (line 18762) | function getUTCWeek(dirtyDate, options) {
function addLeadingZeros (line 18772) | function addLeadingZeros(number, targetLength) {
function formatTimezoneShort (line 19639) | function formatTimezoneShort(offset, dirtyDelimiter) {
function formatTimezoneWithOptionalMinutes (line 19650) | function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
function formatTimezone (line 19657) | function formatTimezone(offset, dirtyDelimiter) {
function isProtectedDayOfYearToken (line 19750) | function isProtectedDayOfYearToken(token) {
function isProtectedWeekYearToken (line 19753) | function isProtectedWeekYearToken(token) {
function throwProtectedError (line 19756) | function throwProtectedError(token, format, input) {
function buildFormatLongFn (line 19852) | function buildFormatLongFn(args) {
function buildLocalizeFn (line 19909) | function buildLocalizeFn(args) {
function buildMatchFn (line 20068) | function buildMatchFn(args) {
function findKey (line 20094) | function findKey(object, predicate) {
function findIndex (line 20102) | function findIndex(array, predicate) {
function buildMatchPatternFn (line 20111) | function buildMatchPatternFn(args) {
function format (line 20561) | function format(dirtyDate, dirtyFormatStr, options) {
function cleanEscapedString$1 (line 20631) | function cleanEscapedString$1(input) {
function assign (line 20639) | function assign(target, object) {
function _typeof$w (line 20651) | function _typeof$w(obj) {
function _inherits$v (line 20665) | function _inherits$v(subClass, superClass) {
function _setPrototypeOf$v (line 20678) | function _setPrototypeOf$v(o, p) {
function _createSuper$v (line 20685) | function _createSuper$v(Derived) {
function _possibleConstructorReturn$v (line 20699) | function _possibleConstructorReturn$v(self, call) {
function _assertThisInitialized$v (line 20705) | function _assertThisInitialized$v(self) {
function _isNativeReflectConstruct$v (line 20711) | function _isNativeReflectConstruct$v() {
function _getPrototypeOf$v (line 20722) | function _getPrototypeOf$v(o) {
function _classCallCheck$w (line 20728) | function _classCallCheck$w(instance, Constructor) {
function _defineProperties$w (line 20733) | function _defineProperties$w(target, props) {
function _createClass$w (line 20742) | function _createClass$w(Constructor, protoProps, staticProps) {
function _defineProperty$v (line 20747) | function _defineProperty$v(obj, key, value) {
function Setter (line 20762) | function Setter() {
function ValueSetter (line 20777) | function ValueSetter(value, validateValue, setValue, priority, subPriori...
function DateToSystemTimezoneSetter (line 20806) | function DateToSystemTimezoneSetter() {
function _classCallCheck$v (line 20832) | function _classCallCheck$v(instance, Constructor) {
function _defineProperties$v (line 20837) | function _defineProperties$v(target, props) {
function _createClass$v (line 20846) | function _createClass$v(Constructor, protoProps, staticProps) {
function Parser (line 20852) | function Parser() {
function _typeof$v (line 20876) | function _typeof$v(obj) {
function _classCallCheck$u (line 20890) | function _classCallCheck$u(instance, Constructor) {
function _defineProperties$u (line 20895) | function _defineProperties$u(target, props) {
function _createClass$u (line 20904) | function _createClass$u(Constructor, protoProps, staticProps) {
function _inherits$u (line 20909) | function _inherits$u(subClass, superClass) {
function _setPrototypeOf$u (line 20922) | function _setPrototypeOf$u(o, p) {
function _createSuper$u (line 20929) | function _createSuper$u(Derived) {
function _possibleConstructorReturn$u (line 20943) | function _possibleConstructorReturn$u(self, call) {
function _assertThisInitialized$u (line 20949) | function _assertThisInitialized$u(self) {
function _isNativeReflectConstruct$u (line 20955) | function _isNativeReflectConstruct$u() {
function _getPrototypeOf$u (line 20966) | function _getPrototypeOf$u(o) {
function _defineProperty$u (line 20972) | function _defineProperty$u(obj, key, value) {
function EraParser (line 20988) | function EraParser() {
function mapValue (line 21090) | function mapValue(parseFnResult, mapFn) {
function parseNumericPattern (line 21099) | function parseNumericPattern(pattern, dateString) {
function parseTimezonePattern (line 21109) | function parseTimezonePattern(pattern, dateString) {
function parseAnyDigitsSigned (line 21130) | function parseAnyDigitsSigned(dateString) {
function parseNDigits (line 21133) | function parseNDigits(n, dateString) {
function parseNDigitsSigned (line 21147) | function parseNDigitsSigned(n, dateString) {
function dayPeriodEnumToHours (line 21161) | function dayPeriodEnumToHours(dayPeriod) {
function normalizeTwoDigitYear (line 21178) | function normalizeTwoDigitYear(twoDigitYear, currentYear) {
function isLeapYearIndex$1 (line 21196) | function isLeapYearIndex$1(year) {
function _typeof$u (line 21200) | function _typeof$u(obj) {
function _classCallCheck$t (line 21214) | function _classCallCheck$t(instance, Constructor) {
function _defineProperties$t (line 21219) | function _defineProperties$t(target, props) {
function _createClass$t (line 21228) | function _createClass$t(Constructor, protoProps, staticProps) {
function _inherits$t (line 21233) | function _inherits$t(subClass, superClass) {
function _setPrototypeOf$t (line 21246) | function _setPrototypeOf$t(o, p) {
function _createSuper$t (line 21253) | function _createSuper$t(Derived) {
function _possibleConstructorReturn$t (line 21267) | function _possibleConstructorReturn$t(self, call) {
function _assertThisInitialized$t (line 21273) | function _assertThisInitialized$t(self) {
function _isNativeReflectConstruct$t (line 21279) | function _isNativeReflectConstruct$t() {
function _getPrototypeOf$t (line 21290) | function _getPrototypeOf$t(o) {
function _defineProperty$t (line 21296) | function _defineProperty$t(obj, key, value) {
function YearParser (line 21320) | function YearParser() {
function _typeof$t (line 21375) | function _typeof$t(obj) {
function _classCallCheck$s (line 21389) | function _classCallCheck$s(instance, Constructor) {
function _defineProperties$s (line 21394) | function _defineProperties$s(target, props) {
function _createClass$s (line 21403) | function _createClass$s(Constructor, protoProps, staticProps) {
function _inherits$s (line 21408) | function _inherits$s(subClass, superClass) {
function _setPrototypeOf$s (line 21421) | function _setPrototypeOf$s(o, p) {
function _createSuper$s (line 21428) | function _createSuper$s(Derived) {
function _possibleConstructorReturn$s (line 21442) | function _possibleConstructorReturn$s(self, call) {
function _assertThisInitialized$s (line 21448) | function _assertThisInitialized$s(self) {
function _isNativeReflectConstruct$s (line 21454) | function _isNativeReflectConstruct$s() {
function _getPrototypeOf$s (line 21465) | function _getPrototypeOf$s(o) {
function _defineProperty$s (line 21471) | function _defineProperty$s(obj, key, value) {
function LocalWeekYearParser (line 21488) | function LocalWeekYearParser() {
function _typeof$s (line 21543) | function _typeof$s(obj) {
function _classCallCheck$r (line 21557) | function _classCallCheck$r(instance, Constructor) {
function _defineProperties$r (line 21562) | function _defineProperties$r(target, props) {
function _createClass$r (line 21571) | function _createClass$r(Constructor, protoProps, staticProps) {
function _inherits$r (line 21576) | function _inherits$r(subClass, superClass) {
function _setPrototypeOf$r (line 21589) | function _setPrototypeOf$r(o, p) {
function _createSuper$r (line 21596) | function _createSuper$r(Derived) {
function _possibleConstructorReturn$r (line 21610) | function _possibleConstructorReturn$r(self, call) {
function _assertThisInitialized$r (line 21616) | function _assertThisInitialized$r(self) {
function _isNativeReflectConstruct$r (line 21622) | function _isNativeReflectConstruct$r() {
function _getPrototypeOf$r (line 21633) | function _getPrototypeOf$r(o) {
function _defineProperty$r (line 21639) | function _defineProperty$r(obj, key, value) {
function ISOWeekYearParser (line 21656) | function ISOWeekYearParser() {
function _typeof$r (line 21687) | function _typeof$r(obj) {
function _classCallCheck$q (line 21701) | function _classCallCheck$q(instance, Constructor) {
function _defineProperties$q (line 21706) | function _defineProperties$q(target, props) {
function _createClass$q (line 21715) | function _createClass$q(Constructor, protoProps, staticProps) {
function _inherits$q (line 21720) | function _inherits$q(subClass, superClass) {
function _setPrototypeOf$q (line 21733) | function _setPrototypeOf$q(o, p) {
function _createSuper$q (line 21740) | function _createSuper$q(Derived) {
function _possibleConstructorReturn$q (line 21754) | function _possibleConstructorReturn$q(self, call) {
function _assertThisInitialized$q (line 21760) | function _assertThisInitialized$q(self) {
function _isNativeReflectConstruct$q (line 21766) | function _isNativeReflectConstruct$q() {
function _getPrototypeOf$q (line 21777) | function _getPrototypeOf$q(o) {
function _defineProperty$q (line 21783) | function _defineProperty$q(obj, key, value) {
function ExtendedYearParser (line 21799) | function ExtendedYearParser() {
function _typeof$q (line 21829) | function _typeof$q(obj) {
function _classCallCheck$p (line 21843) | function _classCallCheck$p(instance, Constructor) {
function _defineProperties$p (line 21848) | function _defineProperties$p(target, props) {
function _createClass$p (line 21857) | function _createClass$p(Constructor, protoProps, staticProps) {
function _inherits$p (line 21862) | function _inherits$p(subClass, superClass) {
function _setPrototypeOf$p (line 21875) | function _setPrototypeOf$p(o, p) {
function _createSuper$p (line 21882) | function _createSuper$p(Derived) {
function _possibleConstructorReturn$p (line 21896) | function _possibleConstructorReturn$p(self, call) {
function _assertThisInitialized$p (line 21902) | function _assertThisInitialized$p(self) {
function _isNativeReflectConstruct$p (line 21908) | function _isNativeReflectConstruct$p() {
function _getPrototypeOf$p (line 21919) | function _getPrototypeOf$p(o) {
function _defineProperty$p (line 21925) | function _defineProperty$p(obj, key, value) {
function QuarterParser (line 21941) | function QuarterParser() {
function _typeof$p (line 22016) | function _typeof$p(obj) {
function _classCallCheck$o (line 22030) | function _classCallCheck$o(instance, Constructor) {
function _defineProperties$o (line 22035) | function _defineProperties$o(target, props) {
function _createClass$o (line 22044) | function _createClass$o(Constructor, protoProps, staticProps) {
function _inherits$o (line 22049) | function _inherits$o(subClass, superClass) {
function _setPrototypeOf$o (line 22062) | function _setPrototypeOf$o(o, p) {
function _createSuper$o (line 22069) | function _createSuper$o(Derived) {
function _possibleConstructorReturn$o (line 22083) | function _possibleConstructorReturn$o(self, call) {
function _assertThisInitialized$o (line 22089) | function _assertThisInitialized$o(self) {
function _isNativeReflectConstruct$o (line 22095) | function _isNativeReflectConstruct$o() {
function _getPrototypeOf$o (line 22106) | function _getPrototypeOf$o(o) {
function _defineProperty$o (line 22112) | function _defineProperty$o(obj, key, value) {
function StandAloneQuarterParser (line 22128) | function StandAloneQuarterParser() {
function _typeof$o (line 22203) | function _typeof$o(obj) {
function _classCallCheck$n (line 22217) | function _classCallCheck$n(instance, Constructor) {
function _defineProperties$n (line 22222) | function _defineProperties$n(target, props) {
function _createClass$n (line 22231) | function _createClass$n(Constructor, protoProps, staticProps) {
function _inherits$n (line 22236) | function _inherits$n(subClass, superClass) {
function _setPrototypeOf$n (line 22249) | function _setPrototypeOf$n(o, p) {
function _createSuper$n (line 22256) | function _createSuper$n(Derived) {
function _possibleConstructorReturn$n (line 22270) | function _possibleConstructorReturn$n(self, call) {
function _assertThisInitialized$n (line 22276) | function _assertThisInitialized$n(self) {
function _isNativeReflectConstruct$n (line 22282) | function _isNativeReflectConstruct$n() {
function _getPrototypeOf$n (line 22293) | function _getPrototypeOf$n(o) {
function _defineProperty$n (line 22299) | function _defineProperty$n(obj, key, value) {
function MonthParser (line 22315) | function MonthParser() {
function _typeof$n (line 22395) | function _typeof$n(obj) {
function _classCallCheck$m (line 22409) | function _classCallCheck$m(instance, Constructor) {
function _defineProperties$m (line 22414) | function _defineProperties$m(target, props) {
function _createClass$m (line 22423) | function _createClass$m(Constructor, protoProps, staticProps) {
function _inherits$m (line 22428) | function _inherits$m(subClass, superClass) {
function _setPrototypeOf$m (line 22441) | function _setPrototypeOf$m(o, p) {
function _createSuper$m (line 22448) | function _createSuper$m(Derived) {
function _possibleConstructorReturn$m (line 22462) | function _possibleConstructorReturn$m(self, call) {
function _assertThisInitialized$m (line 22468) | function _assertThisInitialized$m(self) {
function _isNativeReflectConstruct$m (line 22474) | function _isNativeReflectConstruct$m() {
function _getPrototypeOf$m (line 22485) | function _getPrototypeOf$m(o) {
function _defineProperty$m (line 22491) | function _defineProperty$m(obj, key, value) {
function StandAloneMonthParser (line 22507) | function StandAloneMonthParser() {
function setUTCWeek (line 22587) | function setUTCWeek(dirtyDate, dirtyWeek, options) {
function _typeof$m (line 22596) | function _typeof$m(obj) {
function _classCallCheck$l (line 22610) | function _classCallCheck$l(instance, Constructor) {
function _defineProperties$l (line 22615) | function _defineProperties$l(target, props) {
function _createClass$l (line 22624) | function _createClass$l(Constructor, protoProps, staticProps) {
function _inherits$l (line 22629) | function _inherits$l(subClass, superClass) {
function _setPrototypeOf$l (line 22642) | function _setPrototypeOf$l(o, p) {
function _createSuper$l (line 22649) | function _createSuper$l(Derived) {
function _possibleConstructorReturn$l (line 22663) | function _possibleConstructorReturn$l(self, call) {
function _assertThisInitialized$l (line 22669) | function _assertThisInitialized$l(self) {
function _isNativeReflectConstruct$l (line 22675) | function _isNativeReflectConstruct$l() {
function _getPrototypeOf$l (line 22686) | function _getPrototypeOf$l(o) {
function _defineProperty$l (line 22692) | function _defineProperty$l(obj, key, value) {
function LocalWeekParser (line 22709) | function LocalWeekParser() {
function setUTCISOWeek (line 22748) | function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
function _typeof$l (line 22757) | function _typeof$l(obj) {
function _classCallCheck$k (line 22771) | function _classCallCheck$k(instance, Constructor) {
function _defineProperties$k (line 22776) | function _defineProperties$k(target, props) {
function _createClass$k (line 22785) | function _createClass$k(Constructor, protoProps, staticProps) {
function _inherits$k (line 22790) | function _inherits$k(subClass, superClass) {
function _setPrototypeOf$k (line 22803) | function _setPrototypeOf$k(o, p) {
function _createSuper$k (line 22810) | function _createSuper$k(Derived) {
function _possibleConstructorReturn$k (line 22824) | function _possibleConstructorReturn$k(self, call) {
function _assertThisInitialized$k (line 22830) | function _assertThisInitialized$k(self) {
function _isNativeReflectConstruct$k (line 22836) | function _isNativeReflectConstruct$k() {
function _getPrototypeOf$k (line 22847) | function _getPrototypeOf$k(o) {
function _defineProperty$k (line 22853) | function _defineProperty$k(obj, key, value) {
function ISOWeekParser (line 22870) | function ISOWeekParser() {
function _typeof$k (line 22909) | function _typeof$k(obj) {
function _classCallCheck$j (line 22923) | function _classCallCheck$j(instance, Constructor) {
function _defineProperties$j (line 22928) | function _defineProperties$j(target, props) {
function _createClass$j (line 22937) | function _createClass$j(Constructor, protoProps, staticProps) {
function _inherits$j (line 22942) | function _inherits$j(subClass, superClass) {
function _setPrototypeOf$j (line 22955) | function _setPrototypeOf$j(o, p) {
function _createSuper$j (line 22962) | function _createSuper$j(Derived) {
function _possibleConstructorReturn$j (line 22976) | function _possibleConstructorReturn$j(self, call) {
function _assertThisInitialized$j (line 22982) | function _assertThisInitialized$j(self) {
function _isNativeReflectConstruct$j (line 22988) | function _isNativeReflectConstruct$j() {
function _getPrototypeOf$j (line 22999) | function _getPrototypeOf$j(o) {
function _defineProperty$j (line 23005) | function _defineProperty$j(obj, key, value) {
function DateParser (line 23024) | function DateParser() {
function _typeof$j (line 23073) | function _typeof$j(obj) {
function _classCallCheck$i (line 23087) | function _classCallCheck$i(instance, Constructor) {
function _defineProperties$i (line 23092) | function _defineProperties$i(target, props) {
function _createClass$i (line 23101) | function _createClass$i(Constructor, protoProps, staticProps) {
function _inherits$i (line 23106) | function _inherits$i(subClass, superClass) {
function _setPrototypeOf$i (line 23119) | function _setPrototypeOf$i(o, p) {
function _createSuper$i (line 23126) | function _createSuper$i(Derived) {
function _possibleConstructorReturn$i (line 23140) | function _possibleConstructorReturn$i(self, call) {
function _assertThisInitialized$i (line 23146) | function _assertThisInitialized$i(self) {
function _isNativeReflectConstruct$i (line 23152) | function _isNativeReflectConstruct$i() {
function _getPrototypeOf$i (line 23163) | function _getPrototypeOf$i(o) {
function _defineProperty$i (line 23169) | function _defineProperty$i(obj, key, value) {
function DayOfYearParser (line 23185) | function DayOfYearParser() {
function setUTCDay (line 23234) | function setUTCDay(dirtyDate, dirtyDay, options) {
function _typeof$i (line 23253) | function _typeof$i(obj) {
function _classCallCheck$h (line 23267) | function _classCallCheck$h(instance, Constructor) {
function _defineProperties$h (line 23272) | function _defineProperties$h(target, props) {
function _createClass$h (line 23281) | function _createClass$h(Constructor, protoProps, staticProps) {
function _inherits$h (line 23286) | function _inherits$h(subClass, superClass) {
function _setPrototypeOf$h (line 23299) | function _setPrototypeOf$h(o, p) {
function _createSuper$h (line 23306) | function _createSuper$h(Derived) {
function _possibleConstructorReturn$h (line 23320) | function _possibleConstructorReturn$h(self, call) {
function _assertThisInitialized$h (line 23326) | function _assertThisInitialized$h(self) {
function _isNativeReflectConstruct$h (line 23332) | function _isNativeReflectConstruct$h() {
function _getPrototypeOf$h (line 23343) | function _getPrototypeOf$h(o) {
function _defineProperty$h (line 23349) | function _defineProperty$h(obj, key, value) {
function DayParser (line 23366) | function DayParser() {
function _typeof$h (line 23447) | function _typeof$h(obj) {
function _classCallCheck$g (line 23461) | function _classCallCheck$g(instance, Constructor) {
function _defineProperties$g (line 23466) | function _defineProperties$g(target, props) {
function _createClass$g (line 23475) | function _createClass$g(Constructor, protoProps, staticProps) {
function _inherits$g (line 23480) | function _inherits$g(subClass, superClass) {
function _setPrototypeOf$g (line 23493) | function _setPrototypeOf$g(o, p) {
function _createSuper$g (line 23500) | function _createSuper$g(Derived) {
function _possibleConstructorReturn$g (line 23514) | function _possibleConstructorReturn$g(self, call) {
function _assertThisInitialized$g (line 23520) | function _assertThisInitialized$g(self) {
function _isNativeReflectConstruct$g (line 23526) | function _isNativeReflectConstruct$g() {
function _getPrototypeOf$g (line 23537) | function _getPrototypeOf$g(o) {
function _defineProperty$g (line 23543) | function _defineProperty$g(obj, key, value) {
function LocalDayParser (line 23560) | function LocalDayParser() {
function _typeof$g (line 23655) | function _typeof$g(obj) {
function _classCallCheck$f (line 23669) | function _classCallCheck$f(instance, Constructor) {
function _defineProperties$f (line 23674) | function _defineProperties$f(target, props) {
function _createClass$f (line 23683) | function _createClass$f(Constructor, protoProps, staticProps) {
function _inherits$f (line 23688) | function _inherits$f(subClass, superClass) {
function _setPrototypeOf$f (line 23701) | function _setPrototypeOf$f(o, p) {
function _createSuper$f (line 23708) | function _createSuper$f(Derived) {
function _possibleConstructorReturn$f (line 23722) | function _possibleConstructorReturn$f(self, call) {
function _assertThisInitialized$f (line 23728) | function _assertThisInitialized$f(self) {
function _isNativeReflectConstruct$f (line 23734) | function _isNativeReflectConstruct$f() {
function _getPrototypeOf$f (line 23745) | function _getPrototypeOf$f(o) {
function _defineProperty$f (line 23751) | function _defineProperty$f(obj, key, value) {
function StandAloneLocalDayParser (line 23768) | function StandAloneLocalDayParser() {
function setUTCISODay (line 23863) | function setUTCISODay(dirtyDate, dirtyDay) {
function _typeof$f (line 23879) | function _typeof$f(obj) {
function _classCallCheck$e (line 23893) | function _classCallCheck$e(instance, Constructor) {
function _defineProperties$e (line 23898) | function _defineProperties$e(target, props) {
function _createClass$e (line 23907) | function _createClass$e(Constructor, protoProps, staticProps) {
function _inherits$e (line 23912) | function _inherits$e(subClass, superClass) {
function _setPrototypeOf$e (line 23925) | function _setPrototypeOf$e(o, p) {
function _createSuper$e (line 23932) | function _createSuper$e(Derived) {
function _possibleConstructorReturn$e (line 23946) | function _possibleConstructorReturn$e(self, call) {
function _assertThisInitialized$e (line 23952) | function _assertThisInitialized$e(self) {
function _isNativeReflectConstruct$e (line 23958) | function _isNativeReflectConstruct$e() {
function _getPrototypeOf$e (line 23969) | function _getPrototypeOf$e(o) {
function _defineProperty$e (line 23975) | function _defineProperty$e(obj, key, value) {
function ISODayParser (line 23992) | function ISODayParser() {
function _typeof$e (line 24089) | function _typeof$e(obj) {
function _classCallCheck$d (line 24103) | function _classCallCheck$d(instance, Constructor) {
function _defineProperties$d (line 24108) | function _defineProperties$d(target, props) {
function _createClass$d (line 24117) | function _createClass$d(Constructor, protoProps, staticProps) {
function _inherits$d (line 24122) | function _inherits$d(subClass, superClass) {
function _setPrototypeOf$d (line 24135) | function _setPrototypeOf$d(o, p) {
function _createSuper$d (line 24142) | function _createSuper$d(Derived) {
function _possibleConstructorReturn$d (line 24156) | function _possibleConstructorReturn$d(self, call) {
function _assertThisInitialized$d (line 24162) | function _assertThisInitialized$d(self) {
function _isNativeReflectConstruct$d (line 24168) | function _isNativeReflectConstruct$d() {
function _getPrototypeOf$d (line 24179) | function _getPrototypeOf$d(o) {
function _defineProperty$d (line 24185) | function _defineProperty$d(obj, key, value) {
function AMPMParser (line 24201) | function AMPMParser() {
function _typeof$d (line 24255) | function _typeof$d(obj) {
function _classCallCheck$c (line 24269) | function _classCallCheck$c(instance, Constructor) {
function _defineProperties$c (line 24274) | function _defineProperties$c(target, props) {
function _createClass$c (line 24283) | function _createClass$c(Constructor, protoProps, staticProps) {
function _inherits$c (line 24288) | function _inherits$c(subClass, superClass) {
function _setPrototypeOf$c (line 24301) | function _setPrototypeOf$c(o, p) {
function _createSuper$c (line 24308) | function _createSuper$c(Derived) {
function _possibleConstructorReturn$c (line 24322) | function _possibleConstructorReturn$c(self, call) {
function _assertThisInitialized$c (line 24328) | function _assertThisInitialized$c(self) {
function _isNativeReflectConstruct$c (line 24334) | function _isNativeReflectConstruct$c() {
function _getPrototypeOf$c (line 24345) | function _getPrototypeOf$c(o) {
function _defineProperty$c (line 24351) | function _defineProperty$c(obj, key, value) {
function AMPMMidnightParser (line 24367) | function AMPMMidnightParser() {
function _typeof$c (line 24421) | function _typeof$c(obj) {
function _classCallCheck$b (line 24435) | function _classCallCheck$b(instance, Constructor) {
function _defineProperties$b (line 24440) | function _defineProperties$b(target, props) {
function _createClass$b (line 24449) | function _createClass$b(Constructor, protoProps, staticProps) {
function _inherits$b (line 24454) | function _inherits$b(subClass, superClass) {
function _setPrototypeOf$b (line 24467) | function _setPrototypeOf$b(o, p) {
function _createSuper$b (line 24474) | function _createSuper$b(Derived) {
function _possibleConstructorReturn$b (line 24488) | function _possibleConstructorReturn$b(self, call) {
function _assertThisInitialized$b (line 24494) | function _assertThisInitialized$b(self) {
function _isNativeReflectConstruct$b (line 24500) | function _isNativeReflectConstruct$b() {
function _getPrototypeOf$b (line 24511) | function _getPrototypeOf$b(o) {
function _defineProperty$b (line 24517) | function _defineProperty$b(obj, key, value) {
function DayPeriodParser (line 24534) | function DayPeriodParser() {
function _typeof$b (line 24588) | function _typeof$b(obj) {
function _classCallCheck$a (line 24602) | function _classCallCheck$a(instance, Constructor) {
function _defineProperties$a (line 24607) | function _defineProperties$a(target, props) {
function _createClass$a (line 24616) | function _createClass$a(Constructor, protoProps, staticProps) {
function _inherits$a (line 24621) | function _inherits$a(subClass, superClass) {
function _setPrototypeOf$a (line 24634) | function _setPrototypeOf$a(o, p) {
function _createSuper$a (line 24641) | function _createSuper$a(Derived) {
function _possibleConstructorReturn$a (line 24655) | function _possibleConstructorReturn$a(self, call) {
function _assertThisInitialized$a (line 24661) | function _assertThisInitialized$a(self) {
function _isNativeReflectConstruct$a (line 24667) | function _isNativeReflectConstruct$a() {
function _getPrototypeOf$a (line 24678) | function _getPrototypeOf$a(o) {
function _defineProperty$a (line 24684) | function _defineProperty$a(obj, key, value) {
function Hour1to12Parser (line 24700) | function Hour1to12Parser() {
function _typeof$a (line 24747) | function _typeof$a(obj) {
function _classCallCheck$9 (line 24761) | function _classCallCheck$9(instance, Constructor) {
function _defineProperties$9 (line 24766) | function _defineProperties$9(target, props) {
function _createClass$9 (line 24775) | function _createClass$9(Constructor, protoProps, staticProps) {
function _inherits$9 (line 24780) | function _inherits$9(subClass, superClass) {
function _setPrototypeOf$9 (line 24793) | function _setPrototypeOf$9(o, p) {
function _createSuper$9 (line 24800) | function _createSuper$9(Derived) {
function _possibleConstructorReturn$9 (line 24814) | function _possibleConstructorReturn$9(self, call) {
function _assertThisInitialized$9 (line 24820) | function _assertThisInitialized$9(self) {
function _isNativeReflectConstruct$9 (line 24826) | function _isNativeReflectConstruct$9() {
function _getPrototypeOf$9 (line 24837) | function _getPrototypeOf$9(o) {
function _defineProperty$9 (line 24843) | function _defineProperty$9(obj, key, value) {
function Hour0to23Parser (line 24859) | function Hour0to23Parser() {
function _typeof$9 (line 24899) | function _typeof$9(obj) {
function _classCallCheck$8 (line 24913) | function _classCallCheck$8(instance, Constructor) {
function _defineProperties$8 (line 24918) | function _defineProperties$8(target, props) {
function _createClass$8 (line 24927) | function _createClass$8(Constructor, protoProps, staticProps) {
function _inherits$8 (line 24932) | function _inherits$8(subClass, superClass) {
function _setPrototypeOf$8 (line 24945) | function _setPrototypeOf$8(o, p) {
function _createSuper$8 (line 24952) | function _createSuper$8(Derived) {
function _possibleConstructorReturn$8 (line 24966) | function _possibleConstructorReturn$8(self, call) {
function _assertThisInitialized$8 (line 24972) | function _assertThisInitialized$8(self) {
function _isNativeReflectConstruct$8 (line 24978) | function _isNativeReflectConstruct$8() {
function _getPrototypeOf$8 (line 24989) | function _getPrototypeOf$8(o) {
function _defineProperty$8 (line 24995) | function _defineProperty$8(obj, key, value) {
function Hour0To11Parser (line 25011) | function Hour0To11Parser() {
function _typeof$8 (line 25056) | function _typeof$8(obj) {
function _classCallCheck$7 (line 25070) | function _classCallCheck$7(instance, Constructor) {
function _defineProperties$7 (line 25075) | function _defineProperties$7(target, props) {
function _createClass$7 (line 25084) | function _createClass$7(Constructor, protoProps, staticProps) {
function _inherits$7 (line 25089) | function _inherits$7(subClass, superClass) {
function _setPrototypeOf$7 (line 25102) | function _setPrototypeOf$7(o, p) {
function _createSuper$7 (line 25109) | function _createSuper$7(Derived) {
function _possibleConstructorReturn$7 (line 25123) | function _possibleConstructorReturn$7(self, call) {
function _assertThisInitialized$7 (line 25129) | function _assertThisInitialized$7(self) {
function _isNativeReflectConstruct$7 (line 25135) | function _isNativeReflectConstruct$7() {
function _getPrototypeOf$7 (line 25146) | function _getPrototypeOf$7(o) {
function _defineProperty$7 (line 25152) | function _defineProperty$7(obj, key, value) {
function Hour1To24Parser (line 25168) | function Hour1To24Parser() {
function _typeof$7 (line 25209) | function _typeof$7(obj) {
function _classCallCheck$6 (line 25223) | function _classCallCheck$6(instance, Constructor) {
function _defineProperties$6 (line 25228) | function _defineProperties$6(target, props) {
function _createClass$6 (line 25237) | function _createClass$6(Constructor, protoProps, staticProps) {
function _inherits$6 (line 25242) | function _inherits$6(subClass, superClass) {
function _setPrototypeOf$6 (line 25255) | function _setPrototypeOf$6(o, p) {
function _createSuper$6 (line 25262) | function _createSuper$6(Derived) {
function _possibleConstructorReturn$6 (line 25276) | function _possibleConstructorReturn$6(self, call) {
function _assertThisInitialized$6 (line 25282) | function _assertThisInitialized$6(self) {
function _isNativeReflectConstruct$6 (line 25288) | function _isNativeReflectConstruct$6() {
function _getPrototypeOf$6 (line 25299) | function _getPrototypeOf$6(o) {
function _defineProperty$6 (line 25305) | function _defineProperty$6(obj, key, value) {
function MinuteParser (line 25321) | function MinuteParser() {
function _typeof$6 (line 25361) | function _typeof$6(obj) {
function _classCallCheck$5 (line 25375) | function _classCallCheck$5(instance, Constructor) {
function _defineProperties$5 (line 25380) | function _defineProperties$5(target, props) {
function _createClass$5 (line 25389) | function _createClass$5(Constructor, protoProps, staticProps) {
function _inherits$5 (line 25394) | function _inherits$5(subClass, superClass) {
function _setPrototypeOf$5 (line 25407) | function _setPrototypeOf$5(o, p) {
function _createSuper$5 (line 25414) | function _createSuper$5(Derived) {
function _possibleConstructorReturn$5 (line 25428) | function _possibleConstructorReturn$5(self, call) {
function _assertThisInitialized$5 (line 25434) | function _assertThisInitialized$5(self) {
function _isNativeReflectConstruct$5 (line 25440) | function _isNativeReflectConstruct$5() {
function _getPrototypeOf$5 (line 25451) | function _getPrototypeOf$5(o) {
function _defineProperty$5 (line 25457) | function _defineProperty$5(obj, key, value) {
function SecondParser (line 25473) | function SecondParser() {
function _typeof$5 (line 25513) | function _typeof$5(obj) {
function _classCallCheck$4 (line 25527) | function _classCallCheck$4(instance, Constructor) {
function _defineProperties$4 (line 25532) | function _defineProperties$4(target, props) {
function _createClass$4 (line 25541) | function _createClass$4(Constructor, protoProps, staticProps) {
function _inherits$4 (line 25546) | function _inherits$4(subClass, superClass) {
function _setPrototypeOf$4 (line 25559) | function _setPrototypeOf$4(o, p) {
function _createSuper$4 (line 25566) | function _createSuper$4(Derived) {
function _possibleConstructorReturn$4 (line 25580) | function _possibleConstructorReturn$4(self, call) {
function _assertThisInitialized$4 (line 25586) | function _assertThisInitialized$4(self) {
function _isNativeReflectConstruct$4 (line 25592) | function _isNativeReflectConstruct$4() {
function _getPrototypeOf$4 (line 25603) | function _getPrototypeOf$4(o) {
function _defineProperty$4 (line 25609) | function _defineProperty$4(obj, key, value) {
function FractionOfSecondParser (line 25625) | function FractionOfSecondParser() {
function _typeof$4 (line 25654) | function _typeof$4(obj) {
function _classCallCheck$3 (line 25668) | function _classCallCheck$3(instance, Constructor) {
function _defineProperties$3 (line 25673) | function _defineProperties$3(target, props) {
function _createClass$3 (line 25682) | function _createClass$3(Constructor, protoProps, staticProps) {
function _inherits$3 (line 25687) | function _inherits$3(subClass, superClass) {
function _setPrototypeOf$3 (line 25700) | function _setPrototypeOf$3(o, p) {
function _createSuper$3 (line 25707) | function _createSuper$3(Derived) {
function _possibleConstructorReturn$3 (line 25721) | function _possibleConstructorReturn$3(self, call) {
function _assertThisInitialized$3 (line 25727) | function _assertThisInitialized$3(self) {
function _isNativeReflectConstruct$3 (line 25733) | function _isNativeReflectConstruct$3() {
function _getPrototypeOf$3 (line 25744) | function _getPrototypeOf$3(o) {
function _defineProperty$3 (line 25750) | function _defineProperty$3(obj, key, value) {
function ISOTimezoneWithZParser (line 25767) | function ISOTimezoneWithZParser() {
function _typeof$3 (line 25807) | function _typeof$3(obj) {
function _classCallCheck$2 (line 25821) | function _classCallCheck$2(instance, Constructor) {
function _defineProperties$2 (line 25826) | function _defineProperties$2(target, props) {
function _createClass$2 (line 25835) | function _createClass$2(Constructor, protoProps, staticProps) {
function _inherits$2 (line 25840) | function _inherits$2(subClass, superClass) {
function _setPrototypeOf$2 (line 25853) | function _setPrototypeOf$2(o, p) {
function _createSuper$2 (line 25860) | function _createSuper$2(Derived) {
function _possibleConstructorReturn$2 (line 25874) | function _possibleConstructorReturn$2(self, call) {
function _assertThisInitialized$2 (line 25880) | function _assertThisInitialized$2(self) {
function _isNativeReflectConstruct$2 (line 25886) | function _isNativeReflectConstruct$2() {
function _getPrototypeOf$2 (line 25897) | function _getPrototypeOf$2(o) {
function _defineProperty$2 (line 25903) | function _defineProperty$2(obj, key, value) {
function ISOTimezoneParser (line 25920) | function ISOTimezoneParser() {
function _typeof$2 (line 25960) | function _typeof$2(obj) {
function _classCallCheck$1 (line 25974) | function _classCallCheck$1(instance, Constructor) {
function _defineProperties$1 (line 25979) | function _defineProperties$1(target, props) {
function _createClass$1 (line 25988) | function _createClass$1(Constructor, protoProps, staticProps) {
function _inherits$1 (line 25993) | function _inherits$1(subClass, superClass) {
function _setPrototypeOf$1 (line 26006) | function _setPrototypeOf$1(o, p) {
function _createSuper$1 (line 26013) | function _createSuper$1(Derived) {
function _possibleConstructorReturn$1 (line 26027) | function _possibleConstructorReturn$1(self, call) {
function _assertThisInitialized$1 (line 26033) | function _assertThisInitialized$1(self) {
function _isNativeReflectConstruct$1 (line 26039) | function _isNativeReflectConstruct$1() {
function _getPrototypeOf$1 (line 26050) | function _getPrototypeOf$1(o) {
function _defineProperty$1 (line 26056) | function _defineProperty$1(obj, key, value) {
function TimestampSecondsParser (line 26072) | function TimestampSecondsParser() {
function _typeof$1 (line 26099) | function _typeof$1(obj) {
function _classCallCheck (line 26113) | function _classCallCheck(instance, Constructor) {
function _defineProperties (line 26118) | function _defineProperties(target, props) {
function _createClass (line 26127) | function _createClass(Constructor, protoProps, staticProps) {
function _inherits (line 26132) | function _inherits(subClass, superClass) {
function _setPrototypeOf (line 26145) | function _setPrototypeOf(o, p) {
function _createSuper (line 26152) | function _createSuper(Derived) {
function _possibleConstructorReturn (line 26166) | function _possibleConstructorReturn(self, call) {
function _assertThisInitialized (line 26172) | function _assertThisInitialized(self) {
function _isNativeReflectConstruct (line 26178) | function _isNativeReflectConstruct() {
function _getPrototypeOf (line 26189) | function _getPrototypeOf(o) {
function _defineProperty (line 26195) | function _defineProperty(obj, key, value) {
function TimestampMillisecondsParser (line 26211) | function TimestampMillisecondsParser() {
function _typeof (line 26316) | function _typeof(obj) {
function _createForOfIteratorHelper (line 26330) | function _createForOfIteratorHelper(o, allowArrayLike) {
function _unsupportedIterableToArray (line 26381) | function _unsupportedIterableToArray(o, minLen) {
function _arrayLikeToArray (line 26389) | function _arrayLikeToArray(arr, len) {
function parse (line 26717) | function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, o...
function cleanEscapedString (line 26875) | function cleanEscapedString(input) {
function startOfHour (line 26898) | function startOfHour(dirtyDate) {
function startOfSecond (line 26924) | function startOfSecond(dirtyDate) {
function parseISO (line 26964) | function parseISO(argument, options) {
function splitDateString (line 27019) | function splitDateString(dateString) {
function parseYear (line 27049) | function parseYear(dateString, additionalDigits) {
function parseDate (line 27065) | function parseDate(dateString, year) {
function parseDateUnit (line 27091) | function parseDateUnit(value) {
function parseTime (line 27094) | function parseTime(timeString) {
function parseTimeUnit (line 27106) | function parseTimeUnit(value) {
function parseTimezone (line 27109) | function parseTimezone(timezoneString) {
function dayOfISOWeekYear (line 27121) | function dayOfISOWeekYear(isoWeekYear, week, day) {
function isLeapYearIndex (line 27132) | function isLeapYearIndex(year) {
function validateDate (line 27135) | function validateDate(year, month, date) {
function validateDayOfYearDate (line 27138) | function validateDayOfYearDate(year, dayOfYear) {
function validateWeekDate (line 27141) | function validateWeekDate(_year, week, day) {
function validateTime (line 27144) | function validateTime(hours, minutes, seconds) {
function validateTimezone (line 27150) | function validateTimezone(_hours, minutes) {
FILE: app/assets/javascripts/pghero/application.js
function highlightQueries (line 7) | function highlightQueries() {
function initSlider (line 14) | function initSlider() {
FILE: app/assets/javascripts/pghero/chartkick.js
function isArray (line 14) | function isArray(variable) {
function isFunction (line 18) | function isFunction(variable) {
function isPlainObject (line 22) | function isPlainObject(variable) {
function extend (line 28) | function extend(target, source) {
function merge (line 47) | function merge(obj1, obj2) {
function negativeValues (line 56) | function negativeValues(series) {
function toStr (line 68) | function toStr(obj) {
function toFloat (line 72) | function toFloat(obj) {
function toDate (line 76) | function toDate(obj) {
function toArr (line 99) | function toArr(obj) {
function jsOptionsFunc (line 113) | function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, set...
function sortByTime (line 162) | function sortByTime(a, b) {
function sortByNumberSeries (line 166) | function sortByNumberSeries(a, b) {
function sortByNumber (line 171) | function sortByNumber(a, b) {
function every (line 175) | function every(values, fn) {
function isDay (line 184) | function isDay(timeUnit) {
function calculateTimeUnit (line 188) | function calculateTimeUnit(values, maxDay) {
function isDate (line 229) | function isDate(obj) {
function isNumber (line 233) | function isNumber(obj) {
function formatValue (line 239) | function formatValue(pre, value, options, axis) {
function seriesOption (line 342) | function seriesOption(chart, series, option) {
function hideLegend$2 (line 407) | function hideLegend$2(options, legend, hideLegend) {
function setTitle$2 (line 418) | function setTitle$2(options, title) {
function setMin$2 (line 423) | function setMin$2(options, min) {
function setMax$2 (line 429) | function setMax$2(options, max) {
function setBarMin$1 (line 433) | function setBarMin$1(options, min) {
function setBarMax$1 (line 439) | function setBarMax$1(options, max) {
function setStacked$2 (line 443) | function setStacked$2(options, stacked) {
function setXtitle$2 (line 448) | function setXtitle$2(options, title) {
function setYtitle$2 (line 453) | function setYtitle$2(options, title) {
function addOpacity (line 459) | function addOpacity(hex, opacity) {
function notnull (line 464) | function notnull(x) {
function setLabelSize (line 468) | function setLabelSize(chart, data, options) {
function calculateScale (line 487) | function calculateScale(series) {
function setFormatOptions$1 (line 497) | function setFormatOptions$1(chart, options, chartType) {
function maxAbsY (line 610) | function maxAbsY(series) {
function maxR (line 624) | function maxR(series) {
function prepareDefaultData (line 641) | function prepareDefaultData(chart) {
function prepareBubbleData (line 690) | function prepareBubbleData(chart) {
function prepareNumberData (line 718) | function prepareNumberData(chart) {
function prepareData (line 744) | function prepareData(chart, chartType) {
function createDataTable (line 754) | function createDataTable(chart, options, chartType) {
function hideLegend$1 (line 1129) | function hideLegend$1(options, legend, hideLegend) {
function setTitle$1 (line 1146) | function setTitle$1(options, title) {
function setMin$1 (line 1150) | function setMin$1(options, min) {
function setMax$1 (line 1154) | function setMax$1(options, max) {
function setStacked$1 (line 1158) | function setStacked$1(options, stacked) {
function setXtitle$1 (line 1165) | function setXtitle$1(options, title) {
function setYtitle$1 (line 1169) | function setYtitle$1(options, title) {
function setFormatOptions (line 1175) | function setFormatOptions(chart, options, chartType) {
function hideLegend (line 1423) | function hideLegend(options, legend, hideLegend) {
function setTitle (line 1439) | function setTitle(options, title) {
function setMin (line 1444) | function setMin(options, min) {
function setMax (line 1448) | function setMax(options, max) {
function setBarMin (line 1452) | function setBarMin(options, min) {
function setBarMax (line 1456) | function setBarMax(options, max) {
function setStacked (line 1460) | function setStacked(options, stacked) {
function setXtitle (line 1464) | function setXtitle(options, title) {
function setYtitle (line 1469) | function setYtitle(options, title) {
function resize (line 1476) | function resize(callback) {
function getAdapterType (line 1796) | function getAdapterType(library) {
function addAdapter (line 1809) | function addAdapter(library) {
function loadAdapters (line 1821) | function loadAdapters() {
function callAdapter (line 1837) | function callAdapter(chartType, chart) {
function formatSeriesBubble (line 1896) | function formatSeriesBubble(data) {
function formatSeriesData (line 1906) | function formatSeriesData(data, keyType) {
function detectXType (line 1927) | function detectXType(series, noDatetime, options) {
function detectXTypeWithFunction (line 1943) | function detectXTypeWithFunction(series, func) {
function copySeries (line 1957) | function copySeries(series) {
function processSeries (line 1971) | function processSeries(chart, keyType, noDatetime) {
function processSimple (line 1998) | function processSimple(chart) {
function dataEmpty (line 2006) | function dataEmpty(data, chartType) {
function addDownloadButton (line 2019) | function addDownloadButton(chart) {
function pushRequest (line 2076) | function pushRequest(url, success, error) {
function runNext (line 2081) | function runNext() {
function requestComplete (line 2092) | function requestComplete() {
function getJSON (line 2097) | function getJSON(url, success, error) {
function setText (line 2114) | function setText(element, text) {
function chartError (line 2119) | function chartError(element, message, noPrefix) {
function errorCatcher (line 2127) | function errorCatcher(chart) {
function fetchDataSource (line 2136) | function fetchDataSource(chart, dataSource, showLoading) {
function renderChart (line 2166) | function renderChart(chartType, chart) {
function getElement (line 2179) | function getElement(element) {
function LineChart (line 2347) | function LineChart () {
function PieChart (line 2367) | function PieChart () {
function ColumnChart (line 2387) | function ColumnChart () {
function BarChart (line 2407) | function BarChart () {
function AreaChart (line 2427) | function AreaChart () {
function GeoChart (line 2447) | function GeoChart () {
function ScatterChart (line 2467) | function ScatterChart () {
function BubbleChart (line 2487) | function BubbleChart () {
function Timeline (line 2507) | function Timeline () {
FILE: app/assets/javascripts/pghero/jquery.js
function DOMEval (line 107) | function DOMEval( code, node, doc ) {
function toType (line 137) | function toType( obj ) {
function isArrayLike (line 507) | function isArrayLike( obj ) {
function Sizzle (line 759) | function Sizzle( selector, context, results, seed ) {
function createCache (line 928) | function createCache() {
function markFunction (line 948) | function markFunction( fn ) {
function assert (line 957) | function assert( fn ) {
function addHandle (line 981) | function addHandle( attrs, handler ) {
function siblingCheck (line 996) | function siblingCheck( a, b ) {
function createInputPseudo (line 1022) | function createInputPseudo( type ) {
function createButtonPseudo (line 1033) | function createButtonPseudo( type ) {
function createDisabledPseudo (line 1044) | function createDisabledPseudo( disabled ) {
function createPositionalPseudo (line 1100) | function createPositionalPseudo( fn ) {
function testContext (line 1123) | function testContext( context ) {
function setFilters (line 2377) | function setFilters() {}
function toSelector (line 2451) | function toSelector( tokens ) {
function addCombinator (line 2461) | function addCombinator( matcher, combinator, base ) {
function elementMatcher (line 2528) | function elementMatcher( matchers ) {
function multipleContexts (line 2542) | function multipleContexts( selector, contexts, results ) {
function condense (line 2551) | function condense( unmatched, map, filter, context, xml ) {
function setMatcher (line 2572) | function setMatcher( preFilter, selector, matcher, postFilter, postFinde...
function matcherFromTokens (line 2672) | function matcherFromTokens( tokens ) {
function matcherFromGroupMatchers (line 2735) | function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
function nodeName (line 3093) | function nodeName( elem, name ) {
function winnow (line 3103) | function winnow( elements, qualifier, not ) {
function sibling (line 3398) | function sibling( cur, dir ) {
function createOptions (line 3491) | function createOptions( options ) {
function Identity (line 3716) | function Identity( v ) {
function Thrower (line 3719) | function Thrower( ex ) {
function adoptValue (line 3723) | function adoptValue( value, resolve, reject, noValue ) {
function resolve (line 3816) | function resolve( depth, deferred, handler, special ) {
function completed (line 4181) | function completed() {
function fcamelCase (line 4276) | function fcamelCase( _all, letter ) {
function camelCase (line 4283) | function camelCase( string ) {
function Data (line 4300) | function Data() {
function getData (line 4469) | function getData( data ) {
function dataAttr (line 4494) | function dataAttr( elem, key, data ) {
function adjustCSS (line 4806) | function adjustCSS( elem, prop, valueParts, tween ) {
function getDefaultDisplay (line 4874) | function getDefaultDisplay( elem ) {
function showHide (line 4897) | function showHide( elements, show ) {
function getAll (line 5029) | function getAll( context, tag ) {
function setGlobalEval (line 5054) | function setGlobalEval( elems, refElements ) {
function buildFragment (line 5070) | function buildFragment( elems, context, scripts, selection, ignored ) {
function returnTrue (line 5162) | function returnTrue() {
function returnFalse (line 5166) | function returnFalse() {
function expectSync (line 5176) | function expectSync( elem, type ) {
function safeActiveElement (line 5183) | function safeActiveElement() {
function on (line 5189) | function on( elem, types, selector, data, fn, one ) {
function leverageNative (line 5677) | function leverageNative( el, type, expectSync ) {
function manipulationTarget (line 6027) | function manipulationTarget( elem, content ) {
function disableScript (line 6038) | function disableScript( elem ) {
function restoreScript (line 6042) | function restoreScript( elem ) {
function cloneCopyEvent (line 6052) | function cloneCopyEvent( src, dest ) {
function fixInput (line 6085) | function fixInput( src, dest ) {
function domManip (line 6098) | function domManip( collection, args, callback, ignored ) {
function remove (line 6196) | function remove( elem, selector, keepData ) {
function computeStyleTests (line 6522) | function computeStyleTests() {
function roundPixelMeasures (line 6566) | function roundPixelMeasures( measure ) {
function curCSS (line 6659) | function curCSS( elem, name, computed ) {
function addGetHookIf (line 6744) | function addGetHookIf( conditionFn, hookFn ) {
function vendorPropName (line 6769) | function vendorPropName( name ) {
function finalPropName (line 6784) | function finalPropName( name ) {
function setPositiveNumber (line 6809) | function setPositiveNumber( _elem, value, subtract ) {
function boxModelAdjustment (line 6821) | function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, ...
function getWidthOrHeight (line 6889) | function getWidthOrHeight( elem, dimension, extra ) {
function Tween (line 7265) | function Tween( elem, options, prop, end, easing ) {
function schedule (line 7388) | function schedule() {
function createFxNow (line 7401) | function createFxNow() {
function genFx (line 7409) | function genFx( type, includeWidth ) {
function createTween (line 7429) | function createTween( value, prop, animation ) {
function defaultPrefilter (line 7443) | function defaultPrefilter( elem, props, opts ) {
function propFilter (line 7615) | function propFilter( props, specialEasing ) {
function Animation (line 7652) | function Animation( elem, properties, options ) {
function stripAndCollapse (line 8366) | function stripAndCollapse( value ) {
function getClass (line 8372) | function getClass( elem ) {
function classesToArray (line 8376) | function classesToArray( value ) {
function buildParams (line 9004) | function buildParams( prefix, obj, traditional, add ) {
function addToPrefiltersOrTransports (line 9157) | function addToPrefiltersOrTransports( structure ) {
function inspectPrefiltersOrTransports (line 9191) | function inspectPrefiltersOrTransports( structure, options, originalOpti...
function ajaxExtend (line 9220) | function ajaxExtend( target, src ) {
function ajaxHandleResponses (line 9240) | function ajaxHandleResponses( s, jqXHR, responses ) {
function ajaxConvert (line 9298) | function ajaxConvert( s, response, jqXHR, isSuccess ) {
function done (line 9814) | function done( status, nativeStatusText, responses, headers ) {
FILE: app/assets/javascripts/pghero/nouislider.js
function isValidFormatter (line 23) | function isValidFormatter(entry) {
function isValidPartialFormatter (line 26) | function isValidPartialFormatter(entry) {
function removeElement (line 30) | function removeElement(el) {
function isSet (line 33) | function isSet(value) {
function preventDefault (line 37) | function preventDefault(e) {
function unique (line 41) | function unique(array) {
function closest (line 47) | function closest(value, to) {
function offset (line 51) | function offset(elem, orientation) {
function isNumeric (line 65) | function isNumeric(a) {
function addClassFor (line 69) | function addClassFor(element, className, duration) {
function limit (line 78) | function limit(a) {
function asArray (line 83) | function asArray(a) {
function countDecimals (line 87) | function countDecimals(numStr) {
function addClass (line 93) | function addClass(el, className) {
function removeClass (line 102) | function removeClass(el, className) {
function hasClass (line 111) | function hasClass(el, className) {
function getPageOffset (line 115) | function getPageOffset(doc) {
function getActions (line 136) | function getActions() {
function getSupportsPassive (line 159) | function getSupportsPassive() {
function getSupportsTouchActionNone (line 175) | function getSupportsTouchActionNone() {
function subRangeRatio (line 181) | function subRangeRatio(pa, pb) {
function fromPercentage (line 185) | function fromPercentage(range, value, startRange) {
function toPercentage (line 189) | function toPercentage(range, value) {
function isPercentage (line 193) | function isPercentage(range, value) {
function getJ (line 196) | function getJ(value, arr) {
function toStepping (line 204) | function toStepping(xVal, xPct, value) {
function fromStepping (line 216) | function fromStepping(xVal, xPct, value) {
function getStep (line 229) | function getStep(xPct, xSteps, snap, value) {
function Spectrum (line 252) | function Spectrum(entry, snap, singleStep) {
function testStep (line 530) | function testStep(parsed, entry) {
function testKeyboardPageMultiplier (line 538) | function testKeyboardPageMultiplier(parsed, entry) {
function testKeyboardMultiplier (line 544) | function testKeyboardMultiplier(parsed, entry) {
function testKeyboardDefaultStep (line 550) | function testKeyboardDefaultStep(parsed, entry) {
function testRange (line 556) | function testRange(parsed, entry) {
function testStart (line 567) | function testStart(parsed, entry) {
function testSnap (line 580) | function testSnap(parsed, entry) {
function testAnimate (line 587) | function testAnimate(parsed, entry) {
function testAnimationDuration (line 594) | function testAnimationDuration(parsed, entry) {
function testConnect (line 600) | function testConnect(parsed, entry) {
function testOrientation (line 626) | function testOrientation(parsed, entry) {
function testMargin (line 640) | function testMargin(parsed, entry) {
function testLimit (line 650) | function testLimit(parsed, entry) {
function testPadding (line 659) | function testPadding(parsed, entry) {
function testDirection (line 688) | function testDirection(parsed, entry) {
function testBehaviour (line 703) | function testBehaviour(parsed, entry) {
function testTooltips (line 739) | function testTooltips(parsed, entry) {
function testHandleAttributes (line 762) | function testHandleAttributes(parsed, entry) {
function testAriaFormat (line 768) | function testAriaFormat(parsed, entry) {
function testFormat (line 774) | function testFormat(parsed, entry) {
function testKeyboardSupport (line 780) | function testKeyboardSupport(parsed, entry) {
function testDocumentElement (line 786) | function testDocumentElement(parsed, entry) {
function testCssPrefix (line 790) | function testCssPrefix(parsed, entry) {
function testCssClasses (line 796) | function testCssClasses(parsed, entry) {
function testOptions (line 811) | function testOptions(options) {
function scope (line 899) | function scope(target, options, originalOptions) {
function initialize (line 2253) | function initialize(target, originalOptions) {
FILE: app/controllers/pg_hero/home_controller.rb
type PgHero (line 1) | module PgHero
class HomeController (line 2) | class HomeController < ActionController::Base
method index (line 26) | def index
method space (line 85) | def space
method relation_space (line 114) | def relation_space
method index_bloat (line 122) | def index_bloat
method live_queries (line 128) | def live_queries
method queries (line 138) | def queries
method show_query (line 180) | def show_query
method system (line 214) | def system
method cpu_usage (line 237) | def cpu_usage
method connection_stats (line 241) | def connection_stats
method replication_lag_stats (line 245) | def replication_lag_stats
method load_stats (line 249) | def load_stats
method free_space_stats (line 277) | def free_space_stats
method explain (line 283) | def explain
method tune (line 345) | def tune
method connections (line 351) | def connections
method maintenance (line 390) | def maintenance
method kill (line 397) | def kill
method kill_long_running_queries (line 405) | def kill_long_running_queries
method kill_all (line 410) | def kill_all
method enable_query_stats (line 415) | def enable_query_stats
method reset_query_stats (line 423) | def reset_query_stats
method redirect_backward (line 440) | def redirect_backward(**options)
method set_database (line 444) | def set_database
method default_url_options (line 456) | def default_url_options
method set_query_stats_enabled (line 460) | def set_query_stats_enabled
method set_suggested_indexes (line 467) | def set_suggested_indexes(min_average_time = 0, min_calls = 0)
method system_params (line 484) | def system_params
method chart_library_options (line 492) | def chart_library_options
method set_show_details (line 496) | def set_show_details
method group_connections (line 501) | def group_connections(connections, keys)
method group_connections_by_key (line 508) | def group_connections_by_key(connections, key)
method check_api (line 512) | def check_api
method render_text (line 518) | def render_text(message, status:)
method ensure_query_stats (line 522) | def ensure_query_stats
method rescue_timeout (line 530) | def rescue_timeout(default)
FILE: app/helpers/pg_hero/home_helper.rb
type PgHero (line 1) | module PgHero
type HomeHelper (line 2) | module HomeHelper
function pghero_pretty_ident (line 3) | def pghero_pretty_ident(table, schema: nil)
function pghero_js_value (line 15) | def pghero_js_value(value)
function pghero_remove_index (line 19) | def pghero_remove_index(query)
function pghero_formatted_vacuum_times (line 30) | def pghero_formatted_vacuum_times(time)
function pghero_formatted_date_time (line 36) | def pghero_formatted_date_time(time)
FILE: lib/generators/pghero/config_generator.rb
type Pghero (line 3) | module Pghero
type Generators (line 4) | module Generators
class ConfigGenerator (line 5) | class ConfigGenerator < Rails::Generators::Base
method create_initializer (line 8) | def create_initializer
FILE: lib/generators/pghero/query_stats_generator.rb
type Pghero (line 4) | module Pghero
type Generators (line 5) | module Generators
class QueryStatsGenerator (line 6) | class QueryStatsGenerator < Rails::Generators::Base
method copy_migration (line 10) | def copy_migration
method migration_version (line 14) | def migration_version
FILE: lib/generators/pghero/space_stats_generator.rb
type Pghero (line 4) | module Pghero
type Generators (line 5) | module Generators
class SpaceStatsGenerator (line 6) | class SpaceStatsGenerator < Rails::Generators::Base
method copy_migration (line 10) | def copy_migration
method migration_version (line 14) | def migration_version
FILE: lib/pghero.rb
type PgHero (line 30) | module PgHero
class Error (line 36) | class Error < StandardError; end
class NotEnabled (line 37) | class NotEnabled < Error; end
function time_zone= (line 71) | def time_zone=(time_zone)
function time_zone (line 75) | def time_zone
function username (line 81) | def username
function password (line 87) | def password
function stats_database_url (line 92) | def stats_database_url
function explain_enabled? (line 97) | def explain_enabled?
function explain_mode (line 102) | def explain_mode
function visualize_url (line 106) | def visualize_url
function config (line 110) | def config
function file_config (line 115) | def file_config
function default_config (line 143) | def default_config
function databases (line 173) | def databases
function primary_database (line 187) | def primary_database
function capture_query_stats (line 191) | def capture_query_stats(verbose: false)
function capture_space_stats (line 199) | def capture_space_stats(verbose: false)
function analyze_all (line 206) | def analyze_all(**options)
function autoindex_all (line 213) | def autoindex_all(create: false, verbose: true)
function pretty_size (line 220) | def pretty_size(value)
function clean_query_stats (line 227) | def clean_query_stats(before: nil)
function clean_space_stats (line 233) | def clean_space_stats(before: nil)
function connection_config (line 240) | def connection_config(model)
function spec_name_key (line 245) | def spec_name_key
function include_replicas_key (line 250) | def include_replicas_key
function each_database (line 256) | def each_database
FILE: lib/pghero/connection.rb
type PgHero (line 1) | module PgHero
class Connection (line 2) | class Connection < ActiveRecord::Base
FILE: lib/pghero/database.rb
type PgHero (line 1) | module PgHero
class Database (line 2) | class Database
method initialize (line 23) | def initialize(id, config)
method name (line 33) | def name
method capture_query_stats? (line 37) | def capture_query_stats?
method cache_hit_rate_threshold (line 41) | def cache_hit_rate_threshold
method total_connections_threshold (line 45) | def total_connections_threshold
method slow_query_ms (line 49) | def slow_query_ms
method slow_query_calls (line 53) | def slow_query_calls
method explain_timeout_sec (line 57) | def explain_timeout_sec
method long_running_query_sec (line 61) | def long_running_query_sec
method index_bloat_bytes (line 66) | def index_bloat_bytes
method aws_access_key_id (line 70) | def aws_access_key_id
method aws_secret_access_key (line 74) | def aws_secret_access_key
method aws_region (line 78) | def aws_region
method aws_db_instance_identifier (line 83) | def aws_db_instance_identifier
method gcp_database_id (line 88) | def gcp_database_id
method azure_resource_id (line 93) | def azure_resource_id
method filter_data (line 98) | def filter_data
method connection_model (line 124) | def connection_model
method build_connection_model (line 140) | def build_connection_model
FILE: lib/pghero/engine.rb
type PgHero (line 1) | module PgHero
class Engine (line 2) | class Engine < ::Rails::Engine
FILE: lib/pghero/methods/basic.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Basic (line 3) | module Basic
function ssl_used? (line 4) | def ssl_used?
function database_name (line 17) | def database_name
function current_user (line 21) | def current_user
function server_version (line 25) | def server_version
function server_version_num (line 29) | def server_version_num
function quote_ident (line 33) | def quote_ident(value)
function select_all (line 39) | def select_all(sql, stats: false, query_columns: [])
function select_all_leased (line 45) | def select_all_leased(sql, conn:, query_columns:)
function select_all_stats (line 88) | def select_all_stats(sql, **options)
function select_all_size (line 92) | def select_all_size(sql)
function select_one (line 100) | def select_one(sql)
function execute (line 104) | def execute(sql)
function with_connection (line 108) | def with_connection(stats: false, &block)
function squish (line 113) | def squish(str)
function add_source (line 117) | def add_source(sql)
function quote (line 121) | def quote(value)
function quote_table_name (line 125) | def quote_table_name(value)
function quote_column_name (line 129) | def quote_column_name(value)
function unquote (line 133) | def unquote(part)
function with_transaction (line 141) | def with_transaction(lock_timeout: nil, statement_timeout: nil, ro...
function table_exists? (line 150) | def table_exists?(table)
FILE: lib/pghero/methods/connections.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Connections (line 3) | module Connections
function connections (line 4) | def connections
function total_connections (line 39) | def total_connections
function connection_states (line 43) | def connection_states
function connection_sources (line 59) | def connection_sources
FILE: lib/pghero/methods/constraints.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Constraints (line 3) | module Constraints
function invalid_constraints (line 6) | def invalid_constraints
FILE: lib/pghero/methods/explain.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Explain (line 3) | module Explain
function explain (line 6) | def explain(sql)
function explain_v2 (line 23) | def explain_v2(sql, analyze: nil, verbose: nil, costs: nil, settin...
function explain_safe? (line 41) | def explain_safe?
function add_explain_option (line 48) | def add_explain_option(options, name, value)
function explain_format (line 55) | def explain_format(format)
FILE: lib/pghero/methods/indexes.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Indexes (line 3) | module Indexes
function index_hit_rate (line 4) | def index_hit_rate
function index_caching (line 13) | def index_caching
function index_usage (line 31) | def index_usage
function missing_indexes (line 49) | def missing_indexes
function unused_indexes (line 71) | def unused_indexes(max_scans: 50, across: [])
function reset_stats (line 101) | def reset_stats
function last_stats_reset_time (line 106) | def last_stats_reset_time
function invalid_indexes (line 117) | def invalid_indexes(indexes: nil)
function indexes (line 128) | def indexes
function duplicate_indexes (line 171) | def duplicate_indexes(indexes: nil)
function index_bloat (line 187) | def index_bloat(min_size: nil)
function index_covers? (line 327) | def index_covers?(indexed_columns, columns)
FILE: lib/pghero/methods/kill.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Kill (line 3) | module Kill
function kill (line 4) | def kill(pid)
function kill_long_running_queries (line 8) | def kill_long_running_queries(min_duration: nil)
function kill_all (line 13) | def kill_all
FILE: lib/pghero/methods/maintenance.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Maintenance (line 3) | module Maintenance
function transaction_id_danger (line 8) | def transaction_id_danger(threshold: 10000000, max_value: 2146483648)
function autovacuum_danger (line 31) | def autovacuum_danger
function vacuum_progress (line 36) | def vacuum_progress
function maintenance_info (line 52) | def maintenance_info
function analyze (line 70) | def analyze(table, verbose: false)
function analyze_tables (line 75) | def analyze_tables(verbose: false, min_size: nil, tables: nil)
FILE: lib/pghero/methods/queries.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Queries (line 3) | module Queries
function running_queries (line 4) | def running_queries(min_duration: nil, all: false)
function long_running_queries (line 32) | def long_running_queries
function blocked_queries (line 38) | def blocked_queries
FILE: lib/pghero/methods/query_stats.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type QueryStats (line 3) | module QueryStats
function query_stats (line 4) | def query_stats(historical: false, start_at: nil, end_at: nil, min...
function query_stats_available? (line 29) | def query_stats_available?
function query_stats_enabled? (line 34) | def query_stats_enabled?
function query_stats_extension_enabled? (line 38) | def query_stats_extension_enabled?
function query_stats_readable? (line 42) | def query_stats_readable?
function enable_query_stats (line 49) | def enable_query_stats
function disable_query_stats (line 54) | def disable_query_stats
function reset_query_stats (line 59) | def reset_query_stats(**options)
function reset_instance_query_stats (line 67) | def reset_instance_query_stats(database: nil, user: nil, query_has...
function historical_query_stats_enabled? (line 105) | def historical_query_stats_enabled?
function query_stats_table_exists? (line 111) | def query_stats_table_exists?
function missing_query_stats_columns (line 115) | def missing_query_stats_columns
function supports_query_hash? (line 119) | def supports_query_hash?
function capture_query_stats (line 128) | def capture_query_stats(raise_errors: false)
function clean_query_stats (line 165) | def clean_query_stats(before: nil)
function slow_queries (line 170) | def slow_queries(query_stats: nil, **options)
function query_hash_stats (line 175) | def query_hash_stats(query_hash, user: nil, current: false)
function current_query_stats (line 212) | def current_query_stats(limit: nil, sort: nil, database: nil, quer...
function historical_query_stats (line 265) | def historical_query_stats(sort: nil, start_at: nil, end_at: nil, ...
function combine_query_stats (line 313) | def combine_query_stats(grouped_stats)
function explainable? (line 331) | def explainable?(query)
function normalize_query (line 337) | def normalize_query(query)
function insert_query_stats (line 341) | def insert_query_stats(db_id, db_query_stats, now)
FILE: lib/pghero/methods/replication.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Replication (line 3) | module Replication
function replica? (line 4) | def replica?
function replication_lag (line 12) | def replication_lag
function replication_slots (line 32) | def replication_slots
function replicating? (line 48) | def replicating?
function feature_support (line 56) | def feature_support
function with_feature_support (line 60) | def with_feature_support(cache_key, default = nil)
FILE: lib/pghero/methods/sequences.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Sequences (line 3) | module Sequences
function sequences (line 4) | def sequences
function sequence_danger (line 59) | def sequence_danger(threshold: 0.9, sequences: nil)
function parse_default_value (line 69) | def parse_default_value(default_value)
function unquote_ident (line 79) | def unquote_ident(value)
function add_sequence_attributes (line 90) | def add_sequence_attributes(sequences)
FILE: lib/pghero/methods/settings.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Settings (line 3) | module Settings
function settings (line 4) | def settings
function autovacuum_settings (line 29) | def autovacuum_settings
function vacuum_settings (line 33) | def vacuum_settings
function fetch_settings (line 39) | def fetch_settings(names)
FILE: lib/pghero/methods/space.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Space (line 3) | module Space
function database_size (line 4) | def database_size
function relation_sizes (line 8) | def relation_sizes
function table_sizes (line 29) | def table_sizes
function space_growth (line 49) | def space_growth(days: 7, relation_sizes: nil)
function relation_space_stats (line 92) | def relation_space_stats(relation, schema: "public")
function capture_space_stats (line 122) | def capture_space_stats
function clean_space_stats (line 137) | def clean_space_stats(before: nil)
function space_stats_enabled? (line 142) | def space_stats_enabled?
FILE: lib/pghero/methods/suggested_indexes.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type SuggestedIndexes (line 3) | module SuggestedIndexes
function suggested_indexes_enabled? (line 4) | def suggested_indexes_enabled?
function suggested_indexes_by_query (line 9) | def suggested_indexes_by_query(queries: nil, query_stats: nil, ind...
function suggested_indexes (line 64) | def suggested_indexes(suggested_indexes_by_query: nil, **options)
function autoindex (line 78) | def autoindex(create: false)
function best_index (line 89) | def best_index(statement)
function best_index_helper (line 95) | def best_index_helper(statements)
function best_index_structure (line 198) | def best_index_structure(statement)
function row_estimates (line 239) | def row_estimates(stats, total_rows, rows_left, op)
function parse_table (line 271) | def parse_table(tree)
function parse_where (line 283) | def parse_where(tree)
function str_method (line 302) | def str_method
function parse_sort (line 306) | def parse_sort(sort_clause)
function column_stats (line 315) | def column_stats(schema: nil, table: nil)
FILE: lib/pghero/methods/system.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type System (line 3) | module System
function system_stats_enabled? (line 4) | def system_stats_enabled?
function system_stats_provider (line 8) | def system_stats_provider
function cpu_usage (line 18) | def cpu_usage(**options)
function connection_stats (line 22) | def connection_stats(**options)
function replication_lag_stats (line 26) | def replication_lag_stats(**options)
function read_iops_stats (line 30) | def read_iops_stats(**options)
function write_iops_stats (line 34) | def write_iops_stats(**options)
function free_space_stats (line 38) | def free_space_stats(**options)
function rds_stats (line 42) | def rds_stats(metric_name, duration: nil, period: nil, offset: nil...
function azure_stats (line 80) | def azure_stats(metric_name, duration: nil, period: nil, offset: n...
function gcp_stats (line 130) | def gcp_stats(metric_name, duration: nil, period: nil, offset: nil...
function system_stats (line 240) | def system_stats(metric_key, **options)
function azure_flexible_server? (line 289) | def azure_flexible_server?
function free_space (line 295) | def free_space(quota, used)
function add_missing_data (line 303) | def add_missing_data(data, start_time, end_time, period)
FILE: lib/pghero/methods/tables.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Tables (line 3) | module Tables
function table_hit_rate (line 4) | def table_hit_rate
function table_caching (line 13) | def table_caching
function unused_tables (line 30) | def unused_tables
function table_stats (line 46) | def table_stats(schema: nil, table: nil)
FILE: lib/pghero/methods/users.rb
type PgHero (line 1) | module PgHero
type Methods (line 2) | module Methods
type Users (line 3) | module Users
function create_user (line 6) | def create_user(user, password: nil, schema: "public", database: n...
function drop_user (line 50) | def drop_user(user, schema: "public", database: nil)
function random_password (line 83) | def random_password
function table_grant_commands (line 88) | def table_grant_commands(privilege, tables, quoted_user)
FILE: lib/pghero/query_stats.rb
type PgHero (line 1) | module PgHero
class QueryStats (line 2) | class QueryStats < Stats
FILE: lib/pghero/space_stats.rb
type PgHero (line 1) | module PgHero
class SpaceStats (line 2) | class SpaceStats < Stats
FILE: lib/pghero/stats.rb
type PgHero (line 1) | module PgHero
class Stats (line 2) | class Stats < ActiveRecord::Base
FILE: lib/pghero/version.rb
type PgHero (line 1) | module PgHero
FILE: test/basic_test.rb
class BasicTest (line 3) | class BasicTest < Minitest::Test
method test_ssl_used? (line 4) | def test_ssl_used?
method test_database_name (line 8) | def test_database_name
method test_server_version (line 12) | def test_server_version
method test_server_version_num (line 16) | def test_server_version_num
FILE: test/best_index_test.rb
class BestIndexTest (line 3) | class BestIndexTest < Minitest::Test
method test_where (line 4) | def test_where
method test_all_values (line 8) | def test_all_values
method test_where_multiple_columns (line 21) | def test_where_multiple_columns
method test_where_unique (line 25) | def test_where_unique
method test_order (line 29) | def test_order
method test_order_multiple (line 33) | def test_order_multiple
method test_order_multiple_direction (line 37) | def test_order_multiple_direction
method test_order_multiple_unique (line 41) | def test_order_multiple_unique
method test_where_unique_order (line 45) | def test_where_unique_order
method test_where_order (line 49) | def test_where_order
method test_where_order_unknown (line 53) | def test_where_order_unknown
method test_where_in (line 57) | def test_where_in
method test_like (line 61) | def test_like
method test_like_where (line 65) | def test_like_where
method test_like_where2 (line 69) | def test_like_where2
method test_ilike (line 73) | def test_ilike
method test_not_equals (line 77) | def test_not_equals
method test_not_in (line 81) | def test_not_in
method test_between (line 85) | def test_between
method test_multiple_range (line 89) | def test_multiple_range
method test_where_prepared (line 93) | def test_where_prepared
method test_where_normalized (line 97) | def test_where_normalized
method test_is_null (line 101) | def test_is_null
method test_is_null_equal (line 105) | def test_is_null_equal
method test_is_not_null (line 109) | def test_is_not_null
method test_update (line 113) | def test_update
method test_delete (line 117) | def test_delete
method test_parse_error (line 121) | def test_parse_error
method test_stats_not_found (line 125) | def test_stats_not_found
method test_unknown_structure (line 129) | def test_unknown_structure
method test_where_or (line 133) | def test_where_or
method test_where_nested_or (line 137) | def test_where_nested_or
method test_multiple_tables (line 141) | def test_multiple_tables
method test_no_columns (line 145) | def test_no_columns
method test_small_table (line 149) | def test_small_table
method test_system_table (line 153) | def test_system_table
method test_insert (line 157) | def test_insert
method test_set (line 161) | def test_set
method test_empty_statement (line 165) | def test_empty_statement
method assert_best_index (line 171) | def assert_best_index(expected, statement)
method assert_no_index (line 178) | def assert_no_index(explanation, statement)
FILE: test/config_generator_test.rb
class ConfigGeneratorTest (line 5) | class ConfigGeneratorTest < Rails::Generators::TestCase
method test_works (line 10) | def test_works
FILE: test/connections_test.rb
class ConnectionsTest (line 3) | class ConnectionsTest < Minitest::Test
method test_connections (line 4) | def test_connections
method test_total_connections (line 8) | def test_total_connections
method test_connection_states (line 12) | def test_connection_states
method test_connection_sources (line 16) | def test_connection_sources
FILE: test/constraints_test.rb
class ConstraintsTest (line 3) | class ConstraintsTest < Minitest::Test
method test_invalid_constraints (line 4) | def test_invalid_constraints
FILE: test/controller_test.rb
class ControllerTest (line 3) | class ControllerTest < ActionDispatch::IntegrationTest
method test_index (line 4) | def test_index
method test_space (line 9) | def test_space
method test_relation_space (line 14) | def test_relation_space
method test_index_bloat (line 19) | def test_index_bloat
method test_live_queries (line 24) | def test_live_queries
method test_queries (line 29) | def test_queries
method test_show_query (line 34) | def test_show_query
method test_system (line 39) | def test_system
method test_explain (line 44) | def test_explain
method test_explain_not_enabled (line 49) | def test_explain_not_enabled
method test_explain_only (line 57) | def test_explain_only
method test_explain_only_normalized (line 65) | def test_explain_only_normalized
method test_explain_only_not_enabled (line 77) | def test_explain_only_not_enabled
method test_explain_only_analyze (line 85) | def test_explain_only_analyze
method test_explain_analyze (line 93) | def test_explain_analyze
method test_explain_analyze_normalized (line 103) | def test_explain_analyze_normalized
method test_explain_analyze_timeout (line 115) | def test_explain_analyze_timeout
method test_explain_analyze_not_enabled (line 125) | def test_explain_analyze_not_enabled
method test_explain_visualize (line 131) | def test_explain_visualize
method test_explain_visualize_analyze (line 139) | def test_explain_visualize_analyze
method test_explain_visualize_normalized (line 149) | def test_explain_visualize_normalized
method test_tune (line 164) | def test_tune
method test_connections (line 169) | def test_connections
method test_maintenance (line 174) | def test_maintenance
method test_reset_query_stats (line 185) | def test_reset_query_stats
FILE: test/database_test.rb
class DatabaseTest (line 3) | class DatabaseTest < Minitest::Test
method test_id (line 4) | def test_id
method test_name (line 8) | def test_name
FILE: test/explain_test.rb
class ExplainTest (line 3) | class ExplainTest < Minitest::Test
method setup (line 4) | def setup
method test_explain (line 8) | def test_explain
method test_explain_analyze (line 12) | def test_explain_analyze
method test_explain_statement_timeout (line 19) | def test_explain_statement_timeout
method test_explain_multiple_statements (line 29) | def test_explain_multiple_statements
method test_explain_v2 (line 34) | def test_explain_v2
method test_explain_v2_analyze (line 43) | def test_explain_v2_analyze
method test_explain_v2_generic_plan (line 57) | def test_explain_v2_generic_plan
method test_explain_v2_format_text (line 67) | def test_explain_v2_format_text
method test_explain_v2_format_json (line 71) | def test_explain_v2_format_json
method test_explain_v2_format_xml (line 75) | def test_explain_v2_format_xml
method test_explain_v2_format_yaml (line 79) | def test_explain_v2_format_yaml
method test_explain_v2_format_bad (line 83) | def test_explain_v2_format_bad
FILE: test/indexes_test.rb
class IndexesTest (line 3) | class IndexesTest < Minitest::Test
method test_index_hit_rate (line 4) | def test_index_hit_rate
method test_index_caching (line 9) | def test_index_caching
method test_index_usage (line 13) | def test_index_usage
method test_missing_indexes (line 17) | def test_missing_indexes
method test_unused_indexes (line 21) | def test_unused_indexes
method test_reset_stats (line 25) | def test_reset_stats
method test_last_stats_reset_time (line 29) | def test_last_stats_reset_time
method test_invalid_indexes (line 34) | def test_invalid_indexes
method test_indexes (line 38) | def test_indexes
method test_duplicate_indexes (line 42) | def test_duplicate_indexes
method test_index_bloat (line 46) | def test_index_bloat
FILE: test/kill_test.rb
class KillTest (line 3) | class KillTest < Minitest::Test
method test_kill (line 4) | def test_kill
method test_kill_long_running_queries (line 9) | def test_kill_long_running_queries
method test_kill_all (line 13) | def test_kill_all
FILE: test/maintenance_test.rb
class MaintenanceTest (line 3) | class MaintenanceTest < Minitest::Test
method test_transaction_id_danger (line 4) | def test_transaction_id_danger
method test_autovacuum_danger (line 9) | def test_autovacuum_danger
method test_vacuum_progress (line 13) | def test_vacuum_progress
method test_maintenance_info (line 17) | def test_maintenance_info
method test_analyze (line 21) | def test_analyze
method test_analyze_tables (line 25) | def test_analyze_tables
FILE: test/module_test.rb
class ModuleTest (line 3) | class ModuleTest < Minitest::Test
method test_databases (line 4) | def test_databases
method test_connection_pool (line 8) | def test_connection_pool
method test_analyze_all (line 26) | def test_analyze_all
method test_clean_query_stats (line 30) | def test_clean_query_stats
method test_clean_space_stats (line 34) | def test_clean_space_stats
FILE: test/queries_test.rb
class QueriesTest (line 3) | class QueriesTest < Minitest::Test
method test_running_queries (line 4) | def test_running_queries
method test_filter_data (line 8) | def test_filter_data
method test_long_running_queries (line 23) | def test_long_running_queries
method test_blocked_queries (line 27) | def test_blocked_queries
method with_filter_data (line 31) | def with_filter_data
FILE: test/query_stats_generator_test.rb
class QueryStatsGeneratorTest (line 5) | class QueryStatsGeneratorTest < Rails::Generators::TestCase
method test_works (line 10) | def test_works
FILE: test/query_stats_test.rb
class QueryStatsTest (line 3) | class QueryStatsTest < Minitest::Test
method test_query_stats (line 4) | def test_query_stats
method test_query_stats_available (line 8) | def test_query_stats_available
method test_query_stats_enabled (line 12) | def test_query_stats_enabled
method test_query_stats_extension_enabled (line 16) | def test_query_stats_extension_enabled
method test_query_stats_readable? (line 20) | def test_query_stats_readable?
method test_enable_query_stats (line 24) | def test_enable_query_stats
method test_reset_query_stats (line 29) | def test_reset_query_stats
method test_reset_instance_query_stats (line 35) | def test_reset_instance_query_stats
method test_reset_instance_query_stats_database (line 39) | def test_reset_instance_query_stats_database
method test_reset_instance_query_stats_database_invalid (line 52) | def test_reset_instance_query_stats_database_invalid
method test_reset_query_stats_user (line 61) | def test_reset_query_stats_user
method test_reset_query_stats_user_invalid (line 74) | def test_reset_query_stats_user_invalid
method test_reset_query_stats_query_hash (line 83) | def test_reset_query_stats_query_hash
method test_reset_query_stats_query_hash_invalid (line 100) | def test_reset_query_stats_query_hash_invalid
method test_historical_query_stats_enabled (line 109) | def test_historical_query_stats_enabled
method test_capture_query_stats (line 113) | def test_capture_query_stats
method test_clean_query_stats (line 121) | def test_clean_query_stats
method test_slow_queries (line 125) | def test_slow_queries
method gte12? (line 129) | def gte12?
FILE: test/replication_test.rb
class ReplicationTest (line 3) | class ReplicationTest < Minitest::Test
method test_replica (line 4) | def test_replica
method test_replication_lag (line 8) | def test_replication_lag
method test_replication_slots (line 12) | def test_replication_slots
method test_replicating (line 16) | def test_replicating
FILE: test/sequences_test.rb
class SequencesTest (line 3) | class SequencesTest < Minitest::Test
method test_sequences (line 4) | def test_sequences
method test_sequences_last_value (line 16) | def test_sequences_last_value
method test_sequence_danger (line 22) | def test_sequence_danger
FILE: test/settings_test.rb
class SettingsTest (line 3) | class SettingsTest < Minitest::Test
method test_settings (line 4) | def test_settings
method test_autovacuum_settings (line 8) | def test_autovacuum_settings
method test_vacuum_settings (line 12) | def test_vacuum_settings
FILE: test/space_stats_generator_test.rb
class SpaceStatsGeneratorTest (line 5) | class SpaceStatsGeneratorTest < Rails::Generators::TestCase
method test_works (line 10) | def test_works
FILE: test/space_test.rb
class SpaceTest (line 3) | class SpaceTest < Minitest::Test
method test_database_size (line 4) | def test_database_size
method test_relation_sizes (line 8) | def test_relation_sizes
method test_table_sizes (line 15) | def test_table_sizes
method test_space_growth (line 19) | def test_space_growth
method test_relation_space_stats (line 23) | def test_relation_space_stats
method test_capture_space_stats (line 27) | def test_capture_space_stats
method test_clean_space_stats (line 34) | def test_clean_space_stats
method test_space_stats_enabled (line 38) | def test_space_stats_enabled
FILE: test/suggested_indexes_test.rb
class SuggestedIndexesTest (line 3) | class SuggestedIndexesTest < Minitest::Test
method setup (line 4) | def setup
method test_suggested_indexes_enabled (line 12) | def test_suggested_indexes_enabled
method test_basic (line 16) | def test_basic
method test_existing_index (line 21) | def test_existing_index
method test_primary_key (line 26) | def test_primary_key
method test_hash (line 32) | def test_hash
method test_hash_multiple_values (line 38) | def test_hash_multiple_values
method test_hash_greater_than (line 44) | def test_hash_greater_than
method test_gist_trgm (line 50) | def test_gist_trgm
method test_ltree (line 56) | def test_ltree
method test_range (line 62) | def test_range
method test_inet (line 68) | def test_inet
method test_inet_greater_than (line 74) | def test_inet_greater_than
method test_brin (line 80) | def test_brin
method test_brin_order (line 86) | def test_brin_order
method test_gin (line 92) | def test_gin
FILE: test/system_test.rb
class SystemTest (line 3) | class SystemTest < Minitest::Test
method test_system_stats_enabled (line 4) | def test_system_stats_enabled
method test_system_stats_provider (line 8) | def test_system_stats_provider
FILE: test/tables_test.rb
class TablesTest (line 3) | class TablesTest < Minitest::Test
method test_table_hit_rate (line 4) | def test_table_hit_rate
method test_table_caching (line 9) | def test_table_caching
method test_unused_tables (line 13) | def test_unused_tables
method test_table_stats (line 17) | def test_table_stats
FILE: test/test_helper.rb
class Minitest::Test (line 6) | class Minitest::Test
method database (line 7) | def database
method with_explain (line 11) | def with_explain(value)
method with_explain_timeout (line 18) | def with_explain_timeout(value)
method explain_normalized? (line 28) | def explain_normalized?
class City (line 42) | class City < ActiveRecord::Base
class State (line 45) | class State < ActiveRecord::Base
class User (line 48) | class User < ActiveRecord::Base
FILE: test/users_test.rb
class UsersTest (line 3) | class UsersTest < Minitest::Test
method teardown (line 4) | def teardown
method test_create_user (line 8) | def test_create_user
method test_create_user_tables (line 12) | def test_create_user_tables
method user (line 16) | def user
Condensed preview — 120 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,799K chars).
[
{
"path": ".gitattributes",
"chars": 32,
"preview": "app/assets/** linguist-vendored\n"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 28,
"preview": "blank_issues_enabled: false\n"
},
{
"path": ".github/ISSUE_TEMPLATE/issue.md",
"chars": 187,
"preview": "---\nname: Issue\nabout: Create an issue\n---\n\nHi,\n\nBefore creating an issue, please check out the Contributing Guide:\n\nhtt"
},
{
"path": ".github/workflows/build.yml",
"chars": 1045,
"preview": "name: build\non: [push, pull_request]\njobs:\n build:\n runs-on: ${{ matrix.os || 'ubuntu-latest' }}\n strategy:\n "
},
{
"path": ".gitignore",
"chars": 176,
"preview": "*.gem\n*.rbc\n.bundle\n.config\n.yardoc\n*.lock\nInstalledFiles\n_yardoc\ncoverage\ndoc/\nlib/bundler/man\npkg\nrdoc\nspec/reports\nte"
},
{
"path": "CHANGELOG.md",
"chars": 12975,
"preview": "## 3.7.0 (2025-05-26)\n\n- Dropped support for Linux package for Ubuntu 20.04\n- Dropped support for Ruby < 3.2 and Rails <"
},
{
"path": "CONTRIBUTING.md",
"chars": 1327,
"preview": "# Contributing\n\nFirst, thanks for wanting to contribute. You’re awesome! :heart:\n\n## Help\n\nWe’re not able to provide sup"
},
{
"path": "Gemfile",
"chars": 205,
"preview": "source \"https://rubygems.org\"\n\ngemspec\n\ngem \"rake\"\ngem \"minitest\"\ngem \"activerecord\", \"~> 8.1.0\"\ngem \"combustion\"\ngem \"p"
},
{
"path": "LICENSE.txt",
"chars": 1109,
"preview": "Copyright (c) 2014-2025 Andrew Kane, 2008-2014 Heroku (initial queries)\n\nMIT License\n\nPermission is hereby granted, free"
},
{
"path": "README.md",
"chars": 1734,
"preview": "# PgHero\n\nA performance dashboard for Postgres\n\n[See it in action](https://pghero.dokkuapp.com/)\n\n[ 2023 Chart.js Contributors\n * Released under the MIT License\n *"
},
{
"path": "app/assets/javascripts/pghero/application.js",
"chars": 4459,
"preview": "//= require ./jquery\n//= require ./nouislider\n//= require ./Chart.bundle\n//= require ./chartkick\n//= require ./highlight"
},
{
"path": "app/assets/javascripts/pghero/chartkick.js",
"chars": 71520,
"preview": "/*!\n * Chartkick.js v5.0.1\n * Create beautiful charts with one line of JavaScript\n * https://github.com/ankane/chartkick"
},
{
"path": "app/assets/javascripts/pghero/jquery.js",
"chars": 293671,
"preview": "/*!\n * jQuery JavaScript Library v3.6.3\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * C"
},
{
"path": "app/assets/javascripts/pghero/nouislider.js",
"chars": 103435,
"preview": "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n "
},
{
"path": "app/assets/stylesheets/pghero/application.css",
"chars": 7274,
"preview": "/*\n *= require ./nouislider\n *= require ./arduino-light\n *= require_self\n */\n\nhtml {\n box-sizing: border-box;\n font-si"
},
{
"path": "app/assets/stylesheets/pghero/arduino-light.css",
"chars": 994,
"preview": "/*\n\nArduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>\n\n*/\n\n.hljs {\n display: block;\n overflow-x: auto;\n}\n\n."
},
{
"path": "app/assets/stylesheets/pghero/nouislider.css",
"chars": 5716,
"preview": "/* Functional styling;\n * These styles are required for noUiSlider to function.\n * You don't need to change these rules "
},
{
"path": "app/controllers/pg_hero/home_controller.rb",
"chars": 20148,
"preview": "module PgHero\n class HomeController < ActionController::Base\n http_basic_authenticate_with name: PgHero.username, pa"
},
{
"path": "app/helpers/pg_hero/home_helper.rb",
"chars": 1153,
"preview": "module PgHero\n module HomeHelper\n def pghero_pretty_ident(table, schema: nil)\n ident = table\n if schema &&"
},
{
"path": "app/views/layouts/pg_hero/application.html.erb",
"chars": 3475,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <title><%= [@databases.size > 1 ? @database.name : \"PgHero\", @title].compact.join(\" "
},
{
"path": "app/views/pg_hero/home/_connections_table.html.erb",
"chars": 465,
"preview": "<table class=\"table\">\n <thead>\n <tr>\n <th>Top Sources</th>\n <th class=\"width-20\">Connections</th>\n </tr"
},
{
"path": "app/views/pg_hero/home/_live_queries_table.html.erb",
"chars": 1703,
"preview": "<table class=\"table queries\">\n <thead>\n <tr>\n <th class=\"width-25\">Pid</th>\n <th class=\"width-25\">Duration"
},
{
"path": "app/views/pg_hero/home/_queries_table.html.erb",
"chars": 2649,
"preview": "<table class=\"table queries-table\">\n <% unless local_assigns[:xhr] %>\n <thead>\n <tr>\n <th class=\"width-3"
},
{
"path": "app/views/pg_hero/home/_query_stats_slider.html.erb",
"chars": 543,
"preview": "<div id=\"slider-container\">\n <div id=\"slider\"></div>\n <div id=\"range-end\"></div>\n <div id=\"range-start\"></div>\n</div>"
},
{
"path": "app/views/pg_hero/home/_suggested_index.html.erb",
"chars": 1077,
"preview": "<% if index && !details[:covering_index] %>\n <% unless @debug %>\n <div class=\"show-details\">Details</div>\n <% end %"
},
{
"path": "app/views/pg_hero/home/connections.html.erb",
"chars": 1024,
"preview": "<div class=\"content\">\n <h1>Connections</h1>\n\n <p><%= pluralize(@total_connections, \"connection\") %></p>\n\n <% if @tota"
},
{
"path": "app/views/pg_hero/home/explain.html.erb",
"chars": 1119,
"preview": "<div class=\"content\">\n <h1>Explain</h1>\n\n <%= form_tag explain_path do %>\n <div class=\"field\"><%= text_area_tag :qu"
},
{
"path": "app/views/pg_hero/home/index.html.erb",
"chars": 17826,
"preview": "<div id=\"status\">\n <% if @replica %>\n <div class=\"alert alert-<%= @good_replication_lag ? \"success\" : \"warning\" %>\">"
},
{
"path": "app/views/pg_hero/home/index_bloat.html.erb",
"chars": 2197,
"preview": "<div class=\"content\">\n <h1>Index Bloat</h1>\n\n <% if @index_bloat.any? %>\n\n <p>Indexes can become <%= link_to \"bloat"
},
{
"path": "app/views/pg_hero/home/live_queries.html.erb",
"chars": 403,
"preview": "<div class=\"content\">\n <h1>Live Queries</h1>\n\n <p><%= pluralize(@running_queries.size, \"query\") %></p>\n\n <%= render p"
},
{
"path": "app/views/pg_hero/home/maintenance.html.erb",
"chars": 1781,
"preview": "<div class=\"content\">\n <h1>Maintenance</h1>\n\n <table class=\"table\">\n <thead>\n <tr>\n <th>Table</th>\n "
},
{
"path": "app/views/pg_hero/home/queries.html.erb",
"chars": 1420,
"preview": "<div class=\"content\">\n <% if @query_stats_enabled && !@historical_query_stats_enabled %>\n <%= button_to \"Reset\", res"
},
{
"path": "app/views/pg_hero/home/relation_space.html.erb",
"chars": 471,
"preview": "<div class=\"content\">\n <h1>\n <%= @relation %>\n <% if @schema != \"public\" %>\n <small><%= @schema %></small>\n "
},
{
"path": "app/views/pg_hero/home/show_query.html.erb",
"chars": 3652,
"preview": "<div class=\"content\">\n <pre><code class=\"query-code\"><%= @query %></code></pre>\n <%= javascript_tag nonce: true do %>\n"
},
{
"path": "app/views/pg_hero/home/space.html.erb",
"chars": 3244,
"preview": "<div class=\"content\">\n <h1>Space</h1>\n\n <p>Database Size: <%= @database_size %></p>\n\n <% if @system_stats_enabled %>\n"
},
{
"path": "app/views/pg_hero/home/system.html.erb",
"chars": 1569,
"preview": "<div class=\"content\">\n <p id=\"periods\">\n <% @periods.each do |name, options| %>\n <%= link_to name, system_path("
},
{
"path": "app/views/pg_hero/home/tune.html.erb",
"chars": 1538,
"preview": "<div class=\"content\">\n <h1>Tune</h1>\n\n <table class=\"table\">\n <thead>\n <tr>\n <th>Setting</th>\n <"
},
{
"path": "config/routes.rb",
"chars": 1386,
"preview": "PgHero::Engine.routes.draw do\n scope \"(:database)\", constraints: proc { |req| (PgHero.config[\"databases\"].keys + [nil])"
},
{
"path": "gemfiles/activerecord71.gemfile",
"chars": 186,
"preview": "source \"https://rubygems.org\"\n\ngemspec path: \"..\"\n\ngem \"rake\"\ngem \"minitest\"\ngem \"activerecord\", \"~> 7.1.0\"\ngem \"combust"
},
{
"path": "gemfiles/activerecord72.gemfile",
"chars": 186,
"preview": "source \"https://rubygems.org\"\n\ngemspec path: \"..\"\n\ngem \"rake\"\ngem \"minitest\"\ngem \"activerecord\", \"~> 7.2.0\"\ngem \"combust"
},
{
"path": "gemfiles/activerecord80.gemfile",
"chars": 149,
"preview": "source \"https://rubygems.org\"\n\ngemspec path: \"..\"\n\ngem \"rake\"\ngem \"minitest\"\ngem \"activerecord\", \"~> 8.0.0\"\ngem \"combust"
},
{
"path": "guides/Contributing.md",
"chars": 418,
"preview": "# Contributing\n\n```sh\ngit clone https://github.com/ankane/pghero.git\ngit clone https://github.com/pghero/pghero.git pghe"
},
{
"path": "guides/Docker.md",
"chars": 7389,
"preview": "# PgHero Docker\n\n## Installation\n\nPgHero is available on [Docker Hub](https://hub.docker.com/r/ankane/pghero/).\n\n```sh\nd"
},
{
"path": "guides/Linux.md",
"chars": 7157,
"preview": "# PgHero Linux\n\n## Installation\n\n- [Ubuntu](#ubuntu)\n- [Debian](#debian)\n\n### Ubuntu\n\n```sh\nwget -qO- https://dl.package"
},
{
"path": "guides/Permissions.md",
"chars": 2709,
"preview": "# Permissions\n\nFor security, Postgres doesn’t allow you to see queries from other users without being a superuser. Howev"
},
{
"path": "guides/Query-Stats.md",
"chars": 1573,
"preview": "# Query Stats\n\nThe [pg_stat_statements module](https://www.postgresql.org/docs/current/static/pgstatstatements.html) is "
},
{
"path": "guides/Rails.md",
"chars": 6104,
"preview": "# PgHero Rails\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"pghero\"\n```\n\nAnd mount the d"
},
{
"path": "guides/Suggested-Indexes.md",
"chars": 1210,
"preview": "# How PgHero Suggests Indexes\n\n1. Get the most time-consuming queries from [pg_stat_statements](https://www.postgresql.o"
},
{
"path": "lib/generators/pghero/config_generator.rb",
"chars": 273,
"preview": "require \"rails/generators\"\n\nmodule Pghero\n module Generators\n class ConfigGenerator < Rails::Generators::Base\n "
},
{
"path": "lib/generators/pghero/query_stats_generator.rb",
"chars": 553,
"preview": "require \"rails/generators\"\nrequire \"rails/generators/active_record\"\n\nmodule Pghero\n module Generators\n class QuerySt"
},
{
"path": "lib/generators/pghero/space_stats_generator.rb",
"chars": 553,
"preview": "require \"rails/generators\"\nrequire \"rails/generators/active_record\"\n\nmodule Pghero\n module Generators\n class SpaceSt"
},
{
"path": "lib/generators/pghero/templates/config.yml.tt",
"chars": 1324,
"preview": "databases:\n primary:\n # Database URL (defaults to app database)\n # url: <%%= ENV[\"DATABASE_URL\"] %>\n\n # System"
},
{
"path": "lib/generators/pghero/templates/query_stats.rb.tt",
"chars": 411,
"preview": "class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>\n def change\n create_table :pgher"
},
{
"path": "lib/generators/pghero/templates/space_stats.rb.tt",
"chars": 351,
"preview": "class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>\n def change\n create_table :pgher"
},
{
"path": "lib/pghero/connection.rb",
"chars": 95,
"preview": "module PgHero\n class Connection < ActiveRecord::Base\n self.abstract_class = true\n end\nend\n"
},
{
"path": "lib/pghero/database.rb",
"chars": 5109,
"preview": "module PgHero\n class Database\n include Methods::Basic\n include Methods::Connections\n include Methods::Constrai"
},
{
"path": "lib/pghero/engine.rb",
"chars": 944,
"preview": "module PgHero\n class Engine < ::Rails::Engine\n isolate_namespace PgHero\n\n initializer \"pghero\", group: :all do |a"
},
{
"path": "lib/pghero/methods/basic.rb",
"chars": 4387,
"preview": "module PgHero\n module Methods\n module Basic\n def ssl_used?\n ssl_used = nil\n with_transaction(roll"
},
{
"path": "lib/pghero/methods/connections.rb",
"chars": 1806,
"preview": "module PgHero\n module Methods\n module Connections\n def connections\n if server_version_num >= 90500\n "
},
{
"path": "lib/pghero/methods/constraints.rb",
"chars": 904,
"preview": "module PgHero\n module Methods\n module Constraints\n # referenced fields can be nil\n # as not all constraint"
},
{
"path": "lib/pghero/methods/explain.rb",
"chars": 2171,
"preview": "module PgHero\n module Methods\n module Explain\n # TODO remove in 4.0\n # note: this method is not affected b"
},
{
"path": "lib/pghero/methods/indexes.rb",
"chars": 11675,
"preview": "module PgHero\n module Methods\n module Indexes\n def index_hit_rate\n select_one <<~SQL\n SELECT\n "
},
{
"path": "lib/pghero/methods/kill.rb",
"chars": 679,
"preview": "module PgHero\n module Methods\n module Kill\n def kill(pid)\n select_one(\"SELECT pg_terminate_backend(#{pid"
},
{
"path": "lib/pghero/methods/maintenance.rb",
"chars": 2951,
"preview": "module PgHero\n module Methods\n module Maintenance\n # https://www.postgresql.org/docs/current/routine-vacuuming."
},
{
"path": "lib/pghero/methods/queries.rb",
"chars": 3096,
"preview": "module PgHero\n module Methods\n module Queries\n def running_queries(min_duration: nil, all: false)\n query"
},
{
"path": "lib/pghero/methods/query_stats.rb",
"chars": 14097,
"preview": "module PgHero\n module Methods\n module QueryStats\n def query_stats(historical: false, start_at: nil, end_at: nil"
},
{
"path": "lib/pghero/methods/replication.rb",
"chars": 2016,
"preview": "module PgHero\n module Methods\n module Replication\n def replica?\n unless defined?(@replica)\n @re"
},
{
"path": "lib/pghero/methods/sequences.rb",
"chars": 4492,
"preview": "module PgHero\n module Methods\n module Sequences\n def sequences\n # get columns with default values\n "
},
{
"path": "lib/pghero/methods/settings.rb",
"chars": 1460,
"preview": "module PgHero\n module Methods\n module Settings\n def settings\n names =\n if server_version_num >="
},
{
"path": "lib/pghero/methods/space.rb",
"chars": 4202,
"preview": "module PgHero\n module Methods\n module Space\n def database_size\n PgHero.pretty_size select_one(\"SELECT pg"
},
{
"path": "lib/pghero/methods/suggested_indexes.rb",
"chars": 12201,
"preview": "module PgHero\n module Methods\n module SuggestedIndexes\n def suggested_indexes_enabled?\n defined?(PgQuery"
},
{
"path": "lib/pghero/methods/system.rb",
"chars": 11239,
"preview": "module PgHero\n module Methods\n module System\n def system_stats_enabled?\n !system_stats_provider.nil?\n "
},
{
"path": "lib/pghero/methods/tables.rb",
"chars": 1750,
"preview": "module PgHero\n module Methods\n module Tables\n def table_hit_rate\n select_one <<~SQL\n SELECT\n "
},
{
"path": "lib/pghero/methods/users.rb",
"chars": 3511,
"preview": "module PgHero\n module Methods\n module Users\n # documented as unsafe to pass user input\n # identifiers are "
},
{
"path": "lib/pghero/query_stats.rb",
"chars": 94,
"preview": "module PgHero\n class QueryStats < Stats\n self.table_name = \"pghero_query_stats\"\n end\nend\n"
},
{
"path": "lib/pghero/space_stats.rb",
"chars": 94,
"preview": "module PgHero\n class SpaceStats < Stats\n self.table_name = \"pghero_space_stats\"\n end\nend\n"
},
{
"path": "lib/pghero/stats.rb",
"chars": 170,
"preview": "module PgHero\n class Stats < ActiveRecord::Base\n self.abstract_class = true\n establish_connection PgHero.stats_da"
},
{
"path": "lib/pghero/version.rb",
"chars": 38,
"preview": "module PgHero\n VERSION = \"3.7.0\"\nend\n"
},
{
"path": "lib/pghero.rb",
"chars": 8704,
"preview": "# dependencies\nrequire \"active_support\"\n\n# stdlib\nrequire \"forwardable\"\n\n# methods\nrequire_relative \"pghero/methods/basi"
},
{
"path": "lib/tasks/pghero.rake",
"chars": 1067,
"preview": "namespace :pghero do\n desc \"Capture query stats\"\n task capture_query_stats: :environment do\n PgHero.capture_query_s"
},
{
"path": "licenses/LICENSE-chart.js.txt",
"chars": 1093,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2014-2022 Chart.js Contributors\n\nPermission is hereby granted, free of charge, to a"
},
{
"path": "licenses/LICENSE-chartjs-adapter-date-fns.txt",
"chars": 1088,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2019 Chart.js Contributors\n\nPermission is hereby granted, free of charge, to any pe"
},
{
"path": "licenses/LICENSE-chartkick.js.txt",
"chars": 1073,
"preview": "Copyright (c) 2013-2021 Andrew Kane\n\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining\n"
},
{
"path": "licenses/LICENSE-date-fns.txt",
"chars": 1117,
"preview": "MIT License\n\nCopyright (c) 2021 Sasha Koss and Lesha Koss https://kossnocorp.mit-license.org\n\nPermission is hereby grant"
},
{
"path": "licenses/LICENSE-highlight.js.txt",
"chars": 1514,
"preview": "BSD 3-Clause License\n\nCopyright (c) 2006, Ivan Sagalaev.\nAll rights reserved.\n\nRedistribution and use in source and bina"
},
{
"path": "licenses/LICENSE-jquery.txt",
"chars": 1097,
"preview": "Copyright OpenJS Foundation and other contributors, https://openjsf.org/\n\nPermission is hereby granted, free of charge, "
},
{
"path": "licenses/LICENSE-kurkle-color.txt",
"chars": 1085,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2018-2021 Jukka Kurkela\n\nPermission is hereby granted, free of charge, to any perso"
},
{
"path": "licenses/LICENSE-nouislider.txt",
"chars": 1068,
"preview": "MIT License\n\nCopyright (c) 2019 Léon Gersen\n\nPermission is hereby granted, free of charge, to any person obtaining a cop"
},
{
"path": "pghero.gemspec",
"chars": 571,
"preview": "require_relative \"lib/pghero/version\"\n\nGem::Specification.new do |spec|\n spec.name = \"pghero\"\n spec.version "
},
{
"path": "test/basic_test.rb",
"chars": 390,
"preview": "require_relative \"test_helper\"\n\nclass BasicTest < Minitest::Test\n def test_ssl_used?\n refute database.ssl_used?\n en"
},
{
"path": "test/best_index_test.rb",
"chars": 6476,
"preview": "require_relative \"test_helper\"\n\nclass BestIndexTest < Minitest::Test\n def test_where\n assert_best_index ({table: \"us"
},
{
"path": "test/config_generator_test.rb",
"chars": 352,
"preview": "require_relative \"test_helper\"\n\nrequire \"generators/pghero/config_generator\"\n\nclass ConfigGeneratorTest < Rails::Generat"
},
{
"path": "test/connections_test.rb",
"chars": 421,
"preview": "require_relative \"test_helper\"\n\nclass ConnectionsTest < Minitest::Test\n def test_connections\n assert_kind_of Array, "
},
{
"path": "test/constraints_test.rb",
"chars": 162,
"preview": "require_relative \"test_helper\"\n\nclass ConstraintsTest < Minitest::Test\n def test_invalid_constraints\n assert_equal ["
},
{
"path": "test/controller_test.rb",
"chars": 5383,
"preview": "require_relative \"test_helper\"\n\nclass ControllerTest < ActionDispatch::IntegrationTest\n def test_index\n get pg_hero."
},
{
"path": "test/database_test.rb",
"chars": 197,
"preview": "require_relative \"test_helper\"\n\nclass DatabaseTest < Minitest::Test\n def test_id\n assert_equal \"primary\", database.i"
},
{
"path": "test/explain_test.rb",
"chars": 2454,
"preview": "require_relative \"test_helper\"\n\nclass ExplainTest < Minitest::Test\n def setup\n City.delete_all\n end\n\n def test_exp"
},
{
"path": "test/indexes_test.rb",
"chars": 1046,
"preview": "require_relative \"test_helper\"\n\nclass IndexesTest < Minitest::Test\n def test_index_hit_rate\n database.index_hit_rate"
},
{
"path": "test/internal/app/assets/config/manifest.js",
"chars": 0,
"preview": ""
},
{
"path": "test/internal/config/database.yml",
"chars": 53,
"preview": "test:\n adapter: postgresql\n database: pghero_test\n"
},
{
"path": "test/internal/config/routes.rb",
"chars": 69,
"preview": "Rails.application.routes.draw do\n mount PgHero::Engine, at: \"/\"\nend\n"
},
{
"path": "test/internal/db/schema.rb",
"chars": 1488,
"preview": "ActiveRecord::Schema.define do\n enable_extension \"pg_stat_statements\"\n enable_extension \"pg_trgm\"\n enable_extension \""
},
{
"path": "test/kill_test.rb",
"chars": 329,
"preview": "require_relative \"test_helper\"\n\nclass KillTest < Minitest::Test\n def test_kill\n # prevent warning for now\n # refu"
},
{
"path": "test/maintenance_test.rb",
"chars": 630,
"preview": "require_relative \"test_helper\"\n\nclass MaintenanceTest < Minitest::Test\n def test_transaction_id_danger\n assert datab"
},
{
"path": "test/module_test.rb",
"chars": 816,
"preview": "require_relative \"test_helper\"\n\nclass ModuleTest < Minitest::Test\n def test_databases\n assert PgHero.databases.any?\n"
},
{
"path": "test/queries_test.rb",
"chars": 971,
"preview": "require_relative \"test_helper\"\n\nclass QueriesTest < Minitest::Test\n def test_running_queries\n assert database.runnin"
},
{
"path": "test/query_stats_generator_test.rb",
"chars": 415,
"preview": "require_relative \"test_helper\"\n\nrequire \"generators/pghero/query_stats_generator\"\n\nclass QueryStatsGeneratorTest < Rails"
},
{
"path": "test/query_stats_test.rb",
"chars": 3608,
"preview": "require_relative \"test_helper\"\n\nclass QueryStatsTest < Minitest::Test\n def test_query_stats\n assert database.query_s"
},
{
"path": "test/replication_test.rb",
"chars": 355,
"preview": "require_relative \"test_helper\"\n\nclass ReplicationTest < Minitest::Test\n def test_replica\n refute database.replica?\n "
},
{
"path": "test/sequences_test.rb",
"chars": 914,
"preview": "require_relative \"test_helper\"\n\nclass SequencesTest < Minitest::Test\n def test_sequences\n seq = database.sequences.f"
},
{
"path": "test/settings_test.rb",
"chars": 338,
"preview": "require_relative \"test_helper\"\n\nclass SettingsTest < Minitest::Test\n def test_settings\n assert database.settings[:ma"
},
{
"path": "test/space_stats_generator_test.rb",
"chars": 415,
"preview": "require_relative \"test_helper\"\n\nrequire \"generators/pghero/space_stats_generator\"\n\nclass SpaceStatsGeneratorTest < Rails"
},
{
"path": "test/space_test.rb",
"chars": 1032,
"preview": "require_relative \"test_helper\"\n\nclass SpaceTest < Minitest::Test\n def test_database_size\n assert database.database_s"
},
{
"path": "test/suggested_indexes_test.rb",
"chars": 3277,
"preview": "require_relative \"test_helper\"\n\nclass SuggestedIndexesTest < Minitest::Test\n def setup\n if database.server_version_n"
},
{
"path": "test/system_test.rb",
"chars": 236,
"preview": "require_relative \"test_helper\"\n\nclass SystemTest < Minitest::Test\n def test_system_stats_enabled\n refute database.sy"
},
{
"path": "test/tables_test.rb",
"chars": 340,
"preview": "require_relative \"test_helper\"\n\nclass TablesTest < Minitest::Test\n def test_table_hit_rate\n database.table_hit_rate\n"
},
{
"path": "test/test_helper.rb",
"chars": 1829,
"preview": "require \"bundler/setup\"\nrequire \"combustion\"\nBundler.require(:default)\nrequire \"minitest/autorun\"\n\nclass Minitest::Test\n"
},
{
"path": "test/users_test.rb",
"chars": 309,
"preview": "require_relative \"test_helper\"\n\nclass UsersTest < Minitest::Test\n def teardown\n database.drop_user(user)\n end\n\n de"
}
]
About this extraction
This page contains the full source code of the ankane/pghero GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 120 files (1.6 MB), approximately 443.7k tokens, and a symbol index with 1766 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.