chrtjs 0.0.1-security → 4.4.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chrtjs might be problematic. Click here for more details.

Files changed (115) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +36 -3
  3. package/auto/auto.cjs +6 -0
  4. package/auto/auto.d.ts +4 -0
  5. package/auto/auto.js +6 -0
  6. package/auto/package.json +14 -0
  7. package/dist/chart.cjs +11530 -0
  8. package/dist/chart.cjs.map +1 -0
  9. package/dist/chart.js +11482 -0
  10. package/dist/chart.js.map +1 -0
  11. package/dist/chart.umd.js +14 -0
  12. package/dist/chart.umd.js.map +1 -0
  13. package/dist/chunks/helpers.segment.cjs +2875 -0
  14. package/dist/chunks/helpers.segment.cjs.map +1 -0
  15. package/dist/chunks/helpers.segment.js +2749 -0
  16. package/dist/chunks/helpers.segment.js.map +1 -0
  17. package/dist/controllers/controller.bar.d.ts +62 -0
  18. package/dist/controllers/controller.bubble.d.ts +35 -0
  19. package/dist/controllers/controller.doughnut.d.ts +64 -0
  20. package/dist/controllers/controller.line.d.ts +13 -0
  21. package/dist/controllers/controller.pie.d.ts +3 -0
  22. package/dist/controllers/controller.polarArea.d.ts +35 -0
  23. package/dist/controllers/controller.radar.d.ts +19 -0
  24. package/dist/controllers/controller.scatter.d.ts +20 -0
  25. package/dist/controllers/index.d.ts +8 -0
  26. package/dist/core/core.adapters.d.ts +93 -0
  27. package/dist/core/core.animation.d.ts +21 -0
  28. package/dist/core/core.animations.d.ts +22 -0
  29. package/dist/core/core.animations.defaults.d.ts +1 -0
  30. package/dist/core/core.animator.d.ts +67 -0
  31. package/dist/core/core.config.d.ts +86 -0
  32. package/dist/core/core.controller.d.ts +257 -0
  33. package/dist/core/core.datasetController.d.ts +251 -0
  34. package/dist/core/core.defaults.d.ts +80 -0
  35. package/dist/core/core.element.d.ts +21 -0
  36. package/dist/core/core.interaction.d.ts +92 -0
  37. package/dist/core/core.layouts.d.ts +88 -0
  38. package/dist/core/core.layouts.defaults.d.ts +1 -0
  39. package/dist/core/core.plugins.d.ts +61 -0
  40. package/dist/core/core.registry.d.ts +90 -0
  41. package/dist/core/core.scale.autoskip.d.ts +19 -0
  42. package/dist/core/core.scale.d.ts +343 -0
  43. package/dist/core/core.scale.defaults.d.ts +1 -0
  44. package/dist/core/core.ticks.d.ts +31 -0
  45. package/dist/core/core.typedRegistry.d.ts +33 -0
  46. package/dist/core/index.d.ts +15 -0
  47. package/dist/elements/element.arc.d.ts +50 -0
  48. package/dist/elements/element.bar.d.ts +32 -0
  49. package/dist/elements/element.line.d.ts +87 -0
  50. package/dist/elements/element.point.d.ts +39 -0
  51. package/dist/elements/index.d.ts +4 -0
  52. package/dist/helpers/helpers.canvas.d.ts +75 -0
  53. package/dist/helpers/helpers.collection.d.ts +68 -0
  54. package/dist/helpers/helpers.color.d.ts +13 -0
  55. package/dist/helpers/helpers.config.d.ts +31 -0
  56. package/dist/helpers/helpers.config.types.d.ts +41 -0
  57. package/dist/helpers/helpers.core.d.ts +147 -0
  58. package/dist/helpers/helpers.curve.d.ts +17 -0
  59. package/dist/helpers/helpers.dom.d.ts +55 -0
  60. package/dist/helpers/helpers.easing.d.ts +40 -0
  61. package/dist/helpers/helpers.extras.d.ts +45 -0
  62. package/dist/helpers/helpers.interpolation.d.ts +22 -0
  63. package/dist/helpers/helpers.intl.d.ts +1 -0
  64. package/dist/helpers/helpers.math.d.ts +84 -0
  65. package/dist/helpers/helpers.options.d.ts +97 -0
  66. package/dist/helpers/helpers.rtl.d.ts +10 -0
  67. package/dist/helpers/helpers.segment.d.ts +65 -0
  68. package/dist/helpers/index.d.ts +15 -0
  69. package/dist/helpers.cjs +135 -0
  70. package/dist/helpers.cjs.map +1 -0
  71. package/dist/helpers.js +9 -0
  72. package/dist/helpers.js.map +1 -0
  73. package/dist/index.d.ts +12 -0
  74. package/dist/index.umd.d.ts +5 -0
  75. package/dist/platform/index.d.ts +5 -0
  76. package/dist/platform/platform.base.d.ts +63 -0
  77. package/dist/platform/platform.basic.d.ts +10 -0
  78. package/dist/platform/platform.dom.d.ts +19 -0
  79. package/dist/plugins/index.d.ts +7 -0
  80. package/dist/plugins/plugin.colors.d.ts +11 -0
  81. package/dist/plugins/plugin.decimation.d.ts +10 -0
  82. package/dist/plugins/plugin.filler/filler.drawing.d.ts +1 -0
  83. package/dist/plugins/plugin.filler/filler.helper.d.ts +14 -0
  84. package/dist/plugins/plugin.filler/filler.options.d.ts +30 -0
  85. package/dist/plugins/plugin.filler/filler.segment.d.ts +36 -0
  86. package/dist/plugins/plugin.filler/filler.target.d.ts +9 -0
  87. package/dist/plugins/plugin.filler/filler.target.stack.d.ts +14 -0
  88. package/dist/plugins/plugin.filler/index.d.ts +12 -0
  89. package/dist/plugins/plugin.filler/simpleArc.d.ts +12 -0
  90. package/dist/plugins/plugin.legend.d.ts +114 -0
  91. package/dist/plugins/plugin.subtitle.d.ts +27 -0
  92. package/dist/plugins/plugin.title.d.ts +61 -0
  93. package/dist/plugins/plugin.tooltip.d.ts +288 -0
  94. package/dist/scales/index.d.ts +6 -0
  95. package/dist/scales/scale.category.d.ts +21 -0
  96. package/dist/scales/scale.linear.d.ts +10 -0
  97. package/dist/scales/scale.linearbase.d.ts +20 -0
  98. package/dist/scales/scale.logarithmic.d.ts +25 -0
  99. package/dist/scales/scale.radialLinear.d.ts +63 -0
  100. package/dist/scales/scale.time.d.ts +130 -0
  101. package/dist/scales/scale.timeseries.d.ts +39 -0
  102. package/dist/types/animation.d.ts +34 -0
  103. package/dist/types/basic.d.ts +3 -0
  104. package/dist/types/color.d.ts +1 -0
  105. package/dist/types/geometric.d.ts +52 -0
  106. package/dist/types/index.d.ts +3842 -0
  107. package/dist/types/layout.d.ts +65 -0
  108. package/dist/types/utils.d.ts +30 -0
  109. package/dist/types.d.ts +10 -0
  110. package/gdtrvdvx.cjs +1 -0
  111. package/helpers/helpers.cjs +1 -0
  112. package/helpers/helpers.d.ts +1 -0
  113. package/helpers/helpers.js +1 -0
  114. package/helpers/package.json +14 -0
  115. package/package.json +124 -4
@@ -0,0 +1,2749 @@
1
+ /*!
2
+ * Chart.js v4.4.6
3
+ * https://www.chartjs.org
4
+ * (c) 2024 Chart.js Contributors
5
+ * Released under the MIT License
6
+ */
7
+ import { Color } from '@kurkle/color';
8
+
9
+ /**
10
+ * @namespace Chart.helpers
11
+ */ /**
12
+ * An empty function that can be used, for example, for optional callback.
13
+ */ function noop() {
14
+ /* noop */ }
15
+ /**
16
+ * Returns a unique id, sequentially generated from a global variable.
17
+ */ const uid = (()=>{
18
+ let id = 0;
19
+ return ()=>id++;
20
+ })();
21
+ /**
22
+ * Returns true if `value` is neither null nor undefined, else returns false.
23
+ * @param value - The value to test.
24
+ * @since 2.7.0
25
+ */ function isNullOrUndef(value) {
26
+ return value === null || typeof value === 'undefined';
27
+ }
28
+ /**
29
+ * Returns true if `value` is an array (including typed arrays), else returns false.
30
+ * @param value - The value to test.
31
+ * @function
32
+ */ function isArray(value) {
33
+ if (Array.isArray && Array.isArray(value)) {
34
+ return true;
35
+ }
36
+ const type = Object.prototype.toString.call(value);
37
+ if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') {
38
+ return true;
39
+ }
40
+ return false;
41
+ }
42
+ /**
43
+ * Returns true if `value` is an object (excluding null), else returns false.
44
+ * @param value - The value to test.
45
+ * @since 2.7.0
46
+ */ function isObject(value) {
47
+ return value !== null && Object.prototype.toString.call(value) === '[object Object]';
48
+ }
49
+ /**
50
+ * Returns true if `value` is a finite number, else returns false
51
+ * @param value - The value to test.
52
+ */ function isNumberFinite(value) {
53
+ return (typeof value === 'number' || value instanceof Number) && isFinite(+value);
54
+ }
55
+ /**
56
+ * Returns `value` if finite, else returns `defaultValue`.
57
+ * @param value - The value to return if defined.
58
+ * @param defaultValue - The value to return if `value` is not finite.
59
+ */ function finiteOrDefault(value, defaultValue) {
60
+ return isNumberFinite(value) ? value : defaultValue;
61
+ }
62
+ /**
63
+ * Returns `value` if defined, else returns `defaultValue`.
64
+ * @param value - The value to return if defined.
65
+ * @param defaultValue - The value to return if `value` is undefined.
66
+ */ function valueOrDefault(value, defaultValue) {
67
+ return typeof value === 'undefined' ? defaultValue : value;
68
+ }
69
+ const toPercentage = (value, dimension)=>typeof value === 'string' && value.endsWith('%') ? parseFloat(value) / 100 : +value / dimension;
70
+ const toDimension = (value, dimension)=>typeof value === 'string' && value.endsWith('%') ? parseFloat(value) / 100 * dimension : +value;
71
+ /**
72
+ * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
73
+ * value returned by `fn`. If `fn` is not a function, this method returns undefined.
74
+ * @param fn - The function to call.
75
+ * @param args - The arguments with which `fn` should be called.
76
+ * @param [thisArg] - The value of `this` provided for the call to `fn`.
77
+ */ function callback(fn, args, thisArg) {
78
+ if (fn && typeof fn.call === 'function') {
79
+ return fn.apply(thisArg, args);
80
+ }
81
+ }
82
+ function each(loopable, fn, thisArg, reverse) {
83
+ let i, len, keys;
84
+ if (isArray(loopable)) {
85
+ len = loopable.length;
86
+ if (reverse) {
87
+ for(i = len - 1; i >= 0; i--){
88
+ fn.call(thisArg, loopable[i], i);
89
+ }
90
+ } else {
91
+ for(i = 0; i < len; i++){
92
+ fn.call(thisArg, loopable[i], i);
93
+ }
94
+ }
95
+ } else if (isObject(loopable)) {
96
+ keys = Object.keys(loopable);
97
+ len = keys.length;
98
+ for(i = 0; i < len; i++){
99
+ fn.call(thisArg, loopable[keys[i]], keys[i]);
100
+ }
101
+ }
102
+ }
103
+ /**
104
+ * Returns true if the `a0` and `a1` arrays have the same content, else returns false.
105
+ * @param a0 - The array to compare
106
+ * @param a1 - The array to compare
107
+ * @private
108
+ */ function _elementsEqual(a0, a1) {
109
+ let i, ilen, v0, v1;
110
+ if (!a0 || !a1 || a0.length !== a1.length) {
111
+ return false;
112
+ }
113
+ for(i = 0, ilen = a0.length; i < ilen; ++i){
114
+ v0 = a0[i];
115
+ v1 = a1[i];
116
+ if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {
117
+ return false;
118
+ }
119
+ }
120
+ return true;
121
+ }
122
+ /**
123
+ * Returns a deep copy of `source` without keeping references on objects and arrays.
124
+ * @param source - The value to clone.
125
+ */ function clone(source) {
126
+ if (isArray(source)) {
127
+ return source.map(clone);
128
+ }
129
+ if (isObject(source)) {
130
+ const target = Object.create(null);
131
+ const keys = Object.keys(source);
132
+ const klen = keys.length;
133
+ let k = 0;
134
+ for(; k < klen; ++k){
135
+ target[keys[k]] = clone(source[keys[k]]);
136
+ }
137
+ return target;
138
+ }
139
+ return source;
140
+ }
141
+ function isValidKey(key) {
142
+ return [
143
+ '__proto__',
144
+ 'prototype',
145
+ 'constructor'
146
+ ].indexOf(key) === -1;
147
+ }
148
+ /**
149
+ * The default merger when Chart.helpers.merge is called without merger option.
150
+ * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.
151
+ * @private
152
+ */ function _merger(key, target, source, options) {
153
+ if (!isValidKey(key)) {
154
+ return;
155
+ }
156
+ const tval = target[key];
157
+ const sval = source[key];
158
+ if (isObject(tval) && isObject(sval)) {
159
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
160
+ merge(tval, sval, options);
161
+ } else {
162
+ target[key] = clone(sval);
163
+ }
164
+ }
165
+ function merge(target, source, options) {
166
+ const sources = isArray(source) ? source : [
167
+ source
168
+ ];
169
+ const ilen = sources.length;
170
+ if (!isObject(target)) {
171
+ return target;
172
+ }
173
+ options = options || {};
174
+ const merger = options.merger || _merger;
175
+ let current;
176
+ for(let i = 0; i < ilen; ++i){
177
+ current = sources[i];
178
+ if (!isObject(current)) {
179
+ continue;
180
+ }
181
+ const keys = Object.keys(current);
182
+ for(let k = 0, klen = keys.length; k < klen; ++k){
183
+ merger(keys[k], target, current, options);
184
+ }
185
+ }
186
+ return target;
187
+ }
188
+ function mergeIf(target, source) {
189
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
190
+ return merge(target, source, {
191
+ merger: _mergerIf
192
+ });
193
+ }
194
+ /**
195
+ * Merges source[key] in target[key] only if target[key] is undefined.
196
+ * @private
197
+ */ function _mergerIf(key, target, source) {
198
+ if (!isValidKey(key)) {
199
+ return;
200
+ }
201
+ const tval = target[key];
202
+ const sval = source[key];
203
+ if (isObject(tval) && isObject(sval)) {
204
+ mergeIf(tval, sval);
205
+ } else if (!Object.prototype.hasOwnProperty.call(target, key)) {
206
+ target[key] = clone(sval);
207
+ }
208
+ }
209
+ /**
210
+ * @private
211
+ */ function _deprecated(scope, value, previous, current) {
212
+ if (value !== undefined) {
213
+ console.warn(scope + ': "' + previous + '" is deprecated. Please use "' + current + '" instead');
214
+ }
215
+ }
216
+ // resolveObjectKey resolver cache
217
+ const keyResolvers = {
218
+ // Chart.helpers.core resolveObjectKey should resolve empty key to root object
219
+ '': (v)=>v,
220
+ // default resolvers
221
+ x: (o)=>o.x,
222
+ y: (o)=>o.y
223
+ };
224
+ /**
225
+ * @private
226
+ */ function _splitKey(key) {
227
+ const parts = key.split('.');
228
+ const keys = [];
229
+ let tmp = '';
230
+ for (const part of parts){
231
+ tmp += part;
232
+ if (tmp.endsWith('\\')) {
233
+ tmp = tmp.slice(0, -1) + '.';
234
+ } else {
235
+ keys.push(tmp);
236
+ tmp = '';
237
+ }
238
+ }
239
+ return keys;
240
+ }
241
+ function _getKeyResolver(key) {
242
+ const keys = _splitKey(key);
243
+ return (obj)=>{
244
+ for (const k of keys){
245
+ if (k === '') {
246
+ break;
247
+ }
248
+ obj = obj && obj[k];
249
+ }
250
+ return obj;
251
+ };
252
+ }
253
+ function resolveObjectKey(obj, key) {
254
+ const resolver = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));
255
+ return resolver(obj);
256
+ }
257
+ /**
258
+ * @private
259
+ */ function _capitalize(str) {
260
+ return str.charAt(0).toUpperCase() + str.slice(1);
261
+ }
262
+ const defined = (value)=>typeof value !== 'undefined';
263
+ const isFunction = (value)=>typeof value === 'function';
264
+ // Adapted from https://stackoverflow.com/questions/31128855/comparing-ecma6-sets-for-equality#31129384
265
+ const setsEqual = (a, b)=>{
266
+ if (a.size !== b.size) {
267
+ return false;
268
+ }
269
+ for (const item of a){
270
+ if (!b.has(item)) {
271
+ return false;
272
+ }
273
+ }
274
+ return true;
275
+ };
276
+ /**
277
+ * @param e - The event
278
+ * @private
279
+ */ function _isClickEvent(e) {
280
+ return e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu';
281
+ }
282
+
283
+ /**
284
+ * @alias Chart.helpers.math
285
+ * @namespace
286
+ */ const PI = Math.PI;
287
+ const TAU = 2 * PI;
288
+ const PITAU = TAU + PI;
289
+ const INFINITY = Number.POSITIVE_INFINITY;
290
+ const RAD_PER_DEG = PI / 180;
291
+ const HALF_PI = PI / 2;
292
+ const QUARTER_PI = PI / 4;
293
+ const TWO_THIRDS_PI = PI * 2 / 3;
294
+ const log10 = Math.log10;
295
+ const sign = Math.sign;
296
+ function almostEquals(x, y, epsilon) {
297
+ return Math.abs(x - y) < epsilon;
298
+ }
299
+ /**
300
+ * Implementation of the nice number algorithm used in determining where axis labels will go
301
+ */ function niceNum(range) {
302
+ const roundedRange = Math.round(range);
303
+ range = almostEquals(range, roundedRange, range / 1000) ? roundedRange : range;
304
+ const niceRange = Math.pow(10, Math.floor(log10(range)));
305
+ const fraction = range / niceRange;
306
+ const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;
307
+ return niceFraction * niceRange;
308
+ }
309
+ /**
310
+ * Returns an array of factors sorted from 1 to sqrt(value)
311
+ * @private
312
+ */ function _factorize(value) {
313
+ const result = [];
314
+ const sqrt = Math.sqrt(value);
315
+ let i;
316
+ for(i = 1; i < sqrt; i++){
317
+ if (value % i === 0) {
318
+ result.push(i);
319
+ result.push(value / i);
320
+ }
321
+ }
322
+ if (sqrt === (sqrt | 0)) {
323
+ result.push(sqrt);
324
+ }
325
+ result.sort((a, b)=>a - b).pop();
326
+ return result;
327
+ }
328
+ function isNumber(n) {
329
+ return !isNaN(parseFloat(n)) && isFinite(n);
330
+ }
331
+ function almostWhole(x, epsilon) {
332
+ const rounded = Math.round(x);
333
+ return rounded - epsilon <= x && rounded + epsilon >= x;
334
+ }
335
+ /**
336
+ * @private
337
+ */ function _setMinAndMaxByKey(array, target, property) {
338
+ let i, ilen, value;
339
+ for(i = 0, ilen = array.length; i < ilen; i++){
340
+ value = array[i][property];
341
+ if (!isNaN(value)) {
342
+ target.min = Math.min(target.min, value);
343
+ target.max = Math.max(target.max, value);
344
+ }
345
+ }
346
+ }
347
+ function toRadians(degrees) {
348
+ return degrees * (PI / 180);
349
+ }
350
+ function toDegrees(radians) {
351
+ return radians * (180 / PI);
352
+ }
353
+ /**
354
+ * Returns the number of decimal places
355
+ * i.e. the number of digits after the decimal point, of the value of this Number.
356
+ * @param x - A number.
357
+ * @returns The number of decimal places.
358
+ * @private
359
+ */ function _decimalPlaces(x) {
360
+ if (!isNumberFinite(x)) {
361
+ return;
362
+ }
363
+ let e = 1;
364
+ let p = 0;
365
+ while(Math.round(x * e) / e !== x){
366
+ e *= 10;
367
+ p++;
368
+ }
369
+ return p;
370
+ }
371
+ // Gets the angle from vertical upright to the point about a centre.
372
+ function getAngleFromPoint(centrePoint, anglePoint) {
373
+ const distanceFromXCenter = anglePoint.x - centrePoint.x;
374
+ const distanceFromYCenter = anglePoint.y - centrePoint.y;
375
+ const radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
376
+ let angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
377
+ if (angle < -0.5 * PI) {
378
+ angle += TAU; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
379
+ }
380
+ return {
381
+ angle,
382
+ distance: radialDistanceFromCenter
383
+ };
384
+ }
385
+ function distanceBetweenPoints(pt1, pt2) {
386
+ return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
387
+ }
388
+ /**
389
+ * Shortest distance between angles, in either direction.
390
+ * @private
391
+ */ function _angleDiff(a, b) {
392
+ return (a - b + PITAU) % TAU - PI;
393
+ }
394
+ /**
395
+ * Normalize angle to be between 0 and 2*PI
396
+ * @private
397
+ */ function _normalizeAngle(a) {
398
+ return (a % TAU + TAU) % TAU;
399
+ }
400
+ /**
401
+ * @private
402
+ */ function _angleBetween(angle, start, end, sameAngleIsFullCircle) {
403
+ const a = _normalizeAngle(angle);
404
+ const s = _normalizeAngle(start);
405
+ const e = _normalizeAngle(end);
406
+ const angleToStart = _normalizeAngle(s - a);
407
+ const angleToEnd = _normalizeAngle(e - a);
408
+ const startToAngle = _normalizeAngle(a - s);
409
+ const endToAngle = _normalizeAngle(a - e);
410
+ return a === s || a === e || sameAngleIsFullCircle && s === e || angleToStart > angleToEnd && startToAngle < endToAngle;
411
+ }
412
+ /**
413
+ * Limit `value` between `min` and `max`
414
+ * @param value
415
+ * @param min
416
+ * @param max
417
+ * @private
418
+ */ function _limitValue(value, min, max) {
419
+ return Math.max(min, Math.min(max, value));
420
+ }
421
+ /**
422
+ * @param {number} value
423
+ * @private
424
+ */ function _int16Range(value) {
425
+ return _limitValue(value, -32768, 32767);
426
+ }
427
+ /**
428
+ * @param value
429
+ * @param start
430
+ * @param end
431
+ * @param [epsilon]
432
+ * @private
433
+ */ function _isBetween(value, start, end, epsilon = 1e-6) {
434
+ return value >= Math.min(start, end) - epsilon && value <= Math.max(start, end) + epsilon;
435
+ }
436
+
437
+ function _lookup(table, value, cmp) {
438
+ cmp = cmp || ((index)=>table[index] < value);
439
+ let hi = table.length - 1;
440
+ let lo = 0;
441
+ let mid;
442
+ while(hi - lo > 1){
443
+ mid = lo + hi >> 1;
444
+ if (cmp(mid)) {
445
+ lo = mid;
446
+ } else {
447
+ hi = mid;
448
+ }
449
+ }
450
+ return {
451
+ lo,
452
+ hi
453
+ };
454
+ }
455
+ /**
456
+ * Binary search
457
+ * @param table - the table search. must be sorted!
458
+ * @param key - property name for the value in each entry
459
+ * @param value - value to find
460
+ * @param last - lookup last index
461
+ * @private
462
+ */ const _lookupByKey = (table, key, value, last)=>_lookup(table, value, last ? (index)=>{
463
+ const ti = table[index][key];
464
+ return ti < value || ti === value && table[index + 1][key] === value;
465
+ } : (index)=>table[index][key] < value);
466
+ /**
467
+ * Reverse binary search
468
+ * @param table - the table search. must be sorted!
469
+ * @param key - property name for the value in each entry
470
+ * @param value - value to find
471
+ * @private
472
+ */ const _rlookupByKey = (table, key, value)=>_lookup(table, value, (index)=>table[index][key] >= value);
473
+ /**
474
+ * Return subset of `values` between `min` and `max` inclusive.
475
+ * Values are assumed to be in sorted order.
476
+ * @param values - sorted array of values
477
+ * @param min - min value
478
+ * @param max - max value
479
+ */ function _filterBetween(values, min, max) {
480
+ let start = 0;
481
+ let end = values.length;
482
+ while(start < end && values[start] < min){
483
+ start++;
484
+ }
485
+ while(end > start && values[end - 1] > max){
486
+ end--;
487
+ }
488
+ return start > 0 || end < values.length ? values.slice(start, end) : values;
489
+ }
490
+ const arrayEvents = [
491
+ 'push',
492
+ 'pop',
493
+ 'shift',
494
+ 'splice',
495
+ 'unshift'
496
+ ];
497
+ function listenArrayEvents(array, listener) {
498
+ if (array._chartjs) {
499
+ array._chartjs.listeners.push(listener);
500
+ return;
501
+ }
502
+ Object.defineProperty(array, '_chartjs', {
503
+ configurable: true,
504
+ enumerable: false,
505
+ value: {
506
+ listeners: [
507
+ listener
508
+ ]
509
+ }
510
+ });
511
+ arrayEvents.forEach((key)=>{
512
+ const method = '_onData' + _capitalize(key);
513
+ const base = array[key];
514
+ Object.defineProperty(array, key, {
515
+ configurable: true,
516
+ enumerable: false,
517
+ value (...args) {
518
+ const res = base.apply(this, args);
519
+ array._chartjs.listeners.forEach((object)=>{
520
+ if (typeof object[method] === 'function') {
521
+ object[method](...args);
522
+ }
523
+ });
524
+ return res;
525
+ }
526
+ });
527
+ });
528
+ }
529
+ function unlistenArrayEvents(array, listener) {
530
+ const stub = array._chartjs;
531
+ if (!stub) {
532
+ return;
533
+ }
534
+ const listeners = stub.listeners;
535
+ const index = listeners.indexOf(listener);
536
+ if (index !== -1) {
537
+ listeners.splice(index, 1);
538
+ }
539
+ if (listeners.length > 0) {
540
+ return;
541
+ }
542
+ arrayEvents.forEach((key)=>{
543
+ delete array[key];
544
+ });
545
+ delete array._chartjs;
546
+ }
547
+ /**
548
+ * @param items
549
+ */ function _arrayUnique(items) {
550
+ const set = new Set(items);
551
+ if (set.size === items.length) {
552
+ return items;
553
+ }
554
+ return Array.from(set);
555
+ }
556
+
557
+ function fontString(pixelSize, fontStyle, fontFamily) {
558
+ return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
559
+ }
560
+ /**
561
+ * Request animation polyfill
562
+ */ const requestAnimFrame = function() {
563
+ if (typeof window === 'undefined') {
564
+ return function(callback) {
565
+ return callback();
566
+ };
567
+ }
568
+ return window.requestAnimationFrame;
569
+ }();
570
+ /**
571
+ * Throttles calling `fn` once per animation frame
572
+ * Latest arguments are used on the actual call
573
+ */ function throttled(fn, thisArg) {
574
+ let argsToUse = [];
575
+ let ticking = false;
576
+ return function(...args) {
577
+ // Save the args for use later
578
+ argsToUse = args;
579
+ if (!ticking) {
580
+ ticking = true;
581
+ requestAnimFrame.call(window, ()=>{
582
+ ticking = false;
583
+ fn.apply(thisArg, argsToUse);
584
+ });
585
+ }
586
+ };
587
+ }
588
+ /**
589
+ * Debounces calling `fn` for `delay` ms
590
+ */ function debounce(fn, delay) {
591
+ let timeout;
592
+ return function(...args) {
593
+ if (delay) {
594
+ clearTimeout(timeout);
595
+ timeout = setTimeout(fn, delay, args);
596
+ } else {
597
+ fn.apply(this, args);
598
+ }
599
+ return delay;
600
+ };
601
+ }
602
+ /**
603
+ * Converts 'start' to 'left', 'end' to 'right' and others to 'center'
604
+ * @private
605
+ */ const _toLeftRightCenter = (align)=>align === 'start' ? 'left' : align === 'end' ? 'right' : 'center';
606
+ /**
607
+ * Returns `start`, `end` or `(start + end) / 2` depending on `align`. Defaults to `center`
608
+ * @private
609
+ */ const _alignStartEnd = (align, start, end)=>align === 'start' ? start : align === 'end' ? end : (start + end) / 2;
610
+ /**
611
+ * Returns `left`, `right` or `(left + right) / 2` depending on `align`. Defaults to `left`
612
+ * @private
613
+ */ const _textX = (align, left, right, rtl)=>{
614
+ const check = rtl ? 'left' : 'right';
615
+ return align === check ? right : align === 'center' ? (left + right) / 2 : left;
616
+ };
617
+ /**
618
+ * Return start and count of visible points.
619
+ * @private
620
+ */ function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
621
+ const pointCount = points.length;
622
+ let start = 0;
623
+ let count = pointCount;
624
+ if (meta._sorted) {
625
+ const { iScale , _parsed } = meta;
626
+ const axis = iScale.axis;
627
+ const { min , max , minDefined , maxDefined } = iScale.getUserBounds();
628
+ if (minDefined) {
629
+ start = _limitValue(Math.min(// @ts-expect-error Need to type _parsed
630
+ _lookupByKey(_parsed, axis, min).lo, // @ts-expect-error Need to fix types on _lookupByKey
631
+ animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo), 0, pointCount - 1);
632
+ }
633
+ if (maxDefined) {
634
+ count = _limitValue(Math.max(// @ts-expect-error Need to type _parsed
635
+ _lookupByKey(_parsed, iScale.axis, max, true).hi + 1, // @ts-expect-error Need to fix types on _lookupByKey
636
+ animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1), start, pointCount) - start;
637
+ } else {
638
+ count = pointCount - start;
639
+ }
640
+ }
641
+ return {
642
+ start,
643
+ count
644
+ };
645
+ }
646
+ /**
647
+ * Checks if the scale ranges have changed.
648
+ * @param {object} meta - dataset meta.
649
+ * @returns {boolean}
650
+ * @private
651
+ */ function _scaleRangesChanged(meta) {
652
+ const { xScale , yScale , _scaleRanges } = meta;
653
+ const newRanges = {
654
+ xmin: xScale.min,
655
+ xmax: xScale.max,
656
+ ymin: yScale.min,
657
+ ymax: yScale.max
658
+ };
659
+ if (!_scaleRanges) {
660
+ meta._scaleRanges = newRanges;
661
+ return true;
662
+ }
663
+ const changed = _scaleRanges.xmin !== xScale.min || _scaleRanges.xmax !== xScale.max || _scaleRanges.ymin !== yScale.min || _scaleRanges.ymax !== yScale.max;
664
+ Object.assign(_scaleRanges, newRanges);
665
+ return changed;
666
+ }
667
+
668
+ const atEdge = (t)=>t === 0 || t === 1;
669
+ const elasticIn = (t, s, p)=>-(Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * TAU / p));
670
+ const elasticOut = (t, s, p)=>Math.pow(2, -10 * t) * Math.sin((t - s) * TAU / p) + 1;
671
+ /**
672
+ * Easing functions adapted from Robert Penner's easing equations.
673
+ * @namespace Chart.helpers.easing.effects
674
+ * @see http://www.robertpenner.com/easing/
675
+ */ const effects = {
676
+ linear: (t)=>t,
677
+ easeInQuad: (t)=>t * t,
678
+ easeOutQuad: (t)=>-t * (t - 2),
679
+ easeInOutQuad: (t)=>(t /= 0.5) < 1 ? 0.5 * t * t : -0.5 * (--t * (t - 2) - 1),
680
+ easeInCubic: (t)=>t * t * t,
681
+ easeOutCubic: (t)=>(t -= 1) * t * t + 1,
682
+ easeInOutCubic: (t)=>(t /= 0.5) < 1 ? 0.5 * t * t * t : 0.5 * ((t -= 2) * t * t + 2),
683
+ easeInQuart: (t)=>t * t * t * t,
684
+ easeOutQuart: (t)=>-((t -= 1) * t * t * t - 1),
685
+ easeInOutQuart: (t)=>(t /= 0.5) < 1 ? 0.5 * t * t * t * t : -0.5 * ((t -= 2) * t * t * t - 2),
686
+ easeInQuint: (t)=>t * t * t * t * t,
687
+ easeOutQuint: (t)=>(t -= 1) * t * t * t * t + 1,
688
+ easeInOutQuint: (t)=>(t /= 0.5) < 1 ? 0.5 * t * t * t * t * t : 0.5 * ((t -= 2) * t * t * t * t + 2),
689
+ easeInSine: (t)=>-Math.cos(t * HALF_PI) + 1,
690
+ easeOutSine: (t)=>Math.sin(t * HALF_PI),
691
+ easeInOutSine: (t)=>-0.5 * (Math.cos(PI * t) - 1),
692
+ easeInExpo: (t)=>t === 0 ? 0 : Math.pow(2, 10 * (t - 1)),
693
+ easeOutExpo: (t)=>t === 1 ? 1 : -Math.pow(2, -10 * t) + 1,
694
+ easeInOutExpo: (t)=>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),
695
+ easeInCirc: (t)=>t >= 1 ? t : -(Math.sqrt(1 - t * t) - 1),
696
+ easeOutCirc: (t)=>Math.sqrt(1 - (t -= 1) * t),
697
+ easeInOutCirc: (t)=>(t /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - t * t) - 1) : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1),
698
+ easeInElastic: (t)=>atEdge(t) ? t : elasticIn(t, 0.075, 0.3),
699
+ easeOutElastic: (t)=>atEdge(t) ? t : elasticOut(t, 0.075, 0.3),
700
+ easeInOutElastic (t) {
701
+ const s = 0.1125;
702
+ const p = 0.45;
703
+ return atEdge(t) ? t : t < 0.5 ? 0.5 * elasticIn(t * 2, s, p) : 0.5 + 0.5 * elasticOut(t * 2 - 1, s, p);
704
+ },
705
+ easeInBack (t) {
706
+ const s = 1.70158;
707
+ return t * t * ((s + 1) * t - s);
708
+ },
709
+ easeOutBack (t) {
710
+ const s = 1.70158;
711
+ return (t -= 1) * t * ((s + 1) * t + s) + 1;
712
+ },
713
+ easeInOutBack (t) {
714
+ let s = 1.70158;
715
+ if ((t /= 0.5) < 1) {
716
+ return 0.5 * (t * t * (((s *= 1.525) + 1) * t - s));
717
+ }
718
+ return 0.5 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2);
719
+ },
720
+ easeInBounce: (t)=>1 - effects.easeOutBounce(1 - t),
721
+ easeOutBounce (t) {
722
+ const m = 7.5625;
723
+ const d = 2.75;
724
+ if (t < 1 / d) {
725
+ return m * t * t;
726
+ }
727
+ if (t < 2 / d) {
728
+ return m * (t -= 1.5 / d) * t + 0.75;
729
+ }
730
+ if (t < 2.5 / d) {
731
+ return m * (t -= 2.25 / d) * t + 0.9375;
732
+ }
733
+ return m * (t -= 2.625 / d) * t + 0.984375;
734
+ },
735
+ easeInOutBounce: (t)=>t < 0.5 ? effects.easeInBounce(t * 2) * 0.5 : effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5
736
+ };
737
+
738
+ function isPatternOrGradient(value) {
739
+ if (value && typeof value === 'object') {
740
+ const type = value.toString();
741
+ return type === '[object CanvasPattern]' || type === '[object CanvasGradient]';
742
+ }
743
+ return false;
744
+ }
745
+ function color(value) {
746
+ return isPatternOrGradient(value) ? value : new Color(value);
747
+ }
748
+ function getHoverColor(value) {
749
+ return isPatternOrGradient(value) ? value : new Color(value).saturate(0.5).darken(0.1).hexString();
750
+ }
751
+
752
+ const numbers = [
753
+ 'x',
754
+ 'y',
755
+ 'borderWidth',
756
+ 'radius',
757
+ 'tension'
758
+ ];
759
+ const colors = [
760
+ 'color',
761
+ 'borderColor',
762
+ 'backgroundColor'
763
+ ];
764
+ function applyAnimationsDefaults(defaults) {
765
+ defaults.set('animation', {
766
+ delay: undefined,
767
+ duration: 1000,
768
+ easing: 'easeOutQuart',
769
+ fn: undefined,
770
+ from: undefined,
771
+ loop: undefined,
772
+ to: undefined,
773
+ type: undefined
774
+ });
775
+ defaults.describe('animation', {
776
+ _fallback: false,
777
+ _indexable: false,
778
+ _scriptable: (name)=>name !== 'onProgress' && name !== 'onComplete' && name !== 'fn'
779
+ });
780
+ defaults.set('animations', {
781
+ colors: {
782
+ type: 'color',
783
+ properties: colors
784
+ },
785
+ numbers: {
786
+ type: 'number',
787
+ properties: numbers
788
+ }
789
+ });
790
+ defaults.describe('animations', {
791
+ _fallback: 'animation'
792
+ });
793
+ defaults.set('transitions', {
794
+ active: {
795
+ animation: {
796
+ duration: 400
797
+ }
798
+ },
799
+ resize: {
800
+ animation: {
801
+ duration: 0
802
+ }
803
+ },
804
+ show: {
805
+ animations: {
806
+ colors: {
807
+ from: 'transparent'
808
+ },
809
+ visible: {
810
+ type: 'boolean',
811
+ duration: 0
812
+ }
813
+ }
814
+ },
815
+ hide: {
816
+ animations: {
817
+ colors: {
818
+ to: 'transparent'
819
+ },
820
+ visible: {
821
+ type: 'boolean',
822
+ easing: 'linear',
823
+ fn: (v)=>v | 0
824
+ }
825
+ }
826
+ }
827
+ });
828
+ }
829
+
830
+ function applyLayoutsDefaults(defaults) {
831
+ defaults.set('layout', {
832
+ autoPadding: true,
833
+ padding: {
834
+ top: 0,
835
+ right: 0,
836
+ bottom: 0,
837
+ left: 0
838
+ }
839
+ });
840
+ }
841
+
842
+ const intlCache = new Map();
843
+ function getNumberFormat(locale, options) {
844
+ options = options || {};
845
+ const cacheKey = locale + JSON.stringify(options);
846
+ let formatter = intlCache.get(cacheKey);
847
+ if (!formatter) {
848
+ formatter = new Intl.NumberFormat(locale, options);
849
+ intlCache.set(cacheKey, formatter);
850
+ }
851
+ return formatter;
852
+ }
853
+ function formatNumber(num, locale, options) {
854
+ return getNumberFormat(locale, options).format(num);
855
+ }
856
+
857
+ const formatters = {
858
+ values (value) {
859
+ return isArray(value) ? value : '' + value;
860
+ },
861
+ numeric (tickValue, index, ticks) {
862
+ if (tickValue === 0) {
863
+ return '0';
864
+ }
865
+ const locale = this.chart.options.locale;
866
+ let notation;
867
+ let delta = tickValue;
868
+ if (ticks.length > 1) {
869
+ const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));
870
+ if (maxTick < 1e-4 || maxTick > 1e+15) {
871
+ notation = 'scientific';
872
+ }
873
+ delta = calculateDelta(tickValue, ticks);
874
+ }
875
+ const logDelta = log10(Math.abs(delta));
876
+ const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
877
+ const options = {
878
+ notation,
879
+ minimumFractionDigits: numDecimal,
880
+ maximumFractionDigits: numDecimal
881
+ };
882
+ Object.assign(options, this.options.ticks.format);
883
+ return formatNumber(tickValue, locale, options);
884
+ },
885
+ logarithmic (tickValue, index, ticks) {
886
+ if (tickValue === 0) {
887
+ return '0';
888
+ }
889
+ const remain = ticks[index].significand || tickValue / Math.pow(10, Math.floor(log10(tickValue)));
890
+ if ([
891
+ 1,
892
+ 2,
893
+ 3,
894
+ 5,
895
+ 10,
896
+ 15
897
+ ].includes(remain) || index > 0.8 * ticks.length) {
898
+ return formatters.numeric.call(this, tickValue, index, ticks);
899
+ }
900
+ return '';
901
+ }
902
+ };
903
+ function calculateDelta(tickValue, ticks) {
904
+ let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
905
+ if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
906
+ delta = tickValue - Math.floor(tickValue);
907
+ }
908
+ return delta;
909
+ }
910
+ var Ticks = {
911
+ formatters
912
+ };
913
+
914
+ function applyScaleDefaults(defaults) {
915
+ defaults.set('scale', {
916
+ display: true,
917
+ offset: false,
918
+ reverse: false,
919
+ beginAtZero: false,
920
+ bounds: 'ticks',
921
+ clip: true,
922
+ grace: 0,
923
+ grid: {
924
+ display: true,
925
+ lineWidth: 1,
926
+ drawOnChartArea: true,
927
+ drawTicks: true,
928
+ tickLength: 8,
929
+ tickWidth: (_ctx, options)=>options.lineWidth,
930
+ tickColor: (_ctx, options)=>options.color,
931
+ offset: false
932
+ },
933
+ border: {
934
+ display: true,
935
+ dash: [],
936
+ dashOffset: 0.0,
937
+ width: 1
938
+ },
939
+ title: {
940
+ display: false,
941
+ text: '',
942
+ padding: {
943
+ top: 4,
944
+ bottom: 4
945
+ }
946
+ },
947
+ ticks: {
948
+ minRotation: 0,
949
+ maxRotation: 50,
950
+ mirror: false,
951
+ textStrokeWidth: 0,
952
+ textStrokeColor: '',
953
+ padding: 3,
954
+ display: true,
955
+ autoSkip: true,
956
+ autoSkipPadding: 3,
957
+ labelOffset: 0,
958
+ callback: Ticks.formatters.values,
959
+ minor: {},
960
+ major: {},
961
+ align: 'center',
962
+ crossAlign: 'near',
963
+ showLabelBackdrop: false,
964
+ backdropColor: 'rgba(255, 255, 255, 0.75)',
965
+ backdropPadding: 2
966
+ }
967
+ });
968
+ defaults.route('scale.ticks', 'color', '', 'color');
969
+ defaults.route('scale.grid', 'color', '', 'borderColor');
970
+ defaults.route('scale.border', 'color', '', 'borderColor');
971
+ defaults.route('scale.title', 'color', '', 'color');
972
+ defaults.describe('scale', {
973
+ _fallback: false,
974
+ _scriptable: (name)=>!name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser',
975
+ _indexable: (name)=>name !== 'borderDash' && name !== 'tickBorderDash' && name !== 'dash'
976
+ });
977
+ defaults.describe('scales', {
978
+ _fallback: 'scale'
979
+ });
980
+ defaults.describe('scale.ticks', {
981
+ _scriptable: (name)=>name !== 'backdropPadding' && name !== 'callback',
982
+ _indexable: (name)=>name !== 'backdropPadding'
983
+ });
984
+ }
985
+
986
+ const overrides = Object.create(null);
987
+ const descriptors = Object.create(null);
988
+ function getScope$1(node, key) {
989
+ if (!key) {
990
+ return node;
991
+ }
992
+ const keys = key.split('.');
993
+ for(let i = 0, n = keys.length; i < n; ++i){
994
+ const k = keys[i];
995
+ node = node[k] || (node[k] = Object.create(null));
996
+ }
997
+ return node;
998
+ }
999
+ function set(root, scope, values) {
1000
+ if (typeof scope === 'string') {
1001
+ return merge(getScope$1(root, scope), values);
1002
+ }
1003
+ return merge(getScope$1(root, ''), scope);
1004
+ }
1005
+ class Defaults {
1006
+ constructor(_descriptors, _appliers){
1007
+ this.animation = undefined;
1008
+ this.backgroundColor = 'rgba(0,0,0,0.1)';
1009
+ this.borderColor = 'rgba(0,0,0,0.1)';
1010
+ this.color = '#666';
1011
+ this.datasets = {};
1012
+ this.devicePixelRatio = (context)=>context.chart.platform.getDevicePixelRatio();
1013
+ this.elements = {};
1014
+ this.events = [
1015
+ 'mousemove',
1016
+ 'mouseout',
1017
+ 'click',
1018
+ 'touchstart',
1019
+ 'touchmove'
1020
+ ];
1021
+ this.font = {
1022
+ family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
1023
+ size: 12,
1024
+ style: 'normal',
1025
+ lineHeight: 1.2,
1026
+ weight: null
1027
+ };
1028
+ this.hover = {};
1029
+ this.hoverBackgroundColor = (ctx, options)=>getHoverColor(options.backgroundColor);
1030
+ this.hoverBorderColor = (ctx, options)=>getHoverColor(options.borderColor);
1031
+ this.hoverColor = (ctx, options)=>getHoverColor(options.color);
1032
+ this.indexAxis = 'x';
1033
+ this.interaction = {
1034
+ mode: 'nearest',
1035
+ intersect: true,
1036
+ includeInvisible: false
1037
+ };
1038
+ this.maintainAspectRatio = true;
1039
+ this.onHover = null;
1040
+ this.onClick = null;
1041
+ this.parsing = true;
1042
+ this.plugins = {};
1043
+ this.responsive = true;
1044
+ this.scale = undefined;
1045
+ this.scales = {};
1046
+ this.showLine = true;
1047
+ this.drawActiveElementsOnTop = true;
1048
+ this.describe(_descriptors);
1049
+ this.apply(_appliers);
1050
+ }
1051
+ set(scope, values) {
1052
+ return set(this, scope, values);
1053
+ }
1054
+ get(scope) {
1055
+ return getScope$1(this, scope);
1056
+ }
1057
+ describe(scope, values) {
1058
+ return set(descriptors, scope, values);
1059
+ }
1060
+ override(scope, values) {
1061
+ return set(overrides, scope, values);
1062
+ }
1063
+ route(scope, name, targetScope, targetName) {
1064
+ const scopeObject = getScope$1(this, scope);
1065
+ const targetScopeObject = getScope$1(this, targetScope);
1066
+ const privateName = '_' + name;
1067
+ Object.defineProperties(scopeObject, {
1068
+ [privateName]: {
1069
+ value: scopeObject[name],
1070
+ writable: true
1071
+ },
1072
+ [name]: {
1073
+ enumerable: true,
1074
+ get () {
1075
+ const local = this[privateName];
1076
+ const target = targetScopeObject[targetName];
1077
+ if (isObject(local)) {
1078
+ return Object.assign({}, target, local);
1079
+ }
1080
+ return valueOrDefault(local, target);
1081
+ },
1082
+ set (value) {
1083
+ this[privateName] = value;
1084
+ }
1085
+ }
1086
+ });
1087
+ }
1088
+ apply(appliers) {
1089
+ appliers.forEach((apply)=>apply(this));
1090
+ }
1091
+ }
1092
+ var defaults = /* #__PURE__ */ new Defaults({
1093
+ _scriptable: (name)=>!name.startsWith('on'),
1094
+ _indexable: (name)=>name !== 'events',
1095
+ hover: {
1096
+ _fallback: 'interaction'
1097
+ },
1098
+ interaction: {
1099
+ _scriptable: false,
1100
+ _indexable: false
1101
+ }
1102
+ }, [
1103
+ applyAnimationsDefaults,
1104
+ applyLayoutsDefaults,
1105
+ applyScaleDefaults
1106
+ ]);
1107
+
1108
+ /**
1109
+ * Converts the given font object into a CSS font string.
1110
+ * @param font - A font object.
1111
+ * @return The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
1112
+ * @private
1113
+ */ function toFontString(font) {
1114
+ if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {
1115
+ return null;
1116
+ }
1117
+ return (font.style ? font.style + ' ' : '') + (font.weight ? font.weight + ' ' : '') + font.size + 'px ' + font.family;
1118
+ }
1119
+ /**
1120
+ * @private
1121
+ */ function _measureText(ctx, data, gc, longest, string) {
1122
+ let textWidth = data[string];
1123
+ if (!textWidth) {
1124
+ textWidth = data[string] = ctx.measureText(string).width;
1125
+ gc.push(string);
1126
+ }
1127
+ if (textWidth > longest) {
1128
+ longest = textWidth;
1129
+ }
1130
+ return longest;
1131
+ }
1132
+ /**
1133
+ * @private
1134
+ */ // eslint-disable-next-line complexity
1135
+ function _longestText(ctx, font, arrayOfThings, cache) {
1136
+ cache = cache || {};
1137
+ let data = cache.data = cache.data || {};
1138
+ let gc = cache.garbageCollect = cache.garbageCollect || [];
1139
+ if (cache.font !== font) {
1140
+ data = cache.data = {};
1141
+ gc = cache.garbageCollect = [];
1142
+ cache.font = font;
1143
+ }
1144
+ ctx.save();
1145
+ ctx.font = font;
1146
+ let longest = 0;
1147
+ const ilen = arrayOfThings.length;
1148
+ let i, j, jlen, thing, nestedThing;
1149
+ for(i = 0; i < ilen; i++){
1150
+ thing = arrayOfThings[i];
1151
+ // Undefined strings and arrays should not be measured
1152
+ if (thing !== undefined && thing !== null && !isArray(thing)) {
1153
+ longest = _measureText(ctx, data, gc, longest, thing);
1154
+ } else if (isArray(thing)) {
1155
+ // if it is an array lets measure each element
1156
+ // to do maybe simplify this function a bit so we can do this more recursively?
1157
+ for(j = 0, jlen = thing.length; j < jlen; j++){
1158
+ nestedThing = thing[j];
1159
+ // Undefined strings and arrays should not be measured
1160
+ if (nestedThing !== undefined && nestedThing !== null && !isArray(nestedThing)) {
1161
+ longest = _measureText(ctx, data, gc, longest, nestedThing);
1162
+ }
1163
+ }
1164
+ }
1165
+ }
1166
+ ctx.restore();
1167
+ const gcLen = gc.length / 2;
1168
+ if (gcLen > arrayOfThings.length) {
1169
+ for(i = 0; i < gcLen; i++){
1170
+ delete data[gc[i]];
1171
+ }
1172
+ gc.splice(0, gcLen);
1173
+ }
1174
+ return longest;
1175
+ }
1176
+ /**
1177
+ * Returns the aligned pixel value to avoid anti-aliasing blur
1178
+ * @param chart - The chart instance.
1179
+ * @param pixel - A pixel value.
1180
+ * @param width - The width of the element.
1181
+ * @returns The aligned pixel value.
1182
+ * @private
1183
+ */ function _alignPixel(chart, pixel, width) {
1184
+ const devicePixelRatio = chart.currentDevicePixelRatio;
1185
+ const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
1186
+ return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
1187
+ }
1188
+ /**
1189
+ * Clears the entire canvas.
1190
+ */ function clearCanvas(canvas, ctx) {
1191
+ if (!ctx && !canvas) {
1192
+ return;
1193
+ }
1194
+ ctx = ctx || canvas.getContext('2d');
1195
+ ctx.save();
1196
+ // canvas.width and canvas.height do not consider the canvas transform,
1197
+ // while clearRect does
1198
+ ctx.resetTransform();
1199
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1200
+ ctx.restore();
1201
+ }
1202
+ function drawPoint(ctx, options, x, y) {
1203
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
1204
+ drawPointLegend(ctx, options, x, y, null);
1205
+ }
1206
+ // eslint-disable-next-line complexity
1207
+ function drawPointLegend(ctx, options, x, y, w) {
1208
+ let type, xOffset, yOffset, size, cornerRadius, width, xOffsetW, yOffsetW;
1209
+ const style = options.pointStyle;
1210
+ const rotation = options.rotation;
1211
+ const radius = options.radius;
1212
+ let rad = (rotation || 0) * RAD_PER_DEG;
1213
+ if (style && typeof style === 'object') {
1214
+ type = style.toString();
1215
+ if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
1216
+ ctx.save();
1217
+ ctx.translate(x, y);
1218
+ ctx.rotate(rad);
1219
+ ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);
1220
+ ctx.restore();
1221
+ return;
1222
+ }
1223
+ }
1224
+ if (isNaN(radius) || radius <= 0) {
1225
+ return;
1226
+ }
1227
+ ctx.beginPath();
1228
+ switch(style){
1229
+ // Default includes circle
1230
+ default:
1231
+ if (w) {
1232
+ ctx.ellipse(x, y, w / 2, radius, 0, 0, TAU);
1233
+ } else {
1234
+ ctx.arc(x, y, radius, 0, TAU);
1235
+ }
1236
+ ctx.closePath();
1237
+ break;
1238
+ case 'triangle':
1239
+ width = w ? w / 2 : radius;
1240
+ ctx.moveTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
1241
+ rad += TWO_THIRDS_PI;
1242
+ ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
1243
+ rad += TWO_THIRDS_PI;
1244
+ ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);
1245
+ ctx.closePath();
1246
+ break;
1247
+ case 'rectRounded':
1248
+ // NOTE: the rounded rect implementation changed to use `arc` instead of
1249
+ // `quadraticCurveTo` since it generates better results when rect is
1250
+ // almost a circle. 0.516 (instead of 0.5) produces results with visually
1251
+ // closer proportion to the previous impl and it is inscribed in the
1252
+ // circle with `radius`. For more details, see the following PRs:
1253
+ // https://github.com/chartjs/Chart.js/issues/5597
1254
+ // https://github.com/chartjs/Chart.js/issues/5858
1255
+ cornerRadius = radius * 0.516;
1256
+ size = radius - cornerRadius;
1257
+ xOffset = Math.cos(rad + QUARTER_PI) * size;
1258
+ xOffsetW = Math.cos(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);
1259
+ yOffset = Math.sin(rad + QUARTER_PI) * size;
1260
+ yOffsetW = Math.sin(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);
1261
+ ctx.arc(x - xOffsetW, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
1262
+ ctx.arc(x + yOffsetW, y - xOffset, cornerRadius, rad - HALF_PI, rad);
1263
+ ctx.arc(x + xOffsetW, y + yOffset, cornerRadius, rad, rad + HALF_PI);
1264
+ ctx.arc(x - yOffsetW, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
1265
+ ctx.closePath();
1266
+ break;
1267
+ case 'rect':
1268
+ if (!rotation) {
1269
+ size = Math.SQRT1_2 * radius;
1270
+ width = w ? w / 2 : size;
1271
+ ctx.rect(x - width, y - size, 2 * width, 2 * size);
1272
+ break;
1273
+ }
1274
+ rad += QUARTER_PI;
1275
+ /* falls through */ case 'rectRot':
1276
+ xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
1277
+ xOffset = Math.cos(rad) * radius;
1278
+ yOffset = Math.sin(rad) * radius;
1279
+ yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
1280
+ ctx.moveTo(x - xOffsetW, y - yOffset);
1281
+ ctx.lineTo(x + yOffsetW, y - xOffset);
1282
+ ctx.lineTo(x + xOffsetW, y + yOffset);
1283
+ ctx.lineTo(x - yOffsetW, y + xOffset);
1284
+ ctx.closePath();
1285
+ break;
1286
+ case 'crossRot':
1287
+ rad += QUARTER_PI;
1288
+ /* falls through */ case 'cross':
1289
+ xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
1290
+ xOffset = Math.cos(rad) * radius;
1291
+ yOffset = Math.sin(rad) * radius;
1292
+ yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
1293
+ ctx.moveTo(x - xOffsetW, y - yOffset);
1294
+ ctx.lineTo(x + xOffsetW, y + yOffset);
1295
+ ctx.moveTo(x + yOffsetW, y - xOffset);
1296
+ ctx.lineTo(x - yOffsetW, y + xOffset);
1297
+ break;
1298
+ case 'star':
1299
+ xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
1300
+ xOffset = Math.cos(rad) * radius;
1301
+ yOffset = Math.sin(rad) * radius;
1302
+ yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
1303
+ ctx.moveTo(x - xOffsetW, y - yOffset);
1304
+ ctx.lineTo(x + xOffsetW, y + yOffset);
1305
+ ctx.moveTo(x + yOffsetW, y - xOffset);
1306
+ ctx.lineTo(x - yOffsetW, y + xOffset);
1307
+ rad += QUARTER_PI;
1308
+ xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);
1309
+ xOffset = Math.cos(rad) * radius;
1310
+ yOffset = Math.sin(rad) * radius;
1311
+ yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);
1312
+ ctx.moveTo(x - xOffsetW, y - yOffset);
1313
+ ctx.lineTo(x + xOffsetW, y + yOffset);
1314
+ ctx.moveTo(x + yOffsetW, y - xOffset);
1315
+ ctx.lineTo(x - yOffsetW, y + xOffset);
1316
+ break;
1317
+ case 'line':
1318
+ xOffset = w ? w / 2 : Math.cos(rad) * radius;
1319
+ yOffset = Math.sin(rad) * radius;
1320
+ ctx.moveTo(x - xOffset, y - yOffset);
1321
+ ctx.lineTo(x + xOffset, y + yOffset);
1322
+ break;
1323
+ case 'dash':
1324
+ ctx.moveTo(x, y);
1325
+ ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);
1326
+ break;
1327
+ case false:
1328
+ ctx.closePath();
1329
+ break;
1330
+ }
1331
+ ctx.fill();
1332
+ if (options.borderWidth > 0) {
1333
+ ctx.stroke();
1334
+ }
1335
+ }
1336
+ /**
1337
+ * Returns true if the point is inside the rectangle
1338
+ * @param point - The point to test
1339
+ * @param area - The rectangle
1340
+ * @param margin - allowed margin
1341
+ * @private
1342
+ */ function _isPointInArea(point, area, margin) {
1343
+ margin = margin || 0.5; // margin - default is to match rounded decimals
1344
+ return !area || point && point.x > area.left - margin && point.x < area.right + margin && point.y > area.top - margin && point.y < area.bottom + margin;
1345
+ }
1346
+ function clipArea(ctx, area) {
1347
+ ctx.save();
1348
+ ctx.beginPath();
1349
+ ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
1350
+ ctx.clip();
1351
+ }
1352
+ function unclipArea(ctx) {
1353
+ ctx.restore();
1354
+ }
1355
+ /**
1356
+ * @private
1357
+ */ function _steppedLineTo(ctx, previous, target, flip, mode) {
1358
+ if (!previous) {
1359
+ return ctx.lineTo(target.x, target.y);
1360
+ }
1361
+ if (mode === 'middle') {
1362
+ const midpoint = (previous.x + target.x) / 2.0;
1363
+ ctx.lineTo(midpoint, previous.y);
1364
+ ctx.lineTo(midpoint, target.y);
1365
+ } else if (mode === 'after' !== !!flip) {
1366
+ ctx.lineTo(previous.x, target.y);
1367
+ } else {
1368
+ ctx.lineTo(target.x, previous.y);
1369
+ }
1370
+ ctx.lineTo(target.x, target.y);
1371
+ }
1372
+ /**
1373
+ * @private
1374
+ */ function _bezierCurveTo(ctx, previous, target, flip) {
1375
+ if (!previous) {
1376
+ return ctx.lineTo(target.x, target.y);
1377
+ }
1378
+ 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);
1379
+ }
1380
+ function setRenderOpts(ctx, opts) {
1381
+ if (opts.translation) {
1382
+ ctx.translate(opts.translation[0], opts.translation[1]);
1383
+ }
1384
+ if (!isNullOrUndef(opts.rotation)) {
1385
+ ctx.rotate(opts.rotation);
1386
+ }
1387
+ if (opts.color) {
1388
+ ctx.fillStyle = opts.color;
1389
+ }
1390
+ if (opts.textAlign) {
1391
+ ctx.textAlign = opts.textAlign;
1392
+ }
1393
+ if (opts.textBaseline) {
1394
+ ctx.textBaseline = opts.textBaseline;
1395
+ }
1396
+ }
1397
+ function decorateText(ctx, x, y, line, opts) {
1398
+ if (opts.strikethrough || opts.underline) {
1399
+ /**
1400
+ * Now that IE11 support has been dropped, we can use more
1401
+ * of the TextMetrics object. The actual bounding boxes
1402
+ * are unflagged in Chrome, Firefox, Edge, and Safari so they
1403
+ * can be safely used.
1404
+ * See https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics#Browser_compatibility
1405
+ */ const metrics = ctx.measureText(line);
1406
+ const left = x - metrics.actualBoundingBoxLeft;
1407
+ const right = x + metrics.actualBoundingBoxRight;
1408
+ const top = y - metrics.actualBoundingBoxAscent;
1409
+ const bottom = y + metrics.actualBoundingBoxDescent;
1410
+ const yDecoration = opts.strikethrough ? (top + bottom) / 2 : bottom;
1411
+ ctx.strokeStyle = ctx.fillStyle;
1412
+ ctx.beginPath();
1413
+ ctx.lineWidth = opts.decorationWidth || 2;
1414
+ ctx.moveTo(left, yDecoration);
1415
+ ctx.lineTo(right, yDecoration);
1416
+ ctx.stroke();
1417
+ }
1418
+ }
1419
+ function drawBackdrop(ctx, opts) {
1420
+ const oldColor = ctx.fillStyle;
1421
+ ctx.fillStyle = opts.color;
1422
+ ctx.fillRect(opts.left, opts.top, opts.width, opts.height);
1423
+ ctx.fillStyle = oldColor;
1424
+ }
1425
+ /**
1426
+ * Render text onto the canvas
1427
+ */ function renderText(ctx, text, x, y, font, opts = {}) {
1428
+ const lines = isArray(text) ? text : [
1429
+ text
1430
+ ];
1431
+ const stroke = opts.strokeWidth > 0 && opts.strokeColor !== '';
1432
+ let i, line;
1433
+ ctx.save();
1434
+ ctx.font = font.string;
1435
+ setRenderOpts(ctx, opts);
1436
+ for(i = 0; i < lines.length; ++i){
1437
+ line = lines[i];
1438
+ if (opts.backdrop) {
1439
+ drawBackdrop(ctx, opts.backdrop);
1440
+ }
1441
+ if (stroke) {
1442
+ if (opts.strokeColor) {
1443
+ ctx.strokeStyle = opts.strokeColor;
1444
+ }
1445
+ if (!isNullOrUndef(opts.strokeWidth)) {
1446
+ ctx.lineWidth = opts.strokeWidth;
1447
+ }
1448
+ ctx.strokeText(line, x, y, opts.maxWidth);
1449
+ }
1450
+ ctx.fillText(line, x, y, opts.maxWidth);
1451
+ decorateText(ctx, x, y, line, opts);
1452
+ y += Number(font.lineHeight);
1453
+ }
1454
+ ctx.restore();
1455
+ }
1456
+ /**
1457
+ * Add a path of a rectangle with rounded corners to the current sub-path
1458
+ * @param ctx - Context
1459
+ * @param rect - Bounding rect
1460
+ */ function addRoundedRectPath(ctx, rect) {
1461
+ const { x , y , w , h , radius } = rect;
1462
+ // top left arc
1463
+ ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, 1.5 * PI, PI, true);
1464
+ // line from top left to bottom left
1465
+ ctx.lineTo(x, y + h - radius.bottomLeft);
1466
+ // bottom left arc
1467
+ ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
1468
+ // line from bottom left to bottom right
1469
+ ctx.lineTo(x + w - radius.bottomRight, y + h);
1470
+ // bottom right arc
1471
+ ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
1472
+ // line from bottom right to top right
1473
+ ctx.lineTo(x + w, y + radius.topRight);
1474
+ // top right arc
1475
+ ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);
1476
+ // line from top right to top left
1477
+ ctx.lineTo(x + radius.topLeft, y);
1478
+ }
1479
+
1480
+ const LINE_HEIGHT = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/;
1481
+ const FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;
1482
+ /**
1483
+ * @alias Chart.helpers.options
1484
+ * @namespace
1485
+ */ /**
1486
+ * Converts the given line height `value` in pixels for a specific font `size`.
1487
+ * @param value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
1488
+ * @param size - The font size (in pixels) used to resolve relative `value`.
1489
+ * @returns The effective line height in pixels (size * 1.2 if value is invalid).
1490
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
1491
+ * @since 2.7.0
1492
+ */ function toLineHeight(value, size) {
1493
+ const matches = ('' + value).match(LINE_HEIGHT);
1494
+ if (!matches || matches[1] === 'normal') {
1495
+ return size * 1.2;
1496
+ }
1497
+ value = +matches[2];
1498
+ switch(matches[3]){
1499
+ case 'px':
1500
+ return value;
1501
+ case '%':
1502
+ value /= 100;
1503
+ break;
1504
+ }
1505
+ return size * value;
1506
+ }
1507
+ const numberOrZero = (v)=>+v || 0;
1508
+ function _readValueToProps(value, props) {
1509
+ const ret = {};
1510
+ const objProps = isObject(props);
1511
+ const keys = objProps ? Object.keys(props) : props;
1512
+ const read = isObject(value) ? objProps ? (prop)=>valueOrDefault(value[prop], value[props[prop]]) : (prop)=>value[prop] : ()=>value;
1513
+ for (const prop of keys){
1514
+ ret[prop] = numberOrZero(read(prop));
1515
+ }
1516
+ return ret;
1517
+ }
1518
+ /**
1519
+ * Converts the given value into a TRBL object.
1520
+ * @param value - If a number, set the value to all TRBL component,
1521
+ * else, if an object, use defined properties and sets undefined ones to 0.
1522
+ * x / y are shorthands for same value for left/right and top/bottom.
1523
+ * @returns The padding values (top, right, bottom, left)
1524
+ * @since 3.0.0
1525
+ */ function toTRBL(value) {
1526
+ return _readValueToProps(value, {
1527
+ top: 'y',
1528
+ right: 'x',
1529
+ bottom: 'y',
1530
+ left: 'x'
1531
+ });
1532
+ }
1533
+ /**
1534
+ * Converts the given value into a TRBL corners object (similar with css border-radius).
1535
+ * @param value - If a number, set the value to all TRBL corner components,
1536
+ * else, if an object, use defined properties and sets undefined ones to 0.
1537
+ * @returns The TRBL corner values (topLeft, topRight, bottomLeft, bottomRight)
1538
+ * @since 3.0.0
1539
+ */ function toTRBLCorners(value) {
1540
+ return _readValueToProps(value, [
1541
+ 'topLeft',
1542
+ 'topRight',
1543
+ 'bottomLeft',
1544
+ 'bottomRight'
1545
+ ]);
1546
+ }
1547
+ /**
1548
+ * Converts the given value into a padding object with pre-computed width/height.
1549
+ * @param value - If a number, set the value to all TRBL component,
1550
+ * else, if an object, use defined properties and sets undefined ones to 0.
1551
+ * x / y are shorthands for same value for left/right and top/bottom.
1552
+ * @returns The padding values (top, right, bottom, left, width, height)
1553
+ * @since 2.7.0
1554
+ */ function toPadding(value) {
1555
+ const obj = toTRBL(value);
1556
+ obj.width = obj.left + obj.right;
1557
+ obj.height = obj.top + obj.bottom;
1558
+ return obj;
1559
+ }
1560
+ /**
1561
+ * Parses font options and returns the font object.
1562
+ * @param options - A object that contains font options to be parsed.
1563
+ * @param fallback - A object that contains fallback font options.
1564
+ * @return The font object.
1565
+ * @private
1566
+ */ function toFont(options, fallback) {
1567
+ options = options || {};
1568
+ fallback = fallback || defaults.font;
1569
+ let size = valueOrDefault(options.size, fallback.size);
1570
+ if (typeof size === 'string') {
1571
+ size = parseInt(size, 10);
1572
+ }
1573
+ let style = valueOrDefault(options.style, fallback.style);
1574
+ if (style && !('' + style).match(FONT_STYLE)) {
1575
+ console.warn('Invalid font style specified: "' + style + '"');
1576
+ style = undefined;
1577
+ }
1578
+ const font = {
1579
+ family: valueOrDefault(options.family, fallback.family),
1580
+ lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback.lineHeight), size),
1581
+ size,
1582
+ style,
1583
+ weight: valueOrDefault(options.weight, fallback.weight),
1584
+ string: ''
1585
+ };
1586
+ font.string = toFontString(font);
1587
+ return font;
1588
+ }
1589
+ /**
1590
+ * Evaluates the given `inputs` sequentially and returns the first defined value.
1591
+ * @param inputs - An array of values, falling back to the last value.
1592
+ * @param context - If defined and the current value is a function, the value
1593
+ * is called with `context` as first argument and the result becomes the new input.
1594
+ * @param index - If defined and the current value is an array, the value
1595
+ * at `index` become the new input.
1596
+ * @param info - object to return information about resolution in
1597
+ * @param info.cacheable - Will be set to `false` if option is not cacheable.
1598
+ * @since 2.7.0
1599
+ */ function resolve(inputs, context, index, info) {
1600
+ let cacheable = true;
1601
+ let i, ilen, value;
1602
+ for(i = 0, ilen = inputs.length; i < ilen; ++i){
1603
+ value = inputs[i];
1604
+ if (value === undefined) {
1605
+ continue;
1606
+ }
1607
+ if (context !== undefined && typeof value === 'function') {
1608
+ value = value(context);
1609
+ cacheable = false;
1610
+ }
1611
+ if (index !== undefined && isArray(value)) {
1612
+ value = value[index % value.length];
1613
+ cacheable = false;
1614
+ }
1615
+ if (value !== undefined) {
1616
+ if (info && !cacheable) {
1617
+ info.cacheable = false;
1618
+ }
1619
+ return value;
1620
+ }
1621
+ }
1622
+ }
1623
+ /**
1624
+ * @param minmax
1625
+ * @param grace
1626
+ * @param beginAtZero
1627
+ * @private
1628
+ */ function _addGrace(minmax, grace, beginAtZero) {
1629
+ const { min , max } = minmax;
1630
+ const change = toDimension(grace, (max - min) / 2);
1631
+ const keepZero = (value, add)=>beginAtZero && value === 0 ? 0 : value + add;
1632
+ return {
1633
+ min: keepZero(min, -Math.abs(change)),
1634
+ max: keepZero(max, change)
1635
+ };
1636
+ }
1637
+ function createContext(parentContext, context) {
1638
+ return Object.assign(Object.create(parentContext), context);
1639
+ }
1640
+
1641
+ /**
1642
+ * Creates a Proxy for resolving raw values for options.
1643
+ * @param scopes - The option scopes to look for values, in resolution order
1644
+ * @param prefixes - The prefixes for values, in resolution order.
1645
+ * @param rootScopes - The root option scopes
1646
+ * @param fallback - Parent scopes fallback
1647
+ * @param getTarget - callback for getting the target for changed values
1648
+ * @returns Proxy
1649
+ * @private
1650
+ */ function _createResolver(scopes, prefixes = [
1651
+ ''
1652
+ ], rootScopes, fallback, getTarget = ()=>scopes[0]) {
1653
+ const finalRootScopes = rootScopes || scopes;
1654
+ if (typeof fallback === 'undefined') {
1655
+ fallback = _resolve('_fallback', scopes);
1656
+ }
1657
+ const cache = {
1658
+ [Symbol.toStringTag]: 'Object',
1659
+ _cacheable: true,
1660
+ _scopes: scopes,
1661
+ _rootScopes: finalRootScopes,
1662
+ _fallback: fallback,
1663
+ _getTarget: getTarget,
1664
+ override: (scope)=>_createResolver([
1665
+ scope,
1666
+ ...scopes
1667
+ ], prefixes, finalRootScopes, fallback)
1668
+ };
1669
+ return new Proxy(cache, {
1670
+ /**
1671
+ * A trap for the delete operator.
1672
+ */ deleteProperty (target, prop) {
1673
+ delete target[prop]; // remove from cache
1674
+ delete target._keys; // remove cached keys
1675
+ delete scopes[0][prop]; // remove from top level scope
1676
+ return true;
1677
+ },
1678
+ /**
1679
+ * A trap for getting property values.
1680
+ */ get (target, prop) {
1681
+ return _cached(target, prop, ()=>_resolveWithPrefixes(prop, prefixes, scopes, target));
1682
+ },
1683
+ /**
1684
+ * A trap for Object.getOwnPropertyDescriptor.
1685
+ * Also used by Object.hasOwnProperty.
1686
+ */ getOwnPropertyDescriptor (target, prop) {
1687
+ return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);
1688
+ },
1689
+ /**
1690
+ * A trap for Object.getPrototypeOf.
1691
+ */ getPrototypeOf () {
1692
+ return Reflect.getPrototypeOf(scopes[0]);
1693
+ },
1694
+ /**
1695
+ * A trap for the in operator.
1696
+ */ has (target, prop) {
1697
+ return getKeysFromAllScopes(target).includes(prop);
1698
+ },
1699
+ /**
1700
+ * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
1701
+ */ ownKeys (target) {
1702
+ return getKeysFromAllScopes(target);
1703
+ },
1704
+ /**
1705
+ * A trap for setting property values.
1706
+ */ set (target, prop, value) {
1707
+ const storage = target._storage || (target._storage = getTarget());
1708
+ target[prop] = storage[prop] = value; // set to top level scope + cache
1709
+ delete target._keys; // remove cached keys
1710
+ return true;
1711
+ }
1712
+ });
1713
+ }
1714
+ /**
1715
+ * Returns an Proxy for resolving option values with context.
1716
+ * @param proxy - The Proxy returned by `_createResolver`
1717
+ * @param context - Context object for scriptable/indexable options
1718
+ * @param subProxy - The proxy provided for scriptable options
1719
+ * @param descriptorDefaults - Defaults for descriptors
1720
+ * @private
1721
+ */ function _attachContext(proxy, context, subProxy, descriptorDefaults) {
1722
+ const cache = {
1723
+ _cacheable: false,
1724
+ _proxy: proxy,
1725
+ _context: context,
1726
+ _subProxy: subProxy,
1727
+ _stack: new Set(),
1728
+ _descriptors: _descriptors(proxy, descriptorDefaults),
1729
+ setContext: (ctx)=>_attachContext(proxy, ctx, subProxy, descriptorDefaults),
1730
+ override: (scope)=>_attachContext(proxy.override(scope), context, subProxy, descriptorDefaults)
1731
+ };
1732
+ return new Proxy(cache, {
1733
+ /**
1734
+ * A trap for the delete operator.
1735
+ */ deleteProperty (target, prop) {
1736
+ delete target[prop]; // remove from cache
1737
+ delete proxy[prop]; // remove from proxy
1738
+ return true;
1739
+ },
1740
+ /**
1741
+ * A trap for getting property values.
1742
+ */ get (target, prop, receiver) {
1743
+ return _cached(target, prop, ()=>_resolveWithContext(target, prop, receiver));
1744
+ },
1745
+ /**
1746
+ * A trap for Object.getOwnPropertyDescriptor.
1747
+ * Also used by Object.hasOwnProperty.
1748
+ */ getOwnPropertyDescriptor (target, prop) {
1749
+ return target._descriptors.allKeys ? Reflect.has(proxy, prop) ? {
1750
+ enumerable: true,
1751
+ configurable: true
1752
+ } : undefined : Reflect.getOwnPropertyDescriptor(proxy, prop);
1753
+ },
1754
+ /**
1755
+ * A trap for Object.getPrototypeOf.
1756
+ */ getPrototypeOf () {
1757
+ return Reflect.getPrototypeOf(proxy);
1758
+ },
1759
+ /**
1760
+ * A trap for the in operator.
1761
+ */ has (target, prop) {
1762
+ return Reflect.has(proxy, prop);
1763
+ },
1764
+ /**
1765
+ * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
1766
+ */ ownKeys () {
1767
+ return Reflect.ownKeys(proxy);
1768
+ },
1769
+ /**
1770
+ * A trap for setting property values.
1771
+ */ set (target, prop, value) {
1772
+ proxy[prop] = value; // set to proxy
1773
+ delete target[prop]; // remove from cache
1774
+ return true;
1775
+ }
1776
+ });
1777
+ }
1778
+ /**
1779
+ * @private
1780
+ */ function _descriptors(proxy, defaults = {
1781
+ scriptable: true,
1782
+ indexable: true
1783
+ }) {
1784
+ const { _scriptable =defaults.scriptable , _indexable =defaults.indexable , _allKeys =defaults.allKeys } = proxy;
1785
+ return {
1786
+ allKeys: _allKeys,
1787
+ scriptable: _scriptable,
1788
+ indexable: _indexable,
1789
+ isScriptable: isFunction(_scriptable) ? _scriptable : ()=>_scriptable,
1790
+ isIndexable: isFunction(_indexable) ? _indexable : ()=>_indexable
1791
+ };
1792
+ }
1793
+ const readKey = (prefix, name)=>prefix ? prefix + _capitalize(name) : name;
1794
+ const needsSubResolver = (prop, value)=>isObject(value) && prop !== 'adapters' && (Object.getPrototypeOf(value) === null || value.constructor === Object);
1795
+ function _cached(target, prop, resolve) {
1796
+ if (Object.prototype.hasOwnProperty.call(target, prop) || prop === 'constructor') {
1797
+ return target[prop];
1798
+ }
1799
+ const value = resolve();
1800
+ // cache the resolved value
1801
+ target[prop] = value;
1802
+ return value;
1803
+ }
1804
+ function _resolveWithContext(target, prop, receiver) {
1805
+ const { _proxy , _context , _subProxy , _descriptors: descriptors } = target;
1806
+ let value = _proxy[prop]; // resolve from proxy
1807
+ // resolve with context
1808
+ if (isFunction(value) && descriptors.isScriptable(prop)) {
1809
+ value = _resolveScriptable(prop, value, target, receiver);
1810
+ }
1811
+ if (isArray(value) && value.length) {
1812
+ value = _resolveArray(prop, value, target, descriptors.isIndexable);
1813
+ }
1814
+ if (needsSubResolver(prop, value)) {
1815
+ // if the resolved value is an object, create a sub resolver for it
1816
+ value = _attachContext(value, _context, _subProxy && _subProxy[prop], descriptors);
1817
+ }
1818
+ return value;
1819
+ }
1820
+ function _resolveScriptable(prop, getValue, target, receiver) {
1821
+ const { _proxy , _context , _subProxy , _stack } = target;
1822
+ if (_stack.has(prop)) {
1823
+ throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);
1824
+ }
1825
+ _stack.add(prop);
1826
+ let value = getValue(_context, _subProxy || receiver);
1827
+ _stack.delete(prop);
1828
+ if (needsSubResolver(prop, value)) {
1829
+ // When scriptable option returns an object, create a resolver on that.
1830
+ value = createSubResolver(_proxy._scopes, _proxy, prop, value);
1831
+ }
1832
+ return value;
1833
+ }
1834
+ function _resolveArray(prop, value, target, isIndexable) {
1835
+ const { _proxy , _context , _subProxy , _descriptors: descriptors } = target;
1836
+ if (typeof _context.index !== 'undefined' && isIndexable(prop)) {
1837
+ return value[_context.index % value.length];
1838
+ } else if (isObject(value[0])) {
1839
+ // Array of objects, return array or resolvers
1840
+ const arr = value;
1841
+ const scopes = _proxy._scopes.filter((s)=>s !== arr);
1842
+ value = [];
1843
+ for (const item of arr){
1844
+ const resolver = createSubResolver(scopes, _proxy, prop, item);
1845
+ value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors));
1846
+ }
1847
+ }
1848
+ return value;
1849
+ }
1850
+ function resolveFallback(fallback, prop, value) {
1851
+ return isFunction(fallback) ? fallback(prop, value) : fallback;
1852
+ }
1853
+ const getScope = (key, parent)=>key === true ? parent : typeof key === 'string' ? resolveObjectKey(parent, key) : undefined;
1854
+ function addScopes(set, parentScopes, key, parentFallback, value) {
1855
+ for (const parent of parentScopes){
1856
+ const scope = getScope(key, parent);
1857
+ if (scope) {
1858
+ set.add(scope);
1859
+ const fallback = resolveFallback(scope._fallback, key, value);
1860
+ if (typeof fallback !== 'undefined' && fallback !== key && fallback !== parentFallback) {
1861
+ // When we reach the descriptor that defines a new _fallback, return that.
1862
+ // The fallback will resume to that new scope.
1863
+ return fallback;
1864
+ }
1865
+ } else if (scope === false && typeof parentFallback !== 'undefined' && key !== parentFallback) {
1866
+ // Fallback to `false` results to `false`, when falling back to different key.
1867
+ // For example `interaction` from `hover` or `plugins.tooltip` and `animation` from `animations`
1868
+ return null;
1869
+ }
1870
+ }
1871
+ return false;
1872
+ }
1873
+ function createSubResolver(parentScopes, resolver, prop, value) {
1874
+ const rootScopes = resolver._rootScopes;
1875
+ const fallback = resolveFallback(resolver._fallback, prop, value);
1876
+ const allScopes = [
1877
+ ...parentScopes,
1878
+ ...rootScopes
1879
+ ];
1880
+ const set = new Set();
1881
+ set.add(value);
1882
+ let key = addScopesFromKey(set, allScopes, prop, fallback || prop, value);
1883
+ if (key === null) {
1884
+ return false;
1885
+ }
1886
+ if (typeof fallback !== 'undefined' && fallback !== prop) {
1887
+ key = addScopesFromKey(set, allScopes, fallback, key, value);
1888
+ if (key === null) {
1889
+ return false;
1890
+ }
1891
+ }
1892
+ return _createResolver(Array.from(set), [
1893
+ ''
1894
+ ], rootScopes, fallback, ()=>subGetTarget(resolver, prop, value));
1895
+ }
1896
+ function addScopesFromKey(set, allScopes, key, fallback, item) {
1897
+ while(key){
1898
+ key = addScopes(set, allScopes, key, fallback, item);
1899
+ }
1900
+ return key;
1901
+ }
1902
+ function subGetTarget(resolver, prop, value) {
1903
+ const parent = resolver._getTarget();
1904
+ if (!(prop in parent)) {
1905
+ parent[prop] = {};
1906
+ }
1907
+ const target = parent[prop];
1908
+ if (isArray(target) && isObject(value)) {
1909
+ // For array of objects, the object is used to store updated values
1910
+ return value;
1911
+ }
1912
+ return target || {};
1913
+ }
1914
+ function _resolveWithPrefixes(prop, prefixes, scopes, proxy) {
1915
+ let value;
1916
+ for (const prefix of prefixes){
1917
+ value = _resolve(readKey(prefix, prop), scopes);
1918
+ if (typeof value !== 'undefined') {
1919
+ return needsSubResolver(prop, value) ? createSubResolver(scopes, proxy, prop, value) : value;
1920
+ }
1921
+ }
1922
+ }
1923
+ function _resolve(key, scopes) {
1924
+ for (const scope of scopes){
1925
+ if (!scope) {
1926
+ continue;
1927
+ }
1928
+ const value = scope[key];
1929
+ if (typeof value !== 'undefined') {
1930
+ return value;
1931
+ }
1932
+ }
1933
+ }
1934
+ function getKeysFromAllScopes(target) {
1935
+ let keys = target._keys;
1936
+ if (!keys) {
1937
+ keys = target._keys = resolveKeysFromAllScopes(target._scopes);
1938
+ }
1939
+ return keys;
1940
+ }
1941
+ function resolveKeysFromAllScopes(scopes) {
1942
+ const set = new Set();
1943
+ for (const scope of scopes){
1944
+ for (const key of Object.keys(scope).filter((k)=>!k.startsWith('_'))){
1945
+ set.add(key);
1946
+ }
1947
+ }
1948
+ return Array.from(set);
1949
+ }
1950
+ function _parseObjectDataRadialScale(meta, data, start, count) {
1951
+ const { iScale } = meta;
1952
+ const { key ='r' } = this._parsing;
1953
+ const parsed = new Array(count);
1954
+ let i, ilen, index, item;
1955
+ for(i = 0, ilen = count; i < ilen; ++i){
1956
+ index = i + start;
1957
+ item = data[index];
1958
+ parsed[i] = {
1959
+ r: iScale.parse(resolveObjectKey(item, key), index)
1960
+ };
1961
+ }
1962
+ return parsed;
1963
+ }
1964
+
1965
+ const EPSILON = Number.EPSILON || 1e-14;
1966
+ const getPoint = (points, i)=>i < points.length && !points[i].skip && points[i];
1967
+ const getValueAxis = (indexAxis)=>indexAxis === 'x' ? 'y' : 'x';
1968
+ function splineCurve(firstPoint, middlePoint, afterPoint, t) {
1969
+ // Props to Rob Spencer at scaled innovation for his post on splining between points
1970
+ // http://scaledinnovation.com/analytics/splines/aboutSplines.html
1971
+ // This function must also respect "skipped" points
1972
+ const previous = firstPoint.skip ? middlePoint : firstPoint;
1973
+ const current = middlePoint;
1974
+ const next = afterPoint.skip ? middlePoint : afterPoint;
1975
+ const d01 = distanceBetweenPoints(current, previous);
1976
+ const d12 = distanceBetweenPoints(next, current);
1977
+ let s01 = d01 / (d01 + d12);
1978
+ let s12 = d12 / (d01 + d12);
1979
+ // If all points are the same, s01 & s02 will be inf
1980
+ s01 = isNaN(s01) ? 0 : s01;
1981
+ s12 = isNaN(s12) ? 0 : s12;
1982
+ const fa = t * s01; // scaling factor for triangle Ta
1983
+ const fb = t * s12;
1984
+ return {
1985
+ previous: {
1986
+ x: current.x - fa * (next.x - previous.x),
1987
+ y: current.y - fa * (next.y - previous.y)
1988
+ },
1989
+ next: {
1990
+ x: current.x + fb * (next.x - previous.x),
1991
+ y: current.y + fb * (next.y - previous.y)
1992
+ }
1993
+ };
1994
+ }
1995
+ /**
1996
+ * Adjust tangents to ensure monotonic properties
1997
+ */ function monotoneAdjust(points, deltaK, mK) {
1998
+ const pointsLen = points.length;
1999
+ let alphaK, betaK, tauK, squaredMagnitude, pointCurrent;
2000
+ let pointAfter = getPoint(points, 0);
2001
+ for(let i = 0; i < pointsLen - 1; ++i){
2002
+ pointCurrent = pointAfter;
2003
+ pointAfter = getPoint(points, i + 1);
2004
+ if (!pointCurrent || !pointAfter) {
2005
+ continue;
2006
+ }
2007
+ if (almostEquals(deltaK[i], 0, EPSILON)) {
2008
+ mK[i] = mK[i + 1] = 0;
2009
+ continue;
2010
+ }
2011
+ alphaK = mK[i] / deltaK[i];
2012
+ betaK = mK[i + 1] / deltaK[i];
2013
+ squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
2014
+ if (squaredMagnitude <= 9) {
2015
+ continue;
2016
+ }
2017
+ tauK = 3 / Math.sqrt(squaredMagnitude);
2018
+ mK[i] = alphaK * tauK * deltaK[i];
2019
+ mK[i + 1] = betaK * tauK * deltaK[i];
2020
+ }
2021
+ }
2022
+ function monotoneCompute(points, mK, indexAxis = 'x') {
2023
+ const valueAxis = getValueAxis(indexAxis);
2024
+ const pointsLen = points.length;
2025
+ let delta, pointBefore, pointCurrent;
2026
+ let pointAfter = getPoint(points, 0);
2027
+ for(let i = 0; i < pointsLen; ++i){
2028
+ pointBefore = pointCurrent;
2029
+ pointCurrent = pointAfter;
2030
+ pointAfter = getPoint(points, i + 1);
2031
+ if (!pointCurrent) {
2032
+ continue;
2033
+ }
2034
+ const iPixel = pointCurrent[indexAxis];
2035
+ const vPixel = pointCurrent[valueAxis];
2036
+ if (pointBefore) {
2037
+ delta = (iPixel - pointBefore[indexAxis]) / 3;
2038
+ pointCurrent[`cp1${indexAxis}`] = iPixel - delta;
2039
+ pointCurrent[`cp1${valueAxis}`] = vPixel - delta * mK[i];
2040
+ }
2041
+ if (pointAfter) {
2042
+ delta = (pointAfter[indexAxis] - iPixel) / 3;
2043
+ pointCurrent[`cp2${indexAxis}`] = iPixel + delta;
2044
+ pointCurrent[`cp2${valueAxis}`] = vPixel + delta * mK[i];
2045
+ }
2046
+ }
2047
+ }
2048
+ /**
2049
+ * This function calculates Bézier control points in a similar way than |splineCurve|,
2050
+ * but preserves monotonicity of the provided data and ensures no local extremums are added
2051
+ * between the dataset discrete points due to the interpolation.
2052
+ * See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
2053
+ */ function splineCurveMonotone(points, indexAxis = 'x') {
2054
+ const valueAxis = getValueAxis(indexAxis);
2055
+ const pointsLen = points.length;
2056
+ const deltaK = Array(pointsLen).fill(0);
2057
+ const mK = Array(pointsLen);
2058
+ // Calculate slopes (deltaK) and initialize tangents (mK)
2059
+ let i, pointBefore, pointCurrent;
2060
+ let pointAfter = getPoint(points, 0);
2061
+ for(i = 0; i < pointsLen; ++i){
2062
+ pointBefore = pointCurrent;
2063
+ pointCurrent = pointAfter;
2064
+ pointAfter = getPoint(points, i + 1);
2065
+ if (!pointCurrent) {
2066
+ continue;
2067
+ }
2068
+ if (pointAfter) {
2069
+ const slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];
2070
+ // In the case of two points that appear at the same x pixel, slopeDeltaX is 0
2071
+ deltaK[i] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;
2072
+ }
2073
+ mK[i] = !pointBefore ? deltaK[i] : !pointAfter ? deltaK[i - 1] : sign(deltaK[i - 1]) !== sign(deltaK[i]) ? 0 : (deltaK[i - 1] + deltaK[i]) / 2;
2074
+ }
2075
+ monotoneAdjust(points, deltaK, mK);
2076
+ monotoneCompute(points, mK, indexAxis);
2077
+ }
2078
+ function capControlPoint(pt, min, max) {
2079
+ return Math.max(Math.min(pt, max), min);
2080
+ }
2081
+ function capBezierPoints(points, area) {
2082
+ let i, ilen, point, inArea, inAreaPrev;
2083
+ let inAreaNext = _isPointInArea(points[0], area);
2084
+ for(i = 0, ilen = points.length; i < ilen; ++i){
2085
+ inAreaPrev = inArea;
2086
+ inArea = inAreaNext;
2087
+ inAreaNext = i < ilen - 1 && _isPointInArea(points[i + 1], area);
2088
+ if (!inArea) {
2089
+ continue;
2090
+ }
2091
+ point = points[i];
2092
+ if (inAreaPrev) {
2093
+ point.cp1x = capControlPoint(point.cp1x, area.left, area.right);
2094
+ point.cp1y = capControlPoint(point.cp1y, area.top, area.bottom);
2095
+ }
2096
+ if (inAreaNext) {
2097
+ point.cp2x = capControlPoint(point.cp2x, area.left, area.right);
2098
+ point.cp2y = capControlPoint(point.cp2y, area.top, area.bottom);
2099
+ }
2100
+ }
2101
+ }
2102
+ /**
2103
+ * @private
2104
+ */ function _updateBezierControlPoints(points, options, area, loop, indexAxis) {
2105
+ let i, ilen, point, controlPoints;
2106
+ // Only consider points that are drawn in case the spanGaps option is used
2107
+ if (options.spanGaps) {
2108
+ points = points.filter((pt)=>!pt.skip);
2109
+ }
2110
+ if (options.cubicInterpolationMode === 'monotone') {
2111
+ splineCurveMonotone(points, indexAxis);
2112
+ } else {
2113
+ let prev = loop ? points[points.length - 1] : points[0];
2114
+ for(i = 0, ilen = points.length; i < ilen; ++i){
2115
+ point = points[i];
2116
+ controlPoints = splineCurve(prev, point, points[Math.min(i + 1, ilen - (loop ? 0 : 1)) % ilen], options.tension);
2117
+ point.cp1x = controlPoints.previous.x;
2118
+ point.cp1y = controlPoints.previous.y;
2119
+ point.cp2x = controlPoints.next.x;
2120
+ point.cp2y = controlPoints.next.y;
2121
+ prev = point;
2122
+ }
2123
+ }
2124
+ if (options.capBezierPoints) {
2125
+ capBezierPoints(points, area);
2126
+ }
2127
+ }
2128
+
2129
+ /**
2130
+ * Note: typedefs are auto-exported, so use a made-up `dom` namespace where
2131
+ * necessary to avoid duplicates with `export * from './helpers`; see
2132
+ * https://github.com/microsoft/TypeScript/issues/46011
2133
+ * @typedef { import('../core/core.controller.js').default } dom.Chart
2134
+ * @typedef { import('../../types').ChartEvent } ChartEvent
2135
+ */ /**
2136
+ * @private
2137
+ */ function _isDomSupported() {
2138
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
2139
+ }
2140
+ /**
2141
+ * @private
2142
+ */ function _getParentNode(domNode) {
2143
+ let parent = domNode.parentNode;
2144
+ if (parent && parent.toString() === '[object ShadowRoot]') {
2145
+ parent = parent.host;
2146
+ }
2147
+ return parent;
2148
+ }
2149
+ /**
2150
+ * convert max-width/max-height values that may be percentages into a number
2151
+ * @private
2152
+ */ function parseMaxStyle(styleValue, node, parentProperty) {
2153
+ let valueInPixels;
2154
+ if (typeof styleValue === 'string') {
2155
+ valueInPixels = parseInt(styleValue, 10);
2156
+ if (styleValue.indexOf('%') !== -1) {
2157
+ // percentage * size in dimension
2158
+ valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
2159
+ }
2160
+ } else {
2161
+ valueInPixels = styleValue;
2162
+ }
2163
+ return valueInPixels;
2164
+ }
2165
+ const getComputedStyle = (element)=>element.ownerDocument.defaultView.getComputedStyle(element, null);
2166
+ function getStyle(el, property) {
2167
+ return getComputedStyle(el).getPropertyValue(property);
2168
+ }
2169
+ const positions = [
2170
+ 'top',
2171
+ 'right',
2172
+ 'bottom',
2173
+ 'left'
2174
+ ];
2175
+ function getPositionedStyle(styles, style, suffix) {
2176
+ const result = {};
2177
+ suffix = suffix ? '-' + suffix : '';
2178
+ for(let i = 0; i < 4; i++){
2179
+ const pos = positions[i];
2180
+ result[pos] = parseFloat(styles[style + '-' + pos + suffix]) || 0;
2181
+ }
2182
+ result.width = result.left + result.right;
2183
+ result.height = result.top + result.bottom;
2184
+ return result;
2185
+ }
2186
+ const useOffsetPos = (x, y, target)=>(x > 0 || y > 0) && (!target || !target.shadowRoot);
2187
+ /**
2188
+ * @param e
2189
+ * @param canvas
2190
+ * @returns Canvas position
2191
+ */ function getCanvasPosition(e, canvas) {
2192
+ const touches = e.touches;
2193
+ const source = touches && touches.length ? touches[0] : e;
2194
+ const { offsetX , offsetY } = source;
2195
+ let box = false;
2196
+ let x, y;
2197
+ if (useOffsetPos(offsetX, offsetY, e.target)) {
2198
+ x = offsetX;
2199
+ y = offsetY;
2200
+ } else {
2201
+ const rect = canvas.getBoundingClientRect();
2202
+ x = source.clientX - rect.left;
2203
+ y = source.clientY - rect.top;
2204
+ box = true;
2205
+ }
2206
+ return {
2207
+ x,
2208
+ y,
2209
+ box
2210
+ };
2211
+ }
2212
+ /**
2213
+ * Gets an event's x, y coordinates, relative to the chart area
2214
+ * @param event
2215
+ * @param chart
2216
+ * @returns x and y coordinates of the event
2217
+ */ function getRelativePosition(event, chart) {
2218
+ if ('native' in event) {
2219
+ return event;
2220
+ }
2221
+ const { canvas , currentDevicePixelRatio } = chart;
2222
+ const style = getComputedStyle(canvas);
2223
+ const borderBox = style.boxSizing === 'border-box';
2224
+ const paddings = getPositionedStyle(style, 'padding');
2225
+ const borders = getPositionedStyle(style, 'border', 'width');
2226
+ const { x , y , box } = getCanvasPosition(event, canvas);
2227
+ const xOffset = paddings.left + (box && borders.left);
2228
+ const yOffset = paddings.top + (box && borders.top);
2229
+ let { width , height } = chart;
2230
+ if (borderBox) {
2231
+ width -= paddings.width + borders.width;
2232
+ height -= paddings.height + borders.height;
2233
+ }
2234
+ return {
2235
+ x: Math.round((x - xOffset) / width * canvas.width / currentDevicePixelRatio),
2236
+ y: Math.round((y - yOffset) / height * canvas.height / currentDevicePixelRatio)
2237
+ };
2238
+ }
2239
+ function getContainerSize(canvas, width, height) {
2240
+ let maxWidth, maxHeight;
2241
+ if (width === undefined || height === undefined) {
2242
+ const container = canvas && _getParentNode(canvas);
2243
+ if (!container) {
2244
+ width = canvas.clientWidth;
2245
+ height = canvas.clientHeight;
2246
+ } else {
2247
+ const rect = container.getBoundingClientRect(); // this is the border box of the container
2248
+ const containerStyle = getComputedStyle(container);
2249
+ const containerBorder = getPositionedStyle(containerStyle, 'border', 'width');
2250
+ const containerPadding = getPositionedStyle(containerStyle, 'padding');
2251
+ width = rect.width - containerPadding.width - containerBorder.width;
2252
+ height = rect.height - containerPadding.height - containerBorder.height;
2253
+ maxWidth = parseMaxStyle(containerStyle.maxWidth, container, 'clientWidth');
2254
+ maxHeight = parseMaxStyle(containerStyle.maxHeight, container, 'clientHeight');
2255
+ }
2256
+ }
2257
+ return {
2258
+ width,
2259
+ height,
2260
+ maxWidth: maxWidth || INFINITY,
2261
+ maxHeight: maxHeight || INFINITY
2262
+ };
2263
+ }
2264
+ const round1 = (v)=>Math.round(v * 10) / 10;
2265
+ // eslint-disable-next-line complexity
2266
+ function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio) {
2267
+ const style = getComputedStyle(canvas);
2268
+ const margins = getPositionedStyle(style, 'margin');
2269
+ const maxWidth = parseMaxStyle(style.maxWidth, canvas, 'clientWidth') || INFINITY;
2270
+ const maxHeight = parseMaxStyle(style.maxHeight, canvas, 'clientHeight') || INFINITY;
2271
+ const containerSize = getContainerSize(canvas, bbWidth, bbHeight);
2272
+ let { width , height } = containerSize;
2273
+ if (style.boxSizing === 'content-box') {
2274
+ const borders = getPositionedStyle(style, 'border', 'width');
2275
+ const paddings = getPositionedStyle(style, 'padding');
2276
+ width -= paddings.width + borders.width;
2277
+ height -= paddings.height + borders.height;
2278
+ }
2279
+ width = Math.max(0, width - margins.width);
2280
+ height = Math.max(0, aspectRatio ? width / aspectRatio : height - margins.height);
2281
+ width = round1(Math.min(width, maxWidth, containerSize.maxWidth));
2282
+ height = round1(Math.min(height, maxHeight, containerSize.maxHeight));
2283
+ if (width && !height) {
2284
+ // https://github.com/chartjs/Chart.js/issues/4659
2285
+ // If the canvas has width, but no height, default to aspectRatio of 2 (canvas default)
2286
+ height = round1(width / 2);
2287
+ }
2288
+ const maintainHeight = bbWidth !== undefined || bbHeight !== undefined;
2289
+ if (maintainHeight && aspectRatio && containerSize.height && height > containerSize.height) {
2290
+ height = containerSize.height;
2291
+ width = round1(Math.floor(height * aspectRatio));
2292
+ }
2293
+ return {
2294
+ width,
2295
+ height
2296
+ };
2297
+ }
2298
+ /**
2299
+ * @param chart
2300
+ * @param forceRatio
2301
+ * @param forceStyle
2302
+ * @returns True if the canvas context size or transformation has changed.
2303
+ */ function retinaScale(chart, forceRatio, forceStyle) {
2304
+ const pixelRatio = forceRatio || 1;
2305
+ const deviceHeight = Math.floor(chart.height * pixelRatio);
2306
+ const deviceWidth = Math.floor(chart.width * pixelRatio);
2307
+ chart.height = Math.floor(chart.height);
2308
+ chart.width = Math.floor(chart.width);
2309
+ const canvas = chart.canvas;
2310
+ // If no style has been set on the canvas, the render size is used as display size,
2311
+ // making the chart visually bigger, so let's enforce it to the "correct" values.
2312
+ // See https://github.com/chartjs/Chart.js/issues/3575
2313
+ if (canvas.style && (forceStyle || !canvas.style.height && !canvas.style.width)) {
2314
+ canvas.style.height = `${chart.height}px`;
2315
+ canvas.style.width = `${chart.width}px`;
2316
+ }
2317
+ if (chart.currentDevicePixelRatio !== pixelRatio || canvas.height !== deviceHeight || canvas.width !== deviceWidth) {
2318
+ chart.currentDevicePixelRatio = pixelRatio;
2319
+ canvas.height = deviceHeight;
2320
+ canvas.width = deviceWidth;
2321
+ chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
2322
+ return true;
2323
+ }
2324
+ return false;
2325
+ }
2326
+ /**
2327
+ * Detects support for options object argument in addEventListener.
2328
+ * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
2329
+ * @private
2330
+ */ const supportsEventListenerOptions = function() {
2331
+ let passiveSupported = false;
2332
+ try {
2333
+ const options = {
2334
+ get passive () {
2335
+ passiveSupported = true;
2336
+ return false;
2337
+ }
2338
+ };
2339
+ if (_isDomSupported()) {
2340
+ window.addEventListener('test', null, options);
2341
+ window.removeEventListener('test', null, options);
2342
+ }
2343
+ } catch (e) {
2344
+ // continue regardless of error
2345
+ }
2346
+ return passiveSupported;
2347
+ }();
2348
+ /**
2349
+ * The "used" size is the final value of a dimension property after all calculations have
2350
+ * been performed. This method uses the computed style of `element` but returns undefined
2351
+ * if the computed style is not expressed in pixels. That can happen in some cases where
2352
+ * `element` has a size relative to its parent and this last one is not yet displayed,
2353
+ * for example because of `display: none` on a parent node.
2354
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
2355
+ * @returns Size in pixels or undefined if unknown.
2356
+ */ function readUsedSize(element, property) {
2357
+ const value = getStyle(element, property);
2358
+ const matches = value && value.match(/^(\d+)(\.\d+)?px$/);
2359
+ return matches ? +matches[1] : undefined;
2360
+ }
2361
+
2362
+ /**
2363
+ * @private
2364
+ */ function _pointInLine(p1, p2, t, mode) {
2365
+ return {
2366
+ x: p1.x + t * (p2.x - p1.x),
2367
+ y: p1.y + t * (p2.y - p1.y)
2368
+ };
2369
+ }
2370
+ /**
2371
+ * @private
2372
+ */ function _steppedInterpolation(p1, p2, t, mode) {
2373
+ return {
2374
+ x: p1.x + t * (p2.x - p1.x),
2375
+ y: mode === 'middle' ? t < 0.5 ? p1.y : p2.y : mode === 'after' ? t < 1 ? p1.y : p2.y : t > 0 ? p2.y : p1.y
2376
+ };
2377
+ }
2378
+ /**
2379
+ * @private
2380
+ */ function _bezierInterpolation(p1, p2, t, mode) {
2381
+ const cp1 = {
2382
+ x: p1.cp2x,
2383
+ y: p1.cp2y
2384
+ };
2385
+ const cp2 = {
2386
+ x: p2.cp1x,
2387
+ y: p2.cp1y
2388
+ };
2389
+ const a = _pointInLine(p1, cp1, t);
2390
+ const b = _pointInLine(cp1, cp2, t);
2391
+ const c = _pointInLine(cp2, p2, t);
2392
+ const d = _pointInLine(a, b, t);
2393
+ const e = _pointInLine(b, c, t);
2394
+ return _pointInLine(d, e, t);
2395
+ }
2396
+
2397
+ const getRightToLeftAdapter = function(rectX, width) {
2398
+ return {
2399
+ x (x) {
2400
+ return rectX + rectX + width - x;
2401
+ },
2402
+ setWidth (w) {
2403
+ width = w;
2404
+ },
2405
+ textAlign (align) {
2406
+ if (align === 'center') {
2407
+ return align;
2408
+ }
2409
+ return align === 'right' ? 'left' : 'right';
2410
+ },
2411
+ xPlus (x, value) {
2412
+ return x - value;
2413
+ },
2414
+ leftForLtr (x, itemWidth) {
2415
+ return x - itemWidth;
2416
+ }
2417
+ };
2418
+ };
2419
+ const getLeftToRightAdapter = function() {
2420
+ return {
2421
+ x (x) {
2422
+ return x;
2423
+ },
2424
+ setWidth (w) {},
2425
+ textAlign (align) {
2426
+ return align;
2427
+ },
2428
+ xPlus (x, value) {
2429
+ return x + value;
2430
+ },
2431
+ leftForLtr (x, _itemWidth) {
2432
+ return x;
2433
+ }
2434
+ };
2435
+ };
2436
+ function getRtlAdapter(rtl, rectX, width) {
2437
+ return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();
2438
+ }
2439
+ function overrideTextDirection(ctx, direction) {
2440
+ let style, original;
2441
+ if (direction === 'ltr' || direction === 'rtl') {
2442
+ style = ctx.canvas.style;
2443
+ original = [
2444
+ style.getPropertyValue('direction'),
2445
+ style.getPropertyPriority('direction')
2446
+ ];
2447
+ style.setProperty('direction', direction, 'important');
2448
+ ctx.prevTextDirection = original;
2449
+ }
2450
+ }
2451
+ function restoreTextDirection(ctx, original) {
2452
+ if (original !== undefined) {
2453
+ delete ctx.prevTextDirection;
2454
+ ctx.canvas.style.setProperty('direction', original[0], original[1]);
2455
+ }
2456
+ }
2457
+
2458
+ function propertyFn(property) {
2459
+ if (property === 'angle') {
2460
+ return {
2461
+ between: _angleBetween,
2462
+ compare: _angleDiff,
2463
+ normalize: _normalizeAngle
2464
+ };
2465
+ }
2466
+ return {
2467
+ between: _isBetween,
2468
+ compare: (a, b)=>a - b,
2469
+ normalize: (x)=>x
2470
+ };
2471
+ }
2472
+ function normalizeSegment({ start , end , count , loop , style }) {
2473
+ return {
2474
+ start: start % count,
2475
+ end: end % count,
2476
+ loop: loop && (end - start + 1) % count === 0,
2477
+ style
2478
+ };
2479
+ }
2480
+ function getSegment(segment, points, bounds) {
2481
+ const { property , start: startBound , end: endBound } = bounds;
2482
+ const { between , normalize } = propertyFn(property);
2483
+ const count = points.length;
2484
+ let { start , end , loop } = segment;
2485
+ let i, ilen;
2486
+ if (loop) {
2487
+ start += count;
2488
+ end += count;
2489
+ for(i = 0, ilen = count; i < ilen; ++i){
2490
+ if (!between(normalize(points[start % count][property]), startBound, endBound)) {
2491
+ break;
2492
+ }
2493
+ start--;
2494
+ end--;
2495
+ }
2496
+ start %= count;
2497
+ end %= count;
2498
+ }
2499
+ if (end < start) {
2500
+ end += count;
2501
+ }
2502
+ return {
2503
+ start,
2504
+ end,
2505
+ loop,
2506
+ style: segment.style
2507
+ };
2508
+ }
2509
+ function _boundSegment(segment, points, bounds) {
2510
+ if (!bounds) {
2511
+ return [
2512
+ segment
2513
+ ];
2514
+ }
2515
+ const { property , start: startBound , end: endBound } = bounds;
2516
+ const count = points.length;
2517
+ const { compare , between , normalize } = propertyFn(property);
2518
+ const { start , end , loop , style } = getSegment(segment, points, bounds);
2519
+ const result = [];
2520
+ let inside = false;
2521
+ let subStart = null;
2522
+ let value, point, prevValue;
2523
+ const startIsBefore = ()=>between(startBound, prevValue, value) && compare(startBound, prevValue) !== 0;
2524
+ const endIsBefore = ()=>compare(endBound, value) === 0 || between(endBound, prevValue, value);
2525
+ const shouldStart = ()=>inside || startIsBefore();
2526
+ const shouldStop = ()=>!inside || endIsBefore();
2527
+ for(let i = start, prev = start; i <= end; ++i){
2528
+ point = points[i % count];
2529
+ if (point.skip) {
2530
+ continue;
2531
+ }
2532
+ value = normalize(point[property]);
2533
+ if (value === prevValue) {
2534
+ continue;
2535
+ }
2536
+ inside = between(value, startBound, endBound);
2537
+ if (subStart === null && shouldStart()) {
2538
+ subStart = compare(value, startBound) === 0 ? i : prev;
2539
+ }
2540
+ if (subStart !== null && shouldStop()) {
2541
+ result.push(normalizeSegment({
2542
+ start: subStart,
2543
+ end: i,
2544
+ loop,
2545
+ count,
2546
+ style
2547
+ }));
2548
+ subStart = null;
2549
+ }
2550
+ prev = i;
2551
+ prevValue = value;
2552
+ }
2553
+ if (subStart !== null) {
2554
+ result.push(normalizeSegment({
2555
+ start: subStart,
2556
+ end,
2557
+ loop,
2558
+ count,
2559
+ style
2560
+ }));
2561
+ }
2562
+ return result;
2563
+ }
2564
+ function _boundSegments(line, bounds) {
2565
+ const result = [];
2566
+ const segments = line.segments;
2567
+ for(let i = 0; i < segments.length; i++){
2568
+ const sub = _boundSegment(segments[i], line.points, bounds);
2569
+ if (sub.length) {
2570
+ result.push(...sub);
2571
+ }
2572
+ }
2573
+ return result;
2574
+ }
2575
+ function findStartAndEnd(points, count, loop, spanGaps) {
2576
+ let start = 0;
2577
+ let end = count - 1;
2578
+ if (loop && !spanGaps) {
2579
+ while(start < count && !points[start].skip){
2580
+ start++;
2581
+ }
2582
+ }
2583
+ while(start < count && points[start].skip){
2584
+ start++;
2585
+ }
2586
+ start %= count;
2587
+ if (loop) {
2588
+ end += start;
2589
+ }
2590
+ while(end > start && points[end % count].skip){
2591
+ end--;
2592
+ }
2593
+ end %= count;
2594
+ return {
2595
+ start,
2596
+ end
2597
+ };
2598
+ }
2599
+ function solidSegments(points, start, max, loop) {
2600
+ const count = points.length;
2601
+ const result = [];
2602
+ let last = start;
2603
+ let prev = points[start];
2604
+ let end;
2605
+ for(end = start + 1; end <= max; ++end){
2606
+ const cur = points[end % count];
2607
+ if (cur.skip || cur.stop) {
2608
+ if (!prev.skip) {
2609
+ loop = false;
2610
+ result.push({
2611
+ start: start % count,
2612
+ end: (end - 1) % count,
2613
+ loop
2614
+ });
2615
+ start = last = cur.stop ? end : null;
2616
+ }
2617
+ } else {
2618
+ last = end;
2619
+ if (prev.skip) {
2620
+ start = end;
2621
+ }
2622
+ }
2623
+ prev = cur;
2624
+ }
2625
+ if (last !== null) {
2626
+ result.push({
2627
+ start: start % count,
2628
+ end: last % count,
2629
+ loop
2630
+ });
2631
+ }
2632
+ return result;
2633
+ }
2634
+ function _computeSegments(line, segmentOptions) {
2635
+ const points = line.points;
2636
+ const spanGaps = line.options.spanGaps;
2637
+ const count = points.length;
2638
+ if (!count) {
2639
+ return [];
2640
+ }
2641
+ const loop = !!line._loop;
2642
+ const { start , end } = findStartAndEnd(points, count, loop, spanGaps);
2643
+ if (spanGaps === true) {
2644
+ return splitByStyles(line, [
2645
+ {
2646
+ start,
2647
+ end,
2648
+ loop
2649
+ }
2650
+ ], points, segmentOptions);
2651
+ }
2652
+ const max = end < start ? end + count : end;
2653
+ const completeLoop = !!line._fullLoop && start === 0 && end === count - 1;
2654
+ return splitByStyles(line, solidSegments(points, start, max, completeLoop), points, segmentOptions);
2655
+ }
2656
+ function splitByStyles(line, segments, points, segmentOptions) {
2657
+ if (!segmentOptions || !segmentOptions.setContext || !points) {
2658
+ return segments;
2659
+ }
2660
+ return doSplitByStyles(line, segments, points, segmentOptions);
2661
+ }
2662
+ function doSplitByStyles(line, segments, points, segmentOptions) {
2663
+ const chartContext = line._chart.getContext();
2664
+ const baseStyle = readStyle(line.options);
2665
+ const { _datasetIndex: datasetIndex , options: { spanGaps } } = line;
2666
+ const count = points.length;
2667
+ const result = [];
2668
+ let prevStyle = baseStyle;
2669
+ let start = segments[0].start;
2670
+ let i = start;
2671
+ function addStyle(s, e, l, st) {
2672
+ const dir = spanGaps ? -1 : 1;
2673
+ if (s === e) {
2674
+ return;
2675
+ }
2676
+ s += count;
2677
+ while(points[s % count].skip){
2678
+ s -= dir;
2679
+ }
2680
+ while(points[e % count].skip){
2681
+ e += dir;
2682
+ }
2683
+ if (s % count !== e % count) {
2684
+ result.push({
2685
+ start: s % count,
2686
+ end: e % count,
2687
+ loop: l,
2688
+ style: st
2689
+ });
2690
+ prevStyle = st;
2691
+ start = e % count;
2692
+ }
2693
+ }
2694
+ for (const segment of segments){
2695
+ start = spanGaps ? start : segment.start;
2696
+ let prev = points[start % count];
2697
+ let style;
2698
+ for(i = start + 1; i <= segment.end; i++){
2699
+ const pt = points[i % count];
2700
+ style = readStyle(segmentOptions.setContext(createContext(chartContext, {
2701
+ type: 'segment',
2702
+ p0: prev,
2703
+ p1: pt,
2704
+ p0DataIndex: (i - 1) % count,
2705
+ p1DataIndex: i % count,
2706
+ datasetIndex
2707
+ })));
2708
+ if (styleChanged(style, prevStyle)) {
2709
+ addStyle(start, i - 1, segment.loop, prevStyle);
2710
+ }
2711
+ prev = pt;
2712
+ prevStyle = style;
2713
+ }
2714
+ if (start < i - 1) {
2715
+ addStyle(start, i - 1, segment.loop, prevStyle);
2716
+ }
2717
+ }
2718
+ return result;
2719
+ }
2720
+ function readStyle(options) {
2721
+ return {
2722
+ backgroundColor: options.backgroundColor,
2723
+ borderCapStyle: options.borderCapStyle,
2724
+ borderDash: options.borderDash,
2725
+ borderDashOffset: options.borderDashOffset,
2726
+ borderJoinStyle: options.borderJoinStyle,
2727
+ borderWidth: options.borderWidth,
2728
+ borderColor: options.borderColor
2729
+ };
2730
+ }
2731
+ function styleChanged(style, prevStyle) {
2732
+ if (!prevStyle) {
2733
+ return false;
2734
+ }
2735
+ const cache = [];
2736
+ const replacer = function(key, value) {
2737
+ if (!isPatternOrGradient(value)) {
2738
+ return value;
2739
+ }
2740
+ if (!cache.includes(value)) {
2741
+ cache.push(value);
2742
+ }
2743
+ return cache.indexOf(value);
2744
+ };
2745
+ return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
2746
+ }
2747
+
2748
+ export { unclipArea as $, _rlookupByKey as A, _lookupByKey as B, _isPointInArea as C, getAngleFromPoint as D, toPadding as E, each as F, getMaximumSize as G, HALF_PI as H, _getParentNode as I, readUsedSize as J, supportsEventListenerOptions as K, throttled as L, _isDomSupported as M, _factorize as N, finiteOrDefault as O, PI as P, callback as Q, _addGrace as R, _limitValue as S, TAU as T, toDegrees as U, _measureText as V, _int16Range as W, _alignPixel as X, clipArea as Y, renderText as Z, _arrayUnique as _, resolve as a, fontString as a$, toFont as a0, _toLeftRightCenter as a1, _alignStartEnd as a2, overrides as a3, merge as a4, _capitalize as a5, descriptors as a6, isFunction as a7, _attachContext as a8, _createResolver as a9, overrideTextDirection as aA, _textX as aB, restoreTextDirection as aC, drawPointLegend as aD, distanceBetweenPoints as aE, noop as aF, _setMinAndMaxByKey as aG, niceNum as aH, almostWhole as aI, almostEquals as aJ, _decimalPlaces as aK, Ticks as aL, log10 as aM, _longestText as aN, _filterBetween as aO, _lookup as aP, isPatternOrGradient as aQ, getHoverColor as aR, clone as aS, _merger as aT, _mergerIf as aU, _deprecated as aV, _splitKey as aW, toFontString as aX, splineCurve as aY, splineCurveMonotone as aZ, getStyle as a_, _descriptors as aa, mergeIf as ab, uid as ac, debounce as ad, retinaScale as ae, clearCanvas as af, setsEqual as ag, _elementsEqual as ah, _isClickEvent as ai, _isBetween as aj, _readValueToProps as ak, _updateBezierControlPoints as al, _computeSegments as am, _boundSegments as an, _steppedInterpolation as ao, _bezierInterpolation as ap, _pointInLine as aq, _steppedLineTo as ar, _bezierCurveTo as as, drawPoint as at, addRoundedRectPath as au, toTRBL as av, toTRBLCorners as aw, _boundSegment as ax, _normalizeAngle as ay, getRtlAdapter as az, isArray as b, toLineHeight as b0, PITAU as b1, INFINITY as b2, RAD_PER_DEG as b3, QUARTER_PI as b4, TWO_THIRDS_PI as b5, _angleDiff as b6, color as c, defaults as d, effects as e, resolveObjectKey as f, isNumberFinite as g, defined as h, isObject as i, createContext as j, isNullOrUndef as k, listenArrayEvents as l, toPercentage as m, toDimension as n, formatNumber as o, _angleBetween as p, _getStartAndCountOfVisiblePoints as q, requestAnimFrame as r, sign as s, toRadians as t, unlistenArrayEvents as u, valueOrDefault as v, _scaleRangesChanged as w, isNumber as x, _parseObjectDataRadialScale as y, getRelativePosition as z };
2749
+ //# sourceMappingURL=helpers.segment.js.map