@plotdb/chart 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils/brush.js ADDED
@@ -0,0 +1,306 @@
1
+ (function(){
2
+ var svgns, handleSize, brush;
3
+ svgns = "http://www.w3.org/2000/svg";
4
+ handleSize = 6;
5
+ brush = function(opt){
6
+ opt == null && (opt = {});
7
+ this.dir = opt.dir === 'y' ? 'y' : 'x';
8
+ this._extent = [[0, 0], [1, 1]];
9
+ this._sel = null;
10
+ this._g = null;
11
+ this.evtHandler = {};
12
+ return this;
13
+ };
14
+ brush.prototype = import$(Object.create(Object.prototype), {
15
+ on: function(n, cb){
16
+ var this$ = this;
17
+ return (Array.isArray(n)
18
+ ? n
19
+ : [n]).map(function(n){
20
+ var ref$;
21
+ return ((ref$ = this$.evtHandler)[n] || (ref$[n] = [])).push(cb);
22
+ });
23
+ },
24
+ fire: function(n){
25
+ var v, res$, i$, to$, ref$, len$, cb, results$ = [];
26
+ res$ = [];
27
+ for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
28
+ res$.push(arguments[i$]);
29
+ }
30
+ v = res$;
31
+ for (i$ = 0, len$ = (ref$ = this.evtHandler[n] || []).length; i$ < len$; ++i$) {
32
+ cb = ref$[i$];
33
+ results$.push(cb.apply(this, v));
34
+ }
35
+ return results$;
36
+ },
37
+ extent: function(e){
38
+ if (!arguments.length) {
39
+ return this._extent;
40
+ }
41
+ this._extent = e;
42
+ this._render();
43
+ return this;
44
+ },
45
+ selection: function(){
46
+ if (this._sel) {
47
+ return this._sel.slice();
48
+ } else {
49
+ return null;
50
+ }
51
+ },
52
+ attached: function(){
53
+ return !!this._g;
54
+ },
55
+ _span: function(){
56
+ var i;
57
+ i = this.dir === 'x' ? 0 : 1;
58
+ return [this._extent[0][i], this._extent[1][i]];
59
+ },
60
+ _emit: function(type, evt){
61
+ return this.fire(type, {
62
+ type: type,
63
+ selection: this.selection(),
64
+ sourceEvent: evt || null,
65
+ target: this
66
+ });
67
+ },
68
+ move: function(sel, evt){
69
+ var this$ = this;
70
+ this._sel = sel != null ? [+sel[0], +sel[1]] : null;
71
+ this._render();
72
+ ['start', 'brush', 'end'].map(function(it){
73
+ return this$._emit(it, evt);
74
+ });
75
+ return this;
76
+ },
77
+ clear: function(evt){
78
+ return this.move(null, evt);
79
+ },
80
+ attach: function(g){
81
+ var mk, ends, cursor, this$ = this;
82
+ if (this._g !== g) {
83
+ if (this._g) {
84
+ this.detach();
85
+ }
86
+ if (g.__brush && g.__brush !== this) {
87
+ g.__brush.detach();
88
+ }
89
+ g.__brush = this;
90
+ this._g = g;
91
+ g.setAttribute('fill', 'none');
92
+ g.setAttribute('pointer-events', 'all');
93
+ if (((typeof navigator != 'undefined' && navigator !== null) && navigator.maxTouchPoints) || 'ontouchstart' in g) {
94
+ g.style.touchAction = 'none';
95
+ g.style.setProperty('-webkit-tap-highlight-color', "rgba(0,0,0,0)");
96
+ }
97
+ mk = function(cls, type, attrs){
98
+ var n, k, v;
99
+ attrs == null && (attrs = {});
100
+ n = g.querySelector(":scope > rect." + cls.split(' ').join('.')) || g.appendChild(document.createElementNS(svgns, 'rect'));
101
+ n.setAttribute('class', cls);
102
+ n.__data__ = {
103
+ type: type
104
+ };
105
+ for (k in attrs) {
106
+ v = attrs[k];
107
+ n.setAttribute(k, v);
108
+ }
109
+ return n;
110
+ };
111
+ ends = this.dir === 'x'
112
+ ? ['w', 'e']
113
+ : ['n', 's'];
114
+ cursor = this.dir === 'x' ? 'ew-resize' : 'ns-resize';
115
+ this._n = {
116
+ overlay: mk('overlay', 'overlay', {
117
+ "pointer-events": 'all',
118
+ cursor: 'crosshair'
119
+ }),
120
+ selection: mk('selection', 'selection', {
121
+ cursor: 'move',
122
+ fill: '#777',
123
+ "fill-opacity": 0.3,
124
+ stroke: '#fff',
125
+ "shape-rendering": 'crispEdges'
126
+ }),
127
+ handle: ends.map(function(t){
128
+ return mk("handle handle--" + t, t, {
129
+ cursor: cursor
130
+ });
131
+ })
132
+ };
133
+ g.addEventListener('pointerdown', this._down = function(e){
134
+ return this$._start(e);
135
+ });
136
+ }
137
+ this._render();
138
+ return this;
139
+ },
140
+ detach: function(){
141
+ var i$, ref$, len$, n;
142
+ if (!this._g) {
143
+ return;
144
+ }
145
+ this._g.removeEventListener('pointerdown', this._down);
146
+ for (i$ = 0, len$ = (ref$ = [this._n.overlay, this._n.selection].concat(this._n.handle)).length; i$ < len$; ++i$) {
147
+ n = ref$[i$];
148
+ if (n.parentNode) {
149
+ n.parentNode.removeChild(n);
150
+ }
151
+ }
152
+ if (this._g.__brush === this) {
153
+ this._g.__brush = null;
154
+ }
155
+ return this._g = null;
156
+ },
157
+ _render: function(){
158
+ var ref$, ref1$, x0, y0, x1, y1, x$, i$, len$, n, a, b, sx0, sy0, sx1, sy1, y$, h, this$ = this;
159
+ if (!this._g) {
160
+ return;
161
+ }
162
+ ref$ = this._extent, ref1$ = ref$[0], x0 = ref1$[0], y0 = ref1$[1], ref1$ = ref$[1], x1 = ref1$[0], y1 = ref1$[1];
163
+ x$ = this._n.overlay;
164
+ x$.setAttribute('x', x0);
165
+ x$.setAttribute('y', y0);
166
+ x$.setAttribute('width', x1 - x0);
167
+ x$.setAttribute('height', y1 - y0);
168
+ if (!this._sel) {
169
+ for (i$ = 0, len$ = (ref$ = [this._n.selection].concat(this._n.handle)).length; i$ < len$; ++i$) {
170
+ n = ref$[i$];
171
+ n.style.display = 'none';
172
+ ['x', 'y', 'width', 'height'].map(fn$);
173
+ }
174
+ return;
175
+ }
176
+ ref$ = this._sel, a = ref$[0], b = ref$[1];
177
+ ref$ = this.dir === 'x'
178
+ ? [a, y0, b, y1]
179
+ : [x0, a, x1, b], sx0 = ref$[0], sy0 = ref$[1], sx1 = ref$[2], sy1 = ref$[3];
180
+ y$ = this._n.selection;
181
+ y$.style.display = '';
182
+ y$.setAttribute('x', sx0);
183
+ y$.setAttribute('y', sy0);
184
+ y$.setAttribute('width', sx1 - sx0);
185
+ y$.setAttribute('height', sy1 - sy0);
186
+ h = handleSize / 2;
187
+ return this._n.handle.map(function(n, i){
188
+ n.style.display = '';
189
+ if (this$.dir === 'x') {
190
+ n.setAttribute('x', (i ? sx1 : sx0) - h);
191
+ n.setAttribute('y', sy0 - h);
192
+ n.setAttribute('width', handleSize);
193
+ return n.setAttribute('height', sy1 - sy0 + handleSize);
194
+ } else {
195
+ n.setAttribute('x', sx0 - h);
196
+ n.setAttribute('y', (i ? sy1 : sy0) - h);
197
+ n.setAttribute('width', sx1 - sx0 + handleSize);
198
+ return n.setAttribute('height', handleSize);
199
+ }
200
+ });
201
+ function fn$(it){
202
+ return n.removeAttribute(it);
203
+ }
204
+ },
205
+ _pos: function(e){
206
+ var m, p;
207
+ m = this._g.getScreenCTM();
208
+ if (!m) {
209
+ return 0;
210
+ }
211
+ p = new DOMPoint(e.clientX, e.clientY).matrixTransform(m.inverse());
212
+ if (this.dir === 'x') {
213
+ return p.x;
214
+ } else {
215
+ return p.y;
216
+ }
217
+ },
218
+ _start: function(e){
219
+ var type, ref$, lo, hi, clamp, p0, s0, mode, moved, upd, mv, up, this$ = this;
220
+ if (e.button != null && e.button !== 0) {
221
+ return;
222
+ }
223
+ type = (e.target.__data__ || {}).type;
224
+ if (!type) {
225
+ return;
226
+ }
227
+ e.stopImmediatePropagation();
228
+ e.preventDefault();
229
+ ref$ = this._span(), lo = ref$[0], hi = ref$[1];
230
+ clamp = function(v){
231
+ var ref$;
232
+ return (ref$ = v > lo ? v : lo) < hi ? ref$ : hi;
233
+ };
234
+ p0 = this._pos(e);
235
+ s0 = this._sel ? this._sel.slice() : null;
236
+ mode = type === 'selection'
237
+ ? 'move'
238
+ : (type === 'w' || type === 'n') && s0
239
+ ? 'lo'
240
+ : (type === 'e' || type === 's') && s0 ? 'hi' : 'new';
241
+ if (mode === 'new') {
242
+ p0 = clamp(p0);
243
+ }
244
+ moved = false;
245
+ this._emit('start', e);
246
+ upd = function(e){
247
+ var p, d, ref$, ref1$, ref2$, anchor;
248
+ p = this$._pos(e);
249
+ if (mode === 'move') {
250
+ d = p - p0;
251
+ d = (ref$ = d > (ref2$ = lo - s0[0]) ? d : ref2$) < (ref1$ = hi - s0[1]) ? ref$ : ref1$;
252
+ this$._sel = [s0[0] + d, s0[1] + d];
253
+ } else {
254
+ anchor = mode === 'new'
255
+ ? p0
256
+ : mode === 'lo'
257
+ ? s0[1]
258
+ : s0[0];
259
+ p = clamp(p);
260
+ this$._sel = [Math.min(anchor, p), Math.max(anchor, p)];
261
+ }
262
+ this$._render();
263
+ return this$._emit('brush', e);
264
+ };
265
+ mv = function(e){
266
+ moved = true;
267
+ return upd(e);
268
+ };
269
+ up = function(e){
270
+ var noclick;
271
+ window.removeEventListener('pointermove', mv);
272
+ window.removeEventListener('pointerup', up);
273
+ window.removeEventListener('pointercancel', up);
274
+ if (!moved && mode !== 'move') {
275
+ this$._sel = null;
276
+ }
277
+ if (this$._sel && this$._sel[0] === this$._sel[1]) {
278
+ this$._sel = null;
279
+ }
280
+ this$._render();
281
+ if (moved) {
282
+ noclick = function(e){
283
+ e.stopImmediatePropagation();
284
+ return e.preventDefault();
285
+ };
286
+ window.addEventListener('click', noclick, true);
287
+ setTimeout(function(){
288
+ return window.removeEventListener('click', noclick, true);
289
+ }, 0);
290
+ }
291
+ return this$._emit('end', e);
292
+ };
293
+ window.addEventListener('pointermove', mv);
294
+ window.addEventListener('pointerup', up);
295
+ return window.addEventListener('pointercancel', up);
296
+ }
297
+ });
298
+ if (typeof chart != 'undefined' && chart !== null) {
299
+ (chart.utils || (chart.utils = {})).brush = brush;
300
+ }
301
+ function import$(obj, src){
302
+ var own = {}.hasOwnProperty;
303
+ for (var key in src) if (own.call(src, key)) obj[key] = src[key];
304
+ return obj;
305
+ }
306
+ }).call(this);
@@ -0,0 +1 @@
1
+ !function(){var t;(t=function(t){return this.dir="y"===(t=null==t?{}:t).dir?"y":"x",this._extent=[[0,0],[1,1]],this._sel=null,this._g=null,this.evtHandler={},this}).prototype=((t,e)=>{var n,i={}.hasOwnProperty;for(n in e)i.call(e,n)&&(t[n]=e[n]);return t})(Object.create(Object.prototype),{on:function(t,n){var i=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=i.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,i,r,s=[],o=[],h=1,u=arguments.length;h<u;++h)o.push(arguments[h]);for(e=o,h=0,i=(n=this.evtHandler[t]||[]).length;h<i;++h)r=n[h],s.push(r.apply(this,e));return s},extent:function(t){return arguments.length?(this._extent=t,this._render(),this):this._extent},selection:function(){return this._sel?this._sel.slice():null},attached:function(){return!!this._g},_span:function(){var t="x"===this.dir?0:1;return[this._extent[0][t],this._extent[1][t]]},_emit:function(t,e){return this.fire(t,{type:t,selection:this.selection(),sourceEvent:e||null,target:this})},move:function(t,e){var n=this;return this._sel=null!=t?[+t[0],+t[1]]:null,this._render(),["start","brush","end"].map(function(t){return n._emit(t,e)}),this},clear:function(t){return this.move(null,t)},attach:function(o){var e,t,n,i=this;return this._g!==o&&(this._g&&this.detach(),o.__brush&&o.__brush!==this&&o.__brush.detach(),((o.__brush=this)._g=o).setAttribute("fill","none"),o.setAttribute("pointer-events","all"),("undefined"!=typeof navigator&&null!==navigator&&navigator.maxTouchPoints||"ontouchstart"in o)&&(o.style.touchAction="none",o.style.setProperty("-webkit-tap-highlight-color","rgba(0,0,0,0)")),t="x"===this.dir?["w","e"]:["n","s"],n="x"===this.dir?"ew-resize":"ns-resize",this._n={overlay:(e=function(t,e,n){var i,r,s;for(r in null==n&&(n={}),(i=o.querySelector(":scope > rect."+t.split(" ").join("."))||o.appendChild(document.createElementNS("http://www.w3.org/2000/svg","rect"))).setAttribute("class",t),i.__data__={type:e},n)s=n[r],i.setAttribute(r,s);return i})("overlay","overlay",{"pointer-events":"all",cursor:"crosshair"}),selection:e("selection","selection",{cursor:"move",fill:"#777","fill-opacity":.3,stroke:"#fff","shape-rendering":"crispEdges"}),handle:t.map(function(t){return e("handle handle--"+t,t,{cursor:n})})},o.addEventListener("pointerdown",this._down=function(t){return i._start(t)})),this._render(),this},detach:function(){var t,e,n,i;if(this._g){for(this._g.removeEventListener("pointerdown",this._down),t=0,n=(e=[this._n.overlay,this._n.selection].concat(this._n.handle)).length;t<n;++t)(i=e[t]).parentNode&&i.parentNode.removeChild(i);return this._g.__brush===this&&(this._g.__brush=null),this._g=null}},_render:function(){var t,e,n,i,r,s,o,h,u,l,a,c,_,d,p=this;if(this._g){if(e=(i=(t=this._extent)[0])[0],d=i[1],n=(i=t[1])[0],i=i[1],(h=this._n.overlay).setAttribute("x",e),h.setAttribute("y",d),h.setAttribute("width",n-e),h.setAttribute("height",i-d),this._sel)return h=(t=this._sel)[0],u=t[1],t="x"===this.dir?[h,d,u,i]:[e,h,n,u],l=t[0],a=t[1],c=t[2],_=t[3],(d=this._n.selection).style.display="",d.setAttribute("x",l),d.setAttribute("y",a),d.setAttribute("width",c-l),d.setAttribute("height",_-a),this._n.handle.map(function(t,e){return t.style.display="","x"===p.dir?(t.setAttribute("x",(e?c:l)-3),t.setAttribute("y",a-3),t.setAttribute("width",6),t.setAttribute("height",_-a+6)):(t.setAttribute("x",l-3),t.setAttribute("y",(e?_:a)-3),t.setAttribute("width",c-l+6),t.setAttribute("height",6))});for(r=0,s=(t=[this._n.selection].concat(this._n.handle)).length;r<s;++r)(o=t[r]).style.display="none",["x","y","width","height"].map(v)}function v(t){return o.removeAttribute(t)}},_pos:function(t){var e=this._g.getScreenCTM();return e?(t=new DOMPoint(t.clientX,t.clientY).matrixTransform(e.inverse()),"x"===this.dir?t.x:t.y):0},_start:function(t){var e,n,s,o,h,u,l,a,i,r,c,_,d=this;if((null==t.button||0===t.button)&&(e=(t.target.__data__||{}).type))return t.stopImmediatePropagation(),t.preventDefault(),n=this._span(),s=n[0],o=n[1],h=function(t){return(t=s<t?t:s)<o?t:o},u=this._pos(t),l=this._sel?this._sel.slice():null,"new"===(a="selection"===e?"move":"w"!==e&&"n"!==e||!l?"e"!==e&&"s"!==e||!l?"new":"hi":"lo")&&(u=h(u)),i=!1,this._emit("start",t),r=function(t){var e,n,i,r=d._pos(t);return"move"===a?(e=(i=(e=r-u)>(i=s-l[0])?e:i)<(n=o-l[1])?i:n,d._sel=[l[0]+e,l[1]+e]):(i="new"===a?u:"lo"===a?l[1]:l[0],r=h(r),d._sel=[Math.min(i,r),Math.max(i,r)]),d._render(),d._emit("brush",t)},c=function(t){return i=!0,r(t)},_=function(t){var e;return window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),i||"move"===a||(d._sel=null),d._sel&&d._sel[0]===d._sel[1]&&(d._sel=null),d._render(),i&&(e=function(t){return t.stopImmediatePropagation(),t.preventDefault()},window.addEventListener("click",e,!0),setTimeout(function(){return window.removeEventListener("click",e,!0)},0)),d._emit("end",t)},window.addEventListener("pointermove",c),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_)}}),"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).brush=t)}.call(this);
package/utils/color.js ADDED
@@ -0,0 +1,37 @@
1
+ (function(){
2
+ var clamp, turbo, discrete, quantize, color;
3
+ clamp = function(v){
4
+ return Math.max(0, Math.min(255, Math.round(v)));
5
+ };
6
+ turbo = function(t){
7
+ var r, g, b;
8
+ t = Math.max(0, Math.min(1, t));
9
+ r = clamp(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05)))));
10
+ g = clamp(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56)))));
11
+ b = clamp(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))));
12
+ return "rgb(" + r + ", " + g + ", " + b + ")";
13
+ };
14
+ discrete = function(range){
15
+ var n;
16
+ n = range.length;
17
+ return function(t){
18
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
19
+ };
20
+ };
21
+ quantize = function(interpolator, n){
22
+ var i$, i, results$ = [];
23
+ for (i$ = 0; i$ < n; ++i$) {
24
+ i = i$;
25
+ results$.push(interpolator(i / (n - 1)));
26
+ }
27
+ return results$;
28
+ };
29
+ color = {
30
+ turbo: turbo,
31
+ discrete: discrete,
32
+ quantize: quantize
33
+ };
34
+ if (typeof chart != 'undefined' && chart !== null) {
35
+ (chart.utils || (chart.utils = {})).color = color;
36
+ }
37
+ }).call(this);
@@ -0,0 +1 @@
1
+ !function(){var n=function(t){return Math.max(0,Math.min(255,Math.round(t)))},t={turbo:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+n(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))+", "+n(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))+", "+n(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))+")"},discrete:function(n){var r=n.length;return function(t){return n[Math.max(0,Math.min(r-1,Math.floor(t*r)))]}},quantize:function(t,n){for(var r,a=[],u=0;u<n;++u)r=u,a.push(t(r/(n-1)));return a}};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).color=t)}.call(this);
@@ -0,0 +1,86 @@
1
+ (function(){
2
+ var debounce;
3
+ debounce = function(f, o){
4
+ var ref$, l, ret;
5
+ if (typeof f === 'number' && !(o != null)) {
6
+ return new Promise(function(res){
7
+ return setTimeout(res, f);
8
+ });
9
+ }
10
+ if (typeof o === 'function') {
11
+ ref$ = [o, f], f = ref$[0], o = ref$[1];
12
+ }
13
+ o = o || {};
14
+ ref$ = typeof f === 'object'
15
+ ? [f.func, f]
16
+ : [
17
+ f, {
18
+ delay: typeof o === 'object' ? o.delay || 750 : o
19
+ }
20
+ ], f = ref$[0], o = ref$[1];
21
+ l = {};
22
+ ret = function(){
23
+ var args, res$, i$, to$, used, delay, p, this$ = this;
24
+ res$ = [];
25
+ for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
26
+ res$.push(arguments[i$]);
27
+ }
28
+ args = res$;
29
+ used = false;
30
+ delay = ret.delay.value || o.delay || 750;
31
+ ret.delay.value = 0;
32
+ p = new Promise(function(res, rej){
33
+ if (used) {
34
+ return;
35
+ }
36
+ if (l.h) {
37
+ ret.clear();
38
+ }
39
+ l.res = res;
40
+ l.rej = rej;
41
+ return l.h = setTimeout(function(){
42
+ var r;
43
+ r = f.apply(this$, args);
44
+ if (r && typeof r.then === 'function') {
45
+ r.then(function(){
46
+ var a, res$, i$, to$;
47
+ res$ = [];
48
+ for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
49
+ res$.push(arguments[i$]);
50
+ }
51
+ a = res$;
52
+ return res.apply(null, a);
53
+ });
54
+ } else {
55
+ res(r);
56
+ }
57
+ return l.res = null, l.rej = null, l.h = 0, l;
58
+ }, delay);
59
+ });
60
+ p.now = function(){
61
+ used = true;
62
+ ret.clear();
63
+ return f.apply(this$, args);
64
+ };
65
+ p.cancel = function(){
66
+ return ret.clear();
67
+ };
68
+ return p;
69
+ };
70
+ ret.clear = function(){
71
+ clearTimeout(l.h);
72
+ if (l.res) {
73
+ l.res(null);
74
+ }
75
+ return l.h = 0, l.res = null, l.rej = null, l;
76
+ };
77
+ ret.delay = function(it){
78
+ ret.delay.value = it;
79
+ return ret;
80
+ };
81
+ return ret;
82
+ };
83
+ if (typeof chart != 'undefined' && chart !== null) {
84
+ (chart.utils || (chart.utils = {})).debounce = debounce;
85
+ }
86
+ }).call(this);
@@ -0,0 +1 @@
1
+ !function(){var e=function(c,f){var e,i,h;return"number"==typeof c&&null==f?new Promise(function(e){return setTimeout(e,c)}):("function"==typeof f&&(c=(e=[f,c])[0],f=e[1]),f=f||{},e="object"==typeof c?[c.func,c]:[c,{delay:"object"==typeof f?f.delay||750:f}],c=e[0],f=e[1],i={},(h=function(){for(var n,t,r,e,l=this,u=[],o=0,a=arguments.length;o<a;++o)u.push(arguments[o]);return n=u,t=!1,r=h.delay.value||f.delay||750,h.delay.value=0,(e=new Promise(function(u,e){if(!t)return i.h&&h.clear(),i.res=u,i.rej=e,i.h=setTimeout(function(){var e=c.apply(l,n);return e&&"function"==typeof e.then?e.then(function(){for(var e,n=[],t=0,r=arguments.length;t<r;++t)n.push(arguments[t]);return e=n,u.apply(null,e)}):u(e),i.res=null,i.rej=null,i.h=0,i},r)})).now=function(){return t=!0,h.clear(),c.apply(l,n)},e.cancel=function(){return h.clear()},e}).clear=function(){return clearTimeout(i.h),i.res&&i.res(null),i.h=0,i.res=null,i.rej=null,i},h.delay=function(e){return h.delay.value=e,h},h)};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).debounce=e)}.call(this);