PageSourceSearch

https://quorumapp.com/ts/Vendors/chartjs/chartjs-dragdata.js?liveUpdate=56

js quorumapp.com collected 2026-09-26 04:38:12 UTC 55,240 bytes, 1,568 lines download raw bytes

vendor: 31,029 bytes, lines 1-930
1(function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('chart.js')) :
3        typeof define === 'function' && define.amd ? define(['chart.js'], factory) :
4            (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.index = factory(global.Chart));
5})(this, (function (chart_js) {
6    'use strict';
7
8    var noop = { value: () => { } };
9
10    function dispatch() {
11        for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
12            if (!(t = arguments[i] + "") || (t in _) || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
13            _[t] = [];
14        }
15        return new Dispatch(_);
16    }
17
18    function Dispatch(_) {
19        this._ = _;
20    }
21
22    function parseTypenames$1(typenames, types) {
23        return typenames.trim().split(/^|\s+/).map(function (t) {
24            var name = "", i = t.indexOf(".");
25            if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
26            if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
27            return { type: t, name: name };
28        });
29    }
30
31    Dispatch.prototype = dispatch.prototype = {
32        constructor: Dispatch,
33        on: function (typename, callback) {
34            var _ = this._,
35                T = parseTypenames$1(typename + "", _),
36                t,
37                i = -1,
38                n = T.length;
39
40            // If no callback was specified, return the callback of the given type and name.
41            if (arguments.length < 2) {
42                while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
43                return;
44            }
45
46            // If a type was specified, set the callback for the given type and name.
47            // Otherwise, if a null callback was specified, remove callbacks of the given name.
48            if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
49            while (++i < n) {
50                if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
51                else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
52            }
53
54            return this;
55        },
56        copy: function () {
57            var copy = {}, _ = this._;
58            for (var t in _) copy[t] = _[t].slice();
59            return new Dispatch(copy);
60        },
61        call: function (type, that) {
62            if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
63            if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
64            for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
65        },
66        apply: function (type, that, args) {
67            if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
68            for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
69        }
70    };
71
72    function get(type, name) {
73        for (var i = 0, n = type.length, c; i < n; ++i) {
74            if ((c = type[i]).name === name) {
75                return c.value;
76            }
77        }
78    }
79
80    function set(type, name, callback) {
81        for (var i = 0, n = type.length; i < n; ++i) {
82            if (type[i].name === name) {
83                type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
84                break;
85            }
86        }
87        if (callback != null) type.push({ name: name, value: callback });
88        return type;
89    }
90
91    var xhtml = "http://www.w3.org/1999/xhtml";
92
93    var namespaces = {
94        svg: "http://www.w3.org/2000/svg",
95        xhtml: xhtml,
96        xlink: "http://www.w3.org/1999/xlink",
97        xml: "http://www.w3.org/XML/1998/namespace",
98        xmlns: "http://www.w3.org/2000/xmlns/"
99    };
100
101    function namespace(name) {
102        var prefix = name += "", i = prefix.indexOf(":");
103        if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
104        return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name; // eslint-disable-line no-prototype-builtins
105    }
106
107    function creatorInherit(name) {
108        return function () {
109            var document = this.ownerDocument,
110                uri = this.namespaceURI;
111            return uri === xhtml && document.documentElement.namespaceURI === xhtml
112                ? document.createElement(name)
113                : document.createElementNS(uri, name);
114        };
115    }
116
117    function creatorFixed(fullname) {
118        return function () {
119            return this.ownerDocument.createElementNS(fullname.space, fullname.local);
120        };
121    }
122
123    function creator(name) {
124        var fullname = namespace(name);
125        return (fullname.local
126            ? creatorFixed
127            : creatorInherit)(fullname);
128    }
129
130    function none() { }
131
132    function selector(selector) {
133        return selector == null ? none : function () {
134            return this.querySelector(selector);
135        };
136    }
137
138    function selection_select(select) {
139        if (typeof select !== "function") select = selector(select);
140
141        for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
142            for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
143                if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
144                    if ("__data__" in node) subnode.__data__ = node.__data__;
145                    subgroup[i] = subnode;
146                }
147            }
148        }
149
150        return new Selection(subgroups, this._parents);
151    }
152
153    // Given something array like (or null), returns something that is strictly an
154    // array. This is used to ensure that array-like objects passed to d3.selectAll
155    // or selection.selectAll are converted into proper arrays when creating a
156    // selection; we don’t ever want to create a selection backed by a live
157    // HTMLCollection or NodeList. However, note that selection.selectAll will use a
158    // static NodeList as a group, since it safely derived from querySelectorAll.
159    function array(x) {
160        return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
161    }
162
163    function empty() {
164        return [];
165    }
166
167    function selectorAll(selector) {
168        return selector == null ? empty : function () {
169            return this.querySelectorAll(selector);
170        };
171    }
172
173    function arrayAll(select) {
174        return function () {
175            return array(select.apply(this, arguments));
176        };
177    }
178
179    function selection_selectAll(select) {
180        if (typeof select === "function") select = arrayAll(select);
181        else select = selectorAll(select);
182
183        for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
184            for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
185                if (node = group[i]) {
186                    subgroups.push(select.call(node, node.__data__, i, group));
187                    parents.push(node);
188                }
189            }
190        }
191
192        return new Selection(subgroups, parents);
193    }
194
195    function matcher(selector) {
196        return function () {
197            return this.matches(selector);
198        };
199    }
200
201    function childMatcher(selector) {
202        return function (node) {
203            return node.matches(selector);
204        };
205    }
206
207    var find = Array.prototype.find;
208
209    function childFind(match) {
210        return function () {
211            return find.call(this.children, match);
212        };
213    }
214
215    function childFirst() {
216        return this.firstElementChild;
217    }
218
219    function selection_selectChild(match) {
220        return this.select(match == null ? childFirst
221            : childFind(typeof match === "function" ? match : childMatcher(match)));
222    }
223
224    var filter = Array.prototype.filter;
225
226    function children() {
227        return Array.from(this.children);
228    }
229
230    function childrenFilter(match) {
231        return function () {
232            return filter.call(this.children, match);
233        };
234    }
235
236    function selection_selectChildren(match) {
237        return this.selectAll(match == null ? children
238            : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
239    }
240
241    function selection_filter(match) {
242        if (typeof match !== "function") match = matcher(match);
243
244        for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
245            for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
246                if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
247                    subgroup.push(node);
248                }
249            }
250        }
251
252        return new Selection(subgroups, this._parents);
253    }
254
255    function sparse(update) {
256        return new Array(update.length);
257    }
258
259    function selection_enter() {
260        return new Selection(this._enter || this._groups.map(sparse), this._parents);
261    }
262
263    function EnterNode(parent, datum) {
264        this.ownerDocument = parent.ownerDocument;
265        this.namespaceURI = parent.namespaceURI;
266        this._next = null;
267        this._parent = parent;
268        this.__data__ = datum;
269    }
270
271    EnterNode.prototype = {
272        constructor: EnterNode,
273        appendChild: function (child) { return this._parent.insertBefore(child, this._next); },
274        insertBefore: function (child, next) { return this._parent.insertBefore(child, next); },
275        querySelector: function (selector) { return this._parent.querySelector(selector); },
276        querySelectorAll: function (selector) { return this._parent.querySelectorAll(selector); }
277    };
278
279    function constant$1(x) {
280        return function () {
281            return x;
282        };
283    }
284
285    function bindIndex(parent, group, enter, update, exit, data) {
286        var i = 0,
287            node,
288            groupLength = group.length,
289            dataLength = data.length;
290
291        // Put any non-null nodes that fit into update.
292        // Put any null nodes into enter.
293        // Put any remaining data into enter.
294        for (; i < dataLength; ++i) {
295            if (node = group[i]) {
296                node.__data__ = data[i];
297                update[i] = node;
298            } else {
299                enter[i] = new EnterNode(parent, data[i]);
300            }
301        }
302
303        // Put any non-null nodes that don’t fit into exit.
304        for (; i < groupLength; ++i) {
305            if (node = group[i]) {
306                exit[i] = node;
307            }
308        }
309    }
310
311    function bindKey(parent, group, enter, update, exit, data, key) {
312        var i,
313            node,
314            nodeByKeyValue = new Map,
315            groupLength = group.length,
316            dataLength = data.length,
317            keyValues = new Array(groupLength),
318            keyValue;
319
320        // Compute the key for each node.
321        // If multiple nodes have the same key, the duplicates are added to exit.
322        for (i = 0; i < groupLength; ++i) {
323            if (node = group[i]) {
324                keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
325                if (nodeByKeyValue.has(keyValue)) {
326                    exit[i] = node;
327                } else {
328                    nodeByKeyValue.set(keyValue, node);
329                }
330            }
331        }
332
333        // Compute the key for each datum.
334        // If there a node associated with this key, join and add it to update.
335        // If there is not (or the key is a duplicate), add it to enter.
336        for (i = 0; i < dataLength; ++i) {
337            keyValue = key.call(parent, data[i], i, data) + "";
338            if (node = nodeByKeyValue.get(keyValue)) {
339                update[i] = node;
340                node.__data__ = data[i];
341                nodeByKeyValue.delete(keyValue);
342            } else {
343                enter[i] = new EnterNode(parent, data[i]);
344            }
345        }
346
347        // Add any remaining nodes that were not bound to data to exit.
348        for (i = 0; i < groupLength; ++i) {
349            if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {
350                exit[i] = node;
351            }
352        }
353    }
354
355    function datum(node) {
356        return node.__data__;
357    }
358
359    function selection_data(value, key) {
360        if (!arguments.length) return Array.from(this, datum);
361
362        var bind = key ? bindKey : bindIndex,
363            parents = this._parents,
364            groups = this._groups;
365
366        if (typeof value !== "function") value = constant$1(value);
367
368        for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
369            var parent = parents[j],
370                group = groups[j],
371                groupLength = group.length,
372                data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),
373                dataLength = data.length,
374                enterGroup = enter[j] = new Array(dataLength),
375                updateGroup = update[j] = new Array(dataLength),
376                exitGroup = exit[j] = new Array(groupLength);
377
378            bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
379
380            // Now connect the enter nodes to their following update node, such that
381            // appendChild can insert the materialized enter node before this node,
382            // rather than at the end of the parent node.
383            for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
384                if (previous = enterGroup[i0]) {
385                    if (i0 >= i1) i1 = i0 + 1;
386                    while (!(next = updateGroup[i1]) && ++i1 < dataLength);
387                    previous._next = next || null;
388                }
389            }
390        }
391
392        update = new Selection(update, parents);
393        update._enter = enter;
394        update._exit = exit;
395        return update;
396    }
397
398    // Given some data, this returns an array-like view of it: an object that
399    // exposes a length property and allows numeric indexing. Note that unlike
400    // selectAll, this isn’t worried about “live” collections because the resulting
401    // array will only be used briefly while data is being bound. (It is possible to
402    // cause the data to change while iterating by using a key function, but please
403    // don’t; we’d rather avoid a gratuitous copy.)
404    function arraylike(data) {
405        return typeof data === "object" && "length" in data
406            ? data // Array, TypedArray, NodeList, array-like
407            : Array.from(data); // Map, Set, iterable, string, or anything else
408    }
409
410    function selection_exit() {
411        return new Selection(this._exit || this._groups.map(sparse), this._parents);
412    }
413
414    function selection_join(onenter, onupdate, onexit) {
415        var enter = this.enter(), update = this, exit = this.exit();
416        if (typeof onenter === "function") {
417            enter = onenter(enter);
418            if (enter) enter = enter.selection();
419        } else {
420            enter = enter.append(onenter + "");
421        }
422        if (onupdate != null) {
423            update = onupdate(update);
424            if (update) update = update.selection();
425        }
426        if (onexit == null) exit.remove(); else onexit(exit);
427        return enter && update ? enter.merge(update).order() : update;
428    }
429
430    function selection_merge(context) {
431        var selection = context.selection ? context.selection() : context;
432
433        for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
434            for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
435                if (node = group0[i] || group1[i]) {
436                    merge[i] = node;
437                }
438            }
439        }
440
441        for (; j < m0; ++j) {
442            merges[j] = groups0[j];
443        }
444
445        return new Selection(merges, this._parents);
446    }
447
448    function selection_order() {
449
450        for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
451            for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
452                if (node = group[i]) {
453                    if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
454                    next = node;
455                }
456            }
457        }
458
459        return this;
460    }
461
462    function selection_sort(compare) {
463        if (!compare) compare = ascending;
464
465        function compareNode(a, b) {
466            return a && b ? compare(a.__data__, b.__data__) : !a - !b;
467        }
468
469        for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
470            for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
471                if (node = group[i]) {
472                    sortgroup[i] = node;
473                }
474            }
475            sortgroup.sort(compareNode);
476        }
477
478        return new Selection(sortgroups, this._parents).order();
479    }
480
481    function ascending(a, b) {
482        return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
483    }
484
485    function selection_call() {
486        var callback = arguments[0];
487        arguments[0] = this;
488        callback.apply(null, arguments);
489        return this;
490    }
491
492    function selection_nodes() {
493        return Array.from(this);
494    }
495
496    function selection_node() {
497
498        for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
499            for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
500                var node = group[i];
501                if (node) return node;
502            }
503        }
504
505        return null;
506    }
507
508    function selection_size() {
509        let size = 0;
510        for (const node of this) ++size; // eslint-disable-line no-unused-vars
511        return size;
512    }
513
514    function selection_empty() {
515        return !this.node();
516    }
517
518    function selection_each(callback) {
519
520        for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
521            for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
522                if (node = group[i]) callback.call(node, node.__data__, i, group);
523            }
524        }
525
526        return this;
527    }
528
529    function attrRemove(name) {
530        return function () {
531            this.removeAttribute(name);
532        };
533    }
534
535    function attrRemoveNS(fullname) {
536        return function () {
537            this.removeAttributeNS(fullname.space, fullname.local);
538        };
539    }
540
541    function attrConstant(name, value) {
542        return function () {
543            this.setAttribute(name, value);
544        };
545    }
546
547    function attrConstantNS(fullname, value) {
548        return function () {
549            this.setAttributeNS(fullname.space, fullname.local, value);
550        };
551    }
552
553    function attrFunction(name, value) {
554        return function () {
555            var v = value.apply(this, arguments);
556            if (v == null) this.removeAttribute(name);
557            else this.setAttribute(name, v);
558        };
559    }
560
561    function attrFunctionNS(fullname, value) {
562        return function () {
563            var v = value.apply(this, arguments);
564            if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
565            else this.setAttributeNS(fullname.space, fullname.local, v);
566        };
567    }
568
569    function selection_attr(name, value) {
570        var fullname = namespace(name);
571
572        if (arguments.length < 2) {
573            var node = this.node();
574            return fullname.local
575                ? node.getAttributeNS(fullname.space, fullname.local)
576                : node.getAttribute(fullname);
577        }
578
579        return this.each((value == null
580            ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function"
581                ? (fullname.local ? attrFunctionNS : attrFunction)
582                : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));
583    }
584
585    function defaultView(node) {
586        return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
587            || (node.document && node) // node is a Window
588            || node.defaultView; // node is a Document
589    }
590
591    function styleRemove(name) {
592        return function () {
593            this.style.removeProperty(name);
594        };
595    }
596
597    function styleConstant(name, value, priority) {
598        return function () {
599            this.style.setProperty(name, value, priority);
600        };
601    }
602
603    function styleFunction(name, value, priority) {
604        return function () {
605            var v = value.apply(this, arguments);
606            if (v == null) this.style.removeProperty(name);
607            else this.style.setProperty(name, v, priority);
608        };
609    }
610
611    function selection_style(name, value, priority) {
612        return arguments.length > 1
613            ? this.each((value == null
614                ? styleRemove : typeof value === "function"
615                    ? styleFunction
616                    : styleConstant)(name, value, priority == null ? "" : priority))
617            : styleValue(this.node(), name);
618    }
619
620    function styleValue(node, name) {
621        return node.style.getPropertyValue(name)
622            || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
623    }
624
625    function propertyRemove(name) {
626        return function () {
627            delete this[name];
628        };
629    }
630
631    function propertyConstant(name, value) {
632        return function () {
633            this[name] = value;
634        };
635    }
636
637    function propertyFunction(name, value) {
638        return function () {
639            var v = value.apply(this, arguments);
640            if (v == null) delete this[name];
641            else this[name] = v;
642        };
643    }
644
645    function selection_property(name, value) {
646        return arguments.length > 1
647            ? this.each((value == null
648                ? propertyRemove : typeof value === "function"
649                    ? propertyFunction
650                    : propertyConstant)(name, value))
651            : this.node()[name];
652    }
653
654    function classArray(string) {
655        return string.trim().split(/^|\s+/);
656    }
657
658    function classList(node) {
659        return node.classList || new ClassList(node);
660    }
661
662    function ClassList(node) {
663        this._node = node;
664        this._names = classArray(node.getAttribute("class") || "");
665    }
666
667    ClassList.prototype = {
668        add: function (name) {
669            var i = this._names.indexOf(name);
670            if (i < 0) {
671                this._names.push(name);
672                this._node.setAttribute("class", this._names.join(" "));
673            }
674        },
675        remove: function (name) {
676            var i = this._names.indexOf(name);
677            if (i >= 0) {
678                this._names.splice(i, 1);
679                this._node.setAttribute("class", this._names.join(" "));
680            }
681        },
682        contains: function (name) {
683            return this._names.indexOf(name) >= 0;
684        }
685    };
686
687    function classedAdd(node, names) {
688        var list = classList(node), i = -1, n = names.length;
689        while (++i < n) list.add(names[i]);
690    }
691
692    function classedRemove(node, names) {
693        var list = classList(node), i = -1, n = names.length;
694        while (++i < n) list.remove(names[i]);
695    }
696
697    function classedTrue(names) {
698        return function () {
699            classedAdd(this, names);
700        };
701    }
702
703    function classedFalse(names) {
704        return function () {
705            classedRemove(this, names);
706        };
707    }
708
709    function classedFunction(names, value) {
710        return function () {
711            (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
712        };
713    }
714
715    function selection_classed(name, value) {
716        var names = classArray(name + "");
717
718        if (arguments.length < 2) {
719            var list = classList(this.node()), i = -1, n = names.length;
720            while (++i < n) if (!list.contains(names[i])) return false;
721            return true;
722        }
723
724        return this.each((typeof value === "function"
725            ? classedFunction : value
726                ? classedTrue
727                : classedFalse)(names, value));
728    }
729
730    function textRemove() {
731        this.textContent = "";
732    }
733
734    function textConstant(value) {
735        return function () {
736            this.textContent = value;
737        };
738    }
739
740    function textFunction(value) {
741        return function () {
742            var v = value.apply(this, arguments);
743            this.textContent = v == null ? "" : v;
744        };
745    }
746
747    function selection_text(value) {
748        return arguments.length
749            ? this.each(value == null
750                ? textRemove : (typeof value === "function"
751                    ? textFunction
752                    : textConstant)(value))
753            : this.node().textContent;
754    }
755
756    function htmlRemove() {
757        this.innerHTML = "";
758    }
759
760    function htmlConstant(value) {
761        return function () {
762            this.innerHTML = value;
763        };
764    }
765
766    function htmlFunction(value) {
767        return function () {
768            var v = value.apply(this, arguments);
769            this.innerHTML = v == null ? "" : v;
770        };
771    }
772
773    function selection_html(value) {
774        return arguments.length
775            ? this.each(value == null
776                ? htmlRemove : (typeof value === "function"
777                    ? htmlFunction
778                    : htmlConstant)(value))
779            : this.node().innerHTML;
780    }
781
782    function raise() {
783        if (this.nextSibling) this.parentNode.appendChild(this);
784    }
785
786    function selection_raise() {
787        return this.each(raise);
788    }
789
790    function lower() {
791        if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
792    }
793
794    function selection_lower() {
795        return this.each(lower);
796    }
797
798    function selection_append(name) {
799        var create = typeof name === "function" ? name : creator(name);
800        return this.select(function () {
801            return this.appendChild(create.apply(this, arguments));
802        });
803    }
804
805    function constantNull() {
806        return null;
807    }
808
809    function selection_insert(name, before) {
810        var create = typeof name === "function" ? name : creator(name),
811            select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
812        return this.select(function () {
813            return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
814        });
815    }
816
817    function remove() {
818        var parent = this.parentNode;
819        if (parent) parent.removeChild(this);
820    }
821
822    function selection_remove() {
823        return this.each(remove);
824    }
825
826    function selection_cloneShallow() {
827        var clone = this.cloneNode(false), parent = this.parentNode;
828        return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
829    }
830
831    function selection_cloneDeep() {
832        var clone = this.cloneNode(true), parent = this.parentNode;
833        return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
834    }
835
836    function selection_clone(deep) {
837        return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
838    }
839
840    function selection_datum(value) {
841        return arguments.length
842            ? this.property("__data__", value)
843            : this.node().__data__;
844    }
845
846    function contextListener(listener) {
847        return function (event) {
848            listener.call(this, event, this.__data__);
849        };
850    }
851
852    function parseTypenames(typenames) {
853        return typenames.trim().split(/^|\s+/).map(function (t) {
854            var name = "", i = t.indexOf(".");
855            if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
856            return { type: t, name: name };
857        });
858    }
859
860    function onRemove(typename) {
861        return function () {
862            var on = this.__on;
863            if (!on) return;
864            for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
865                if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
866                    this.removeEventListener(o.type, o.listener, o.options);
867                } else {
868                    on[++i] = o;
869                }
870            }
871            if (++i) on.length = i;
872            else delete this.__on;
873        };
874    }
875
876    function onAdd(typename, value, options) {
877        return function () {
878            var on = this.__on, o, listener = contextListener(value);
879            if (on) for (var j = 0, m = on.length; j < m; ++j) {
880                if ((o = on[j]).type === typename.type && o.name === typename.name) {
881                    this.removeEventListener(o.type, o.listener, o.options);
882                    this.addEventListener(o.type, o.listener = listener, o.options = options);
883                    o.value = value;
884                    return;
885                }
886            }
887            this.addEventListener(typename.type, listener, options);
888            o = { type: typename.type, name: typename.name, value: value, listener: listener, options: options };
889            if (!on) this.__on = [o];
890            else on.push(o);
891        };
892    }
893
894    function selection_on(typename, value, options) {
895        var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
896
897        if (arguments.length < 2) {
898            var on = this.node().__on;
899            if (on) for (var j = 0, m = on.length, o; j < m; ++j) {
900                for (i = 0, o = on[j]; i < n; ++i) {
901                    if ((t = typenames[i]).type === o.type && t.name === o.name) {
902                        return o.value;
903                    }
904                }
905            }
906            return;
907        }
908
909        on = value ? onAdd : onRemove;
910        for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));
911        return this;
912    }
913
914    function dispatchEvent(node, type, params) {
915        var window = defaultView(node),
916            event = window.CustomEvent;
917
918        if (typeof event === "function") {
919            event = new event(type, params);
920        } else {
921            event = window.document.createEvent("Event");
922            if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
923            else event.initEvent(type, false, false);
924        }
925
926        node.dispatchEvent(event);
927    }
928
929    function dispatchConstant(type, params) {
930        return function () {
vendor: 12,647 bytes, lines 931-1296
931            return dispatchEvent(this, type, params);
932        };
933    }
934
935    function dispatchFunction(type, params) {
936        return function () {
937            return dispatchEvent(this, type, params.apply(this, arguments));
938        };
939    }
940
941    function selection_dispatch(type, params) {
942        return this.each((typeof params === "function"
943            ? dispatchFunction
944            : dispatchConstant)(type, params));
945    }
946
947    function* selection_iterator() {
948        for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
949            for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {
950                if (node = group[i]) yield node;
951            }
952        }
953    }
954
955    var root = [null];
956
957    function Selection(groups, parents) {
958        this._groups = groups;
959        this._parents = parents;
960    }
961
962    function selection_selection() {
963        return this;
964    }
965
966    Selection.prototype = {
967        constructor: Selection,
968        select: selection_select,
969        selectAll: selection_selectAll,
970        selectChild: selection_selectChild,
971        selectChildren: selection_selectChildren,
972        filter: selection_filter,
973        data: selection_data,
974        enter: selection_enter,
975        exit: selection_exit,
976        join: selection_join,
977        merge: selection_merge,
978        selection: selection_selection,
979        order: selection_order,
980        sort: selection_sort,
981        call: selection_call,
982        nodes: selection_nodes,
983        node: selection_node,
984        size: selection_size,
985        empty: selection_empty,
986        each: selection_each,
987        attr: selection_attr,
988        style: selection_style,
989        property: selection_property,
990        classed: selection_classed,
991        text: selection_text,
992        html: selection_html,
993        raise: selection_raise,
994        lower: selection_lower,
995        append: selection_append,
996        insert: selection_insert,
997        remove: selection_remove,
998        clone: selection_clone,
999        datum: selection_datum,
1000        on: selection_on,
1001        dispatch: selection_dispatch,
1002        [Symbol.iterator]: selection_iterator
1003    };
1004
1005    function select(selector) {
1006        return typeof selector === "string"
1007            ? new Selection([[document.querySelector(selector)]], [document.documentElement])
1008            : new Selection([[selector]], root);
1009    }
1010
1011    function sourceEvent(event) {
1012        let sourceEvent;
1013        while (sourceEvent = event.sourceEvent) event = sourceEvent;
1014        return event;
1015    }
1016
1017    function pointer(event, node) {
1018        event = sourceEvent(event);
1019        if (node === undefined) node = event.currentTarget;
1020        if (node) {
1021            var svg = node.ownerSVGElement || node;
1022            if (svg.createSVGPoint) {
1023                var point = svg.createSVGPoint();
1024                point.x = event.clientX, point.y = event.clientY;
1025                point = point.matrixTransform(node.getScreenCTM().inverse());
1026                return [point.x, point.y];
1027            }
1028            if (node.getBoundingClientRect) {
1029                var rect = node.getBoundingClientRect();
1030                return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
1031            }
1032        }
1033        return [event.pageX, event.pageY];
1034    }
1035
1036    // These are typically used in conjunction with noevent to ensure that we can
1037    // preventDefault on the event.
1038    const nonpassive = { passive: false };
1039    const nonpassivecapture = { capture: true, passive: false };
1040
1041    function nopropagation(event) {
1042        event.stopImmediatePropagation();
1043    }
1044
1045    function noevent(event) {
1046        event.preventDefault();
1047        event.stopImmediatePropagation();
1048    }
1049
1050    function nodrag(view) {
1051        var root = view.document.documentElement,
1052            selection = select(view).on("dragstart.drag", noevent, nonpassivecapture);
1053        if ("onselectstart" in root) {
1054            selection.on("selectstart.drag", noevent, nonpassivecapture);
1055        } else {
1056            root.__noselect = root.style.MozUserSelect;
1057            root.style.MozUserSelect = "none";
1058        }
1059    }
1060
1061    function yesdrag(view, noclick) {
1062        var root = view.document.documentElement,
1063            selection = select(view).on("dragstart.drag", null);
1064        if (noclick) {
1065            selection.on("click.drag", noevent, nonpassivecapture);
1066            setTimeout(function () { selection.on("click.drag", null); }, 0);
1067        }
1068        if ("onselectstart" in root) {
1069            selection.on("selectstart.drag", null);
1070        } else {
1071            root.style.MozUserSelect = root.__noselect;
1072            delete root.__noselect;
1073        }
1074    }
1075
1076    var constant = x => () => x;
1077
1078    function DragEvent(type, {
1079        sourceEvent,
1080        subject,
1081        target,
1082        identifier,
1083        active,
1084        x, y, dx, dy,
1085        dispatch
1086    }) {
1087        Object.defineProperties(this, {
1088            type: { value: type, enumerable: true, configurable: true },
1089            sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
1090            subject: { value: subject, enumerable: true, configurable: true },
1091            target: { value: target, enumerable: true, configurable: true },
1092            identifier: { value: identifier, enumerable: true, configurable: true },
1093            active: { value: active, enumerable: true, configurable: true },
1094            x: { value: x, enumerable: true, configurable: true },
1095            y: { value: y, enumerable: true, configurable: true },
1096            dx: { value: dx, enumerable: true, configurable: true },
1097            dy: { value: dy, enumerable: true, configurable: true },
1098            _: { value: dispatch }
1099        });
1100    }
1101
1102    DragEvent.prototype.on = function () {
1103        var value = this._.on.apply(this._, arguments);
1104        return value === this._ ? this : value;
1105    };
1106
1107    // Ignore right-click, since that should open the context menu.
1108    function defaultFilter(event) {
1109        return !event.ctrlKey && !event.button;
1110    }
1111
1112    function defaultContainer() {
1113        return this.parentNode;
1114    }
1115
1116    function defaultSubject(event, d) {
1117        return d == null ? { x: event.x, y: event.y } : d;
1118    }
1119
1120    function defaultTouchable() {
1121        return navigator.maxTouchPoints || ("ontouchstart" in this);
1122    }
1123
1124    function drag() {
1125        var filter = defaultFilter,
1126            container = defaultContainer,
1127            subject = defaultSubject,
1128            touchable = defaultTouchable,
1129            gestures = {},
1130            listeners = dispatch("start", "drag", "end"),
1131            active = 0,
1132            mousedownx,
1133            mousedowny,
1134            mousemoving,
1135            touchending,
1136            clickDistance2 = 0;
1137
1138        function drag(selection) {
1139            selection
1140                .on("mousedown.drag", mousedowned)
1141                .filter(touchable)
1142                .on("touchstart.drag", touchstarted)
1143                .on("touchmove.drag", touchmoved, nonpassive)
1144                .on("touchend.drag touchcancel.drag", touchended)
1145                .style("touch-action", "none")
1146                .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1147        }
1148
1149        function mousedowned(event, d) {
1150            if (touchending || !filter.call(this, event, d)) return;
1151            var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse");
1152            if (!gesture) return;
1153            select(event.view)
1154                .on("mousemove.drag", mousemoved, nonpassivecapture)
1155                .on("mouseup.drag", mouseupped, nonpassivecapture);
1156            nodrag(event.view);
1157            nopropagation(event);
1158            mousemoving = false;
1159            mousedownx = event.clientX;
1160            mousedowny = event.clientY;
1161            gesture("start", event);
1162        }
1163
1164        function mousemoved(event) {
1165            noevent(event);
1166            if (!mousemoving) {
1167                var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
1168                mousemoving = dx * dx + dy * dy > clickDistance2;
1169            }
1170            gestures.mouse("drag", event);
1171        }
1172
1173        function mouseupped(event) {
1174            select(event.view).on("mousemove.drag mouseup.drag", null);
1175            yesdrag(event.view, mousemoving);
1176            noevent(event);
1177            gestures.mouse("end", event);
1178        }
1179
1180        function touchstarted(event, d) {
1181            if (!filter.call(this, event, d)) return;
1182            var touches = event.changedTouches,
1183                c = container.call(this, event, d),
1184                n = touches.length, i, gesture;
1185
1186            for (i = 0; i < n; ++i) {
1187                if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) {
1188                    nopropagation(event);
1189                    gesture("start", event, touches[i]);
1190                }
1191            }
1192        }
1193
1194        function touchmoved(event) {
1195            var touches = event.changedTouches,
1196                n = touches.length, i, gesture;
1197
1198            for (i = 0; i < n; ++i) {
1199                if (gesture = gestures[touches[i].identifier]) {
1200                    noevent(event);
1201                    gesture("drag", event, touches[i]);
1202                }
1203            }
1204        }
1205
1206        function touchended(event) {
1207            var touches = event.changedTouches,
1208                n = touches.length, i, gesture;
1209
1210            if (touchending) clearTimeout(touchending);
1211            touchending = setTimeout(function () { touchending = null; }, 500); // Ghost clicks are delayed!
1212            for (i = 0; i < n; ++i) {
1213                if (gesture = gestures[touches[i].identifier]) {
1214                    nopropagation(event);
1215                    gesture("end", event, touches[i]);
1216                }
1217            }
1218        }
1219
1220        function beforestart(that, container, event, d, identifier, touch) {
1221            var dispatch = listeners.copy(),
1222                p = pointer(touch || event, container), dx, dy,
1223                s;
1224
1225            if ((s = subject.call(that, new DragEvent("beforestart", {
1226                sourceEvent: event,
1227                target: drag,
1228                identifier,
1229                active,
1230                x: p[0],
1231                y: p[1],
1232                dx: 0,
1233                dy: 0,
1234                dispatch
1235            }), d)) == null) return;
1236
1237            dx = s.x - p[0] || 0;
1238            dy = s.y - p[1] || 0;
1239
1240            return function gesture(type, event, touch) {
1241                var p0 = p, n;
1242                switch (type) {
1243                    case "start": gestures[identifier] = gesture, n = active++; break;
1244                    case "end": delete gestures[identifier], --active; // falls through
1245                    case "drag": p = pointer(touch || event, container), n = active; break;
1246                }
1247                dispatch.call(
1248                    type,
1249                    that,
1250                    new DragEvent(type, {
1251                        sourceEvent: event,
1252                        subject: s,
1253                        target: drag,
1254                        identifier,
1255                        active: n,
1256                        x: p[0] + dx,
1257                        y: p[1] + dy,
1258                        dx: p[0] - p0[0],
1259                        dy: p[1] - p0[1],
1260                        dispatch
1261                    }),
1262                    d
1263                );
1264            };
1265        }
1266
1267        drag.filter = function (_) {
1268            return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), drag) : filter;
1269        };
1270
1271        drag.container = function (_) {
1272            return arguments.length ? (container = typeof _ === "function" ? _ : constant(_), drag) : container;
1273        };
1274
1275        drag.subject = function (_) {
1276            return arguments.length ? (subject = typeof _ === "function" ? _ : constant(_), drag) : subject;
1277        };
1278
1279        drag.touchable = function (_) {
1280            return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), drag) : touchable;
1281        };
1282
1283        drag.on = function () {
1284            var value = listeners.on.apply(listeners, arguments);
1285            return value === listeners ? drag : value;
1286        };
1287
1288        drag.clickDistance = function (_) {
1289            return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
1290        };
1291
1292        return drag;
1293    }
1294
1295    let element, yAxisID, xAxisID, rAxisID, type, stacked, floatingBar, initValue, curDatasetIndex, curIndex, eventSettings;
1296    let isDragging = false;
1297
1298    function getSafe(func) {
1299        try {
1300            return func()
1301        } catch (e) {
1302            return ''
1303        }
1304    }
1305
1306    const getElement = (e, chartInstance, callback) => {
1307        element = chartInstance.getElementsAtEventForMode(e, 'nearest', { intersect: true }, false)[0];
1308        type = chartInstance.config.type;
1309
1310        if (element) {
1311            let datasetIndex = element.datasetIndex;
1312            let index = element.index;
1313            // save element settings
1314            eventSettings = getSafe(() => chartInstance.config.options.plugins.tooltip.animation);
1315
1316            const dataset = chartInstance.data.datasets[datasetIndex];
1317            const datasetMeta = chartInstance.getDatasetMeta(datasetIndex);
1318            let curValue = dataset.data[index];
1319            // get the id of the datasets scale
1320            xAxisID = datasetMeta.xAxisID;
1321            yAxisID = datasetMeta.yAxisID;
1322            rAxisID = datasetMeta.rAxisID;
1323
1324            // check if dragging the dataset or datapoint is prohibited
1325            if (dataset.dragData === false ||
1326                (chartInstance.config.options.scales[xAxisID] && chartInstance.config.options.scales[xAxisID].dragData === false) ||
1327                (chartInstance.config.options.scales[yAxisID] && chartInstance.config.options.scales[yAxisID].dragData === false) ||
1328                (chartInstance.config.options.scales[rAxisID] && chartInstance.config.options.scales[rAxisID].rAxisID === false) ||
1329                dataset.data[element.index].dragData === false
1330            ) {
1331                element = null;
1332                return
1333            }
1334
1335            if (type === 'bar') {
1336                stacked = chartInstance.config.options.scales[xAxisID].stacked;
1337                // if a bar has a data point that is an array of length 2, it's a floating bar
1338                const samplePoint = chartInstance.data.datasets[0].data[0];
1339                floatingBar = (samplePoint !== null) && Array.isArray(samplePoint) && samplePoint.length == 2;
1340                let newPos = calcPosition(e, chartInstance, datasetIndex, index);
1341                initValue = newPos - curValue;
1342            }
1343            else {
1344                floatingBar = false;
1345            }
1346
1347
1348            // disable the tooltip animation
1349            if (chartInstance.config.options.plugins.dragData.showTooltip === undefined || chartInstance.config.options.plugins.dragData.showTooltip) {
1350                if (!chartInstance.config.options.plugins.tooltip) chartInstance.config.options.plugins.tooltip = {};
1351                chartInstance.config.options.plugins.tooltip.animation = false;
1352            }
1353
1354            if (typeof callback === 'function' && element) {
1355                if (callback(e, datasetIndex, index, curValue) === false) {
1356                    element = null;
1357                }
1358            }
1359        }
1360    };
1361
1362    function roundValue(value, pos) {
1363        if (!isNaN(pos)) {
1364            return Math.round(value * Math.pow(10, pos)) / Math.pow(10, pos)
1365        }
1366        return value
1367    }
1368
1369    function calcRadar(e, chartInstance) {
1370        let x, y, v;
1371        if (e.touches) {
1372            x = e.touches[0].clientX - chartInstance.canvas.getBoundingClientRect().left;
1373            y = e.touches[0].clientY - chartInstance.canvas.getBoundingClientRect().top;
1374        } else {
1375            x = e.clientX - chartInstance.canvas.getBoundingClientRect().left;
1376            y = e.clientY - chartInstance.canvas.getBoundingClientRect().top;
1377        }
1378        let rScale = chartInstance.scales[rAxisID];
1379        let d = Math.sqrt(Math.pow(x - rScale.xCenter, 2) + Math.pow(y - rScale.yCenter, 2));
1380        let scalingFactor = rScale.drawingArea / (rScale.max - rScale.min);
1381        if (rScale.options.ticks.reverse) {
1382            v = rScale.max - (d / scalingFactor);
1383        } else {
1384            v = rScale.min + (d / scalingFactor);
1385        }
1386
1387        v = roundValue(v, chartInstance.config.options.plugins.dragData.round);
1388
1389        v = v > chartInstance.scales[rAxisID].max ? chartInstance.scales[rAxisID].max : v;
1390        v = v < chartInstance.scales[rAxisID].min ? chartInstance.scales[rAxisID].min : v;
1391
1392        return v
1393    }
1394
1395    function calcPosition(e, chartInstance, datasetIndex, index, data) {
1396        let x, y;
1397        const dataPoint = chartInstance.data.datasets[datasetIndex].data[index];
1398
1399        if (e.touches) {
1400            x = chartInstance.scales[xAxisID].getValueForPixel(e.touches[0].clientX - chartInstance.canvas.getBoundingClientRect().left);
1401            y = chartInstance.scales[yAxisID].getValueForPixel(e.touches[0].clientY - chartInstance.canvas.getBoundingClientRect().top);
1402        } else {
1403            x = chartInstance.scales[xAxisID].getValueForPixel(e.clientX - chartInstance.canvas.getBoundingClientRect().left);
1404            y = chartInstance.scales[yAxisID].getValueForPixel(e.clientY - chartInstance.canvas.getBoundingClientRect().top);
1405        }
1406
1407        x = roundValue(x, chartInstance.config.options.plugins.dragData.round);
1408        y = roundValue(y, chartInstance.config.options.plugins.dragData.round);
1409
1410        x = x > chartInstance.scales[xAxisID].max ? chartInstance.scales[xAxisID].max : x;
1411        x = x < chartInstance.scales[xAxisID].min ? chartInstance.scales[xAxisID].min : x;
1412
1413        y = y > chartInstance.scales[yAxisID].max ? chartInstance.scales[yAxisID].max : y;
1414        y = y < chartInstance.scales[yAxisID].min ? chartInstance.scales[yAxisID].min : y;
1415
1416
1417        if (floatingBar) {
1418
1419           
1420            // x contains the new value for one end of the floating bar
1421            // dataPoint contains the old interval [left, right] of the floating bar
1422            // calculate difference between the new value and both sides
1423            // the side with the smallest difference from the new value was the one that was dragged
1424            // return an interval with new value on the dragged side and old value on the other side
1425            let newVal;
1426            // choose the right variable based on the orientation of the graph(vertical, horizontal)
1427            if (chartInstance.config.options.indexAxis === 'y') {
1428                newVal = x;
1429            } else {
1430                newVal = y;
1431            }
1432
1433
1434            const diffFromLeft = Math.abs(newVal - dataPoint[0]);
1435            const diffFromRight = Math.abs(newVal - dataPoint[1]);
1436
1437            let isEndpoint = false;
1438            if (chartInstance.data.datasets[datasetIndex].label.indexOf('_endpoint_') > -1) {
1439                isEndpoint = true;
1440            }
1441            if (isEndpoint) {
1442                let increment = parseFloat((chartInstance.options.scales.y.max / 100).toFixed(3));
1443                let upperBound = newVal + increment;
1444                return [newVal, upperBound]
1445            }
1446            else {
1447                if (diffFromLeft <= diffFromRight) {
1448                    return [newVal, dataPoint[1]]
1449                } else {
1450                    return [dataPoint[0], newVal]
1451                }
1452            }
1453        }
1454      
1455
1456        if (dataPoint.x !== undefined && chartInstance.config.options.plugins.dragData.dragX) {
1457            dataPoint.x = x;
1458        }
1459
1460        if (dataPoint.y !== undefined) {
1461            if (chartInstance.config.options.plugins.dragData.dragY !== false) {
1462                dataPoint.y = y;
1463            }
1464            return dataPoint
1465        } else {
1466            if (chartInstance.config.options.indexAxis === 'y') {
1467                return x
1468            } else {
1469                return y
1470            }
1471        }
1472    }
1473
1474    const updateData = (e, chartInstance, pluginOptions, callback) => {
1475        if (element) {
1476            curDatasetIndex = element.datasetIndex;
1477            curIndex = element.index;
1478
1479            isDragging = true;
1480
1481            let dataPoint = chartInstance.data.datasets[curDatasetIndex].data[curIndex];
1482            if (type === 'line') {
1483                dataPoint = calcPosition(e, chartInstance, curDatasetIndex, curIndex);
1484            }
1485           else if (type === 'radar' || type === 'polarArea') {
1486                dataPoint = calcRadar(e, chartInstance);
1487            }
1488            //PUT THIS FIRST SO STACKED DOESN'T OVERRIDE FLOATING BAR 
1489            else if (floatingBar) {
1490                dataPoint = calcPosition(e, chartInstance, curDatasetIndex, curIndex);
1491            }
1492            else if (stacked) {
1493                let cursorPos = calcPosition(e, chartInstance, curDatasetIndex, curIndex);
1494                dataPoint = roundValue(cursorPos - initValue, pluginOptions.round);
1495            } /*else if (floatingBar) {
1496          dataPoint = calcPosition(e, chartInstance, curDatasetIndex, curIndex);
1497          console.log("IS floating bar datapoint = " + dataPoint);
1498        } */ else {
1499                dataPoint = calcPosition(e, chartInstance, curDatasetIndex, curIndex);
1500            }
1501
1502            if (!callback || (typeof callback === 'function' && callback(e, curDatasetIndex, curIndex, dataPoint) !== false)) {
1503                chartInstance.data.datasets[curDatasetIndex].data[curIndex] = dataPoint;
1504                chartInstance.update('none');
1505            }
1506        }
1507    };
1508
1509    // Update values to the nearest values
1510    function applyMagnet(chartInstance, i, j) {
1511        const pluginOptions = chartInstance.config.options.plugins.dragData;
1512        if (pluginOptions.magnet) {
1513            const magnet = pluginOptions.magnet;
1514            if (magnet.to && typeof magnet.to === 'function') {
1515                let data = chartInstance.data.datasets[i].data[j];
1516                data = magnet.to(data);
1517                chartInstance.data.datasets[i].data[j] = data;
1518                chartInstance.update('none');
1519                return data
1520            }
1521        } else {
1522            return chartInstance.data.datasets[i].data[j]
1523        }
1524    }
1525
1526    const dragEndCallback = (e, chartInstance, callback) => {
1527        curIndex = undefined;
1528        isDragging = false;
1529        // re-enable the tooltip animation
1530        if (chartInstance.config.options.plugins.tooltip) {
1531            chartInstance.config.options.plugins.tooltip.animation = eventSettings;
1532            chartInstance.update('none');
1533        }
1534
1535        // chartInstance.update('none')
1536        if (typeof callback === 'function' && element) {
1537            const datasetIndex = element.datasetIndex;
1538            const index = element.index;
1539            let value = applyMagnet(chartInstance, datasetIndex, index);
1540            return callback(e, datasetIndex, index, value)
1541        }
1542    };
1543
1544    const ChartJSdragDataPlugin = {
1545        id: 'dragdata',
1546        afterInit: function (chartInstance) {
1547            if (chartInstance.config.options.plugins && chartInstance.config.options.plugins.dragData) {
1548                const pluginOptions = chartInstance.config.options.plugins.dragData;
1549                select(chartInstance.canvas).call(
1550                    drag().container(chartInstance.canvas)
1551                        .on('start', e => getElement(e.sourceEvent, chartInstance, pluginOptions.onDragStart))
1552                        .on('drag', e => updateData(e.sourceEvent, chartInstance, pluginOptions, pluginOptions.onDrag))
1553                        .on('end', e => dragEndCallback(e.sourceEvent, chartInstance, pluginOptions.onDragEnd))
1554                );
1555            }
1556        },
1557        beforeEvent: function (chart) {
1558            if (isDragging) {
1559                chart.tooltip.update();
1560                return false
1561            }
1562        },
1563    };
1564    chart_js.Chart.register(ChartJSdragDataPlugin);
1565
1566    return ChartJSdragDataPlugin;
1567
1568}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.