From f35ae07790d1a3639d94e2aee0abcd013275cb9b Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 15:23:31 +0200 Subject: [PATCH 1/9] Update vis.timeline to 7.7.3 Remove d3 dependency as it's only used to download JSON data --- .../resources/webapp/assets/css/timeline.css | 16 +- .../resources/webapp/assets/js/timeline.js | 158 +- .../src/main/resources/webapp/timeline.html | 5 +- .../resources/webapp/vendor/d3/LICENSE.txt | 27 - .../resources/webapp/vendor/d3/d3-3.3.4.js | 9294 --- .../vis/dist/img/network/acceptDeleteIcon.png | Bin 20675 -> 0 bytes .../vis/dist/img/network/addNodeIcon.png | Bin 20998 -> 0 bytes .../vendor/vis/dist/img/network/backIcon.png | Bin 20802 -> 0 bytes .../vis/dist/img/network/connectIcon.png | Bin 20764 -> 0 bytes .../vendor/vis/dist/img/network/cross.png | Bin 18303 -> 0 bytes .../vendor/vis/dist/img/network/cross2.png | Bin 17768 -> 0 bytes .../vis/dist/img/network/deleteIcon.png | Bin 20981 -> 0 bytes .../vendor/vis/dist/img/network/downArrow.png | Bin 4460 -> 0 bytes .../vendor/vis/dist/img/network/editIcon.png | Bin 21016 -> 0 bytes .../vendor/vis/dist/img/network/leftArrow.png | Bin 4531 -> 0 bytes .../vendor/vis/dist/img/network/minus.png | Bin 4147 -> 0 bytes .../vendor/vis/dist/img/network/plus.png | Bin 4341 -> 0 bytes .../vis/dist/img/network/rightArrow.png | Bin 4514 -> 0 bytes .../vendor/vis/dist/img/network/upArrow.png | Bin 4461 -> 0 bytes .../vis/dist/img/network/zoomExtends.png | Bin 4464 -> 0 bytes .../vendor/vis/dist/img/timeline/delete.png | Bin 665 -> 0 bytes .../resources/webapp/vendor/vis/dist/vis.css | 30 +- .../main/resources/webapp/vendor/vis/vis.css | 810 + .../main/resources/webapp/vendor/vis/vis.js | 47300 ++++++++++++++++ .../resources/webapp/vendor/vis/vis.min.css | 1 + .../resources/webapp/vendor/vis/vis.min.js | 48 + 26 files changed, 48264 insertions(+), 9425 deletions(-) delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/d3/LICENSE.txt delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/d3/d3-3.3.4.js delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/acceptDeleteIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/addNodeIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/backIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/connectIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/cross.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/cross2.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/deleteIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/downArrow.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/editIcon.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/leftArrow.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/minus.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/plus.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/rightArrow.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/upArrow.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/zoomExtends.png delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/timeline/delete.png create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.css create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.js create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.css create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.js diff --git a/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css b/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css index 566b2e701b6b..3f205d0c1548 100644 --- a/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css +++ b/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css @@ -12,28 +12,28 @@ * limitations under the License. */ -.vis.timeline .item { +.vis-timeline .vis-item { padding: 0px; } -.vis.timeline .labelset .vlabel .inner { +.vis-timeline .vis-labelset .vis-label .vis-inner { padding: 0px; } -.vis.timeline .item.range { - height: 3px; +.vis-timeline .vis-item.vis-range { + height: 0.6em; } -.vis.timeline .red { +.vis-timeline .red { background-color: #F2DEDE; border-color: #F2AEAE; } -.vis.timeline .green { +.vis-timeline .green { background-color: #DFF0DB; border-color: #B8F0AA; } -.vis.timeline .blue { +.vis-timeline .blue { background-color: #E3E9FC; border-color: #B0C3FC; } -.vis.timeline .orange { +.vis-timeline .orange { background-color: #FFA500; border-color: #B0C3FC; } diff --git a/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js b/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js index 2bd22a1c13e2..84fbb9c2ae04 100644 --- a/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js +++ b/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js @@ -12,88 +12,90 @@ * limitations under the License. */ -d3.json('/ui/api/query/' + window.location.search.substring(1), function (query) { - d3.select('#queryId').text(query.queryId); - renderTimeline(query); -}); +$(document).ready(function () { + $.ajax({url: '/ui/api/query/' + window.location.search.substring(1)}) + .done(function(data) { + $('#queryId').text(data.queryId); + renderTimeline(data); -function renderTimeline(data) { - function getTasks(stage) { - return [].concat.apply( - stage.tasks, - stage.subStages.map(getTasks)); - } - tasks = getTasks(data.outputStage); - tasks = tasks.map(function(task) { - return { - taskId: task.taskStatus.taskId.substring(task.taskStatus.taskId.indexOf('.') + 1), - time: { - create: task.stats.createTime, - firstStart: task.stats.firstStartTime, - lastStart: task.stats.lastStartTime, - lastEnd: task.stats.lastEndTime, - end: task.stats.endTime, - }, - }; - }); + }); - var groups = new vis.DataSet(); - var items = new vis.DataSet(); - for (var i = 0; i < tasks.length; i++) { - var task = tasks[i]; - var stageId = task.taskId.substr(0, task.taskId.indexOf(".")); - var taskNumber = task.taskId.substr(task.taskId.indexOf(".") + 1); - if (taskNumber == 0) { - groups.add({ - id: stageId, - content: stageId, - sort: stageId, - subgroupOrder: 'sort', - }); + function renderTimeline(data) { + function getTasks(stage) { + return [].concat.apply( + stage.tasks, + stage.subStages.map(getTasks)); } - items.add({ - group: stageId, - start: task.time.create, - end: task.time.firstStart, - className: 'red', - subgroup: taskNumber, - sort: -taskNumber, - }); - items.add({ - group: stageId, - start: task.time.firstStart, - end: task.time.lastStart, - className: 'green', - subgroup: taskNumber, - sort: -taskNumber, - }); - items.add({ - group: stageId, - start: task.time.lastStart, - end: task.time.lastEnd, - className: 'blue', - subgroup: taskNumber, - sort: -taskNumber, - }); - items.add({ - group: stageId, - start: task.time.lastEnd, - end: task.time.end, - className: 'orange', - subgroup: taskNumber, - sort: -taskNumber, + + tasks = getTasks(data.outputStage); + tasks = tasks.map(function (task) { + return { + taskId: task.taskStatus.taskId.substring(task.taskStatus.taskId.indexOf('.') + 1), + time: { + create: task.stats.createTime, + firstStart: task.stats.firstStartTime, + lastStart: task.stats.lastStartTime, + lastEnd: task.stats.lastEndTime, + end: task.stats.endTime, + }, + }; }); - } - var options = { - stack: false, - groupOrder: 'sort', - padding: 0, - margin: 0, - clickToUse: true, - }; + var groups = new vis.DataSet(); + var items = new vis.DataSet(); + for (var i = 0; i < tasks.length; i++) { + var task = tasks[i]; + var stageId = task.taskId.substr(0, task.taskId.indexOf(".")); + var taskNumber = task.taskId.substr(task.taskId.indexOf(".") + 1); + if (taskNumber == 0) { + groups.add({ + id: stageId, + content: stageId, + sort: stageId, + subgroupOrder: 'sort', + }); + } + items.add({ + group: stageId, + start: task.time.create, + end: task.time.firstStart, + className: 'red', + subgroup: taskNumber, + sort: -taskNumber, + }); + items.add({ + group: stageId, + start: task.time.firstStart, + end: task.time.lastStart, + className: 'green', + subgroup: taskNumber, + sort: -taskNumber, + }); + items.add({ + group: stageId, + start: task.time.lastStart, + end: task.time.lastEnd, + className: 'blue', + subgroup: taskNumber, + sort: -taskNumber, + }); + items.add({ + group: stageId, + start: task.time.lastEnd, + end: task.time.end, + className: 'orange', + subgroup: taskNumber, + sort: -taskNumber, + }); + } - var container = document.getElementById('timeline'); + var options = { + stack: false, + groupOrder: 'sort', + margin: 0, + clickToUse: true, + }; - var timeline = new vis.Timeline(container, items, groups, options); -} + new vis.Timeline(document.getElementById('timeline'), items, groups, options); + } +}); diff --git a/core/trino-web-ui/src/main/resources/webapp/timeline.html b/core/trino-web-ui/src/main/resources/webapp/timeline.html index 06bdee41ce16..6c0319c251a0 100644 --- a/core/trino-web-ui/src/main/resources/webapp/timeline.html +++ b/core/trino-web-ui/src/main/resources/webapp/timeline.html @@ -9,9 +9,8 @@ - - - + + diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/d3/LICENSE.txt b/core/trino-web-ui/src/main/resources/webapp/vendor/d3/LICENSE.txt deleted file mode 100644 index 721bd22ece65..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/d3/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2010-2016 Mike Bostock -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the author nor the names of contributors may be used to - endorse or promote products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/d3/d3-3.3.4.js b/core/trino-web-ui/src/main/resources/webapp/vendor/d3/d3-3.3.4.js deleted file mode 100644 index a3e4b951e371..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/d3/d3-3.3.4.js +++ /dev/null @@ -1,9294 +0,0 @@ -!function() { - var d3 = { - version: "3.4.4" - }; - if (!Date.now) Date.now = function() { - return +new Date(); - }; - var d3_arraySlice = [].slice, d3_array = function(list) { - return d3_arraySlice.call(list); - }; - var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window; - try { - d3_array(d3_documentElement.childNodes)[0].nodeType; - } catch (e) { - d3_array = function(list) { - var i = list.length, array = new Array(i); - while (i--) array[i] = list[i]; - return array; - }; - } - try { - d3_document.createElement("div").style.setProperty("opacity", 0, ""); - } catch (error) { - var d3_element_prototype = d3_window.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty; - d3_element_prototype.setAttribute = function(name, value) { - d3_element_setAttribute.call(this, name, value + ""); - }; - d3_element_prototype.setAttributeNS = function(space, local, value) { - d3_element_setAttributeNS.call(this, space, local, value + ""); - }; - d3_style_prototype.setProperty = function(name, value, priority) { - d3_style_setProperty.call(this, name, value + "", priority); - }; - } - d3.ascending = d3_ascending; - function d3_ascending(a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - d3.descending = function(a, b) { - return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; - }; - d3.min = function(array, f) { - var i = -1, n = array.length, a, b; - if (arguments.length === 1) { - while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined; - while (++i < n) if ((b = array[i]) != null && a > b) a = b; - } else { - while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; - } - return a; - }; - d3.max = function(array, f) { - var i = -1, n = array.length, a, b; - if (arguments.length === 1) { - while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined; - while (++i < n) if ((b = array[i]) != null && b > a) a = b; - } else { - while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; - } - return a; - }; - d3.extent = function(array, f) { - var i = -1, n = array.length, a, b, c; - if (arguments.length === 1) { - while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined; - while (++i < n) if ((b = array[i]) != null) { - if (a > b) a = b; - if (c < b) c = b; - } - } else { - while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined; - while (++i < n) if ((b = f.call(array, array[i], i)) != null) { - if (a > b) a = b; - if (c < b) c = b; - } - } - return [ a, c ]; - }; - d3.sum = function(array, f) { - var s = 0, n = array.length, a, i = -1; - if (arguments.length === 1) { - while (++i < n) if (!isNaN(a = +array[i])) s += a; - } else { - while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a; - } - return s; - }; - function d3_number(x) { - return x != null && !isNaN(x); - } - d3.mean = function(array, f) { - var n = array.length, a, m = 0, i = -1, j = 0; - if (arguments.length === 1) { - while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j; - } else { - while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j; - } - return j ? m : undefined; - }; - d3.quantile = function(values, p) { - var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h; - return e ? v + e * (values[h] - v) : v; - }; - d3.median = function(array, f) { - if (arguments.length > 1) array = array.map(f); - array = array.filter(d3_number); - return array.length ? d3.quantile(array.sort(d3_ascending), .5) : undefined; - }; - function d3_bisector(compare) { - return { - left: function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid; - } - return lo; - }, - right: function(a, x, lo, hi) { - if (arguments.length < 3) lo = 0; - if (arguments.length < 4) hi = a.length; - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1; - } - return lo; - } - }; - } - var d3_bisect = d3_bisector(d3_ascending); - d3.bisectLeft = d3_bisect.left; - d3.bisect = d3.bisectRight = d3_bisect.right; - d3.bisector = function(f) { - return d3_bisector(f.length === 1 ? function(d, x) { - return d3_ascending(f(d), x); - } : f); - }; - d3.shuffle = function(array) { - var m = array.length, t, i; - while (m) { - i = Math.random() * m-- | 0; - t = array[m], array[m] = array[i], array[i] = t; - } - return array; - }; - d3.permute = function(array, indexes) { - var i = indexes.length, permutes = new Array(i); - while (i--) permutes[i] = array[indexes[i]]; - return permutes; - }; - d3.pairs = function(array) { - var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n); - while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ]; - return pairs; - }; - d3.zip = function() { - if (!(n = arguments.length)) return []; - for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) { - for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) { - zip[j] = arguments[j][i]; - } - } - return zips; - }; - function d3_zipLength(d) { - return d.length; - } - d3.transpose = function(matrix) { - return d3.zip.apply(d3, matrix); - }; - d3.keys = function(map) { - var keys = []; - for (var key in map) keys.push(key); - return keys; - }; - d3.values = function(map) { - var values = []; - for (var key in map) values.push(map[key]); - return values; - }; - d3.entries = function(map) { - var entries = []; - for (var key in map) entries.push({ - key: key, - value: map[key] - }); - return entries; - }; - d3.merge = function(arrays) { - var n = arrays.length, m, i = -1, j = 0, merged, array; - while (++i < n) j += arrays[i].length; - merged = new Array(j); - while (--n >= 0) { - array = arrays[n]; - m = array.length; - while (--m >= 0) { - merged[--j] = array[m]; - } - } - return merged; - }; - var abs = Math.abs; - d3.range = function(start, stop, step) { - if (arguments.length < 3) { - step = 1; - if (arguments.length < 2) { - stop = start; - start = 0; - } - } - if ((stop - start) / step === Infinity) throw new Error("infinite range"); - var range = [], k = d3_range_integerScale(abs(step)), i = -1, j; - start *= k, stop *= k, step *= k; - if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k); - return range; - }; - function d3_range_integerScale(x) { - var k = 1; - while (x * k % 1) k *= 10; - return k; - } - function d3_class(ctor, properties) { - try { - for (var key in properties) { - Object.defineProperty(ctor.prototype, key, { - value: properties[key], - enumerable: false - }); - } - } catch (e) { - ctor.prototype = properties; - } - } - d3.map = function(object) { - var map = new d3_Map(); - if (object instanceof d3_Map) object.forEach(function(key, value) { - map.set(key, value); - }); else for (var key in object) map.set(key, object[key]); - return map; - }; - function d3_Map() {} - d3_class(d3_Map, { - has: d3_map_has, - get: function(key) { - return this[d3_map_prefix + key]; - }, - set: function(key, value) { - return this[d3_map_prefix + key] = value; - }, - remove: d3_map_remove, - keys: d3_map_keys, - values: function() { - var values = []; - this.forEach(function(key, value) { - values.push(value); - }); - return values; - }, - entries: function() { - var entries = []; - this.forEach(function(key, value) { - entries.push({ - key: key, - value: value - }); - }); - return entries; - }, - size: d3_map_size, - empty: d3_map_empty, - forEach: function(f) { - for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) f.call(this, key.substring(1), this[key]); - } - }); - var d3_map_prefix = "\x00", d3_map_prefixCode = d3_map_prefix.charCodeAt(0); - function d3_map_has(key) { - return d3_map_prefix + key in this; - } - function d3_map_remove(key) { - key = d3_map_prefix + key; - return key in this && delete this[key]; - } - function d3_map_keys() { - var keys = []; - this.forEach(function(key) { - keys.push(key); - }); - return keys; - } - function d3_map_size() { - var size = 0; - for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) ++size; - return size; - } - function d3_map_empty() { - for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) return false; - return true; - } - d3.nest = function() { - var nest = {}, keys = [], sortKeys = [], sortValues, rollup; - function map(mapType, array, depth) { - if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array; - var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values; - while (++i < n) { - if (values = valuesByKey.get(keyValue = key(object = array[i]))) { - values.push(object); - } else { - valuesByKey.set(keyValue, [ object ]); - } - } - if (mapType) { - object = mapType(); - setter = function(keyValue, values) { - object.set(keyValue, map(mapType, values, depth)); - }; - } else { - object = {}; - setter = function(keyValue, values) { - object[keyValue] = map(mapType, values, depth); - }; - } - valuesByKey.forEach(setter); - return object; - } - function entries(map, depth) { - if (depth >= keys.length) return map; - var array = [], sortKey = sortKeys[depth++]; - map.forEach(function(key, keyMap) { - array.push({ - key: key, - values: entries(keyMap, depth) - }); - }); - return sortKey ? array.sort(function(a, b) { - return sortKey(a.key, b.key); - }) : array; - } - nest.map = function(array, mapType) { - return map(mapType, array, 0); - }; - nest.entries = function(array) { - return entries(map(d3.map, array, 0), 0); - }; - nest.key = function(d) { - keys.push(d); - return nest; - }; - nest.sortKeys = function(order) { - sortKeys[keys.length - 1] = order; - return nest; - }; - nest.sortValues = function(order) { - sortValues = order; - return nest; - }; - nest.rollup = function(f) { - rollup = f; - return nest; - }; - return nest; - }; - d3.set = function(array) { - var set = new d3_Set(); - if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]); - return set; - }; - function d3_Set() {} - d3_class(d3_Set, { - has: d3_map_has, - add: function(value) { - this[d3_map_prefix + value] = true; - return value; - }, - remove: function(value) { - value = d3_map_prefix + value; - return value in this && delete this[value]; - }, - values: d3_map_keys, - size: d3_map_size, - empty: d3_map_empty, - forEach: function(f) { - for (var value in this) if (value.charCodeAt(0) === d3_map_prefixCode) f.call(this, value.substring(1)); - } - }); - d3.behavior = {}; - d3.rebind = function(target, source) { - var i = 1, n = arguments.length, method; - while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]); - return target; - }; - function d3_rebind(target, source, method) { - return function() { - var value = method.apply(source, arguments); - return value === source ? target : value; - }; - } - function d3_vendorSymbol(object, name) { - if (name in object) return name; - name = name.charAt(0).toUpperCase() + name.substring(1); - for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) { - var prefixName = d3_vendorPrefixes[i] + name; - if (prefixName in object) return prefixName; - } - } - var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ]; - function d3_noop() {} - d3.dispatch = function() { - var dispatch = new d3_dispatch(), i = -1, n = arguments.length; - while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); - return dispatch; - }; - function d3_dispatch() {} - d3_dispatch.prototype.on = function(type, listener) { - var i = type.indexOf("."), name = ""; - if (i >= 0) { - name = type.substring(i + 1); - type = type.substring(0, i); - } - if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener); - if (arguments.length === 2) { - if (listener == null) for (type in this) { - if (this.hasOwnProperty(type)) this[type].on(name, null); - } - return this; - } - }; - function d3_dispatch_event(dispatch) { - var listeners = [], listenerByName = new d3_Map(); - function event() { - var z = listeners, i = -1, n = z.length, l; - while (++i < n) if (l = z[i].on) l.apply(this, arguments); - return dispatch; - } - event.on = function(name, listener) { - var l = listenerByName.get(name), i; - if (arguments.length < 2) return l && l.on; - if (l) { - l.on = null; - listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1)); - listenerByName.remove(name); - } - if (listener) listeners.push(listenerByName.set(name, { - on: listener - })); - return dispatch; - }; - return event; - } - d3.event = null; - function d3_eventPreventDefault() { - d3.event.preventDefault(); - } - function d3_eventSource() { - var e = d3.event, s; - while (s = e.sourceEvent) e = s; - return e; - } - function d3_eventDispatch(target) { - var dispatch = new d3_dispatch(), i = 0, n = arguments.length; - while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch); - dispatch.of = function(thiz, argumentz) { - return function(e1) { - try { - var e0 = e1.sourceEvent = d3.event; - e1.target = target; - d3.event = e1; - dispatch[e1.type].apply(thiz, argumentz); - } finally { - d3.event = e0; - } - }; - }; - return dispatch; - } - d3.requote = function(s) { - return s.replace(d3_requote_re, "\\$&"); - }; - var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; - var d3_subclass = {}.__proto__ ? function(object, prototype) { - object.__proto__ = prototype; - } : function(object, prototype) { - for (var property in prototype) object[property] = prototype[property]; - }; - function d3_selection(groups) { - d3_subclass(groups, d3_selectionPrototype); - return groups; - } - var d3_select = function(s, n) { - return n.querySelector(s); - }, d3_selectAll = function(s, n) { - return n.querySelectorAll(s); - }, d3_selectMatcher = d3_documentElement[d3_vendorSymbol(d3_documentElement, "matchesSelector")], d3_selectMatches = function(n, s) { - return d3_selectMatcher.call(n, s); - }; - if (typeof Sizzle === "function") { - d3_select = function(s, n) { - return Sizzle(s, n)[0] || null; - }; - d3_selectAll = Sizzle; - d3_selectMatches = Sizzle.matchesSelector; - } - d3.selection = function() { - return d3_selectionRoot; - }; - var d3_selectionPrototype = d3.selection.prototype = []; - d3_selectionPrototype.select = function(selector) { - var subgroups = [], subgroup, subnode, group, node; - selector = d3_selection_selector(selector); - for (var j = -1, m = this.length; ++j < m; ) { - subgroups.push(subgroup = []); - subgroup.parentNode = (group = this[j]).parentNode; - for (var i = -1, n = group.length; ++i < n; ) { - if (node = group[i]) { - subgroup.push(subnode = selector.call(node, node.__data__, i, j)); - if (subnode && "__data__" in node) subnode.__data__ = node.__data__; - } else { - subgroup.push(null); - } - } - } - return d3_selection(subgroups); - }; - function d3_selection_selector(selector) { - return typeof selector === "function" ? selector : function() { - return d3_select(selector, this); - }; - } - d3_selectionPrototype.selectAll = function(selector) { - var subgroups = [], subgroup, node; - selector = d3_selection_selectorAll(selector); - for (var j = -1, m = this.length; ++j < m; ) { - for (var group = this[j], i = -1, n = group.length; ++i < n; ) { - if (node = group[i]) { - subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j))); - subgroup.parentNode = node; - } - } - } - return d3_selection(subgroups); - }; - function d3_selection_selectorAll(selector) { - return typeof selector === "function" ? selector : function() { - return d3_selectAll(selector, this); - }; - } - var d3_nsPrefix = { - svg: "http://www.w3.org/2000/svg", - xhtml: "http://www.w3.org/1999/xhtml", - xlink: "http://www.w3.org/1999/xlink", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/" - }; - d3.ns = { - prefix: d3_nsPrefix, - qualify: function(name) { - var i = name.indexOf(":"), prefix = name; - if (i >= 0) { - prefix = name.substring(0, i); - name = name.substring(i + 1); - } - return d3_nsPrefix.hasOwnProperty(prefix) ? { - space: d3_nsPrefix[prefix], - local: name - } : name; - } - }; - d3_selectionPrototype.attr = function(name, value) { - if (arguments.length < 2) { - if (typeof name === "string") { - var node = this.node(); - name = d3.ns.qualify(name); - return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name); - } - for (value in name) this.each(d3_selection_attr(value, name[value])); - return this; - } - return this.each(d3_selection_attr(name, value)); - }; - function d3_selection_attr(name, value) { - name = d3.ns.qualify(name); - function attrNull() { - this.removeAttribute(name); - } - function attrNullNS() { - this.removeAttributeNS(name.space, name.local); - } - function attrConstant() { - this.setAttribute(name, value); - } - function attrConstantNS() { - this.setAttributeNS(name.space, name.local, value); - } - function attrFunction() { - var x = value.apply(this, arguments); - if (x == null) this.removeAttribute(name); else this.setAttribute(name, x); - } - function attrFunctionNS() { - var x = value.apply(this, arguments); - if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x); - } - return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant; - } - function d3_collapse(s) { - return s.trim().replace(/\s+/g, " "); - } - d3_selectionPrototype.classed = function(name, value) { - if (arguments.length < 2) { - if (typeof name === "string") { - var node = this.node(), n = (name = d3_selection_classes(name)).length, i = -1; - if (value = node.classList) { - while (++i < n) if (!value.contains(name[i])) return false; - } else { - value = node.getAttribute("class"); - while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false; - } - return true; - } - for (value in name) this.each(d3_selection_classed(value, name[value])); - return this; - } - return this.each(d3_selection_classed(name, value)); - }; - function d3_selection_classedRe(name) { - return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g"); - } - function d3_selection_classes(name) { - return name.trim().split(/^|\s+/); - } - function d3_selection_classed(name, value) { - name = d3_selection_classes(name).map(d3_selection_classedName); - var n = name.length; - function classedConstant() { - var i = -1; - while (++i < n) name[i](this, value); - } - function classedFunction() { - var i = -1, x = value.apply(this, arguments); - while (++i < n) name[i](this, x); - } - return typeof value === "function" ? classedFunction : classedConstant; - } - function d3_selection_classedName(name) { - var re = d3_selection_classedRe(name); - return function(node, value) { - if (c = node.classList) return value ? c.add(name) : c.remove(name); - var c = node.getAttribute("class") || ""; - if (value) { - re.lastIndex = 0; - if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); - } else { - node.setAttribute("class", d3_collapse(c.replace(re, " "))); - } - }; - } - d3_selectionPrototype.style = function(name, value, priority) { - var n = arguments.length; - if (n < 3) { - if (typeof name !== "string") { - if (n < 2) value = ""; - for (priority in name) this.each(d3_selection_style(priority, name[priority], value)); - return this; - } - if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name); - priority = ""; - } - return this.each(d3_selection_style(name, value, priority)); - }; - function d3_selection_style(name, value, priority) { - function styleNull() { - this.style.removeProperty(name); - } - function styleConstant() { - this.style.setProperty(name, value, priority); - } - function styleFunction() { - var x = value.apply(this, arguments); - if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority); - } - return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant; - } - d3_selectionPrototype.property = function(name, value) { - if (arguments.length < 2) { - if (typeof name === "string") return this.node()[name]; - for (value in name) this.each(d3_selection_property(value, name[value])); - return this; - } - return this.each(d3_selection_property(name, value)); - }; - function d3_selection_property(name, value) { - function propertyNull() { - delete this[name]; - } - function propertyConstant() { - this[name] = value; - } - function propertyFunction() { - var x = value.apply(this, arguments); - if (x == null) delete this[name]; else this[name] = x; - } - return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant; - } - d3_selectionPrototype.text = function(value) { - return arguments.length ? this.each(typeof value === "function" ? function() { - var v = value.apply(this, arguments); - this.textContent = v == null ? "" : v; - } : value == null ? function() { - this.textContent = ""; - } : function() { - this.textContent = value; - }) : this.node().textContent; - }; - d3_selectionPrototype.html = function(value) { - return arguments.length ? this.each(typeof value === "function" ? function() { - var v = value.apply(this, arguments); - this.innerHTML = v == null ? "" : v; - } : value == null ? function() { - this.innerHTML = ""; - } : function() { - this.innerHTML = value; - }) : this.node().innerHTML; - }; - d3_selectionPrototype.append = function(name) { - name = d3_selection_creator(name); - return this.select(function() { - return this.appendChild(name.apply(this, arguments)); - }); - }; - function d3_selection_creator(name) { - return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() { - return this.ownerDocument.createElementNS(name.space, name.local); - } : function() { - return this.ownerDocument.createElementNS(this.namespaceURI, name); - }; - } - d3_selectionPrototype.insert = function(name, before) { - name = d3_selection_creator(name); - before = d3_selection_selector(before); - return this.select(function() { - return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null); - }); - }; - d3_selectionPrototype.remove = function() { - return this.each(function() { - var parent = this.parentNode; - if (parent) parent.removeChild(this); - }); - }; - d3_selectionPrototype.data = function(value, key) { - var i = -1, n = this.length, group, node; - if (!arguments.length) { - value = new Array(n = (group = this[0]).length); - while (++i < n) { - if (node = group[i]) { - value[i] = node.__data__; - } - } - return value; - } - function bind(group, groupData) { - var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData; - if (key) { - var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue; - for (i = -1; ++i < n; ) { - keyValue = key.call(node = group[i], node.__data__, i); - if (nodeByKeyValue.has(keyValue)) { - exitNodes[i] = node; - } else { - nodeByKeyValue.set(keyValue, node); - } - keyValues.push(keyValue); - } - for (i = -1; ++i < m; ) { - keyValue = key.call(groupData, nodeData = groupData[i], i); - if (node = nodeByKeyValue.get(keyValue)) { - updateNodes[i] = node; - node.__data__ = nodeData; - } else if (!dataByKeyValue.has(keyValue)) { - enterNodes[i] = d3_selection_dataNode(nodeData); - } - dataByKeyValue.set(keyValue, nodeData); - nodeByKeyValue.remove(keyValue); - } - for (i = -1; ++i < n; ) { - if (nodeByKeyValue.has(keyValues[i])) { - exitNodes[i] = group[i]; - } - } - } else { - for (i = -1; ++i < n0; ) { - node = group[i]; - nodeData = groupData[i]; - if (node) { - node.__data__ = nodeData; - updateNodes[i] = node; - } else { - enterNodes[i] = d3_selection_dataNode(nodeData); - } - } - for (;i < m; ++i) { - enterNodes[i] = d3_selection_dataNode(groupData[i]); - } - for (;i < n; ++i) { - exitNodes[i] = group[i]; - } - } - enterNodes.update = updateNodes; - enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode; - enter.push(enterNodes); - update.push(updateNodes); - exit.push(exitNodes); - } - var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]); - if (typeof value === "function") { - while (++i < n) { - bind(group = this[i], value.call(group, group.parentNode.__data__, i)); - } - } else { - while (++i < n) { - bind(group = this[i], value); - } - } - update.enter = function() { - return enter; - }; - update.exit = function() { - return exit; - }; - return update; - }; - function d3_selection_dataNode(data) { - return { - __data__: data - }; - } - d3_selectionPrototype.datum = function(value) { - return arguments.length ? this.property("__data__", value) : this.property("__data__"); - }; - d3_selectionPrototype.filter = function(filter) { - var subgroups = [], subgroup, group, node; - if (typeof filter !== "function") filter = d3_selection_filter(filter); - for (var j = 0, m = this.length; j < m; j++) { - subgroups.push(subgroup = []); - subgroup.parentNode = (group = this[j]).parentNode; - for (var i = 0, n = group.length; i < n; i++) { - if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { - subgroup.push(node); - } - } - } - return d3_selection(subgroups); - }; - function d3_selection_filter(selector) { - return function() { - return d3_selectMatches(this, selector); - }; - } - d3_selectionPrototype.order = function() { - for (var j = -1, m = this.length; ++j < m; ) { - for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) { - if (node = group[i]) { - if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); - next = node; - } - } - } - return this; - }; - d3_selectionPrototype.sort = function(comparator) { - comparator = d3_selection_sortComparator.apply(this, arguments); - for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator); - return this.order(); - }; - function d3_selection_sortComparator(comparator) { - if (!arguments.length) comparator = d3_ascending; - return function(a, b) { - return a && b ? comparator(a.__data__, b.__data__) : !a - !b; - }; - } - d3_selectionPrototype.each = function(callback) { - return d3_selection_each(this, function(node, i, j) { - callback.call(node, node.__data__, i, j); - }); - }; - function d3_selection_each(groups, callback) { - for (var j = 0, m = groups.length; j < m; j++) { - for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) { - if (node = group[i]) callback(node, i, j); - } - } - return groups; - } - d3_selectionPrototype.call = function(callback) { - var args = d3_array(arguments); - callback.apply(args[0] = this, args); - return this; - }; - d3_selectionPrototype.empty = function() { - return !this.node(); - }; - d3_selectionPrototype.node = function() { - for (var j = 0, m = this.length; j < m; j++) { - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - var node = group[i]; - if (node) return node; - } - } - return null; - }; - d3_selectionPrototype.size = function() { - var n = 0; - this.each(function() { - ++n; - }); - return n; - }; - function d3_selection_enter(selection) { - d3_subclass(selection, d3_selection_enterPrototype); - return selection; - } - var d3_selection_enterPrototype = []; - d3.selection.enter = d3_selection_enter; - d3.selection.enter.prototype = d3_selection_enterPrototype; - d3_selection_enterPrototype.append = d3_selectionPrototype.append; - d3_selection_enterPrototype.empty = d3_selectionPrototype.empty; - d3_selection_enterPrototype.node = d3_selectionPrototype.node; - d3_selection_enterPrototype.call = d3_selectionPrototype.call; - d3_selection_enterPrototype.size = d3_selectionPrototype.size; - d3_selection_enterPrototype.select = function(selector) { - var subgroups = [], subgroup, subnode, upgroup, group, node; - for (var j = -1, m = this.length; ++j < m; ) { - upgroup = (group = this[j]).update; - subgroups.push(subgroup = []); - subgroup.parentNode = group.parentNode; - for (var i = -1, n = group.length; ++i < n; ) { - if (node = group[i]) { - subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j)); - subnode.__data__ = node.__data__; - } else { - subgroup.push(null); - } - } - } - return d3_selection(subgroups); - }; - d3_selection_enterPrototype.insert = function(name, before) { - if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); - return d3_selectionPrototype.insert.call(this, name, before); - }; - function d3_selection_enterInsertBefore(enter) { - var i0, j0; - return function(d, i, j) { - var group = enter[j].update, n = group.length, node; - if (j != j0) j0 = j, i0 = 0; - if (i >= i0) i0 = i + 1; - while (!(node = group[i0]) && ++i0 < n) ; - return node; - }; - } - d3_selectionPrototype.transition = function() { - var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || { - time: Date.now(), - ease: d3_ease_cubicInOut, - delay: 0, - duration: 250 - }; - for (var j = -1, m = this.length; ++j < m; ) { - subgroups.push(subgroup = []); - for (var group = this[j], i = -1, n = group.length; ++i < n; ) { - if (node = group[i]) d3_transitionNode(node, i, id, transition); - subgroup.push(node); - } - } - return d3_transition(subgroups, id); - }; - d3_selectionPrototype.interrupt = function() { - return this.each(d3_selection_interrupt); - }; - function d3_selection_interrupt() { - var lock = this.__transition__; - if (lock) ++lock.active; - } - d3.select = function(node) { - var group = [ typeof node === "string" ? d3_select(node, d3_document) : node ]; - group.parentNode = d3_documentElement; - return d3_selection([ group ]); - }; - d3.selectAll = function(nodes) { - var group = d3_array(typeof nodes === "string" ? d3_selectAll(nodes, d3_document) : nodes); - group.parentNode = d3_documentElement; - return d3_selection([ group ]); - }; - var d3_selectionRoot = d3.select(d3_documentElement); - d3_selectionPrototype.on = function(type, listener, capture) { - var n = arguments.length; - if (n < 3) { - if (typeof type !== "string") { - if (n < 2) listener = false; - for (capture in type) this.each(d3_selection_on(capture, type[capture], listener)); - return this; - } - if (n < 2) return (n = this.node()["__on" + type]) && n._; - capture = false; - } - return this.each(d3_selection_on(type, listener, capture)); - }; - function d3_selection_on(type, listener, capture) { - var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener; - if (i > 0) type = type.substring(0, i); - var filter = d3_selection_onFilters.get(type); - if (filter) type = filter, wrap = d3_selection_onFilter; - function onRemove() { - var l = this[name]; - if (l) { - this.removeEventListener(type, l, l.$); - delete this[name]; - } - } - function onAdd() { - var l = wrap(listener, d3_array(arguments)); - onRemove.call(this); - this.addEventListener(type, this[name] = l, l.$ = capture); - l._ = listener; - } - function removeAll() { - var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; - for (var name in this) { - if (match = name.match(re)) { - var l = this[name]; - this.removeEventListener(match[1], l, l.$); - delete this[name]; - } - } - } - return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; - } - var d3_selection_onFilters = d3.map({ - mouseenter: "mouseover", - mouseleave: "mouseout" - }); - d3_selection_onFilters.forEach(function(k) { - if ("on" + k in d3_document) d3_selection_onFilters.remove(k); - }); - function d3_selection_onListener(listener, argumentz) { - return function(e) { - var o = d3.event; - d3.event = e; - argumentz[0] = this.__data__; - try { - listener.apply(this, argumentz); - } finally { - d3.event = o; - } - }; - } - function d3_selection_onFilter(listener, argumentz) { - var l = d3_selection_onListener(listener, argumentz); - return function(e) { - var target = this, related = e.relatedTarget; - if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) { - l.call(target, e); - } - }; - } - var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0; - function d3_event_dragSuppress() { - var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault); - if (d3_event_dragSelect) { - var style = d3_documentElement.style, select = style[d3_event_dragSelect]; - style[d3_event_dragSelect] = "none"; - } - return function(suppressClick) { - w.on(name, null); - if (d3_event_dragSelect) style[d3_event_dragSelect] = select; - if (suppressClick) { - function off() { - w.on(click, null); - } - w.on(click, function() { - d3_eventPreventDefault(); - off(); - }, true); - setTimeout(off, 0); - } - }; - } - d3.mouse = function(container) { - return d3_mousePoint(container, d3_eventSource()); - }; - function d3_mousePoint(container, e) { - if (e.changedTouches) e = e.changedTouches[0]; - var svg = container.ownerSVGElement || container; - if (svg.createSVGPoint) { - var point = svg.createSVGPoint(); - point.x = e.clientX, point.y = e.clientY; - point = point.matrixTransform(container.getScreenCTM().inverse()); - return [ point.x, point.y ]; - } - var rect = container.getBoundingClientRect(); - return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ]; - } - d3.touches = function(container, touches) { - if (arguments.length < 2) touches = d3_eventSource().touches; - return touches ? d3_array(touches).map(function(touch) { - var point = d3_mousePoint(container, touch); - point.identifier = touch.identifier; - return point; - }) : []; - }; - d3.behavior.drag = function() { - var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_behavior_dragMouseSubject, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_behavior_dragTouchSubject, "touchmove", "touchend"); - function drag() { - this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); - } - function dragstart(id, position, subject, move, end) { - return function() { - var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject()).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(), position0 = position(parent, dragId); - if (origin) { - dragOffset = origin.apply(that, arguments); - dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ]; - } else { - dragOffset = [ 0, 0 ]; - } - dispatch({ - type: "dragstart" - }); - function moved() { - var position1 = position(parent, dragId), dx, dy; - if (!position1) return; - dx = position1[0] - position0[0]; - dy = position1[1] - position0[1]; - dragged |= dx | dy; - position0 = position1; - dispatch({ - type: "drag", - x: position1[0] + dragOffset[0], - y: position1[1] + dragOffset[1], - dx: dx, - dy: dy - }); - } - function ended() { - if (!position(parent, dragId)) return; - dragSubject.on(move + dragName, null).on(end + dragName, null); - dragRestore(dragged && d3.event.target === target); - dispatch({ - type: "dragend" - }); - } - }; - } - drag.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return drag; - }; - return d3.rebind(drag, event, "on"); - }; - function d3_behavior_dragTouchId() { - return d3.event.changedTouches[0].identifier; - } - function d3_behavior_dragTouchSubject() { - return d3.event.target; - } - function d3_behavior_dragMouseSubject() { - return d3_window; - } - var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π; - function d3_sgn(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - } - function d3_cross2d(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); - } - function d3_acos(x) { - return x > 1 ? 0 : x < -1 ? π : Math.acos(x); - } - function d3_asin(x) { - return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x); - } - function d3_sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; - } - function d3_cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; - } - function d3_tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); - } - function d3_haversin(x) { - return (x = Math.sin(x / 2)) * x; - } - var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4; - d3.interpolateZoom = function(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2]; - var dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1), dr = r1 - r0, S = (dr || Math.log(w1 / w0)) / ρ; - function interpolate(t) { - var s = t * S; - if (dr) { - var coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0)); - return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ]; - } - return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * s) ]; - } - interpolate.duration = S * 1e3; - return interpolate; - }; - d3.behavior.zoom = function() { - var view = { - x: 0, - y: 0, - k: 1 - }, translate0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1; - function zoom(g) { - g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted); - } - zoom.event = function(g) { - g.each(function() { - var dispatch = event.of(this, arguments), view1 = view; - if (d3_transitionInheritId) { - d3.select(this).transition().each("start.zoom", function() { - view = this.__chart__ || { - x: 0, - y: 0, - k: 1 - }; - zoomstarted(dispatch); - }).tween("zoom:zoom", function() { - var dx = size[0], dy = size[1], cx = dx / 2, cy = dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]); - return function(t) { - var l = i(t), k = dx / l[2]; - this.__chart__ = view = { - x: cx - l[0] * k, - y: cy - l[1] * k, - k: k - }; - zoomed(dispatch); - }; - }).each("end.zoom", function() { - zoomended(dispatch); - }); - } else { - this.__chart__ = view; - zoomstarted(dispatch); - zoomed(dispatch); - zoomended(dispatch); - } - }); - }; - zoom.translate = function(_) { - if (!arguments.length) return [ view.x, view.y ]; - view = { - x: +_[0], - y: +_[1], - k: view.k - }; - rescale(); - return zoom; - }; - zoom.scale = function(_) { - if (!arguments.length) return view.k; - view = { - x: view.x, - y: view.y, - k: +_ - }; - rescale(); - return zoom; - }; - zoom.scaleExtent = function(_) { - if (!arguments.length) return scaleExtent; - scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ]; - return zoom; - }; - zoom.center = function(_) { - if (!arguments.length) return center; - center = _ && [ +_[0], +_[1] ]; - return zoom; - }; - zoom.size = function(_) { - if (!arguments.length) return size; - size = _ && [ +_[0], +_[1] ]; - return zoom; - }; - zoom.x = function(z) { - if (!arguments.length) return x1; - x1 = z; - x0 = z.copy(); - view = { - x: 0, - y: 0, - k: 1 - }; - return zoom; - }; - zoom.y = function(z) { - if (!arguments.length) return y1; - y1 = z; - y0 = z.copy(); - view = { - x: 0, - y: 0, - k: 1 - }; - return zoom; - }; - function location(p) { - return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ]; - } - function point(l) { - return [ l[0] * view.k + view.x, l[1] * view.k + view.y ]; - } - function scaleTo(s) { - view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s)); - } - function translateTo(p, l) { - l = point(l); - view.x += p[0] - l[0]; - view.y += p[1] - l[1]; - } - function rescale() { - if (x1) x1.domain(x0.range().map(function(x) { - return (x - view.x) / view.k; - }).map(x0.invert)); - if (y1) y1.domain(y0.range().map(function(y) { - return (y - view.y) / view.k; - }).map(y0.invert)); - } - function zoomstarted(dispatch) { - dispatch({ - type: "zoomstart" - }); - } - function zoomed(dispatch) { - rescale(); - dispatch({ - type: "zoom", - scale: view.k, - translate: [ view.x, view.y ] - }); - } - function zoomended(dispatch) { - dispatch({ - type: "zoomend" - }); - } - function mousedowned() { - var that = this, target = d3.event.target, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(); - d3_selection_interrupt.call(that); - zoomstarted(dispatch); - function moved() { - dragged = 1; - translateTo(d3.mouse(that), location0); - zoomed(dispatch); - } - function ended() { - subject.on(mousemove, d3_window === that ? mousewheelreset : null).on(mouseup, null); - dragRestore(dragged && d3.event.target === target); - zoomended(dispatch); - } - } - function touchstarted() { - var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, target = d3.select(d3.event.target).on(touchmove, moved).on(touchend, ended), subject = d3.select(that).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress(); - d3_selection_interrupt.call(that); - started(); - zoomstarted(dispatch); - function relocate() { - var touches = d3.touches(that); - scale0 = view.k; - touches.forEach(function(t) { - if (t.identifier in locations0) locations0[t.identifier] = location(t); - }); - return touches; - } - function started() { - var changed = d3.event.changedTouches; - for (var i = 0, n = changed.length; i < n; ++i) { - locations0[changed[i].identifier] = null; - } - var touches = relocate(), now = Date.now(); - if (touches.length === 1) { - if (now - touchtime < 500) { - var p = touches[0], l = locations0[p.identifier]; - scaleTo(view.k * 2); - translateTo(p, l); - d3_eventPreventDefault(); - zoomed(dispatch); - } - touchtime = now; - } else if (touches.length > 1) { - var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1]; - distance0 = dx * dx + dy * dy; - } - } - function moved() { - var touches = d3.touches(that), p0, l0, p1, l1; - for (var i = 0, n = touches.length; i < n; ++i, l1 = null) { - p1 = touches[i]; - if (l1 = locations0[p1.identifier]) { - if (l0) break; - p0 = p1, l0 = l1; - } - } - if (l1) { - var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); - p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ]; - l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ]; - scaleTo(scale1 * scale0); - } - touchtime = null; - translateTo(p0, l0); - zoomed(dispatch); - } - function ended() { - if (d3.event.touches.length) { - var changed = d3.event.changedTouches; - for (var i = 0, n = changed.length; i < n; ++i) { - delete locations0[changed[i].identifier]; - } - for (var identifier in locations0) { - return void relocate(); - } - } - target.on(zoomName, null); - subject.on(mousedown, mousedowned).on(touchstart, touchstarted); - dragRestore(); - zoomended(dispatch); - } - } - function mousewheeled() { - var dispatch = event.of(this, arguments); - if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), - zoomstarted(dispatch); - mousewheelTimer = setTimeout(function() { - mousewheelTimer = null; - zoomended(dispatch); - }, 50); - d3_eventPreventDefault(); - var point = center || d3.mouse(this); - if (!translate0) translate0 = location(point); - scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k); - translateTo(point, translate0); - zoomed(dispatch); - } - function mousewheelreset() { - translate0 = null; - } - function dblclicked() { - var dispatch = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2; - zoomstarted(dispatch); - scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1)); - translateTo(p, l); - zoomed(dispatch); - zoomended(dispatch); - } - return d3.rebind(zoom, event, "on"); - }; - var d3_behavior_zoomInfinity = [ 0, Infinity ]; - var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { - return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); - }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { - return d3.event.wheelDelta; - }, "mousewheel") : (d3_behavior_zoomDelta = function() { - return -d3.event.detail; - }, "MozMousePixelScroll"); - function d3_Color() {} - d3_Color.prototype.toString = function() { - return this.rgb() + ""; - }; - d3.hsl = function(h, s, l) { - return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l); - }; - function d3_hsl(h, s, l) { - return new d3_Hsl(h, s, l); - } - function d3_Hsl(h, s, l) { - this.h = h; - this.s = s; - this.l = l; - } - var d3_hslPrototype = d3_Hsl.prototype = new d3_Color(); - d3_hslPrototype.brighter = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - return d3_hsl(this.h, this.s, this.l / k); - }; - d3_hslPrototype.darker = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - return d3_hsl(this.h, this.s, k * this.l); - }; - d3_hslPrototype.rgb = function() { - return d3_hsl_rgb(this.h, this.s, this.l); - }; - function d3_hsl_rgb(h, s, l) { - var m1, m2; - h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h; - s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s; - l = l < 0 ? 0 : l > 1 ? 1 : l; - m2 = l <= .5 ? l * (1 + s) : l + s - l * s; - m1 = 2 * l - m2; - function v(h) { - if (h > 360) h -= 360; else if (h < 0) h += 360; - if (h < 60) return m1 + (m2 - m1) * h / 60; - if (h < 180) return m2; - if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60; - return m1; - } - function vv(h) { - return Math.round(v(h) * 255); - } - return d3_rgb(vv(h + 120), vv(h), vv(h - 120)); - } - d3.hcl = function(h, c, l) { - return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l); - }; - function d3_hcl(h, c, l) { - return new d3_Hcl(h, c, l); - } - function d3_Hcl(h, c, l) { - this.h = h; - this.c = c; - this.l = l; - } - var d3_hclPrototype = d3_Hcl.prototype = new d3_Color(); - d3_hclPrototype.brighter = function(k) { - return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); - }; - d3_hclPrototype.darker = function(k) { - return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1))); - }; - d3_hclPrototype.rgb = function() { - return d3_hcl_lab(this.h, this.c, this.l).rgb(); - }; - function d3_hcl_lab(h, c, l) { - if (isNaN(h)) h = 0; - if (isNaN(c)) c = 0; - return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); - } - d3.lab = function(l, a, b) { - return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b); - }; - function d3_lab(l, a, b) { - return new d3_Lab(l, a, b); - } - function d3_Lab(l, a, b) { - this.l = l; - this.a = a; - this.b = b; - } - var d3_lab_K = 18; - var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883; - var d3_labPrototype = d3_Lab.prototype = new d3_Color(); - d3_labPrototype.brighter = function(k) { - return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); - }; - d3_labPrototype.darker = function(k) { - return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); - }; - d3_labPrototype.rgb = function() { - return d3_lab_rgb(this.l, this.a, this.b); - }; - function d3_lab_rgb(l, a, b) { - var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200; - x = d3_lab_xyz(x) * d3_lab_X; - y = d3_lab_xyz(y) * d3_lab_Y; - z = d3_lab_xyz(z) * d3_lab_Z; - return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z)); - } - function d3_lab_hcl(l, a, b) { - return l > 0 ? d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : d3_hcl(NaN, NaN, l); - } - function d3_lab_xyz(x) { - return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037; - } - function d3_xyz_lab(x) { - return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; - } - function d3_xyz_rgb(r) { - return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055)); - } - d3.rgb = function(r, g, b) { - return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b); - }; - function d3_rgbNumber(value) { - return d3_rgb(value >> 16, value >> 8 & 255, value & 255); - } - function d3_rgbString(value) { - return d3_rgbNumber(value) + ""; - } - function d3_rgb(r, g, b) { - return new d3_Rgb(r, g, b); - } - function d3_Rgb(r, g, b) { - this.r = r; - this.g = g; - this.b = b; - } - var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color(); - d3_rgbPrototype.brighter = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - var r = this.r, g = this.g, b = this.b, i = 30; - if (!r && !g && !b) return d3_rgb(i, i, i); - if (r && r < i) r = i; - if (g && g < i) g = i; - if (b && b < i) b = i; - return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k))); - }; - d3_rgbPrototype.darker = function(k) { - k = Math.pow(.7, arguments.length ? k : 1); - return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b)); - }; - d3_rgbPrototype.hsl = function() { - return d3_rgb_hsl(this.r, this.g, this.b); - }; - d3_rgbPrototype.toString = function() { - return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b); - }; - function d3_rgb_hex(v) { - return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); - } - function d3_rgb_parse(format, rgb, hsl) { - var r = 0, g = 0, b = 0, m1, m2, color; - m1 = /([a-z]+)\((.*)\)/i.exec(format); - if (m1) { - m2 = m1[2].split(","); - switch (m1[1]) { - case "hsl": - { - return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100); - } - - case "rgb": - { - return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2])); - } - } - } - if (color = d3_rgb_names.get(format)) return rgb(color.r, color.g, color.b); - if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.substring(1), 16))) { - if (format.length === 4) { - r = (color & 3840) >> 4; - r = r >> 4 | r; - g = color & 240; - g = g >> 4 | g; - b = color & 15; - b = b << 4 | b; - } else if (format.length === 7) { - r = (color & 16711680) >> 16; - g = (color & 65280) >> 8; - b = color & 255; - } - } - return rgb(r, g, b); - } - function d3_rgb_hsl(r, g, b) { - var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2; - if (d) { - s = l < .5 ? d / (max + min) : d / (2 - max - min); - if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4; - h *= 60; - } else { - h = NaN; - s = l > 0 && l < 1 ? 0 : h; - } - return d3_hsl(h, s, l); - } - function d3_rgb_lab(r, g, b) { - r = d3_rgb_xyz(r); - g = d3_rgb_xyz(g); - b = d3_rgb_xyz(b); - var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z); - return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z)); - } - function d3_rgb_xyz(r) { - return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4); - } - function d3_rgb_parseNumber(c) { - var f = parseFloat(c); - return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f; - } - var d3_rgb_names = d3.map({ - aliceblue: 15792383, - antiquewhite: 16444375, - aqua: 65535, - aquamarine: 8388564, - azure: 15794175, - beige: 16119260, - bisque: 16770244, - black: 0, - blanchedalmond: 16772045, - blue: 255, - blueviolet: 9055202, - brown: 10824234, - burlywood: 14596231, - cadetblue: 6266528, - chartreuse: 8388352, - chocolate: 13789470, - coral: 16744272, - cornflowerblue: 6591981, - cornsilk: 16775388, - crimson: 14423100, - cyan: 65535, - darkblue: 139, - darkcyan: 35723, - darkgoldenrod: 12092939, - darkgray: 11119017, - darkgreen: 25600, - darkgrey: 11119017, - darkkhaki: 12433259, - darkmagenta: 9109643, - darkolivegreen: 5597999, - darkorange: 16747520, - darkorchid: 10040012, - darkred: 9109504, - darksalmon: 15308410, - darkseagreen: 9419919, - darkslateblue: 4734347, - darkslategray: 3100495, - darkslategrey: 3100495, - darkturquoise: 52945, - darkviolet: 9699539, - deeppink: 16716947, - deepskyblue: 49151, - dimgray: 6908265, - dimgrey: 6908265, - dodgerblue: 2003199, - firebrick: 11674146, - floralwhite: 16775920, - forestgreen: 2263842, - fuchsia: 16711935, - gainsboro: 14474460, - ghostwhite: 16316671, - gold: 16766720, - goldenrod: 14329120, - gray: 8421504, - green: 32768, - greenyellow: 11403055, - grey: 8421504, - honeydew: 15794160, - hotpink: 16738740, - indianred: 13458524, - indigo: 4915330, - ivory: 16777200, - khaki: 15787660, - lavender: 15132410, - lavenderblush: 16773365, - lawngreen: 8190976, - lemonchiffon: 16775885, - lightblue: 11393254, - lightcoral: 15761536, - lightcyan: 14745599, - lightgoldenrodyellow: 16448210, - lightgray: 13882323, - lightgreen: 9498256, - lightgrey: 13882323, - lightpink: 16758465, - lightsalmon: 16752762, - lightseagreen: 2142890, - lightskyblue: 8900346, - lightslategray: 7833753, - lightslategrey: 7833753, - lightsteelblue: 11584734, - lightyellow: 16777184, - lime: 65280, - limegreen: 3329330, - linen: 16445670, - magenta: 16711935, - maroon: 8388608, - mediumaquamarine: 6737322, - mediumblue: 205, - mediumorchid: 12211667, - mediumpurple: 9662683, - mediumseagreen: 3978097, - mediumslateblue: 8087790, - mediumspringgreen: 64154, - mediumturquoise: 4772300, - mediumvioletred: 13047173, - midnightblue: 1644912, - mintcream: 16121850, - mistyrose: 16770273, - moccasin: 16770229, - navajowhite: 16768685, - navy: 128, - oldlace: 16643558, - olive: 8421376, - olivedrab: 7048739, - orange: 16753920, - orangered: 16729344, - orchid: 14315734, - palegoldenrod: 15657130, - palegreen: 10025880, - paleturquoise: 11529966, - palevioletred: 14381203, - papayawhip: 16773077, - peachpuff: 16767673, - peru: 13468991, - pink: 16761035, - plum: 14524637, - powderblue: 11591910, - purple: 8388736, - red: 16711680, - rosybrown: 12357519, - royalblue: 4286945, - saddlebrown: 9127187, - salmon: 16416882, - sandybrown: 16032864, - seagreen: 3050327, - seashell: 16774638, - sienna: 10506797, - silver: 12632256, - skyblue: 8900331, - slateblue: 6970061, - slategray: 7372944, - slategrey: 7372944, - snow: 16775930, - springgreen: 65407, - steelblue: 4620980, - tan: 13808780, - teal: 32896, - thistle: 14204888, - tomato: 16737095, - turquoise: 4251856, - violet: 15631086, - wheat: 16113331, - white: 16777215, - whitesmoke: 16119285, - yellow: 16776960, - yellowgreen: 10145074 - }); - d3_rgb_names.forEach(function(key, value) { - d3_rgb_names.set(key, d3_rgbNumber(value)); - }); - function d3_functor(v) { - return typeof v === "function" ? v : function() { - return v; - }; - } - d3.functor = d3_functor; - function d3_identity(d) { - return d; - } - d3.xhr = d3_xhrType(d3_identity); - function d3_xhrType(response) { - return function(url, mimeType, callback) { - if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, - mimeType = null; - return d3_xhr(url, mimeType, response, callback); - }; - } - function d3_xhr(url, mimeType, response, callback) { - var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null; - if (d3_window.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest(); - "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() { - request.readyState > 3 && respond(); - }; - function respond() { - var status = request.status, result; - if (!status && request.responseText || status >= 200 && status < 300 || status === 304) { - try { - result = response.call(xhr, request); - } catch (e) { - dispatch.error.call(xhr, e); - return; - } - dispatch.load.call(xhr, result); - } else { - dispatch.error.call(xhr, request); - } - } - request.onprogress = function(event) { - var o = d3.event; - d3.event = event; - try { - dispatch.progress.call(xhr, request); - } finally { - d3.event = o; - } - }; - xhr.header = function(name, value) { - name = (name + "").toLowerCase(); - if (arguments.length < 2) return headers[name]; - if (value == null) delete headers[name]; else headers[name] = value + ""; - return xhr; - }; - xhr.mimeType = function(value) { - if (!arguments.length) return mimeType; - mimeType = value == null ? null : value + ""; - return xhr; - }; - xhr.responseType = function(value) { - if (!arguments.length) return responseType; - responseType = value; - return xhr; - }; - xhr.response = function(value) { - response = value; - return xhr; - }; - [ "get", "post" ].forEach(function(method) { - xhr[method] = function() { - return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments))); - }; - }); - xhr.send = function(method, data, callback) { - if (arguments.length === 2 && typeof data === "function") callback = data, data = null; - request.open(method, url, true); - if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*"; - if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]); - if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType); - if (responseType != null) request.responseType = responseType; - if (callback != null) xhr.on("error", callback).on("load", function(request) { - callback(null, request); - }); - dispatch.beforesend.call(xhr, request); - request.send(data == null ? null : data); - return xhr; - }; - xhr.abort = function() { - request.abort(); - return xhr; - }; - d3.rebind(xhr, dispatch, "on"); - return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback)); - } - function d3_xhr_fixCallback(callback) { - return callback.length === 1 ? function(error, request) { - callback(error == null ? request : null); - } : callback; - } - d3.dsv = function(delimiter, mimeType) { - var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0); - function dsv(url, row, callback) { - if (arguments.length < 3) callback = row, row = null; - var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback); - xhr.row = function(_) { - return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row; - }; - return xhr; - } - function response(request) { - return dsv.parse(request.responseText); - } - function typedResponse(f) { - return function(request) { - return dsv.parse(request.responseText, f); - }; - } - dsv.parse = function(text, f) { - var o; - return dsv.parseRows(text, function(row, i) { - if (o) return o(row, i - 1); - var a = new Function("d", "return {" + row.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "]"; - }).join(",") + "}"); - o = f ? function(row, i) { - return f(a(row), i); - } : a; - }); - }; - dsv.parseRows = function(text, f) { - var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol; - function token() { - if (I >= N) return EOF; - if (eol) return eol = false, EOL; - var j = I; - if (text.charCodeAt(j) === 34) { - var i = j; - while (i++ < N) { - if (text.charCodeAt(i) === 34) { - if (text.charCodeAt(i + 1) !== 34) break; - ++i; - } - } - I = i + 2; - var c = text.charCodeAt(i + 1); - if (c === 13) { - eol = true; - if (text.charCodeAt(i + 2) === 10) ++I; - } else if (c === 10) { - eol = true; - } - return text.substring(j + 1, i).replace(/""/g, '"'); - } - while (I < N) { - var c = text.charCodeAt(I++), k = 1; - if (c === 10) eol = true; else if (c === 13) { - eol = true; - if (text.charCodeAt(I) === 10) ++I, ++k; - } else if (c !== delimiterCode) continue; - return text.substring(j, I - k); - } - return text.substring(j); - } - while ((t = token()) !== EOF) { - var a = []; - while (t !== EOL && t !== EOF) { - a.push(t); - t = token(); - } - if (f && !(a = f(a, n++))) continue; - rows.push(a); - } - return rows; - }; - dsv.format = function(rows) { - if (Array.isArray(rows[0])) return dsv.formatRows(rows); - var fieldSet = new d3_Set(), fields = []; - rows.forEach(function(row) { - for (var field in row) { - if (!fieldSet.has(field)) { - fields.push(fieldSet.add(field)); - } - } - }); - return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) { - return fields.map(function(field) { - return formatValue(row[field]); - }).join(delimiter); - })).join("\n"); - }; - dsv.formatRows = function(rows) { - return rows.map(formatRow).join("\n"); - }; - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(text) { - return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text; - } - return dsv; - }; - d3.csv = d3.dsv(",", "text/csv"); - d3.tsv = d3.dsv(" ", "text/tab-separated-values"); - d3.touch = function(container, touches, identifier) { - if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches; - if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) { - if ((touch = touches[i]).identifier === identifier) { - return d3_mousePoint(container, touch); - } - } - }; - var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) { - setTimeout(callback, 17); - }; - d3.timer = function(callback, delay, then) { - var n = arguments.length; - if (n < 2) delay = 0; - if (n < 3) then = Date.now(); - var time = then + delay, timer = { - c: callback, - t: time, - f: false, - n: null - }; - if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer; - d3_timer_queueTail = timer; - if (!d3_timer_interval) { - d3_timer_timeout = clearTimeout(d3_timer_timeout); - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); - } - }; - function d3_timer_step() { - var now = d3_timer_mark(), delay = d3_timer_sweep() - now; - if (delay > 24) { - if (isFinite(delay)) { - clearTimeout(d3_timer_timeout); - d3_timer_timeout = setTimeout(d3_timer_step, delay); - } - d3_timer_interval = 0; - } else { - d3_timer_interval = 1; - d3_timer_frame(d3_timer_step); - } - } - d3.timer.flush = function() { - d3_timer_mark(); - d3_timer_sweep(); - }; - function d3_timer_mark() { - var now = Date.now(); - d3_timer_active = d3_timer_queueHead; - while (d3_timer_active) { - if (now >= d3_timer_active.t) d3_timer_active.f = d3_timer_active.c(now - d3_timer_active.t); - d3_timer_active = d3_timer_active.n; - } - return now; - } - function d3_timer_sweep() { - var t0, t1 = d3_timer_queueHead, time = Infinity; - while (t1) { - if (t1.f) { - t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n; - } else { - if (t1.t < time) time = t1.t; - t1 = (t0 = t1).n; - } - } - d3_timer_queueTail = t0; - return time; - } - function d3_format_precision(x, p) { - return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1); - } - d3.round = function(x, n) { - return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); - }; - var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix); - d3.formatPrefix = function(value, precision) { - var i = 0; - if (value) { - if (value < 0) value *= -1; - if (precision) value = d3.round(value, d3_format_precision(value, precision)); - i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10); - i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3)); - } - return d3_formatPrefixes[8 + i / 3]; - }; - function d3_formatPrefix(d, i) { - var k = Math.pow(10, abs(8 - i) * 3); - return { - scale: i > 8 ? function(d) { - return d / k; - } : function(d) { - return d * k; - }, - symbol: d - }; - } - function d3_locale_numberFormat(locale) { - var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping ? function(value) { - var i = value.length, t = [], j = 0, g = locale_grouping[0]; - while (i > 0 && g > 0) { - t.push(value.substring(i -= g, i + g)); - g = locale_grouping[j = (j + 1) % locale_grouping.length]; - } - return t.reverse().join(locale_thousands); - } : d3_identity; - return function(specifier) { - var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false; - if (precision) precision = +precision.substring(1); - if (zfill || fill === "0" && align === "=") { - zfill = fill = "0"; - align = "="; - if (comma) width -= Math.floor((width - 1) / 4); - } - switch (type) { - case "n": - comma = true; - type = "g"; - break; - - case "%": - scale = 100; - suffix = "%"; - type = "f"; - break; - - case "p": - scale = 100; - suffix = "%"; - type = "r"; - break; - - case "b": - case "o": - case "x": - case "X": - if (symbol === "#") prefix = "0" + type.toLowerCase(); - - case "c": - case "d": - integer = true; - precision = 0; - break; - - case "s": - scale = -1; - type = "r"; - break; - } - if (symbol === "$") prefix = locale_currency[0], suffix = locale_currency[1]; - if (type == "r" && !precision) type = "g"; - if (precision != null) { - if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision)); - } - type = d3_format_types.get(type) || d3_format_typeDefault; - var zcomma = zfill && comma; - return function(value) { - var fullSuffix = suffix; - if (integer && value % 1) return ""; - var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign; - if (scale < 0) { - var unit = d3.formatPrefix(value, precision); - value = unit.scale(value); - fullSuffix = unit.symbol + suffix; - } else { - value *= scale; - } - value = type(value, precision); - var i = value.lastIndexOf("."), before = i < 0 ? value : value.substring(0, i), after = i < 0 ? "" : locale_decimal + value.substring(i + 1); - if (!zfill && comma) before = formatGroup(before); - var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : ""; - if (zcomma) before = formatGroup(padding + before); - negative += prefix; - value = before + after; - return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix; - }; - }; - } - var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i; - var d3_format_types = d3.map({ - b: function(x) { - return x.toString(2); - }, - c: function(x) { - return String.fromCharCode(x); - }, - o: function(x) { - return x.toString(8); - }, - x: function(x) { - return x.toString(16); - }, - X: function(x) { - return x.toString(16).toUpperCase(); - }, - g: function(x, p) { - return x.toPrecision(p); - }, - e: function(x, p) { - return x.toExponential(p); - }, - f: function(x, p) { - return x.toFixed(p); - }, - r: function(x, p) { - return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p)))); - } - }); - function d3_format_typeDefault(x) { - return x + ""; - } - var d3_time = d3.time = {}, d3_date = Date; - function d3_date_utc() { - this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]); - } - d3_date_utc.prototype = { - getDate: function() { - return this._.getUTCDate(); - }, - getDay: function() { - return this._.getUTCDay(); - }, - getFullYear: function() { - return this._.getUTCFullYear(); - }, - getHours: function() { - return this._.getUTCHours(); - }, - getMilliseconds: function() { - return this._.getUTCMilliseconds(); - }, - getMinutes: function() { - return this._.getUTCMinutes(); - }, - getMonth: function() { - return this._.getUTCMonth(); - }, - getSeconds: function() { - return this._.getUTCSeconds(); - }, - getTime: function() { - return this._.getTime(); - }, - getTimezoneOffset: function() { - return 0; - }, - valueOf: function() { - return this._.valueOf(); - }, - setDate: function() { - d3_time_prototype.setUTCDate.apply(this._, arguments); - }, - setDay: function() { - d3_time_prototype.setUTCDay.apply(this._, arguments); - }, - setFullYear: function() { - d3_time_prototype.setUTCFullYear.apply(this._, arguments); - }, - setHours: function() { - d3_time_prototype.setUTCHours.apply(this._, arguments); - }, - setMilliseconds: function() { - d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); - }, - setMinutes: function() { - d3_time_prototype.setUTCMinutes.apply(this._, arguments); - }, - setMonth: function() { - d3_time_prototype.setUTCMonth.apply(this._, arguments); - }, - setSeconds: function() { - d3_time_prototype.setUTCSeconds.apply(this._, arguments); - }, - setTime: function() { - d3_time_prototype.setTime.apply(this._, arguments); - } - }; - var d3_time_prototype = Date.prototype; - function d3_time_interval(local, step, number) { - function round(date) { - var d0 = local(date), d1 = offset(d0, 1); - return date - d0 < d1 - date ? d0 : d1; - } - function ceil(date) { - step(date = local(new d3_date(date - 1)), 1); - return date; - } - function offset(date, k) { - step(date = new d3_date(+date), k); - return date; - } - function range(t0, t1, dt) { - var time = ceil(t0), times = []; - if (dt > 1) { - while (time < t1) { - if (!(number(time) % dt)) times.push(new Date(+time)); - step(time, 1); - } - } else { - while (time < t1) times.push(new Date(+time)), step(time, 1); - } - return times; - } - function range_utc(t0, t1, dt) { - try { - d3_date = d3_date_utc; - var utc = new d3_date_utc(); - utc._ = t0; - return range(utc, t1, dt); - } finally { - d3_date = Date; - } - } - local.floor = local; - local.round = round; - local.ceil = ceil; - local.offset = offset; - local.range = range; - var utc = local.utc = d3_time_interval_utc(local); - utc.floor = utc; - utc.round = d3_time_interval_utc(round); - utc.ceil = d3_time_interval_utc(ceil); - utc.offset = d3_time_interval_utc(offset); - utc.range = range_utc; - return local; - } - function d3_time_interval_utc(method) { - return function(date, k) { - try { - d3_date = d3_date_utc; - var utc = new d3_date_utc(); - utc._ = date; - return method(utc, k)._; - } finally { - d3_date = Date; - } - }; - } - d3_time.year = d3_time_interval(function(date) { - date = d3_time.day(date); - date.setMonth(0, 1); - return date; - }, function(date, offset) { - date.setFullYear(date.getFullYear() + offset); - }, function(date) { - return date.getFullYear(); - }); - d3_time.years = d3_time.year.range; - d3_time.years.utc = d3_time.year.utc.range; - d3_time.day = d3_time_interval(function(date) { - var day = new d3_date(2e3, 0); - day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); - return day; - }, function(date, offset) { - date.setDate(date.getDate() + offset); - }, function(date) { - return date.getDate() - 1; - }); - d3_time.days = d3_time.day.range; - d3_time.days.utc = d3_time.day.utc.range; - d3_time.dayOfYear = function(date) { - var year = d3_time.year(date); - return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5); - }; - [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" ].forEach(function(day, i) { - i = 7 - i; - var interval = d3_time[day] = d3_time_interval(function(date) { - (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7); - return date; - }, function(date, offset) { - date.setDate(date.getDate() + Math.floor(offset) * 7); - }, function(date) { - var day = d3_time.year(date).getDay(); - return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i); - }); - d3_time[day + "s"] = interval.range; - d3_time[day + "s"].utc = interval.utc.range; - d3_time[day + "OfYear"] = function(date) { - var day = d3_time.year(date).getDay(); - return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7); - }; - }); - d3_time.week = d3_time.sunday; - d3_time.weeks = d3_time.sunday.range; - d3_time.weeks.utc = d3_time.sunday.utc.range; - d3_time.weekOfYear = d3_time.sundayOfYear; - function d3_locale_timeFormat(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_days = locale.days, locale_shortDays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - function d3_time_format(template) { - var n = template.length; - function format(date) { - var string = [], i = -1, j = 0, c, p, f; - while (++i < n) { - if (template.charCodeAt(i) === 37) { - string.push(template.substring(j, i)); - if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i); - if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p); - string.push(c); - j = i + 1; - } - } - string.push(template.substring(j, i)); - return string.join(""); - } - format.parse = function(string) { - var d = { - y: 1900, - m: 0, - d: 1, - H: 0, - M: 0, - S: 0, - L: 0, - Z: null - }, i = d3_time_parse(d, template, string, 0); - if (i != string.length) return null; - if ("p" in d) d.H = d.H % 12 + d.p * 12; - var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)(); - if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("w" in d && ("W" in d || "U" in d)) { - date.setFullYear(d.y, 0, 1); - date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7); - } else date.setFullYear(d.y, d.m, d.d); - date.setHours(d.H + Math.floor(d.Z / 100), d.M + d.Z % 100, d.S, d.L); - return localZ ? date._ : date; - }; - format.toString = function() { - return template; - }; - return format; - } - function d3_time_parse(date, template, string, j) { - var c, p, t, i = 0, n = template.length, m = string.length; - while (i < n) { - if (j >= m) return -1; - c = template.charCodeAt(i++); - if (c === 37) { - t = template.charAt(i++); - p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t]; - if (!p || (j = p(date, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) { - return -1; - } - } - return j; - } - d3_time_format.utc = function(template) { - var local = d3_time_format(template); - function format(date) { - try { - d3_date = d3_date_utc; - var utc = new d3_date(); - utc._ = date; - return local(utc); - } finally { - d3_date = Date; - } - } - format.parse = function(string) { - try { - d3_date = d3_date_utc; - var date = local.parse(string); - return date && date._; - } finally { - d3_date = Date; - } - }; - format.toString = local.toString; - return format; - }; - d3_time_format.multi = d3_time_format.utc.multi = d3_time_formatMulti; - var d3_time_periodLookup = d3.map(), d3_time_dayRe = d3_time_formatRe(locale_days), d3_time_dayLookup = d3_time_formatLookup(locale_days), d3_time_dayAbbrevRe = d3_time_formatRe(locale_shortDays), d3_time_dayAbbrevLookup = d3_time_formatLookup(locale_shortDays), d3_time_monthRe = d3_time_formatRe(locale_months), d3_time_monthLookup = d3_time_formatLookup(locale_months), d3_time_monthAbbrevRe = d3_time_formatRe(locale_shortMonths), d3_time_monthAbbrevLookup = d3_time_formatLookup(locale_shortMonths); - locale_periods.forEach(function(p, i) { - d3_time_periodLookup.set(p.toLowerCase(), i); - }); - var d3_time_formats = { - a: function(d) { - return locale_shortDays[d.getDay()]; - }, - A: function(d) { - return locale_days[d.getDay()]; - }, - b: function(d) { - return locale_shortMonths[d.getMonth()]; - }, - B: function(d) { - return locale_months[d.getMonth()]; - }, - c: d3_time_format(locale_dateTime), - d: function(d, p) { - return d3_time_formatPad(d.getDate(), p, 2); - }, - e: function(d, p) { - return d3_time_formatPad(d.getDate(), p, 2); - }, - H: function(d, p) { - return d3_time_formatPad(d.getHours(), p, 2); - }, - I: function(d, p) { - return d3_time_formatPad(d.getHours() % 12 || 12, p, 2); - }, - j: function(d, p) { - return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3); - }, - L: function(d, p) { - return d3_time_formatPad(d.getMilliseconds(), p, 3); - }, - m: function(d, p) { - return d3_time_formatPad(d.getMonth() + 1, p, 2); - }, - M: function(d, p) { - return d3_time_formatPad(d.getMinutes(), p, 2); - }, - p: function(d) { - return locale_periods[+(d.getHours() >= 12)]; - }, - S: function(d, p) { - return d3_time_formatPad(d.getSeconds(), p, 2); - }, - U: function(d, p) { - return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2); - }, - w: function(d) { - return d.getDay(); - }, - W: function(d, p) { - return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2); - }, - x: d3_time_format(locale_date), - X: d3_time_format(locale_time), - y: function(d, p) { - return d3_time_formatPad(d.getFullYear() % 100, p, 2); - }, - Y: function(d, p) { - return d3_time_formatPad(d.getFullYear() % 1e4, p, 4); - }, - Z: d3_time_zone, - "%": function() { - return "%"; - } - }; - var d3_time_parsers = { - a: d3_time_parseWeekdayAbbrev, - A: d3_time_parseWeekday, - b: d3_time_parseMonthAbbrev, - B: d3_time_parseMonth, - c: d3_time_parseLocaleFull, - d: d3_time_parseDay, - e: d3_time_parseDay, - H: d3_time_parseHour24, - I: d3_time_parseHour24, - j: d3_time_parseDayOfYear, - L: d3_time_parseMilliseconds, - m: d3_time_parseMonthNumber, - M: d3_time_parseMinutes, - p: d3_time_parseAmPm, - S: d3_time_parseSeconds, - U: d3_time_parseWeekNumberSunday, - w: d3_time_parseWeekdayNumber, - W: d3_time_parseWeekNumberMonday, - x: d3_time_parseLocaleDate, - X: d3_time_parseLocaleTime, - y: d3_time_parseYear, - Y: d3_time_parseFullYear, - Z: d3_time_parseZone, - "%": d3_time_parseLiteralPercent - }; - function d3_time_parseWeekdayAbbrev(date, string, i) { - d3_time_dayAbbrevRe.lastIndex = 0; - var n = d3_time_dayAbbrevRe.exec(string.substring(i)); - return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseWeekday(date, string, i) { - d3_time_dayRe.lastIndex = 0; - var n = d3_time_dayRe.exec(string.substring(i)); - return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseMonthAbbrev(date, string, i) { - d3_time_monthAbbrevRe.lastIndex = 0; - var n = d3_time_monthAbbrevRe.exec(string.substring(i)); - return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseMonth(date, string, i) { - d3_time_monthRe.lastIndex = 0; - var n = d3_time_monthRe.exec(string.substring(i)); - return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function d3_time_parseLocaleFull(date, string, i) { - return d3_time_parse(date, d3_time_formats.c.toString(), string, i); - } - function d3_time_parseLocaleDate(date, string, i) { - return d3_time_parse(date, d3_time_formats.x.toString(), string, i); - } - function d3_time_parseLocaleTime(date, string, i) { - return d3_time_parse(date, d3_time_formats.X.toString(), string, i); - } - function d3_time_parseAmPm(date, string, i) { - var n = d3_time_periodLookup.get(string.substring(i, i += 2).toLowerCase()); - return n == null ? -1 : (date.p = n, i); - } - return d3_time_format; - } - var d3_time_formatPads = { - "-": "", - _: " ", - "0": "0" - }, d3_time_numberRe = /^\s*\d+/, d3_time_percentRe = /^%/; - function d3_time_formatPad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); - } - function d3_time_formatRe(names) { - return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i"); - } - function d3_time_formatLookup(names) { - var map = new d3_Map(), i = -1, n = names.length; - while (++i < n) map.set(names[i].toLowerCase(), i); - return map; - } - function d3_time_parseWeekdayNumber(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 1)); - return n ? (date.w = +n[0], i + n[0].length) : -1; - } - function d3_time_parseWeekNumberSunday(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i)); - return n ? (date.U = +n[0], i + n[0].length) : -1; - } - function d3_time_parseWeekNumberMonday(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i)); - return n ? (date.W = +n[0], i + n[0].length) : -1; - } - function d3_time_parseFullYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 4)); - return n ? (date.y = +n[0], i + n[0].length) : -1; - } - function d3_time_parseYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1; - } - function d3_time_parseZone(date, string, i) { - return /^[+-]\d{4}$/.test(string = string.substring(i, i + 5)) ? (date.Z = +string, - i + 5) : -1; - } - function d3_time_expandYear(d) { - return d + (d > 68 ? 1900 : 2e3); - } - function d3_time_parseMonthNumber(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.m = n[0] - 1, i + n[0].length) : -1; - } - function d3_time_parseDay(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.d = +n[0], i + n[0].length) : -1; - } - function d3_time_parseDayOfYear(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 3)); - return n ? (date.j = +n[0], i + n[0].length) : -1; - } - function d3_time_parseHour24(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.H = +n[0], i + n[0].length) : -1; - } - function d3_time_parseMinutes(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.M = +n[0], i + n[0].length) : -1; - } - function d3_time_parseSeconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 2)); - return n ? (date.S = +n[0], i + n[0].length) : -1; - } - function d3_time_parseMilliseconds(date, string, i) { - d3_time_numberRe.lastIndex = 0; - var n = d3_time_numberRe.exec(string.substring(i, i + 3)); - return n ? (date.L = +n[0], i + n[0].length) : -1; - } - function d3_time_zone(d) { - var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(abs(z) / 60), zm = abs(z) % 60; - return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2); - } - function d3_time_parseLiteralPercent(date, string, i) { - d3_time_percentRe.lastIndex = 0; - var n = d3_time_percentRe.exec(string.substring(i, i + 1)); - return n ? i + n[0].length : -1; - } - function d3_time_formatMulti(formats) { - var n = formats.length, i = -1; - while (++i < n) formats[i][0] = this(formats[i][0]); - return function(date) { - var i = 0, f = formats[i]; - while (!f[1](date)) f = formats[++i]; - return f[0](date); - }; - } - d3.locale = function(locale) { - return { - numberFormat: d3_locale_numberFormat(locale), - timeFormat: d3_locale_timeFormat(locale) - }; - }; - var d3_locale_enUS = d3.locale({ - decimal: ".", - thousands: ",", - grouping: [ 3 ], - currency: [ "$", "" ], - dateTime: "%a %b %e %X %Y", - date: "%m/%d/%Y", - time: "%H:%M:%S", - periods: [ "AM", "PM" ], - days: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], - shortDays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], - months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], - shortMonths: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] - }); - d3.format = d3_locale_enUS.numberFormat; - d3.geo = {}; - function d3_adder() {} - d3_adder.prototype = { - s: 0, - t: 0, - add: function(y) { - d3_adderSum(y, this.t, d3_adderTemp); - d3_adderSum(d3_adderTemp.s, this.s, this); - if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t; - }, - reset: function() { - this.s = this.t = 0; - }, - valueOf: function() { - return this.s; - } - }; - var d3_adderTemp = new d3_adder(); - function d3_adderSum(a, b, o) { - var x = o.s = a + b, bv = x - a, av = x - bv; - o.t = a - av + (b - bv); - } - d3.geo.stream = function(object, listener) { - if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) { - d3_geo_streamObjectType[object.type](object, listener); - } else { - d3_geo_streamGeometry(object, listener); - } - }; - function d3_geo_streamGeometry(geometry, listener) { - if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) { - d3_geo_streamGeometryType[geometry.type](geometry, listener); - } - } - var d3_geo_streamObjectType = { - Feature: function(feature, listener) { - d3_geo_streamGeometry(feature.geometry, listener); - }, - FeatureCollection: function(object, listener) { - var features = object.features, i = -1, n = features.length; - while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener); - } - }; - var d3_geo_streamGeometryType = { - Sphere: function(object, listener) { - listener.sphere(); - }, - Point: function(object, listener) { - object = object.coordinates; - listener.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]); - }, - LineString: function(object, listener) { - d3_geo_streamLine(object.coordinates, listener, 0); - }, - MultiLineString: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0); - }, - Polygon: function(object, listener) { - d3_geo_streamPolygon(object.coordinates, listener); - }, - MultiPolygon: function(object, listener) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while (++i < n) d3_geo_streamPolygon(coordinates[i], listener); - }, - GeometryCollection: function(object, listener) { - var geometries = object.geometries, i = -1, n = geometries.length; - while (++i < n) d3_geo_streamGeometry(geometries[i], listener); - } - }; - function d3_geo_streamLine(coordinates, listener, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - listener.lineStart(); - while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]); - listener.lineEnd(); - } - function d3_geo_streamPolygon(coordinates, listener) { - var i = -1, n = coordinates.length; - listener.polygonStart(); - while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1); - listener.polygonEnd(); - } - d3.geo.area = function(object) { - d3_geo_areaSum = 0; - d3.geo.stream(object, d3_geo_area); - return d3_geo_areaSum; - }; - var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder(); - var d3_geo_area = { - sphere: function() { - d3_geo_areaSum += 4 * π; - }, - point: d3_noop, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: function() { - d3_geo_areaRingSum.reset(); - d3_geo_area.lineStart = d3_geo_areaRingStart; - }, - polygonEnd: function() { - var area = 2 * d3_geo_areaRingSum; - d3_geo_areaSum += area < 0 ? 4 * π + area : area; - d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop; - } - }; - function d3_geo_areaRingStart() { - var λ00, φ00, λ0, cosφ0, sinφ0; - d3_geo_area.point = function(λ, φ) { - d3_geo_area.point = nextPoint; - λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), - sinφ0 = Math.sin(φ); - }; - function nextPoint(λ, φ) { - λ *= d3_radians; - φ = φ * d3_radians / 2 + π / 4; - var dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(adλ), v = k * sdλ * Math.sin(adλ); - d3_geo_areaRingSum.add(Math.atan2(v, u)); - λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ; - } - d3_geo_area.lineEnd = function() { - nextPoint(λ00, φ00); - }; - } - function d3_geo_cartesian(spherical) { - var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ); - return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ]; - } - function d3_geo_cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; - } - function d3_geo_cartesianCross(a, b) { - return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ]; - } - function d3_geo_cartesianAdd(a, b) { - a[0] += b[0]; - a[1] += b[1]; - a[2] += b[2]; - } - function d3_geo_cartesianScale(vector, k) { - return [ vector[0] * k, vector[1] * k, vector[2] * k ]; - } - function d3_geo_cartesianNormalize(d) { - var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l; - d[1] /= l; - d[2] /= l; - } - function d3_geo_spherical(cartesian) { - return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ]; - } - function d3_geo_sphericalEqual(a, b) { - return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε; - } - d3.geo.bounds = function() { - var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range; - var bound = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - bound.point = ringPoint; - bound.lineStart = ringStart; - bound.lineEnd = ringEnd; - dλSum = 0; - d3_geo_area.polygonStart(); - }, - polygonEnd: function() { - d3_geo_area.polygonEnd(); - bound.point = point; - bound.lineStart = lineStart; - bound.lineEnd = lineEnd; - if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90; - range[0] = λ0, range[1] = λ1; - } - }; - function point(λ, φ) { - ranges.push(range = [ λ0 = λ, λ1 = λ ]); - if (φ < φ0) φ0 = φ; - if (φ > φ1) φ1 = φ; - } - function linePoint(λ, φ) { - var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]); - if (p0) { - var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal); - d3_geo_cartesianNormalize(inflection); - inflection = d3_geo_spherical(inflection); - var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180; - if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) { - var φi = inflection[1] * d3_degrees; - if (φi > φ1) φ1 = φi; - } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) { - var φi = -inflection[1] * d3_degrees; - if (φi < φ0) φ0 = φi; - } else { - if (φ < φ0) φ0 = φ; - if (φ > φ1) φ1 = φ; - } - if (antimeridian) { - if (λ < λ_) { - if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; - } else { - if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; - } - } else { - if (λ1 >= λ0) { - if (λ < λ0) λ0 = λ; - if (λ > λ1) λ1 = λ; - } else { - if (λ > λ_) { - if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ; - } else { - if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ; - } - } - } - } else { - point(λ, φ); - } - p0 = p, λ_ = λ; - } - function lineStart() { - bound.point = linePoint; - } - function lineEnd() { - range[0] = λ0, range[1] = λ1; - bound.point = point; - p0 = null; - } - function ringPoint(λ, φ) { - if (p0) { - var dλ = λ - λ_; - dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ; - } else λ__ = λ, φ__ = φ; - d3_geo_area.point(λ, φ); - linePoint(λ, φ); - } - function ringStart() { - d3_geo_area.lineStart(); - } - function ringEnd() { - ringPoint(λ__, φ__); - d3_geo_area.lineEnd(); - if (abs(dλSum) > ε) λ0 = -(λ1 = 180); - range[0] = λ0, range[1] = λ1; - p0 = null; - } - function angle(λ0, λ1) { - return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; - } - function compareRanges(a, b) { - return a[0] - b[0]; - } - function withinRange(x, range) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; - } - return function(feature) { - φ1 = λ1 = -(λ0 = φ0 = Infinity); - ranges = []; - d3.geo.stream(feature, bound); - var n = ranges.length; - if (n) { - ranges.sort(compareRanges); - for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) { - b = ranges[i]; - if (withinRange(b[0], a) || withinRange(b[1], a)) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else { - merged.push(a = b); - } - } - var best = -Infinity, dλ; - for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) { - b = merged[i]; - if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1]; - } - } - ranges = range = null; - return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ]; - }; - }(); - d3.geo.centroid = function(object) { - d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; - d3.geo.stream(object, d3_geo_centroid); - var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z; - if (m < ε2) { - x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1; - if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0; - m = x * x + y * y + z * z; - if (m < ε2) return [ NaN, NaN ]; - } - return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ]; - }; - var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2; - var d3_geo_centroid = { - sphere: d3_noop, - point: d3_geo_centroidPoint, - lineStart: d3_geo_centroidLineStart, - lineEnd: d3_geo_centroidLineEnd, - polygonStart: function() { - d3_geo_centroid.lineStart = d3_geo_centroidRingStart; - }, - polygonEnd: function() { - d3_geo_centroid.lineStart = d3_geo_centroidLineStart; - } - }; - function d3_geo_centroidPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ)); - } - function d3_geo_centroidPointXYZ(x, y, z) { - ++d3_geo_centroidW0; - d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0; - d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0; - d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0; - } - function d3_geo_centroidLineStart() { - var x0, y0, z0; - d3_geo_centroid.point = function(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - x0 = cosφ * Math.cos(λ); - y0 = cosφ * Math.sin(λ); - z0 = Math.sin(φ); - d3_geo_centroid.point = nextPoint; - d3_geo_centroidPointXYZ(x0, y0, z0); - }; - function nextPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - d3_geo_centroidW1 += w; - d3_geo_centroidX1 += w * (x0 + (x0 = x)); - d3_geo_centroidY1 += w * (y0 + (y0 = y)); - d3_geo_centroidZ1 += w * (z0 + (z0 = z)); - d3_geo_centroidPointXYZ(x0, y0, z0); - } - } - function d3_geo_centroidLineEnd() { - d3_geo_centroid.point = d3_geo_centroidPoint; - } - function d3_geo_centroidRingStart() { - var λ00, φ00, x0, y0, z0; - d3_geo_centroid.point = function(λ, φ) { - λ00 = λ, φ00 = φ; - d3_geo_centroid.point = nextPoint; - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians); - x0 = cosφ * Math.cos(λ); - y0 = cosφ * Math.sin(λ); - z0 = Math.sin(φ); - d3_geo_centroidPointXYZ(x0, y0, z0); - }; - d3_geo_centroid.lineEnd = function() { - nextPoint(λ00, φ00); - d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd; - d3_geo_centroid.point = d3_geo_centroidPoint; - }; - function nextPoint(λ, φ) { - λ *= d3_radians; - var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u); - d3_geo_centroidX2 += v * cx; - d3_geo_centroidY2 += v * cy; - d3_geo_centroidZ2 += v * cz; - d3_geo_centroidW1 += w; - d3_geo_centroidX1 += w * (x0 + (x0 = x)); - d3_geo_centroidY1 += w * (y0 + (y0 = y)); - d3_geo_centroidZ1 += w * (z0 + (z0 = z)); - d3_geo_centroidPointXYZ(x0, y0, z0); - } - } - function d3_true() { - return true; - } - function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) { - var subject = [], clip = []; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n]; - if (d3_geo_sphericalEqual(p0, p1)) { - listener.lineStart(); - for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]); - listener.lineEnd(); - return; - } - var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false); - a.o = b; - subject.push(a); - clip.push(b); - a = new d3_geo_clipPolygonIntersection(p1, segment, null, false); - b = new d3_geo_clipPolygonIntersection(p1, null, a, true); - a.o = b; - subject.push(a); - clip.push(b); - }); - clip.sort(compare); - d3_geo_clipPolygonLinkCircular(subject); - d3_geo_clipPolygonLinkCircular(clip); - if (!subject.length) return; - for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) { - clip[i].e = entry = !entry; - } - var start = subject[0], points, point; - while (1) { - var current = start, isSubject = true; - while (current.v) if ((current = current.n) === start) return; - points = current.z; - listener.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) { - for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.n.x, 1, listener); - } - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]); - } else { - interpolate(current.x, current.p.x, -1, listener); - } - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - listener.lineEnd(); - } - } - function d3_geo_clipPolygonLinkCircular(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; - } - function d3_geo_clipPolygonIntersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; - this.e = entry; - this.v = false; - this.n = this.p = null; - } - function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) { - return function(rotate, listener) { - var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]); - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - listener.polygonStart(); - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = d3.merge(segments); - var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon); - if (segments.length) { - d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener); - } else if (clipStartInside) { - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - } - listener.polygonEnd(); - segments = polygon = null; - }, - sphere: function() { - listener.polygonStart(); - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - listener.polygonEnd(); - } - }; - function point(λ, φ) { - var point = rotate(λ, φ); - if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ); - } - function pointLine(λ, φ) { - var point = rotate(λ, φ); - line.point(point[0], point[1]); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - var segments; - var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygon, ring; - function pointRing(λ, φ) { - ring.push([ λ, φ ]); - var point = rotate(λ, φ); - ringListener.point(point[0], point[1]); - } - function ringStart() { - ringListener.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringListener.lineEnd(); - var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - if (clean & 1) { - segment = ringSegments[0]; - var n = segment.length - 1, i = -1, point; - listener.lineStart(); - while (++i < n) listener.point((point = segment[i])[0], point[1]); - listener.lineEnd(); - return; - } - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(d3_geo_clipSegmentLength1)); - } - return clip; - }; - } - function d3_geo_clipSegmentLength1(segment) { - return segment.length > 1; - } - function d3_geo_clipBufferListener() { - var lines = [], line; - return { - lineStart: function() { - lines.push(line = []); - }, - point: function(λ, φ) { - line.push([ λ, φ ]); - }, - lineEnd: d3_noop, - buffer: function() { - var buffer = lines; - lines = []; - line = null; - return buffer; - }, - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - } - }; - } - function d3_geo_clipSort(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]); - } - function d3_geo_pointInPolygon(point, polygon) { - var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0; - d3_geo_areaRingSum.reset(); - for (var i = 0, n = polygon.length; i < n; ++i) { - var ring = polygon[i], m = ring.length; - if (!m) continue; - var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1; - while (true) { - if (j === m) j = 0; - point = ring[j]; - var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ; - d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ))); - polarAngle += antimeridian ? dλ + sdλ * τ : dλ; - if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) { - var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point)); - d3_geo_cartesianNormalize(arc); - var intersection = d3_geo_cartesianCross(meridianNormal, arc); - d3_geo_cartesianNormalize(intersection); - var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]); - if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) { - winding += antimeridian ^ dλ >= 0 ? 1 : -1; - } - } - if (!j++) break; - λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point; - } - } - return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1; - } - var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]); - function d3_geo_clipAntimeridianLine(listener) { - var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean; - return { - lineStart: function() { - listener.lineStart(); - clean = 1; - }, - point: function(λ1, φ1) { - var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0); - if (abs(dλ - π) < ε) { - listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ); - listener.point(sλ0, φ0); - listener.lineEnd(); - listener.lineStart(); - listener.point(sλ1, φ0); - listener.point(λ1, φ0); - clean = 0; - } else if (sλ0 !== sλ1 && dλ >= π) { - if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε; - if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε; - φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1); - listener.point(sλ0, φ0); - listener.lineEnd(); - listener.lineStart(); - listener.point(sλ1, φ0); - clean = 0; - } - listener.point(λ0 = λ1, φ0 = φ1); - sλ0 = sλ1; - }, - lineEnd: function() { - listener.lineEnd(); - λ0 = φ0 = NaN; - }, - clean: function() { - return 2 - clean; - } - }; - } - function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) { - var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1); - return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2; - } - function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) { - var φ; - if (from == null) { - φ = direction * halfπ; - listener.point(-π, φ); - listener.point(0, φ); - listener.point(π, φ); - listener.point(π, 0); - listener.point(π, -φ); - listener.point(0, -φ); - listener.point(-π, -φ); - listener.point(-π, 0); - listener.point(-π, φ); - } else if (abs(from[0] - to[0]) > ε) { - var s = from[0] < to[0] ? π : -π; - φ = direction * s / 2; - listener.point(-s, φ); - listener.point(0, φ); - listener.point(s, φ); - } else { - listener.point(to[0], to[1]); - } - } - function d3_geo_clipCircle(radius) { - var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians); - return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]); - function visible(λ, φ) { - return Math.cos(λ) * Math.cos(φ) > cr; - } - function clipLine(listener) { - var point0, c0, v0, v00, clean; - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(λ, φ) { - var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0; - if (!point0 && (v00 = v0 = v)) listener.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) { - point1[0] += ε; - point1[1] += ε; - v = visible(point1[0], point1[1]); - } - } - if (v !== v0) { - clean = 0; - if (v) { - listener.lineStart(); - point2 = intersect(point1, point0); - listener.point(point2[0], point2[1]); - } else { - point2 = intersect(point0, point1); - listener.point(point2[0], point2[1]); - listener.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - listener.lineStart(); - listener.point(t[0][0], t[0][1]); - listener.point(t[1][0], t[1][1]); - listener.lineEnd(); - } else { - listener.point(t[1][0], t[1][1]); - listener.lineEnd(); - listener.lineStart(); - listener.point(t[0][0], t[0][1]); - } - } - } - if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) { - listener.point(point1[0], point1[1]); - } - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) listener.lineEnd(); - point0 = null; - }, - clean: function() { - return clean | (v00 && v0) << 1; - } - }; - } - function intersect(a, b, two) { - var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b); - var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2); - d3_geo_cartesianAdd(A, B); - var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1); - if (t2 < 0) return; - var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu); - d3_geo_cartesianAdd(q, A); - q = d3_geo_spherical(q); - if (!two) return q; - var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z; - if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z; - var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε; - if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z; - if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) { - var q1 = d3_geo_cartesianScale(u, (-w + t) / uu); - d3_geo_cartesianAdd(q1, A); - return [ q, d3_geo_spherical(q1) ]; - } - } - function code(λ, φ) { - var r = smallRadius ? radius : π - radius, code = 0; - if (λ < -r) code |= 1; else if (λ > r) code |= 2; - if (φ < -r) code |= 4; else if (φ > r) code |= 8; - return code; - } - } - function d3_geom_clipLine(x0, y0, x1, y1) { - return function(line) { - var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - if (t0 > 0) line.a = { - x: ax + t0 * dx, - y: ay + t0 * dy - }; - if (t1 < 1) line.b = { - x: ax + t1 * dx, - y: ay + t1 * dy - }; - return line; - }; - } - var d3_geo_clipExtentMAX = 1e9; - d3.geo.clipExtent = function() { - var x0, y0, x1, y1, stream, clip, clipExtent = { - stream: function(output) { - if (stream) stream.valid = false; - stream = clip(output); - stream.valid = true; - return stream; - }, - extent: function(_) { - if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; - clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]); - if (stream) stream.valid = false, stream = null; - return clipExtent; - } - }; - return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]); - }; - function d3_geo_clipExtent(x0, y0, x1, y1) { - return function(listener) { - var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - listener = bufferListener; - segments = []; - polygon = []; - clean = true; - }, - polygonEnd: function() { - listener = listener_; - segments = d3.merge(segments); - var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length; - if (inside || visible) { - listener.polygonStart(); - if (inside) { - listener.lineStart(); - interpolate(null, null, 1, listener); - listener.lineEnd(); - } - if (visible) { - d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener); - } - listener.polygonEnd(); - } - segments = polygon = ring = null; - } - }; - function insidePolygon(p) { - var wn = 0, n = polygon.length, y = p[1]; - for (var i = 0; i < n; ++i) { - for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) { - b = v[j]; - if (a[1] <= y) { - if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn; - } else { - if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn; - } - a = b; - } - } - return wn !== 0; - } - function interpolate(from, to, direction, listener) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) { - do { - listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - } while ((a = (a + direction + 4) % 4) !== a1); - } else { - listener.point(to[0], to[1]); - } - } - function pointVisible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function point(x, y) { - if (pointVisible(x, y)) listener.point(x, y); - } - var x__, y__, v__, x_, y_, v_, first, clean; - function lineStart() { - clip.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferListener.rejoin(); - segments.push(bufferListener.buffer()); - } - clip.point = point; - if (v_) listener.lineEnd(); - } - function linePoint(x, y) { - x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x)); - y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y)); - var v = pointVisible(x, y); - if (polygon) ring.push([ x, y ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - listener.lineStart(); - listener.point(x, y); - } - } else { - if (v && v_) listener.point(x, y); else { - var l = { - a: { - x: x_, - y: y_ - }, - b: { - x: x, - y: y - } - }; - if (clipLine(l)) { - if (!v_) { - listener.lineStart(); - listener.point(l.a.x, l.a.y); - } - listener.point(l.b.x, l.b.y); - if (!v) listener.lineEnd(); - clean = false; - } else if (v) { - listener.lineStart(); - listener.point(x, y); - clean = false; - } - } - } - x_ = x, y_ = y, v_ = v; - } - return clip; - }; - function corner(p, direction) { - return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; - } - function compare(a, b) { - return comparePoints(a.x, b.x); - } - function comparePoints(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - } - function d3_geo_compose(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - } - function d3_geo_conic(projectAt) { - var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1); - p.parallels = function(_) { - if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ]; - return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180); - }; - return p; - } - function d3_geo_conicEqualArea(φ0, φ1) { - var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n; - function forward(λ, φ) { - var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; - return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ]; - } - forward.invert = function(x, y) { - var ρ0_y = ρ0 - y; - return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ]; - }; - return forward; - } - (d3.geo.conicEqualArea = function() { - return d3_geo_conic(d3_geo_conicEqualArea); - }).raw = d3_geo_conicEqualArea; - d3.geo.albers = function() { - return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070); - }; - d3.geo.albersUsa = function() { - var lower48 = d3.geo.albers(); - var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]); - var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]); - var point, pointStream = { - point: function(x, y) { - point = [ x, y ]; - } - }, lower48Point, alaskaPoint, hawaiiPoint; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - point = null; - (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y); - return point; - } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream); - return { - point: function(x, y) { - lower48Stream.point(x, y); - alaskaStream.point(x, y); - hawaiiStream.point(x, y); - }, - sphere: function() { - lower48Stream.sphere(); - alaskaStream.sphere(); - hawaiiStream.sphere(); - }, - lineStart: function() { - lower48Stream.lineStart(); - alaskaStream.lineStart(); - hawaiiStream.lineStart(); - }, - lineEnd: function() { - lower48Stream.lineEnd(); - alaskaStream.lineEnd(); - hawaiiStream.lineEnd(); - }, - polygonStart: function() { - lower48Stream.polygonStart(); - alaskaStream.polygonStart(); - hawaiiStream.polygonStart(); - }, - polygonEnd: function() { - lower48Stream.polygonEnd(); - alaskaStream.polygonEnd(); - hawaiiStream.polygonEnd(); - } - }; - }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_); - alaska.precision(_); - hawaii.precision(_); - return albersUsa; - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_); - alaska.scale(_ * .35); - hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point; - alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; - hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point; - return albersUsa; - }; - return albersUsa.scale(1070); - }; - var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = { - point: d3_noop, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: function() { - d3_geo_pathAreaPolygon = 0; - d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart; - }, - polygonEnd: function() { - d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop; - d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2); - } - }; - function d3_geo_pathAreaRingStart() { - var x00, y00, x0, y0; - d3_geo_pathArea.point = function(x, y) { - d3_geo_pathArea.point = nextPoint; - x00 = x0 = x, y00 = y0 = y; - }; - function nextPoint(x, y) { - d3_geo_pathAreaPolygon += y0 * x - x0 * y; - x0 = x, y0 = y; - } - d3_geo_pathArea.lineEnd = function() { - nextPoint(x00, y00); - }; - } - var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1; - var d3_geo_pathBounds = { - point: d3_geo_pathBoundsPoint, - lineStart: d3_noop, - lineEnd: d3_noop, - polygonStart: d3_noop, - polygonEnd: d3_noop - }; - function d3_geo_pathBoundsPoint(x, y) { - if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x; - if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x; - if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y; - if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y; - } - function d3_geo_pathBuffer() { - var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = []; - var stream = { - point: point, - lineStart: function() { - stream.point = pointLineStart; - }, - lineEnd: lineEnd, - polygonStart: function() { - stream.lineEnd = lineEndPolygon; - }, - polygonEnd: function() { - stream.lineEnd = lineEnd; - stream.point = point; - }, - pointRadius: function(_) { - pointCircle = d3_geo_pathBufferCircle(_); - return stream; - }, - result: function() { - if (buffer.length) { - var result = buffer.join(""); - buffer = []; - return result; - } - } - }; - function point(x, y) { - buffer.push("M", x, ",", y, pointCircle); - } - function pointLineStart(x, y) { - buffer.push("M", x, ",", y); - stream.point = pointLine; - } - function pointLine(x, y) { - buffer.push("L", x, ",", y); - } - function lineEnd() { - stream.point = point; - } - function lineEndPolygon() { - buffer.push("Z"); - } - return stream; - } - function d3_geo_pathBufferCircle(radius) { - return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; - } - var d3_geo_pathCentroid = { - point: d3_geo_pathCentroidPoint, - lineStart: d3_geo_pathCentroidLineStart, - lineEnd: d3_geo_pathCentroidLineEnd, - polygonStart: function() { - d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart; - }, - polygonEnd: function() { - d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; - d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart; - d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd; - } - }; - function d3_geo_pathCentroidPoint(x, y) { - d3_geo_centroidX0 += x; - d3_geo_centroidY0 += y; - ++d3_geo_centroidZ0; - } - function d3_geo_pathCentroidLineStart() { - var x0, y0; - d3_geo_pathCentroid.point = function(x, y) { - d3_geo_pathCentroid.point = nextPoint; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); - }; - function nextPoint(x, y) { - var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); - d3_geo_centroidX1 += z * (x0 + x) / 2; - d3_geo_centroidY1 += z * (y0 + y) / 2; - d3_geo_centroidZ1 += z; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); - } - } - function d3_geo_pathCentroidLineEnd() { - d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint; - } - function d3_geo_pathCentroidRingStart() { - var x00, y00, x0, y0; - d3_geo_pathCentroid.point = function(x, y) { - d3_geo_pathCentroid.point = nextPoint; - d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y); - }; - function nextPoint(x, y) { - var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy); - d3_geo_centroidX1 += z * (x0 + x) / 2; - d3_geo_centroidY1 += z * (y0 + y) / 2; - d3_geo_centroidZ1 += z; - z = y0 * x - x0 * y; - d3_geo_centroidX2 += z * (x0 + x); - d3_geo_centroidY2 += z * (y0 + y); - d3_geo_centroidZ2 += z * 3; - d3_geo_pathCentroidPoint(x0 = x, y0 = y); - } - d3_geo_pathCentroid.lineEnd = function() { - nextPoint(x00, y00); - }; - } - function d3_geo_pathContext(context) { - var pointRadius = 4.5; - var stream = { - point: point, - lineStart: function() { - stream.point = pointLineStart; - }, - lineEnd: lineEnd, - polygonStart: function() { - stream.lineEnd = lineEndPolygon; - }, - polygonEnd: function() { - stream.lineEnd = lineEnd; - stream.point = point; - }, - pointRadius: function(_) { - pointRadius = _; - return stream; - }, - result: d3_noop - }; - function point(x, y) { - context.moveTo(x, y); - context.arc(x, y, pointRadius, 0, τ); - } - function pointLineStart(x, y) { - context.moveTo(x, y); - stream.point = pointLine; - } - function pointLine(x, y) { - context.lineTo(x, y); - } - function lineEnd() { - stream.point = point; - } - function lineEndPolygon() { - context.closePath(); - } - return stream; - } - function d3_geo_resample(project) { - var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; - function resample(stream) { - return (maxDepth ? resampleRecursive : resampleNone)(stream); - } - function resampleNone(stream) { - return d3_geo_transformPoint(stream, function(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - }); - } - function resampleRecursive(stream) { - var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0; - var resample = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resample.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resample.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resample.point = linePoint; - stream.lineStart(); - } - function linePoint(λ, φ) { - var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); - resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resample.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resample.point = ringPoint; - resample.lineEnd = ringEnd; - } - function ringPoint(λ, φ) { - linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resample.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); - resample.lineEnd = lineEnd; - lineEnd(); - } - return resample; - } - function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * δ2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream); - } - } - } - resample.precision = function(_) { - if (!arguments.length) return Math.sqrt(δ2); - maxDepth = (δ2 = _ * _) > 0 && 16; - return resample; - }; - return resample; - } - d3.geo.path = function() { - var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream); - d3.geo.stream(object, cacheStream); - } - return contextStream.result(); - } - path.area = function(object) { - d3_geo_pathAreaSum = 0; - d3.geo.stream(object, projectStream(d3_geo_pathArea)); - return d3_geo_pathAreaSum; - }; - path.centroid = function(object) { - d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0; - d3.geo.stream(object, projectStream(d3_geo_pathCentroid)); - return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ]; - }; - path.bounds = function(object) { - d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity); - d3.geo.stream(object, projectStream(d3_geo_pathBounds)); - return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ]; - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity; - return reset(); - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return reset(); - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - function reset() { - cacheStream = null; - return path; - } - return path.projection(d3.geo.albersUsa()).context(null); - }; - function d3_geo_pathProjectStream(project) { - var resample = d3_geo_resample(function(x, y) { - return project([ x * d3_degrees, y * d3_degrees ]); - }); - return function(stream) { - return d3_geo_projectionRadians(resample(stream)); - }; - } - d3.geo.transform = function(methods) { - return { - stream: function(stream) { - var transform = new d3_geo_transform(stream); - for (var k in methods) transform[k] = methods[k]; - return transform; - } - }; - }; - function d3_geo_transform(stream) { - this.stream = stream; - } - d3_geo_transform.prototype = { - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } - }; - function d3_geo_transformPoint(stream, point) { - return { - point: point, - sphere: function() { - stream.sphere(); - }, - lineStart: function() { - stream.lineStart(); - }, - lineEnd: function() { - stream.lineEnd(); - }, - polygonStart: function() { - stream.polygonStart(); - }, - polygonEnd: function() { - stream.polygonEnd(); - } - }; - } - d3.geo.projection = d3_geo_projection; - d3.geo.projectionMutator = d3_geo_projectionMutator; - function d3_geo_projection(project) { - return d3_geo_projectionMutator(function() { - return project; - })(); - } - function d3_geo_projectionMutator(projectAt) { - var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) { - x = project(x, y); - return [ x[0] * k + δx, δy - x[1] * k ]; - }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream; - function projection(point) { - point = projectRotate(point[0] * d3_radians, point[1] * d3_radians); - return [ point[0] * k + δx, δy - point[1] * k ]; - } - function invert(point) { - point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k); - return point && [ point[0] * d3_degrees, point[1] * d3_degrees ]; - } - projection.stream = function(output) { - if (stream) stream.valid = false; - stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output)))); - stream.valid = true; - return stream; - }; - projection.clipAngle = function(_) { - if (!arguments.length) return clipAngle; - preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians); - return invalidate(); - }; - projection.clipExtent = function(_) { - if (!arguments.length) return clipExtent; - clipExtent = _; - postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity; - return invalidate(); - }; - projection.scale = function(_) { - if (!arguments.length) return k; - k = +_; - return reset(); - }; - projection.translate = function(_) { - if (!arguments.length) return [ x, y ]; - x = +_[0]; - y = +_[1]; - return reset(); - }; - projection.center = function(_) { - if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ]; - λ = _[0] % 360 * d3_radians; - φ = _[1] % 360 * d3_radians; - return reset(); - }; - projection.rotate = function(_) { - if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ]; - δλ = _[0] % 360 * d3_radians; - δφ = _[1] % 360 * d3_radians; - δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; - return reset(); - }; - d3.rebind(projection, projectResample, "precision"); - function reset() { - projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); - var center = project(λ, φ); - δx = x - center[0] * k; - δy = y + center[1] * k; - return invalidate(); - } - function invalidate() { - if (stream) stream.valid = false, stream = null; - return projection; - } - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return reset(); - }; - } - function d3_geo_projectionRadians(stream) { - return d3_geo_transformPoint(stream, function(x, y) { - stream.point(x * d3_radians, y * d3_radians); - }); - } - function d3_geo_equirectangular(λ, φ) { - return [ λ, φ ]; - } - (d3.geo.equirectangular = function() { - return d3_geo_projection(d3_geo_equirectangular); - }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular; - d3.geo.rotation = function(rotate) { - rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); - return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; - } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians); - return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates; - }; - return forward; - }; - function d3_geo_identityRotation(λ, φ) { - return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; - } - d3_geo_identityRotation.invert = d3_geo_equirectangular; - function d3_geo_rotation(δλ, δφ, δγ) { - return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation; - } - function d3_geo_forwardRotationλ(δλ) { - return function(λ, φ) { - return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ]; - }; - } - function d3_geo_rotationλ(δλ) { - var rotation = d3_geo_forwardRotationλ(δλ); - rotation.invert = d3_geo_forwardRotationλ(-δλ); - return rotation; - } - function d3_geo_rotationφγ(δφ, δγ) { - var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ); - function rotation(λ, φ) { - var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ; - return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ]; - } - rotation.invert = function(λ, φ) { - var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ; - return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ]; - }; - return rotation; - } - d3.geo.circle = function() { - var origin = [ 0, 0 ], angle, precision = 6, interpolate; - function circle() { - var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = []; - interpolate(null, null, 1, { - point: function(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= d3_degrees, x[1] *= d3_degrees; - } - }); - return { - type: "Polygon", - coordinates: [ ring ] - }; - } - circle.origin = function(x) { - if (!arguments.length) return origin; - origin = x; - return circle; - }; - circle.angle = function(x) { - if (!arguments.length) return angle; - interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians); - return circle; - }; - circle.precision = function(_) { - if (!arguments.length) return precision; - interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians); - return circle; - }; - return circle.angle(90); - }; - function d3_geo_circleInterpolate(radius, precision) { - var cr = Math.cos(radius), sr = Math.sin(radius); - return function(from, to, direction, listener) { - var step = direction * precision; - if (from != null) { - from = d3_geo_circleAngle(cr, from); - to = d3_geo_circleAngle(cr, to); - if (direction > 0 ? from < to : from > to) from += direction * τ; - } else { - from = radius + direction * τ; - to = radius - .5 * step; - } - for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) { - listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]); - } - }; - } - function d3_geo_circleAngle(cr, point) { - var a = d3_geo_cartesian(point); - a[0] -= cr; - d3_geo_cartesianNormalize(a); - var angle = d3_acos(-a[1]); - return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI); - } - d3.geo.distance = function(a, b) { - var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t; - return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ); - }; - d3.geo.graticule = function() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; - } - function lines() { - return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) { - return abs(x % DX) > ε; - }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) { - return abs(y % DY) > ε; - }).map(y)); - } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); - }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ] - }; - }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.minorExtent(); - return graticule.majorExtent(_).minorExtent(_); - }; - graticule.majorExtent = function(_) { - if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - graticule.minorExtent = function(_) { - if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - graticule.step = function(_) { - if (!arguments.length) return graticule.minorStep(); - return graticule.majorStep(_).minorStep(_); - }; - graticule.majorStep = function(_) { - if (!arguments.length) return [ DX, DY ]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - graticule.minorStep = function(_) { - if (!arguments.length) return [ dx, dy ]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = d3_geo_graticuleX(y0, y1, 90); - y = d3_geo_graticuleY(x0, x1, precision); - X = d3_geo_graticuleX(Y0, Y1, 90); - Y = d3_geo_graticuleY(X0, X1, precision); - return graticule; - }; - return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]); - }; - function d3_geo_graticuleX(y0, y1, dy) { - var y = d3.range(y0, y1 - ε, dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ x, y ]; - }); - }; - } - function d3_geo_graticuleY(x0, x1, dx) { - var x = d3.range(x0, x1 - ε, dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ x, y ]; - }); - }; - } - function d3_source(d) { - return d.source; - } - function d3_target(d) { - return d.target; - } - d3.geo.greatArc = function() { - var source = d3_source, source_, target = d3_target, target_; - function greatArc() { - return { - type: "LineString", - coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ] - }; - } - greatArc.distance = function() { - return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments)); - }; - greatArc.source = function(_) { - if (!arguments.length) return source; - source = _, source_ = typeof _ === "function" ? null : _; - return greatArc; - }; - greatArc.target = function(_) { - if (!arguments.length) return target; - target = _, target_ = typeof _ === "function" ? null : _; - return greatArc; - }; - greatArc.precision = function() { - return arguments.length ? greatArc : 0; - }; - return greatArc; - }; - d3.geo.interpolate = function(source, target) { - return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians); - }; - function d3_geo_interpolate(x0, y0, x1, y1) { - var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d); - var interpolate = d ? function(t) { - var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1; - return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ]; - } : function() { - return [ x0 * d3_degrees, y0 * d3_degrees ]; - }; - interpolate.distance = d; - return interpolate; - } - d3.geo.length = function(object) { - d3_geo_lengthSum = 0; - d3.geo.stream(object, d3_geo_length); - return d3_geo_lengthSum; - }; - var d3_geo_lengthSum; - var d3_geo_length = { - sphere: d3_noop, - point: d3_noop, - lineStart: d3_geo_lengthLineStart, - lineEnd: d3_noop, - polygonStart: d3_noop, - polygonEnd: d3_noop - }; - function d3_geo_lengthLineStart() { - var λ0, sinφ0, cosφ0; - d3_geo_length.point = function(λ, φ) { - λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ); - d3_geo_length.point = nextPoint; - }; - d3_geo_length.lineEnd = function() { - d3_geo_length.point = d3_geo_length.lineEnd = d3_noop; - }; - function nextPoint(λ, φ) { - var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t); - d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ); - λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ; - } - } - function d3_geo_azimuthal(scale, angle) { - function azimuthal(λ, φ) { - var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ); - return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ]; - } - azimuthal.invert = function(x, y) { - var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c); - return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ]; - }; - return azimuthal; - } - var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) { - return Math.sqrt(2 / (1 + cosλcosφ)); - }, function(ρ) { - return 2 * Math.asin(ρ / 2); - }); - (d3.geo.azimuthalEqualArea = function() { - return d3_geo_projection(d3_geo_azimuthalEqualArea); - }).raw = d3_geo_azimuthalEqualArea; - var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) { - var c = Math.acos(cosλcosφ); - return c && c / Math.sin(c); - }, d3_identity); - (d3.geo.azimuthalEquidistant = function() { - return d3_geo_projection(d3_geo_azimuthalEquidistant); - }).raw = d3_geo_azimuthalEquidistant; - function d3_geo_conicConformal(φ0, φ1) { - var cosφ0 = Math.cos(φ0), t = function(φ) { - return Math.tan(π / 4 + φ / 2); - }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n; - if (!n) return d3_geo_mercator; - function forward(λ, φ) { - if (F > 0) { - if (φ < -halfπ + ε) φ = -halfπ + ε; - } else { - if (φ > halfπ - ε) φ = halfπ - ε; - } - var ρ = F / Math.pow(t(φ), n); - return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ]; - } - forward.invert = function(x, y) { - var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y); - return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ]; - }; - return forward; - } - (d3.geo.conicConformal = function() { - return d3_geo_conic(d3_geo_conicConformal); - }).raw = d3_geo_conicConformal; - function d3_geo_conicEquidistant(φ0, φ1) { - var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0; - if (abs(n) < ε) return d3_geo_equirectangular; - function forward(λ, φ) { - var ρ = G - φ; - return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ]; - } - forward.invert = function(x, y) { - var ρ0_y = G - y; - return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ]; - }; - return forward; - } - (d3.geo.conicEquidistant = function() { - return d3_geo_conic(d3_geo_conicEquidistant); - }).raw = d3_geo_conicEquidistant; - var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) { - return 1 / cosλcosφ; - }, Math.atan); - (d3.geo.gnomonic = function() { - return d3_geo_projection(d3_geo_gnomonic); - }).raw = d3_geo_gnomonic; - function d3_geo_mercator(λ, φ) { - return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ]; - } - d3_geo_mercator.invert = function(x, y) { - return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ]; - }; - function d3_geo_mercatorProjection(project) { - var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto; - m.scale = function() { - var v = scale.apply(m, arguments); - return v === m ? clipAuto ? m.clipExtent(null) : m : v; - }; - m.translate = function() { - var v = translate.apply(m, arguments); - return v === m ? clipAuto ? m.clipExtent(null) : m : v; - }; - m.clipExtent = function(_) { - var v = clipExtent.apply(m, arguments); - if (v === m) { - if (clipAuto = _ == null) { - var k = π * scale(), t = translate(); - clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]); - } - } else if (clipAuto) { - v = null; - } - return v; - }; - return m.clipExtent(null); - } - (d3.geo.mercator = function() { - return d3_geo_mercatorProjection(d3_geo_mercator); - }).raw = d3_geo_mercator; - var d3_geo_orthographic = d3_geo_azimuthal(function() { - return 1; - }, Math.asin); - (d3.geo.orthographic = function() { - return d3_geo_projection(d3_geo_orthographic); - }).raw = d3_geo_orthographic; - var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) { - return 1 / (1 + cosλcosφ); - }, function(ρ) { - return 2 * Math.atan(ρ); - }); - (d3.geo.stereographic = function() { - return d3_geo_projection(d3_geo_stereographic); - }).raw = d3_geo_stereographic; - function d3_geo_transverseMercator(λ, φ) { - return [ Math.log(Math.tan(π / 4 + φ / 2)), -λ ]; - } - d3_geo_transverseMercator.invert = function(x, y) { - return [ -y, 2 * Math.atan(Math.exp(x)) - halfπ ]; - }; - (d3.geo.transverseMercator = function() { - var projection = d3_geo_mercatorProjection(d3_geo_transverseMercator), center = projection.center, rotate = projection.rotate; - projection.center = function(_) { - return _ ? center([ -_[1], _[0] ]) : (_ = center(), [ -_[1], _[0] ]); - }; - projection.rotate = function(_) { - return _ ? rotate([ _[0], _[1], _.length > 2 ? _[2] + 90 : 90 ]) : (_ = rotate(), - [ _[0], _[1], _[2] - 90 ]); - }; - return projection.rotate([ 0, 0 ]); - }).raw = d3_geo_transverseMercator; - d3.geom = {}; - function d3_geom_pointX(d) { - return d[0]; - } - function d3_geom_pointY(d) { - return d[1]; - } - d3.geom.hull = function(vertices) { - var x = d3_geom_pointX, y = d3_geom_pointY; - if (arguments.length) return hull(vertices); - function hull(data) { - if (data.length < 3) return []; - var fx = d3_functor(x), fy = d3_functor(y), i, n = data.length, points = [], flippedPoints = []; - for (i = 0; i < n; i++) { - points.push([ +fx.call(this, data[i], i), +fy.call(this, data[i], i), i ]); - } - points.sort(d3_geom_hullOrder); - for (i = 0; i < n; i++) flippedPoints.push([ points[i][0], -points[i][1] ]); - var upper = d3_geom_hullUpper(points), lower = d3_geom_hullUpper(flippedPoints); - var skipLeft = lower[0] === upper[0], skipRight = lower[lower.length - 1] === upper[upper.length - 1], polygon = []; - for (i = upper.length - 1; i >= 0; --i) polygon.push(data[points[upper[i]][2]]); - for (i = +skipLeft; i < lower.length - skipRight; ++i) polygon.push(data[points[lower[i]][2]]); - return polygon; - } - hull.x = function(_) { - return arguments.length ? (x = _, hull) : x; - }; - hull.y = function(_) { - return arguments.length ? (y = _, hull) : y; - }; - return hull; - }; - function d3_geom_hullUpper(points) { - var n = points.length, hull = [ 0, 1 ], hs = 2; - for (var i = 2; i < n; i++) { - while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs; - hull[hs++] = i; - } - return hull.slice(0, hs); - } - function d3_geom_hullOrder(a, b) { - return a[0] - b[0] || a[1] - b[1]; - } - d3.geom.polygon = function(coordinates) { - d3_subclass(coordinates, d3_geom_polygonPrototype); - return coordinates; - }; - var d3_geom_polygonPrototype = d3.geom.polygon.prototype = []; - d3_geom_polygonPrototype.area = function() { - var i = -1, n = this.length, a, b = this[n - 1], area = 0; - while (++i < n) { - a = b; - b = this[i]; - area += a[1] * b[0] - a[0] * b[1]; - } - return area * .5; - }; - d3_geom_polygonPrototype.centroid = function(k) { - var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c; - if (!arguments.length) k = -1 / (6 * this.area()); - while (++i < n) { - a = b; - b = this[i]; - c = a[0] * b[1] - b[0] * a[1]; - x += (a[0] + b[0]) * c; - y += (a[1] + b[1]) * c; - } - return [ x * k, y * k ]; - }; - d3_geom_polygonPrototype.clip = function(subject) { - var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d; - while (++i < n) { - input = subject.slice(); - subject.length = 0; - b = this[i]; - c = input[(m = input.length - closed) - 1]; - j = -1; - while (++j < m) { - d = input[j]; - if (d3_geom_polygonInside(d, a, b)) { - if (!d3_geom_polygonInside(c, a, b)) { - subject.push(d3_geom_polygonIntersect(c, d, a, b)); - } - subject.push(d); - } else if (d3_geom_polygonInside(c, a, b)) { - subject.push(d3_geom_polygonIntersect(c, d, a, b)); - } - c = d; - } - if (closed) subject.push(subject[0]); - a = b; - } - return subject; - }; - function d3_geom_polygonInside(p, a, b) { - return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]); - } - function d3_geom_polygonIntersect(c, d, a, b) { - var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21); - return [ x1 + ua * x21, y1 + ua * y21 ]; - } - function d3_geom_polygonClosed(coordinates) { - var a = coordinates[0], b = coordinates[coordinates.length - 1]; - return !(a[0] - b[0] || a[1] - b[1]); - } - var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = []; - function d3_geom_voronoiBeach() { - d3_geom_voronoiRedBlackNode(this); - this.edge = this.site = this.circle = null; - } - function d3_geom_voronoiCreateBeach(site) { - var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach(); - beach.site = site; - return beach; - } - function d3_geom_voronoiDetachBeach(beach) { - d3_geom_voronoiDetachCircle(beach); - d3_geom_voronoiBeaches.remove(beach); - d3_geom_voronoiBeachPool.push(beach); - d3_geom_voronoiRedBlackNode(beach); - } - function d3_geom_voronoiRemoveBeach(beach) { - var circle = beach.circle, x = circle.x, y = circle.cy, vertex = { - x: x, - y: y - }, previous = beach.P, next = beach.N, disappearing = [ beach ]; - d3_geom_voronoiDetachBeach(beach); - var lArc = previous; - while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) { - previous = lArc.P; - disappearing.unshift(lArc); - d3_geom_voronoiDetachBeach(lArc); - lArc = previous; - } - disappearing.unshift(lArc); - d3_geom_voronoiDetachCircle(lArc); - var rArc = next; - while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) { - next = rArc.N; - disappearing.push(rArc); - d3_geom_voronoiDetachBeach(rArc); - rArc = next; - } - disappearing.push(rArc); - d3_geom_voronoiDetachCircle(rArc); - var nArcs = disappearing.length, iArc; - for (iArc = 1; iArc < nArcs; ++iArc) { - rArc = disappearing[iArc]; - lArc = disappearing[iArc - 1]; - d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); - } - lArc = disappearing[0]; - rArc = disappearing[nArcs - 1]; - rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex); - d3_geom_voronoiAttachCircle(lArc); - d3_geom_voronoiAttachCircle(rArc); - } - function d3_geom_voronoiAddBeach(site) { - var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._; - while (node) { - dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x; - if (dxl > ε) node = node.L; else { - dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix); - if (dxr > ε) { - if (!node.R) { - lArc = node; - break; - } - node = node.R; - } else { - if (dxl > -ε) { - lArc = node.P; - rArc = node; - } else if (dxr > -ε) { - lArc = node; - rArc = node.N; - } else { - lArc = rArc = node; - } - break; - } - } - } - var newArc = d3_geom_voronoiCreateBeach(site); - d3_geom_voronoiBeaches.insert(lArc, newArc); - if (!lArc && !rArc) return; - if (lArc === rArc) { - d3_geom_voronoiDetachCircle(lArc); - rArc = d3_geom_voronoiCreateBeach(lArc.site); - d3_geom_voronoiBeaches.insert(newArc, rArc); - newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); - d3_geom_voronoiAttachCircle(lArc); - d3_geom_voronoiAttachCircle(rArc); - return; - } - if (!rArc) { - newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site); - return; - } - d3_geom_voronoiDetachCircle(lArc); - d3_geom_voronoiDetachCircle(rArc); - var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = { - x: (cy * hb - by * hc) / d + ax, - y: (bx * hc - cx * hb) / d + ay - }; - d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex); - newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex); - rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex); - d3_geom_voronoiAttachCircle(lArc); - d3_geom_voronoiAttachCircle(rArc); - } - function d3_geom_voronoiLeftBreakPoint(arc, directrix) { - var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix; - if (!pby2) return rfocx; - var lArc = arc.P; - if (!lArc) return -Infinity; - site = lArc.site; - var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix; - if (!plby2) return lfocx; - var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2; - if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; - return (rfocx + lfocx) / 2; - } - function d3_geom_voronoiRightBreakPoint(arc, directrix) { - var rArc = arc.N; - if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix); - var site = arc.site; - return site.y === directrix ? site.x : Infinity; - } - function d3_geom_voronoiCell(site) { - this.site = site; - this.edges = []; - } - d3_geom_voronoiCell.prototype.prepare = function() { - var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge; - while (iHalfEdge--) { - edge = halfEdges[iHalfEdge].edge; - if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1); - } - halfEdges.sort(d3_geom_voronoiHalfEdgeOrder); - return halfEdges.length; - }; - function d3_geom_voronoiCloseCells(extent) { - var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end; - while (iCell--) { - cell = cells[iCell]; - if (!cell || !cell.prepare()) continue; - halfEdges = cell.edges; - nHalfEdges = halfEdges.length; - iHalfEdge = 0; - while (iHalfEdge < nHalfEdges) { - end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y; - start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y; - if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) { - halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? { - x: x0, - y: abs(x2 - x0) < ε ? y2 : y1 - } : abs(y3 - y1) < ε && x1 - x3 > ε ? { - x: abs(y2 - y1) < ε ? x2 : x1, - y: y1 - } : abs(x3 - x1) < ε && y3 - y0 > ε ? { - x: x1, - y: abs(x2 - x1) < ε ? y2 : y0 - } : abs(y3 - y0) < ε && x3 - x0 > ε ? { - x: abs(y2 - y0) < ε ? x2 : x0, - y: y0 - } : null), cell.site, null)); - ++nHalfEdges; - } - } - } - } - function d3_geom_voronoiHalfEdgeOrder(a, b) { - return b.angle - a.angle; - } - function d3_geom_voronoiCircle() { - d3_geom_voronoiRedBlackNode(this); - this.x = this.y = this.arc = this.site = this.cy = null; - } - function d3_geom_voronoiAttachCircle(arc) { - var lArc = arc.P, rArc = arc.N; - if (!lArc || !rArc) return; - var lSite = lArc.site, cSite = arc.site, rSite = rArc.site; - if (lSite === rSite) return; - var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by; - var d = 2 * (ax * cy - ay * cx); - if (d >= -ε2) return; - var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by; - var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle(); - circle.arc = arc; - circle.site = cSite; - circle.x = x + bx; - circle.y = cy + Math.sqrt(x * x + y * y); - circle.cy = cy; - arc.circle = circle; - var before = null, node = d3_geom_voronoiCircles._; - while (node) { - if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) { - if (node.L) node = node.L; else { - before = node.P; - break; - } - } else { - if (node.R) node = node.R; else { - before = node; - break; - } - } - } - d3_geom_voronoiCircles.insert(before, circle); - if (!before) d3_geom_voronoiFirstCircle = circle; - } - function d3_geom_voronoiDetachCircle(arc) { - var circle = arc.circle; - if (circle) { - if (!circle.P) d3_geom_voronoiFirstCircle = circle.N; - d3_geom_voronoiCircles.remove(circle); - d3_geom_voronoiCirclePool.push(circle); - d3_geom_voronoiRedBlackNode(circle); - arc.circle = null; - } - } - function d3_geom_voronoiClipEdges(extent) { - var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e; - while (i--) { - e = edges[i]; - if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) { - e.a = e.b = null; - edges.splice(i, 1); - } - } - } - function d3_geom_voronoiConnectEdge(edge, extent) { - var vb = edge.b; - if (vb) return true; - var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb; - if (ry === ly) { - if (fx < x0 || fx >= x1) return; - if (lx > rx) { - if (!va) va = { - x: fx, - y: y0 - }; else if (va.y >= y1) return; - vb = { - x: fx, - y: y1 - }; - } else { - if (!va) va = { - x: fx, - y: y1 - }; else if (va.y < y0) return; - vb = { - x: fx, - y: y0 - }; - } - } else { - fm = (lx - rx) / (ry - ly); - fb = fy - fm * fx; - if (fm < -1 || fm > 1) { - if (lx > rx) { - if (!va) va = { - x: (y0 - fb) / fm, - y: y0 - }; else if (va.y >= y1) return; - vb = { - x: (y1 - fb) / fm, - y: y1 - }; - } else { - if (!va) va = { - x: (y1 - fb) / fm, - y: y1 - }; else if (va.y < y0) return; - vb = { - x: (y0 - fb) / fm, - y: y0 - }; - } - } else { - if (ly < ry) { - if (!va) va = { - x: x0, - y: fm * x0 + fb - }; else if (va.x >= x1) return; - vb = { - x: x1, - y: fm * x1 + fb - }; - } else { - if (!va) va = { - x: x1, - y: fm * x1 + fb - }; else if (va.x < x0) return; - vb = { - x: x0, - y: fm * x0 + fb - }; - } - } - } - edge.a = va; - edge.b = vb; - return true; - } - function d3_geom_voronoiEdge(lSite, rSite) { - this.l = lSite; - this.r = rSite; - this.a = this.b = null; - } - function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) { - var edge = new d3_geom_voronoiEdge(lSite, rSite); - d3_geom_voronoiEdges.push(edge); - if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va); - if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb); - d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite)); - d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite)); - return edge; - } - function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) { - var edge = new d3_geom_voronoiEdge(lSite, null); - edge.a = va; - edge.b = vb; - d3_geom_voronoiEdges.push(edge); - return edge; - } - function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) { - if (!edge.a && !edge.b) { - edge.a = vertex; - edge.l = lSite; - edge.r = rSite; - } else if (edge.l === rSite) { - edge.b = vertex; - } else { - edge.a = vertex; - } - } - function d3_geom_voronoiHalfEdge(edge, lSite, rSite) { - var va = edge.a, vb = edge.b; - this.edge = edge; - this.site = lSite; - this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y); - } - d3_geom_voronoiHalfEdge.prototype = { - start: function() { - return this.edge.l === this.site ? this.edge.a : this.edge.b; - }, - end: function() { - return this.edge.l === this.site ? this.edge.b : this.edge.a; - } - }; - function d3_geom_voronoiRedBlackTree() { - this._ = null; - } - function d3_geom_voronoiRedBlackNode(node) { - node.U = node.C = node.L = node.R = node.P = node.N = null; - } - d3_geom_voronoiRedBlackTree.prototype = { - insert: function(after, node) { - var parent, grandpa, uncle; - if (after) { - node.P = after; - node.N = after.N; - if (after.N) after.N.P = node; - after.N = node; - if (after.R) { - after = after.R; - while (after.L) after = after.L; - after.L = node; - } else { - after.R = node; - } - parent = after; - } else if (this._) { - after = d3_geom_voronoiRedBlackFirst(this._); - node.P = null; - node.N = after; - after.P = after.L = node; - parent = after; - } else { - node.P = node.N = null; - this._ = node; - parent = null; - } - node.L = node.R = null; - node.U = parent; - node.C = true; - after = node; - while (parent && parent.C) { - grandpa = parent.U; - if (parent === grandpa.L) { - uncle = grandpa.R; - if (uncle && uncle.C) { - parent.C = uncle.C = false; - grandpa.C = true; - after = grandpa; - } else { - if (after === parent.R) { - d3_geom_voronoiRedBlackRotateLeft(this, parent); - after = parent; - parent = after.U; - } - parent.C = false; - grandpa.C = true; - d3_geom_voronoiRedBlackRotateRight(this, grandpa); - } - } else { - uncle = grandpa.L; - if (uncle && uncle.C) { - parent.C = uncle.C = false; - grandpa.C = true; - after = grandpa; - } else { - if (after === parent.L) { - d3_geom_voronoiRedBlackRotateRight(this, parent); - after = parent; - parent = after.U; - } - parent.C = false; - grandpa.C = true; - d3_geom_voronoiRedBlackRotateLeft(this, grandpa); - } - } - parent = after.U; - } - this._.C = false; - }, - remove: function(node) { - if (node.N) node.N.P = node.P; - if (node.P) node.P.N = node.N; - node.N = node.P = null; - var parent = node.U, sibling, left = node.L, right = node.R, next, red; - if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right); - if (parent) { - if (parent.L === node) parent.L = next; else parent.R = next; - } else { - this._ = next; - } - if (left && right) { - red = next.C; - next.C = node.C; - next.L = left; - left.U = next; - if (next !== right) { - parent = next.U; - next.U = node.U; - node = next.R; - parent.L = node; - next.R = right; - right.U = next; - } else { - next.U = parent; - parent = next; - node = next.R; - } - } else { - red = node.C; - node = next; - } - if (node) node.U = parent; - if (red) return; - if (node && node.C) { - node.C = false; - return; - } - do { - if (node === this._) break; - if (node === parent.L) { - sibling = parent.R; - if (sibling.C) { - sibling.C = false; - parent.C = true; - d3_geom_voronoiRedBlackRotateLeft(this, parent); - sibling = parent.R; - } - if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { - if (!sibling.R || !sibling.R.C) { - sibling.L.C = false; - sibling.C = true; - d3_geom_voronoiRedBlackRotateRight(this, sibling); - sibling = parent.R; - } - sibling.C = parent.C; - parent.C = sibling.R.C = false; - d3_geom_voronoiRedBlackRotateLeft(this, parent); - node = this._; - break; - } - } else { - sibling = parent.L; - if (sibling.C) { - sibling.C = false; - parent.C = true; - d3_geom_voronoiRedBlackRotateRight(this, parent); - sibling = parent.L; - } - if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) { - if (!sibling.L || !sibling.L.C) { - sibling.R.C = false; - sibling.C = true; - d3_geom_voronoiRedBlackRotateLeft(this, sibling); - sibling = parent.L; - } - sibling.C = parent.C; - parent.C = sibling.L.C = false; - d3_geom_voronoiRedBlackRotateRight(this, parent); - node = this._; - break; - } - } - sibling.C = true; - node = parent; - parent = parent.U; - } while (!node.C); - if (node) node.C = false; - } - }; - function d3_geom_voronoiRedBlackRotateLeft(tree, node) { - var p = node, q = node.R, parent = p.U; - if (parent) { - if (parent.L === p) parent.L = q; else parent.R = q; - } else { - tree._ = q; - } - q.U = parent; - p.U = q; - p.R = q.L; - if (p.R) p.R.U = p; - q.L = p; - } - function d3_geom_voronoiRedBlackRotateRight(tree, node) { - var p = node, q = node.L, parent = p.U; - if (parent) { - if (parent.L === p) parent.L = q; else parent.R = q; - } else { - tree._ = q; - } - q.U = parent; - p.U = q; - p.L = q.R; - if (p.L) p.L.U = p; - q.R = p; - } - function d3_geom_voronoiRedBlackFirst(node) { - while (node.L) node = node.L; - return node; - } - function d3_geom_voronoi(sites, bbox) { - var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle; - d3_geom_voronoiEdges = []; - d3_geom_voronoiCells = new Array(sites.length); - d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree(); - d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree(); - while (true) { - circle = d3_geom_voronoiFirstCircle; - if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) { - if (site.x !== x0 || site.y !== y0) { - d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); - d3_geom_voronoiAddBeach(site); - x0 = site.x, y0 = site.y; - } - site = sites.pop(); - } else if (circle) { - d3_geom_voronoiRemoveBeach(circle.arc); - } else { - break; - } - } - if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox); - var diagram = { - cells: d3_geom_voronoiCells, - edges: d3_geom_voronoiEdges - }; - d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null; - return diagram; - } - function d3_geom_voronoiVertexOrder(a, b) { - return b.y - a.y || b.x - a.x; - } - d3.geom.voronoi = function(points) { - var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent; - if (points) return voronoi(points); - function voronoi(data) { - var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1]; - d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) { - var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) { - var s = e.start(); - return [ s.x, s.y ]; - }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : []; - polygon.point = data[i]; - }); - return polygons; - } - function sites(data) { - return data.map(function(d, i) { - return { - x: Math.round(fx(d, i) / ε) * ε, - y: Math.round(fy(d, i) / ε) * ε, - i: i - }; - }); - } - voronoi.links = function(data) { - return d3_geom_voronoi(sites(data)).edges.filter(function(edge) { - return edge.l && edge.r; - }).map(function(edge) { - return { - source: data[edge.l.i], - target: data[edge.r.i] - }; - }); - }; - voronoi.triangles = function(data) { - var triangles = []; - d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) { - var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l; - while (++j < m) { - e0 = e1; - s0 = s1; - e1 = edges[j].edge; - s1 = e1.l === site ? e1.r : e1.l; - if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) { - triangles.push([ data[i], data[s0.i], data[s1.i] ]); - } - } - }); - return triangles; - }; - voronoi.x = function(_) { - return arguments.length ? (fx = d3_functor(x = _), voronoi) : x; - }; - voronoi.y = function(_) { - return arguments.length ? (fy = d3_functor(y = _), voronoi) : y; - }; - voronoi.clipExtent = function(_) { - if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent; - clipExtent = _ == null ? d3_geom_voronoiClipExtent : _; - return voronoi; - }; - voronoi.size = function(_) { - if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1]; - return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]); - }; - return voronoi; - }; - var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ]; - function d3_geom_voronoiTriangleArea(a, b, c) { - return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y); - } - d3.geom.delaunay = function(vertices) { - return d3.geom.voronoi().triangles(vertices); - }; - d3.geom.quadtree = function(points, x1, y1, x2, y2) { - var x = d3_geom_pointX, y = d3_geom_pointY, compat; - if (compat = arguments.length) { - x = d3_geom_quadtreeCompatX; - y = d3_geom_quadtreeCompatY; - if (compat === 3) { - y2 = y1; - x2 = x1; - y1 = x1 = 0; - } - return quadtree(points); - } - function quadtree(data) { - var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_; - if (x1 != null) { - x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2; - } else { - x2_ = y2_ = -(x1_ = y1_ = Infinity); - xs = [], ys = []; - n = data.length; - if (compat) for (i = 0; i < n; ++i) { - d = data[i]; - if (d.x < x1_) x1_ = d.x; - if (d.y < y1_) y1_ = d.y; - if (d.x > x2_) x2_ = d.x; - if (d.y > y2_) y2_ = d.y; - xs.push(d.x); - ys.push(d.y); - } else for (i = 0; i < n; ++i) { - var x_ = +fx(d = data[i], i), y_ = +fy(d, i); - if (x_ < x1_) x1_ = x_; - if (y_ < y1_) y1_ = y_; - if (x_ > x2_) x2_ = x_; - if (y_ > y2_) y2_ = y_; - xs.push(x_); - ys.push(y_); - } - } - var dx = x2_ - x1_, dy = y2_ - y1_; - if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; - function insert(n, d, x, y, x1, y1, x2, y2) { - if (isNaN(x) || isNaN(y)) return; - if (n.leaf) { - var nx = n.x, ny = n.y; - if (nx != null) { - if (abs(nx - x) + abs(ny - y) < .01) { - insertChild(n, d, x, y, x1, y1, x2, y2); - } else { - var nPoint = n.point; - n.x = n.y = n.point = null; - insertChild(n, nPoint, nx, ny, x1, y1, x2, y2); - insertChild(n, d, x, y, x1, y1, x2, y2); - } - } else { - n.x = x, n.y = y, n.point = d; - } - } else { - insertChild(n, d, x, y, x1, y1, x2, y2); - } - } - function insertChild(n, d, x, y, x1, y1, x2, y2) { - var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right; - n.leaf = false; - n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode()); - if (right) x1 = sx; else x2 = sx; - if (bottom) y1 = sy; else y2 = sy; - insert(n, d, x, y, x1, y1, x2, y2); - } - var root = d3_geom_quadtreeNode(); - root.add = function(d) { - insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_); - }; - root.visit = function(f) { - d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); - }; - i = -1; - if (x1 == null) { - while (++i < n) { - insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_); - } - --i; - } else data.forEach(root.add); - xs = ys = data = d = null; - return root; - } - quadtree.x = function(_) { - return arguments.length ? (x = _, quadtree) : x; - }; - quadtree.y = function(_) { - return arguments.length ? (y = _, quadtree) : y; - }; - quadtree.extent = function(_) { - if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ]; - if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], - y2 = +_[1][1]; - return quadtree; - }; - quadtree.size = function(_) { - if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ]; - if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1]; - return quadtree; - }; - return quadtree; - }; - function d3_geom_quadtreeCompatX(d) { - return d.x; - } - function d3_geom_quadtreeCompatY(d) { - return d.y; - } - function d3_geom_quadtreeNode() { - return { - leaf: true, - nodes: [], - point: null, - x: null, - y: null - }; - } - function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) { - if (!f(node, x1, y1, x2, y2)) { - var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes; - if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy); - if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy); - if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2); - if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); - } - } - d3.interpolateRgb = d3_interpolateRgb; - function d3_interpolateRgb(a, b) { - a = d3.rgb(a); - b = d3.rgb(b); - var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab; - return function(t) { - return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t)); - }; - } - d3.interpolateObject = d3_interpolateObject; - function d3_interpolateObject(a, b) { - var i = {}, c = {}, k; - for (k in a) { - if (k in b) { - i[k] = d3_interpolate(a[k], b[k]); - } else { - c[k] = a[k]; - } - } - for (k in b) { - if (!(k in a)) { - c[k] = b[k]; - } - } - return function(t) { - for (k in i) c[k] = i[k](t); - return c; - }; - } - d3.interpolateNumber = d3_interpolateNumber; - function d3_interpolateNumber(a, b) { - b -= a = +a; - return function(t) { - return a + b * t; - }; - } - d3.interpolateString = d3_interpolateString; - function d3_interpolateString(a, b) { - var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o; - a = a + "", b = b + ""; - d3_interpolate_number.lastIndex = 0; - for (i = 0; m = d3_interpolate_number.exec(b); ++i) { - if (m.index) s.push(b.substring(s0, s1 = m.index)); - q.push({ - i: s.length, - x: m[0] - }); - s.push(null); - s0 = d3_interpolate_number.lastIndex; - } - if (s0 < b.length) s.push(b.substring(s0)); - for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) { - o = q[i]; - if (o.x == m[0]) { - if (o.i) { - if (s[o.i + 1] == null) { - s[o.i - 1] += o.x; - s.splice(o.i, 1); - for (j = i + 1; j < n; ++j) q[j].i--; - } else { - s[o.i - 1] += o.x + s[o.i + 1]; - s.splice(o.i, 2); - for (j = i + 1; j < n; ++j) q[j].i -= 2; - } - } else { - if (s[o.i + 1] == null) { - s[o.i] = o.x; - } else { - s[o.i] = o.x + s[o.i + 1]; - s.splice(o.i + 1, 1); - for (j = i + 1; j < n; ++j) q[j].i--; - } - } - q.splice(i, 1); - n--; - i--; - } else { - o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x)); - } - } - while (i < n) { - o = q.pop(); - if (s[o.i + 1] == null) { - s[o.i] = o.x; - } else { - s[o.i] = o.x + s[o.i + 1]; - s.splice(o.i + 1, 1); - } - n--; - } - if (s.length === 1) { - return s[0] == null ? (o = q[0].x, function(t) { - return o(t) + ""; - }) : function() { - return b; - }; - } - return function(t) { - for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - } - var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; - d3.interpolate = d3_interpolate; - function d3_interpolate(a, b) { - var i = d3.interpolators.length, f; - while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ; - return f; - } - d3.interpolators = [ function(a, b) { - var t = typeof b; - return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b); - } ]; - d3.interpolateArray = d3_interpolateArray; - function d3_interpolateArray(a, b) { - var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i; - for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i])); - for (;i < na; ++i) c[i] = a[i]; - for (;i < nb; ++i) c[i] = b[i]; - return function(t) { - for (i = 0; i < n0; ++i) c[i] = x[i](t); - return c; - }; - } - var d3_ease_default = function() { - return d3_identity; - }; - var d3_ease = d3.map({ - linear: d3_ease_default, - poly: d3_ease_poly, - quad: function() { - return d3_ease_quad; - }, - cubic: function() { - return d3_ease_cubic; - }, - sin: function() { - return d3_ease_sin; - }, - exp: function() { - return d3_ease_exp; - }, - circle: function() { - return d3_ease_circle; - }, - elastic: d3_ease_elastic, - back: d3_ease_back, - bounce: function() { - return d3_ease_bounce; - } - }); - var d3_ease_mode = d3.map({ - "in": d3_identity, - out: d3_ease_reverse, - "in-out": d3_ease_reflect, - "out-in": function(f) { - return d3_ease_reflect(d3_ease_reverse(f)); - } - }); - d3.ease = function(name) { - var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in"; - t = d3_ease.get(t) || d3_ease_default; - m = d3_ease_mode.get(m) || d3_identity; - return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1)))); - }; - function d3_ease_clamp(f) { - return function(t) { - return t <= 0 ? 0 : t >= 1 ? 1 : f(t); - }; - } - function d3_ease_reverse(f) { - return function(t) { - return 1 - f(1 - t); - }; - } - function d3_ease_reflect(f) { - return function(t) { - return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t)); - }; - } - function d3_ease_quad(t) { - return t * t; - } - function d3_ease_cubic(t) { - return t * t * t; - } - function d3_ease_cubicInOut(t) { - if (t <= 0) return 0; - if (t >= 1) return 1; - var t2 = t * t, t3 = t2 * t; - return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75); - } - function d3_ease_poly(e) { - return function(t) { - return Math.pow(t, e); - }; - } - function d3_ease_sin(t) { - return 1 - Math.cos(t * halfπ); - } - function d3_ease_exp(t) { - return Math.pow(2, 10 * (t - 1)); - } - function d3_ease_circle(t) { - return 1 - Math.sqrt(1 - t * t); - } - function d3_ease_elastic(a, p) { - var s; - if (arguments.length < 2) p = .45; - if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4; - return function(t) { - return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p); - }; - } - function d3_ease_back(s) { - if (!s) s = 1.70158; - return function(t) { - return t * t * ((s + 1) * t - s); - }; - } - function d3_ease_bounce(t) { - return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375; - } - d3.interpolateHcl = d3_interpolateHcl; - function d3_interpolateHcl(a, b) { - a = d3.hcl(a); - b = d3.hcl(b); - var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al; - if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac; - if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; - return function(t) { - return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + ""; - }; - } - d3.interpolateHsl = d3_interpolateHsl; - function d3_interpolateHsl(a, b) { - a = d3.hsl(a); - b = d3.hsl(b); - var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al; - if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as; - if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360; - return function(t) { - return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + ""; - }; - } - d3.interpolateLab = d3_interpolateLab; - function d3_interpolateLab(a, b) { - a = d3.lab(a); - b = d3.lab(b); - var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab; - return function(t) { - return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + ""; - }; - } - d3.interpolateRound = d3_interpolateRound; - function d3_interpolateRound(a, b) { - b -= a; - return function(t) { - return Math.round(a + b * t); - }; - } - d3.transform = function(string) { - var g = d3_document.createElementNS(d3.ns.prefix.svg, "g"); - return (d3.transform = function(string) { - if (string != null) { - g.setAttribute("transform", string); - var t = g.transform.baseVal.consolidate(); - } - return new d3_transform(t ? t.matrix : d3_transformIdentity); - })(string); - }; - function d3_transform(m) { - var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0; - if (r0[0] * r1[1] < r1[0] * r0[1]) { - r0[0] *= -1; - r0[1] *= -1; - kx *= -1; - kz *= -1; - } - this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees; - this.translate = [ m.e, m.f ]; - this.scale = [ kx, ky ]; - this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0; - } - d3_transform.prototype.toString = function() { - return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")"; - }; - function d3_transformDot(a, b) { - return a[0] * b[0] + a[1] * b[1]; - } - function d3_transformNormalize(a) { - var k = Math.sqrt(d3_transformDot(a, a)); - if (k) { - a[0] /= k; - a[1] /= k; - } - return k; - } - function d3_transformCombine(a, b, k) { - a[0] += k * b[0]; - a[1] += k * b[1]; - return a; - } - var d3_transformIdentity = { - a: 1, - b: 0, - c: 0, - d: 1, - e: 0, - f: 0 - }; - d3.interpolateTransform = d3_interpolateTransform; - function d3_interpolateTransform(a, b) { - var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale; - if (ta[0] != tb[0] || ta[1] != tb[1]) { - s.push("translate(", null, ",", null, ")"); - q.push({ - i: 1, - x: d3_interpolateNumber(ta[0], tb[0]) - }, { - i: 3, - x: d3_interpolateNumber(ta[1], tb[1]) - }); - } else if (tb[0] || tb[1]) { - s.push("translate(" + tb + ")"); - } else { - s.push(""); - } - if (ra != rb) { - if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; - q.push({ - i: s.push(s.pop() + "rotate(", null, ")") - 2, - x: d3_interpolateNumber(ra, rb) - }); - } else if (rb) { - s.push(s.pop() + "rotate(" + rb + ")"); - } - if (wa != wb) { - q.push({ - i: s.push(s.pop() + "skewX(", null, ")") - 2, - x: d3_interpolateNumber(wa, wb) - }); - } else if (wb) { - s.push(s.pop() + "skewX(" + wb + ")"); - } - if (ka[0] != kb[0] || ka[1] != kb[1]) { - n = s.push(s.pop() + "scale(", null, ",", null, ")"); - q.push({ - i: n - 4, - x: d3_interpolateNumber(ka[0], kb[0]) - }, { - i: n - 2, - x: d3_interpolateNumber(ka[1], kb[1]) - }); - } else if (kb[0] != 1 || kb[1] != 1) { - s.push(s.pop() + "scale(" + kb + ")"); - } - n = q.length; - return function(t) { - var i = -1, o; - while (++i < n) s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - } - function d3_uninterpolateNumber(a, b) { - b = b - (a = +a) ? 1 / (b - a) : 0; - return function(x) { - return (x - a) * b; - }; - } - function d3_uninterpolateClamp(a, b) { - b = b - (a = +a) ? 1 / (b - a) : 0; - return function(x) { - return Math.max(0, Math.min(1, (x - a) * b)); - }; - } - d3.layout = {}; - d3.layout.bundle = function() { - return function(links) { - var paths = [], i = -1, n = links.length; - while (++i < n) paths.push(d3_layout_bundlePath(links[i])); - return paths; - }; - }; - function d3_layout_bundlePath(link) { - var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ]; - while (start !== lca) { - start = start.parent; - points.push(start); - } - var k = points.length; - while (end !== lca) { - points.splice(k, 0, end); - end = end.parent; - } - return points; - } - function d3_layout_bundleAncestors(node) { - var ancestors = [], parent = node.parent; - while (parent != null) { - ancestors.push(node); - node = parent; - parent = parent.parent; - } - ancestors.push(node); - return ancestors; - } - function d3_layout_bundleLeastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null; - while (aNode === bNode) { - sharedNode = aNode; - aNode = aNodes.pop(); - bNode = bNodes.pop(); - } - return sharedNode; - } - d3.layout.chord = function() { - var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords; - function relayout() { - var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j; - chords = []; - groups = []; - k = 0, i = -1; - while (++i < n) { - x = 0, j = -1; - while (++j < n) { - x += matrix[i][j]; - } - groupSums.push(x); - subgroupIndex.push(d3.range(n)); - k += x; - } - if (sortGroups) { - groupIndex.sort(function(a, b) { - return sortGroups(groupSums[a], groupSums[b]); - }); - } - if (sortSubgroups) { - subgroupIndex.forEach(function(d, i) { - d.sort(function(a, b) { - return sortSubgroups(matrix[i][a], matrix[i][b]); - }); - }); - } - k = (τ - padding * n) / k; - x = 0, i = -1; - while (++i < n) { - x0 = x, j = -1; - while (++j < n) { - var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k; - subgroups[di + "-" + dj] = { - index: di, - subindex: dj, - startAngle: a0, - endAngle: a1, - value: v - }; - } - groups[di] = { - index: di, - startAngle: x0, - endAngle: x, - value: (x - x0) / k - }; - x += padding; - } - i = -1; - while (++i < n) { - j = i - 1; - while (++j < n) { - var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i]; - if (source.value || target.value) { - chords.push(source.value < target.value ? { - source: target, - target: source - } : { - source: source, - target: target - }); - } - } - } - if (sortChords) resort(); - } - function resort() { - chords.sort(function(a, b) { - return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2); - }); - } - chord.matrix = function(x) { - if (!arguments.length) return matrix; - n = (matrix = x) && matrix.length; - chords = groups = null; - return chord; - }; - chord.padding = function(x) { - if (!arguments.length) return padding; - padding = x; - chords = groups = null; - return chord; - }; - chord.sortGroups = function(x) { - if (!arguments.length) return sortGroups; - sortGroups = x; - chords = groups = null; - return chord; - }; - chord.sortSubgroups = function(x) { - if (!arguments.length) return sortSubgroups; - sortSubgroups = x; - chords = null; - return chord; - }; - chord.sortChords = function(x) { - if (!arguments.length) return sortChords; - sortChords = x; - if (chords) resort(); - return chord; - }; - chord.chords = function() { - if (!chords) relayout(); - return chords; - }; - chord.groups = function() { - if (!groups) relayout(); - return groups; - }; - return chord; - }; - d3.layout.force = function() { - var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges; - function repulse(node) { - return function(quad, x1, _, x2) { - if (quad.point !== node) { - var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x1, dn = dx * dx + dy * dy; - if (dw * dw / theta2 < dn) { - if (dn < chargeDistance2) { - var k = quad.charge / dn; - node.px -= dx * k; - node.py -= dy * k; - } - return true; - } - if (quad.point && dn && dn < chargeDistance2) { - var k = quad.pointCharge / dn; - node.px -= dx * k; - node.py -= dy * k; - } - } - return !quad.charge; - }; - } - force.tick = function() { - if ((alpha *= .99) < .005) { - event.end({ - type: "end", - alpha: alpha = 0 - }); - return true; - } - var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y; - for (i = 0; i < m; ++i) { - o = links[i]; - s = o.source; - t = o.target; - x = t.x - s.x; - y = t.y - s.y; - if (l = x * x + y * y) { - l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l; - x *= l; - y *= l; - t.x -= x * (k = s.weight / (t.weight + s.weight)); - t.y -= y * k; - s.x += x * (k = 1 - k); - s.y += y * k; - } - } - if (k = alpha * gravity) { - x = size[0] / 2; - y = size[1] / 2; - i = -1; - if (k) while (++i < n) { - o = nodes[i]; - o.x += (x - o.x) * k; - o.y += (y - o.y) * k; - } - } - if (charge) { - d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges); - i = -1; - while (++i < n) { - if (!(o = nodes[i]).fixed) { - q.visit(repulse(o)); - } - } - } - i = -1; - while (++i < n) { - o = nodes[i]; - if (o.fixed) { - o.x = o.px; - o.y = o.py; - } else { - o.x -= (o.px - (o.px = o.x)) * friction; - o.y -= (o.py - (o.py = o.y)) * friction; - } - } - event.tick({ - type: "tick", - alpha: alpha - }); - }; - force.nodes = function(x) { - if (!arguments.length) return nodes; - nodes = x; - return force; - }; - force.links = function(x) { - if (!arguments.length) return links; - links = x; - return force; - }; - force.size = function(x) { - if (!arguments.length) return size; - size = x; - return force; - }; - force.linkDistance = function(x) { - if (!arguments.length) return linkDistance; - linkDistance = typeof x === "function" ? x : +x; - return force; - }; - force.distance = force.linkDistance; - force.linkStrength = function(x) { - if (!arguments.length) return linkStrength; - linkStrength = typeof x === "function" ? x : +x; - return force; - }; - force.friction = function(x) { - if (!arguments.length) return friction; - friction = +x; - return force; - }; - force.charge = function(x) { - if (!arguments.length) return charge; - charge = typeof x === "function" ? x : +x; - return force; - }; - force.chargeDistance = function(x) { - if (!arguments.length) return Math.sqrt(chargeDistance2); - chargeDistance2 = x * x; - return force; - }; - force.gravity = function(x) { - if (!arguments.length) return gravity; - gravity = +x; - return force; - }; - force.theta = function(x) { - if (!arguments.length) return Math.sqrt(theta2); - theta2 = x * x; - return force; - }; - force.alpha = function(x) { - if (!arguments.length) return alpha; - x = +x; - if (alpha) { - if (x > 0) alpha = x; else alpha = 0; - } else if (x > 0) { - event.start({ - type: "start", - alpha: alpha = x - }); - d3.timer(force.tick); - } - return force; - }; - force.start = function() { - var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o; - for (i = 0; i < n; ++i) { - (o = nodes[i]).index = i; - o.weight = 0; - } - for (i = 0; i < m; ++i) { - o = links[i]; - if (typeof o.source == "number") o.source = nodes[o.source]; - if (typeof o.target == "number") o.target = nodes[o.target]; - ++o.source.weight; - ++o.target.weight; - } - for (i = 0; i < n; ++i) { - o = nodes[i]; - if (isNaN(o.x)) o.x = position("x", w); - if (isNaN(o.y)) o.y = position("y", h); - if (isNaN(o.px)) o.px = o.x; - if (isNaN(o.py)) o.py = o.y; - } - distances = []; - if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance; - strengths = []; - if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength; - charges = []; - if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; - function position(dimension, size) { - if (!neighbors) { - neighbors = new Array(n); - for (j = 0; j < n; ++j) { - neighbors[j] = []; - } - for (j = 0; j < m; ++j) { - var o = links[j]; - neighbors[o.source.index].push(o.target); - neighbors[o.target.index].push(o.source); - } - } - var candidates = neighbors[i], j = -1, m = candidates.length, x; - while (++j < m) if (!isNaN(x = candidates[j][dimension])) return x; - return Math.random() * size; - } - return force.resume(); - }; - force.resume = function() { - return force.alpha(.1); - }; - force.stop = function() { - return force.alpha(0); - }; - force.drag = function() { - if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend); - if (!arguments.length) return drag; - this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag); - }; - function dragmove(d) { - d.px = d3.event.x, d.py = d3.event.y; - force.resume(); - } - return d3.rebind(force, event, "on"); - }; - function d3_layout_forceDragstart(d) { - d.fixed |= 2; - } - function d3_layout_forceDragend(d) { - d.fixed &= ~6; - } - function d3_layout_forceMouseover(d) { - d.fixed |= 4; - d.px = d.x, d.py = d.y; - } - function d3_layout_forceMouseout(d) { - d.fixed &= ~4; - } - function d3_layout_forceAccumulate(quad, alpha, charges) { - var cx = 0, cy = 0; - quad.charge = 0; - if (!quad.leaf) { - var nodes = quad.nodes, n = nodes.length, i = -1, c; - while (++i < n) { - c = nodes[i]; - if (c == null) continue; - d3_layout_forceAccumulate(c, alpha, charges); - quad.charge += c.charge; - cx += c.charge * c.cx; - cy += c.charge * c.cy; - } - } - if (quad.point) { - if (!quad.leaf) { - quad.point.x += Math.random() - .5; - quad.point.y += Math.random() - .5; - } - var k = alpha * charges[quad.point.index]; - quad.charge += quad.pointCharge = k; - cx += k * quad.point.x; - cy += k * quad.point.y; - } - quad.cx = cx / quad.charge; - quad.cy = cy / quad.charge; - } - var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1, d3_layout_forceChargeDistance2 = Infinity; - d3.layout.hierarchy = function() { - var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue; - function recurse(node, depth, nodes) { - var childs = children.call(hierarchy, node, depth); - node.depth = depth; - nodes.push(node); - if (childs && (n = childs.length)) { - var i = -1, n, c = node.children = new Array(n), v = 0, j = depth + 1, d; - while (++i < n) { - d = c[i] = recurse(childs[i], j, nodes); - d.parent = node; - v += d.value; - } - if (sort) c.sort(sort); - if (value) node.value = v; - } else { - delete node.children; - if (value) { - node.value = +value.call(hierarchy, node, depth) || 0; - } - } - return node; - } - function revalue(node, depth) { - var children = node.children, v = 0; - if (children && (n = children.length)) { - var i = -1, n, j = depth + 1; - while (++i < n) v += revalue(children[i], j); - } else if (value) { - v = +value.call(hierarchy, node, depth) || 0; - } - if (value) node.value = v; - return v; - } - function hierarchy(d) { - var nodes = []; - recurse(d, 0, nodes); - return nodes; - } - hierarchy.sort = function(x) { - if (!arguments.length) return sort; - sort = x; - return hierarchy; - }; - hierarchy.children = function(x) { - if (!arguments.length) return children; - children = x; - return hierarchy; - }; - hierarchy.value = function(x) { - if (!arguments.length) return value; - value = x; - return hierarchy; - }; - hierarchy.revalue = function(root) { - revalue(root, 0); - return root; - }; - return hierarchy; - }; - function d3_layout_hierarchyRebind(object, hierarchy) { - d3.rebind(object, hierarchy, "sort", "children", "value"); - object.nodes = object; - object.links = d3_layout_hierarchyLinks; - return object; - } - function d3_layout_hierarchyChildren(d) { - return d.children; - } - function d3_layout_hierarchyValue(d) { - return d.value; - } - function d3_layout_hierarchySort(a, b) { - return b.value - a.value; - } - function d3_layout_hierarchyLinks(nodes) { - return d3.merge(nodes.map(function(parent) { - return (parent.children || []).map(function(child) { - return { - source: parent, - target: child - }; - }); - })); - } - d3.layout.partition = function() { - var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ]; - function position(node, x, dx, dy) { - var children = node.children; - node.x = x; - node.y = node.depth * dy; - node.dx = dx; - node.dy = dy; - if (children && (n = children.length)) { - var i = -1, n, c, d; - dx = node.value ? dx / node.value : 0; - while (++i < n) { - position(c = children[i], x, d = c.value * dx, dy); - x += d; - } - } - } - function depth(node) { - var children = node.children, d = 0; - if (children && (n = children.length)) { - var i = -1, n; - while (++i < n) d = Math.max(d, depth(children[i])); - } - return 1 + d; - } - function partition(d, i) { - var nodes = hierarchy.call(this, d, i); - position(nodes[0], 0, size[0], size[1] / depth(nodes[0])); - return nodes; - } - partition.size = function(x) { - if (!arguments.length) return size; - size = x; - return partition; - }; - return d3_layout_hierarchyRebind(partition, hierarchy); - }; - d3.layout.pie = function() { - var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ; - function pie(data) { - var values = data.map(function(d, i) { - return +value.call(pie, d, i); - }); - var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle); - var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values); - var index = d3.range(data.length); - if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) { - return values[j] - values[i]; - } : function(i, j) { - return sort(data[i], data[j]); - }); - var arcs = []; - index.forEach(function(i) { - var d; - arcs[i] = { - data: data[i], - value: d = values[i], - startAngle: a, - endAngle: a += d * k - }; - }); - return arcs; - } - pie.value = function(x) { - if (!arguments.length) return value; - value = x; - return pie; - }; - pie.sort = function(x) { - if (!arguments.length) return sort; - sort = x; - return pie; - }; - pie.startAngle = function(x) { - if (!arguments.length) return startAngle; - startAngle = x; - return pie; - }; - pie.endAngle = function(x) { - if (!arguments.length) return endAngle; - endAngle = x; - return pie; - }; - return pie; - }; - var d3_layout_pieSortByValue = {}; - d3.layout.stack = function() { - var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY; - function stack(data, index) { - var series = data.map(function(d, i) { - return values.call(stack, d, i); - }); - var points = series.map(function(d) { - return d.map(function(v, i) { - return [ x.call(stack, v, i), y.call(stack, v, i) ]; - }); - }); - var orders = order.call(stack, points, index); - series = d3.permute(series, orders); - points = d3.permute(points, orders); - var offsets = offset.call(stack, points, index); - var n = series.length, m = series[0].length, i, j, o; - for (j = 0; j < m; ++j) { - out.call(stack, series[0][j], o = offsets[j], points[0][j][1]); - for (i = 1; i < n; ++i) { - out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]); - } - } - return data; - } - stack.values = function(x) { - if (!arguments.length) return values; - values = x; - return stack; - }; - stack.order = function(x) { - if (!arguments.length) return order; - order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault; - return stack; - }; - stack.offset = function(x) { - if (!arguments.length) return offset; - offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero; - return stack; - }; - stack.x = function(z) { - if (!arguments.length) return x; - x = z; - return stack; - }; - stack.y = function(z) { - if (!arguments.length) return y; - y = z; - return stack; - }; - stack.out = function(z) { - if (!arguments.length) return out; - out = z; - return stack; - }; - return stack; - }; - function d3_layout_stackX(d) { - return d.x; - } - function d3_layout_stackY(d) { - return d.y; - } - function d3_layout_stackOut(d, y0, y) { - d.y0 = y0; - d.y = y; - } - var d3_layout_stackOrders = d3.map({ - "inside-out": function(data) { - var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) { - return max[a] - max[b]; - }), top = 0, bottom = 0, tops = [], bottoms = []; - for (i = 0; i < n; ++i) { - j = index[i]; - if (top < bottom) { - top += sums[j]; - tops.push(j); - } else { - bottom += sums[j]; - bottoms.push(j); - } - } - return bottoms.reverse().concat(tops); - }, - reverse: function(data) { - return d3.range(data.length).reverse(); - }, - "default": d3_layout_stackOrderDefault - }); - var d3_layout_stackOffsets = d3.map({ - silhouette: function(data) { - var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o > max) max = o; - sums.push(o); - } - for (j = 0; j < m; ++j) { - y0[j] = (max - sums[j]) / 2; - } - return y0; - }, - wiggle: function(data) { - var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = []; - y0[0] = o = o0 = 0; - for (j = 1; j < m; ++j) { - for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1]; - for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) { - for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) { - s3 += (data[k][j][1] - data[k][j - 1][1]) / dx; - } - s2 += s3 * data[i][j][1]; - } - y0[j] = o -= s1 ? s2 / s1 * dx : 0; - if (o < o0) o0 = o; - } - for (j = 0; j < m; ++j) y0[j] -= o0; - return y0; - }, - expand: function(data) { - var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = []; - for (j = 0; j < m; ++j) { - for (i = 0, o = 0; i < n; i++) o += data[i][j][1]; - if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k; - } - for (j = 0; j < m; ++j) y0[j] = 0; - return y0; - }, - zero: d3_layout_stackOffsetZero - }); - function d3_layout_stackOrderDefault(data) { - return d3.range(data.length); - } - function d3_layout_stackOffsetZero(data) { - var j = -1, m = data[0].length, y0 = []; - while (++j < m) y0[j] = 0; - return y0; - } - function d3_layout_stackMaxIndex(array) { - var i = 1, j = 0, v = array[0][1], k, n = array.length; - for (;i < n; ++i) { - if ((k = array[i][1]) > v) { - j = i; - v = k; - } - } - return j; - } - function d3_layout_stackReduceSum(d) { - return d.reduce(d3_layout_stackSum, 0); - } - function d3_layout_stackSum(p, d) { - return p + d[1]; - } - d3.layout.histogram = function() { - var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges; - function histogram(data, i) { - var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x; - while (++i < m) { - bin = bins[i] = []; - bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]); - bin.y = 0; - } - if (m > 0) { - i = -1; - while (++i < n) { - x = values[i]; - if (x >= range[0] && x <= range[1]) { - bin = bins[d3.bisect(thresholds, x, 1, m) - 1]; - bin.y += k; - bin.push(data[i]); - } - } - } - return bins; - } - histogram.value = function(x) { - if (!arguments.length) return valuer; - valuer = x; - return histogram; - }; - histogram.range = function(x) { - if (!arguments.length) return ranger; - ranger = d3_functor(x); - return histogram; - }; - histogram.bins = function(x) { - if (!arguments.length) return binner; - binner = typeof x === "number" ? function(range) { - return d3_layout_histogramBinFixed(range, x); - } : d3_functor(x); - return histogram; - }; - histogram.frequency = function(x) { - if (!arguments.length) return frequency; - frequency = !!x; - return histogram; - }; - return histogram; - }; - function d3_layout_histogramBinSturges(range, values) { - return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1)); - } - function d3_layout_histogramBinFixed(range, n) { - var x = -1, b = +range[0], m = (range[1] - b) / n, f = []; - while (++x <= n) f[x] = m * x + b; - return f; - } - function d3_layout_histogramRange(values) { - return [ d3.min(values), d3.max(values) ]; - } - d3.layout.tree = function() { - var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; - function tree(d, i) { - var nodes = hierarchy.call(this, d, i), root = nodes[0]; - function firstWalk(node, previousSibling) { - var children = node.children, layout = node._tree; - if (children && (n = children.length)) { - var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1; - while (++i < n) { - child = children[i]; - firstWalk(child, previousChild); - ancestor = apportion(child, previousChild, ancestor); - previousChild = child; - } - d3_layout_treeShift(node); - var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim); - if (previousSibling) { - layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); - layout.mod = layout.prelim - midpoint; - } else { - layout.prelim = midpoint; - } - } else { - if (previousSibling) { - layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling); - } - } - } - function secondWalk(node, x) { - node.x = node._tree.prelim + x; - var children = node.children; - if (children && (n = children.length)) { - var i = -1, n; - x += node._tree.mod; - while (++i < n) { - secondWalk(children[i], x); - } - } - } - function apportion(node, previousSibling, ancestor) { - if (previousSibling) { - var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift; - while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) { - vom = d3_layout_treeLeft(vom); - vop = d3_layout_treeRight(vop); - vop._tree.ancestor = node; - shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip); - if (shift > 0) { - d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift); - sip += shift; - sop += shift; - } - sim += vim._tree.mod; - sip += vip._tree.mod; - som += vom._tree.mod; - sop += vop._tree.mod; - } - if (vim && !d3_layout_treeRight(vop)) { - vop._tree.thread = vim; - vop._tree.mod += sim - sop; - } - if (vip && !d3_layout_treeLeft(vom)) { - vom._tree.thread = vip; - vom._tree.mod += sip - som; - ancestor = node; - } - } - return ancestor; - } - d3_layout_treeVisitAfter(root, function(node, previousSibling) { - node._tree = { - ancestor: node, - prelim: 0, - mod: 0, - change: 0, - shift: 0, - number: previousSibling ? previousSibling._tree.number + 1 : 0 - }; - }); - firstWalk(root); - secondWalk(root, -root._tree.prelim); - var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1; - d3_layout_treeVisitAfter(root, nodeSize ? function(node) { - node.x *= size[0]; - node.y = node.depth * size[1]; - delete node._tree; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * size[0]; - node.y = node.depth / y1 * size[1]; - delete node._tree; - }); - return nodes; - } - tree.separation = function(x) { - if (!arguments.length) return separation; - separation = x; - return tree; - }; - tree.size = function(x) { - if (!arguments.length) return nodeSize ? null : size; - nodeSize = (size = x) == null; - return tree; - }; - tree.nodeSize = function(x) { - if (!arguments.length) return nodeSize ? size : null; - nodeSize = (size = x) != null; - return tree; - }; - return d3_layout_hierarchyRebind(tree, hierarchy); - }; - function d3_layout_treeSeparation(a, b) { - return a.parent == b.parent ? 1 : 2; - } - function d3_layout_treeLeft(node) { - var children = node.children; - return children && children.length ? children[0] : node._tree.thread; - } - function d3_layout_treeRight(node) { - var children = node.children, n; - return children && (n = children.length) ? children[n - 1] : node._tree.thread; - } - function d3_layout_treeSearch(node, compare) { - var children = node.children; - if (children && (n = children.length)) { - var child, n, i = -1; - while (++i < n) { - if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) { - node = child; - } - } - } - return node; - } - function d3_layout_treeRightmost(a, b) { - return a.x - b.x; - } - function d3_layout_treeLeftmost(a, b) { - return b.x - a.x; - } - function d3_layout_treeDeepest(a, b) { - return a.depth - b.depth; - } - function d3_layout_treeVisitAfter(node, callback) { - function visit(node, previousSibling) { - var children = node.children; - if (children && (n = children.length)) { - var child, previousChild = null, i = -1, n; - while (++i < n) { - child = children[i]; - visit(child, previousChild); - previousChild = child; - } - } - callback(node, previousSibling); - } - visit(node, null); - } - function d3_layout_treeShift(node) { - var shift = 0, change = 0, children = node.children, i = children.length, child; - while (--i >= 0) { - child = children[i]._tree; - child.prelim += shift; - child.mod += shift; - shift += child.shift + (change += child.change); - } - } - function d3_layout_treeMove(ancestor, node, shift) { - ancestor = ancestor._tree; - node = node._tree; - var change = shift / (node.number - ancestor.number); - ancestor.change += change; - node.change -= change; - node.shift += shift; - node.prelim += shift; - node.mod += shift; - } - function d3_layout_treeAncestor(vim, node, ancestor) { - return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor; - } - d3.layout.pack = function() { - var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius; - function pack(d, i) { - var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() { - return radius; - }; - root.x = root.y = 0; - d3_layout_treeVisitAfter(root, function(d) { - d.r = +r(d.value); - }); - d3_layout_treeVisitAfter(root, d3_layout_packSiblings); - if (padding) { - var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; - d3_layout_treeVisitAfter(root, function(d) { - d.r += dr; - }); - d3_layout_treeVisitAfter(root, d3_layout_packSiblings); - d3_layout_treeVisitAfter(root, function(d) { - d.r -= dr; - }); - } - d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h)); - return nodes; - } - pack.size = function(_) { - if (!arguments.length) return size; - size = _; - return pack; - }; - pack.radius = function(_) { - if (!arguments.length) return radius; - radius = _ == null || typeof _ === "function" ? _ : +_; - return pack; - }; - pack.padding = function(_) { - if (!arguments.length) return padding; - padding = +_; - return pack; - }; - return d3_layout_hierarchyRebind(pack, hierarchy); - }; - function d3_layout_packSort(a, b) { - return a.value - b.value; - } - function d3_layout_packInsert(a, b) { - var c = a._pack_next; - a._pack_next = b; - b._pack_prev = a; - b._pack_next = c; - c._pack_prev = b; - } - function d3_layout_packSplice(a, b) { - a._pack_next = b; - b._pack_prev = a; - } - function d3_layout_packIntersects(a, b) { - var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r; - return .999 * dr * dr > dx * dx + dy * dy; - } - function d3_layout_packSiblings(node) { - if (!(nodes = node.children) || !(n = nodes.length)) return; - var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n; - function bound(node) { - xMin = Math.min(node.x - node.r, xMin); - xMax = Math.max(node.x + node.r, xMax); - yMin = Math.min(node.y - node.r, yMin); - yMax = Math.max(node.y + node.r, yMax); - } - nodes.forEach(d3_layout_packLink); - a = nodes[0]; - a.x = -a.r; - a.y = 0; - bound(a); - if (n > 1) { - b = nodes[1]; - b.x = b.r; - b.y = 0; - bound(b); - if (n > 2) { - c = nodes[2]; - d3_layout_packPlace(a, b, c); - bound(c); - d3_layout_packInsert(a, c); - a._pack_prev = c; - d3_layout_packInsert(c, b); - b = a._pack_next; - for (i = 3; i < n; i++) { - d3_layout_packPlace(a, b, c = nodes[i]); - var isect = 0, s1 = 1, s2 = 1; - for (j = b._pack_next; j !== b; j = j._pack_next, s1++) { - if (d3_layout_packIntersects(j, c)) { - isect = 1; - break; - } - } - if (isect == 1) { - for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) { - if (d3_layout_packIntersects(k, c)) { - break; - } - } - } - if (isect) { - if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b); - i--; - } else { - d3_layout_packInsert(a, c); - b = c; - bound(c); - } - } - } - } - var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0; - for (i = 0; i < n; i++) { - c = nodes[i]; - c.x -= cx; - c.y -= cy; - cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); - } - node.r = cr; - nodes.forEach(d3_layout_packUnlink); - } - function d3_layout_packLink(node) { - node._pack_next = node._pack_prev = node; - } - function d3_layout_packUnlink(node) { - delete node._pack_next; - delete node._pack_prev; - } - function d3_layout_packTransform(node, x, y, k) { - var children = node.children; - node.x = x += k * node.x; - node.y = y += k * node.y; - node.r *= k; - if (children) { - var i = -1, n = children.length; - while (++i < n) d3_layout_packTransform(children[i], x, y, k); - } - } - function d3_layout_packPlace(a, b, c) { - var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y; - if (db && (dx || dy)) { - var da = b.r + c.r, dc = dx * dx + dy * dy; - da *= da; - db *= db; - var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); - c.x = a.x + x * dx + y * dy; - c.y = a.y + x * dy - y * dx; - } else { - c.x = a.x + db; - c.y = a.y; - } - } - d3.layout.cluster = function() { - var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false; - function cluster(d, i) { - var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0; - d3_layout_treeVisitAfter(root, function(node) { - var children = node.children; - if (children && children.length) { - node.x = d3_layout_clusterX(children); - node.y = d3_layout_clusterY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - d3_layout_treeVisitAfter(root, nodeSize ? function(node) { - node.x = (node.x - root.x) * size[0]; - node.y = (root.y - node.y) * size[1]; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * size[0]; - node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1]; - }); - return nodes; - } - cluster.separation = function(x) { - if (!arguments.length) return separation; - separation = x; - return cluster; - }; - cluster.size = function(x) { - if (!arguments.length) return nodeSize ? null : size; - nodeSize = (size = x) == null; - return cluster; - }; - cluster.nodeSize = function(x) { - if (!arguments.length) return nodeSize ? size : null; - nodeSize = (size = x) != null; - return cluster; - }; - return d3_layout_hierarchyRebind(cluster, hierarchy); - }; - function d3_layout_clusterY(children) { - return 1 + d3.max(children, function(child) { - return child.y; - }); - } - function d3_layout_clusterX(children) { - return children.reduce(function(x, child) { - return x + child.x; - }, 0) / children.length; - } - function d3_layout_clusterLeft(node) { - var children = node.children; - return children && children.length ? d3_layout_clusterLeft(children[0]) : node; - } - function d3_layout_clusterRight(node) { - var children = node.children, n; - return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node; - } - d3.layout.treemap = function() { - var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5)); - function scale(children, k) { - var i = -1, n = children.length, child, area; - while (++i < n) { - area = (child = children[i]).value * (k < 0 ? 0 : k); - child.area = isNaN(area) || area <= 0 ? 0 : area; - } - } - function squarify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while ((n = remaining.length) > 0) { - row.push(child = remaining[n - 1]); - row.area += child.area; - if (mode !== "squarify" || (score = worst(row, u)) <= best) { - remaining.pop(); - best = score; - } else { - row.area -= row.pop().area; - position(row, u, rect, false); - u = Math.min(rect.dx, rect.dy); - row.length = row.area = 0; - best = Infinity; - } - } - if (row.length) { - position(row, u, rect, true); - row.length = row.area = 0; - } - children.forEach(squarify); - } - } - function stickify(node) { - var children = node.children; - if (children && children.length) { - var rect = pad(node), remaining = children.slice(), child, row = []; - scale(remaining, rect.dx * rect.dy / node.value); - row.area = 0; - while (child = remaining.pop()) { - row.push(child); - row.area += child.area; - if (child.z != null) { - position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); - row.length = row.area = 0; - } - } - children.forEach(stickify); - } - } - function worst(row, u) { - var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; - while (++i < n) { - if (!(r = row[i].area)) continue; - if (r < rmin) rmin = r; - if (r > rmax) rmax = r; - } - s *= s; - u *= u; - return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity; - } - function position(row, u, rect, flush) { - var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o; - if (u == rect.dx) { - if (flush || v > rect.dy) v = rect.dy; - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dy = v; - x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0); - } - o.z = true; - o.dx += rect.x + rect.dx - x; - rect.y += v; - rect.dy -= v; - } else { - if (flush || v > rect.dx) v = rect.dx; - while (++i < n) { - o = row[i]; - o.x = x; - o.y = y; - o.dx = v; - y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0); - } - o.z = false; - o.dy += rect.y + rect.dy - y; - rect.x += v; - rect.dx -= v; - } - } - function treemap(d) { - var nodes = stickies || hierarchy(d), root = nodes[0]; - root.x = 0; - root.y = 0; - root.dx = size[0]; - root.dy = size[1]; - if (stickies) hierarchy.revalue(root); - scale([ root ], root.dx * root.dy / root.value); - (stickies ? stickify : squarify)(root); - if (sticky) stickies = nodes; - return nodes; - } - treemap.size = function(x) { - if (!arguments.length) return size; - size = x; - return treemap; - }; - treemap.padding = function(x) { - if (!arguments.length) return padding; - function padFunction(node) { - var p = x.call(treemap, node, node.depth); - return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p); - } - function padConstant(node) { - return d3_layout_treemapPad(node, x); - } - var type; - pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], - padConstant) : padConstant; - return treemap; - }; - treemap.round = function(x) { - if (!arguments.length) return round != Number; - round = x ? Math.round : Number; - return treemap; - }; - treemap.sticky = function(x) { - if (!arguments.length) return sticky; - sticky = x; - stickies = null; - return treemap; - }; - treemap.ratio = function(x) { - if (!arguments.length) return ratio; - ratio = x; - return treemap; - }; - treemap.mode = function(x) { - if (!arguments.length) return mode; - mode = x + ""; - return treemap; - }; - return d3_layout_hierarchyRebind(treemap, hierarchy); - }; - function d3_layout_treemapPadNull(node) { - return { - x: node.x, - y: node.y, - dx: node.dx, - dy: node.dy - }; - } - function d3_layout_treemapPad(node, padding) { - var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2]; - if (dx < 0) { - x += dx / 2; - dx = 0; - } - if (dy < 0) { - y += dy / 2; - dy = 0; - } - return { - x: x, - y: y, - dx: dx, - dy: dy - }; - } - d3.random = { - normal: function(µ, σ) { - var n = arguments.length; - if (n < 2) σ = 1; - if (n < 1) µ = 0; - return function() { - var x, y, r; - do { - x = Math.random() * 2 - 1; - y = Math.random() * 2 - 1; - r = x * x + y * y; - } while (!r || r > 1); - return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r); - }; - }, - logNormal: function() { - var random = d3.random.normal.apply(d3, arguments); - return function() { - return Math.exp(random()); - }; - }, - bates: function(m) { - var random = d3.random.irwinHall(m); - return function() { - return random() / m; - }; - }, - irwinHall: function(m) { - return function() { - for (var s = 0, j = 0; j < m; j++) s += Math.random(); - return s; - }; - } - }; - d3.scale = {}; - function d3_scaleExtent(domain) { - var start = domain[0], stop = domain[domain.length - 1]; - return start < stop ? [ start, stop ] : [ stop, start ]; - } - function d3_scaleRange(scale) { - return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range()); - } - function d3_scale_bilinear(domain, range, uninterpolate, interpolate) { - var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]); - return function(x) { - return i(u(x)); - }; - } - function d3_scale_nice(domain, nice) { - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx; - if (x1 < x0) { - dx = i0, i0 = i1, i1 = dx; - dx = x0, x0 = x1, x1 = dx; - } - domain[i0] = nice.floor(x0); - domain[i1] = nice.ceil(x1); - return domain; - } - function d3_scale_niceStep(step) { - return step ? { - floor: function(x) { - return Math.floor(x / step) * step; - }, - ceil: function(x) { - return Math.ceil(x / step) * step; - } - } : d3_scale_niceIdentity; - } - var d3_scale_niceIdentity = { - floor: d3_identity, - ceil: d3_identity - }; - function d3_scale_polylinear(domain, range, uninterpolate, interpolate) { - var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1; - if (domain[k] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while (++j <= k) { - u.push(uninterpolate(domain[j - 1], domain[j])); - i.push(interpolate(range[j - 1], range[j])); - } - return function(x) { - var j = d3.bisect(domain, x, 1, k) - 1; - return i[j](u[j](x)); - }; - } - d3.scale.linear = function() { - return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false); - }; - function d3_scale_linear(domain, range, interpolate, clamp) { - var output, input; - function rescale() { - var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber; - output = linear(domain, range, uninterpolate, interpolate); - input = linear(range, domain, uninterpolate, d3_interpolate); - return scale; - } - function scale(x) { - return output(x); - } - scale.invert = function(y) { - return input(y); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = x.map(Number); - return rescale(); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - scale.rangeRound = function(x) { - return scale.range(x).interpolate(d3_interpolateRound); - }; - scale.clamp = function(x) { - if (!arguments.length) return clamp; - clamp = x; - return rescale(); - }; - scale.interpolate = function(x) { - if (!arguments.length) return interpolate; - interpolate = x; - return rescale(); - }; - scale.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - scale.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - scale.nice = function(m) { - d3_scale_linearNice(domain, m); - return rescale(); - }; - scale.copy = function() { - return d3_scale_linear(domain, range, interpolate, clamp); - }; - return rescale(); - } - function d3_scale_linearRebind(scale, linear) { - return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp"); - } - function d3_scale_linearNice(domain, m) { - return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); - } - function d3_scale_linearTickRange(domain, m) { - if (m == null) m = 10; - var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step; - if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2; - extent[0] = Math.ceil(extent[0] / step) * step; - extent[1] = Math.floor(extent[1] / step) * step + step * .5; - extent[2] = step; - return extent; - } - function d3_scale_linearTicks(domain, m) { - return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); - } - function d3_scale_linearTickFormat(domain, m, format) { - var range = d3_scale_linearTickRange(domain, m); - if (format) { - var match = d3_format_re.exec(format); - match.shift(); - if (match[8] === "s") { - var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1]))); - if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2])); - match[8] = "f"; - format = d3.format(match.join("")); - return function(d) { - return format(prefix.scale(d)) + prefix.symbol; - }; - } - if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range); - format = match.join(""); - } else { - format = ",." + d3_scale_linearPrecision(range[2]) + "f"; - } - return d3.format(format); - } - var d3_scale_linearFormatSignificant = { - s: 1, - g: 1, - p: 1, - r: 1, - e: 1 - }; - function d3_scale_linearPrecision(value) { - return -Math.floor(Math.log(value) / Math.LN10 + .01); - } - function d3_scale_linearFormatPrecision(type, range) { - var p = d3_scale_linearPrecision(range[2]); - return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2; - } - d3.scale.log = function() { - return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]); - }; - function d3_scale_log(linear, base, positive, domain) { - function log(x) { - return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base); - } - function pow(x) { - return positive ? Math.pow(base, x) : -Math.pow(base, -x); - } - function scale(x) { - return linear(log(x)); - } - scale.invert = function(x) { - return pow(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - positive = x[0] >= 0; - linear.domain((domain = x.map(Number)).map(log)); - return scale; - }; - scale.base = function(_) { - if (!arguments.length) return base; - base = +_; - linear.domain(domain.map(log)); - return scale; - }; - scale.nice = function() { - var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative); - linear.domain(niced); - domain = niced.map(pow); - return scale; - }; - scale.ticks = function() { - var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base; - if (isFinite(j - i)) { - if (positive) { - for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k); - ticks.push(pow(i)); - } else { - ticks.push(pow(i)); - for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k); - } - for (i = 0; ticks[i] < u; i++) {} - for (j = ticks.length; ticks[j - 1] > v; j--) {} - ticks = ticks.slice(i, j); - } - return ticks; - }; - scale.tickFormat = function(n, format) { - if (!arguments.length) return d3_scale_logFormat; - if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format); - var k = Math.max(.1, n / scale.ticks().length), f = positive ? (e = 1e-12, Math.ceil) : (e = -1e-12, - Math.floor), e; - return function(d) { - return d / pow(f(log(d) + e)) <= k ? format(d) : ""; - }; - }; - scale.copy = function() { - return d3_scale_log(linear.copy(), base, positive, domain); - }; - return d3_scale_linearRebind(scale, linear); - } - var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = { - floor: function(x) { - return -Math.ceil(-x); - }, - ceil: function(x) { - return -Math.floor(-x); - } - }; - d3.scale.pow = function() { - return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]); - }; - function d3_scale_pow(linear, exponent, domain) { - var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent); - function scale(x) { - return linear(powp(x)); - } - scale.invert = function(x) { - return powb(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return domain; - linear.domain((domain = x.map(Number)).map(powp)); - return scale; - }; - scale.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - scale.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - scale.nice = function(m) { - return scale.domain(d3_scale_linearNice(domain, m)); - }; - scale.exponent = function(x) { - if (!arguments.length) return exponent; - powp = d3_scale_powPow(exponent = x); - powb = d3_scale_powPow(1 / exponent); - linear.domain(domain.map(powp)); - return scale; - }; - scale.copy = function() { - return d3_scale_pow(linear.copy(), exponent, domain); - }; - return d3_scale_linearRebind(scale, linear); - } - function d3_scale_powPow(e) { - return function(x) { - return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e); - }; - } - d3.scale.sqrt = function() { - return d3.scale.pow().exponent(.5); - }; - d3.scale.ordinal = function() { - return d3_scale_ordinal([], { - t: "range", - a: [ [] ] - }); - }; - function d3_scale_ordinal(domain, ranger) { - var index, range, rangeBand; - function scale(x) { - return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length]; - } - function steps(start, step) { - return d3.range(domain.length).map(function(i) { - return start + step * i; - }); - } - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = []; - index = new d3_Map(); - var i = -1, n = x.length, xi; - while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi)); - return scale[ranger.t].apply(scale, ranger.a); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - rangeBand = 0; - ranger = { - t: "range", - a: arguments - }; - return scale; - }; - scale.rangePoints = function(x, padding) { - if (arguments.length < 2) padding = 0; - var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding); - range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step); - rangeBand = 0; - ranger = { - t: "rangePoints", - a: arguments - }; - return scale; - }; - scale.rangeBands = function(x, padding, outerPadding) { - if (arguments.length < 2) padding = 0; - if (arguments.length < 3) outerPadding = padding; - var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding); - range = steps(start + step * outerPadding, step); - if (reverse) range.reverse(); - rangeBand = step * (1 - padding); - ranger = { - t: "rangeBands", - a: arguments - }; - return scale; - }; - scale.rangeRoundBands = function(x, padding, outerPadding) { - if (arguments.length < 2) padding = 0; - if (arguments.length < 3) outerPadding = padding; - var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step; - range = steps(start + Math.round(error / 2), step); - if (reverse) range.reverse(); - rangeBand = Math.round(step * (1 - padding)); - ranger = { - t: "rangeRoundBands", - a: arguments - }; - return scale; - }; - scale.rangeBand = function() { - return rangeBand; - }; - scale.rangeExtent = function() { - return d3_scaleExtent(ranger.a[0]); - }; - scale.copy = function() { - return d3_scale_ordinal(domain, ranger); - }; - return scale.domain(domain); - } - d3.scale.category10 = function() { - return d3.scale.ordinal().range(d3_category10); - }; - d3.scale.category20 = function() { - return d3.scale.ordinal().range(d3_category20); - }; - d3.scale.category20b = function() { - return d3.scale.ordinal().range(d3_category20b); - }; - d3.scale.category20c = function() { - return d3.scale.ordinal().range(d3_category20c); - }; - var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString); - var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString); - var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString); - var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString); - d3.scale.quantile = function() { - return d3_scale_quantile([], []); - }; - function d3_scale_quantile(domain, range) { - var thresholds; - function rescale() { - var k = 0, q = range.length; - thresholds = []; - while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q); - return scale; - } - function scale(x) { - if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)]; - } - scale.domain = function(x) { - if (!arguments.length) return domain; - domain = x.filter(function(d) { - return !isNaN(d); - }).sort(d3_ascending); - return rescale(); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - scale.quantiles = function() { - return thresholds; - }; - scale.invertExtent = function(y) { - y = range.indexOf(y); - return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ]; - }; - scale.copy = function() { - return d3_scale_quantile(domain, range); - }; - return rescale(); - } - d3.scale.quantize = function() { - return d3_scale_quantize(0, 1, [ 0, 1 ]); - }; - function d3_scale_quantize(x0, x1, range) { - var kx, i; - function scale(x) { - return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))]; - } - function rescale() { - kx = range.length / (x1 - x0); - i = range.length - 1; - return scale; - } - scale.domain = function(x) { - if (!arguments.length) return [ x0, x1 ]; - x0 = +x[0]; - x1 = +x[x.length - 1]; - return rescale(); - }; - scale.range = function(x) { - if (!arguments.length) return range; - range = x; - return rescale(); - }; - scale.invertExtent = function(y) { - y = range.indexOf(y); - y = y < 0 ? NaN : y / kx + x0; - return [ y, y + 1 / kx ]; - }; - scale.copy = function() { - return d3_scale_quantize(x0, x1, range); - }; - return rescale(); - } - d3.scale.threshold = function() { - return d3_scale_threshold([ .5 ], [ 0, 1 ]); - }; - function d3_scale_threshold(domain, range) { - function scale(x) { - if (x <= x) return range[d3.bisect(domain, x)]; - } - scale.domain = function(_) { - if (!arguments.length) return domain; - domain = _; - return scale; - }; - scale.range = function(_) { - if (!arguments.length) return range; - range = _; - return scale; - }; - scale.invertExtent = function(y) { - y = range.indexOf(y); - return [ domain[y - 1], domain[y] ]; - }; - scale.copy = function() { - return d3_scale_threshold(domain, range); - }; - return scale; - } - d3.scale.identity = function() { - return d3_scale_identity([ 0, 1 ]); - }; - function d3_scale_identity(domain) { - function identity(x) { - return +x; - } - identity.invert = identity; - identity.domain = identity.range = function(x) { - if (!arguments.length) return domain; - domain = x.map(identity); - return identity; - }; - identity.ticks = function(m) { - return d3_scale_linearTicks(domain, m); - }; - identity.tickFormat = function(m, format) { - return d3_scale_linearTickFormat(domain, m, format); - }; - identity.copy = function() { - return d3_scale_identity(domain); - }; - return identity; - } - d3.svg = {}; - d3.svg.arc = function() { - var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; - function arc() { - var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, - a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1); - return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z"; - } - arc.innerRadius = function(v) { - if (!arguments.length) return innerRadius; - innerRadius = d3_functor(v); - return arc; - }; - arc.outerRadius = function(v) { - if (!arguments.length) return outerRadius; - outerRadius = d3_functor(v); - return arc; - }; - arc.startAngle = function(v) { - if (!arguments.length) return startAngle; - startAngle = d3_functor(v); - return arc; - }; - arc.endAngle = function(v) { - if (!arguments.length) return endAngle; - endAngle = d3_functor(v); - return arc; - }; - arc.centroid = function() { - var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset; - return [ Math.cos(a) * r, Math.sin(a) * r ]; - }; - return arc; - }; - var d3_svg_arcOffset = -halfπ, d3_svg_arcMax = τ - ε; - function d3_svg_arcInnerRadius(d) { - return d.innerRadius; - } - function d3_svg_arcOuterRadius(d) { - return d.outerRadius; - } - function d3_svg_arcStartAngle(d) { - return d.startAngle; - } - function d3_svg_arcEndAngle(d) { - return d.endAngle; - } - function d3_svg_line(projection) { - var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7; - function line(data) { - var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y); - function segment() { - segments.push("M", interpolate(projection(points), tension)); - } - while (++i < n) { - if (defined.call(this, d = data[i], i)) { - points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]); - } else if (points.length) { - segment(); - points = []; - } - } - if (points.length) segment(); - return segments.length ? segments.join("") : null; - } - line.x = function(_) { - if (!arguments.length) return x; - x = _; - return line; - }; - line.y = function(_) { - if (!arguments.length) return y; - y = _; - return line; - }; - line.defined = function(_) { - if (!arguments.length) return defined; - defined = _; - return line; - }; - line.interpolate = function(_) { - if (!arguments.length) return interpolateKey; - if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; - return line; - }; - line.tension = function(_) { - if (!arguments.length) return tension; - tension = _; - return line; - }; - return line; - } - d3.svg.line = function() { - return d3_svg_line(d3_identity); - }; - var d3_svg_lineInterpolators = d3.map({ - linear: d3_svg_lineLinear, - "linear-closed": d3_svg_lineLinearClosed, - step: d3_svg_lineStep, - "step-before": d3_svg_lineStepBefore, - "step-after": d3_svg_lineStepAfter, - basis: d3_svg_lineBasis, - "basis-open": d3_svg_lineBasisOpen, - "basis-closed": d3_svg_lineBasisClosed, - bundle: d3_svg_lineBundle, - cardinal: d3_svg_lineCardinal, - "cardinal-open": d3_svg_lineCardinalOpen, - "cardinal-closed": d3_svg_lineCardinalClosed, - monotone: d3_svg_lineMonotone - }); - d3_svg_lineInterpolators.forEach(function(key, value) { - value.key = key; - value.closed = /-closed$/.test(key); - }); - function d3_svg_lineLinear(points) { - return points.join("L"); - } - function d3_svg_lineLinearClosed(points) { - return d3_svg_lineLinear(points) + "Z"; - } - function d3_svg_lineStep(points) { - var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; - while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]); - if (n > 1) path.push("H", p[0]); - return path.join(""); - } - function d3_svg_lineStepBefore(points) { - var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; - while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]); - return path.join(""); - } - function d3_svg_lineStepAfter(points) { - var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ]; - while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]); - return path.join(""); - } - function d3_svg_lineCardinalOpen(points, tension) { - return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension)); - } - function d3_svg_lineCardinalClosed(points, tension) { - return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), - points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension)); - } - function d3_svg_lineCardinal(points, tension) { - return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension)); - } - function d3_svg_lineHermite(points, tangents) { - if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) { - return d3_svg_lineLinear(points); - } - var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1; - if (quad) { - path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1]; - p0 = points[1]; - pi = 2; - } - if (tangents.length > 1) { - t = tangents[1]; - p = points[pi]; - pi++; - path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; - for (var i = 2; i < tangents.length; i++, pi++) { - p = points[pi]; - t = tangents[i]; - path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; - } - } - if (quad) { - var lp = points[pi]; - path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1]; - } - return path; - } - function d3_svg_lineCardinalTangents(points, tension) { - var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length; - while (++i < n) { - p0 = p1; - p1 = p2; - p2 = points[i]; - tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]); - } - return tangents; - } - function d3_svg_lineBasis(points) { - if (points.length < 3) return d3_svg_lineLinear(points); - var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; - points.push(points[n - 1]); - while (++i <= n) { - pi = points[i]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - points.pop(); - path.push("L", pi); - return path.join(""); - } - function d3_svg_lineBasisOpen(points) { - if (points.length < 4) return d3_svg_lineLinear(points); - var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ]; - while (++i < 3) { - pi = points[i]; - px.push(pi[0]); - py.push(pi[1]); - } - path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); - --i; - while (++i < n) { - pi = points[i]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); - } - function d3_svg_lineBasisClosed(points) { - var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = []; - while (++i < 4) { - pi = points[i % n]; - px.push(pi[0]); - py.push(pi[1]); - } - path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ]; - --i; - while (++i < m) { - pi = points[i % n]; - px.shift(); - px.push(pi[0]); - py.shift(); - py.push(pi[1]); - d3_svg_lineBasisBezier(path, px, py); - } - return path.join(""); - } - function d3_svg_lineBundle(points, tension) { - var n = points.length - 1; - if (n) { - var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t; - while (++i <= n) { - p = points[i]; - t = i / n; - p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); - p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); - } - } - return d3_svg_lineBasis(points); - } - function d3_svg_lineDot4(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; - } - var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ]; - function d3_svg_lineBasisBezier(path, x, y) { - path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y)); - } - function d3_svg_lineSlope(p0, p1) { - return (p1[1] - p0[1]) / (p1[0] - p0[0]); - } - function d3_svg_lineFiniteDifferences(points) { - var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1); - while (++i < j) { - m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2; - } - m[i] = d; - return m; - } - function d3_svg_lineMonotoneTangents(points) { - var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1; - while (++i < j) { - d = d3_svg_lineSlope(points[i], points[i + 1]); - if (abs(d) < ε) { - m[i] = m[i + 1] = 0; - } else { - a = m[i] / d; - b = m[i + 1] / d; - s = a * a + b * b; - if (s > 9) { - s = d * 3 / Math.sqrt(s); - m[i] = s * a; - m[i + 1] = s * b; - } - } - } - i = -1; - while (++i <= j) { - s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i])); - tangents.push([ s || 0, m[i] * s || 0 ]); - } - return tangents; - } - function d3_svg_lineMonotone(points) { - return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points)); - } - d3.svg.line.radial = function() { - var line = d3_svg_line(d3_svg_lineRadial); - line.radius = line.x, delete line.x; - line.angle = line.y, delete line.y; - return line; - }; - function d3_svg_lineRadial(points) { - var point, i = -1, n = points.length, r, a; - while (++i < n) { - point = points[i]; - r = point[0]; - a = point[1] + d3_svg_arcOffset; - point[0] = r * Math.cos(a); - point[1] = r * Math.sin(a); - } - return points; - } - function d3_svg_area(projection) { - var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7; - function area(data) { - var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() { - return x; - } : d3_functor(x1), fy1 = y0 === y1 ? function() { - return y; - } : d3_functor(y1), x, y; - function segment() { - segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z"); - } - while (++i < n) { - if (defined.call(this, d = data[i], i)) { - points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]); - points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]); - } else if (points0.length) { - segment(); - points0 = []; - points1 = []; - } - } - if (points0.length) segment(); - return segments.length ? segments.join("") : null; - } - area.x = function(_) { - if (!arguments.length) return x1; - x0 = x1 = _; - return area; - }; - area.x0 = function(_) { - if (!arguments.length) return x0; - x0 = _; - return area; - }; - area.x1 = function(_) { - if (!arguments.length) return x1; - x1 = _; - return area; - }; - area.y = function(_) { - if (!arguments.length) return y1; - y0 = y1 = _; - return area; - }; - area.y0 = function(_) { - if (!arguments.length) return y0; - y0 = _; - return area; - }; - area.y1 = function(_) { - if (!arguments.length) return y1; - y1 = _; - return area; - }; - area.defined = function(_) { - if (!arguments.length) return defined; - defined = _; - return area; - }; - area.interpolate = function(_) { - if (!arguments.length) return interpolateKey; - if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key; - interpolateReverse = interpolate.reverse || interpolate; - L = interpolate.closed ? "M" : "L"; - return area; - }; - area.tension = function(_) { - if (!arguments.length) return tension; - tension = _; - return area; - }; - return area; - } - d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter; - d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore; - d3.svg.area = function() { - return d3_svg_area(d3_identity); - }; - d3.svg.area.radial = function() { - var area = d3_svg_area(d3_svg_lineRadial); - area.radius = area.x, delete area.x; - area.innerRadius = area.x0, delete area.x0; - area.outerRadius = area.x1, delete area.x1; - area.angle = area.y, delete area.y; - area.startAngle = area.y0, delete area.y0; - area.endAngle = area.y1, delete area.y1; - return area; - }; - d3.svg.chord = function() { - var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle; - function chord(d, i) { - var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i); - return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z"; - } - function subgroup(self, f, d, i) { - var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset; - return { - r: r, - a0: a0, - a1: a1, - p0: [ r * Math.cos(a0), r * Math.sin(a0) ], - p1: [ r * Math.cos(a1), r * Math.sin(a1) ] - }; - } - function equals(a, b) { - return a.a0 == b.a0 && a.a1 == b.a1; - } - function arc(r, p, a) { - return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p; - } - function curve(r0, p0, r1, p1) { - return "Q 0,0 " + p1; - } - chord.radius = function(v) { - if (!arguments.length) return radius; - radius = d3_functor(v); - return chord; - }; - chord.source = function(v) { - if (!arguments.length) return source; - source = d3_functor(v); - return chord; - }; - chord.target = function(v) { - if (!arguments.length) return target; - target = d3_functor(v); - return chord; - }; - chord.startAngle = function(v) { - if (!arguments.length) return startAngle; - startAngle = d3_functor(v); - return chord; - }; - chord.endAngle = function(v) { - if (!arguments.length) return endAngle; - endAngle = d3_functor(v); - return chord; - }; - return chord; - }; - function d3_svg_chordRadius(d) { - return d.radius; - } - d3.svg.diagonal = function() { - var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection; - function diagonal(d, i) { - var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, { - x: p0.x, - y: m - }, { - x: p3.x, - y: m - }, p3 ]; - p = p.map(projection); - return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3]; - } - diagonal.source = function(x) { - if (!arguments.length) return source; - source = d3_functor(x); - return diagonal; - }; - diagonal.target = function(x) { - if (!arguments.length) return target; - target = d3_functor(x); - return diagonal; - }; - diagonal.projection = function(x) { - if (!arguments.length) return projection; - projection = x; - return diagonal; - }; - return diagonal; - }; - function d3_svg_diagonalProjection(d) { - return [ d.x, d.y ]; - } - d3.svg.diagonal.radial = function() { - var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection; - diagonal.projection = function(x) { - return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection; - }; - return diagonal; - }; - function d3_svg_diagonalRadialProjection(projection) { - return function() { - var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset; - return [ r * Math.cos(a), r * Math.sin(a) ]; - }; - } - d3.svg.symbol = function() { - var type = d3_svg_symbolType, size = d3_svg_symbolSize; - function symbol(d, i) { - return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i)); - } - symbol.type = function(x) { - if (!arguments.length) return type; - type = d3_functor(x); - return symbol; - }; - symbol.size = function(x) { - if (!arguments.length) return size; - size = d3_functor(x); - return symbol; - }; - return symbol; - }; - function d3_svg_symbolSize() { - return 64; - } - function d3_svg_symbolType() { - return "circle"; - } - function d3_svg_symbolCircle(size) { - var r = Math.sqrt(size / π); - return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z"; - } - var d3_svg_symbols = d3.map({ - circle: d3_svg_symbolCircle, - cross: function(size) { - var r = Math.sqrt(size / 5) / 2; - return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z"; - }, - diamond: function(size) { - var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30; - return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z"; - }, - square: function(size) { - var r = Math.sqrt(size) / 2; - return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z"; - }, - "triangle-down": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z"; - }, - "triangle-up": function(size) { - var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2; - return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z"; - } - }); - d3.svg.symbolTypes = d3_svg_symbols.keys(); - var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians); - function d3_transition(groups, id) { - d3_subclass(groups, d3_transitionPrototype); - groups.id = id; - return groups; - } - var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit; - d3_transitionPrototype.call = d3_selectionPrototype.call; - d3_transitionPrototype.empty = d3_selectionPrototype.empty; - d3_transitionPrototype.node = d3_selectionPrototype.node; - d3_transitionPrototype.size = d3_selectionPrototype.size; - d3.transition = function(selection) { - return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition(); - }; - d3.transition.prototype = d3_transitionPrototype; - d3_transitionPrototype.select = function(selector) { - var id = this.id, subgroups = [], subgroup, subnode, node; - selector = d3_selection_selector(selector); - for (var j = -1, m = this.length; ++j < m; ) { - subgroups.push(subgroup = []); - for (var group = this[j], i = -1, n = group.length; ++i < n; ) { - if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) { - if ("__data__" in node) subnode.__data__ = node.__data__; - d3_transitionNode(subnode, i, id, node.__transition__[id]); - subgroup.push(subnode); - } else { - subgroup.push(null); - } - } - } - return d3_transition(subgroups, id); - }; - d3_transitionPrototype.selectAll = function(selector) { - var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition; - selector = d3_selection_selectorAll(selector); - for (var j = -1, m = this.length; ++j < m; ) { - for (var group = this[j], i = -1, n = group.length; ++i < n; ) { - if (node = group[i]) { - transition = node.__transition__[id]; - subnodes = selector.call(node, node.__data__, i, j); - subgroups.push(subgroup = []); - for (var k = -1, o = subnodes.length; ++k < o; ) { - if (subnode = subnodes[k]) d3_transitionNode(subnode, k, id, transition); - subgroup.push(subnode); - } - } - } - } - return d3_transition(subgroups, id); - }; - d3_transitionPrototype.filter = function(filter) { - var subgroups = [], subgroup, group, node; - if (typeof filter !== "function") filter = d3_selection_filter(filter); - for (var j = 0, m = this.length; j < m; j++) { - subgroups.push(subgroup = []); - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - if ((node = group[i]) && filter.call(node, node.__data__, i, j)) { - subgroup.push(node); - } - } - } - return d3_transition(subgroups, this.id); - }; - d3_transitionPrototype.tween = function(name, tween) { - var id = this.id; - if (arguments.length < 2) return this.node().__transition__[id].tween.get(name); - return d3_selection_each(this, tween == null ? function(node) { - node.__transition__[id].tween.remove(name); - } : function(node) { - node.__transition__[id].tween.set(name, tween); - }); - }; - function d3_transition_tween(groups, name, value, tween) { - var id = groups.id; - return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { - node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j))); - } : (value = tween(value), function(node) { - node.__transition__[id].tween.set(name, value); - })); - } - d3_transitionPrototype.attr = function(nameNS, value) { - if (arguments.length < 2) { - for (value in nameNS) this.attr(value, nameNS[value]); - return this; - } - var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS); - function attrNull() { - this.removeAttribute(name); - } - function attrNullNS() { - this.removeAttributeNS(name.space, name.local); - } - function attrTween(b) { - return b == null ? attrNull : (b += "", function() { - var a = this.getAttribute(name), i; - return a !== b && (i = interpolate(a, b), function(t) { - this.setAttribute(name, i(t)); - }); - }); - } - function attrTweenNS(b) { - return b == null ? attrNullNS : (b += "", function() { - var a = this.getAttributeNS(name.space, name.local), i; - return a !== b && (i = interpolate(a, b), function(t) { - this.setAttributeNS(name.space, name.local, i(t)); - }); - }); - } - return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween); - }; - d3_transitionPrototype.attrTween = function(nameNS, tween) { - var name = d3.ns.qualify(nameNS); - function attrTween(d, i) { - var f = tween.call(this, d, i, this.getAttribute(name)); - return f && function(t) { - this.setAttribute(name, f(t)); - }; - } - function attrTweenNS(d, i) { - var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local)); - return f && function(t) { - this.setAttributeNS(name.space, name.local, f(t)); - }; - } - return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween); - }; - d3_transitionPrototype.style = function(name, value, priority) { - var n = arguments.length; - if (n < 3) { - if (typeof name !== "string") { - if (n < 2) value = ""; - for (priority in name) this.style(priority, name[priority], value); - return this; - } - priority = ""; - } - function styleNull() { - this.style.removeProperty(name); - } - function styleString(b) { - return b == null ? styleNull : (b += "", function() { - var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i; - return a !== b && (i = d3_interpolate(a, b), function(t) { - this.style.setProperty(name, i(t), priority); - }); - }); - } - return d3_transition_tween(this, "style." + name, value, styleString); - }; - d3_transitionPrototype.styleTween = function(name, tween, priority) { - if (arguments.length < 3) priority = ""; - function styleTween(d, i) { - var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name)); - return f && function(t) { - this.style.setProperty(name, f(t), priority); - }; - } - return this.tween("style." + name, styleTween); - }; - d3_transitionPrototype.text = function(value) { - return d3_transition_tween(this, "text", value, d3_transition_text); - }; - function d3_transition_text(b) { - if (b == null) b = ""; - return function() { - this.textContent = b; - }; - } - d3_transitionPrototype.remove = function() { - return this.each("end.transition", function() { - var p; - if (this.__transition__.count < 2 && (p = this.parentNode)) p.removeChild(this); - }); - }; - d3_transitionPrototype.ease = function(value) { - var id = this.id; - if (arguments.length < 1) return this.node().__transition__[id].ease; - if (typeof value !== "function") value = d3.ease.apply(d3, arguments); - return d3_selection_each(this, function(node) { - node.__transition__[id].ease = value; - }); - }; - d3_transitionPrototype.delay = function(value) { - var id = this.id; - if (arguments.length < 1) return this.node().__transition__[id].delay; - return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node.__transition__[id].delay = +value.call(node, node.__data__, i, j); - } : (value = +value, function(node) { - node.__transition__[id].delay = value; - })); - }; - d3_transitionPrototype.duration = function(value) { - var id = this.id; - if (arguments.length < 1) return this.node().__transition__[id].duration; - return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { - node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j)); - } : (value = Math.max(1, value), function(node) { - node.__transition__[id].duration = value; - })); - }; - d3_transitionPrototype.each = function(type, listener) { - var id = this.id; - if (arguments.length < 2) { - var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; - d3_transitionInheritId = id; - d3_selection_each(this, function(node, i, j) { - d3_transitionInherit = node.__transition__[id]; - type.call(node, node.__data__, i, j); - }); - d3_transitionInherit = inherit; - d3_transitionInheritId = inheritId; - } else { - d3_selection_each(this, function(node) { - var transition = node.__transition__[id]; - (transition.event || (transition.event = d3.dispatch("start", "end"))).on(type, listener); - }); - } - return this; - }; - d3_transitionPrototype.transition = function() { - var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition; - for (var j = 0, m = this.length; j < m; j++) { - subgroups.push(subgroup = []); - for (var group = this[j], i = 0, n = group.length; i < n; i++) { - if (node = group[i]) { - transition = Object.create(node.__transition__[id0]); - transition.delay += transition.duration; - d3_transitionNode(node, i, id1, transition); - } - subgroup.push(node); - } - } - return d3_transition(subgroups, id1); - }; - function d3_transitionNode(node, i, id, inherit) { - var lock = node.__transition__ || (node.__transition__ = { - active: 0, - count: 0 - }), transition = lock[id]; - if (!transition) { - var time = inherit.time; - transition = lock[id] = { - tween: new d3_Map(), - time: time, - ease: inherit.ease, - delay: inherit.delay, - duration: inherit.duration - }; - ++lock.count; - d3.timer(function(elapsed) { - var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, timer = d3_timer_active, tweened = []; - timer.t = delay + time; - if (delay <= elapsed) return start(elapsed - delay); - timer.c = start; - function start(elapsed) { - if (lock.active > id) return stop(); - lock.active = id; - transition.event && transition.event.start.call(node, d, i); - transition.tween.forEach(function(key, value) { - if (value = value.call(node, d, i)) { - tweened.push(value); - } - }); - d3.timer(function() { - timer.c = tick(elapsed || 1) ? d3_true : tick; - return 1; - }, 0, time); - } - function tick(elapsed) { - if (lock.active !== id) return stop(); - var t = elapsed / duration, e = ease(t), n = tweened.length; - while (n > 0) { - tweened[--n].call(node, e); - } - if (t >= 1) { - transition.event && transition.event.end.call(node, d, i); - return stop(); - } - } - function stop() { - if (--lock.count) delete lock[id]; else delete node.__transition__; - return 1; - } - }, 0, time); - } - } - d3.svg.axis = function() { - var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_; - function axis(g) { - g.each(function() { - var g = d3.select(this); - var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy(); - var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickTransform; - var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), - d3.transition(path)); - tickEnter.append("line"); - tickEnter.append("text"); - var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"); - switch (orient) { - case "bottom": - { - tickTransform = d3_svg_axisX; - lineEnter.attr("y2", innerTickSize); - textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding); - lineUpdate.attr("x2", 0).attr("y2", innerTickSize); - textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding); - text.attr("dy", ".71em").style("text-anchor", "middle"); - pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize); - break; - } - - case "top": - { - tickTransform = d3_svg_axisX; - lineEnter.attr("y2", -innerTickSize); - textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); - lineUpdate.attr("x2", 0).attr("y2", -innerTickSize); - textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding)); - text.attr("dy", "0em").style("text-anchor", "middle"); - pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize); - break; - } - - case "left": - { - tickTransform = d3_svg_axisY; - lineEnter.attr("x2", -innerTickSize); - textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)); - lineUpdate.attr("x2", -innerTickSize).attr("y2", 0); - textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0); - text.attr("dy", ".32em").style("text-anchor", "end"); - pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize); - break; - } - - case "right": - { - tickTransform = d3_svg_axisY; - lineEnter.attr("x2", innerTickSize); - textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding); - lineUpdate.attr("x2", innerTickSize).attr("y2", 0); - textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0); - text.attr("dy", ".32em").style("text-anchor", "start"); - pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize); - break; - } - } - if (scale1.rangeBand) { - var x = scale1, dx = x.rangeBand() / 2; - scale0 = scale1 = function(d) { - return x(d) + dx; - }; - } else if (scale0.rangeBand) { - scale0 = scale1; - } else { - tickExit.call(tickTransform, scale1); - } - tickEnter.call(tickTransform, scale0); - tickUpdate.call(tickTransform, scale1); - }); - } - axis.scale = function(x) { - if (!arguments.length) return scale; - scale = x; - return axis; - }; - axis.orient = function(x) { - if (!arguments.length) return orient; - orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient; - return axis; - }; - axis.ticks = function() { - if (!arguments.length) return tickArguments_; - tickArguments_ = arguments; - return axis; - }; - axis.tickValues = function(x) { - if (!arguments.length) return tickValues; - tickValues = x; - return axis; - }; - axis.tickFormat = function(x) { - if (!arguments.length) return tickFormat_; - tickFormat_ = x; - return axis; - }; - axis.tickSize = function(x) { - var n = arguments.length; - if (!n) return innerTickSize; - innerTickSize = +x; - outerTickSize = +arguments[n - 1]; - return axis; - }; - axis.innerTickSize = function(x) { - if (!arguments.length) return innerTickSize; - innerTickSize = +x; - return axis; - }; - axis.outerTickSize = function(x) { - if (!arguments.length) return outerTickSize; - outerTickSize = +x; - return axis; - }; - axis.tickPadding = function(x) { - if (!arguments.length) return tickPadding; - tickPadding = +x; - return axis; - }; - axis.tickSubdivide = function() { - return arguments.length && axis; - }; - return axis; - }; - var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = { - top: 1, - right: 1, - bottom: 1, - left: 1 - }; - function d3_svg_axisX(selection, x) { - selection.attr("transform", function(d) { - return "translate(" + x(d) + ",0)"; - }); - } - function d3_svg_axisY(selection, y) { - selection.attr("transform", function(d) { - return "translate(0," + y(d) + ")"; - }); - } - d3.svg.brush = function() { - var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0]; - function brush(g) { - g.each(function() { - var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart); - var background = g.selectAll(".background").data([ 0 ]); - background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); - g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move"); - var resize = g.selectAll(".resize").data(resizes, d3_identity); - resize.exit().remove(); - resize.enter().append("g").attr("class", function(d) { - return "resize " + d; - }).style("cursor", function(d) { - return d3_svg_brushCursor[d]; - }).append("rect").attr("x", function(d) { - return /[ew]$/.test(d) ? -3 : null; - }).attr("y", function(d) { - return /^[ns]/.test(d) ? -3 : null; - }).attr("width", 6).attr("height", 6).style("visibility", "hidden"); - resize.style("display", brush.empty() ? "none" : null); - var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range; - if (x) { - range = d3_scaleRange(x); - backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]); - redrawX(gUpdate); - } - if (y) { - range = d3_scaleRange(y); - backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]); - redrawY(gUpdate); - } - redraw(gUpdate); - }); - } - brush.event = function(g) { - g.each(function() { - var event_ = event.of(this, arguments), extent1 = { - x: xExtent, - y: yExtent, - i: xExtentDomain, - j: yExtentDomain - }, extent0 = this.__chart__ || extent1; - this.__chart__ = extent1; - if (d3_transitionInheritId) { - d3.select(this).transition().each("start.brush", function() { - xExtentDomain = extent0.i; - yExtentDomain = extent0.j; - xExtent = extent0.x; - yExtent = extent0.y; - event_({ - type: "brushstart" - }); - }).tween("brush:brush", function() { - var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y); - xExtentDomain = yExtentDomain = null; - return function(t) { - xExtent = extent1.x = xi(t); - yExtent = extent1.y = yi(t); - event_({ - type: "brush", - mode: "resize" - }); - }; - }).each("end.brush", function() { - xExtentDomain = extent1.i; - yExtentDomain = extent1.j; - event_({ - type: "brush", - mode: "resize" - }); - event_({ - type: "brushend" - }); - }); - } else { - event_({ - type: "brushstart" - }); - event_({ - type: "brush", - mode: "resize" - }); - event_({ - type: "brushend" - }); - } - }); - }; - function redraw(g) { - g.selectAll(".resize").attr("transform", function(d) { - return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")"; - }); - } - function redrawX(g) { - g.select(".extent").attr("x", xExtent[0]); - g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]); - } - function redrawY(g) { - g.select(".extent").attr("y", yExtent[0]); - g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]); - } - function brushstart() { - var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), dragRestore = d3_event_dragSuppress(), center, origin = d3.mouse(target), offset; - var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup); - if (d3.event.changedTouches) { - w.on("touchmove.brush", brushmove).on("touchend.brush", brushend); - } else { - w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend); - } - g.interrupt().selectAll("*").interrupt(); - if (dragging) { - origin[0] = xExtent[0] - origin[0]; - origin[1] = yExtent[0] - origin[1]; - } else if (resizing) { - var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing); - offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ]; - origin[0] = xExtent[ex]; - origin[1] = yExtent[ey]; - } else if (d3.event.altKey) center = origin.slice(); - g.style("pointer-events", "none").selectAll(".resize").style("display", null); - d3.select("body").style("cursor", eventTarget.style("cursor")); - event_({ - type: "brushstart" - }); - brushmove(); - function keydown() { - if (d3.event.keyCode == 32) { - if (!dragging) { - center = null; - origin[0] -= xExtent[1]; - origin[1] -= yExtent[1]; - dragging = 2; - } - d3_eventPreventDefault(); - } - } - function keyup() { - if (d3.event.keyCode == 32 && dragging == 2) { - origin[0] += xExtent[1]; - origin[1] += yExtent[1]; - dragging = 0; - d3_eventPreventDefault(); - } - } - function brushmove() { - var point = d3.mouse(target), moved = false; - if (offset) { - point[0] += offset[0]; - point[1] += offset[1]; - } - if (!dragging) { - if (d3.event.altKey) { - if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ]; - origin[0] = xExtent[+(point[0] < center[0])]; - origin[1] = yExtent[+(point[1] < center[1])]; - } else center = null; - } - if (resizingX && move1(point, x, 0)) { - redrawX(g); - moved = true; - } - if (resizingY && move1(point, y, 1)) { - redrawY(g); - moved = true; - } - if (moved) { - redraw(g); - event_({ - type: "brush", - mode: dragging ? "move" : "resize" - }); - } - } - function move1(point, scale, i) { - var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; - if (dragging) { - r0 -= position; - r1 -= size + position; - } - min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i]; - if (dragging) { - max = (min += position) + size; - } else { - if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min)); - if (position < min) { - max = min; - min = position; - } else { - max = position; - } - } - if (extent[0] != min || extent[1] != max) { - if (i) yExtentDomain = null; else xExtentDomain = null; - extent[0] = min; - extent[1] = max; - return true; - } - } - function brushend() { - brushmove(); - g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null); - d3.select("body").style("cursor", null); - w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null); - dragRestore(); - event_({ - type: "brushend" - }); - } - } - brush.x = function(z) { - if (!arguments.length) return x; - x = z; - resizes = d3_svg_brushResizes[!x << 1 | !y]; - return brush; - }; - brush.y = function(z) { - if (!arguments.length) return y; - y = z; - resizes = d3_svg_brushResizes[!x << 1 | !y]; - return brush; - }; - brush.clamp = function(z) { - if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null; - if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z; - return brush; - }; - brush.extent = function(z) { - var x0, x1, y0, y1, t; - if (!arguments.length) { - if (x) { - if (xExtentDomain) { - x0 = xExtentDomain[0], x1 = xExtentDomain[1]; - } else { - x0 = xExtent[0], x1 = xExtent[1]; - if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - } - } - if (y) { - if (yExtentDomain) { - y0 = yExtentDomain[0], y1 = yExtentDomain[1]; - } else { - y0 = yExtent[0], y1 = yExtent[1]; - if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - } - } - return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ]; - } - if (x) { - x0 = z[0], x1 = z[1]; - if (y) x0 = x0[0], x1 = x1[0]; - xExtentDomain = [ x0, x1 ]; - if (x.invert) x0 = x(x0), x1 = x(x1); - if (x1 < x0) t = x0, x0 = x1, x1 = t; - if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ]; - } - if (y) { - y0 = z[0], y1 = z[1]; - if (x) y0 = y0[1], y1 = y1[1]; - yExtentDomain = [ y0, y1 ]; - if (y.invert) y0 = y(y0), y1 = y(y1); - if (y1 < y0) t = y0, y0 = y1, y1 = t; - if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ]; - } - return brush; - }; - brush.clear = function() { - if (!brush.empty()) { - xExtent = [ 0, 0 ], yExtent = [ 0, 0 ]; - xExtentDomain = yExtentDomain = null; - } - return brush; - }; - brush.empty = function() { - return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1]; - }; - return d3.rebind(brush, event, "on"); - }; - var d3_svg_brushCursor = { - n: "ns-resize", - e: "ew-resize", - s: "ns-resize", - w: "ew-resize", - nw: "nwse-resize", - ne: "nesw-resize", - se: "nwse-resize", - sw: "nesw-resize" - }; - var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ]; - var d3_time_format = d3_time.format = d3_locale_enUS.timeFormat; - var d3_time_formatUtc = d3_time_format.utc; - var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ"); - d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso; - function d3_time_formatIsoNative(date) { - return date.toISOString(); - } - d3_time_formatIsoNative.parse = function(string) { - var date = new Date(string); - return isNaN(date) ? null : date; - }; - d3_time_formatIsoNative.toString = d3_time_formatIso.toString; - d3_time.second = d3_time_interval(function(date) { - return new d3_date(Math.floor(date / 1e3) * 1e3); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 1e3); - }, function(date) { - return date.getSeconds(); - }); - d3_time.seconds = d3_time.second.range; - d3_time.seconds.utc = d3_time.second.utc.range; - d3_time.minute = d3_time_interval(function(date) { - return new d3_date(Math.floor(date / 6e4) * 6e4); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 6e4); - }, function(date) { - return date.getMinutes(); - }); - d3_time.minutes = d3_time.minute.range; - d3_time.minutes.utc = d3_time.minute.utc.range; - d3_time.hour = d3_time_interval(function(date) { - var timezone = date.getTimezoneOffset() / 60; - return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5); - }, function(date, offset) { - date.setTime(date.getTime() + Math.floor(offset) * 36e5); - }, function(date) { - return date.getHours(); - }); - d3_time.hours = d3_time.hour.range; - d3_time.hours.utc = d3_time.hour.utc.range; - d3_time.month = d3_time_interval(function(date) { - date = d3_time.day(date); - date.setDate(1); - return date; - }, function(date, offset) { - date.setMonth(date.getMonth() + offset); - }, function(date) { - return date.getMonth(); - }); - d3_time.months = d3_time.month.range; - d3_time.months.utc = d3_time.month.utc.range; - function d3_time_scale(linear, methods, format) { - function scale(x) { - return linear(x); - } - scale.invert = function(x) { - return d3_time_scaleDate(linear.invert(x)); - }; - scale.domain = function(x) { - if (!arguments.length) return linear.domain().map(d3_time_scaleDate); - linear.domain(x); - return scale; - }; - function tickMethod(extent, count) { - var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target); - return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) { - return d / 31536e6; - }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i]; - } - scale.nice = function(interval, skip) { - var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval); - if (method) interval = method[0], skip = method[1]; - function skipped(date) { - return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length; - } - return scale.domain(d3_scale_nice(domain, skip > 1 ? { - floor: function(date) { - while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1); - return date; - }, - ceil: function(date) { - while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1); - return date; - } - } : interval)); - }; - scale.ticks = function(interval, skip) { - var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ { - range: interval - }, skip ]; - if (method) interval = method[0], skip = method[1]; - return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip); - }; - scale.tickFormat = function() { - return format; - }; - scale.copy = function() { - return d3_time_scale(linear.copy(), methods, format); - }; - return d3_scale_linearRebind(scale, linear); - } - function d3_time_scaleDate(t) { - return new Date(t); - } - var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ]; - var d3_time_scaleLocalMethods = [ [ d3_time.second, 1 ], [ d3_time.second, 5 ], [ d3_time.second, 15 ], [ d3_time.second, 30 ], [ d3_time.minute, 1 ], [ d3_time.minute, 5 ], [ d3_time.minute, 15 ], [ d3_time.minute, 30 ], [ d3_time.hour, 1 ], [ d3_time.hour, 3 ], [ d3_time.hour, 6 ], [ d3_time.hour, 12 ], [ d3_time.day, 1 ], [ d3_time.day, 2 ], [ d3_time.week, 1 ], [ d3_time.month, 1 ], [ d3_time.month, 3 ], [ d3_time.year, 1 ] ]; - var d3_time_scaleLocalFormat = d3_time_format.multi([ [ ".%L", function(d) { - return d.getMilliseconds(); - } ], [ ":%S", function(d) { - return d.getSeconds(); - } ], [ "%I:%M", function(d) { - return d.getMinutes(); - } ], [ "%I %p", function(d) { - return d.getHours(); - } ], [ "%a %d", function(d) { - return d.getDay() && d.getDate() != 1; - } ], [ "%b %d", function(d) { - return d.getDate() != 1; - } ], [ "%B", function(d) { - return d.getMonth(); - } ], [ "%Y", d3_true ] ]); - var d3_time_scaleMilliseconds = { - range: function(start, stop, step) { - return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); - }, - floor: d3_identity, - ceil: d3_identity - }; - d3_time_scaleLocalMethods.year = d3_time.year; - d3_time.scale = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat); - }; - var d3_time_scaleUtcMethods = d3_time_scaleLocalMethods.map(function(m) { - return [ m[0].utc, m[1] ]; - }); - var d3_time_scaleUtcFormat = d3_time_formatUtc.multi([ [ ".%L", function(d) { - return d.getUTCMilliseconds(); - } ], [ ":%S", function(d) { - return d.getUTCSeconds(); - } ], [ "%I:%M", function(d) { - return d.getUTCMinutes(); - } ], [ "%I %p", function(d) { - return d.getUTCHours(); - } ], [ "%a %d", function(d) { - return d.getUTCDay() && d.getUTCDate() != 1; - } ], [ "%b %d", function(d) { - return d.getUTCDate() != 1; - } ], [ "%B", function(d) { - return d.getUTCMonth(); - } ], [ "%Y", d3_true ] ]); - d3_time_scaleUtcMethods.year = d3_time.year.utc; - d3_time.scale.utc = function() { - return d3_time_scale(d3.scale.linear(), d3_time_scaleUtcMethods, d3_time_scaleUtcFormat); - }; - d3.text = d3_xhrType(function(request) { - return request.responseText; - }); - d3.json = function(url, callback) { - return d3_xhr(url, "application/json", d3_json, callback); - }; - function d3_json(request) { - return JSON.parse(request.responseText); - } - d3.html = function(url, callback) { - return d3_xhr(url, "text/html", d3_html, callback); - }; - function d3_html(request) { - var range = d3_document.createRange(); - range.selectNode(d3_document.body); - return range.createContextualFragment(request.responseText); - } - d3.xml = d3_xhrType(function(request) { - return request.responseXML; - }); - if (typeof define === "function" && define.amd) { - define(d3); - } else if (typeof module === "object" && module.exports) { - module.exports = d3; - } else { - this.d3 = d3; - } -}(); \ No newline at end of file diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/acceptDeleteIcon.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/acceptDeleteIcon.png deleted file mode 100644 index 02a062852c2a8ea7610b64f5d6f79ce4953c3b42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20675 zcmeI43p|tU|Hp4BXOa|>o}q-yj>hJ^&6%7-RA!r5Y-5%=l;}i9NeGeZkyBKZk`Ck; zAv&leiIP0@TI8t#qC#L`gixC>Y z2nN~UaG+o&!=D;N27vG18rrJjvbOQ6 zCm%0yu3BVaF<-eMJ6`zEp_l_poOPu3NjwtmQ$2NP=jr%;jh}j=P6s}`Hu0+Y%cTyJ z{6*n#tPBQZ#Y#!4p;PKYz+|+M(HgZ% z(HnqJ_&rH6pwc0u61qHYdf^*vnvYP-E}=?RqJf=Qj67f#c?f$3FtZej$vmdv3S`d* ze4B`Vy?_%K@Lj$A)jc34b22ST2=G3tx3wlIDZ+aY>|~L0mP&LsB`>oEnt2W;M<_C9uDkE1LQ47JdED0DVFWm=8#G& zF)Ck)wuto>1BZxuc<8RsY_U;TBab4?Bcz+@-ik<5g2y5kJ|DdU0NII4IA=RL72YCK z+|q(NR3@_t{N|>}w3?q^@0XXYg~4V3(8G#u`=SFWT^3^~5<~lPYSr-kfQ^#bTPF7V zmn<~91Y{39@fZ!}vavXMxcu?smwkPYY-_OIghr2TUnsXWReDSXeTX*tJTdTJQQ(L~*SuW%dKK;NbJV$LW z_J~&Ps`hEpi*B7y!Y18%!1>K4LQ#p}ybVO*_japgJz146CIDchf>Cu}Q%pD}U}sM& zd-|>ElvVaBAjaS3NC*II#IMwKYb-Ub7Xtu%cC7Y!bLFurMV(5KEB*bPm{)6fC2A%l(Rsaqz;A1hK3t&1x@G6rofWRwJ5Fr9z@9G`Yf&kV zn$O092rJC3J?%Z$KC;dOEnkUT^h8`=TzHrBt<`Etd3F~yt}gmeqv!{R#d%ums6UiT zSPYSkipSOHuaw)1gRd?>JkRFBuWs#f?UwCy7xe+1{0yY^GWDd}Pe_3!qUfVKpfwG< z`!f5g`w)G~eX1kg5}AHxA-_(#zR+}O+-$4#QuZbCr3m>L+}!bcjftBbmlSFBCF>(SmcVD&onweT2Q zN_x+do%Qh)O{EM)QALUpTk+g6`!h=S_AAx9LG@vS$NJM2rZL<-wac`(E=g>ZNVZMZ zNLJQ{xaAj|DR@>O=|1Y-t)o5I3e!MkIyW-fCO2vNT zg8Y+c9KsgiQR*^!)ZbLJ_gKi}an@S#e$Cv}(dd28#W3ucSxz8f5_kUcz4Kn36Mf;dLZYAX@QYy7lq*JOz(Wq80gkhut zsqcK}jN4FchRY!&6H1toqk|>&~o7cYMoE-%3fL>t?smjh=!_$ox>Z4;dB>= z@-tdz4DAi=>znU1pK5-Xrk7z1>wx!X^k;NrbYJ#eAHH6vEU)Ye*`}m#{TZ*}vTO9+ z>(O30p6=^6lv);L7Oi?%QB;w;D7SoV(%QnThm`8`@5*kM+@w`Q&2-JUXGKwL~&$7)8_rrq7R?dsE{>B#9eAU9@} z5Jh-zta+^Wyib#nTUBo!GR1U~-fN7Kh~1i zLY3L=6#e?)T~Wd-!v5-LsnxsVc6;nGJro@8xvUMAs>g17iVN+=f5fNYpJh;Bj_7k> zTRm-)0^Q9t*c#(q6gjR{ya1q_agI!WN(zhF-XIP z;E0ngx5jqoF3s1K)4`;e*~hOnIQqM}tajeg1FJ?BvsWFGh`6P4i=qZ;L$$>}!ue>g zSUX~^?GSn7x5R6D5i4sEIXW-PcdgDpe9d0kzAFQhwKP2pM1vb+uETa7Njw~aEl_nx zDxKWJ^XJr?`=e< z6lSey9=cQ7*m+q0_}dfHLvpv|dXALk?6LCzt9ZV;es(ju#3&@9Q=)gtf;D^AiJUdM zvad{=_Q0`l$Ro8l`npD>LtyO2s>U5vmxKZbCEX=n?%p=|v}0(4qbJ0x`x4>fo=jzv zC42W3%XccIF4_J_^J(}?c zQM!BG#i8-{7M+mPX3fruon^T4(>IN-TqEb+ZfQ0&b^FzA%vk(glX~Kf`Q4DPqYn1YiS`v^}_AKQ=;lJ zWgX@BAE>k&ySXGhTr+4TQ~%42FPU%IU}==J`@!RNFVuta5q$#_;@uM~q%lvz4n&>p z5xw_Imf3p$EUKT_(!F^hC7mx9dtC8I zKZn^wd&7ET^d;$@V|~T(iuB@gpTP3r$m^G){3iyKv-DfK#;!-aTRQ#lK^EG$>-uOU zW1@CqynAU^G;{S-OH;*T_UhrHYmV18jhPLZKgM;%JuvnD^7PT$r`tDIva?6qo?1C2>4qA#OoJT0+wv={nEQeHyA_KV_@DJ>9*~v2QDAyXJJj zhYRDbcXK}_DJ3OM&lf&6`k9CTcLIR94Asq(<>_FLAu?#X1QNrKtQ$@X<`kj;U}PE| zOdtl5Ss*_$g-SP8ds}f+4MZgwt9j@-Kplc{#s8AwEv)J#nzjKVP- z0UDV_0EN?n=%JW!W3{ik7>> z1Qvto#$W`Q%q-U*7h;_2Fij6Coy1^=Y8gR(_WrSEeh88A1QywZv!;tQ!I{5P@bw$nIr8A0u4Eb5w2*S<%LDc_-2?!;G{d@Q=%u!HtIMM=! zHb8P0w>jS2(!$aLWr0H=5Ef9x_o@9C@FTd{2xfqR>VMB8|2z19tXg6KfleWlOd#LS z>U+cgry27jqWt~HFcjDy4JCp7^pHrffgZvDjE2KVD5#&m9+K?${rvvfS(`Ka|0ibc z58rJ3?3w>tlSX9F!^q5kCev~9DS=a-l9{0<{!9i9Ly^Q*E z4a2Q>Ib|DuW?@=#w-fgZ^&gikoT`I!&48H&{Cl~`Zxa0}{14mkn>y)VsTgMtY*y%8 z%8Y-fXq*{g4v8NleJ4H(?5q;Sh?kr&I7SeI>A)b7O*r+yT+OpIe{^$xS8|&9S;-{S z#R?0uvB05VXcP(z*X7jAbNbEF;a+)RI5jV)2K$;dO*k=sYWvyWlUut6ZTVW8>cgQ> zG?a6#&v|_do!$L&sMp_z&hGv>^hcySoyszSe;e(m=2=nP%flI{uAEyUWbUc`-1M`z z6E&P1kjV}OTjsbuI2 zoa%}AGBG}Kb9nGZvA2YzWJpC9kf*ISFDBk8oO0Sjx(V9XU}|rCuwKdO+k69)bSIMNx$BT*O;5ECF z+*bhcc(r&jV`F1$XXiyL5-2fMjRoT$Hank;(Y|sT#+cs6Zsz*f} zk#cxVesV

f872;krtRzfp_o=TYSP*TrE~<$bp}nD3~hFYp;1DGZ-jGo4-ce*4ke z>~e%i?K7QsqnkG_*$mR~XAkEb6j$3(pj{xZDAX}l8=c}Y`HNB!EPEsXWmonw?P`Og zr}=O5+$~I}221B3JZ}zuJ_PyfXfOWi-S3~VrYX`X*L!x}ylL-*PtD(v{J~PiW}ACE zM0vIDs=Lo`FgoXTUQJ*l%eB(V$5b;HwTj$s$geIjBc;tl<72cWm#MT#MPM3|lf;3e z{*dg=(^4%ejlTvx!ve(~QA%L?zeFf>96l@@c=lj@NtIJ!{JMF;?*baLskVv= z*|*+xq)O^G;+(p^KC7W)E%434+vd(<4)`$sC0bKe$=yrA zC&b8=B5$;}eZHvG@B%#HUH3?dwp?dLbJ@Ten1o+!04rzhhjG>3`iaRaVeN4jK=Rs) z7m@l~GHdGUjzm#=*VpLQYu;J!Tzjf{`ZQ#!esXs;LOjl_`Kqv1M1`TDA@_+QSA29^ zR<-13MGhJ$uE|J|ynS)wC7b5WwJOSyXM2Wa6zanq`bREM^X8R&FtgpLWyWAIj#k}0 ziQ8L7BY(&_wbf_c0)kM}o&(3%w{N1Wk!=k_@;Bs}J-5_3c}OIat6es3Jk&WVRZ{%DI6H? nI=6;CK4|hfyRdNoc2VHed(;aY^0IjN&|TBJ8-Rjfy}F-(#K^GUrYlJ|7ixclz1>^WKlDCtu#1yV|8Q zTsV~5#`8?13>GDQHFq*7Esvc7-IxDLjVy^^9B^~ zSQUVnIeD4_m&$?KR$=}UfL8#3*hC#w0=V`A?zcB>3IvWM10u%noiOjV6blb4Ge{+u zU@GKLM&UbnRrl~XIjL<_Y&8?#B7(%Nz@_M^-3&^WgoPu7o=&s?KxUjM<7_8p16u`) zTU(JQ$^_k1M{aP>%X)YW&JDE{`04?`GkR$IoC>&feV7(^7-jC<<}og>UHqAQCy#lS z2gmmv4;EP)+D@%H;?egq)?}ufe||>#foy}BM}@Pp$e_*IJtquPj!(d{WTOpE zDc#!KF;93tpfb&=GoTJ!+O5N}KTb8*70>y}TtV2GUi*9!0Nz*8>K-cca)x;we%2N+ zKdw7#lDQcO^E5lP2LN^%%Bk7kE!Az}1pvd$aOF$-QXlFhRBE|5)UE8R zxM?74z()w%;ODMXc*sC8;@%}`Wq0sHJ!wR(jaNjxub|pZhiih`zCvGcycubl>J;=dS`n|T_3RL7y zbR9O{|Z@w&BC{WP2{*q%MXI1n^eB0#!uC?JtwX2X^ z0R|x4MtxIf3umjxrn#UEa)>oOt29<|9a+@I%k85t z(qGiSfWMG>A@hC*U%H3ho(ofU&lPR&?%panBs_!|;wC1+^c~Kp*gnZUYrjT4cDq5* z*)rRUHj%mO5PMTl_YRAhnP(N9OL(x}OWbRceDM{%a?O*3jaG^GojRIdo4iVV#rYvX zV0DD(;if2(qGYNBj|53FK;mMOMYiOFW0Fnw5Dn;?q~TE_Idf)`ThC)4igT|_OW@p>_Uo-9pH9@d8;0tDR9V7-}c5%%8rz$l^dB)%B9)s zUI=xWjplZ#x2U(qUa-l$>^4~42;#>}mIkWGc&{#q*c-0iAb}0NLSy>AOme1~e zmn>(8?XIQ9Md?MGA5|4q<*do6u!^@T$aqAmzx1x`PFY^Lh4>n^J}g-2Z<4ZR}H

|#V-x46+1BId1SnF`o)!|KGJUGs&sOwUB zRzUtFZd_dFlaAkSgF1s4jec0ai(89EZTao;X6t%dhTG8r?7>a*g!$n4b|5EgGY5$? zI$S?|$BOBx-~%!@PUxb0iJwZkNA-_qR_KfB#~vy=G*nk4<8}M($s(D_;iT5MR-6;L=DdDJOF_k?eh^ZIsZqIy7kAJ%`s@QdLY!~Rqf)EaeBb*s9v zPQKc1Opit-qEfd}&C{i&(>dMQ%*T8KN=>;KN%grtFf%$4`8@qO|KNV{B=Bul-=MRt zH$NQB5zA9stAakGXAxzkdHQ#KVdY%0qt$y; zWy|1GZ{w=fgXC_(vs8vEjws}vthQKf@gxCf#;5Q>B+*CE~9I?jEYU%HjQn-+^!FXvmwsu2ENOXRyn_Ros_|bSWLt=$K-W zUhzcHgO3&a0*9m`X?JfV_np3ySI|&FX!GpweEqUtHDib1nf%0;iGtMC-91-U4>(>K z{rJhK7o2!cvA61Q8Mfm54a~J_V$Pk`ds@2o7wkXSf3Zi7bv(I>>zbmrk4f#X{)Bkj z*}J29a#rWg^+PU5uLbm^pSadiIcsWa0Q*CH#*p3x@G4$fJgO@d`z6%RY5 zJGAX>V;^mKVHS404S{h9+B#u>hurh}(1Uo=`?llh z3F#rBYM=Yud(V~aAI7&1>=vSpR|?agbr{Vb8`i4UYTfz%8vT7q@6bA@YfdQ_(QcFx z`Uqw&{(*HYcg*!Y9`8H2yEY(mqP@>#lKbf4wz;^E zu|n9DvB|N`5vwEKWN7N3P|tP!W?#?bVA}|7@)_cD=jNJ=#l^s(Q=M+|K0cK36p z<0a$c=eanOCT8$()m{M57bM#|)156X(0Cd}4M(7P5Y+-HzKlW?05H0NzBs%$kq+`8 zlE_qT+3~6yvLG@+Th>Y45@P9#C3=xfgZ+qh!B+P8U~fE%AgimxhY3V81Smv04irf7 zq57i(wPnBRq8au=Ggub%)rIb@EvvuKA;{Ts8wgADBZAb`)K&2i7!;&|QiG}^P*A7} z2nK<|!B7YohEjz>(FhGR6bbtFlGWj3SQtNoC)(D~_*-|3|FmVj=yYE+7#t7~pcVjE zqxq4*P!tLUhQPoum@30V)jxOKwPj@& zI%2-QofpNI*%8(M8#@L?a3IbX3{``GmkT1`nK8b5{d~R-jerLeeTWnymF~}ogDxA# zKx%2p3|+Q63T4?yf4b2=#uzZ1eY7B!q8tX^I(P@76 zG@6gj;&T0QA;!24Q*f_KCZN>`>K+gz0ivqz z34^F=;t&W`9Gqc!dP1RaI0AyuKzMw`VQINE{7=$`H2mI$z4J|)z>qf5*FeIIQAiDh zCfo=Pg`yCe28K|$5zN3y1BKFuewSSm`X^ayKQbfd;e3|(ER1|XUIT7`gz4)WqM&~- zzl_A6x-ljDGZt6Sl10Z@dS5e|9dXYeTfZOhA%D$GzBoUB;=;z&mi@kSnW>DKsTN|s zCIB=JzmU^(@C&P%NWg&q(E4Lo%*bzHkoh{tNiw3)u*&iH2x=&m;dk_G)2RE1e*a9SW8_mDqdX=0`RjQ4(I_CCudfdok6Xx^;C)oWxB8A*ntGeMAGYB)b;7?=F)j{lN$7IQ zw11~)TPi61?EC%y#ik`e{OOipMl&4=b^Nh1(-81=w%%}X?Y9A^Bkv~BTcB^`fT z69bT$5f%wWA(5&uHAc<6tltuyg)1*KqvmDQU|+MQ4kPAIZ9n@vFVwC+d%xDE8ZZb1 z1z}w4GhW|9mmdB()aCC(mmdB(^hcxvl}y)xee3O~<|R=Jmxqf`?HIR2hzqCobJNe> z+sJ`LA7?`{GUziowRk3MHlw8y6D=D+U`EE0mZ%Y+OtftQc%utWaY5uyHX_uwt-ru|kRI!^Xu# z!HU7g#R?^+4;vQ~1uF&{7b}#QK5Se}6s#C*T&z%H`mk{^QLtjLaj`;)>BGjwM8S%| z#>EOHrVkqz69p><8y72-m_BS=OcbmbY+S5RV*0RgF;TE$uyL_MiRr_}#YDl1!N$c3 zC8iG>7ZU|51{)VEl$btjTucGUzit)F&_aHMRr?~)AdpVY1@nJk8=NI2DPE);xh>d12?K`1Ues{O)lsTQFJ z77tsU>p>4}IcMY0JyyL(E~n=b8ldhcA}G58KG+a5>tJ`>Sgh7P^FZsD)(#i% z1Lo3OR&)njB>^9fUVm8J=WXuIe}#}y*?T%tLWHAJ7gK&7dOgM+!rN21cMD^<@WH9O zvsD6(8|B^i8fTTu2TWdF`6O1E9S@~rgR&xdn{#-P?dMpa!I`}bOJ(BtFdbHBQM zPxV_p^;PQ)!z{=0kI~e0`o=D`#xyEaBK#U{LWXWRtaf`?gb5lR6e!QoI*n_t{B5`8 zvEr1PI`Om(v2*)pcFRZItt{=~tl%7|5&6|v=JV&zUM_nf(#P%OYMZ;Y)W){cYqhkS zpG9juqKv-jdJ+P8wT)00NPieAbAM#J773py{{;&uZr%U##Hx-sB_EgG(cQEIB>{Vq zk|l-T5;z>&Lh7c!oD1nUA!}+sd?8@m^!C`PiD_`cz~?u1cg(+FVcvxo;Zz93s&5d3mYO2OtzI0BX0~V zN?jAyOi)nq7FmTcJU;XA+!|o2>$ZytrO7(uAVfV*?gGdsoP*OqnWI)%cvb({tX+jH z$F1C8+EZGb>p;+(UxJiAZxSne$}vSILeeabtAyxF0R6A>!O4(~azi;{lO<#~2sBAz z;^WbJ;AHCCcM3`&9X?r)=OD$g2ggFIXtX=mH=D$UOISR&Hw-(u)%O+uN3^KY29>GY zq23mU(x+Y0vD5SCt@+EJoDk5I6p&fDIYvYxRKE3<(By8aw#J7G+D+s919V5%JQWhG z^L(Z|kVJFStj5>9k^WWth8s+H%v_^XK>{iRk?^Ou%QDRy^~(C1(;%9H=-OA2jYGQhFBzQjiWe>InzSB>tc$Yt{$(1`Mu-3MtdoQkgil$@Hr8cux8Va4JhrZA zIxat-^)ha%b}}HgTYhy`;+BZ+ov_iBVWsu=GD6(OK69J;=(Sj7$G?Wg|MGhNSWd`? zLnfwrnKg!7^0JsNNA(stb*`Hx<^3+9nbYO-oF$l|7G1k6uKifoVsYIa6-D5_(Ud&f zL(R74GY=GK(z~}?WgB|mt(J-e^!WJsq4-9D7gJ|kNA8S-ojm=7cURkt@qgI7UWuF-<)?i-Qn}&TolNZqXNC@Ty3V%+ZQtjs65JL%RWRG!%Cnu{ zCwXsUr=y3n=BmHP;~C?>X~&o%l6Q z*0M6oWB>q=wY4F;f}bjax3nbq_gRR^DEKii$i|BY0P~duZwVkH3-pk2W?5LQS>wmy zb9jE7Ac(Dn1tf^e@nr=t03h^fwj0ykt#^sZNXL7UeO%;0dyea3X^1Onf8?TM9X-u? z@^*2Wxlb0m)F@b5&QZO2G;VfcVr0T%7ySkMWFAX(Y33zHAB)>}d+ho4WBv~-M_%2X zxbTSBb80BNv`MO3dO@mzJC zUInd|x&laq-k&cGR6Ax?Bh_Lj7rr5-Z;*)GBT>yyHnNwFTm+bfCz4J8W>ylB*@t!9 zfTME&?*^LBOJEHQ@LsX&)qNl`do+E!1hD>~=3PGqb=K$#i0MaEcW+gCZJK%j&ODh!ElMXDhdgp2Uc2$Xd zj~+-W{hV>RHr_I7y)hFF{@83{ry+1=3sGWwGOS=DZT9c>E95Es>K7vb@UDVW^NX(Z z>`1@p=S?A#gQnxwN0$SUzP1Op0>CD+Hr)MoscF450FaMH>76lGeP5%ZUoELtGq%H>SZj$cayJyt(yb-^csbi{L{Pv~<$-%FAT#_>hTKJJF zol~P*88vT?`Aumhs^-%;37>rwtwd?%^q5i28k;$a`?Vpr;ug6;?UM~{P_FyjAs#mB z?@YL}@Ua`LE+?+FNOjIv91%#pIU-7c9yPaLe{s<;}lG=c6)`mK@Ez$34Hy zBmtY-bFav6;nO6dMLn|mwThI%^#CNiu9kGxNPk`mt>G;6)PkbAWoOo&nq3h;OlvwD zGDk7WvU(nNP6!D?)iAfAI8dA(+Y~_5v@r@#=i%nf-s5s@1vI6={=Cj*g%8(Ne9)*^ zijBV3L&YQ|g#7k6i|aUT#dr(!it?Xk*`EE`y+yIbs)g;U)vJFp6JxVXE9KTxy8k&T z{6T%ls+%!g*bB|*guI&Z6 z?h1xU>qy19Wv-`PVhfZo+cNNXqnFs)A1}^3bbpzjvfl{n^lScQh4w=lPHFc%TN-+; zU#GpE{XS%Y?B2!E^>IwyrI{*HD$J!JDyI)SoLG8)|I&JQBo5VgxF>yKI>&>eSEjdP zaq?}MLw1LB4yo!P+)oysDC{Vl?=j@j;GT4HliSV`D-Q#=mnY}_l3L_Zn7yXYP1TKg za&v&GLYN6&74Sy=~}Pg`0Vs;}uUTeNpul;L%qvv;5D z2-d4OJg#1`-=y$lF5bex&cL(Ob?Bh4snpBETSv3_PV;(n^V5bR_H`^8T=`<9>IsZP zIf}8tzc4i|l~QC=UFbUfvVyWp z4BK;E>rQwLlvT20*5SR5Q#{sfEVU}mE?)kyqPQYoA-~)y#i=OgA+z?(+p=3_Coe8N z)BRYowWKVtY$uiJqs+W`qoj5qr7C6T<()r{n@GvVK9MU@U#A|yJI`H2SWD>0Xv`Wg z-Ff4EYA=FGX_9YxZ1A#7sbS@HR<>K_eQTyNvz!+_6t_R#es=>rjR?vxy$S#k2GN(Who_Dn*~l8j(TAligb zg^E6q{L@xap{8R>8S@SEm2YsvDMrk>i5u+w7ZDnVq;C0_{&Z@t7fhy%bmF!9I^9Ql zQsVPDI<*CV&UkBB ztIW&Ab64$MD|yQJ(!Mgizz5Dn{hnzh5mh?jj{Z@bYHshYxgg=+H{V01J7#BJ+oS%C z&J=`K=LPD=z1gb7#qs+}7PTs;E#CE5w=J|=HI{SxYI@tj^Cye0m(!bkTYP(8b-;4g z%cT~ky-Jf~%RYH}Ubb`X`TpVGEn5+3cXeAUqRTAGk6kssRLRJ{)p&Qcsr%3F@7+JT zV+UH=FHj$ivYQ7~w^#m-`Sn5T`pS`U;;k#K9ugjo4}2dm#%#w*M@&oN3wuXX#{xGN zI|Xj-ub+xe&-3zTCa#&aI z$h^)G4Ozm|;Dqg`o=e^TAy}QMj@UxVc$Z<7>6S6J-e>(~=R3sahi^K=kA=%s5Th9QcO+#&{y-zH@y=Rz*fh`3C>;f$*ve+kHoRRdaBS?eD9? z-Y%JZ_#g*w(q1(b&KbEeGTgbOJ%YPpys@F;Nyv(U;!5Yr&F{_n&7WAb$38G!KhgGh zux;0t>X4&D&282rk}=Uu6UoC#3oYg*r6)D)mEGHyV?@N`Uzl>odq3q{G|`)Ma+D|X zCK^hVmmnfWAM`zHY(CtaoAxd(jS$vLwR4}GE;z*+&oT#n^V;ZqzP2sBP0oJ!~T zFyNtqL0};Y0LG@FK~$PQgAegxFj;I9=wQWFD1=2ffqEJ`A{~P)7=A39a4y3w+{v95 z?oY$hp{7I`<4^)95Xj(DA)$c*Y#t%h1o~N*0NR3P1Qhbwh3{_yH5YUUp*XIASa7%u zh#}k%Mnj@e5F8$kGQ{9fD18VTi84T-kO(v$hC&fAI06a_`SOAiWkAcAOZO$XlC8dU z2mWUQ_2ct{2na+-NC-T{0M6ku5hy$!k3gakXfzD;fbqiEd}=6+&C{9^`Km)^@Mv6C z5TC_iLj<~1AI>(u2^1>mNcj44UV%Zvj@Y~}>_Cc$P-+kY1xF%g3Zm15F+tn70iTCP zry&>tj6epP&jaI7Gsb~P9UXp){>4B9NB%O55z6|DFu{?ju+M91 zYO0Mv>I4fegUaV{-8q~9;?#2eb|D5{hv|B<*mO<^Z>2Hfd+%>+=9>_MOyx6(;F`w3 zkSG`$?T*3|&=`UtY84ViKq9A!OnH8%;Rx;@I+ahIrhA0UF8qH-|KMb zEZ;DZRK9sm)1cD`z8r2Kl}}^^Qke`y5SwX?_|`bh^Yg+b*s^(iDx1czB@@90IEzIm z_+Wi7NVFjxo_`bJSPaX`z3Tb>_0boJS3q<|7!nKptm6 z!lKR1$#~S?%g-S3r*3RmJaBP^OARDzh#34lPQ333{dCRoi3x-sGpt>18PLW)o%4{NI{18iyUs;Qlk24$P-iusmgOc|>0>ClEpn3JPG+sDiAC2xim2)OW(t z1j6S)rhWHK5t^p)Ke#~Y3@+=RNh;GuDZ~W%e|FCQb{Z9}{Fs_n@uq}KeIx#{Ciz-M z{ket_)VpBWMxI)jR)Xy$_(J{1B@0+}fY%I!X~4ghi=rmc@52AE4Zo<<|CNeyYGBhs zXHw?;J4NGE4>L%7>**`;X<(<7D8|C%M6lolaJY^fI)ez-12Z*G)BJWA{9S3y)Xz#p zo~tzpVryxEMd7hn7#a@N%rp8;(-B;G5x|-ktie8KO(Gccr?&6?DT3NHVB6=~6o*D4 z@ksDmAAEfYoqqWHP_MraoqqWH&~K3*Y!;u0{?glb&C{X;mxohO-N0KS48f^=-}Jrr z8dfMHfI?=0*Csqc<&DOCiTVD(jDcQ%6*%p{m%yp5Iqk;9=Or=K3f>k0@5ms8w`8WR z7Gb6TpEtgp(SKfBs3`74h(Z)Yj7tS26eZ;tgC`2*DxJ02O^bz9{q7cOp;}V6E z&_|3*h(Z)Yj7t&L4=q09fBc5G)tTfaE9Xi<-_}5uDeWvEYu3I_ zLDi`+e+x{mR~SLprf_uh4?|GKw-QkM>6%tLtBU1T+eNMltXbmb$Fa}t)OcurxPkuB zp3T0JGBn;;UVgO`-}N?h4TT~Ncqc@mBmoHYXV;U8&^N$6E3zS(UehV9&^!oeNQ~N^ zeq{YtB2GGvr#9H2zwP=vD47d(9Xld;}@T^+7b{oIpxZ*p%d48hP+nj=oCuu zm0U(zT3QyDK55H0)ZPPZtPE9%iHY$}&{UJ#Wlc6A?}?UL7;d7`MECOYn)QRZ?jk)E z4UOO{J3h3ekL9h`NjWJ6to8J)>3j1A(tw60-&|ZrLC_Wy7Z=mg;2W29mh+gBt<~O0 zdK>#Vku60VaJ8l>MT1O$b zs%pISmSL80SW5#wR@)YLzn6cKOjgfWhdJbDbKLb)O|+DprHg)dcXuwYr_nLMvzm@x zt}YkbG&thPEPW!kk_lBa3i94$zi$0{+Q>jVPij`wJ~GsWOr}sMXSOyrcXV6{RH$et zPQH0iw59RG*7&$A@}AqbZ>siYE9baC-v17FJd3jJBTSY7utEQ-szLbW{ynBn;l;brvHs*}1TeE4?m3t2# z{+?G>hE+?d@6OHDEGXPE8uW93NzDw2|t_Z~bLwl6v3_4KJZME;Dtf}A?xeO_tl z5bj5_(~p=X8!NC!e>^aGt-T_o2@ZpK#Yt!JP6G zuXj1v4$c>1i@$$uJlUr{dv!>o-GTR~b1!W(Qd9tktGn#SC0#Ex2e{>l=sLaPwSBF% zu?tsO9YdjUxQqT_VPTKDy6A_RdJKBHyO-ymIB}(=Z+O**4U!)%vvfd8GXVGvL^km@2*2}uao6pTaJ!D;B}NsM3N zoMSXQD$-yinxmu;>gJ|oXJ>byu&^%f_2{Qhl^z}s6582GJM=zWzkdA@p0N=Iheu@C z9j{hZRn5KMd-PG?k)lGG#t#aXE~k=h==B{{+m*Kw+Ux4$l;ZaoqtUK|BV&Es>`wHu zAFIfF_ypO@5#xk?`}S3<%`~7b9`3BXd|76tM$%+$d=~HKIpcc#)nupqt4+S8*`&C&Q0}b9 zusxCTK2dR%q_`vCq+SK*77F#-ur4apIPt0^5WvH~?e?vd5=td1 zA&RmTLQ*e^MA`l`sY$)w_cy=gzg^eNb&a{5=f1z^JfCyUJ@@m>bv*~|Y)r*P=3HQXI)nj(xKFqpv<0Sw@AQu%tT32!kAq4u?y}u2xqPS!fZZbgo&( z{*Dw5C!p})Y!rWVbodb&dyNH$L|+JXE1i$tdm-x3qw&s=3p<-iN8i*;U3-q{%^6N9 ztP?61UU13`VXqawAk%2MRL9<`iptJz&GiwYD`~(&;Xfb9=dR04s0iGZ}pkc-~OwRsDB)mfwxujm!8 zMBySf34?uwTwFAltJRt>Su3rLpNCIcuX#5pQ4St~lZddyh4SI+1jD_j&aWB}@Z2hP)_?S{#}&!- z*MPHqEiS_}HXGczW5vzQJ>A_eEGmpP;UBr|nj+ubR_-$C^(9PiVsxbA*6WoK@GTLh z0%IL_AAhpCw5;y9$UgVBH!-FY*TtqM6rUuiG`o`7!NUK*0_SUq~!CV+(=*v!&`nS4R2kQ2-b!q276>Cd?o1xwo^9IX!4F zX?k`Q5bj}q+!p}08n4uJdQ@moB@6(@XCu@L3>7}zS*lSkxa`jSwmV`I+qL%@t*p3f zw9rVD7{1JJ`2uLM1elD1d2jMXxOIUI5VIh!dC>HEz?9oTGg zGj`nr0KR8pf2k?#M8p+){bviVVT&_#;EQ&n7?dyDG1LMEhLtlWb4P zmKY4S3R?blsSu*V3#wUp&*-wQhDaQt`m%D)g6vB9f(<$RB?m_cb(fg}iz0C4BH98> zBM^SMp_!|dtIZ3u4A8QbNU0VP9TEP0_IFj4<1#F-uD&VtrDCZ&9CpCfOhctCk;n16kw@s*}OR zFt^Erf^PS$?%855+Mm6=t*f*WBu0=c4AfBCDW1LGKSHZw_2ru8&;a$4gh|Dc!}?j7 z=TKOL1;VA!VfciHflyb1@7QUEjYzLrdi-$Mp;yv_YhJHWNJCl`!$_NVW}S*Z<(h4l zZJ%xWzDzr>KRqR_3|Hbd9wA{^WudxR)s!4lJ3pn@vDxuux@fwrwLW?zPcv)hC53Y( z#?0G3=>rL=x3-3-T2a$q1(o%FUA7A{=``v6HGRZ%fvaHQf|Y`;3u>3@-PiJ^>M261 zT0h!jx7=Hgy@WrBkMGs!HUEY=6l^0eEu2x!YY5mT6Aj!eH zIBiYZI;(Y7RW*-m&et?0Y9;H#p2K^Sdy}6hw_o4BF>s?sQAW`XlKGYHjcINJMWsHG z8&PhTT%9*=DKyDV$z9b{l3S84m0oNUXOo@UM7~$>vFKq@=5@J(o)?0xc}3nuyYOW9 zCFJY(^X?7AmBsD4x$EepzL5BVW{GUYjf!FPtA5hx4d_=%wWkLRcHRGUst-bTty@_4 z0?}2pxOzfi1`f2Hd5k=>Ce;l=e{$~uw!^-s-azckN$Ae@oG@FgZ3OvRuL^_!iFL_+ zUU2;qGiww-xCHYV<9DVD)1{~L3jWG%+hd*b>kqD1+uoz5Zi{Tk?pB#5P6tod1L@(b z_{jVRBMc)p%^M#J4pq7xZGdhieZJD%Z+PTvv7wA%%%0pmJ$G`IJRkgVELUl?H=#DR zmLd^p7xuR4i4gt`{_wr91*(w;B3NdOuTx%&b%iWRfIQej z3p!VO_furLY^LTS4fLt?R#7&(Cq5W1RL_t-vTA5Cb5*ox&|Ss5WMxRbc74}K`l zHbZ9W*1^aBh%MC$T6rIFNu#HDpK9i@QY&$*m&xc<*`xrFH(VcG2HSf)_L#3xmXdW` z5&0eYjYmLr4k_}=)P0}B*CESK3O(Fecr0hW8(6f+DDAD&Mz!baLRZKn7mwRD2OptM zWv8yK>3>}KsP&l6>A^G8{fq7{>O5X_X}_flSkd)OS zkvVuMPr7wUyv*(wYHfi%3J0i#xSE+=QB17!Xz=KJ^9r20N#ayi{F`_QAMxgv ztK#h&uJ(_7#AM`P2_6 zgp__p{?XXFsdRJ_^YB)yGoQ0{qemlY+K^9Y#q*NhZmTN#mQ`H{G;-jHz#W_bPb8v~`8#X{4T8kj1dmLrP2Eo~Lo- zp}Hd}CsTHXX?|(j-g>?$q?b_JzC)5acyl46vjI1KxOZLYy4uY{HyA@#T6-3|+;B}b!uOJDhv83JKfZniqd~sHXKYH zy+1nAF8eafPj#}kx}=$@I*?mxTe|Jj`hLS^?8^g<2AihZUJSPF-cimxJ6zvpIw}~s zw{9wSBt{ZDKPEAzdcXMo_o=!V6za8s-(=rJI<}5jw>ovn)cL9Eyd|=bu(8JX&ui-w z>d(aw#mC+D4!tz_uKc}Rerx63%H_8n1|ncvKW!NAzr$=}Dh^&~m$dB;1?^Uw_WW{r z#PLb`c${2Z+_V6H!tewE0d55VLkWtLE5p^=3QeGTYvPGicamnHH;q+@0)U=DAPrC0 zNn(K9No0zTzVcwnZDkOJsITmzWev5aVM(48vtU1xW3Y`AA$TVNMN~Gxi0TERSpwc9 z1|AgX?d3y92kI+-(?zpvb~8j7^v#8_Q(xJT-66=;+75)J`jJ3dnp$826b=LFpfq7x zNE8gF0fIwe2nY-cfuq1M7#gXAhG~PozmzeeEKARi=z(@HHu>Hi>py*EPX>dAhCrB1 zrX~}iN%bQ`U?>y{0)<21a4^dQOb_y5-~+)vbd?#AA3DY)I>C=ZV^F9*Ahs^vo$Alf zS5{_s#Cd%`FK-&BBOm&Ab}WjJKs*fs(}Y6i3L+9XF*JWauWv&m5+Ecmk~hhRL1)Fm z=8R(@wYKJj&e@%}_neV*1}=bg2H%Oy8A*2vqLCmDBs$gKk3hl&utuUX*Wl?42hvZt zTu8Cp=Ma>hdaSgXgCtB z1zQV+p`p-OA~T-9X;`!N4-wD6&r*Sdp-3kf5{=MBYw65Z`Nj8l9V(IH5yX|sPtREz zL;~7_>gSDTU?|>rG6_QSA?rbYHqP?=ws6trK6D1&hd?qn#;_VRDHI|a<>9Ucg=!(e zcpY6B7)C_uf>9(C39O|}BBBVoBzGNx_BR~X*0aO^ByCJ3__O!UcWEL^8fU1Z4L3n) z>mYRzI0OuaLh2eB!w@*Q5l#n%GKBq*ofY~gSzA8}E9c?8X8Ev3&X(6f7-_=|4UJK- zzn7mw;!oX}QRuA26*Oznv6kMqjOIx4{k8SS0WZq8%tXWc(Mjx$tFQcH=WIT(tyGybqZ~#6W(W)sKe% zPcx=NBI4n2BoqwCBVk|!3CYTN1Z@P^T?gTgXVoRFOo#t*e*f&O&6)lG6SMZqHyby5 z=Kt2D5vV=^B)@+q)3Nd?o>iWb{OA}DKdLtfPosHJ2zYkZgar5yzt?x1(gehyf@Xd9 z%@CTU@jtjgi6lSDKa*5ujgo^2^#AOf|Lru&UHLIHt-MVMn)ycjwI=ydM*X>lVb{B? zvdwsAVVbbF6Z;GGAD1kws)KdSfSv{XN4dyt68$awmu>i6o%pX*j57n96*`wP_1`HP zXL^`J;%84kh|dB$t3=V`BqubM>P7XlrV>dQRy{CR^DNDuhgrWX+0Fc{grPf_8iCAl zSZx?eTN@15WYx@b`pwc|UwNTfH7~0M`<68^te8Kw{qFC|u3f$SztyHXa3~Z7WnJsD zUf)A!AO1bm?e9ZpAO1b`XQZ$V8%jtqozOJ>$;;Z*wn zdE@69{pYngio8xZD7Z0rxVWLj@!{d(py0;f;o^o8$A^cDgMu4_hl?9Z93LJo4hn7z z9xiSuaeR2VI4HO=c(}Ns#PQ+b;-KKh;Njwi632&!i-Uq2gNKV7N*o^^E)EKA3?43S zC~9xe_FZVVnSZYXhl zc(^zyxG{LRxS_=H;o;(-;KtzL;)W8(hlh)Uf*XT}iyKNDA093a3T_M@E^a7se0aDx zD7Z0rxVWLj@!{d(py0;f;o^o8$A^cDgMu4_hl?9Z93LJo4hn9Jzr`i`^C1T$AJ&r% zn5;(_Xi^n0tj8aK2xbn}01&(i0K)eIz?W&(XCDCgLjmC3b^t&p0KgLJ@oo1_0AN1Y z+}O}5u;s|9-CoZ|8hABl7N( z3&-9Pl$bX-{rb@q{uV*mNd2TyQc}`~;4(*=ROhu-$wq=j$`g;e`GJ}}y0m#4hCv`p zev5ll+uOstjrth!6fduf1qC0_p?#G#NtbY|gtja`Ul^dhOR{eJ*zz-$plJG5nIdJXN^LVe8^G18+13PV^uR9IrFOsDA5R@eQ z8kN3Qt~O&vJD!W~IU@sE9)@i4RgQbuEl>mr$u#cB5S^INj2=ui9q%s}+MiH34Hx@7 zQuyKanu*qdGy)QPlW!zt0R)-C0kT;LH~H=^g}4#eyelibJCq{U8}HkviO=0xC8^2aq~9esn8`c%N07e zUf3S)VEIR9Gs9*4U|D1Jp;ciw+i#sI5;LE$4ZSDW8-DJwVw2K)8CS*g!yX@=2?U3p z2oa0)+7*@mZm_#elDvq2tR`sr2i=4fAPH#xv5Fy3${CYPrT0y1?NrMjHGg`QgTz>V zuEH@yJQ;h+8|0b;!v?#rJBbt^%hyk}#(31P4bRGRAX~XckZ{IS|IAneCcCs=y+&L z(d2Ocy_Nu`qe3!htVe54 zWk-&YH>@|UYN@ZQ)M?mxoBp$azWIdCK26Rbu0JcR#p94+4 zcH%>~=0}@k7DL_Ao)S*TMfzVl-R7U#@}hCsME`jHJ*vm#nhDjeXG{4AJ^H)6&uS?@ z@|m9$LRa+d)DUdEv*N3(l=L&ZU|q{7?e+c9V%Ma zpqwYIp13KZi&7c_x%@|=nq)?}?yHIBj&u7nV~d%CTjxapS%_6`^TkumzrIoRpmWaeUH|*0^~e zY=2XSBh$4pJ>`ML1x+u-9+UYpU!6U#Kf?PCl=-WySYW+-s2dz>_Te@k5Zw6g?VX!D REZGm4F~`{$=NWC^^ItUJ)cF7a diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/cross.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/cross.png deleted file mode 100644 index 9cbd189ab6ae99ed5794c30a12ddc0480987f29f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18303 zcmeI33p7;g-^aHIkxS)Lq{gj~xtbZx7~?XoxrLF@eaviQa+zVKTsk>aN|%3<$}NuS z6uEU#N+?OXD5BGql91%k8;Mil-7cYB&3oSUKks_if34YTjhWx`dw$>Nc|Ol?|MuS2 z+Pjv!+AGLu$N>PL;OJoE0e#Did}O7ezm*=|51_9Zd6oEw)$ zTfW?%C*%qId3=N;jfUWd^8C1gAOM6vOZVi^Jv-FQ`(J#pc8ZHW=*06-l|^`1?}=7P zSY)I77+Dd8O%8ZlTw=a6Hs=M*b-EvQ4TD6bu+jcx|_nptpn~w)P zD(!!LZ|K5fYI|O9dSR_hx$Mlt4kqq|=$WUi7tDIO?Pg_Fb1TX+Moy0pD9aYIwFQH^ z62L$dg|bAaT;>WO5&l447ASW~E62>=Ijr>7I%Ty)^md7IVZu@;*=QBOGIF2wNx;%h zB04>JktdKT1+1@T`L+Pdk-+-JzrKC|M5hm=Y?c649n@Bp$V>nbbHF$oz~2nWt6j0% z7GPii6+fp+67U2GU>v>u9Dp+yf$|z<`E!8mOaS8^7i$PeZ3fog($x(Iwx<9pc0Jyd z_e%Zsbac?rG5u~S z|F!a&8~gY8ol~;B0AzMN^X}!3u(3V5zxe6Xw$|1s%POr`G4FV98RAr|EB77@{40v` zrN8gxl~;N(xHU2MQUfn5?tXASF~9b}jP1USujB2%T$CUFqV+(h($Tk=VWiUHK09Qe zP3qoW+zFjs)&~r4=+_UkUo{zjmZUZjfHNDY5}Ol{*=tymADtE}Glb=@`T?M)gm>)^ z16j#v|832+VZ-k%2JJKTfoMO+10evg)!^Q59a76wUcc zpO~^4*9=NyW=L7xlAXiUeikR;yPKiAPgXr8c0l`@gVgLjdWhR`D(*T?2?PhM$8I{p z%R#HhJaigq=W4sl31+td+}1BUO6{=+W6rso|1t9dtvK6MW4qlk`TJ}kHZ@)?Gwpup zc@6Wu#G~!^bN!W`#ZzfFG39UO%9vCJVo+7rtAGq+0P%!)k8l3jhQ z+OuI&vtw+_XAq^rtP#uwRt^kjhU*iDY{Yy${H$j)OlL@LcduBilbG#ve$nMwe^t)) z#bI|c9E^1z&5oagR^A*(t2EV{y^DrhT)cmpVrLWJB&}I;T<$|6K_9b z2b_~39W+KPxfR=*-g>>&q*b$3yJwYLy02x(?*pE%3_R{^ST?UsxeebY4JPBPypE@O zJkLH#pGAmYX`O$x$m6v8&g?n(jj5!2+teJLPUIgu^gzR3-M^oE`i=1NtmlUoxF+5A zuCMN}f0Oh^@MVQ)byab2!;Ny2bBNK7+fYeXcuScccC8o_Tg%OKBBCo;9y9+*mt6A$P~d7((Tu zv-h6QiG86AYkKTiR7BVf#Ap=K*t~1&VvXXkEcE3=0XZXrc z^CaH67z?fr$T^&Jn33y{>z-@hSw<}A%1S?3W?SO(IY!ay=CZ}B7u$2~JJrLb_@v=UGiNjBoA>VCJ9h6;3L(uL`xw`r)}Hn_t?A)*H8Hm($j2R1y`Hrdjp; zR$1#ZVPD9a=E(ZK^t8gXimvR2)7`{wZuic{-|pgnGtBTY5!}Cii}upJt$1ybOut|il zx<;Cy$>x*IVVf6e9IPAZG;$fih?;}iKzU|*8GqTL3gzc>_aP&l;TY&NpM)|hAO;6s zY5LODyYp50EBThq>dEL^YxogIYbrj(W~rS*%{C?L<-GRWRGkOLo*TLmyyqf%!6BL30fqbXru!h}imXq* zp|3P}Y$S7z1A6;iy|?QQ>2Pkwl6zfu3-2`SH$C$1x8bhY6|$M9K0iE(*a&56& zIvXE%t#MMyIu}bl9PSWcn#bAY}&(13}tvKJ+_tCZiopjHjp=4VTt@!v=%B4~;>vqjOGYk6f z^bhn;bYge?^9#(!1HpCOnwv{M;{SZuu&T6wkb3({gO`Mt%R|41;Ah9rh5Z%lkXZ7(sfg^UUE=ISFz}E@gEPh>domM@sE~t+AH2%cx5R4T^Lepf!NN^i94+()>(ri9yEM<#&#Qb_U3R-mt$XzLMdTOz zhJ{K;@D!hjWxe#<+-DtIA0%>mYWJoeO5YNN`m1q$!?B{x?W~%n4NAOsmz9Oh^|r%% z+RaMMYF77L684;HXq)4G$vgEld0o(3;akd3;sdvvB}Yn93yN0<6n96KUD)i`-=Udd zTJ!uvS;Tv_;YSZMNaoMWdLw!LH~RaU)SgF$E*`9@E_oWZxI4ept#sW7%Py;@wC6h? zTC5sseDbdG*A3-inZ0$5_Wjba+iHgr`r?&n)8kX(t9K~u=*(D3C6QiPgbsFm$)eS= zYZqmx4;>q-E>KrPM-4ped|XqPTz537Cn@o2&@U$j-4AXjdyh+Ke^%umi2E+b;o$d3ypY=I$USi^~lw@-67nTXK0RYUZxO9e);o?kY z@q$oHHqRGCg$MDW8&LqDScLPLtN>7m@C7;CU~`>!C0BJ2T(-H6H^Bwt!l!}$T!+X| z&@bZBLgBB zF3S-#UMPqlpa@7728TtMl2BLzo`l63BXAh32^xz*<48y>mW($gV~L3ILx(B{{i1}j z{m33RcH_fAmbs3s4x>0FO-AEl1L;p28YJskWde#AR<`E3`YhFbjL)# z>ezq+Rw$P* zK~RVQnmqQ0Q{aDn0+|T^W*QUjpRQiW^_$$BZ(>J0KMe!JxjzXT@r;Fyroz|`QK0-I z(?UU}kQYkl@dBx1SvL9n1U)_(cyoiw;C=k zWXE8EkQvMZ9c`%4+EH9Cn@l9&eOV-5HWKSg^hL6K@k}HMB(aeMKcdM}ES|vfBjHCE z`EB@j(l$KS#*rKvmu5rKq@_3(5#x(Nf+l_@NDK*&K`zA+@X$yg$(O*ygV?1eU!|vn ze<$r0%7uy$GjK|uk=g%mhxmcacSAXF1yJflOi3vyu|~^`Cm8Z=>sLo0ceGsanV|x3 z@U~c;Nb^wQ6 zO2iUbM5GA;%R=IDcoK3clgUQlfq_^{dl24Od*vU#N>czelUlEo@|^< z6w1V{1DVDP7?)^1Fs~RF42Wn`j7u~hm{*Jo21K+e z#wD5$%qzwP10vcK;}XpW<`v_D0TFGAaf#*w^NMl7fQUB5xJ2`TdBwP3Kt!8jT%!5F zykcB1Afin%F425oUNJ5h5YeU>muNmPuNW5$h-g!cOEe#tSBwh=M6@Z!C7KV+E5-!_ zBH9$=63qwZ72|>d5p9ZbiRJ_IigCe!h&IKzMDu}p#kgQVM4Mtw@4&hnc2M6Zjy6{G@Ml0ZfFG7XB9S)Jr%zW^S64s({{8#jwzf6} zSy@?ULqo$(sf7y{YDh~rSXfvXIygAAOq(|CC^RW8O-;=O&~VC9(EGfv&CJX` sLo+=8@#Du{XhNy_`uZ-AV5cPDZ0Kg4{eEr{v_`wYJT%uzxVs&t(B|=$v*q+?>Xml_SyF)Yu$aW z&bBg=%On8+kg>P3atGfRP5+6Dg8zSE>-2(e5*#}pE&xa=P5%i2na7p@fTRnHL~?cY zXY<%xe>MkZPa?rMp=<^#kPZOh?b#kovPb`7)A8q{mJSKgM;zGhD&jDA%LCEM$vXNP z67uU3G>$)2ajR3XwiZ#lk((f#m>7Lf#mzu^zvL6K9*q-;drl_ozxCn8&XWO;s>fg5 znY{3r*jGG~UEV5ID=wXCXXs`WEnQ%_LgDv4O%07NdJyI@lG+?VUc8*9!JW_&0^UUt z2&*+~#jXHC;rFG)fm)}mTGaCRDY-Y68JmQn_X^eWlGiwhM=Jy7k%^Y40dpIn=>jqrmz*gO#U)=|yv)^Ux6aqFL(NGb}O$J~}^aLxwe=Shlx_-Yk;Ee*5 z84e9N;0YW+*?TeUfU_5Y+7@}KGC*7!K)EHvt^!1M0$XorX@vuOGXQ0qVK2g;t4rnk z^g&V?WrRv?oOR4bad?QBmltA%UW>izYGq@}50p%EM14fYQcMh1?)Q<~0Faxk0opPhcNF2{_}K4P zUTVi+HpkeCy!*ZW_Ne2j<*kP$_WE_cO0xZUQEKX=`hCp?d%sF=edTU9#gIg+%!4DC zQ=0oM53jnu^4=8fWtYJRVPcmNaCRF}XlF7!e=}A1F9%(DZ(i-oaR3;uV%I&;6Bmy5 z-}9n1Y--4C!Zvp$5Y4bZ90CAath5p2Tjgd=;s9Wk8>4^LLT$8ei9xOC^14Nxby6R< z8t=8#Zm74Ex0IwsFAv?is(81hUfi9t>iS!e56soEwQl}#DI8fuz2_xaQ;ytwig-?) zUUiIwh{X+YC5lFSf{@>SZ>>ae)r{D88g+IeiU+h|HxrcIG#!$S?9lG}$uLhl^o4W-O%&POb;3# z@4H*%FV~(#BsHOGUoR0eYzRal8n0QNTVo)RLTx^$Su9=Dxa{ouV&STNW7O7jVIqn# z*0mDGB4L&=$_fiRZ%1$ECwBR;<=R+(uZ0-fSYxNrxWMS==X{Fq3rv;RW;f@%< zR^N#2$?mz;IC_7XzpDQ@>&$E3Wrb%)S2(BL^}5&GZ~Hp! zweV<|v`n1Jo~8t*-qNfkVoR7y!b>F!P@-z zLS{ajZ1!7}&%{1apKFfSTu8sU<(~8Hu5N@$QJ0p78)yW`6vb_iF>25`cjxI(JM^p4 zC)BGBm=+cs$B_)z8G4nwj~ro`iFK!kygSBomgv*VOB;#W|6F-!)yq|Cr?HNeX!@pr z!ql`>?;^V*w<6oOHO8d_dD*9HtgC!J#K>ASt<&A4Ys*Y(S(M%9@zmp4o@Cx)CsX`b zDWWjol-ltstFWuVd4uUWSGGjwII{DeN7VGaU%m@DL7oVDpEqVJ?JZg^tu5Li-Liym z-6(`jP)9a({OLy8e9fG6igJ{a_F`{xWgFq-Lz`c0yYp41W5(a>>l zdgC;h>F!i{de!N*j%yv8?%cj};?AQCqbyVOV@zLGU)JNSu8UhYgl{mY$gj9Ww=e72 zaN1|EqB=Ns1J37^x95h<nY&kY)w(I(6 zYCn?c-74Su#IUsSjgrV zk@v>3v&ysT2l6}43>puz2ID(_y^Z~KRgRA#_wKbDq~G0o+sveXJ&FqGDvoj?xx_Fp z^l2ff$YigQ$7e5|3M(9^45BHcK6nmX!zgw z<4}plcwc%;atli~)-~$&qq}01SCj+SqNH_W<72(z%n~^X-pkt1X+~jfog{9T)qAT{ ztLIrvv*K&k{LAc@ zQr$aM(~&neb0Utn)Q`sIEiOPP8sJmS9TS|_9Ql`pyng=TgDZ!X!d50qM%1g?QCa(t{xQJYFRP1Iz`Jv)PK5)qj%hRvP8}uIQivWeV?)1A4Jg(tzBpWQD$cPabWvdZY_U$iK?odrr`T2=nXLzq#Jp0zwjLswH3yK;lX|0TVjQ&^8;W-;+Qw!5x zrO5`%JZ(QO)3yHmz}R2b9muphdL31JDoB+luM#d*)AMe&+*xZz{*63Jeor)qi3Cc-XPAdVGR-^Gb)Okf+l_#zXoC`w!*gW~KWI``@L02-;lY927Fp zBz#YJLQG4x;&J7JhwArC$?i#yR=>5CZTj)bWcE-PT*g?&^Os|dFSR&U5k39m5?$jf zWbo}f4(=>|A$I@A9qLSVkIWAn{We~9xlL?)^yYcwN864c<&I$qJ`w9i z$TwN-{k!j{Fo#P+x!eq*Qm!_&?Rhgxgn*u5aBWo_~WQ_N#<(RZQ8?A}>bMe%p zhdDUYXEh^{?D6a4V_l1%MTP24v@};e4bvSgsdlOM9W@`YcuIN}|IlpXWapEi&Y!o{ zhUJd5b=r=L#_nmIOdd;;BP~kGNNSFgiF=!~hKR$xGz*>R|CmQ=rM2qhs7{`kY%Wz@ zjEs8s@a^N4w)D2+X~StLSA%{!HSwnQ?b0(HjrENyuG|baL~j{g|6!mmtTRk~=wz3i zOV3ZRpY^8v|2{Y7aX0Tn%F>jSDG}lHk&jeEcn1LB6Ti#G|U8tKpSCkXtV(ggF+i3(I_Ma2S=mvSQ9+j820I-;c%>Bd;q=*csaFA#O3i+KNCnx@4K|$Y)$3q)pnLNuJfw5L&clz*b~MPH~6o5o^9{3Dh5o?mJ>IpOVtxjafRm2PiE1lNvW zv1oXlAIca@Sz`jHQ0WXf6@$gW*Wl1}I2MJ*88Og)RJ0*&W|3cpeh}9u7Ugc8T!H3F#KpZV?P`nMZtWQUJ(A3v`Z)pEJBpP1%0Mx z|GypL8!}%FWyj)zsS~jvrNG3RDKj4QkS|+5I|5lV<$^;A<nk|=E}!( z%*<)VQ>fF0hDe>xRXPaxi`MyR%|(6+V|`--{}JU`{RQFQA0y149?UP{XQgI(eP4vj zX7Iu&p>zu-m=piQF`O0rG6JehKu*`>K-T}m9&jl;{*OEGkB-oP`wqyG_V=Ey6@lAl`kP=-;0wIr0bid&7rLRLKKw%$x}l--k)FXU9uX|UGZTe0 zFNm7H*v>-r0PhRwL~v=)CTMS0RyaM-+lmEV6S&ir&gfGJwEdfLKHrI3(EcfIHklUO zyUi4c*;eq*5WFcx&fS%MRXgUY>wogY{DS_Ist_%~AP^w@O#v?cd>~!{E(j3*rT`az zJ`k?}7X%1@Q-F&SY!yaHShApA`MF8+KVUI8u$5dNkB7k@qwuK*VW2!B(6i$5QTSAYuw zgulrbm*o6&p7dbw;m$DdDb7*s&CTEwpfIYPyAuFJt^|PSJpl0c6!_i`0NYUj@MbIc z@Mt;!sIm|HUbg}J?y$GAAcwaDEFg7C$jHd3NI^lNYhYktM}L3+e(>Q-O%XU8-XkI+ zvVC}XSl`*%*?~kN9TLJ~v4EnYVxxwJ22M#yscCd{6fZ0)Dw66@W66t vXh=cW*VmWs>gsx7WMqT_%1DD_{3r~d5_MscE5?+;836Xy&Q_(CTX+8(LxE$* diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/deleteIcon.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/deleteIcon.png deleted file mode 100644 index 540256479106ed2f9263ec5df22fd7f0c75231e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20981 zcmeI42{=^k`^S%xJ!!EeHH45ci?Pf!#xmBBFtW6cF~)=$W+tSvl(mIdWR0}gvXqDy zDN-u3Raz`bNC<^e+5RInd3(L@Z+^>vyRMn*8gqNjeSe?l`JCsu=RRky>qKndX1rWr ztpET3%S}xTteKw@b8kK#=HFL7+Mk&p{GKKbbN~=sJ@@7UlFl+c1T4u|?Dp-hR0fsq zO7#SpVzD4k8r6mDP6Pno))X5O&Zb{Xd*bD|zFBx+tQpl>ln-RBezsS~b zne#71t*TZU8gfhBPYYif85wv|)JjF@xWIGX9+?Y~$1a8+ubu2VbkXhUjfpq)GuNMC z`f|ro3LAMV`Gn$3)U4D4g|hY6uY7gv-kqAR9#!2S0Xa`Vgs;$9hCaQK3;67hMsJp_ z*a8C+^}34Cbn2L~EJx1+D>f{UY@<09_-lz?1|98z7Av z*jGnz>ISxhfqk0--aG~ZQ$8mi;sSQY%7}8MMFXJK#Bc+^bqkQ&xZ}7XU=Ib>xR~8R z0?)w!)YQ(!1h`rPR5pkRUIX}q0H{@Xh!Vhk2-tUj<3?W~I1yN5G-`+busL6(Pnk(7 z@fx~R4rv&)lMn30YiFmrUa`SceDfL&{1SYUuIlZBiIVUj#EMsA4*?)8T9i54v1#81 z;rxaMjmTo*z2JdcJhQS+PTe!TjX9pW0MNzoZ=O+s6s`^2!V~B*b3uNX+jWm%+JT7^ zF4tD*UI)_pTkXa?=hzsY|E=`Ji{74|=UeaS@5I;I9ho8B-dkxm?f%6dJvH(1)y>y( zLGax{#@wG@-F`T3p1!W}G=H#D`QlL4A-G(aMo_Z(obfaMC=)ruO|Rtw47S?M3HZ4pzE=& zMxWUcooVAVc_7fm^t2ZM>@kp2#nl$-+~WfPgR~&!t9nx7RT3(dJnO2KwO0vF?b8U> zm%DRYUqoNPIdC0qpHl8oeZ|oFtJ2E*AWw9q5tUZ1p)sDqs<&-_7uNP%@fFXPTBUd+ zh@V^UKHqA*Olvro({cNak$mEbA)jTcOt@E_kOMskUt=X}7Oidqvp$Xk*_ud?YSWe= z!*&^!MQ^zez>iLa-Y|y623@n#ej;=oTbiZ0HrVKbV3RWgmJ}tHmfS=uTC06h<9uIJ zj_ZonC=B)e+;3nKsHw>r)KTd9l1-(BR&!u3w*d&1sPWI zYjFGMgYfJ1Ozh3=w>>w>0{cVY9!6n?IRga7wQLH!it7Io5OxA9UdC=c-m*e8& z>~lU+lGE*`t49guRgM{_&ZQZnMlQAi(VOdI_%?q23Oo2=>3vJZLeAUZt z=~Cy*4Sa425TpO)v9XRgdF-4?SgC-o_*`s#<`2gTVXl2?15^R(p`dlVnR zlbpm!C3o|yhhr*Yj+7laHLcCNJnV&Vjy2DJnAGO6M0u+EXY<8l2El6|8{ z<8!s{;?;FZcgQI=$&Zam;-pggv9a(I5oSm0RO2zK$x<~P_bYm~GCq3k?(%!|F(tV$ z`Sws&+m&IBVe)WT`?-gRb4sZWYV@Y+``A}jz0Ep;=gvUgI&=Lkv6exk>wOy`1W2@9 z-m|ME={}by@FU`wPZ-*{ZcH~?^CkSH!`_FQl_mE}>MX0Nse3~@u>l)rooD@Kn}N(g zc`nk@h#UewXNqrFvmGOqXE{gx*)(U;H= z-9Q!&+3x@LX%jF04gN&6ztEd6bQKnO)>f-RQ#XiN})ZJ_yQdK!$gW`U(b82WT>~+d(!R|xi36T4{ zJrAC5xIG?{DVD9eN(B|CYaYH$EB3vfh;o+LN%_&$KJt+Q2X9N?CdopYHJZbpV|OX9 z-!^KZY~gqMUGxq0gK~G((p7p(gEwXWcEfzRc}FrTRV>LH!4a{vnz>u0>hIVwI==DkKD+PU1SkElh) z<)m(|A9`3=+xDC0*^zUzL#uAD>N;JV9%^O>mbQOWk-Hyx4efQXO`uzJ+2+t4Jh|xK zj~6R@v{>d0*~RDkS19;dxCQO0sy$kDoy%=d&{m)~-evsDN-2G zh~xQd+Qj2U1D-3k`}RtOQEP7{w#OD_=iDiEZghF%(*NcqICZCR+~xQ;@xqklFItP1 zckU<}`uNGP4H93k*j9e57+ZSr7W(%a#LNc`^;>jsmvG~_uQ-k2M;+Jk&puO{houhP z_=I@Z(zf%)#5Cr?%{E&uTZlZ}c=c*wa73-#M{Y8bN>qJNSO$u>yhE?iM}m2wlwS-{hcv-t*v*p-S2iu zS5SLB1{eeAnV83x_sY+fC*_y!aw{G7tGIs1WujjyRkNXEyyD;ovDv3BsYvaPiZMUx z#NCOHonjsSv`y0ub>%O7HVx<9u)MK%Tz5$C1-2usMQ7(s`}2|Zfc=#|X=Bap#uGdt z#~Np%KSr&-$jS8vaGZ$v+^2Nm<{-0Y0pEWcm zG@p+jjgPtIaX5W?pmI?1N?XnCn)Npy_^QG7jPIBns`6>~ksi6&xx%vNFepHA*7Zxl zN1LY1$r#C)m|5viByHD zBakqd3J4B`sX<^+2pkE9!B7ZI6ifs3{UwVLU|MLJvkS`F!03B-%>T4yT^S5d6a?bq zxlLGJ}(bXR!0>2cXmvQ5MR6}1f~jwEEeQUV8wVIpt*k=nlk}HbSHWcDGWL@ z4z_3<6RCv-D|FHBJUkYSq%#b?nKSrKWYI`E?w}_TVojt|56}oiLvQ9tHZC@JI>Vay z6D}K4O!q~FJbzruEIuyQ;lISlAiMm6uVQEA> zgG$3usqUEh<@)nNjCmcVXh)_vQ+?=4XvnYLKiAApA)*1ELBufEGy)8Tf#Gl*42gmx zQ0lPFP#6jdT_7^=`HO}HbN@Kw8TbV%a4-~sgCS4|W;|k{${&1x)uB3*T@JFP^3!vH zhBE=>LZx}&85pt$oPqLOYGBfAl-52=GjeJgCQ%zq3uBT^! zg#EqzA`*Y<#)M2~F0O+M79DfxeamPzM6W-#{y5-H{+5|M@iaPdZsTgp{@A&!RL06w zb1~l%018i-%V`+G+-fE|qalB2{W&aFS;jr;0Qw) zbIZ&vZao7%BSRxY4MQw*%NRn{ew^BW0l(T@HiBuPpqfAO$o~%hpR1POil>l>&KSs# zS^a4E|8&Nn8hA~07pNLo3#y3+6V(tdU?-%y3z*p;Tz<^&pFL}fX8-@h zS^L8`8#{aE|JF$(P$}L-+CP)&nE4dXEKi9vI>v=Y^#I{LJ>AI!{9M+AcvGCe*LSSa z1jL|%7JT>36I!70Ke#}hi8S&*lT;Rrl7$KM|7_0xb{b``{FpzjoJ|Ru|3>^{P4c5U z`*RI5SMM^*HiP+vX*9Q;=Dtw>amm80I+)iCs0F}(l#A>p(O<&0 z!l6(klzFYse0>jHc=*>)hrbV9c=*@QpOLl{G6Mtu-rFzD3!>&O59guUFmH(v=ce{+ z)34s!$-YE)djm4_+Jrt=dBYLkV}3obXrRMi1ui)7J#c<&F1T^=ZAr|xGH;78@5n${ zw`3Nq7FMPIpErKa=s&N`Qsi{PLcxx~!Nm?GmJbIP3k5p{2Nye(SUwzFEEMb*99-;B zV)<}zu~4vMaB#6hiRHt=#X`Z3!NJ82C6*5d7YhYD1_u{Alvq9-Tr3pq7#v*eP-6LT zaIsLZV{mY>Ly6_X!No$sj={mj4keZk2Nw$kI|c_AJCs;H99%3E>=+ze>`-F)aB#6u zuw!s=u|tXF!@@@7dw<#J{(*u6zmurT;dp z_4MAmMgYLWV``v>^KFfdJG4EvPqZdrN9d^|XUA?{&dTCTuIC91Pm5imt7O=GfAg4Oq4X)^ z4iZvU5P-hjq*CwN0J~dGMf)Qfl9< zA0doAN%C3x<<_m+OZj7_u7saTmUG*=p?fyzQi+meI<0VtI@WIW*xJmDjHbb-d4#=m ztFuQP^D1jMyY4e43hox~qs=^Vn)#4%qAOJ*uIJ%Qbl*#pi)AV)y3f|#DYI;dq$n6E z^q0n+BziOmJi#F_MH;T*e6nk{O61-vF1}hQtM9KeQXZ_oWG%%nwb@<>Xuuo7YZ9f_mvK$X%`+O&4`)8zB_ z7tTHD<#JMya5V!!GtnT))IkXz#p}C)75IITG*s=rjfj zEPXmO)}=IVV>@u^(b6#n+1Q-v$FR) z%3uh0zZX%D44!OwZ)5YOXNq4lgUjq`arDlnm3K4q*BhB{pNN-~IDN@HC|JJAVYl`B zK0p5n6~>dYtUSg=gs;FffZO0>9Z-8JNg<&4n!lL0|9%mhV+s#I+~FU3wN(X*fXB5Y zSwsce0DJOFr&f9;RM&uiE00J}Rn$=7>6c%vgj4p2hjI;0e7V2nRp!^6(OgL-X zmS5N}{_KL-CF(o9amCiNpy_Olr|~MLsCnbb0xVp_zdh@Z%MMZ1Es;lUl zdtZdX>zbEXzT5w*9}Aw+>B@W9Q^WfrI74?_kYqg?poT&n|Ky9dk2AD+ZF4Gzry}jt zuCG+N)oy7$^YiPbhbWMP0DXiAKoS{3-=x;N(y3E@Z2ujj4E8+-eO1n-ECmkC@ISP`%{b}x($iHeN8 zP+M15@WS0S&uXiT?7O#q9xKnk7jzv2g)R$?G%te7+CXZ?V+Ze#u09}?UaMo$(V=Ez zueDA=Lg+%|dhO%YUEw#CT~bvY-BQc##G>$1fV|Xp<<$>E64u`Ss#ZkdnqKL+ZPv@~ diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/downArrow.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/downArrow.png deleted file mode 100644 index e77d5e6d4157b12a5b2fa08a9fc138f0ab9eb4e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4460 zcmV-y5tHtTP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000J;NklFiJeI@Lq_ZL zBmL0S$Rv}rA?cV&Fjh^|PKHr3HRI&NhS;c`jEONpgn&UnEnlJ_Am1#z!h)de+aHT0 z;;vxtzxUqfp68x(?z!iAiJ1%?j48rOmnIvi>lsvt1`y~H9SSnw0-F?A>H>~kT7T;_ z2z@$}yyt2jBz7^jxrDogfG!go#BG@q+l2yBCJhqU{@?P^y~u;>zKLUsunAxxl$+4v zAJ>@{w5l~Vcy)K2afu_uH*6FDdd4~pb&e|ISzAfSS=;G|E6#>6p}?iPK*;6`j}5*z zV`9sv@*1iCNeEb7BzuaQk zab>E(3fniP*Xy>gXm&P+Dkwzy#dN(8x4Xn@T4|e#J$UtRmUo(Vu5lCTyDGAKa&NDx zJ94U!PX)ZZXzz(lQGaaqL+c{2Rhr9uUbTH(fz-OdUCL>sUb0%QcQYj`Q{uNUuKe*#5q@>@~6 zyVF2SvD>0CML4zINKer$8oZ766oJ5UOb}+Y=9Os@14L z6QAACL5V(!OaO?Po!GhRp$*fPj5ftXf-@ps9+cG=<+q?yQN!v}(V0TZdI(_+%4(fS znYcavo=6iPs2LDXT((wHplOEnLNc8otU+1bGbR2Zk)j5H%#3(;O1FZ7P^D=gVn{)} zaf!p*hVSeprnCLUp~JU^d^O&gQ-S~mZ(n*f*-tZ$EelNRN)AZ1d9o8dJJCT32*hea z2_yv%O}xFHNS~{E`UyY5T2-HZq zXQ>|U-^%L0{#HMI%Gq&fFKlZj1T)(4xEXvag>L8B6gotKmZza3{WJb zZ>-ZW_d(0ZRNR>BrV=XnD#Q58@p~(#uD`e-e{$}Ph8LHEf*Y-##P+Fow*7Mb&o?@Sf8;zUJ3a)7nV6XuGu-Y5_d(kKuq zBLtNLWg(ux89|TsrkXPAb$wj^-t>C9H{t^=d(r{OvcQb`)WEDBPng=l3n6rihB6^} zTtHOXN+P@&eKp}9CFTdh>}?~>b3VED�EM>-Bgb&Rym2{we-b7Oawc(c4k4MzLw~<#m(JZ zB@~qQpIqE{{i3mPsMc88e=1BEyGQ-tL@*0+ivy;CK*#2o{spHM{iH| z9Gh3v@&0O|0;q5KVBKexcPNl+?>no)bBumM$tbrKM+f?v`xeex?C|i=cb@7#9^EtA z5$w2SHyX8op_k&`I`M#daNHB=p|*k_yW6PjI+$`i->cYLaVm1JK(;C>Y@EBf^f#6l z?()Qbv){M8za*3ZtU)Wg0(?wkQ!yX57bc$QK9cU1y5sxad*s-*Y2|I!*Oq)mpB)0i zYRYVQe9lv~R#WDTw&)JQGgg2>oc^DT$x>Wy(Xl7@WQ;F(atb;$0A5>*}wG2f&2c2 z$oSY~4e8jS)d-9lf|GzL(4{)wDWd$ieC77;J yvyc*~sDYFLfm~LiO6lU!`6zQ6e`|LwYFu4~NgdG7oBob!2}=brnVxvmqv)!aakZw(&+ z0D?w_x>k(ORSRz(F2>*I0qRqX4_T<9()#59i6RP-Dq^0pBv2^ zWTc}5^7f^=W%TAmKJ0@J1nUCSd7Z-}x~4imVfy>7+xh$Ui3pX!};XA0TG@Ol8oQ1EC(X9(bYS5`I;c|71{-PTf;REc5!(%H_(#jtqA}x=%KB1O0beOVX9nVo^uyAjB>i|3tnzFms)Menz?-e9OqC%t3MGD@#$I6S_&q#*vxeXzf!9 zw>PxSlV0{IO)tauDFc^x<2gcNAvrsU%YHZ6DB?h`eK`pLV->WzN1J$-g}Ft%XbG5q zuQ6+owgCupH9F-306TT%pf-&q8h3aAKsPO1@v@fGr@B>2wOniKmiN~2&p4|b)Rwz- zQ(Huvj}*4n*I6O|fcB=yrpwZb&ag+C(&$=Cx5zkeA?Qup8$#;d!e0nHsdbww!+ANi z?(&EcWV)j`T#h)%p5T!@duU3g&X7~|s2u2C)JjXRNvyIV!s>_($ktGLOx^c4?BVVD z<*}-F0px+1$Vvmm>F{Dp^+y8NbjortYYysP;D1P>Ba&hy(vlzgUR|SpOeKBrVV;|C zcMM+V4!riwDsI#*4>+`;Ui-=xCEhsV{VU*nfxLz_m+kVGRYXq^Tdo9fiiYde@~UtK zXoCprvkch($hDx%XqA_AH zk&q~zTNpXfXdUFnvXj3VUAbt}CfcUo=4B;2q;x46ZMa4@?p`;^y_g$&S_!oI?xFsa z{`!7Yzf`}>*fzct7fqjwQ`RpxSvBr9UOgZ(fF9r?CnB|MGm@;H=A_%KP>ylZE=Vu6 zDzZGBBZl@*!Zt-n7@1@iTsYId#!b>~l3MhJUcTb#nRVs~5AECT4;j2kc(d$NfPi46 zc*LD3%BI!HtGHKDRtKyqN;J({-F|fS9UC|XF`PJfR`@K<)n(IHTBcpu^{TP~#7|sZ5~w8OE|?eTAFg~${z_BV-aU#HiL=rbN7ZvL zrDJta#why|tMSvW8r-iEeWuRQ&3OkmWhab>9(lI%y~0ZcsVuZ<8G^jsJvTlf-XYI0 z&oa+oxJspPBs(RmO0U9kI$TKWj`7Cr8x1Hi&C62;t-GwBX7goBn5p9?3Zc2~nNsN$ zx&bv_*`tZ6)jPvdO=;QBf~p3;tlbBjwVCz&l09J{;J{TPAjj1s(7a0Rwz3aRO&WHm z=cA?0j(SaRGyvKyi_z zT)$mdKN?pRx37HP@mY0l!NXlbdD2eOp?+6=SK{n&&yt$YjcV+>{V9G3Msa8nX?cQr zRVsF0;TAQ;I=S6|B1tLpix`hO8f|jmJ~ROjO_pkSdbg_Im_FgN<3(`WL`rf=^39Q) zo}y8eQR?X7-t!O8=M_>NQGO5W@9I3a9B9?xKYs@9-j^S0p<@wFxi%;ZBf?_s3m#v- zo*9rkNq8@b{~hmp{uTa}8s-`Dnd7bpnA+=iuiv+*r={*X)TgswcAhjJJl_grhi%}X zEQ=1;3g7nI^i=R(nVJ(CxE}KF#a$y>$I{BQ#I<4$6dV|+E0A%!`|f0c%;aEVb8ItJ z=+M^CH=Pf;39ku9>q7-L9y)x;K2qa^ca+1LRz!kwKx?m#U!U$5-FV$+$rOYIwg_UZ ztccHr?pEu@l%vZv8lbL@4>}xD9E?0n)?%TGg(_Yi)qOJ~6;WVtW~8o>WR*F#dYRm zhKgpvr{2X@DhJ8kMrA4ulpWl7>13s;py|_OT&hIU9*`$e9an{jI2C)+M>|)>EUuLD zmh#$l&;5Mzq2jsQUPrIP)}7(L=U#F$f4L)suT(qhjg8Z$$BNv=6tcZ*O;dCuHa;(P zbJNI!lE$8sm~-#X&yR@S6n$~3G&9n~9wP1Vx+;G+wph(4sE6;B`0~w>c3k;tH;$Al zdUjakjo2p?hE~Z3o4JSYtZO__ca6h+nBSIf;LyI|-p3<5EF55teb)$IB2%RB;?YM6 zSN2FIi0^;0sW)&y>M*Ub=4|ijtC#X_m62Lp+gyiUKZB%h6N=AGc%2~RCD_${Rj|+Q z>d3_JdOfg&rcFH+5v4k188vD*D#_XRnwwNLY%bb-viV}8GTQd^8sYJjSL>)$NagS7 zcO5<3Dko?0_o{nrIc&{3Tsz3qM$;ve8imohLsRk7o;wQ6J$***ENfdf%PlKZ`nc>- zhjg2|ja5wN=3xV&JL{|GQr-tZ1XToWkDqIJDeJ8p)IT)I+c&vR5ZAruSV;a0?)LS2 zq$$#{-P%cGN&3mwNz>b0wv}5vz_)h3eHJ`p(6e6n99qpW$avi59<_VuKzkfztmRnB znUsB@(9gZjJr_zt28qpmyM<}*%SGrf+Vtj+4ysnFHg6xhK_4sb84$C-VV_il+vWL| z{#I=+uHE8J#kq>4!m{n|Wuw7W*Fsz;hon+5%}+m71$~s5@9ap$sz0q752j7to}B2D zcpB=vaklw>MOVPa(Sk~g%3Yr{N3^;$DED1A1N3)oVo>%#lF<=ogJFV)@dQN$fruqU6{LHC@BF8o$45V+}xVjnw~J0 z5Le^5H*@xF?eOZNo`#zZ>#FYsq7XYj*-eks1@s0;zt89sw&>pr+P`Vu?emoh>xbFX zajWCv<~f%oj?WNLkRAZg5~A8T&>hT7aYULYlt7}nkfDK|-i$&N0Ms-By$M8jG9BbX zrck}q!S5?-z#u9~9c-^`1~>E8A-hoxgMG=?!R9u^V0R*x1lGXwsRiN~0-j_#0Tk%z z;pK-5R0n_6#WC!KW*8Xs)rIb^4%S*25aeLC6{JJ+C4-cq$`B$Pi2z}+P=qoXi$ExW zkZ=SFhJeG6SO@}vLt}6V70|aA7|+MB)O<;E1XPEFd5N8i0b* zd?_#l7K??!kuW3@!tj9j1$og4feI=W;(qA%5(PNjK)7IX0WPf$=esnAH54bEy zG2DMCmR1!`Fi$!5bu0#lu zh(SXL%4h-vi$$U!Xe82=fJTv!SR(o>4l}c*;eV3Wr4juX_RcqH5<^-~3!{S6$Esk^ zTTpr^1OkiRqOFTS=^?fCFj%Y>;=AmU&_Bsq_)-};kKnPyXW_^fYyAK>ve(~jhefHcUVkm( zM{}hI5PZp66vjIE^Cq=cS-MLX75^CWv$Ps)A@_Sw{~IR2kFe+8!>^~M0@p&K^$^%C z=!M0trK_c{r?01?r-MSF^x&xPQ~NLAM=fL{#105orEKNXk z8feLP-y)$U8vla}ltlKW{xeBs$x$*ff&QPJ^S_-&St~ylrKqmr;MN zVHWCLM%kvjxG?n>w$s8F>OU@77*z-3ngO>2`1f*=)g<~;_#d|6H+9m#QZX(b*pkp+ zDbxO)qH%GAUr78I={xZyV3(9AYRu$>)1i6Le9dSiGM-Tn{Hl40=8ta1?@C)2e^$c# zSs7@9jP!I=5Lguz2olPunSbfGL}%g33&*H=88z6~tchpD{Hg6{e}{$I)x-a5ZHhs{ z;aE81TA%Uy7P_?i=TOJL4_(^*bLfvqTQ4ddkNh^;Pt8lB7A_ALp;|L;iI5jg?dPVS zy|+>W$sP{6RK~T5-$Lb$WL(XBjrqCbmw}Fd6}Y71Tj1i>Tyo>$>ylV(W!x5F+>wDX zZ^<8y72-m_BS=OcbmbY+S5RV*0RgF;TE$uyL_M ziRr_}#YDl1!N$c3C8iG>7ZU|51{)VEl$btjTucGUziowRk3MHlw8y6D=D+U`EE0mZ%Y+OtftQc%utWaY5uyHX_uwt-ru|kRI!^Xu# z!HU7g#R?^+4;vQ~1uF&{7b}#QK5Se}6s#C*T&z%H`mk{^QLtjLaj`;)>BGjwM8S%| z#>EOHrVkqz69p><8y72-m_BS=OcbmbY+S5RV*0RgF;TE$uyL_MiRr_}#YDl1@wd46 zemvxW?8SJpK>*_s2FO!^*^I{@fQW`xW&jYp0RX}x0O0dH<8ufA{NVub))@eBi2xu; zJGJY!J^*kj80l)+1a|MW^EBNyC?47zRCK)TN#c{eYm&pl<2m6w+G0hJr_-a*$FCao zJTmIC^G`zSS+Bgb%-=fH^j@g0lu3nxb?(TW_&rwLRHM7y>!t3O%NIC7GL(!3WHfIc z_I%#W_3Hhw#f|9~xVPQ4pZ)z?_MIQZ4ysS?+llje$w_kL0^q199zavqEo9ztb9fBu z!`ko)p6%QK=O%$_gW4Rf%8BQ1Hp=XUM)Bn49*B&LbcU~5S0e|0R9V&n28CYWC^9_B zhZW(J981ay*VE!z1#)&+7CEc2ik~AaiwXjhkgFd)e-2^{v?BbhWzeN*1JNmPc%3s^ z(8dBMs#o>D`Q&^k4q6!XL7 zm|%0!z(ml)&sC8<`-(>Ait2J(Jb7o}RMVn?Pp4urPSuXr6HWU4UR*kuqItM+YGbaaBp!NY|Ba{P2Y& zM_XklsC8&6s9ksV_6KN@A_B#u#tBb~>AVrr>>-SwXxlq_& zjT;(G=jYne+EW}`?ll%%KFXu>V8;4m{im4C7@K-koXe;A>hbfD(&dnzu{THB;M4k- zRYzLv0#bW}#)l+F;)br}ubjBJTeh9oz5Pm(fw)CN0jyHWdqsO)@U9U(`42u?0(UeA zE_Ny8Z40;9HK798E__3U_<77YfhvPfDE=)?y$HSEB_A41emvHBd`3Qbjd4eLk%PRW zh~}1NAeH#r+F83kyXVjL=XdXw9UejK>UQ-)LHz|)ok*m9$Tg8-&Iz#3G(9J#ki=uJ~wtZ`sD1+ywU82$`KVinC29%35u>xQ|mvG zybq&uoOf5Z-A9`)t6_fsNu`S8E4o~_4i+jj#mwcey-UFeo(OMLRjt`M@VVx;z-3(# zZ4v&<=c7a>v-(}|;*D>sFm?f4c%gv!cMorm%yv5V*h7w_JDuM-mDh*Wc-fadpd4|n zeoNnkZ~N5X?Myr5n7mk&Q7pQ)NwkA|R2MQ}j^za|9K8ClDlj75c)icsQu7TG))E8t zmyJcQmaUktt}LhKyTw+i*SLkeH=346HFA=R2HNBkH8YZvxCSz!GN!a}r#fy+SeF(D z*9Q;tmv()r@BDmbTYCJE26SS8C?)S#@=o9V0z+-9l~W1OEk$7)liY diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/leftArrow.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/leftArrow.png deleted file mode 100644 index 3823536e38ef1cd96582a6072b70cc514ac27d05..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4531 zcmV;k5lrrhP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000KwNkldg1pcz&L1duC-Js%T0xva#KOj<-U4vF6^DUSL1S;K9~U_5b@Tt^Ey`FJT68-Kj(K@lGiW+Yop&i{&M7B z>u{Hrrk>wENpk7_%3KsepyYr|SJ#$ZeaF5B4$H*~2y7$)ydJydzbissZp1xWoaYR) zr;}ILnXVIBCMk9DGIxE;E^Flt@IDA{CpyalSf*WF{QI!=4Y*GhtxV|d8|t&wSgQgB z@#5q~mcP{GKo$TH`b)e-ObgR|7SwN!-(5alu)>aGKKq)pwUy>GY7#vBzz>23#+sk( zJ;zvUt#WO-rdRj6C@uPrEF}aP6n=>80I*$`_r)CFMYnyuHoJ{qty-Q|YC083B)}jr z32aH&yFbx0#WWWDOxJ1kYv)%!4gjZSUt|u=!z=&@^N2Bw1>M@PA$m!1@{)2>exwsC z?CHK4)hRx6YXG3kRNyz>DJ6T)?hJ8_FbI;6elm2HM8p|jK<7PMe=CQhZJ+z^y}B*F zq4%3W0wcsNqIGS=+ePu7Gt6(*tky~Fglj|niU~e8y?&t4Uy__NBqB;706Op4?Ke*{ z4R$ErsD3WxD|10O5yMO2)B9A=^QBJ(KYQtVN)SVkgu{li~d8RGLYE00g;& zv^}R?R~YZ9GsSr%wI4C$07Nq-5W5uSC9G9PN?NbE~6U7qzKuUDT$sv5xo0#k$|N*;@SoK&?>QB$5C? zB@rFTJ`l4 zljms`pL-#EeTBPF4&5AMWBng>r#t==&m_Ra*HMD_dO;>)1h@pZIj*qNS#oT~%!2p= z6Qj20obua%-U`3Ly~!u{>%3+)*ddGK#)ApV${t;s)AV7;sKt}O4X7ih1u@{ra0rqR z?4oUZCS+|P09@{?Q?g^MK>~9Lfz!^KOEmK}KW)1K_Z@sce$S~d+w$BhSDSB1V_6st@$GYEnN=KKDn?02EBRgQP;HP&j)NW)MfG?~tW0%G~K;Q_HU z@agYqbckC-?_&=B_{ZrKbE)l|tPa>Hd)AUZH!Mb}V$H8^5F~x|_FT=odX5DxSE&e;TyDw_?H}&5C3&S8?*{s5b9T&u);;M=3>o&V|4PbRbK7PQ z0Q4VqAAN9zmn)N$T4y~MSZ}R%bC*2&Cr=9Qp9rwZQs(oq{+~&urqc~z)-T=uB#snXP0tAmX; zgTJF<5r}Bz&S?iexZ_`#EE!yqAM+Bi*rZ^^hz?8Okviy2zOm@nflB6pf3;3=5e*o9jafR{A Re)#|Z002ovPDHLkV1iMdkGuc? diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/minus.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/minus.png deleted file mode 100644 index 30698076b9ac59f0880752ddc13af3f6bf062403..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4147 zcmV-35X|q1P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000GENkl3{XTl>HW%Jt}hQ9w9=fGBB#D5Nr`HCj2%^s65j<=9N+ zV3PL3QpRpxvb3q0hEXfcvY5#6Hcpz3fEXGXVqCmn9+1P$0|x{;jGf(&eGX-rqQd)c z@3q$Vti9G=@AoZYFw()eB0S>OWFd7ug9@<#g59D+K|0*vB?Xqbfddy8+$;g1-z_BX z*qRTCpN!>h;btMAi)Vlsk?9#O6p%6ykU-vV<*qHrhx?wvaYe`hxC6=nT1O_@XN1nN zO&^`rk{CF}Y4Hhn0YGcN-M7YhHt>w2)N;mA5?S9<7cLaIbvFokzUuMr&jt;)elP1t z{Y@c|VVPf-J^q#IIhH5d2D2;0ZHGtiu@xkpynbwgP(bjlv-2Hm?h3XR$rg&9D+Hd6 zeyM!zq>n3cA6j3#Dy6Vt`*e^XWoyNwZOi}Ju5N*TCmTf5^Mt_4i5rftNO-3f_o+tPlk(wk|JQ7PsaChDZ|wr*!t*>~U3hS4JqxqV$E% zx2p@G3joCWA{PQ=jGkY&I`M<^7-HqduRT8_G^>^r*v(P703gso5pE`c?C53H7$!Y4 zHm6#n22D(xp@R~;AF}`;E+E-HXUxL3;R2_J&TfzKpI}$ikaawEmXNXlLZpSxwqcl+ z5;WaL3N+1kfktvB0i=b_Zt-?F?Kly#zGhWsLvMYU*A5jml_CkQ1At2&NK~mrprx(1T=Jm{mzAIrAH2@U~ zgbErp2o(r|1{$OSbwEKu6BA5gf)Wi)e>8-Ba{1j%Z`{~`WT$7s@tRPANx>M8_X5E0 zy%)ojm~eV-bHRfw?NeoGOIut`Vcuu6kJ+UeD;KO8Gmu*bC~5F+r$2d+&wP^G-b9 zDv0#6Hoq9NveX;5zNa?O_$B3n29Z;QWL9*XvdptQ-3$QJf-)Unr61on)W@m1yUOAz z7)}Yvg94($Q5rei=eVxBGEz~4(s@X#=G`dPNnGi@6n?Vph9^v@lE6Qq~QV|ZQYk7R8Ww-eCE52?9}Pl3IJyuB?%v0SeHE1(A~CzPxCMl|9iZ{W$7Wweh5A&IS?^l?APvDob)J#&IBsf!} xW+f$983jRyKrSm$Wps0YbZT1Zoq%5bH2}dmt(E>J5*z>k002ovPDHLkV1iae%XI(% diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/plus.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/plus.png deleted file mode 100644 index f7ab2a334e566b6deb9657d7d8370f591bfb81bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4341 zcmV!P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000IcNklZ0y)aS=B_F>$~A z_;!gITGr7pim8wdAki-d6r|q|UQ%GaA2{5x z_NzJ&Mktef;As^kcOJI-g}a1+A%P2GT4vz7P(aG4K?0SZH;(K^75onkoO1vh0oFj7 zfR5Na_mboluEkSVcIU+}7_dg9jsQT>`!hTn<*3!{LR@l-j_lG zI}XThicuj1p0xk8@#VR1oWr+}*V?wvukG5q7$iv9)3myG>!iSrf5{Hf#&!bOHfP7j zTO8Xu#~VE5J(2WkYh}rm!HYHpg{+ty&+~b^oP|kCz2kNFUHh}+jZ42>Wda#HPp$6R z9z0WHa;oq;74Yl1yN_&~@vAEndGgGe^`%z_J8X&y6b0Xxw_{sW$Bx){wV#&^+E+rT~oH-bXEW$I}#NTpm^$<_80R0aN)uH6DaD@ zcSSwseIlvIefh$Y{2K&!jLK2?>32+twlxPT5$YOh9`okFhI#Zgk=Db6PNE^F>PH)%II+(5)2FYk>urlGh$}C6*X2K&t4{^tc4JT$;(~g z(8Tok8z3zfs4##7#pWUfT1T$cB#Q{3FnM|R{gipFb$dzIP^T@}4uf8r&uUDLVHhZ_ zn^O(|40LIsLVC2_^NiyK=XVkcy#O#juAuuvcP&6J5fC|~V0Qe1fuOM+tn~1a-6H@&`zPfVo;IiKJj!p!Wj6 z)u9fX5(`eP@>GWk-_d0)lj{7izOcM|VQX*1Dv>CZXZGM4_xuB>=C(r*QGSPgb zfB-ZM^i#yzch?=67UdWQ0DEk%$2Hh#D?XN9uBbpNC@Kg{Dj6V-F8jP10MC?34jLk%K)fFEZ=xF z3To0yQ3AdSGNK)xr)O+)26a0J+v3GMyQm@3KuAebe}lEu`j`g*7A2H;|MAH2_a_S9 zqjmGj$EHQW0PtQ>W5{}F@ikim3qymD{6Ii7d7T+y<;|S2lXkKPNxSb{hN6Zt_@OkH zesR(uab@UI>LAsyYE-5Udms|Gd6;b|?em zK}-gOmXCYhpDk2Skjg4n`OWEc+q(w`41IpFr>%txT^Ed4>Zjph>>dv zdq&4%?Rwl3a5Dhxzp=OI;LW!)Co_^3W%rPR#~X^v%RXIN4ieL&vOJUN|EK40=8>L* zMT#0Ex74n$y*Fk9x$*Yk+4K$ZF+wSB^q$O4j7aI5HD%twcth#Y_TG-cmZUGfyb~*; zkQSBY*=(tgYQ^7RFxR00000NkvXXu0mjfp~Nvu diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/rightArrow.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/rightArrow.png deleted file mode 100644 index c3a209d8b0a58355305aae03b5520a1e070d8eab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4514 zcmV;T5nb+yP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000KfNkl=)-fx%60=o-~3&uscqkw>si!2o>5sjwfBtw!WZAfjL zc9OQKiI-lcwX`)=Nz$5(Gf5aF32KstNSJ7-6H+aRARr>aa1((n_uIm}@SqLUBtRuL;Pkc4Q|CdD zZRa&rFVRCI%7DCM00zmt_-&kPh1&g9CH14WKLtJJ8={ zMb}!7^`=IOOC{(w^emE`hb|3X@FP&%(lnK-BYU*q|G=!fr|rY{h1`=eNVfZIy_jW-uYfBhj?bbsL`=QA#Ai zRcI#v8unJ{p@`!rmpcb`n!oPTob1RpK3kRg;Mu->?>RP`iHIRdPMakniYEXu9*I4( zBQh7dAE?`t&^FfWHB$}+N%n(J42dMiH+z|k)WieYasZ;W3_>6gW2HLEG6OzX_v?hV@fI&)F$-m4FbPN` zfk}WsAn;8idVJ|K*N?{J=cIT&T%{CFw(8+aLC;=(B-K1Qpag&bw=fG4gF!(O6KjbW ziygHW09wbcc?njaJh?mbPLGdTsQ6}#U#Mq-cZcjR_EiOSvjaM_zT|)^Sb>?g8P%OXk>*Z6wmdmqhguIABtHG@ImMhVQN1Wu?NEY)w&KimxfYcvVw_u|fdGT$^F zZrT_5&+d~k>{yO3tyS90=2whuW35XBG5lRZ+P5xwvMRwNx$DNbT5FBoVHip!BKnkN z+FfZb_5rYt-`!&XH0^`b1>B@@(=fatoqcm~#ha=zrXg+AwP?@fC zyxm)nK5VnL6Wuxn?RL%qpmNP8?pf(4xAIPfpi=jtumykRZMIwGZzJDmAd{A*HxBp3q8@6xsizh@XOiJpJvSIx!SXb3w(a8 z)eN^PbAq3j_tK~qEGFd*X#j+>D{3-%eT3!m?UGp z^$SCTwZ_F&avQsE(Xz3H0IMzKp2tmZMwgijqwMw;FK4Z}8G1`YpIo@&83G*Lvif;AFp(X}sC3Zn#=sZ>?F@JJID$AlPj!Z9lR)@8}&r zVbW!AX;Ih<#NrhtD*@2#6*+T13r8IXX!bjScKO`D`tRwKe&KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000Jw01_u;C^6LsAgGY+3 z+aI!BFcKEsfA^ll$TcX#&?!Z8JuegHH55CK!9C-&=moy_XCGJ z77o^cpo|Aek6bMWPk9uZhHa~!>{;3;H9k# zJiEdsHh;n!h?L(j0ma7o?MqUBVViCIK~FfRQr+`;>|Xnh?7F@$GME?y`u*AY@^8l_ zHXq>a#7Y?x@QUfpru9=lY#Hm*=j&FV==wAs0OlHht3LgOR>iXMO4RcXE_~fL1lJe}8eq{$S+0um92f z;gyYZ14PP}Q}eplj;x6X&QxGC31HpS?MF)|ulgofDp#F*wd87l+mn{)JbPTklWxa= zJ+`CY7O^m4@%6F3Il2OuPBpQwvF{5rlT&Y|Fv9`p=Qm{yIGqX-pSb1AhCMrYgcW?v95o|2a8#hwDj7`NpI9M2}mSW zF4`CPSO$PJ4a&ekaqRr|UuSK*5K1_^u2tj`7|+GO&}z}na9gx9-1FmKXcZ)3kNwZN zq2kJ>tiMpGpVLOfa2Qg`0>lc4nYI#uC8ia&P{G?Sud{S`E+*>K`u;T;@0}TWzczE@ znHaU9|7w3*;-9W;w1kR(X;P_8A_)?!wn71M+95m(0O`>d$LzT0gZ?sJzn4#R9m*Cg zq13dpQLEAoj;uur?cl2^Z#GJ-!dE^2$@coa91PT+tusev-FhYYjfa%}a?(#bO_AxhT)tjixot&BD4ZN!ft`pUNt%UB zL`4LGRX?jMm~%tVaYLj0Ri=v7{#BV9>O+CPmA1Z~S>oObVld(aGqw~821eio2 zgOENU!@({%mU+&PerMsd^x%T z=QOP~=#j|2UX4To09=wF?qFi$r90=f!H5Iog>s&*PzHb_&iz&ut47zD0;&Ib+Pmk* z>s+08+q4XZ0$gS=HxL-jt_EW`ZBLL0@=Re3GB!`Ekpe?Q0~65^2BBH5O%5k`xX1qQ z$cVwjVG*}`T9O4x5DI<9t>5pjR*3M;y(g`5+s3$mRBvV8hT&?x%u(kvq?*|kxX3NBv+@!s13cD z6P|vkj3zx{>gl*^o7n%|ohW93#E4YqGE-S?oF-u)80nsGcRUvmA8*;6e`IsWVXx%N z)a?u|6C|)GacTX}%ucd1~pzNG7Sc z&2v7f-P0O1L5jXNDI(=wID{?kQ?Y-y|0TakJ~=(02W+XFacFhe1O42SS<49Ykstvg zhUtlPM~>EdeX1_EYjR}9ofx&j3lLnsUX6XAGy2k<7Gs;IHKp6@NFWdbV=XQJDEHvb z$G*apE8vD|%P)z=`)XDL!wSB?DF_my)obKEfz~AF<$h33<&S@b8M}cq_4y@4{6hj2 zNhFzxI3}P}b}{&>U{OzgI%LYX);@}G#Qr+~{b?&$J^k9A00000NkvXXu0mjfzMf>g diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/zoomExtends.png b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/img/network/zoomExtends.png deleted file mode 100644 index 74595c6358448fbdcfbd62629084841ca7e8b8a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4464 zcmV-$5s&VPP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000J?Nklmr?3xa&Z(!1P+L?CZ z)HFk8I!$dt<2X~bGfw*YAl1VaY`=w2guz-01!Jr_ZsL({y1u8G%uE2<* zWuJa{cDHB*w@LpqJI~ABdw%zvd(XM|VQFb8LMF#)^&|!!GbP|t${2X*$hc+8@H}HdkBLcy%ASf3Cx)=r^ zgbqMK03cbTB$MI*@It72nGPHhNKg+!0U(GVM8p7xVImUo7yxSBM|KjZh5{f!+M?A% zd5P}+yo8M-tK)OWm&K+`6Ts;7Q0#??uJ}{_=HyfU=G05q`%;8b9@K;7q&!97bws2` z>}z*JN#dyM@Bs++k$@w)sPD;#esO+d^0q6uhf)`=ypg(aipm6{jwG@M>|X{Sbsc_@3S~mzg*7iWKA-*jUVKG46AMQk(BiJO z2aczc%o9qSP#UrZYz8B9TSAE9194>k~Hik^&{#E)jve?>a3NMBG-~Dbj@PL{p#T6fmRN?|%eF>RX8ZQ-Uc24y zBk8TJt@RwZ`AlH!_OMAHAdR0>Y6Jn-lz+e{vh$GdjzS|0#!*j`?Odn`RJ zYsfcsF=a-dDG&l%AcQT!)jxaW;qcmQHedT=e-GF`e!|2MRH&d)gQ5ma7C=#fAgoQr zrqiyYfe;ko>wg!Uy`L0lvS5owVLn0F5?mv5g>UTku*vIu6(=71SLJ+RE|fK;yam&o zt2}<)NbS&H0dl=YFoP82EXf_8tAnBj359k(DX7STx|cE*uNepFr ztu68L&A}8!1%Winw&rJb0m}r$p9iXPX4mR4G&eUl>P^C8vG|-$r#A$Tyl)tNFUKgY zs?6Q_!=QxztN?&h{^sn%pB=D-!2rWX@kICt(`*yD(exBDwCXU99TX{1^O zNpRo3eGn0Ru;G=b1X86$Ls{nUyicrn(uenUNVoYHmaP<!lvI6;x#X;^) z4C~IxyaaL-l0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP=YPV z+ueoXKL{?^yL>WGgtNdSvY3H^TNs2H8D`Cq011{AIHm(>utOMPj;%cmv@^uh#WBR< zbm`@TUebXgY!C92?nJxf7HQv47WvUWTvf7cP^tlX`(c^5al_?F77?z^hEw4tDn@4V^@0w-8rRM%jRv+ zj+riJ^ZmV$uG{m)H6f<+*?!2D#&7OCpL9h3()<-#K@Uv-J&^dvbhs@wc6x=<11Hv2m#DR)bL5fm(AhS~;3Rt5&&p1M9m(U6;;l9^VCTSNPfzfnL944$rjF6*2UngF*N B__6>1 diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/vis.css b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/vis.css index 5f0f38ea4588..d1cbef4879d8 100644 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/vis.css +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/dist/vis.css @@ -254,7 +254,7 @@ } .vis.timeline .item .delete { - background: url('img/timeline/delete.png') no-repeat top center; + background: url('dist/img/timeline/delete.png') no-repeat top center; position: absolute; width: 24px; height: 24px; @@ -628,7 +628,7 @@ div.network-manipulation-closeDiv { background-position: 20px 3px; background-repeat: no-repeat; - background-image: url("img/network/cross.png"); + background-image: url("dist/img/network/cross.png"); cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; @@ -674,7 +674,7 @@ div.network-manipulationUI:active { } div.network-manipulationUI.back { - background-image: url("img/network/backIcon.png"); + background-image: url("dist/img/network/backIcon.png"); } div.network-manipulationUI.none:hover { @@ -693,11 +693,11 @@ div.network-manipulationUI.notification{ } div.network-manipulationUI.add { - background-image: url("img/network/addNodeIcon.png"); + background-image: url("dist/img/network/addNodeIcon.png"); } div.network-manipulationUI.edit { - background-image: url("img/network/editIcon.png"); + background-image: url("dist/img/network/editIcon.png"); } div.network-manipulationUI.edit.editmode { @@ -708,11 +708,11 @@ div.network-manipulationUI.edit.editmode { } div.network-manipulationUI.connect { - background-image: url("img/network/connectIcon.png"); + background-image: url("dist/img/network/connectIcon.png"); } div.network-manipulationUI.delete { - background-image: url("img/network/deleteIcon.png"); + background-image: url("dist/img/network/deleteIcon.png"); } /* top right bottom left */ div.network-manipulationLabel { @@ -761,37 +761,37 @@ div.network-navigation:active { } div.network-navigation.up { - background-image: url("img/network/upArrow.png"); + background-image: url("dist/img/network/upArrow.png"); bottom:50px; left:55px; } div.network-navigation.down { - background-image: url("img/network/downArrow.png"); + background-image: url("dist/img/network/downArrow.png"); bottom:10px; left:55px; } div.network-navigation.left { - background-image: url("img/network/leftArrow.png"); + background-image: url("dist/img/network/leftArrow.png"); bottom:10px; left:15px; } div.network-navigation.right { - background-image: url("img/network/rightArrow.png"); + background-image: url("dist/img/network/rightArrow.png"); bottom:10px; left:95px; } div.network-navigation.zoomIn { - background-image: url("img/network/plus.png"); + background-image: url("dist/img/network/plus.png"); bottom:10px; right:15px; } div.network-navigation.zoomOut { - background-image: url("img/network/minus.png"); + background-image: url("dist/img/network/minus.png"); bottom:10px; right:55px; } div.network-navigation.zoomExtends { - background-image: url("img/network/zoomExtends.png"); + background-image: url("dist/img/network/zoomExtends.png"); bottom:50px; right:15px; } @@ -807,4 +807,4 @@ div.network-tooltip { border: 1px solid; box-shadow: 3px 3px 10px rgba(128, 128, 128, 0.5); -} \ No newline at end of file +} diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.css b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.css new file mode 100644 index 000000000000..d1cbef4879d8 --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.css @@ -0,0 +1,810 @@ +.vis .overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + + /* Must be displayed above for example selected Timeline items */ + z-index: 10; +} + +.vis-active { + box-shadow: 0 0 10px #86d5f8; +} + +/* override some bootstrap styles screwing up the timelines css */ + +.vis [class*="span"] { + min-height: 0; + width: auto; +} + +.vis.timeline { +} + + +.vis.timeline.root { + position: relative; + border: 1px solid #bfbfbf; + + overflow: hidden; + padding: 0; + margin: 0; + + box-sizing: border-box; +} + +.vis.timeline .vispanel { + position: absolute; + + padding: 0; + margin: 0; + + box-sizing: border-box; +} + +.vis.timeline .vispanel.center, +.vis.timeline .vispanel.left, +.vis.timeline .vispanel.right, +.vis.timeline .vispanel.top, +.vis.timeline .vispanel.bottom { + border: 1px #bfbfbf; +} + +.vis.timeline .vispanel.center, +.vis.timeline .vispanel.left, +.vis.timeline .vispanel.right { + border-top-style: solid; + border-bottom-style: solid; + overflow: hidden; +} + +.vis.timeline .vispanel.center, +.vis.timeline .vispanel.top, +.vis.timeline .vispanel.bottom { + border-left-style: solid; + border-right-style: solid; +} + +.vis.timeline .background { + overflow: hidden; +} + +.vis.timeline .vispanel > .content { + position: relative; +} + +.vis.timeline .vispanel .shadow { + position: absolute; + width: 100%; + height: 1px; + box-shadow: 0 0 10px rgba(0,0,0,0.8); + /* TODO: find a nice way to ensure shadows are drawn on top of items + z-index: 1; + */ +} + +.vis.timeline .vispanel .shadow.top { + top: -1px; + left: 0; +} + +.vis.timeline .vispanel .shadow.bottom { + bottom: -1px; + left: 0; +} + +.vis.timeline .labelset { + position: relative; + + overflow: hidden; + + box-sizing: border-box; +} + +.vis.timeline .labelset .vlabel { + position: relative; + left: 0; + top: 0; + width: 100%; + color: #4d4d4d; + + box-sizing: border-box; +} + +.vis.timeline .labelset .vlabel { + border-bottom: 1px solid #bfbfbf; +} + +.vis.timeline .labelset .vlabel:last-child { + border-bottom: none; +} + +.vis.timeline .labelset .vlabel .inner { + display: inline-block; + padding: 5px; +} + +.vis.timeline .labelset .vlabel .inner.hidden { + padding: 0; +} + + +.vis.timeline .itemset { + position: relative; + padding: 0; + margin: 0; + + box-sizing: border-box; +} + +.vis.timeline .itemset .background, +.vis.timeline .itemset .foreground { + position: absolute; + width: 100%; + height: 100%; + overflow: visible; +} + +.vis.timeline .axis { + position: absolute; + width: 100%; + height: 0; + left: 0; + z-index: 1; +} + +.vis.timeline .foreground .group { + position: relative; + box-sizing: border-box; + border-bottom: 1px solid #bfbfbf; +} + +.vis.timeline .foreground .group:last-child { + border-bottom: none; +} + + +.vis.timeline .item { + position: absolute; + color: #1A1A1A; + border-color: #97B0F8; + border-width: 1px; + background-color: #D5DDF6; + display: inline-block; + padding: 5px; +} + +.vis.timeline .item.selected { + border-color: #FFC200; + background-color: #FFF785; + + /* z-index must be higher than the z-index of custom time bar and current time bar */ + z-index: 2; +} + +.vis.timeline .editable .item.selected { + cursor: move; +} + +.vis.timeline .item.point.selected { + background-color: #FFF785; +} + +.vis.timeline .item.box { + text-align: center; + border-style: solid; + border-radius: 2px; +} + +.vis.timeline .item.point { + background: none; +} + +.vis.timeline .item.dot { + position: absolute; + padding: 0; + border-width: 4px; + border-style: solid; + border-radius: 4px; +} + +.vis.timeline .item.range { + border-style: solid; + border-radius: 2px; + box-sizing: border-box; +} + +.vis.timeline .item.background { + overflow: hidden; + border: none; + background-color: rgba(213, 221, 246, 0.4); + box-sizing: border-box; + padding: 0; + margin: 0; +} + +.vis.timeline .item.range .content { + position: relative; + display: inline-block; + max-width: 100%; + overflow: hidden; +} + +.vis.timeline .item.background .content { + position: absolute; + display: inline-block; + overflow: hidden; + max-width: 100%; + margin: 5px; +} + +.vis.timeline .item.line { + padding: 0; + position: absolute; + width: 0; + border-left-width: 1px; + border-left-style: solid; +} + +.vis.timeline .item .content { + white-space: nowrap; + overflow: hidden; +} + +.vis.timeline .item .delete { + background: url('dist/img/timeline/delete.png') no-repeat top center; + position: absolute; + width: 24px; + height: 24px; + top: 0; + right: -24px; + cursor: pointer; +} + +.vis.timeline .item.range .drag-left { + position: absolute; + width: 24px; + max-width: 20%; + height: 100%; + top: 0; + left: -4px; + + cursor: w-resize; +} + +.vis.timeline .item.range .drag-right { + position: absolute; + width: 24px; + max-width: 20%; + height: 100%; + top: 0; + right: -4px; + + cursor: e-resize; +} + +.vis.timeline .timeaxis { + position: relative; + overflow: hidden; +} + +.vis.timeline .timeaxis.foreground { + top: 0; + left: 0; + width: 100%; +} + +.vis.timeline .timeaxis.background { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.vis.timeline .timeaxis .text { + position: absolute; + color: #4d4d4d; + padding: 3px; + white-space: nowrap; +} + +.vis.timeline .timeaxis .text.measure { + position: absolute; + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; + visibility: hidden; +} + +.vis.timeline .timeaxis .grid.vertical { + position: absolute; + border-left: 1px solid; +} + +.vis.timeline .timeaxis .grid.minor { + border-color: #e5e5e5; +} + +.vis.timeline .timeaxis .grid.major { + border-color: #bfbfbf; +} + +.vis.timeline .currenttime { + background-color: #FF7F6E; + width: 2px; + z-index: 1; +} +.vis.timeline .customtime { + background-color: #6E94FF; + width: 2px; + cursor: move; + z-index: 1; +} +.vis.timeline.root { + /* + -webkit-transition: height .4s ease-in-out; + transition: height .4s ease-in-out; + */ +} + +.vis.timeline .vispanel { + /* + -webkit-transition: height .4s ease-in-out, top .4s ease-in-out; + transition: height .4s ease-in-out, top .4s ease-in-out; + */ +} + +.vis.timeline .axis { + /* + -webkit-transition: top .4s ease-in-out; + transition: top .4s ease-in-out; + */ +} + +/* TODO: get animation working nicely + +.vis.timeline .item { + -webkit-transition: top .4s ease-in-out; + transition: top .4s ease-in-out; +} + +.vis.timeline .item.line { + -webkit-transition: height .4s ease-in-out, top .4s ease-in-out; + transition: height .4s ease-in-out, top .4s ease-in-out; +} +/**/ + +.vis.timeline .vispanel.background.horizontal .grid.horizontal { + position: absolute; + width: 100%; + height: 0; + border-bottom: 1px solid; +} + +.vis.timeline .vispanel.background.horizontal .grid.minor { + border-color: #e5e5e5; +} + +.vis.timeline .vispanel.background.horizontal .grid.major { + border-color: #bfbfbf; +} + + +.vis.timeline .dataaxis .yAxis.major { + width: 100%; + position: absolute; + color: #4d4d4d; + white-space: nowrap; +} + +.vis.timeline .dataaxis .yAxis.major.measure{ + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; + border: 0px; + visibility: hidden; + width: auto; +} + + +.vis.timeline .dataaxis .yAxis.minor{ + position: absolute; + width: 100%; + color: #bebebe; + white-space: nowrap; +} + +.vis.timeline .dataaxis .yAxis.minor.measure{ + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; + border: 0px; + visibility: hidden; + width: auto; +} + +.vis.timeline .dataaxis .yAxis.title{ + position: absolute; + color: #4d4d4d; + white-space: nowrap; + bottom: 20px; + text-align: center; +} + +.vis.timeline .dataaxis .yAxis.title.measure{ + padding: 0px 0px 0px 0px; + margin: 0px 0px 0px 0px; + visibility: hidden; + width: auto; +} + +.vis.timeline .dataaxis .yAxis.title.left { + bottom: 0px; + -webkit-transform-origin: left top; + -moz-transform-origin: left top; + -ms-transform-origin: left top; + -o-transform-origin: left top; + transform-origin: left bottom; + -webkit-transform: rotate(-90deg); + -moz-transform: rotate(-90deg); + -ms-transform: rotate(-90deg); + -o-transform: rotate(-90deg); + transform: rotate(-90deg); +} + +.vis.timeline .dataaxis .yAxis.title.right { + bottom: 0px; + -webkit-transform-origin: right bottom; + -moz-transform-origin: right bottom; + -ms-transform-origin: right bottom; + -o-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -o-transform: rotate(90deg); + transform: rotate(90deg); +} + +.vis.timeline .legend { + background-color: rgba(247, 252, 255, 0.65); + padding: 5px; + border-color: #b3b3b3; + border-style:solid; + border-width: 1px; + box-shadow: 2px 2px 10px rgba(154, 154, 154, 0.55); +} + +.vis.timeline .legendText { + /*font-size: 10px;*/ + white-space: nowrap; + display: inline-block +} +.vis.timeline .graphGroup0 { + fill:#4f81bd; + fill-opacity:0; + stroke-width:2px; + stroke: #4f81bd; +} + +.vis.timeline .graphGroup1 { + fill:#f79646; + fill-opacity:0; + stroke-width:2px; + stroke: #f79646; +} + +.vis.timeline .graphGroup2 { + fill: #8c51cf; + fill-opacity:0; + stroke-width:2px; + stroke: #8c51cf; +} + +.vis.timeline .graphGroup3 { + fill: #75c841; + fill-opacity:0; + stroke-width:2px; + stroke: #75c841; +} + +.vis.timeline .graphGroup4 { + fill: #ff0100; + fill-opacity:0; + stroke-width:2px; + stroke: #ff0100; +} + +.vis.timeline .graphGroup5 { + fill: #37d8e6; + fill-opacity:0; + stroke-width:2px; + stroke: #37d8e6; +} + +.vis.timeline .graphGroup6 { + fill: #042662; + fill-opacity:0; + stroke-width:2px; + stroke: #042662; +} + +.vis.timeline .graphGroup7 { + fill:#00ff26; + fill-opacity:0; + stroke-width:2px; + stroke: #00ff26; +} + +.vis.timeline .graphGroup8 { + fill:#ff00ff; + fill-opacity:0; + stroke-width:2px; + stroke: #ff00ff; +} + +.vis.timeline .graphGroup9 { + fill: #8f3938; + fill-opacity:0; + stroke-width:2px; + stroke: #8f3938; +} + +.vis.timeline .fill { + fill-opacity:0.1; + stroke: none; +} + + +.vis.timeline .bar { + fill-opacity:0.5; + stroke-width:1px; +} + +.vis.timeline .point { + stroke-width:2px; + fill-opacity:1.0; +} + + +.vis.timeline .legendBackground { + stroke-width:1px; + fill-opacity:0.9; + fill: #ffffff; + stroke: #c2c2c2; +} + + +.vis.timeline .outline { + stroke-width:1px; + fill-opacity:1; + fill: #ffffff; + stroke: #e5e5e5; +} + +.vis.timeline .iconFill { + fill-opacity:0.3; + stroke: none; +} + + + +div.network-manipulationDiv { + border-width: 0; + border-bottom: 1px; + border-style:solid; + border-color: #d6d9d8; + background: #ffffff; /* Old browsers */ + background: -moz-linear-gradient(top, #ffffff 0%, #fcfcfc 48%, #fafafa 50%, #fcfcfc 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(48%,#fcfcfc), color-stop(50%,#fafafa), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* IE10+ */ + background: linear-gradient(to bottom, #ffffff 0%,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */ + + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 30px; +} + +div.network-manipulation-editMode { + position:absolute; + left: 0; + top: 15px; + height: 30px; +} + +div.network-manipulation-closeDiv { + position:absolute; + right: 0; + top: 0; + width: 30px; + height: 30px; + + background-position: 20px 3px; + background-repeat: no-repeat; + background-image: url("dist/img/network/cross.png"); + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.network-manipulation-closeDiv:hover { + opacity: 0.6; +} + +div.network-manipulationUI { + position:relative; + top:-7px; + font-family: verdana; + font-size: 12px; + -moz-border-radius: 15px; + border-radius: 15px; + display:inline-block; + background-position: 0px 0px; + background-repeat:no-repeat; + height:24px; + margin: 0px 0px 0px 10px; + vertical-align:middle; + cursor: pointer; + padding: 0px 8px 0px 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.network-manipulationUI:hover { + box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.20); +} + +div.network-manipulationUI:active { + box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.50); +} + +div.network-manipulationUI.back { + background-image: url("dist/img/network/backIcon.png"); +} + +div.network-manipulationUI.none:hover { + box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0); + cursor: default; +} +div.network-manipulationUI.none:active { + box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.0); +} +div.network-manipulationUI.none { + padding: 0; +} +div.network-manipulationUI.notification{ + margin: 2px; + font-weight: bold; +} + +div.network-manipulationUI.add { + background-image: url("dist/img/network/addNodeIcon.png"); +} + +div.network-manipulationUI.edit { + background-image: url("dist/img/network/editIcon.png"); +} + +div.network-manipulationUI.edit.editmode { + background-color: #fcfcfc; + border-style:solid; + border-width:1px; + border-color: #cccccc; +} + +div.network-manipulationUI.connect { + background-image: url("dist/img/network/connectIcon.png"); +} + +div.network-manipulationUI.delete { + background-image: url("dist/img/network/deleteIcon.png"); +} +/* top right bottom left */ +div.network-manipulationLabel { + margin: 0px 0px 0px 23px; + line-height: 25px; +} +div.network-seperatorLine { + display:inline-block; + width:1px; + height:20px; + background-color: #bdbdbd; + margin: 5px 7px 0px 15px; +} + +div.network-navigation_wrapper { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} +div.network-navigation { + width:34px; + height:34px; + -moz-border-radius: 17px; + border-radius: 17px; + position:absolute; + display:inline-block; + background-position: 2px 2px; + background-repeat:no-repeat; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.network-navigation:hover { + box-shadow: 0px 0px 3px 3px rgba(56, 207, 21, 0.30); +} + +div.network-navigation:active { + box-shadow: 0px 0px 1px 3px rgba(56, 207, 21, 0.95); +} + +div.network-navigation.up { + background-image: url("dist/img/network/upArrow.png"); + bottom:50px; + left:55px; +} +div.network-navigation.down { + background-image: url("dist/img/network/downArrow.png"); + bottom:10px; + left:55px; +} +div.network-navigation.left { + background-image: url("dist/img/network/leftArrow.png"); + bottom:10px; + left:15px; +} +div.network-navigation.right { + background-image: url("dist/img/network/rightArrow.png"); + bottom:10px; + left:95px; +} +div.network-navigation.zoomIn { + background-image: url("dist/img/network/plus.png"); + bottom:10px; + right:15px; +} +div.network-navigation.zoomOut { + background-image: url("dist/img/network/minus.png"); + bottom:10px; + right:55px; +} +div.network-navigation.zoomExtends { + background-image: url("dist/img/network/zoomExtends.png"); + bottom:50px; + right:15px; +} +div.network-tooltip { + position: absolute; + visibility: hidden; + padding: 5px; + white-space: nowrap; + + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border: 1px solid; + + box-shadow: 3px 3px 10px rgba(128, 128, 128, 0.5); +} diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.js b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.js new file mode 100644 index 000000000000..7681b1961463 --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.js @@ -0,0 +1,47300 @@ +/** + * vis-timeline and vis-graph2d + * https://visjs.github.io/vis-timeline/ + * + * Create a fully customizable, interactive timeline with items and ranges. + * + * @version 7.7.3 + * @date 2023-10-27T17:57:57.604Z + * + * @copyright (c) 2011-2017 Almende B.V, http://almende.com + * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs + * + * @license + * vis.js is dual licensed under both + * + * 1. The Apache 2.0 License + * http://www.apache.org/licenses/LICENSE-2.0 + * + * and + * + * 2. The MIT License + * http://opensource.org/licenses/MIT + * + * vis.js may be distributed under either license. + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vis = global.vis || {})); +})(this, (function (exports) { + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function commonjsRequire(path) { + throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); + } + + var moment$5 = {exports: {}}; + + var hasRequiredMoment; + + function requireMoment () { + if (hasRequiredMoment) return moment$5.exports; + hasRequiredMoment = 1; + (function (module, exports) { + (function (global, factory) { + module.exports = factory() ; + }(commonjsGlobal, (function () { + var hookCallback; + + function hooks() { + return hookCallback.apply(null, arguments); + } + + // This is done to register the method called with moment() + // without creating circular dependencies. + function setHookCallback(callback) { + hookCallback = callback; + } + + function isArray(input) { + return ( + input instanceof Array || + Object.prototype.toString.call(input) === '[object Array]' + ); + } + + function isObject(input) { + // IE8 will treat undefined and null as object if it wasn't for + // input != null + return ( + input != null && + Object.prototype.toString.call(input) === '[object Object]' + ); + } + + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } + + function isObjectEmpty(obj) { + if (Object.getOwnPropertyNames) { + return Object.getOwnPropertyNames(obj).length === 0; + } else { + var k; + for (k in obj) { + if (hasOwnProp(obj, k)) { + return false; + } + } + return true; + } + } + + function isUndefined(input) { + return input === void 0; + } + + function isNumber(input) { + return ( + typeof input === 'number' || + Object.prototype.toString.call(input) === '[object Number]' + ); + } + + function isDate(input) { + return ( + input instanceof Date || + Object.prototype.toString.call(input) === '[object Date]' + ); + } + + function map(arr, fn) { + var res = [], + i, + arrLen = arr.length; + for (i = 0; i < arrLen; ++i) { + res.push(fn(arr[i], i)); + } + return res; + } + + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } + } + + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; + } + + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } + + return a; + } + + function createUTC(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); + } + + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty: false, + unusedTokens: [], + unusedInput: [], + overflow: -2, + charsLeftOver: 0, + nullInput: false, + invalidEra: null, + invalidMonth: null, + invalidFormat: false, + userInvalidated: false, + iso: false, + parsedDateParts: [], + era: null, + meridiem: null, + rfc2822: false, + weekdayMismatch: false, + }; + } + + function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); + } + return m._pf; + } + + var some; + if (Array.prototype.some) { + some = Array.prototype.some; + } else { + some = function (fun) { + var t = Object(this), + len = t.length >>> 0, + i; + + for (i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; + } + + function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m), + parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }), + isNowValid = + !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidEra && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + + if (m._strict) { + isNowValid = + isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } else { + return isNowValid; + } + } + return m._isValid; + } + + function createInvalid(flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } else { + getParsingFlags(m).userInvalidated = true; + } + + return m; + } + + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = (hooks.momentProperties = []), + updateInProgress = false; + + function copyConfig(to, from) { + var i, + prop, + val, + momentPropertiesLen = momentProperties.length; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } + + if (momentPropertiesLen > 0) { + for (i = 0; i < momentPropertiesLen; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } + + return to; + } + + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } + + function isMoment(obj) { + return ( + obj instanceof Moment || (obj != null && obj._isAMomentObject != null) + ); + } + + function warn(msg) { + if ( + hooks.suppressDeprecationWarnings === false && + typeof console !== 'undefined' && + console.warn + ) { + console.warn('Deprecation warning: ' + msg); + } + } + + function deprecate(msg, fn) { + var firstTime = true; + + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = [], + arg, + i, + key, + argLen = arguments.length; + for (i = 0; i < argLen; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (key in arguments[0]) { + if (hasOwnProp(arguments[0], key)) { + arg += key + ': ' + arguments[0][key] + ', '; + } + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn( + msg + + '\nArguments: ' + + Array.prototype.slice.call(args).join('') + + '\n' + + new Error().stack + ); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } + + var deprecations = {}; + + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } + + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; + + function isFunction(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } + + function set(config) { + var prop, i; + for (i in config) { + if (hasOwnProp(config, i)) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + + /\d{1,2}/.source + ); + } + + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), + prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if ( + hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop]) + ) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; + } + + function Locale(config) { + if (config != null) { + this.set(config); + } + } + + var keys; + + if (Object.keys) { + keys = Object.keys; + } else { + keys = function (obj) { + var i, + res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; + } + + var defaultCalendar = { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }; + + function calendar(key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } + + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return ( + (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + + absNumber + ); + } + + var formattingTokens = + /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + formatFunctions = {}, + formatTokenFunctions = {}; + + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken(token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal( + func.apply(this, arguments), + token + ); + }; + } + } + + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } + + function makeFormatFunction(format) { + var array = format.match(formattingTokens), + i, + length; + + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } + + return function (mom) { + var output = '', + i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) + ? array[i].call(mom, format) + : array[i]; + } + return output; + }; + } + + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } + + format = expandFormat(format, m.localeData()); + formatFunctions[format] = + formatFunctions[format] || makeFormatFunction(format); + + return formatFunctions[format](m); + } + + function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace( + localFormattingTokens, + replaceLongDateFormatTokens + ); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; + } + + var defaultLongDateFormat = { + LTS: 'h:mm:ss A', + LT: 'h:mm A', + L: 'MM/DD/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }; + + function longDateFormat(key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper + .match(formattingTokens) + .map(function (tok) { + if ( + tok === 'MMMM' || + tok === 'MM' || + tok === 'DD' || + tok === 'dddd' + ) { + return tok.slice(1); + } + return tok; + }) + .join(''); + + return this._longDateFormat[key]; + } + + var defaultInvalidDate = 'Invalid date'; + + function invalidDate() { + return this._invalidDate; + } + + var defaultOrdinal = '%d', + defaultDayOfMonthOrdinalParse = /\d{1,2}/; + + function ordinal(number) { + return this._ordinal.replace('%d', number); + } + + var defaultRelativeTime = { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + w: 'a week', + ww: '%d weeks', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }; + + function relativeTime(number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return isFunction(output) + ? output(number, withoutSuffix, string, isFuture) + : output.replace(/%d/i, number); + } + + function pastFuture(diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); + } + + var aliases = {}; + + function addUnitAlias(unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; + } + + function normalizeUnits(units) { + return typeof units === 'string' + ? aliases[units] || aliases[units.toLowerCase()] + : undefined; + } + + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; + + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } + + return normalizedInput; + } + + var priorities = {}; + + function addUnitPriority(unit, priority) { + priorities[unit] = priority; + } + + function getPrioritizedUnits(unitsObj) { + var units = [], + u; + for (u in unitsObj) { + if (hasOwnProp(unitsObj, u)) { + units.push({ unit: u, priority: priorities[u] }); + } + } + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; + } + + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; + } + + function absFloor(number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } + } + + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; + + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } + + return value; + } + + function makeGetSet(unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; + } + + function get(mom, unit) { + return mom.isValid() + ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() + : NaN; + } + + function set$1(mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if ( + unit === 'FullYear' && + isLeapYear(mom.year()) && + mom.month() === 1 && + mom.date() === 29 + ) { + value = toInt(value); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( + value, + mom.month(), + daysInMonth(value, mom.month()) + ); + } else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } + } + + // MOMENTS + + function stringGet(units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; + } + + function stringSet(units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units), + i, + prioritizedLen = prioritized.length; + for (i = 0; i < prioritizedLen; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; + } + + var match1 = /\d/, // 0 - 9 + match2 = /\d\d/, // 00 - 99 + match3 = /\d{3}/, // 000 - 999 + match4 = /\d{4}/, // 0000 - 9999 + match6 = /[+-]?\d{6}/, // -999999 - 999999 + match1to2 = /\d\d?/, // 0 - 99 + match3to4 = /\d\d\d\d?/, // 999 - 9999 + match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 + match1to3 = /\d{1,3}/, // 0 - 999 + match1to4 = /\d{1,4}/, // 0 - 9999 + match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 + matchUnsigned = /\d+/, // 0 - inf + matchSigned = /[+-]?\d+/, // -inf - inf + matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z + matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z + matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + matchWord = + /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + regexes; + + regexes = {}; + + function addRegexToken(token, regex, strictRegex) { + regexes[token] = isFunction(regex) + ? regex + : function (isStrict, localeData) { + return isStrict && strictRegex ? strictRegex : regex; + }; + } + + function getParseRegexForToken(token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } + + return regexes[token](config._strict, config._locale); + } + + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape( + s + .replace('\\', '') + .replace( + /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, + function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + } + ) + ); + } + + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + + var tokens = {}; + + function addParseToken(token, callback) { + var i, + func = callback, + tokenLen; + if (typeof token === 'string') { + token = [token]; + } + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + tokenLen = token.length; + for (i = 0; i < tokenLen; i++) { + tokens[token[i]] = func; + } + } + + function addWeekParseToken(token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); + } + + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } + } + + var YEAR = 0, + MONTH = 1, + DATE = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECOND = 6, + WEEK = 7, + WEEKDAY = 8; + + function mod(n, x) { + return ((n % x) + x) % x; + } + + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + return -1; + }; + } + + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 + ? isLeapYear(year) + ? 29 + : 28 + : 31 - ((modMonth % 7) % 2); + } + + // FORMATTING + + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // ALIASES + + addUnitAlias('month', 'M'); + + // PRIORITY + + addUnitPriority('month', 8); + + // PARSING + + addRegexToken('M', match1to2); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } + }); + + // LOCALES + + var defaultLocaleMonths = + 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + defaultLocaleMonthsShort = + 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + defaultMonthsShortRegex = matchWord, + defaultMonthsRegex = matchWord; + + function localeMonths(m, format) { + if (!m) { + return isArray(this._months) + ? this._months + : this._months['standalone']; + } + return isArray(this._months) + ? this._months[m.month()] + : this._months[ + (this._months.isFormat || MONTHS_IN_FORMAT).test(format) + ? 'format' + : 'standalone' + ][m.month()]; + } + + function localeMonthsShort(m, format) { + if (!m) { + return isArray(this._monthsShort) + ? this._monthsShort + : this._monthsShort['standalone']; + } + return isArray(this._monthsShort) + ? this._monthsShort[m.month()] + : this._monthsShort[ + MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' + ][m.month()]; + } + + function handleStrictParse(monthName, format, strict) { + var i, + ii, + mom, + llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort( + mom, + '' + ).toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeMonthsParse(monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp( + '^' + this.months(mom, '').replace('.', '') + '$', + 'i' + ); + this._shortMonthsParse[i] = new RegExp( + '^' + this.monthsShort(mom, '').replace('.', '') + '$', + 'i' + ); + } + if (!strict && !this._monthsParse[i]) { + regex = + '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'MMMM' && + this._longMonthsParse[i].test(monthName) + ) { + return i; + } else if ( + strict && + format === 'MMM' && + this._shortMonthsParse[i].test(monthName) + ) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } + } + + // MOMENTS + + function setMonth(mom, value) { + var dayOfMonth; + + if (!mom.isValid()) { + // No op + return mom; + } + + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } + } + } + + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; + } + + function getSetMonth(value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } + } + + function getDaysInMonth() { + return daysInMonth(this.year(), this.month()); + } + + function monthsShortRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + return this._monthsShortStrictRegex && isStrict + ? this._monthsShortStrictRegex + : this._monthsShortRegex; + } + } + + function monthsRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + return this._monthsStrictRegex && isStrict + ? this._monthsStrictRegex + : this._monthsRegex; + } + } + + function computeMonthsParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._monthsShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? zeroFill(y, 4) : '+' + y; + }); + + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); + + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + + // ALIASES + + addUnitAlias('year', 'y'); + + // PRIORITIES + + addUnitPriority('year', 1); + + // PARSING + + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); + + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = + input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); + + // HELPERS + + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + + // HOOKS + + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; + + // MOMENTS + + var getSetYear = makeGetSet('FullYear', true); + + function getIsLeapYear() { + return isLeapYear(this.year()); + } + + function createDate(y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date; + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); + } + + return date; + } + + function createUTCDate(y) { + var date, args; + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); + } + + return date; + } + + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; + } + + // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, + resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } + + return { + year: resYear, + dayOfYear: resDayOfYear, + }; + } + + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, + resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } + + return { + week: resWeek, + year: resYear, + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } + + // FORMATTING + + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + + // ALIASES + + addUnitAlias('week', 'w'); + addUnitAlias('isoWeek', 'W'); + + // PRIORITIES + + addUnitPriority('week', 5); + addUnitPriority('isoWeek', 5); + + // PARSING + + addRegexToken('w', match1to2); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2); + addRegexToken('WW', match1to2, match2); + + addWeekParseToken( + ['w', 'ww', 'W', 'WW'], + function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); + } + ); + + // HELPERS + + // LOCALES + + function localeWeek(mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } + + var defaultLocaleWeek = { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. + }; + + function localeFirstDayOfWeek() { + return this._week.dow; + } + + function localeFirstDayOfYear() { + return this._week.doy; + } + + // MOMENTS + + function getSetWeek(input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + function getSetISOWeek(input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } + + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); + }); + + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); + + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); + + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); + + // ALIASES + + addUnitAlias('day', 'd'); + addUnitAlias('weekday', 'e'); + addUnitAlias('isoWeekday', 'E'); + + // PRIORITY + addUnitPriority('day', 11); + addUnitPriority('weekday', 11); + addUnitPriority('isoWeekday', 11); + + // PARSING + + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); + + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); + + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); + }); + + // HELPERS + + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } + + if (!isNaN(input)) { + return parseInt(input, 10); + } + + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } + + return null; + } + + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; + } + + // LOCALES + function shiftWeekdays(ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } + + var defaultLocaleWeekdays = + 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + defaultWeekdaysRegex = matchWord, + defaultWeekdaysShortRegex = matchWord, + defaultWeekdaysMinRegex = matchWord; + + function localeWeekdays(m, format) { + var weekdays = isArray(this._weekdays) + ? this._weekdays + : this._weekdays[ + m && m !== true && this._weekdays.isFormat.test(format) + ? 'format' + : 'standalone' + ]; + return m === true + ? shiftWeekdays(weekdays, this._week.dow) + : m + ? weekdays[m.day()] + : weekdays; + } + + function localeWeekdaysShort(m) { + return m === true + ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : m + ? this._weekdaysShort[m.day()] + : this._weekdaysShort; + } + + function localeWeekdaysMin(m) { + return m === true + ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : m + ? this._weekdaysMin[m.day()] + : this._weekdaysMin; + } + + function handleStrictParse$1(weekdayName, format, strict) { + var i, + ii, + mom, + llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin( + mom, + '' + ).toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort( + mom, + '' + ).toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } + + function localeWeekdaysParse(weekdayName, format, strict) { + var i, mom, regex; + + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } + + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } + + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp( + '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._shortWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._minWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + } + if (!this._weekdaysParse[i]) { + regex = + '^' + + this.weekdays(mom, '') + + '|^' + + this.weekdaysShort(mom, '') + + '|^' + + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'dddd' && + this._fullWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'ddd' && + this._shortWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'dd' && + this._minWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } + + // MOMENTS + + function getSetDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } + } + + function getSetLocaleDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); + } + + function getSetISODayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. + + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } + } + + function weekdaysRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + return this._weekdaysStrictRegex && isStrict + ? this._weekdaysStrictRegex + : this._weekdaysRegex; + } + } + + function weekdaysShortRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + return this._weekdaysShortStrictRegex && isStrict + ? this._weekdaysShortStrictRegex + : this._weekdaysShortRegex; + } + } + + function weekdaysMinRegex(isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + return this._weekdaysMinStrictRegex && isStrict + ? this._weekdaysMinStrictRegex + : this._weekdaysMinRegex; + } + } + + function computeWeekdaysParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], + shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom, + minp, + shortp, + longp; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = regexEscape(this.weekdaysMin(mom, '')); + shortp = regexEscape(this.weekdaysShort(mom, '')); + longp = regexEscape(this.weekdays(mom, '')); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } + // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + + this._weekdaysStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._weekdaysShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); + this._weekdaysMinStrictRegex = new RegExp( + '^(' + minPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + function hFormat() { + return this.hours() % 12 || 12; + } + + function kFormat() { + return this.hours() || 24; + } + + addFormatToken('H', ['HH', 2], 0, 'hour'); + addFormatToken('h', ['hh', 2], 0, hFormat); + addFormatToken('k', ['kk', 2], 0, kFormat); + + addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); + }); + + addFormatToken('hmmss', 0, 0, function () { + return ( + '' + + hFormat.apply(this) + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); + }); + + addFormatToken('Hmmss', 0, 0, function () { + return ( + '' + + this.hours() + + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2) + ); + }); + + function meridiem(token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem( + this.hours(), + this.minutes(), + lowercase + ); + }); + } + + meridiem('a', true); + meridiem('A', false); + + // ALIASES + + addUnitAlias('hour', 'h'); + + // PRIORITY + addUnitPriority('hour', 13); + + // PARSING + + function matchMeridiem(isStrict, locale) { + return locale._meridiemParse; + } + + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2); + addRegexToken('h', match1to2); + addRegexToken('k', match1to2); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); + + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); + + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); + + // LOCALES + + function localeIsPM(input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return (input + '').toLowerCase().charAt(0) === 'p'; + } + + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + getSetHour = makeGetSet('Hours', true); + + function localeMeridiem(hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } + } + + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + + week: defaultLocaleWeek, + + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + + meridiemParse: defaultLocaleMeridiemParse, + }; + + // internal storage for locale config files + var locales = {}, + localeFamilies = {}, + globalLocale; + + function commonPrefix(arr1, arr2) { + var i, + minl = Math.min(arr1.length, arr2.length); + for (i = 0; i < minl; i += 1) { + if (arr1[i] !== arr2[i]) { + return i; + } + } + return minl; + } + + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; + } + + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, + j, + next, + locale, + split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if ( + next && + next.length >= j && + commonPrefix(split, next) >= j - 1 + ) { + //the next array item is better than a shallower substring of this one + break; + } + j--; + } + i++; + } + return globalLocale; + } + + function isLocaleNameSane(name) { + // Prevent names that look like filesystem paths, i.e contain '/' or '\' + return name.match('^[^/\\\\]*$') != null; + } + + function loadLocale(name) { + var oldLocale = null, + aliasedRequire; + // TODO: Find a better way to register and load all the locales in Node + if ( + locales[name] === undefined && + 'object' !== 'undefined' && + module && + module.exports && + isLocaleNameSane(name) + ) { + try { + oldLocale = globalLocale._abbr; + aliasedRequire = commonjsRequire; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) { + // mark as not found to avoid repeating expensive file require call causing high CPU + // when trying to find en-US, en_US, en-us for every format call + locales[name] = null; // null means not found + } + } + return locales[name]; + } + + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function getSetGlobalLocale(key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } else { + data = defineLocale(key, values); + } + + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } else { + if (typeof console !== 'undefined' && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn( + 'Locale ' + key + ' not found. Did you forget to load it?' + ); + } + } + } + + return globalLocale._abbr; + } + + function defineLocale(name, config) { + if (config !== null) { + var locale, + parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple( + 'defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' + ); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config, + }); + return null; + } + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); + + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } + + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } + } + + function updateLocale(name, config) { + if (config != null) { + var locale, + tmpLocale, + parentConfig = baseConfig; + + if (locales[name] != null && locales[name].parentLocale != null) { + // Update existing child locale in-place to avoid memory-leaks + locales[name].set(mergeConfigs(locales[name]._config, config)); + } else { + // MERGE + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; + } + config = mergeConfigs(parentConfig, config); + if (tmpLocale == null) { + // updateLocale is called for creating a new locale + // Set abbr so it will have a name (getters return + // undefined otherwise). + config.abbr = name; + } + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + } + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); + } + } else if (locales[name] != null) { + delete locales[name]; + } + } + } + return locales[name]; + } + + // returns locale data + function getLocale(key) { + var locale; + + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } + + if (!key) { + return globalLocale; + } + + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } + + return chooseLocale(key); + } + + function listLocales() { + return keys(locales); + } + + function checkOverflow(m) { + var overflow, + a = m._a; + + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 + ? MONTH + : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) + ? DATE + : a[HOUR] < 0 || + a[HOUR] > 24 || + (a[HOUR] === 24 && + (a[MINUTE] !== 0 || + a[SECOND] !== 0 || + a[MILLISECOND] !== 0)) + ? HOUR + : a[MINUTE] < 0 || a[MINUTE] > 59 + ? MINUTE + : a[SECOND] < 0 || a[SECOND] > 59 + ? SECOND + : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 + ? MILLISECOND + : -1; + + if ( + getParsingFlags(m)._overflowDayOfYear && + (overflow < YEAR || overflow > DATE) + ) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } + + getParsingFlags(m).overflow = overflow; + } + + return m; + } + + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = + /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + basicIsoRegex = + /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, + isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/], + ['YYYYMM', /\d{6}/, false], + ['YYYY', /\d{4}/, false], + ], + // iso time formats and regexes + isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/], + ], + aspNetJsonRegex = /^\/?Date\((-?\d+)/i, + // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + rfc2822 = + /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, + obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60, + }; + + // date from iso format + function configFromISO(config) { + var i, + l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, + dateFormat, + timeFormat, + tzFormat, + isoDatesLen = isoDates.length, + isoTimesLen = isoTimes.length; + + if (match) { + getParsingFlags(config).iso = true; + for (i = 0, l = isoDatesLen; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimesLen; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } + } + + function extractFromRFC2822Strings( + yearStr, + monthStr, + dayStr, + hourStr, + minuteStr, + secondStr + ) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10), + ]; + + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } + + return result; + } + + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s + .replace(/\([^()]*\)|[\n\t]/g, ' ') + .replace(/(\s\s+)/g, ' ') + .replace(/^\s\s*/, '') + .replace(/\s\s*$/, ''); + } + + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date( + parsedInput[0], + parsedInput[1], + parsedInput[2] + ).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; + } + + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10), + m = hm % 100, + h = (hm - m) / 100; + return h * 60 + m; + } + } + + // date and time from ref 2822 format + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)), + parsedArray; + if (match) { + parsedArray = extractFromRFC2822Strings( + match[4], + match[3], + match[2], + match[5], + match[6], + match[7] + ); + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } + + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } + } + + // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } + + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } + + if (config._strict) { + config._isValid = false; + } else { + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); + } + } + + hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } + ); + + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; + } + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [ + nowValue.getUTCFullYear(), + nowValue.getUTCMonth(), + nowValue.getUTCDate(), + ]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; + } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray(config) { + var i, + date, + input = [], + currentDate, + expectedWeekday, + yearToUse; + + if (config._d) { + return; + } + + currentDate = currentDateArray(config); + + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } + + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if ( + config._dayOfYear > daysInYear(yearToUse) || + config._dayOfYear === 0 + ) { + getParsingFlags(config)._overflowDayOfYear = true; + } + + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } + + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } + + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = + config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; + } + + // Check for 24:00:00.000 + if ( + config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0 + ) { + config._nextDay = true; + config._a[HOUR] = 0; + } + + config._d = (config._useUTC ? createUTCDate : createDate).apply( + null, + input + ); + expectedWeekday = config._useUTC + ? config._d.getUTCDay() + : config._d.getDay(); + + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } + + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if ( + config._w && + typeof config._w.d !== 'undefined' && + config._w.d !== expectedWeekday + ) { + getParsingFlags(config).weekdayMismatch = true; + } + } + + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; + + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults( + w.GG, + config._a[YEAR], + weekOfYear(createLocal(), 1, 4).year + ); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; + + curWeek = weekOfYear(createLocal(), dow, doy); + + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); + + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; + } + } else if (w.e != null) { + // local weekday -- counting starts from beginning of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to beginning of week + weekday = dow; + } + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } + } + + // constant that refers to the ISO standard + hooks.ISO_8601 = function () {}; + + // constant that refers to the RFC 2822 form + hooks.RFC_2822 = function () {}; + + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + config._a = []; + getParsingFlags(config).empty = true; + + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, + parsedInput, + tokens, + token, + skipped, + stringLength = string.length, + totalParsedInputLength = 0, + era, + tokenLen; + + tokens = + expandFormat(config._f, config._locale).match(formattingTokens) || []; + tokenLen = tokens.length; + for (i = 0; i < tokenLen; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || + [])[0]; + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice( + string.indexOf(parsedInput) + parsedInput.length + ); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); + } + } + + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = + stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } + + // clear _12h flag if hour is <= 12 + if ( + config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0 + ) { + getParsingFlags(config).bigHour = undefined; + } + + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap( + config._locale, + config._a[HOUR], + config._meridiem + ); + + // handle era + era = getParsingFlags(config).era; + if (era !== null) { + config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); + } + + configFromArray(config); + checkOverflow(config); + } + + function meridiemFixWrap(locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; + } + } + + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + scoreToBeat, + i, + currentScore, + validFormatFound, + bestFormatIsValid = false, + configfLen = config._f.length; + + if (configfLen === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < configfLen; i++) { + currentScore = 0; + validFormatFound = false; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (isValid(tempConfig)) { + validFormatFound = true; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (!bestFormatIsValid) { + if ( + scoreToBeat == null || + currentScore < scoreToBeat || + validFormatFound + ) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + if (validFormatFound) { + bestFormatIsValid = true; + } + } + } else { + if (currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } + } + } + + extend(config, bestMoment || tempConfig); + } + + function configFromObject(config) { + if (config._d) { + return; + } + + var i = normalizeObjectUnits(config._i), + dayOrDate = i.day === undefined ? i.date : i.day; + config._a = map( + [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], + function (obj) { + return obj && parseInt(obj, 10); + } + ); + + configFromArray(config); + } + + function createFromConfig(config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; + } + + function prepareConfig(config) { + var input = config._i, + format = config._f; + + config._locale = config._locale || getLocale(config._l); + + if (input === null || (format === undefined && input === '')) { + return createInvalid({ nullInput: true }); + } + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; + } + + return config; + } + + function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } + } + + function createLocalOrUTC(input, format, locale, strict, isUTC) { + var c = {}; + + if (format === true || format === false) { + strict = format; + format = undefined; + } + + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } + + if ( + (isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0) + ) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; + + return createFromConfig(c); + } + + function createLocal(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); + } + + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + } + ), + prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; + } + + // TODO: Use [].sort instead? + function min() { + var args = [].slice.call(arguments, 0); + + return pickBy('isBefore', args); + } + + function max() { + var args = [].slice.call(arguments, 0); + + return pickBy('isAfter', args); + } + + var now = function () { + return Date.now ? Date.now() : +new Date(); + }; + + var ordering = [ + 'year', + 'quarter', + 'month', + 'week', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + ]; + + function isDurationValid(m) { + var key, + unitHasDecimal = false, + i, + orderLen = ordering.length; + for (key in m) { + if ( + hasOwnProp(m, key) && + !( + indexOf.call(ordering, key) !== -1 && + (m[key] == null || !isNaN(m[key])) + ) + ) { + return false; + } + } + + for (i = 0; i < orderLen; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } + + return true; + } + + function isValid$1() { + return this._isValid; + } + + function createInvalid$1() { + return createDuration(NaN); + } + + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || normalizedInput.isoWeek || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + this._isValid = isDurationValid(normalizedInput); + + // representation for dateAddRemove + this._milliseconds = + +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + quarters * 3 + years * 12; + + this._data = {}; + + this._locale = getLocale(); + + this._bubble(); + } + + function isDuration(obj) { + return obj instanceof Duration; + } + + function absRound(number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } + } + + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ( + (dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) + ) { + diffs++; + } + } + return diffs + lengthDiff; + } + + // FORMATTING + + function offset(token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(), + sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return ( + sign + + zeroFill(~~(offset / 60), 2) + + separator + + zeroFill(~~offset % 60, 2) + ); + }); + } + + offset('Z', ':'); + offset('ZZ', ''); + + // PARSING + + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); + + // HELPERS + + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; + + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher), + chunk, + parts, + minutes; + + if (matches === null) { + return null; + } + + chunk = matches[matches.length - 1] || []; + parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + minutes = +(parts[1] * 60) + toInt(parts[2]); + + return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; + } + + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = + (isMoment(input) || isDate(input) + ? input.valueOf() + : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } + } + + function getDateOffset(m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset()); + } + + // HOOKS + + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + hooks.updateOffset = function () {}; + + // MOMENTS + + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset(input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract( + this, + createDuration(input - offset, 'm'), + 1, + false + ); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } + } + + function getSetZone(input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } + + this.utcOffset(input, keepLocalTime); + + return this; + } else { + return -this.utcOffset(); + } + } + + function setOffsetToUTC(keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal(keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } + } + return this; + } + + function setOffsetToParsedOffset() { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } else { + this.utcOffset(0, true); + } + } + return this; + } + + function hasAlignedHourOffset(input) { + if (!this.isValid()) { + return false; + } + input = input ? createLocal(input).utcOffset() : 0; + + return (this.utcOffset() - input) % 60 === 0; + } + + function isDaylightSavingTime() { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } + + function isDaylightSavingTimeShifted() { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } + + var c = {}, + other; + + copyConfig(c, this); + c = prepareConfig(c); + + if (c._a) { + other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = + this.isValid() && compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } + + return this._isDSTShifted; + } + + function isLocal() { + return this.isValid() ? !this._isUTC : false; + } + + function isUtcOffset() { + return this.isValid() ? this._isUTC : false; + } + + function isUtc() { + return this.isValid() ? this._isUTC && this._offset === 0 : false; + } + + // ASP.NET json date format regex + var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + isoRegex = + /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + + function createDuration(input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months, + }; + } else if (isNumber(input) || !isNaN(+input)) { + duration = {}; + if (key) { + duration[key] = +input; + } else { + duration.milliseconds = +input; + } + } else if ((match = aspNetRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match + }; + } else if ((match = isoRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: parseIso(match[2], sign), + M: parseIso(match[3], sign), + w: parseIso(match[4], sign), + d: parseIso(match[5], sign), + h: parseIso(match[6], sign), + m: parseIso(match[7], sign), + s: parseIso(match[8], sign), + }; + } else if (duration == null) { + // checks for null or undefined + duration = {}; + } else if ( + typeof duration === 'object' && + ('from' in duration || 'to' in duration) + ) { + diffRes = momentsDifference( + createLocal(duration.from), + createLocal(duration.to) + ); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + if (isDuration(input) && hasOwnProp(input, '_isValid')) { + ret._isValid = input._isValid; + } + + return ret; + } + + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso(inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; + } + + function positiveMomentsDifference(base, other) { + var res = {}; + + res.months = + other.month() - base.month() + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + + res.milliseconds = +other - +base.clone().add(res.months, 'M'); + + return res; + } + + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return { milliseconds: 0, months: 0 }; + } + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; + } + + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple( + name, + 'moment().' + + name + + '(period, number) is deprecated. Please use moment().' + + name + + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' + ); + tmp = val; + val = period; + period = tmp; + } + + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } + + function addSubtract(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); + + if (!mom.isValid()) { + // No op + return; + } + + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } + } + + var add = createAdder(1, 'add'), + subtract = createAdder(-1, 'subtract'); + + function isString(input) { + return typeof input === 'string' || input instanceof String; + } + + // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined + function isMomentInput(input) { + return ( + isMoment(input) || + isDate(input) || + isString(input) || + isNumber(input) || + isNumberOrStringArray(input) || + isMomentInputObject(input) || + input === null || + input === undefined + ); + } + + function isMomentInputObject(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'years', + 'year', + 'y', + 'months', + 'month', + 'M', + 'days', + 'day', + 'd', + 'dates', + 'date', + 'D', + 'hours', + 'hour', + 'h', + 'minutes', + 'minute', + 'm', + 'seconds', + 'second', + 's', + 'milliseconds', + 'millisecond', + 'ms', + ], + i, + property, + propertyLen = properties.length; + + for (i = 0; i < propertyLen; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function isNumberOrStringArray(input) { + var arrayTest = isArray(input), + dataTypeTest = false; + if (arrayTest) { + dataTypeTest = + input.filter(function (item) { + return !isNumber(item) && isString(input); + }).length === 0; + } + return arrayTest && dataTypeTest; + } + + function isCalendarSpec(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'sameDay', + 'nextDay', + 'lastDay', + 'nextWeek', + 'lastWeek', + 'sameElse', + ], + i, + property; + + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } + + return objectTest && propertyTest; + } + + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 + ? 'sameElse' + : diff < -1 + ? 'lastWeek' + : diff < 0 + ? 'lastDay' + : diff < 1 + ? 'sameDay' + : diff < 2 + ? 'nextDay' + : diff < 7 + ? 'nextWeek' + : 'sameElse'; + } + + function calendar$1(time, formats) { + // Support for single parameter, formats only overload to the calendar function + if (arguments.length === 1) { + if (!arguments[0]) { + time = undefined; + formats = undefined; + } else if (isMomentInput(arguments[0])) { + time = arguments[0]; + formats = undefined; + } else if (isCalendarSpec(arguments[0])) { + formats = arguments[0]; + time = undefined; + } + } + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse', + output = + formats && + (isFunction(formats[format]) + ? formats[format].call(this, now) + : formats[format]); + + return this.format( + output || this.localeData().calendar(format, this, createLocal(now)) + ); + } + + function clone() { + return new Moment(this); + } + + function isAfter(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } + } + + function isBefore(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } + } + + function isBetween(from, to, units, inclusivity) { + var localFrom = isMoment(from) ? from : createLocal(from), + localTo = isMoment(to) ? to : createLocal(to); + if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { + return false; + } + inclusivity = inclusivity || '()'; + return ( + (inclusivity[0] === '(' + ? this.isAfter(localFrom, units) + : !this.isBefore(localFrom, units)) && + (inclusivity[1] === ')' + ? this.isBefore(localTo, units) + : !this.isAfter(localTo, units)) + ); + } + + function isSame(input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return ( + this.clone().startOf(units).valueOf() <= inputMs && + inputMs <= this.clone().endOf(units).valueOf() + ); + } + } + + function isSameOrAfter(input, units) { + return this.isSame(input, units) || this.isAfter(input, units); + } + + function isSameOrBefore(input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } + + function diff(input, units, asFloat) { + var that, zoneDelta, output; + + if (!this.isValid()) { + return NaN; + } + + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; + } + + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; + + units = normalizeUnits(units); + + switch (units) { + case 'year': + output = monthDiff(this, that) / 12; + break; + case 'month': + output = monthDiff(this, that); + break; + case 'quarter': + output = monthDiff(this, that) / 3; + break; + case 'second': + output = (this - that) / 1e3; + break; // 1000 + case 'minute': + output = (this - that) / 6e4; + break; // 1000 * 60 + case 'hour': + output = (this - that) / 36e5; + break; // 1000 * 60 * 60 + case 'day': + output = (this - that - zoneDelta) / 864e5; + break; // 1000 * 60 * 60 * 24, negate dst + case 'week': + output = (this - that - zoneDelta) / 6048e5; + break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: + output = this - that; + } + + return asFloat ? output : absFloor(output); + } + + function monthDiff(a, b) { + if (a.date() < b.date()) { + // end-of-month calculations work correct when the start month has more + // days than the end month. + return -monthDiff(b, a); + } + // difference in months + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, + adjust; + + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; + } + + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + + function toString() { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } + + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + var utc = keepOffset !== true, + m = utc ? this.clone().utc() : this; + if (m.year() < 0 || m.year() > 9999) { + return formatMoment( + m, + utc + ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' + : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) + .toISOString() + .replace('Z', formatMoment(m, 'Z')); + } + } + return formatMoment( + m, + utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + function inspect() { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + var func = 'moment', + zone = '', + prefix, + year, + datetime, + suffix; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + prefix = '[' + func + '("]'; + year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; + datetime = '-MM-DD[T]HH:mm:ss.SSS'; + suffix = zone + '[")]'; + + return this.format(prefix + year + datetime + suffix); + } + + function format(inputString) { + if (!inputString) { + inputString = this.isUtc() + ? hooks.defaultFormatUtc + : hooks.defaultFormat; + } + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); + } + + function from(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ to: this, from: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function fromNow(withoutSuffix) { + return this.from(createLocal(), withoutSuffix); + } + + function to(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ from: this, to: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } + } + + function toNow(withoutSuffix) { + return this.to(createLocal(), withoutSuffix); + } + + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale(key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; + } + } + + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); + + function localeData() { + return this._locale; + } + + var MS_PER_SECOND = 1000, + MS_PER_MINUTE = 60 * MS_PER_SECOND, + MS_PER_HOUR = 60 * MS_PER_MINUTE, + MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor; + } + + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } + } + + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } + } + + function startOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year(), 0, 1); + break; + case 'quarter': + time = startOfDate( + this.year(), + this.month() - (this.month() % 3), + 1 + ); + break; + case 'month': + time = startOfDate(this.year(), this.month(), 1); + break; + case 'week': + time = startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + ); + break; + case 'isoWeek': + time = startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + ); + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date()); + break; + case 'hour': + time = this._d.valueOf(); + time -= mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ); + break; + case 'minute': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; + case 'second': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function endOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } + + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = + startOfDate( + this.year(), + this.month() - (this.month() % 3) + 3, + 1 + ) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = + startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + 7 + ) - 1; + break; + case 'isoWeek': + time = + startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + 7 + ) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += + MS_PER_HOUR - + mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ) - + 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; + } + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; + } + + function valueOf() { + return this._d.valueOf() - (this._offset || 0) * 60000; + } + + function unix() { + return Math.floor(this.valueOf() / 1000); + } + + function toDate() { + return new Date(this.valueOf()); + } + + function toArray() { + var m = this; + return [ + m.year(), + m.month(), + m.date(), + m.hour(), + m.minute(), + m.second(), + m.millisecond(), + ]; + } + + function toObject() { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds(), + }; + } + + function toJSON() { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } + + function isValid$2() { + return isValid(this); + } + + function parsingFlags() { + return extend({}, getParsingFlags(this)); + } + + function invalidAt() { + return getParsingFlags(this).overflow; + } + + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict, + }; + } + + addFormatToken('N', 0, 0, 'eraAbbr'); + addFormatToken('NN', 0, 0, 'eraAbbr'); + addFormatToken('NNN', 0, 0, 'eraAbbr'); + addFormatToken('NNNN', 0, 0, 'eraName'); + addFormatToken('NNNNN', 0, 0, 'eraNarrow'); + + addFormatToken('y', ['y', 1], 'yo', 'eraYear'); + addFormatToken('y', ['yy', 2], 0, 'eraYear'); + addFormatToken('y', ['yyy', 3], 0, 'eraYear'); + addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); + + addRegexToken('N', matchEraAbbr); + addRegexToken('NN', matchEraAbbr); + addRegexToken('NNN', matchEraAbbr); + addRegexToken('NNNN', matchEraName); + addRegexToken('NNNNN', matchEraNarrow); + + addParseToken( + ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], + function (input, array, config, token) { + var era = config._locale.erasParse(input, token, config._strict); + if (era) { + getParsingFlags(config).era = era; + } else { + getParsingFlags(config).invalidEra = input; + } + } + ); + + addRegexToken('y', matchUnsigned); + addRegexToken('yy', matchUnsigned); + addRegexToken('yyy', matchUnsigned); + addRegexToken('yyyy', matchUnsigned); + addRegexToken('yo', matchEraYearOrdinal); + + addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); + addParseToken(['yo'], function (input, array, config, token) { + var match; + if (config._locale._eraYearOrdinalRegex) { + match = input.match(config._locale._eraYearOrdinalRegex); + } + + if (config._locale.eraYearOrdinalParse) { + array[YEAR] = config._locale.eraYearOrdinalParse(input, match); + } else { + array[YEAR] = parseInt(input, 10); + } + }); + + function localeEras(m, format) { + var i, + l, + date, + eras = this._eras || getLocale('en')._eras; + for (i = 0, l = eras.length; i < l; ++i) { + switch (typeof eras[i].since) { + case 'string': + // truncate time + date = hooks(eras[i].since).startOf('day'); + eras[i].since = date.valueOf(); + break; + } + + switch (typeof eras[i].until) { + case 'undefined': + eras[i].until = +Infinity; + break; + case 'string': + // truncate time + date = hooks(eras[i].until).startOf('day').valueOf(); + eras[i].until = date.valueOf(); + break; + } + } + return eras; + } + + function localeErasParse(eraName, format, strict) { + var i, + l, + eras = this.eras(), + name, + abbr, + narrow; + eraName = eraName.toUpperCase(); + + for (i = 0, l = eras.length; i < l; ++i) { + name = eras[i].name.toUpperCase(); + abbr = eras[i].abbr.toUpperCase(); + narrow = eras[i].narrow.toUpperCase(); + + if (strict) { + switch (format) { + case 'N': + case 'NN': + case 'NNN': + if (abbr === eraName) { + return eras[i]; + } + break; + + case 'NNNN': + if (name === eraName) { + return eras[i]; + } + break; + + case 'NNNNN': + if (narrow === eraName) { + return eras[i]; + } + break; + } + } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { + return eras[i]; + } + } + } + + function localeErasConvertYear(era, year) { + var dir = era.since <= era.until ? +1 : -1; + if (year === undefined) { + return hooks(era.since).year(); + } else { + return hooks(era.since).year() + (year - era.offset) * dir; + } + } + + function getEraName() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].name; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].name; + } + } + + return ''; + } + + function getEraNarrow() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].narrow; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].narrow; + } + } + + return ''; + } + + function getEraAbbr() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); + + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].abbr; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].abbr; + } + } + + return ''; + } + + function getEraYear() { + var i, + l, + dir, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + dir = eras[i].since <= eras[i].until ? +1 : -1; + + // truncate time + val = this.clone().startOf('day').valueOf(); + + if ( + (eras[i].since <= val && val <= eras[i].until) || + (eras[i].until <= val && val <= eras[i].since) + ) { + return ( + (this.year() - hooks(eras[i].since).year()) * dir + + eras[i].offset + ); + } + } + + return this.year(); + } + + function erasNameRegex(isStrict) { + if (!hasOwnProp(this, '_erasNameRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNameRegex : this._erasRegex; + } + + function erasAbbrRegex(isStrict) { + if (!hasOwnProp(this, '_erasAbbrRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasAbbrRegex : this._erasRegex; + } + + function erasNarrowRegex(isStrict) { + if (!hasOwnProp(this, '_erasNarrowRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNarrowRegex : this._erasRegex; + } + + function matchEraAbbr(isStrict, locale) { + return locale.erasAbbrRegex(isStrict); + } + + function matchEraName(isStrict, locale) { + return locale.erasNameRegex(isStrict); + } + + function matchEraNarrow(isStrict, locale) { + return locale.erasNarrowRegex(isStrict); + } + + function matchEraYearOrdinal(isStrict, locale) { + return locale._eraYearOrdinalRegex || matchUnsigned; + } + + function computeErasParse() { + var abbrPieces = [], + namePieces = [], + narrowPieces = [], + mixedPieces = [], + i, + l, + eras = this.eras(); + + for (i = 0, l = eras.length; i < l; ++i) { + namePieces.push(regexEscape(eras[i].name)); + abbrPieces.push(regexEscape(eras[i].abbr)); + narrowPieces.push(regexEscape(eras[i].narrow)); + + mixedPieces.push(regexEscape(eras[i].name)); + mixedPieces.push(regexEscape(eras[i].abbr)); + mixedPieces.push(regexEscape(eras[i].narrow)); + } + + this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); + this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); + this._erasNarrowRegex = new RegExp( + '^(' + narrowPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken(token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + addUnitAlias('weekYear', 'gg'); + addUnitAlias('isoWeekYear', 'GG'); + + // PRIORITY + + addUnitPriority('weekYear', 1); + addUnitPriority('isoWeekYear', 1); + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken( + ['gggg', 'ggggg', 'GGGG', 'GGGGG'], + function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); + } + ); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy + ); + } + + function getSetISOWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.isoWeek(), + this.isoWeekday(), + 1, + 4 + ); + } + + function getISOWeeksInYear() { + return weeksInYear(this.year(), 1, 4); + } + + function getISOWeeksInISOWeekYear() { + return weeksInYear(this.isoWeekYear(), 1, 4); + } + + function getWeeksInYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getWeeksInWeekYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; + } else { + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); + } + } + + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; + } + + // FORMATTING + + addFormatToken('Q', 0, 'Qo', 'quarter'); + + // ALIASES + + addUnitAlias('quarter', 'Q'); + + // PRIORITY + + addUnitPriority('quarter', 7); + + // PARSING + + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); + + // MOMENTS + + function getSetQuarter(input) { + return input == null + ? Math.ceil((this.month() + 1) / 3) + : this.month((input - 1) * 3 + (this.month() % 3)); + } + + // FORMATTING + + addFormatToken('D', ['DD', 2], 'Do', 'date'); + + // ALIASES + + addUnitAlias('date', 'D'); + + // PRIORITY + addUnitPriority('date', 9); + + // PARSING + + addRegexToken('D', match1to2); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict + ? locale._dayOfMonthOrdinalParse || locale._ordinalParse + : locale._dayOfMonthOrdinalParseLenient; + }); + + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); + + // MOMENTS + + var getSetDayOfMonth = makeGetSet('Date', true); + + // FORMATTING + + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + + // ALIASES + + addUnitAlias('dayOfYear', 'DDD'); + + // PRIORITY + addUnitPriority('dayOfYear', 4); + + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear(input) { + var dayOfYear = + Math.round( + (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 + ) + 1; + return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); + } + + // FORMATTING + + addFormatToken('m', ['mm', 2], 0, 'minute'); + + // ALIASES + + addUnitAlias('minute', 'm'); + + // PRIORITY + + addUnitPriority('minute', 14); + + // PARSING + + addRegexToken('m', match1to2); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); + + // MOMENTS + + var getSetMinute = makeGetSet('Minutes', false); + + // FORMATTING + + addFormatToken('s', ['ss', 2], 0, 'second'); + + // ALIASES + + addUnitAlias('second', 's'); + + // PRIORITY + + addUnitPriority('second', 15); + + // PARSING + + addRegexToken('s', match1to2); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + // ALIASES + + addUnitAlias('millisecond', 'ms'); + + // PRIORITY + + addUnitPriority('millisecond', 16); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token, getSetMillisecond; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); + } + + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); + } + + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } + + getSetMillisecond = makeGetSet('Milliseconds', false); + + // FORMATTING + + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); + + // MOMENTS + + function getZoneAbbr() { + return this._isUTC ? 'UTC' : ''; + } + + function getZoneName() { + return this._isUTC ? 'Coordinated Universal Time' : ''; + } + + var proto = Moment.prototype; + + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + if (typeof Symbol !== 'undefined' && Symbol.for != null) { + proto[Symbol.for('nodejs.util.inspect.custom')] = function () { + return 'Moment<' + this.format() + '>'; + }; + } + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.eraName = getEraName; + proto.eraNarrow = getEraNarrow; + proto.eraAbbr = getEraAbbr; + proto.eraYear = getEraYear; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.weeksInWeekYear = getWeeksInWeekYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate( + 'dates accessor is deprecated. Use date instead.', + getSetDayOfMonth + ); + proto.months = deprecate( + 'months accessor is deprecated. Use month instead', + getSetMonth + ); + proto.years = deprecate( + 'years accessor is deprecated. Use year instead', + getSetYear + ); + proto.zone = deprecate( + 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', + getSetZone + ); + proto.isDSTShifted = deprecate( + 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', + isDaylightSavingTimeShifted + ); + + function createUnix(input) { + return createLocal(input * 1000); + } + + function createInZone() { + return createLocal.apply(null, arguments).parseZone(); + } + + function preParsePostFormat(string) { + return string; + } + + var proto$1 = Locale.prototype; + + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + proto$1.eras = localeEras; + proto$1.erasParse = localeErasParse; + proto$1.erasConvertYear = localeErasConvertYear; + proto$1.erasAbbrRegex = erasAbbrRegex; + proto$1.erasNameRegex = erasNameRegex; + proto$1.erasNarrowRegex = erasNarrowRegex; + + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1(format, index, field, setter) { + var locale = getLocale(), + utc = createUTC().set(setter, index); + return locale[field](utc, format); + } + + function listMonthsImpl(format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); + } + + var i, + out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; + } + + // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + function listWeekdaysImpl(localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0, + i, + out = []; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); + } + + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + return out; + } + + function listMonths(format, index) { + return listMonthsImpl(format, index, 'months'); + } + + function listMonthsShort(format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } + + function listWeekdays(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } + + function listWeekdaysShort(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); + } + + function listWeekdaysMin(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); + } + + getSetGlobalLocale('en', { + eras: [ + { + since: '0001-01-01', + until: +Infinity, + offset: 1, + name: 'Anno Domini', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: 'Before Christ', + narrow: 'BC', + abbr: 'BC', + }, + ], + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + toInt((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); + + // Side effect imports + + hooks.lang = deprecate( + 'moment.lang is deprecated. Use moment.locale instead.', + getSetGlobalLocale + ); + hooks.langData = deprecate( + 'moment.langData is deprecated. Use moment.localeData instead.', + getLocale + ); + + var mathAbs = Math.abs; + + function abs() { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function addSubtract$1(duration, input, value, direction) { + var other = createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function add$1(input, value) { + return addSubtract$1(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function subtract$1(input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil(number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble() { + var milliseconds = this._milliseconds, + days = this._days, + months = this._months, + data = this._data, + seconds, + minutes, + hours, + years, + monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if ( + !( + (milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0) + ) + ) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths(days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return (days * 4800) / 146097; + } + + function monthsToDays(months) { + // the reverse of daysToMonths + return (months * 146097) / 4800; + } + + function as(units) { + if (!this.isValid()) { + return NaN; + } + var days, + months, + milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + switch (units) { + case 'month': + return months; + case 'quarter': + return months / 3; + case 'year': + return months / 12; + } + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week': + return days / 7 + milliseconds / 6048e5; + case 'day': + return days + milliseconds / 864e5; + case 'hour': + return days * 24 + milliseconds / 36e5; + case 'minute': + return days * 1440 + milliseconds / 6e4; + case 'second': + return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': + return Math.floor(days * 864e5) + milliseconds; + default: + throw new Error('Unknown unit ' + units); + } + } + } + + // TODO: Use this.as('ms')? + function valueOf$1() { + if (!this.isValid()) { + return NaN; + } + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); + } + + function makeAs(alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'), + asSeconds = makeAs('s'), + asMinutes = makeAs('m'), + asHours = makeAs('h'), + asDays = makeAs('d'), + asWeeks = makeAs('w'), + asMonths = makeAs('M'), + asQuarters = makeAs('Q'), + asYears = makeAs('y'); + + function clone$1() { + return createDuration(this); + } + + function get$2(units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'), + seconds = makeGetter('seconds'), + minutes = makeGetter('minutes'), + hours = makeGetter('hours'), + days = makeGetter('days'), + months = makeGetter('months'), + years = makeGetter('years'); + + function weeks() { + return absFloor(this.days() / 7); + } + + var round = Math.round, + thresholds = { + ss: 44, // a few seconds to seconds + s: 45, // seconds to minute + m: 45, // minutes to hour + h: 22, // hours to day + d: 26, // days to month/week + w: null, // weeks to month + M: 11, // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { + var duration = createDuration(posNegDuration).abs(), + seconds = round(duration.as('s')), + minutes = round(duration.as('m')), + hours = round(duration.as('h')), + days = round(duration.as('d')), + months = round(duration.as('M')), + weeks = round(duration.as('w')), + years = round(duration.as('y')), + a = + (seconds <= thresholds.ss && ['s', seconds]) || + (seconds < thresholds.s && ['ss', seconds]) || + (minutes <= 1 && ['m']) || + (minutes < thresholds.m && ['mm', minutes]) || + (hours <= 1 && ['h']) || + (hours < thresholds.h && ['hh', hours]) || + (days <= 1 && ['d']) || + (days < thresholds.d && ['dd', days]); + + if (thresholds.w != null) { + a = + a || + (weeks <= 1 && ['w']) || + (weeks < thresholds.w && ['ww', weeks]); + } + a = a || + (months <= 1 && ['M']) || + (months < thresholds.M && ['MM', months]) || + (years <= 1 && ['y']) || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set the rounding function for relative time strings + function getSetRelativeTimeRounding(roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof roundingFunction === 'function') { + round = roundingFunction; + return true; + } + return false; + } + + // This function allows you to set a threshold for relative time strings + function getSetRelativeTimeThreshold(threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; + } + + function humanize(argWithSuffix, argThresholds) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var withSuffix = false, + th = thresholds, + locale, + output; + + if (typeof argWithSuffix === 'object') { + argThresholds = argWithSuffix; + argWithSuffix = false; + } + if (typeof argWithSuffix === 'boolean') { + withSuffix = argWithSuffix; + } + if (typeof argThresholds === 'object') { + th = Object.assign({}, thresholds, argThresholds); + if (argThresholds.s != null && argThresholds.ss == null) { + th.ss = argThresholds.s - 1; + } + } + + locale = this.localeData(); + output = relativeTime$1(this, !withSuffix, th, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return (x > 0) - (x < 0) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000, + days = abs$1(this._days), + months = abs$1(this._months), + minutes, + hours, + years, + s, + total = this.asSeconds(), + totalSign, + ymSign, + daysSign, + hmsSign; + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + + totalSign = total < 0 ? '-' : ''; + ymSign = sign(this._months) !== sign(total) ? '-' : ''; + daysSign = sign(this._days) !== sign(total) ? '-' : ''; + hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return ( + totalSign + + 'P' + + (years ? ymSign + years + 'Y' : '') + + (months ? ymSign + months + 'M' : '') + + (days ? daysSign + days + 'D' : '') + + (hours || minutes || seconds ? 'T' : '') + + (hours ? hmsSign + hours + 'H' : '') + + (minutes ? hmsSign + minutes + 'M' : '') + + (seconds ? hmsSign + s + 'S' : '') + ); + } + + var proto$2 = Duration.prototype; + + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + + proto$2.toIsoString = deprecate( + 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', + toISOString$1 + ); + proto$2.lang = lang; + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + //! moment.js + + hooks.version = '2.29.4'; + + setHookCallback(createLocal); + + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; + + // currently HTML5 input type only supports 24-hour formats + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // + DATE: 'YYYY-MM-DD', // + TIME: 'HH:mm', // + TIME_SECONDS: 'HH:mm:ss', // + TIME_MS: 'HH:mm:ss.SSS', // + WEEK: 'GGGG-[W]WW', // + MONTH: 'YYYY-MM', // + }; + + return hooks; + + }))); + } (moment$5)); + return moment$5.exports; + } + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + function processRelativeTime(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + var de = moment.defineLocale('de', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: + 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), + monthsParseExact: true, + weekdays: + 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime, + mm: '%d Minuten', + h: processRelativeTime, + hh: '%d Stunden', + d: processRelativeTime, + dd: processRelativeTime, + w: processRelativeTime, + ww: '%d Wochen', + M: processRelativeTime, + MM: processRelativeTime, + y: processRelativeTime, + yy: processRelativeTime, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return de; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var monthsShortDot = + 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split( + '_' + ), + monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + monthsParse = [ + /^ene/i, + /^feb/i, + /^mar/i, + /^abr/i, + /^may/i, + /^jun/i, + /^jul/i, + /^ago/i, + /^sep/i, + /^oct/i, + /^nov/i, + /^dic/i, + ], + monthsRegex = + /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + + var es = moment.defineLocale('es', { + months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortDot; + } else if (/-MMM-/.test(format)) { + return monthsShort[m.month()]; + } else { + return monthsShortDot[m.month()]; + } + }, + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: + /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: + /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), + weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), + weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D [de] MMMM [de] YYYY', + LLL: 'D [de] MMMM [de] YYYY H:mm', + LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm', + }, + calendar: { + sameDay: function () { + return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextDay: function () { + return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + nextWeek: function () { + return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastDay: function () { + return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT'; + }, + lastWeek: function () { + return ( + '[el] dddd [pasado a la' + + (this.hours() !== 1 ? 's' : '') + + '] LT' + ); + }, + sameElse: 'L', + }, + relativeTime: { + future: 'en %s', + past: 'hace %s', + s: 'unos segundos', + ss: '%d segundos', + m: 'un minuto', + mm: '%d minutos', + h: 'una hora', + hh: '%d horas', + d: 'un día', + dd: '%d días', + w: 'una semana', + ww: '%d semanas', + M: 'un mes', + MM: '%d meses', + y: 'un año', + yy: '%d años', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + invalidDate: 'Fecha inválida', + }); + + return es; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var monthsStrictRegex = + /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsShortStrictRegex = + /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i, + monthsRegex = + /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i, + monthsParse = [ + /^janv/i, + /^févr/i, + /^mars/i, + /^avr/i, + /^mai/i, + /^juin/i, + /^juil/i, + /^août/i, + /^sept/i, + /^oct/i, + /^nov/i, + /^déc/i, + ]; + + var fr = moment.defineLocale('fr', { + months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split( + '_' + ), + monthsShort: + 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split( + '_' + ), + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: monthsStrictRegex, + monthsShortStrictRegex: monthsShortStrictRegex, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), + weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Aujourd’hui à] LT', + nextDay: '[Demain à] LT', + nextWeek: 'dddd [à] LT', + lastDay: '[Hier à] LT', + lastWeek: 'dddd [dernier à] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'dans %s', + past: 'il y a %s', + s: 'quelques secondes', + ss: '%d secondes', + m: 'une minute', + mm: '%d minutes', + h: 'une heure', + hh: '%d heures', + d: 'un jour', + dd: '%d jours', + w: 'une semaine', + ww: '%d semaines', + M: 'un mois', + MM: '%d mois', + y: 'un an', + yy: '%d ans', + }, + dayOfMonthOrdinalParse: /\d{1,2}(er|)/, + ordinal: function (number, period) { + switch (period) { + // TODO: Return 'e' when day of month > 1. Move this case inside + // block for masculine words below. + // See https://github.com/moment/moment/issues/3375 + case 'D': + return number + (number === 1 ? 'er' : ''); + + // Words with masculine grammatical gender: mois, trimestre, jour + default: + case 'M': + case 'Q': + case 'DDD': + case 'd': + return number + (number === 1 ? 'er' : 'e'); + + // Words with feminine grammatical gender: semaine + case 'w': + case 'W': + return number + (number === 1 ? 're' : 'e'); + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return fr; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var it = moment.defineLocale('it', { + months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split( + '_' + ), + monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'), + weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split( + '_' + ), + weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'), + weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: function () { + return ( + '[Oggi a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextDay: function () { + return ( + '[Domani a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + nextWeek: function () { + return ( + 'dddd [a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastDay: function () { + return ( + '[Ieri a' + + (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") + + ']LT' + ); + }, + lastWeek: function () { + switch (this.day()) { + case 0: + return ( + '[La scorsa] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + default: + return ( + '[Lo scorso] dddd [a' + + (this.hours() > 1 + ? 'lle ' + : this.hours() === 0 + ? ' ' + : "ll'") + + ']LT' + ); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'tra %s', + past: '%s fa', + s: 'alcuni secondi', + ss: '%d secondi', + m: 'un minuto', + mm: '%d minuti', + h: "un'ora", + hh: '%d ore', + d: 'un giorno', + dd: '%d giorni', + w: 'una settimana', + ww: '%d settimane', + M: 'un mese', + MM: '%d mesi', + y: 'un anno', + yy: '%d anni', + }, + dayOfMonthOrdinalParse: /\d{1,2}º/, + ordinal: '%dº', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return it; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var ja = moment.defineLocale('ja', { + eras: [ + { + since: '2019-05-01', + offset: 1, + name: '令和', + narrow: '㋿', + abbr: 'R', + }, + { + since: '1989-01-08', + until: '2019-04-30', + offset: 1, + name: '平成', + narrow: '㍻', + abbr: 'H', + }, + { + since: '1926-12-25', + until: '1989-01-07', + offset: 1, + name: '昭和', + narrow: '㍼', + abbr: 'S', + }, + { + since: '1912-07-30', + until: '1926-12-24', + offset: 1, + name: '大正', + narrow: '㍽', + abbr: 'T', + }, + { + since: '1873-01-01', + until: '1912-07-29', + offset: 6, + name: '明治', + narrow: '㍾', + abbr: 'M', + }, + { + since: '0001-01-01', + until: '1873-12-31', + offset: 1, + name: '西暦', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: '紀元前', + narrow: 'BC', + abbr: 'BC', + }, + ], + eraYearOrdinalRegex: /(元|\d+)年/, + eraYearOrdinalParse: function (input, match) { + return match[1] === '元' ? 1 : parseInt(match[1] || input, 10); + }, + months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split( + '_' + ), + weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'), + weekdaysShort: '日_月_火_水_木_金_土'.split('_'), + weekdaysMin: '日_月_火_水_木_金_土'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY/MM/DD', + LL: 'YYYY年M月D日', + LLL: 'YYYY年M月D日 HH:mm', + LLLL: 'YYYY年M月D日 dddd HH:mm', + l: 'YYYY/MM/DD', + ll: 'YYYY年M月D日', + lll: 'YYYY年M月D日 HH:mm', + llll: 'YYYY年M月D日(ddd) HH:mm', + }, + meridiemParse: /午前|午後/i, + isPM: function (input) { + return input === '午後'; + }, + meridiem: function (hour, minute, isLower) { + if (hour < 12) { + return '午前'; + } else { + return '午後'; + } + }, + calendar: { + sameDay: '[今日] LT', + nextDay: '[明日] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + return '[来週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + lastDay: '[昨日] LT', + lastWeek: function (now) { + if (this.week() !== now.week()) { + return '[先週]dddd LT'; + } else { + return 'dddd LT'; + } + }, + sameElse: 'L', + }, + dayOfMonthOrdinalParse: /\d{1,2}日/, + ordinal: function (number, period) { + switch (period) { + case 'y': + return number === 1 ? '元年' : number + '年'; + case 'd': + case 'D': + case 'DDD': + return number + '日'; + default: + return number; + } + }, + relativeTime: { + future: '%s後', + past: '%s前', + s: '数秒', + ss: '%d秒', + m: '1分', + mm: '%d分', + h: '1時間', + hh: '%d時間', + d: '1日', + dd: '%d日', + M: '1ヶ月', + MM: '%dヶ月', + y: '1年', + yy: '%d年', + }, + }); + + return ja; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var monthsShortWithDots = + 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), + monthsShortWithoutDots = + 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'), + monthsParse = [ + /^jan/i, + /^feb/i, + /^maart|mrt.?$/i, + /^apr/i, + /^mei$/i, + /^jun[i.]?$/i, + /^jul[i.]?$/i, + /^aug/i, + /^sep/i, + /^okt/i, + /^nov/i, + /^dec/i, + ], + monthsRegex = + /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i; + + var nl = moment.defineLocale('nl', { + months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split( + '_' + ), + monthsShort: function (m, format) { + if (!m) { + return monthsShortWithDots; + } else if (/-MMM-/.test(format)) { + return monthsShortWithoutDots[m.month()]; + } else { + return monthsShortWithDots[m.month()]; + } + }, + + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: + /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i, + monthsShortStrictRegex: + /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i, + + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + + weekdays: + 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), + weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD-MM-YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[vandaag om] LT', + nextDay: '[morgen om] LT', + nextWeek: 'dddd [om] LT', + lastDay: '[gisteren om] LT', + lastWeek: '[afgelopen] dddd [om] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'over %s', + past: '%s geleden', + s: 'een paar seconden', + ss: '%d seconden', + m: 'één minuut', + mm: '%d minuten', + h: 'één uur', + hh: '%d uur', + d: 'één dag', + dd: '%d dagen', + w: 'één week', + ww: '%d weken', + M: 'één maand', + MM: '%d maanden', + y: 'één jaar', + yy: '%d jaar', + }, + dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/, + ordinal: function (number) { + return ( + number + + (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de') + ); + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return nl; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + var monthsNominative = + 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split( + '_' + ), + monthsSubjective = + 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split( + '_' + ), + monthsParse = [ + /^sty/i, + /^lut/i, + /^mar/i, + /^kwi/i, + /^maj/i, + /^cze/i, + /^lip/i, + /^sie/i, + /^wrz/i, + /^paź/i, + /^lis/i, + /^gru/i, + ]; + function plural(n) { + return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1; + } + function translate(number, withoutSuffix, key) { + var result = number + ' '; + switch (key) { + case 'ss': + return result + (plural(number) ? 'sekundy' : 'sekund'); + case 'm': + return withoutSuffix ? 'minuta' : 'minutę'; + case 'mm': + return result + (plural(number) ? 'minuty' : 'minut'); + case 'h': + return withoutSuffix ? 'godzina' : 'godzinę'; + case 'hh': + return result + (plural(number) ? 'godziny' : 'godzin'); + case 'ww': + return result + (plural(number) ? 'tygodnie' : 'tygodni'); + case 'MM': + return result + (plural(number) ? 'miesiące' : 'miesięcy'); + case 'yy': + return result + (plural(number) ? 'lata' : 'lat'); + } + } + + var pl = moment.defineLocale('pl', { + months: function (momentToFormat, format) { + if (!momentToFormat) { + return monthsNominative; + } else if (/D MMMM/.test(format)) { + return monthsSubjective[momentToFormat.month()]; + } else { + return monthsNominative[momentToFormat.month()]; + } + }, + monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + weekdays: + 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'), + weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'), + weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd, D MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Dziś o] LT', + nextDay: '[Jutro o] LT', + nextWeek: function () { + switch (this.day()) { + case 0: + return '[W niedzielę o] LT'; + + case 2: + return '[We wtorek o] LT'; + + case 3: + return '[W środę o] LT'; + + case 6: + return '[W sobotę o] LT'; + + default: + return '[W] dddd [o] LT'; + } + }, + lastDay: '[Wczoraj o] LT', + lastWeek: function () { + switch (this.day()) { + case 0: + return '[W zeszłą niedzielę o] LT'; + case 3: + return '[W zeszłą środę o] LT'; + case 6: + return '[W zeszłą sobotę o] LT'; + default: + return '[W zeszły] dddd [o] LT'; + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'za %s', + past: '%s temu', + s: 'kilka sekund', + ss: translate, + m: translate, + mm: translate, + h: translate, + hh: translate, + d: '1 dzień', + dd: '%d dni', + w: 'tydzień', + ww: translate, + M: 'miesiąc', + MM: translate, + y: 'rok', + yy: translate, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return pl; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + function plural(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд', + mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут', + hh: 'час_часа_часов', + dd: 'день_дня_дней', + ww: 'неделя_недели_недель', + MM: 'месяц_месяца_месяцев', + yy: 'год_года_лет', + }; + if (key === 'm') { + return withoutSuffix ? 'минута' : 'минуту'; + } else { + return number + ' ' + plural(format[key], +number); + } + } + var monthsParse = [ + /^янв/i, + /^фев/i, + /^мар/i, + /^апр/i, + /^ма[йя]/i, + /^июн/i, + /^июл/i, + /^авг/i, + /^сен/i, + /^окт/i, + /^ноя/i, + /^дек/i, + ]; + + // http://new.gramota.ru/spravka/rules/139-prop : § 103 + // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637 + // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753 + var ru = moment.defineLocale('ru', { + months: { + format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split( + '_' + ), + standalone: + 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split( + '_' + ), + }, + monthsShort: { + // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку? + format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split( + '_' + ), + standalone: + 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split( + '_' + ), + }, + weekdays: { + standalone: + 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split( + '_' + ), + format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split( + '_' + ), + isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/, + }, + weekdaysShort: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'), + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, + + // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки + monthsRegex: + /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // копия предыдущего + monthsShortRegex: + /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i, + + // полные названия с падежами + monthsStrictRegex: + /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i, + + // Выражение, которое соответствует только сокращённым формам + monthsShortStrictRegex: + /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i, + longDateFormat: { + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY г.', + LLL: 'D MMMM YYYY г., H:mm', + LLLL: 'dddd, D MMMM YYYY г., H:mm', + }, + calendar: { + sameDay: '[Сегодня, в] LT', + nextDay: '[Завтра, в] LT', + lastDay: '[Вчера, в] LT', + nextWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В следующее] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В следующий] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В следующую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + lastWeek: function (now) { + if (now.week() !== this.week()) { + switch (this.day()) { + case 0: + return '[В прошлое] dddd, [в] LT'; + case 1: + case 2: + case 4: + return '[В прошлый] dddd, [в] LT'; + case 3: + case 5: + case 6: + return '[В прошлую] dddd, [в] LT'; + } + } else { + if (this.day() === 2) { + return '[Во] dddd, [в] LT'; + } else { + return '[В] dddd, [в] LT'; + } + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'через %s', + past: '%s назад', + s: 'несколько секунд', + ss: relativeTimeWithPlural, + m: relativeTimeWithPlural, + mm: relativeTimeWithPlural, + h: 'час', + hh: relativeTimeWithPlural, + d: 'день', + dd: relativeTimeWithPlural, + w: 'неделя', + ww: relativeTimeWithPlural, + M: 'месяц', + MM: relativeTimeWithPlural, + y: 'год', + yy: relativeTimeWithPlural, + }, + meridiemParse: /ночи|утра|дня|вечера/i, + isPM: function (input) { + return /^(дня|вечера)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночи'; + } else if (hour < 12) { + return 'утра'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечера'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + return number + '-й'; + case 'D': + return number + '-го'; + case 'w': + case 'W': + return number + '-я'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return ru; + + }))); + } ()); + + (function (module, exports) { + (function (global, factory) { + typeof commonjsRequire === 'function' ? factory(requireMoment()) : + factory(global.moment); + }(commonjsGlobal, (function (moment) { + //! moment.js locale configuration + + function plural(word, num) { + var forms = word.split('_'); + return num % 10 === 1 && num % 100 !== 11 + ? forms[0] + : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) + ? forms[1] + : forms[2]; + } + function relativeTimeWithPlural(number, withoutSuffix, key) { + var format = { + ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд', + mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин', + hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин', + dd: 'день_дні_днів', + MM: 'місяць_місяці_місяців', + yy: 'рік_роки_років', + }; + if (key === 'm') { + return withoutSuffix ? 'хвилина' : 'хвилину'; + } else if (key === 'h') { + return withoutSuffix ? 'година' : 'годину'; + } else { + return number + ' ' + plural(format[key], +number); + } + } + function weekdaysCaseReplace(m, format) { + var weekdays = { + nominative: + 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split( + '_' + ), + accusative: + 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split( + '_' + ), + genitive: + 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split( + '_' + ), + }, + nounCase; + + if (m === true) { + return weekdays['nominative'] + .slice(1, 7) + .concat(weekdays['nominative'].slice(0, 1)); + } + if (!m) { + return weekdays['nominative']; + } + + nounCase = /(\[[ВвУу]\]) ?dddd/.test(format) + ? 'accusative' + : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format) + ? 'genitive' + : 'nominative'; + return weekdays[nounCase][m.day()]; + } + function processHoursFunction(str) { + return function () { + return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT'; + }; + } + + var uk = moment.defineLocale('uk', { + months: { + format: 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split( + '_' + ), + standalone: + 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split( + '_' + ), + }, + monthsShort: 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split( + '_' + ), + weekdays: weekdaysCaseReplace, + weekdaysShort: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D MMMM YYYY р.', + LLL: 'D MMMM YYYY р., HH:mm', + LLLL: 'dddd, D MMMM YYYY р., HH:mm', + }, + calendar: { + sameDay: processHoursFunction('[Сьогодні '), + nextDay: processHoursFunction('[Завтра '), + lastDay: processHoursFunction('[Вчора '), + nextWeek: processHoursFunction('[У] dddd ['), + lastWeek: function () { + switch (this.day()) { + case 0: + case 3: + case 5: + case 6: + return processHoursFunction('[Минулої] dddd [').call(this); + case 1: + case 2: + case 4: + return processHoursFunction('[Минулого] dddd [').call(this); + } + }, + sameElse: 'L', + }, + relativeTime: { + future: 'за %s', + past: '%s тому', + s: 'декілька секунд', + ss: relativeTimeWithPlural, + m: relativeTimeWithPlural, + mm: relativeTimeWithPlural, + h: 'годину', + hh: relativeTimeWithPlural, + d: 'день', + dd: relativeTimeWithPlural, + M: 'місяць', + MM: relativeTimeWithPlural, + y: 'рік', + yy: relativeTimeWithPlural, + }, + // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason + meridiemParse: /ночі|ранку|дня|вечора/, + isPM: function (input) { + return /^(дня|вечора)$/.test(input); + }, + meridiem: function (hour, minute, isLower) { + if (hour < 4) { + return 'ночі'; + } else if (hour < 12) { + return 'ранку'; + } else if (hour < 17) { + return 'дня'; + } else { + return 'вечора'; + } + }, + dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/, + ordinal: function (number, period) { + switch (period) { + case 'M': + case 'd': + case 'DDD': + case 'w': + case 'W': + return number + '-й'; + case 'D': + return number + '-го'; + default: + return number; + } + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 7, // The week that contains Jan 7th is the first week of the year. + }, + }); + + return uk; + + }))); + } ()); + + var fails$y = function (exec) { + try { + return !!exec(); + } catch (error) { + return true; + } + }; + + var fails$x = fails$y; + + var functionBindNative = !fails$x(function () { + // eslint-disable-next-line es/no-function-prototype-bind -- safe + var test = (function () { /* empty */ }).bind(); + // eslint-disable-next-line no-prototype-builtins -- safe + return typeof test != 'function' || test.hasOwnProperty('prototype'); + }); + + var NATIVE_BIND$4 = functionBindNative; + + var FunctionPrototype$4 = Function.prototype; + var call$k = FunctionPrototype$4.call; + var uncurryThisWithBind = NATIVE_BIND$4 && FunctionPrototype$4.bind.bind(call$k, call$k); + + var functionUncurryThis = NATIVE_BIND$4 ? uncurryThisWithBind : function (fn) { + return function () { + return call$k.apply(fn, arguments); + }; + }; + + var ceil = Math.ceil; + var floor$1 = Math.floor; + + // `Math.trunc` method + // https://tc39.es/ecma262/#sec-math.trunc + // eslint-disable-next-line es/no-math-trunc -- safe + var mathTrunc = Math.trunc || function trunc(x) { + var n = +x; + return (n > 0 ? floor$1 : ceil)(n); + }; + + var trunc = mathTrunc; + + // `ToIntegerOrInfinity` abstract operation + // https://tc39.es/ecma262/#sec-tointegerorinfinity + var toIntegerOrInfinity$5 = function (argument) { + var number = +argument; + // eslint-disable-next-line no-self-compare -- NaN check + return number !== number || number === 0 ? 0 : trunc(number); + }; + + var check = function (it) { + return it && it.Math === Math && it; + }; + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global$q = + // eslint-disable-next-line es/no-global-this -- safe + check(typeof globalThis == 'object' && globalThis) || + check(typeof window == 'object' && window) || + // eslint-disable-next-line no-restricted-globals -- safe + check(typeof self == 'object' && self) || + check(typeof commonjsGlobal == 'object' && commonjsGlobal) || + // eslint-disable-next-line no-new-func -- fallback + (function () { return this; })() || commonjsGlobal || Function('return this')(); + + var shared$7 = {exports: {}}; + + var isPure = true; + + var global$p = global$q; + + // eslint-disable-next-line es/no-object-defineproperty -- safe + var defineProperty$f = Object.defineProperty; + + var defineGlobalProperty$1 = function (key, value) { + try { + defineProperty$f(global$p, key, { value: value, configurable: true, writable: true }); + } catch (error) { + global$p[key] = value; + } return value; + }; + + var global$o = global$q; + var defineGlobalProperty = defineGlobalProperty$1; + + var SHARED = '__core-js_shared__'; + var store$3 = global$o[SHARED] || defineGlobalProperty(SHARED, {}); + + var sharedStore = store$3; + + var store$2 = sharedStore; + + (shared$7.exports = function (key, value) { + return store$2[key] || (store$2[key] = value !== undefined ? value : {}); + })('versions', []).push({ + version: '3.33.0', + mode: 'pure' , + copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', + license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE', + source: 'https://github.com/zloirock/core-js' + }); + + var sharedExports = shared$7.exports; + + // we can't use just `it == null` since of `document.all` special case + // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec + var isNullOrUndefined$6 = function (it) { + return it === null || it === undefined; + }; + + var isNullOrUndefined$5 = isNullOrUndefined$6; + + var $TypeError$h = TypeError; + + // `RequireObjectCoercible` abstract operation + // https://tc39.es/ecma262/#sec-requireobjectcoercible + var requireObjectCoercible$6 = function (it) { + if (isNullOrUndefined$5(it)) throw new $TypeError$h("Can't call method on " + it); + return it; + }; + + var requireObjectCoercible$5 = requireObjectCoercible$6; + + var $Object$4 = Object; + + // `ToObject` abstract operation + // https://tc39.es/ecma262/#sec-toobject + var toObject$f = function (argument) { + return $Object$4(requireObjectCoercible$5(argument)); + }; + + var uncurryThis$x = functionUncurryThis; + var toObject$e = toObject$f; + + var hasOwnProperty = uncurryThis$x({}.hasOwnProperty); + + // `HasOwnProperty` abstract operation + // https://tc39.es/ecma262/#sec-hasownproperty + // eslint-disable-next-line es/no-object-hasown -- safe + var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { + return hasOwnProperty(toObject$e(it), key); + }; + + var uncurryThis$w = functionUncurryThis; + + var id$1 = 0; + var postfix = Math.random(); + var toString$e = uncurryThis$w(1.0.toString); + + var uid$4 = function (key) { + return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$e(++id$1 + postfix, 36); + }; + + var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || ''; + + var global$n = global$q; + var userAgent$5 = engineUserAgent; + + var process$3 = global$n.process; + var Deno$1 = global$n.Deno; + var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version; + var v8 = versions && versions.v8; + var match, version; + + if (v8) { + match = v8.split('.'); + // in old Chrome, versions of V8 isn't V8 = Chrome / 10 + // but their correct versions are not interesting for us + version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); + } + + // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` + // so check `userAgent` even if `.v8` exists, but 0 + if (!version && userAgent$5) { + match = userAgent$5.match(/Edge\/(\d+)/); + if (!match || match[1] >= 74) { + match = userAgent$5.match(/Chrome\/(\d+)/); + if (match) version = +match[1]; + } + } + + var engineV8Version = version; + + /* eslint-disable es/no-symbol -- required for testing */ + var V8_VERSION$3 = engineV8Version; + var fails$w = fails$y; + var global$m = global$q; + + var $String$5 = global$m.String; + + // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing + var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$w(function () { + var symbol = Symbol('symbol detection'); + // Chrome 38 Symbol has incorrect toString conversion + // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances + // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, + // of course, fail. + return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) || + // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + !Symbol.sham && V8_VERSION$3 && V8_VERSION$3 < 41; + }); + + /* eslint-disable es/no-symbol -- required for testing */ + var NATIVE_SYMBOL$5 = symbolConstructorDetection; + + var useSymbolAsUid = NATIVE_SYMBOL$5 + && !Symbol.sham + && typeof Symbol.iterator == 'symbol'; + + var global$l = global$q; + var shared$6 = sharedExports; + var hasOwn$j = hasOwnProperty_1; + var uid$3 = uid$4; + var NATIVE_SYMBOL$4 = symbolConstructorDetection; + var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; + + var Symbol$5 = global$l.Symbol; + var WellKnownSymbolsStore$2 = shared$6('wks'); + var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$5['for'] || Symbol$5 : Symbol$5 && Symbol$5.withoutSetter || uid$3; + + var wellKnownSymbol$p = function (name) { + if (!hasOwn$j(WellKnownSymbolsStore$2, name)) { + WellKnownSymbolsStore$2[name] = NATIVE_SYMBOL$4 && hasOwn$j(Symbol$5, name) + ? Symbol$5[name] + : createWellKnownSymbol('Symbol.' + name); + } return WellKnownSymbolsStore$2[name]; + }; + + var wellKnownSymbol$o = wellKnownSymbol$p; + + var TO_STRING_TAG$4 = wellKnownSymbol$o('toStringTag'); + var test$2 = {}; + + test$2[TO_STRING_TAG$4] = 'z'; + + var toStringTagSupport = String(test$2) === '[object z]'; + + var documentAll$2 = typeof document == 'object' && document.all; + + // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot + // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing + var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined; + + var documentAll_1 = { + all: documentAll$2, + IS_HTMLDDA: IS_HTMLDDA + }; + + var $documentAll$1 = documentAll_1; + + var documentAll$1 = $documentAll$1.all; + + // `IsCallable` abstract operation + // https://tc39.es/ecma262/#sec-iscallable + var isCallable$m = $documentAll$1.IS_HTMLDDA ? function (argument) { + return typeof argument == 'function' || argument === documentAll$1; + } : function (argument) { + return typeof argument == 'function'; + }; + + var uncurryThis$v = functionUncurryThis; + + var toString$d = uncurryThis$v({}.toString); + var stringSlice$1 = uncurryThis$v(''.slice); + + var classofRaw$2 = function (it) { + return stringSlice$1(toString$d(it), 8, -1); + }; + + var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport; + var isCallable$l = isCallable$m; + var classofRaw$1 = classofRaw$2; + var wellKnownSymbol$n = wellKnownSymbol$p; + + var TO_STRING_TAG$3 = wellKnownSymbol$n('toStringTag'); + var $Object$3 = Object; + + // ES3 wrong here + var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments'; + + // fallback for IE11 Script Access Denied error + var tryGet = function (it, key) { + try { + return it[key]; + } catch (error) { /* empty */ } + }; + + // getting tag from ES6+ `Object.prototype.toString` + var classof$g = TO_STRING_TAG_SUPPORT$2 ? classofRaw$1 : function (it) { + var O, tag, result; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (tag = tryGet(O = $Object$3(it), TO_STRING_TAG$3)) == 'string' ? tag + // builtinTag case + : CORRECT_ARGUMENTS ? classofRaw$1(O) + // ES3 arguments fallback + : (result = classofRaw$1(O)) === 'Object' && isCallable$l(O.callee) ? 'Arguments' : result; + }; + + var classof$f = classof$g; + + var $String$4 = String; + + var toString$c = function (argument) { + if (classof$f(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); + return $String$4(argument); + }; + + var uncurryThis$u = functionUncurryThis; + var toIntegerOrInfinity$4 = toIntegerOrInfinity$5; + var toString$b = toString$c; + var requireObjectCoercible$4 = requireObjectCoercible$6; + + var charAt$3 = uncurryThis$u(''.charAt); + var charCodeAt$1 = uncurryThis$u(''.charCodeAt); + var stringSlice = uncurryThis$u(''.slice); + + var createMethod$5 = function (CONVERT_TO_STRING) { + return function ($this, pos) { + var S = toString$b(requireObjectCoercible$4($this)); + var position = toIntegerOrInfinity$4(pos); + var size = S.length; + var first, second; + if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; + first = charCodeAt$1(S, position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size + || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF + ? CONVERT_TO_STRING + ? charAt$3(S, position) + : first + : CONVERT_TO_STRING + ? stringSlice(S, position, position + 2) + : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + }; + }; + + var stringMultibyte = { + // `String.prototype.codePointAt` method + // https://tc39.es/ecma262/#sec-string.prototype.codepointat + codeAt: createMethod$5(false), + // `String.prototype.at` method + // https://github.com/mathiasbynens/String.prototype.at + charAt: createMethod$5(true) + }; + + var global$k = global$q; + var isCallable$k = isCallable$m; + + var WeakMap$1 = global$k.WeakMap; + + var weakMapBasicDetection = isCallable$k(WeakMap$1) && /native code/.test(String(WeakMap$1)); + + var isCallable$j = isCallable$m; + var $documentAll = documentAll_1; + + var documentAll = $documentAll.all; + + var isObject$j = $documentAll.IS_HTMLDDA ? function (it) { + return typeof it == 'object' ? it !== null : isCallable$j(it) || it === documentAll; + } : function (it) { + return typeof it == 'object' ? it !== null : isCallable$j(it); + }; + + var fails$v = fails$y; + + // Detect IE8's incomplete defineProperty implementation + var descriptors = !fails$v(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; + }); + + var objectDefineProperty = {}; + + var global$j = global$q; + var isObject$i = isObject$j; + + var document$3 = global$j.document; + // typeof document.createElement is 'object' in old IE + var EXISTS$1 = isObject$i(document$3) && isObject$i(document$3.createElement); + + var documentCreateElement$1 = function (it) { + return EXISTS$1 ? document$3.createElement(it) : {}; + }; + + var DESCRIPTORS$i = descriptors; + var fails$u = fails$y; + var createElement$1 = documentCreateElement$1; + + // Thanks to IE8 for its funny defineProperty + var ie8DomDefine = !DESCRIPTORS$i && !fails$u(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + return Object.defineProperty(createElement$1('div'), 'a', { + get: function () { return 7; } + }).a !== 7; + }); + + var DESCRIPTORS$h = descriptors; + var fails$t = fails$y; + + // V8 ~ Chrome 36- + // https://bugs.chromium.org/p/v8/issues/detail?id=3334 + var v8PrototypeDefineBug = DESCRIPTORS$h && fails$t(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + return Object.defineProperty(function () { /* empty */ }, 'prototype', { + value: 42, + writable: false + }).prototype !== 42; + }); + + var isObject$h = isObject$j; + + var $String$3 = String; + var $TypeError$g = TypeError; + + // `Assert: Type(argument) is Object` + var anObject$d = function (argument) { + if (isObject$h(argument)) return argument; + throw new $TypeError$g($String$3(argument) + ' is not an object'); + }; + + var NATIVE_BIND$3 = functionBindNative; + + var call$j = Function.prototype.call; + + var functionCall = NATIVE_BIND$3 ? call$j.bind(call$j) : function () { + return call$j.apply(call$j, arguments); + }; + + var path$u = {}; + + var path$t = path$u; + var global$i = global$q; + var isCallable$i = isCallable$m; + + var aFunction = function (variable) { + return isCallable$i(variable) ? variable : undefined; + }; + + var getBuiltIn$f = function (namespace, method) { + return arguments.length < 2 ? aFunction(path$t[namespace]) || aFunction(global$i[namespace]) + : path$t[namespace] && path$t[namespace][method] || global$i[namespace] && global$i[namespace][method]; + }; + + var uncurryThis$t = functionUncurryThis; + + var objectIsPrototypeOf = uncurryThis$t({}.isPrototypeOf); + + var getBuiltIn$e = getBuiltIn$f; + var isCallable$h = isCallable$m; + var isPrototypeOf$r = objectIsPrototypeOf; + var USE_SYMBOL_AS_UID = useSymbolAsUid; + + var $Object$2 = Object; + + var isSymbol$5 = USE_SYMBOL_AS_UID ? function (it) { + return typeof it == 'symbol'; + } : function (it) { + var $Symbol = getBuiltIn$e('Symbol'); + return isCallable$h($Symbol) && isPrototypeOf$r($Symbol.prototype, $Object$2(it)); + }; + + var $String$2 = String; + + var tryToString$6 = function (argument) { + try { + return $String$2(argument); + } catch (error) { + return 'Object'; + } + }; + + var isCallable$g = isCallable$m; + var tryToString$5 = tryToString$6; + + var $TypeError$f = TypeError; + + // `Assert: IsCallable(argument) is true` + var aCallable$e = function (argument) { + if (isCallable$g(argument)) return argument; + throw new $TypeError$f(tryToString$5(argument) + ' is not a function'); + }; + + var aCallable$d = aCallable$e; + var isNullOrUndefined$4 = isNullOrUndefined$6; + + // `GetMethod` abstract operation + // https://tc39.es/ecma262/#sec-getmethod + var getMethod$3 = function (V, P) { + var func = V[P]; + return isNullOrUndefined$4(func) ? undefined : aCallable$d(func); + }; + + var call$i = functionCall; + var isCallable$f = isCallable$m; + var isObject$g = isObject$j; + + var $TypeError$e = TypeError; + + // `OrdinaryToPrimitive` abstract operation + // https://tc39.es/ecma262/#sec-ordinarytoprimitive + var ordinaryToPrimitive$1 = function (input, pref) { + var fn, val; + if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$g(val = call$i(fn, input))) return val; + if (isCallable$f(fn = input.valueOf) && !isObject$g(val = call$i(fn, input))) return val; + if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$g(val = call$i(fn, input))) return val; + throw new $TypeError$e("Can't convert object to primitive value"); + }; + + var call$h = functionCall; + var isObject$f = isObject$j; + var isSymbol$4 = isSymbol$5; + var getMethod$2 = getMethod$3; + var ordinaryToPrimitive = ordinaryToPrimitive$1; + var wellKnownSymbol$m = wellKnownSymbol$p; + + var $TypeError$d = TypeError; + var TO_PRIMITIVE = wellKnownSymbol$m('toPrimitive'); + + // `ToPrimitive` abstract operation + // https://tc39.es/ecma262/#sec-toprimitive + var toPrimitive$6 = function (input, pref) { + if (!isObject$f(input) || isSymbol$4(input)) return input; + var exoticToPrim = getMethod$2(input, TO_PRIMITIVE); + var result; + if (exoticToPrim) { + if (pref === undefined) pref = 'default'; + result = call$h(exoticToPrim, input, pref); + if (!isObject$f(result) || isSymbol$4(result)) return result; + throw new $TypeError$d("Can't convert object to primitive value"); + } + if (pref === undefined) pref = 'number'; + return ordinaryToPrimitive(input, pref); + }; + + var toPrimitive$5 = toPrimitive$6; + var isSymbol$3 = isSymbol$5; + + // `ToPropertyKey` abstract operation + // https://tc39.es/ecma262/#sec-topropertykey + var toPropertyKey$4 = function (argument) { + var key = toPrimitive$5(argument, 'string'); + return isSymbol$3(key) ? key : key + ''; + }; + + var DESCRIPTORS$g = descriptors; + var IE8_DOM_DEFINE$1 = ie8DomDefine; + var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; + var anObject$c = anObject$d; + var toPropertyKey$3 = toPropertyKey$4; + + var $TypeError$c = TypeError; + // eslint-disable-next-line es/no-object-defineproperty -- safe + var $defineProperty$1 = Object.defineProperty; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; + var ENUMERABLE = 'enumerable'; + var CONFIGURABLE$1 = 'configurable'; + var WRITABLE = 'writable'; + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + objectDefineProperty.f = DESCRIPTORS$g ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) { + anObject$c(O); + P = toPropertyKey$3(P); + anObject$c(Attributes); + if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { + var current = $getOwnPropertyDescriptor$2(O, P); + if (current && current[WRITABLE]) { + O[P] = Attributes.value; + Attributes = { + configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], + enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], + writable: false + }; + } + } return $defineProperty$1(O, P, Attributes); + } : $defineProperty$1 : function defineProperty(O, P, Attributes) { + anObject$c(O); + P = toPropertyKey$3(P); + anObject$c(Attributes); + if (IE8_DOM_DEFINE$1) try { + return $defineProperty$1(O, P, Attributes); + } catch (error) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$c('Accessors not supported'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; + }; + + var createPropertyDescriptor$7 = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; + }; + + var DESCRIPTORS$f = descriptors; + var definePropertyModule$4 = objectDefineProperty; + var createPropertyDescriptor$6 = createPropertyDescriptor$7; + + var createNonEnumerableProperty$9 = DESCRIPTORS$f ? function (object, key, value) { + return definePropertyModule$4.f(object, key, createPropertyDescriptor$6(1, value)); + } : function (object, key, value) { + object[key] = value; + return object; + }; + + var shared$5 = sharedExports; + var uid$2 = uid$4; + + var keys$7 = shared$5('keys'); + + var sharedKey$4 = function (key) { + return keys$7[key] || (keys$7[key] = uid$2(key)); + }; + + var hiddenKeys$6 = {}; + + var NATIVE_WEAK_MAP = weakMapBasicDetection; + var global$h = global$q; + var isObject$e = isObject$j; + var createNonEnumerableProperty$8 = createNonEnumerableProperty$9; + var hasOwn$i = hasOwnProperty_1; + var shared$4 = sharedStore; + var sharedKey$3 = sharedKey$4; + var hiddenKeys$5 = hiddenKeys$6; + + var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; + var TypeError$3 = global$h.TypeError; + var WeakMap = global$h.WeakMap; + var set$4, get, has; + + var enforce = function (it) { + return has(it) ? get(it) : set$4(it, {}); + }; + + var getterFor = function (TYPE) { + return function (it) { + var state; + if (!isObject$e(it) || (state = get(it)).type !== TYPE) { + throw new TypeError$3('Incompatible receiver, ' + TYPE + ' required'); + } return state; + }; + }; + + if (NATIVE_WEAK_MAP || shared$4.state) { + var store$1 = shared$4.state || (shared$4.state = new WeakMap()); + /* eslint-disable no-self-assign -- prototype methods protection */ + store$1.get = store$1.get; + store$1.has = store$1.has; + store$1.set = store$1.set; + /* eslint-enable no-self-assign -- prototype methods protection */ + set$4 = function (it, metadata) { + if (store$1.has(it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED); + metadata.facade = it; + store$1.set(it, metadata); + return metadata; + }; + get = function (it) { + return store$1.get(it) || {}; + }; + has = function (it) { + return store$1.has(it); + }; + } else { + var STATE = sharedKey$3('state'); + hiddenKeys$5[STATE] = true; + set$4 = function (it, metadata) { + if (hasOwn$i(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED); + metadata.facade = it; + createNonEnumerableProperty$8(it, STATE, metadata); + return metadata; + }; + get = function (it) { + return hasOwn$i(it, STATE) ? it[STATE] : {}; + }; + has = function (it) { + return hasOwn$i(it, STATE); + }; + } + + var internalState = { + set: set$4, + get: get, + has: has, + enforce: enforce, + getterFor: getterFor + }; + + var NATIVE_BIND$2 = functionBindNative; + + var FunctionPrototype$3 = Function.prototype; + var apply$6 = FunctionPrototype$3.apply; + var call$g = FunctionPrototype$3.call; + + // eslint-disable-next-line es/no-reflect -- safe + var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$2 ? call$g.bind(apply$6) : function () { + return call$g.apply(apply$6, arguments); + }); + + var classofRaw = classofRaw$2; + var uncurryThis$s = functionUncurryThis; + + var functionUncurryThisClause = function (fn) { + // Nashorn bug: + // https://github.com/zloirock/core-js/issues/1128 + // https://github.com/zloirock/core-js/issues/1130 + if (classofRaw(fn) === 'Function') return uncurryThis$s(fn); + }; + + var objectGetOwnPropertyDescriptor = {}; + + var objectPropertyIsEnumerable = {}; + + var $propertyIsEnumerable$2 = {}.propertyIsEnumerable; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$7 = Object.getOwnPropertyDescriptor; + + // Nashorn ~ JDK8 bug + var NASHORN_BUG = getOwnPropertyDescriptor$7 && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); + + // `Object.prototype.propertyIsEnumerable` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable + objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { + var descriptor = getOwnPropertyDescriptor$7(this, V); + return !!descriptor && descriptor.enumerable; + } : $propertyIsEnumerable$2; + + var uncurryThis$r = functionUncurryThis; + var fails$s = fails$y; + var classof$e = classofRaw$2; + + var $Object$1 = Object; + var split = uncurryThis$r(''.split); + + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var indexedObject = fails$s(function () { + // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 + // eslint-disable-next-line no-prototype-builtins -- safe + return !$Object$1('z').propertyIsEnumerable(0); + }) ? function (it) { + return classof$e(it) === 'String' ? split(it, '') : $Object$1(it); + } : $Object$1; + + // toObject with fallback for non-array-like ES3 strings + var IndexedObject$3 = indexedObject; + var requireObjectCoercible$3 = requireObjectCoercible$6; + + var toIndexedObject$b = function (it) { + return IndexedObject$3(requireObjectCoercible$3(it)); + }; + + var DESCRIPTORS$e = descriptors; + var call$f = functionCall; + var propertyIsEnumerableModule$2 = objectPropertyIsEnumerable; + var createPropertyDescriptor$5 = createPropertyDescriptor$7; + var toIndexedObject$a = toIndexedObject$b; + var toPropertyKey$2 = toPropertyKey$4; + var hasOwn$h = hasOwnProperty_1; + var IE8_DOM_DEFINE = ie8DomDefine; + + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + objectGetOwnPropertyDescriptor.f = DESCRIPTORS$e ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject$a(O); + P = toPropertyKey$2(P); + if (IE8_DOM_DEFINE) try { + return $getOwnPropertyDescriptor$1(O, P); + } catch (error) { /* empty */ } + if (hasOwn$h(O, P)) return createPropertyDescriptor$5(!call$f(propertyIsEnumerableModule$2.f, O, P), O[P]); + }; + + var fails$r = fails$y; + var isCallable$e = isCallable$m; + + var replacement = /#|\.prototype\./; + + var isForced$2 = function (feature, detection) { + var value = data[normalize(feature)]; + return value === POLYFILL ? true + : value === NATIVE ? false + : isCallable$e(detection) ? fails$r(detection) + : !!detection; + }; + + var normalize = isForced$2.normalize = function (string) { + return String(string).replace(replacement, '.').toLowerCase(); + }; + + var data = isForced$2.data = {}; + var NATIVE = isForced$2.NATIVE = 'N'; + var POLYFILL = isForced$2.POLYFILL = 'P'; + + var isForced_1 = isForced$2; + + var uncurryThis$q = functionUncurryThisClause; + var aCallable$c = aCallable$e; + var NATIVE_BIND$1 = functionBindNative; + + var bind$i = uncurryThis$q(uncurryThis$q.bind); + + // optional / simple context binding + var functionBindContext = function (fn, that) { + aCallable$c(fn); + return that === undefined ? fn : NATIVE_BIND$1 ? bind$i(fn, that) : function (/* ...args */) { + return fn.apply(that, arguments); + }; + }; + + var global$g = global$q; + var apply$5 = functionApply; + var uncurryThis$p = functionUncurryThisClause; + var isCallable$d = isCallable$m; + var getOwnPropertyDescriptor$6 = objectGetOwnPropertyDescriptor.f; + var isForced$1 = isForced_1; + var path$s = path$u; + var bind$h = functionBindContext; + var createNonEnumerableProperty$7 = createNonEnumerableProperty$9; + var hasOwn$g = hasOwnProperty_1; + + var wrapConstructor = function (NativeConstructor) { + var Wrapper = function (a, b, c) { + if (this instanceof Wrapper) { + switch (arguments.length) { + case 0: return new NativeConstructor(); + case 1: return new NativeConstructor(a); + case 2: return new NativeConstructor(a, b); + } return new NativeConstructor(a, b, c); + } return apply$5(NativeConstructor, this, arguments); + }; + Wrapper.prototype = NativeConstructor.prototype; + return Wrapper; + }; + + /* + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.dontCallGetSet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key + */ + var _export = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var PROTO = options.proto; + + var nativeSource = GLOBAL ? global$g : STATIC ? global$g[TARGET] : (global$g[TARGET] || {}).prototype; + + var target = GLOBAL ? path$s : path$s[TARGET] || createNonEnumerableProperty$7(path$s, TARGET, {})[TARGET]; + var targetPrototype = target.prototype; + + var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; + var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; + + for (key in source) { + FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + // contains in native + USE_NATIVE = !FORCED && nativeSource && hasOwn$g(nativeSource, key); + + targetProperty = target[key]; + + if (USE_NATIVE) if (options.dontCallGetSet) { + descriptor = getOwnPropertyDescriptor$6(nativeSource, key); + nativeProperty = descriptor && descriptor.value; + } else nativeProperty = nativeSource[key]; + + // export native or implementation + sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key]; + + if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue; + + // bind methods to global for calling from export context + if (options.bind && USE_NATIVE) resultProperty = bind$h(sourceProperty, global$g); + // wrap global constructors for prevent changes in this version + else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); + // make static versions for prototype methods + else if (PROTO && isCallable$d(sourceProperty)) resultProperty = uncurryThis$p(sourceProperty); + // default case + else resultProperty = sourceProperty; + + // add a flag to not completely full polyfills + if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) { + createNonEnumerableProperty$7(resultProperty, 'sham', true); + } + + createNonEnumerableProperty$7(target, key, resultProperty); + + if (PROTO) { + VIRTUAL_PROTOTYPE = TARGET + 'Prototype'; + if (!hasOwn$g(path$s, VIRTUAL_PROTOTYPE)) { + createNonEnumerableProperty$7(path$s, VIRTUAL_PROTOTYPE, {}); + } + // export virtual prototype methods + createNonEnumerableProperty$7(path$s[VIRTUAL_PROTOTYPE], key, sourceProperty); + // export real prototype methods + if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) { + createNonEnumerableProperty$7(targetPrototype, key, sourceProperty); + } + } + } + }; + + var DESCRIPTORS$d = descriptors; + var hasOwn$f = hasOwnProperty_1; + + var FunctionPrototype$2 = Function.prototype; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var getDescriptor = DESCRIPTORS$d && Object.getOwnPropertyDescriptor; + + var EXISTS = hasOwn$f(FunctionPrototype$2, 'name'); + // additional protection from minified / mangled / dropped function names + var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; + var CONFIGURABLE = EXISTS && (!DESCRIPTORS$d || (DESCRIPTORS$d && getDescriptor(FunctionPrototype$2, 'name').configurable)); + + var functionName = { + EXISTS: EXISTS, + PROPER: PROPER, + CONFIGURABLE: CONFIGURABLE + }; + + var objectDefineProperties = {}; + + var toIntegerOrInfinity$3 = toIntegerOrInfinity$5; + + var max$3 = Math.max; + var min$2 = Math.min; + + // Helper for a popular repeating case of the spec: + // Let integer be ? ToInteger(index). + // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). + var toAbsoluteIndex$5 = function (index, length) { + var integer = toIntegerOrInfinity$3(index); + return integer < 0 ? max$3(integer + length, 0) : min$2(integer, length); + }; + + var toIntegerOrInfinity$2 = toIntegerOrInfinity$5; + + var min$1 = Math.min; + + // `ToLength` abstract operation + // https://tc39.es/ecma262/#sec-tolength + var toLength$1 = function (argument) { + return argument > 0 ? min$1(toIntegerOrInfinity$2(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 + }; + + var toLength = toLength$1; + + // `LengthOfArrayLike` abstract operation + // https://tc39.es/ecma262/#sec-lengthofarraylike + var lengthOfArrayLike$e = function (obj) { + return toLength(obj.length); + }; + + var toIndexedObject$9 = toIndexedObject$b; + var toAbsoluteIndex$4 = toAbsoluteIndex$5; + var lengthOfArrayLike$d = lengthOfArrayLike$e; + + // `Array.prototype.{ indexOf, includes }` methods implementation + var createMethod$4 = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIndexedObject$9($this); + var length = lengthOfArrayLike$d(O); + var index = toAbsoluteIndex$4(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare -- NaN check + if (IS_INCLUDES && el !== el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare -- NaN check + if (value !== value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) { + if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + var arrayIncludes = { + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + includes: createMethod$4(true), + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + indexOf: createMethod$4(false) + }; + + var uncurryThis$o = functionUncurryThis; + var hasOwn$e = hasOwnProperty_1; + var toIndexedObject$8 = toIndexedObject$b; + var indexOf$4 = arrayIncludes.indexOf; + var hiddenKeys$4 = hiddenKeys$6; + + var push$d = uncurryThis$o([].push); + + var objectKeysInternal = function (object, names) { + var O = toIndexedObject$8(object); + var i = 0; + var result = []; + var key; + for (key in O) !hasOwn$e(hiddenKeys$4, key) && hasOwn$e(O, key) && push$d(result, key); + // Don't enum bug & hidden keys + while (names.length > i) if (hasOwn$e(O, key = names[i++])) { + ~indexOf$4(result, key) || push$d(result, key); + } + return result; + }; + + // IE8- don't enum bug keys + var enumBugKeys$3 = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + + var internalObjectKeys$1 = objectKeysInternal; + var enumBugKeys$2 = enumBugKeys$3; + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + // eslint-disable-next-line es/no-object-keys -- safe + var objectKeys$4 = Object.keys || function keys(O) { + return internalObjectKeys$1(O, enumBugKeys$2); + }; + + var DESCRIPTORS$c = descriptors; + var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug; + var definePropertyModule$3 = objectDefineProperty; + var anObject$b = anObject$d; + var toIndexedObject$7 = toIndexedObject$b; + var objectKeys$3 = objectKeys$4; + + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe + objectDefineProperties.f = DESCRIPTORS$c && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { + anObject$b(O); + var props = toIndexedObject$7(Properties); + var keys = objectKeys$3(Properties); + var length = keys.length; + var index = 0; + var key; + while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]); + return O; + }; + + var getBuiltIn$d = getBuiltIn$f; + + var html$2 = getBuiltIn$d('document', 'documentElement'); + + /* global ActiveXObject -- old IE, WSH */ + var anObject$a = anObject$d; + var definePropertiesModule$1 = objectDefineProperties; + var enumBugKeys$1 = enumBugKeys$3; + var hiddenKeys$3 = hiddenKeys$6; + var html$1 = html$2; + var documentCreateElement = documentCreateElement$1; + var sharedKey$2 = sharedKey$4; + + var GT = '>'; + var LT = '<'; + var PROTOTYPE$1 = 'prototype'; + var SCRIPT = 'script'; + var IE_PROTO$1 = sharedKey$2('IE_PROTO'); + + var EmptyConstructor = function () { /* empty */ }; + + var scriptTag = function (content) { + return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; + }; + + // Create object with fake `null` prototype: use ActiveX Object with cleared prototype + var NullProtoObjectViaActiveX = function (activeXDocument) { + activeXDocument.write(scriptTag('')); + activeXDocument.close(); + var temp = activeXDocument.parentWindow.Object; + activeXDocument = null; // avoid memory leak + return temp; + }; + + // Create object with fake `null` prototype: use iframe Object with cleared prototype + var NullProtoObjectViaIFrame = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = documentCreateElement('iframe'); + var JS = 'java' + SCRIPT + ':'; + var iframeDocument; + iframe.style.display = 'none'; + html$1.appendChild(iframe); + // https://github.com/zloirock/core-js/issues/475 + iframe.src = String(JS); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(scriptTag('document.F=Object')); + iframeDocument.close(); + return iframeDocument.F; + }; + + // Check for document.domain and active x support + // No need to use active x approach when document.domain is not set + // see https://github.com/es-shims/es5-shim/issues/150 + // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 + // avoid IE GC bug + var activeXDocument; + var NullProtoObject = function () { + try { + activeXDocument = new ActiveXObject('htmlfile'); + } catch (error) { /* ignore */ } + NullProtoObject = typeof document != 'undefined' + ? document.domain && activeXDocument + ? NullProtoObjectViaActiveX(activeXDocument) // old IE + : NullProtoObjectViaIFrame() + : NullProtoObjectViaActiveX(activeXDocument); // WSH + var length = enumBugKeys$1.length; + while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys$1[length]]; + return NullProtoObject(); + }; + + hiddenKeys$3[IE_PROTO$1] = true; + + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + // eslint-disable-next-line es/no-object-create -- safe + var objectCreate = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + EmptyConstructor[PROTOTYPE$1] = anObject$a(O); + result = new EmptyConstructor(); + EmptyConstructor[PROTOTYPE$1] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO$1] = O; + } else result = NullProtoObject(); + return Properties === undefined ? result : definePropertiesModule$1.f(result, Properties); + }; + + var fails$q = fails$y; + + var correctPrototypeGetter = !fails$q(function () { + function F() { /* empty */ } + F.prototype.constructor = null; + // eslint-disable-next-line es/no-object-getprototypeof -- required for testing + return Object.getPrototypeOf(new F()) !== F.prototype; + }); + + var hasOwn$d = hasOwnProperty_1; + var isCallable$c = isCallable$m; + var toObject$d = toObject$f; + var sharedKey$1 = sharedKey$4; + var CORRECT_PROTOTYPE_GETTER$1 = correctPrototypeGetter; + + var IE_PROTO = sharedKey$1('IE_PROTO'); + var $Object = Object; + var ObjectPrototype$2 = $Object.prototype; + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + // eslint-disable-next-line es/no-object-getprototypeof -- safe + var objectGetPrototypeOf$1 = CORRECT_PROTOTYPE_GETTER$1 ? $Object.getPrototypeOf : function (O) { + var object = toObject$d(O); + if (hasOwn$d(object, IE_PROTO)) return object[IE_PROTO]; + var constructor = object.constructor; + if (isCallable$c(constructor) && object instanceof constructor) { + return constructor.prototype; + } return object instanceof $Object ? ObjectPrototype$2 : null; + }; + + var createNonEnumerableProperty$6 = createNonEnumerableProperty$9; + + var defineBuiltIn$6 = function (target, key, value, options) { + if (options && options.enumerable) target[key] = value; + else createNonEnumerableProperty$6(target, key, value); + return target; + }; + + var fails$p = fails$y; + var isCallable$b = isCallable$m; + var isObject$d = isObject$j; + var create$b = objectCreate; + var getPrototypeOf$8 = objectGetPrototypeOf$1; + var defineBuiltIn$5 = defineBuiltIn$6; + var wellKnownSymbol$l = wellKnownSymbol$p; + + var ITERATOR$6 = wellKnownSymbol$l('iterator'); + var BUGGY_SAFARI_ITERATORS$1 = false; + + // `%IteratorPrototype%` object + // https://tc39.es/ecma262/#sec-%iteratorprototype%-object + var IteratorPrototype$1, PrototypeOfArrayIteratorPrototype, arrayIterator; + + /* eslint-disable es/no-array-prototype-keys -- safe */ + if ([].keys) { + arrayIterator = [].keys(); + // Safari 8 has buggy iterators w/o `next` + if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true; + else { + PrototypeOfArrayIteratorPrototype = getPrototypeOf$8(getPrototypeOf$8(arrayIterator)); + if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$1 = PrototypeOfArrayIteratorPrototype; + } + } + + var NEW_ITERATOR_PROTOTYPE = !isObject$d(IteratorPrototype$1) || fails$p(function () { + var test = {}; + // FF44- legacy iterators case + return IteratorPrototype$1[ITERATOR$6].call(test) !== test; + }); + + if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$1 = {}; + else IteratorPrototype$1 = create$b(IteratorPrototype$1); + + // `%IteratorPrototype%[@@iterator]()` method + // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator + if (!isCallable$b(IteratorPrototype$1[ITERATOR$6])) { + defineBuiltIn$5(IteratorPrototype$1, ITERATOR$6, function () { + return this; + }); + } + + var iteratorsCore = { + IteratorPrototype: IteratorPrototype$1, + BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1 + }; + + var TO_STRING_TAG_SUPPORT$1 = toStringTagSupport; + var classof$d = classof$g; + + // `Object.prototype.toString` method implementation + // https://tc39.es/ecma262/#sec-object.prototype.tostring + var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString() { + return '[object ' + classof$d(this) + ']'; + }; + + var TO_STRING_TAG_SUPPORT = toStringTagSupport; + var defineProperty$e = objectDefineProperty.f; + var createNonEnumerableProperty$5 = createNonEnumerableProperty$9; + var hasOwn$c = hasOwnProperty_1; + var toString$a = objectToString; + var wellKnownSymbol$k = wellKnownSymbol$p; + + var TO_STRING_TAG$2 = wellKnownSymbol$k('toStringTag'); + + var setToStringTag$7 = function (it, TAG, STATIC, SET_METHOD) { + if (it) { + var target = STATIC ? it : it.prototype; + if (!hasOwn$c(target, TO_STRING_TAG$2)) { + defineProperty$e(target, TO_STRING_TAG$2, { configurable: true, value: TAG }); + } + if (SET_METHOD && !TO_STRING_TAG_SUPPORT) { + createNonEnumerableProperty$5(target, 'toString', toString$a); + } + } + }; + + var iterators = {}; + + var IteratorPrototype = iteratorsCore.IteratorPrototype; + var create$a = objectCreate; + var createPropertyDescriptor$4 = createPropertyDescriptor$7; + var setToStringTag$6 = setToStringTag$7; + var Iterators$5 = iterators; + + var returnThis$1 = function () { return this; }; + + var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { + var TO_STRING_TAG = NAME + ' Iterator'; + IteratorConstructor.prototype = create$a(IteratorPrototype, { next: createPropertyDescriptor$4(+!ENUMERABLE_NEXT, next) }); + setToStringTag$6(IteratorConstructor, TO_STRING_TAG, false, true); + Iterators$5[TO_STRING_TAG] = returnThis$1; + return IteratorConstructor; + }; + + var uncurryThis$n = functionUncurryThis; + var aCallable$b = aCallable$e; + + var functionUncurryThisAccessor = function (object, key, method) { + try { + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + return uncurryThis$n(aCallable$b(Object.getOwnPropertyDescriptor(object, key)[method])); + } catch (error) { /* empty */ } + }; + + var isCallable$a = isCallable$m; + + var $String$1 = String; + var $TypeError$b = TypeError; + + var aPossiblePrototype$1 = function (argument) { + if (typeof argument == 'object' || isCallable$a(argument)) return argument; + throw new $TypeError$b("Can't set " + $String$1(argument) + ' as a prototype'); + }; + + /* eslint-disable no-proto -- safe */ + var uncurryThisAccessor = functionUncurryThisAccessor; + var anObject$9 = anObject$d; + var aPossiblePrototype = aPossiblePrototype$1; + + // `Object.setPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.setprototypeof + // Works with __proto__ only. Old v8 can't work with null proto objects. + // eslint-disable-next-line es/no-object-setprototypeof -- safe + var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var CORRECT_SETTER = false; + var test = {}; + var setter; + try { + setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set'); + setter(test, []); + CORRECT_SETTER = test instanceof Array; + } catch (error) { /* empty */ } + return function setPrototypeOf(O, proto) { + anObject$9(O); + aPossiblePrototype(proto); + if (CORRECT_SETTER) setter(O, proto); + else O.__proto__ = proto; + return O; + }; + }() : undefined); + + var $$10 = _export; + var call$e = functionCall; + var FunctionName = functionName; + var createIteratorConstructor = iteratorCreateConstructor; + var getPrototypeOf$7 = objectGetPrototypeOf$1; + var setToStringTag$5 = setToStringTag$7; + var defineBuiltIn$4 = defineBuiltIn$6; + var wellKnownSymbol$j = wellKnownSymbol$p; + var Iterators$4 = iterators; + var IteratorsCore = iteratorsCore; + + var PROPER_FUNCTION_NAME = FunctionName.PROPER; + FunctionName.CONFIGURABLE; + IteratorsCore.IteratorPrototype; + var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; + var ITERATOR$5 = wellKnownSymbol$j('iterator'); + var KEYS = 'keys'; + var VALUES = 'values'; + var ENTRIES = 'entries'; + + var returnThis = function () { return this; }; + + var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { + createIteratorConstructor(IteratorConstructor, NAME, next); + + var getIterationMethod = function (KIND) { + if (KIND === DEFAULT && defaultIterator) return defaultIterator; + if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; + + switch (KIND) { + case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; + case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; + case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; + } + + return function () { return new IteratorConstructor(this); }; + }; + + var TO_STRING_TAG = NAME + ' Iterator'; + var INCORRECT_VALUES_NAME = false; + var IterablePrototype = Iterable.prototype; + var nativeIterator = IterablePrototype[ITERATOR$5] + || IterablePrototype['@@iterator'] + || DEFAULT && IterablePrototype[DEFAULT]; + var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); + var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; + var CurrentIteratorPrototype, methods, KEY; + + // fix native + if (anyNativeIterator) { + CurrentIteratorPrototype = getPrototypeOf$7(anyNativeIterator.call(new Iterable())); + if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag$5(CurrentIteratorPrototype, TO_STRING_TAG, true, true); + Iterators$4[TO_STRING_TAG] = returnThis; + } + } + + // fix Array.prototype.{ values, @@iterator }.name in V8 / FF + if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) { + { + INCORRECT_VALUES_NAME = true; + defaultIterator = function values() { return call$e(nativeIterator, this); }; + } + } + + // export additional methods + if (DEFAULT) { + methods = { + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(ENTRIES) + }; + if (FORCED) for (KEY in methods) { + if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { + defineBuiltIn$4(IterablePrototype, KEY, methods[KEY]); + } + } else $$10({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); + } + + // define iterator + if ((FORCED) && IterablePrototype[ITERATOR$5] !== defaultIterator) { + defineBuiltIn$4(IterablePrototype, ITERATOR$5, defaultIterator, { name: DEFAULT }); + } + Iterators$4[NAME] = defaultIterator; + + return methods; + }; + + // `CreateIterResultObject` abstract operation + // https://tc39.es/ecma262/#sec-createiterresultobject + var createIterResultObject$3 = function (value, done) { + return { value: value, done: done }; + }; + + var charAt$2 = stringMultibyte.charAt; + var toString$9 = toString$c; + var InternalStateModule$5 = internalState; + var defineIterator$2 = iteratorDefine; + var createIterResultObject$2 = createIterResultObject$3; + + var STRING_ITERATOR = 'String Iterator'; + var setInternalState$5 = InternalStateModule$5.set; + var getInternalState$2 = InternalStateModule$5.getterFor(STRING_ITERATOR); + + // `String.prototype[@@iterator]` method + // https://tc39.es/ecma262/#sec-string.prototype-@@iterator + defineIterator$2(String, 'String', function (iterated) { + setInternalState$5(this, { + type: STRING_ITERATOR, + string: toString$9(iterated), + index: 0 + }); + // `%StringIteratorPrototype%.next` method + // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next + }, function next() { + var state = getInternalState$2(this); + var string = state.string; + var index = state.index; + var point; + if (index >= string.length) return createIterResultObject$2(undefined, true); + point = charAt$2(string, index); + state.index += point.length; + return createIterResultObject$2(point, false); + }); + + var call$d = functionCall; + var anObject$8 = anObject$d; + var getMethod$1 = getMethod$3; + + var iteratorClose$2 = function (iterator, kind, value) { + var innerResult, innerError; + anObject$8(iterator); + try { + innerResult = getMethod$1(iterator, 'return'); + if (!innerResult) { + if (kind === 'throw') throw value; + return value; + } + innerResult = call$d(innerResult, iterator); + } catch (error) { + innerError = true; + innerResult = error; + } + if (kind === 'throw') throw value; + if (innerError) throw innerResult; + anObject$8(innerResult); + return value; + }; + + var anObject$7 = anObject$d; + var iteratorClose$1 = iteratorClose$2; + + // call something on iterator step with safe closing on error + var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) { + try { + return ENTRIES ? fn(anObject$7(value)[0], value[1]) : fn(value); + } catch (error) { + iteratorClose$1(iterator, 'throw', error); + } + }; + + var wellKnownSymbol$i = wellKnownSymbol$p; + var Iterators$3 = iterators; + + var ITERATOR$4 = wellKnownSymbol$i('iterator'); + var ArrayPrototype$l = Array.prototype; + + // check on default Array iterator + var isArrayIteratorMethod$2 = function (it) { + return it !== undefined && (Iterators$3.Array === it || ArrayPrototype$l[ITERATOR$4] === it); + }; + + var uncurryThis$m = functionUncurryThis; + var isCallable$9 = isCallable$m; + var store = sharedStore; + + var functionToString = uncurryThis$m(Function.toString); + + // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper + if (!isCallable$9(store.inspectSource)) { + store.inspectSource = function (it) { + return functionToString(it); + }; + } + + var inspectSource$2 = store.inspectSource; + + var uncurryThis$l = functionUncurryThis; + var fails$o = fails$y; + var isCallable$8 = isCallable$m; + var classof$c = classof$g; + var getBuiltIn$c = getBuiltIn$f; + var inspectSource$1 = inspectSource$2; + + var noop = function () { /* empty */ }; + var empty = []; + var construct$4 = getBuiltIn$c('Reflect', 'construct'); + var constructorRegExp = /^\s*(?:class|function)\b/; + var exec$2 = uncurryThis$l(constructorRegExp.exec); + var INCORRECT_TO_STRING = !constructorRegExp.test(noop); + + var isConstructorModern = function isConstructor(argument) { + if (!isCallable$8(argument)) return false; + try { + construct$4(noop, empty, argument); + return true; + } catch (error) { + return false; + } + }; + + var isConstructorLegacy = function isConstructor(argument) { + if (!isCallable$8(argument)) return false; + switch (classof$c(argument)) { + case 'AsyncFunction': + case 'GeneratorFunction': + case 'AsyncGeneratorFunction': return false; + } + try { + // we can't check .prototype since constructors produced by .bind haven't it + // `Function#toString` throws on some built-it function in some legacy engines + // (for example, `DOMQuad` and similar in FF41-) + return INCORRECT_TO_STRING || !!exec$2(constructorRegExp, inspectSource$1(argument)); + } catch (error) { + return true; + } + }; + + isConstructorLegacy.sham = true; + + // `IsConstructor` abstract operation + // https://tc39.es/ecma262/#sec-isconstructor + var isConstructor$4 = !construct$4 || fails$o(function () { + var called; + return isConstructorModern(isConstructorModern.call) + || !isConstructorModern(Object) + || !isConstructorModern(function () { called = true; }) + || called; + }) ? isConstructorLegacy : isConstructorModern; + + var toPropertyKey$1 = toPropertyKey$4; + var definePropertyModule$2 = objectDefineProperty; + var createPropertyDescriptor$3 = createPropertyDescriptor$7; + + var createProperty$6 = function (object, key, value) { + var propertyKey = toPropertyKey$1(key); + if (propertyKey in object) definePropertyModule$2.f(object, propertyKey, createPropertyDescriptor$3(0, value)); + else object[propertyKey] = value; + }; + + var classof$b = classof$g; + var getMethod = getMethod$3; + var isNullOrUndefined$3 = isNullOrUndefined$6; + var Iterators$2 = iterators; + var wellKnownSymbol$h = wellKnownSymbol$p; + + var ITERATOR$3 = wellKnownSymbol$h('iterator'); + + var getIteratorMethod$9 = function (it) { + if (!isNullOrUndefined$3(it)) return getMethod(it, ITERATOR$3) + || getMethod(it, '@@iterator') + || Iterators$2[classof$b(it)]; + }; + + var call$c = functionCall; + var aCallable$a = aCallable$e; + var anObject$6 = anObject$d; + var tryToString$4 = tryToString$6; + var getIteratorMethod$8 = getIteratorMethod$9; + + var $TypeError$a = TypeError; + + var getIterator$8 = function (argument, usingIterator) { + var iteratorMethod = arguments.length < 2 ? getIteratorMethod$8(argument) : usingIterator; + if (aCallable$a(iteratorMethod)) return anObject$6(call$c(iteratorMethod, argument)); + throw new $TypeError$a(tryToString$4(argument) + ' is not iterable'); + }; + + var bind$g = functionBindContext; + var call$b = functionCall; + var toObject$c = toObject$f; + var callWithSafeIterationClosing = callWithSafeIterationClosing$1; + var isArrayIteratorMethod$1 = isArrayIteratorMethod$2; + var isConstructor$3 = isConstructor$4; + var lengthOfArrayLike$c = lengthOfArrayLike$e; + var createProperty$5 = createProperty$6; + var getIterator$7 = getIterator$8; + var getIteratorMethod$7 = getIteratorMethod$9; + + var $Array$3 = Array; + + // `Array.from` method implementation + // https://tc39.es/ecma262/#sec-array.from + var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject$c(arrayLike); + var IS_CONSTRUCTOR = isConstructor$3(this); + var argumentsLength = arguments.length; + var mapfn = argumentsLength > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + if (mapping) mapfn = bind$g(mapfn, argumentsLength > 2 ? arguments[2] : undefined); + var iteratorMethod = getIteratorMethod$7(O); + var index = 0; + var length, result, step, iterator, next, value; + // if the target is not iterable or it's an array with the default iterator - use a simple case + if (iteratorMethod && !(this === $Array$3 && isArrayIteratorMethod$1(iteratorMethod))) { + iterator = getIterator$7(O, iteratorMethod); + next = iterator.next; + result = IS_CONSTRUCTOR ? new this() : []; + for (;!(step = call$b(next, iterator)).done; index++) { + value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; + createProperty$5(result, index, value); + } + } else { + length = lengthOfArrayLike$c(O); + result = IS_CONSTRUCTOR ? new this(length) : $Array$3(length); + for (;length > index; index++) { + value = mapping ? mapfn(O[index], index) : O[index]; + createProperty$5(result, index, value); + } + } + result.length = index; + return result; + }; + + var wellKnownSymbol$g = wellKnownSymbol$p; + + var ITERATOR$2 = wellKnownSymbol$g('iterator'); + var SAFE_CLOSING = false; + + try { + var called = 0; + var iteratorWithReturn = { + next: function () { + return { done: !!called++ }; + }, + 'return': function () { + SAFE_CLOSING = true; + } + }; + iteratorWithReturn[ITERATOR$2] = function () { + return this; + }; + // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing + Array.from(iteratorWithReturn, function () { throw 2; }); + } catch (error) { /* empty */ } + + var checkCorrectnessOfIteration$2 = function (exec, SKIP_CLOSING) { + try { + if (!SKIP_CLOSING && !SAFE_CLOSING) return false; + } catch (error) { return false; } // workaround of old WebKit + `eval` bug + var ITERATION_SUPPORT = false; + try { + var object = {}; + object[ITERATOR$2] = function () { + return { + next: function () { + return { done: ITERATION_SUPPORT = true }; + } + }; + }; + exec(object); + } catch (error) { /* empty */ } + return ITERATION_SUPPORT; + }; + + var $$$ = _export; + var from$6 = arrayFrom; + var checkCorrectnessOfIteration$1 = checkCorrectnessOfIteration$2; + + var INCORRECT_ITERATION = !checkCorrectnessOfIteration$1(function (iterable) { + // eslint-disable-next-line es/no-array-from -- required for testing + Array.from(iterable); + }); + + // `Array.from` method + // https://tc39.es/ecma262/#sec-array.from + $$$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { + from: from$6 + }); + + var path$r = path$u; + + var from$5 = path$r.Array.from; + + var parent$1k = from$5; + + var from$4 = parent$1k; + + var from$3 = from$4; + + var _Array$from$1 = /*@__PURE__*/getDefaultExportFromCjs(from$3); + + var toIndexedObject$6 = toIndexedObject$b; + var Iterators$1 = iterators; + var InternalStateModule$4 = internalState; + objectDefineProperty.f; + var defineIterator$1 = iteratorDefine; + var createIterResultObject$1 = createIterResultObject$3; + + var ARRAY_ITERATOR = 'Array Iterator'; + var setInternalState$4 = InternalStateModule$4.set; + var getInternalState$1 = InternalStateModule$4.getterFor(ARRAY_ITERATOR); + + // `Array.prototype.entries` method + // https://tc39.es/ecma262/#sec-array.prototype.entries + // `Array.prototype.keys` method + // https://tc39.es/ecma262/#sec-array.prototype.keys + // `Array.prototype.values` method + // https://tc39.es/ecma262/#sec-array.prototype.values + // `Array.prototype[@@iterator]` method + // https://tc39.es/ecma262/#sec-array.prototype-@@iterator + // `CreateArrayIterator` internal method + // https://tc39.es/ecma262/#sec-createarrayiterator + defineIterator$1(Array, 'Array', function (iterated, kind) { + setInternalState$4(this, { + type: ARRAY_ITERATOR, + target: toIndexedObject$6(iterated), // target + index: 0, // next index + kind: kind // kind + }); + // `%ArrayIteratorPrototype%.next` method + // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next + }, function () { + var state = getInternalState$1(this); + var target = state.target; + var kind = state.kind; + var index = state.index++; + if (!target || index >= target.length) { + state.target = undefined; + return createIterResultObject$1(undefined, true); + } + switch (kind) { + case 'keys': return createIterResultObject$1(index, false); + case 'values': return createIterResultObject$1(target[index], false); + } return createIterResultObject$1([index, target[index]], false); + }, 'values'); + + // argumentsList[@@iterator] is %ArrayProto_values% + // https://tc39.es/ecma262/#sec-createunmappedargumentsobject + // https://tc39.es/ecma262/#sec-createmappedargumentsobject + Iterators$1.Arguments = Iterators$1.Array; + + var getIteratorMethod$6 = getIteratorMethod$9; + + var getIteratorMethod_1 = getIteratorMethod$6; + + // iterable DOM collections + // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods + var domIterables = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + + var DOMIterables$4 = domIterables; + var global$f = global$q; + var classof$a = classof$g; + var createNonEnumerableProperty$4 = createNonEnumerableProperty$9; + var Iterators = iterators; + var wellKnownSymbol$f = wellKnownSymbol$p; + + var TO_STRING_TAG$1 = wellKnownSymbol$f('toStringTag'); + + for (var COLLECTION_NAME in DOMIterables$4) { + var Collection = global$f[COLLECTION_NAME]; + var CollectionPrototype = Collection && Collection.prototype; + if (CollectionPrototype && classof$a(CollectionPrototype) !== TO_STRING_TAG$1) { + createNonEnumerableProperty$4(CollectionPrototype, TO_STRING_TAG$1, COLLECTION_NAME); + } + Iterators[COLLECTION_NAME] = Iterators.Array; + } + + var parent$1j = getIteratorMethod_1; + + + var getIteratorMethod$5 = parent$1j; + + var parent$1i = getIteratorMethod$5; + + var getIteratorMethod$4 = parent$1i; + + var parent$1h = getIteratorMethod$4; + + var getIteratorMethod$3 = parent$1h; + + var getIteratorMethod$2 = getIteratorMethod$3; + + var _getIteratorMethod$1 = /*@__PURE__*/getDefaultExportFromCjs(getIteratorMethod$2); + + var getIteratorMethod$1 = getIteratorMethod$2; + + var _getIteratorMethod = /*@__PURE__*/getDefaultExportFromCjs(getIteratorMethod$1); + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + var defineProperty$d = {exports: {}}; + + var $$_ = _export; + var DESCRIPTORS$b = descriptors; + var defineProperty$c = objectDefineProperty.f; + + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + // eslint-disable-next-line es/no-object-defineproperty -- safe + $$_({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty$c, sham: !DESCRIPTORS$b }, { + defineProperty: defineProperty$c + }); + + var path$q = path$u; + + var Object$4 = path$q.Object; + + var defineProperty$b = defineProperty$d.exports = function defineProperty(it, key, desc) { + return Object$4.defineProperty(it, key, desc); + }; + + if (Object$4.defineProperty.sham) defineProperty$b.sham = true; + + var definePropertyExports = defineProperty$d.exports; + + var parent$1g = definePropertyExports; + + var defineProperty$a = parent$1g; + + var parent$1f = defineProperty$a; + + var defineProperty$9 = parent$1f; + + var parent$1e = defineProperty$9; + + var defineProperty$8 = parent$1e; + + var defineProperty$7 = defineProperty$8; + + var _Object$defineProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(defineProperty$7); + + var classof$9 = classofRaw$2; + + // `IsArray` abstract operation + // https://tc39.es/ecma262/#sec-isarray + // eslint-disable-next-line es/no-array-isarray -- safe + var isArray$e = Array.isArray || function isArray(argument) { + return classof$9(argument) === 'Array'; + }; + + var $TypeError$9 = TypeError; + var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 + + var doesNotExceedSafeInteger$4 = function (it) { + if (it > MAX_SAFE_INTEGER) throw $TypeError$9('Maximum allowed index exceeded'); + return it; + }; + + var isArray$d = isArray$e; + var isConstructor$2 = isConstructor$4; + var isObject$c = isObject$j; + var wellKnownSymbol$e = wellKnownSymbol$p; + + var SPECIES$5 = wellKnownSymbol$e('species'); + var $Array$2 = Array; + + // a part of `ArraySpeciesCreate` abstract operation + // https://tc39.es/ecma262/#sec-arrayspeciescreate + var arraySpeciesConstructor$1 = function (originalArray) { + var C; + if (isArray$d(originalArray)) { + C = originalArray.constructor; + // cross-realm fallback + if (isConstructor$2(C) && (C === $Array$2 || isArray$d(C.prototype))) C = undefined; + else if (isObject$c(C)) { + C = C[SPECIES$5]; + if (C === null) C = undefined; + } + } return C === undefined ? $Array$2 : C; + }; + + var arraySpeciesConstructor = arraySpeciesConstructor$1; + + // `ArraySpeciesCreate` abstract operation + // https://tc39.es/ecma262/#sec-arrayspeciescreate + var arraySpeciesCreate$4 = function (originalArray, length) { + return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); + }; + + var fails$n = fails$y; + var wellKnownSymbol$d = wellKnownSymbol$p; + var V8_VERSION$2 = engineV8Version; + + var SPECIES$4 = wellKnownSymbol$d('species'); + + var arrayMethodHasSpeciesSupport$5 = function (METHOD_NAME) { + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/677 + return V8_VERSION$2 >= 51 || !fails$n(function () { + var array = []; + var constructor = array.constructor = {}; + constructor[SPECIES$4] = function () { + return { foo: 1 }; + }; + return array[METHOD_NAME](Boolean).foo !== 1; + }); + }; + + var $$Z = _export; + var fails$m = fails$y; + var isArray$c = isArray$e; + var isObject$b = isObject$j; + var toObject$b = toObject$f; + var lengthOfArrayLike$b = lengthOfArrayLike$e; + var doesNotExceedSafeInteger$3 = doesNotExceedSafeInteger$4; + var createProperty$4 = createProperty$6; + var arraySpeciesCreate$3 = arraySpeciesCreate$4; + var arrayMethodHasSpeciesSupport$4 = arrayMethodHasSpeciesSupport$5; + var wellKnownSymbol$c = wellKnownSymbol$p; + var V8_VERSION$1 = engineV8Version; + + var IS_CONCAT_SPREADABLE = wellKnownSymbol$c('isConcatSpreadable'); + + // We can't use this feature detection in V8 since it causes + // deoptimization and serious performance degradation + // https://github.com/zloirock/core-js/issues/679 + var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION$1 >= 51 || !fails$m(function () { + var array = []; + array[IS_CONCAT_SPREADABLE] = false; + return array.concat()[0] !== array; + }); + + var isConcatSpreadable = function (O) { + if (!isObject$b(O)) return false; + var spreadable = O[IS_CONCAT_SPREADABLE]; + return spreadable !== undefined ? !!spreadable : isArray$c(O); + }; + + var FORCED$9 = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport$4('concat'); + + // `Array.prototype.concat` method + // https://tc39.es/ecma262/#sec-array.prototype.concat + // with adding support of @@isConcatSpreadable and @@species + $$Z({ target: 'Array', proto: true, arity: 1, forced: FORCED$9 }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + concat: function concat(arg) { + var O = toObject$b(this); + var A = arraySpeciesCreate$3(O, 0); + var n = 0; + var i, k, length, len, E; + for (i = -1, length = arguments.length; i < length; i++) { + E = i === -1 ? O : arguments[i]; + if (isConcatSpreadable(E)) { + len = lengthOfArrayLike$b(E); + doesNotExceedSafeInteger$3(n + len); + for (k = 0; k < len; k++, n++) if (k in E) createProperty$4(A, n, E[k]); + } else { + doesNotExceedSafeInteger$3(n + 1); + createProperty$4(A, n++, E); + } + } + A.length = n; + return A; + } + }); + + var objectGetOwnPropertyNames = {}; + + var internalObjectKeys = objectKeysInternal; + var enumBugKeys = enumBugKeys$3; + + var hiddenKeys$2 = enumBugKeys.concat('length', 'prototype'); + + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + // eslint-disable-next-line es/no-object-getownpropertynames -- safe + objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return internalObjectKeys(O, hiddenKeys$2); + }; + + var objectGetOwnPropertyNamesExternal = {}; + + var toAbsoluteIndex$3 = toAbsoluteIndex$5; + var lengthOfArrayLike$a = lengthOfArrayLike$e; + var createProperty$3 = createProperty$6; + + var $Array$1 = Array; + var max$2 = Math.max; + + var arraySliceSimple = function (O, start, end) { + var length = lengthOfArrayLike$a(O); + var k = toAbsoluteIndex$3(start, length); + var fin = toAbsoluteIndex$3(end === undefined ? length : end, length); + var result = $Array$1(max$2(fin - k, 0)); + var n = 0; + for (; k < fin; k++, n++) createProperty$3(result, n, O[k]); + result.length = n; + return result; + }; + + /* eslint-disable es/no-object-getownpropertynames -- safe */ + var classof$8 = classofRaw$2; + var toIndexedObject$5 = toIndexedObject$b; + var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; + var arraySlice$6 = arraySliceSimple; + + var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + + var getWindowNames = function (it) { + try { + return $getOwnPropertyNames$1(it); + } catch (error) { + return arraySlice$6(windowNames); + } + }; + + // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) { + return windowNames && classof$8(it) === 'Window' + ? getWindowNames(it) + : $getOwnPropertyNames$1(toIndexedObject$5(it)); + }; + + var objectGetOwnPropertySymbols = {}; + + // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe + objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; + + var defineProperty$6 = objectDefineProperty; + + var defineBuiltInAccessor$3 = function (target, name, descriptor) { + return defineProperty$6.f(target, name, descriptor); + }; + + var wellKnownSymbolWrapped = {}; + + var wellKnownSymbol$b = wellKnownSymbol$p; + + wellKnownSymbolWrapped.f = wellKnownSymbol$b; + + var path$p = path$u; + var hasOwn$b = hasOwnProperty_1; + var wrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped; + var defineProperty$5 = objectDefineProperty.f; + + var wellKnownSymbolDefine = function (NAME) { + var Symbol = path$p.Symbol || (path$p.Symbol = {}); + if (!hasOwn$b(Symbol, NAME)) defineProperty$5(Symbol, NAME, { + value: wrappedWellKnownSymbolModule$1.f(NAME) + }); + }; + + var call$a = functionCall; + var getBuiltIn$b = getBuiltIn$f; + var wellKnownSymbol$a = wellKnownSymbol$p; + var defineBuiltIn$3 = defineBuiltIn$6; + + var symbolDefineToPrimitive = function () { + var Symbol = getBuiltIn$b('Symbol'); + var SymbolPrototype = Symbol && Symbol.prototype; + var valueOf = SymbolPrototype && SymbolPrototype.valueOf; + var TO_PRIMITIVE = wellKnownSymbol$a('toPrimitive'); + + if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) { + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + // eslint-disable-next-line no-unused-vars -- required for .length + defineBuiltIn$3(SymbolPrototype, TO_PRIMITIVE, function (hint) { + return call$a(valueOf, this); + }, { arity: 1 }); + } + }; + + var bind$f = functionBindContext; + var uncurryThis$k = functionUncurryThis; + var IndexedObject$2 = indexedObject; + var toObject$a = toObject$f; + var lengthOfArrayLike$9 = lengthOfArrayLike$e; + var arraySpeciesCreate$2 = arraySpeciesCreate$4; + + var push$c = uncurryThis$k([].push); + + // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation + var createMethod$3 = function (TYPE) { + var IS_MAP = TYPE === 1; + var IS_FILTER = TYPE === 2; + var IS_SOME = TYPE === 3; + var IS_EVERY = TYPE === 4; + var IS_FIND_INDEX = TYPE === 6; + var IS_FILTER_REJECT = TYPE === 7; + var NO_HOLES = TYPE === 5 || IS_FIND_INDEX; + return function ($this, callbackfn, that, specificCreate) { + var O = toObject$a($this); + var self = IndexedObject$2(O); + var boundFunction = bind$f(callbackfn, that); + var length = lengthOfArrayLike$9(self); + var index = 0; + var create = specificCreate || arraySpeciesCreate$2; + var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; + var value, result; + for (;length > index; index++) if (NO_HOLES || index in self) { + value = self[index]; + result = boundFunction(value, index, O); + if (TYPE) { + if (IS_MAP) target[index] = result; // map + else if (result) switch (TYPE) { + case 3: return true; // some + case 5: return value; // find + case 6: return index; // findIndex + case 2: push$c(target, value); // filter + } else switch (TYPE) { + case 4: return false; // every + case 7: push$c(target, value); // filterReject + } + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; + }; + }; + + var arrayIteration = { + // `Array.prototype.forEach` method + // https://tc39.es/ecma262/#sec-array.prototype.foreach + forEach: createMethod$3(0), + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + map: createMethod$3(1), + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + filter: createMethod$3(2), + // `Array.prototype.some` method + // https://tc39.es/ecma262/#sec-array.prototype.some + some: createMethod$3(3), + // `Array.prototype.every` method + // https://tc39.es/ecma262/#sec-array.prototype.every + every: createMethod$3(4), + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + find: createMethod$3(5), + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: createMethod$3(6), + // `Array.prototype.filterReject` method + // https://github.com/tc39/proposal-array-filtering + filterReject: createMethod$3(7) + }; + + var $$Y = _export; + var global$e = global$q; + var call$9 = functionCall; + var uncurryThis$j = functionUncurryThis; + var DESCRIPTORS$a = descriptors; + var NATIVE_SYMBOL$3 = symbolConstructorDetection; + var fails$l = fails$y; + var hasOwn$a = hasOwnProperty_1; + var isPrototypeOf$q = objectIsPrototypeOf; + var anObject$5 = anObject$d; + var toIndexedObject$4 = toIndexedObject$b; + var toPropertyKey = toPropertyKey$4; + var $toString = toString$c; + var createPropertyDescriptor$2 = createPropertyDescriptor$7; + var nativeObjectCreate = objectCreate; + var objectKeys$2 = objectKeys$4; + var getOwnPropertyNamesModule$2 = objectGetOwnPropertyNames; + var getOwnPropertyNamesExternal = objectGetOwnPropertyNamesExternal; + var getOwnPropertySymbolsModule$3 = objectGetOwnPropertySymbols; + var getOwnPropertyDescriptorModule$2 = objectGetOwnPropertyDescriptor; + var definePropertyModule$1 = objectDefineProperty; + var definePropertiesModule = objectDefineProperties; + var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable; + var defineBuiltIn$2 = defineBuiltIn$6; + var defineBuiltInAccessor$2 = defineBuiltInAccessor$3; + var shared$3 = sharedExports; + var sharedKey = sharedKey$4; + var hiddenKeys$1 = hiddenKeys$6; + var uid$1 = uid$4; + var wellKnownSymbol$9 = wellKnownSymbol$p; + var wrappedWellKnownSymbolModule = wellKnownSymbolWrapped; + var defineWellKnownSymbol$l = wellKnownSymbolDefine; + var defineSymbolToPrimitive$1 = symbolDefineToPrimitive; + var setToStringTag$4 = setToStringTag$7; + var InternalStateModule$3 = internalState; + var $forEach$1 = arrayIteration.forEach; + + var HIDDEN = sharedKey('hidden'); + var SYMBOL = 'Symbol'; + var PROTOTYPE = 'prototype'; + + var setInternalState$3 = InternalStateModule$3.set; + var getInternalState = InternalStateModule$3.getterFor(SYMBOL); + + var ObjectPrototype$1 = Object[PROTOTYPE]; + var $Symbol = global$e.Symbol; + var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; + var RangeError$1 = global$e.RangeError; + var TypeError$2 = global$e.TypeError; + var QObject = global$e.QObject; + var nativeGetOwnPropertyDescriptor$1 = getOwnPropertyDescriptorModule$2.f; + var nativeDefineProperty = definePropertyModule$1.f; + var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; + var nativePropertyIsEnumerable = propertyIsEnumerableModule$1.f; + var push$b = uncurryThis$j([].push); + + var AllSymbols = shared$3('symbols'); + var ObjectPrototypeSymbols = shared$3('op-symbols'); + var WellKnownSymbolsStore$1 = shared$3('wks'); + + // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 + var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + + // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var fallbackDefineProperty = function (O, P, Attributes) { + var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype$1, P); + if (ObjectPrototypeDescriptor) delete ObjectPrototype$1[P]; + nativeDefineProperty(O, P, Attributes); + if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1) { + nativeDefineProperty(ObjectPrototype$1, P, ObjectPrototypeDescriptor); + } + }; + + var setSymbolDescriptor = DESCRIPTORS$a && fails$l(function () { + return nativeObjectCreate(nativeDefineProperty({}, 'a', { + get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } + })).a !== 7; + }) ? fallbackDefineProperty : nativeDefineProperty; + + var wrap = function (tag, description) { + var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); + setInternalState$3(symbol, { + type: SYMBOL, + tag: tag, + description: description + }); + if (!DESCRIPTORS$a) symbol.description = description; + return symbol; + }; + + var $defineProperty = function defineProperty(O, P, Attributes) { + if (O === ObjectPrototype$1) $defineProperty(ObjectPrototypeSymbols, P, Attributes); + anObject$5(O); + var key = toPropertyKey(P); + anObject$5(Attributes); + if (hasOwn$a(AllSymbols, key)) { + if (!Attributes.enumerable) { + if (!hasOwn$a(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor$2(1, {})); + O[HIDDEN][key] = true; + } else { + if (hasOwn$a(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; + Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor$2(0, false) }); + } return setSymbolDescriptor(O, key, Attributes); + } return nativeDefineProperty(O, key, Attributes); + }; + + var $defineProperties = function defineProperties(O, Properties) { + anObject$5(O); + var properties = toIndexedObject$4(Properties); + var keys = objectKeys$2(properties).concat($getOwnPropertySymbols(properties)); + $forEach$1(keys, function (key) { + if (!DESCRIPTORS$a || call$9($propertyIsEnumerable$1, properties, key)) $defineProperty(O, key, properties[key]); + }); + return O; + }; + + var $create = function create(O, Properties) { + return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); + }; + + var $propertyIsEnumerable$1 = function propertyIsEnumerable(V) { + var P = toPropertyKey(V); + var enumerable = call$9(nativePropertyIsEnumerable, this, P); + if (this === ObjectPrototype$1 && hasOwn$a(AllSymbols, P) && !hasOwn$a(ObjectPrototypeSymbols, P)) return false; + return enumerable || !hasOwn$a(this, P) || !hasOwn$a(AllSymbols, P) || hasOwn$a(this, HIDDEN) && this[HIDDEN][P] + ? enumerable : true; + }; + + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { + var it = toIndexedObject$4(O); + var key = toPropertyKey(P); + if (it === ObjectPrototype$1 && hasOwn$a(AllSymbols, key) && !hasOwn$a(ObjectPrototypeSymbols, key)) return; + var descriptor = nativeGetOwnPropertyDescriptor$1(it, key); + if (descriptor && hasOwn$a(AllSymbols, key) && !(hasOwn$a(it, HIDDEN) && it[HIDDEN][key])) { + descriptor.enumerable = true; + } + return descriptor; + }; + + var $getOwnPropertyNames = function getOwnPropertyNames(O) { + var names = nativeGetOwnPropertyNames(toIndexedObject$4(O)); + var result = []; + $forEach$1(names, function (key) { + if (!hasOwn$a(AllSymbols, key) && !hasOwn$a(hiddenKeys$1, key)) push$b(result, key); + }); + return result; + }; + + var $getOwnPropertySymbols = function (O) { + var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1; + var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$4(O)); + var result = []; + $forEach$1(names, function (key) { + if (hasOwn$a(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn$a(ObjectPrototype$1, key))) { + push$b(result, AllSymbols[key]); + } + }); + return result; + }; + + // `Symbol` constructor + // https://tc39.es/ecma262/#sec-symbol-constructor + if (!NATIVE_SYMBOL$3) { + $Symbol = function Symbol() { + if (isPrototypeOf$q(SymbolPrototype, this)) throw new TypeError$2('Symbol is not a constructor'); + var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); + var tag = uid$1(description); + var setter = function (value) { + if (this === ObjectPrototype$1) call$9(setter, ObjectPrototypeSymbols, value); + if (hasOwn$a(this, HIDDEN) && hasOwn$a(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + var descriptor = createPropertyDescriptor$2(1, value); + try { + setSymbolDescriptor(this, tag, descriptor); + } catch (error) { + if (!(error instanceof RangeError$1)) throw error; + fallbackDefineProperty(this, tag, descriptor); + } + }; + if (DESCRIPTORS$a && USE_SETTER) setSymbolDescriptor(ObjectPrototype$1, tag, { configurable: true, set: setter }); + return wrap(tag, description); + }; + + SymbolPrototype = $Symbol[PROTOTYPE]; + + defineBuiltIn$2(SymbolPrototype, 'toString', function toString() { + return getInternalState(this).tag; + }); + + defineBuiltIn$2($Symbol, 'withoutSetter', function (description) { + return wrap(uid$1(description), description); + }); + + propertyIsEnumerableModule$1.f = $propertyIsEnumerable$1; + definePropertyModule$1.f = $defineProperty; + definePropertiesModule.f = $defineProperties; + getOwnPropertyDescriptorModule$2.f = $getOwnPropertyDescriptor; + getOwnPropertyNamesModule$2.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; + getOwnPropertySymbolsModule$3.f = $getOwnPropertySymbols; + + wrappedWellKnownSymbolModule.f = function (name) { + return wrap(wellKnownSymbol$9(name), name); + }; + + if (DESCRIPTORS$a) { + // https://github.com/tc39/proposal-Symbol-description + defineBuiltInAccessor$2(SymbolPrototype, 'description', { + configurable: true, + get: function description() { + return getInternalState(this).description; + } + }); + } + } + + $$Y({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL$3, sham: !NATIVE_SYMBOL$3 }, { + Symbol: $Symbol + }); + + $forEach$1(objectKeys$2(WellKnownSymbolsStore$1), function (name) { + defineWellKnownSymbol$l(name); + }); + + $$Y({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL$3 }, { + useSetter: function () { USE_SETTER = true; }, + useSimple: function () { USE_SETTER = false; } + }); + + $$Y({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL$3, sham: !DESCRIPTORS$a }, { + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + create: $create, + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + defineProperty: $defineProperty, + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + defineProperties: $defineProperties, + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors + getOwnPropertyDescriptor: $getOwnPropertyDescriptor + }); + + $$Y({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL$3 }, { + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + getOwnPropertyNames: $getOwnPropertyNames + }); + + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + defineSymbolToPrimitive$1(); + + // `Symbol.prototype[@@toStringTag]` property + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag + setToStringTag$4($Symbol, SYMBOL); + + hiddenKeys$1[HIDDEN] = true; + + var NATIVE_SYMBOL$2 = symbolConstructorDetection; + + /* eslint-disable es/no-symbol -- safe */ + var symbolRegistryDetection = NATIVE_SYMBOL$2 && !!Symbol['for'] && !!Symbol.keyFor; + + var $$X = _export; + var getBuiltIn$a = getBuiltIn$f; + var hasOwn$9 = hasOwnProperty_1; + var toString$8 = toString$c; + var shared$2 = sharedExports; + var NATIVE_SYMBOL_REGISTRY$1 = symbolRegistryDetection; + + var StringToSymbolRegistry = shared$2('string-to-symbol-registry'); + var SymbolToStringRegistry$1 = shared$2('symbol-to-string-registry'); + + // `Symbol.for` method + // https://tc39.es/ecma262/#sec-symbol.for + $$X({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY$1 }, { + 'for': function (key) { + var string = toString$8(key); + if (hasOwn$9(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; + var symbol = getBuiltIn$a('Symbol')(string); + StringToSymbolRegistry[string] = symbol; + SymbolToStringRegistry$1[symbol] = string; + return symbol; + } + }); + + var $$W = _export; + var hasOwn$8 = hasOwnProperty_1; + var isSymbol$2 = isSymbol$5; + var tryToString$3 = tryToString$6; + var shared$1 = sharedExports; + var NATIVE_SYMBOL_REGISTRY = symbolRegistryDetection; + + var SymbolToStringRegistry = shared$1('symbol-to-string-registry'); + + // `Symbol.keyFor` method + // https://tc39.es/ecma262/#sec-symbol.keyfor + $$W({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { + keyFor: function keyFor(sym) { + if (!isSymbol$2(sym)) throw new TypeError(tryToString$3(sym) + ' is not a symbol'); + if (hasOwn$8(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; + } + }); + + var uncurryThis$i = functionUncurryThis; + + var arraySlice$5 = uncurryThis$i([].slice); + + var uncurryThis$h = functionUncurryThis; + var isArray$b = isArray$e; + var isCallable$7 = isCallable$m; + var classof$7 = classofRaw$2; + var toString$7 = toString$c; + + var push$a = uncurryThis$h([].push); + + var getJsonReplacerFunction = function (replacer) { + if (isCallable$7(replacer)) return replacer; + if (!isArray$b(replacer)) return; + var rawLength = replacer.length; + var keys = []; + for (var i = 0; i < rawLength; i++) { + var element = replacer[i]; + if (typeof element == 'string') push$a(keys, element); + else if (typeof element == 'number' || classof$7(element) === 'Number' || classof$7(element) === 'String') push$a(keys, toString$7(element)); + } + var keysLength = keys.length; + var root = true; + return function (key, value) { + if (root) { + root = false; + return value; + } + if (isArray$b(this)) return value; + for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value; + }; + }; + + var $$V = _export; + var getBuiltIn$9 = getBuiltIn$f; + var apply$4 = functionApply; + var call$8 = functionCall; + var uncurryThis$g = functionUncurryThis; + var fails$k = fails$y; + var isCallable$6 = isCallable$m; + var isSymbol$1 = isSymbol$5; + var arraySlice$4 = arraySlice$5; + var getReplacerFunction = getJsonReplacerFunction; + var NATIVE_SYMBOL$1 = symbolConstructorDetection; + + var $String = String; + var $stringify = getBuiltIn$9('JSON', 'stringify'); + var exec$1 = uncurryThis$g(/./.exec); + var charAt$1 = uncurryThis$g(''.charAt); + var charCodeAt = uncurryThis$g(''.charCodeAt); + var replace$2 = uncurryThis$g(''.replace); + var numberToString = uncurryThis$g(1.0.toString); + + var tester = /[\uD800-\uDFFF]/g; + var low = /^[\uD800-\uDBFF]$/; + var hi = /^[\uDC00-\uDFFF]$/; + + var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL$1 || fails$k(function () { + var symbol = getBuiltIn$9('Symbol')('stringify detection'); + // MS Edge converts symbol values to JSON as {} + return $stringify([symbol]) !== '[null]' + // WebKit converts symbol values to JSON as null + || $stringify({ a: symbol }) !== '{}' + // V8 throws on boxed symbols + || $stringify(Object(symbol)) !== '{}'; + }); + + // https://github.com/tc39/proposal-well-formed-stringify + var ILL_FORMED_UNICODE = fails$k(function () { + return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' + || $stringify('\uDEAD') !== '"\\udead"'; + }); + + var stringifyWithSymbolsFix = function (it, replacer) { + var args = arraySlice$4(arguments); + var $replacer = getReplacerFunction(replacer); + if (!isCallable$6($replacer) && (it === undefined || isSymbol$1(it))) return; // IE8 returns string on undefined + args[1] = function (key, value) { + // some old implementations (like WebKit) could pass numbers as keys + if (isCallable$6($replacer)) value = call$8($replacer, this, $String(key), value); + if (!isSymbol$1(value)) return value; + }; + return apply$4($stringify, null, args); + }; + + var fixIllFormed = function (match, offset, string) { + var prev = charAt$1(string, offset - 1); + var next = charAt$1(string, offset + 1); + if ((exec$1(low, match) && !exec$1(hi, next)) || (exec$1(hi, match) && !exec$1(low, prev))) { + return '\\u' + numberToString(charCodeAt(match, 0), 16); + } return match; + }; + + if ($stringify) { + // `JSON.stringify` method + // https://tc39.es/ecma262/#sec-json.stringify + $$V({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + stringify: function stringify(it, replacer, space) { + var args = arraySlice$4(arguments); + var result = apply$4(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); + return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$2(result, tester, fixIllFormed) : result; + } + }); + } + + var $$U = _export; + var NATIVE_SYMBOL = symbolConstructorDetection; + var fails$j = fails$y; + var getOwnPropertySymbolsModule$2 = objectGetOwnPropertySymbols; + var toObject$9 = toObject$f; + + // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives + // https://bugs.chromium.org/p/v8/issues/detail?id=3443 + var FORCED$8 = !NATIVE_SYMBOL || fails$j(function () { getOwnPropertySymbolsModule$2.f(1); }); + + // `Object.getOwnPropertySymbols` method + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols + $$U({ target: 'Object', stat: true, forced: FORCED$8 }, { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + var $getOwnPropertySymbols = getOwnPropertySymbolsModule$2.f; + return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject$9(it)) : []; + } + }); + + var defineWellKnownSymbol$k = wellKnownSymbolDefine; + + // `Symbol.asyncIterator` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.asynciterator + defineWellKnownSymbol$k('asyncIterator'); + + var defineWellKnownSymbol$j = wellKnownSymbolDefine; + + // `Symbol.hasInstance` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.hasinstance + defineWellKnownSymbol$j('hasInstance'); + + var defineWellKnownSymbol$i = wellKnownSymbolDefine; + + // `Symbol.isConcatSpreadable` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable + defineWellKnownSymbol$i('isConcatSpreadable'); + + var defineWellKnownSymbol$h = wellKnownSymbolDefine; + + // `Symbol.iterator` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.iterator + defineWellKnownSymbol$h('iterator'); + + var defineWellKnownSymbol$g = wellKnownSymbolDefine; + + // `Symbol.match` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.match + defineWellKnownSymbol$g('match'); + + var defineWellKnownSymbol$f = wellKnownSymbolDefine; + + // `Symbol.matchAll` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.matchall + defineWellKnownSymbol$f('matchAll'); + + var defineWellKnownSymbol$e = wellKnownSymbolDefine; + + // `Symbol.replace` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.replace + defineWellKnownSymbol$e('replace'); + + var defineWellKnownSymbol$d = wellKnownSymbolDefine; + + // `Symbol.search` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.search + defineWellKnownSymbol$d('search'); + + var defineWellKnownSymbol$c = wellKnownSymbolDefine; + + // `Symbol.species` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.species + defineWellKnownSymbol$c('species'); + + var defineWellKnownSymbol$b = wellKnownSymbolDefine; + + // `Symbol.split` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.split + defineWellKnownSymbol$b('split'); + + var defineWellKnownSymbol$a = wellKnownSymbolDefine; + var defineSymbolToPrimitive = symbolDefineToPrimitive; + + // `Symbol.toPrimitive` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.toprimitive + defineWellKnownSymbol$a('toPrimitive'); + + // `Symbol.prototype[@@toPrimitive]` method + // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive + defineSymbolToPrimitive(); + + var getBuiltIn$8 = getBuiltIn$f; + var defineWellKnownSymbol$9 = wellKnownSymbolDefine; + var setToStringTag$3 = setToStringTag$7; + + // `Symbol.toStringTag` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.tostringtag + defineWellKnownSymbol$9('toStringTag'); + + // `Symbol.prototype[@@toStringTag]` property + // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag + setToStringTag$3(getBuiltIn$8('Symbol'), 'Symbol'); + + var defineWellKnownSymbol$8 = wellKnownSymbolDefine; + + // `Symbol.unscopables` well-known symbol + // https://tc39.es/ecma262/#sec-symbol.unscopables + defineWellKnownSymbol$8('unscopables'); + + var global$d = global$q; + var setToStringTag$2 = setToStringTag$7; + + // JSON[@@toStringTag] property + // https://tc39.es/ecma262/#sec-json-@@tostringtag + setToStringTag$2(global$d.JSON, 'JSON', true); + + var path$o = path$u; + + var symbol$5 = path$o.Symbol; + + var parent$1d = symbol$5; + + + var symbol$4 = parent$1d; + + var wellKnownSymbol$8 = wellKnownSymbol$p; + var defineProperty$4 = objectDefineProperty.f; + + var METADATA$1 = wellKnownSymbol$8('metadata'); + var FunctionPrototype$1 = Function.prototype; + + // Function.prototype[@@metadata] + // https://github.com/tc39/proposal-decorator-metadata + if (FunctionPrototype$1[METADATA$1] === undefined) { + defineProperty$4(FunctionPrototype$1, METADATA$1, { + value: null + }); + } + + var defineWellKnownSymbol$7 = wellKnownSymbolDefine; + + // `Symbol.asyncDispose` well-known symbol + // https://github.com/tc39/proposal-async-explicit-resource-management + defineWellKnownSymbol$7('asyncDispose'); + + var defineWellKnownSymbol$6 = wellKnownSymbolDefine; + + // `Symbol.dispose` well-known symbol + // https://github.com/tc39/proposal-explicit-resource-management + defineWellKnownSymbol$6('dispose'); + + // TODO: Remove from `core-js@4` + var defineWellKnownSymbol$5 = wellKnownSymbolDefine; + + // `Symbol.metadata` well-known symbol + // https://github.com/tc39/proposal-decorators + defineWellKnownSymbol$5('metadata'); + + var parent$1c = symbol$4; + + + + + + + var symbol$3 = parent$1c; + + var getBuiltIn$7 = getBuiltIn$f; + var uncurryThis$f = functionUncurryThis; + + var Symbol$4 = getBuiltIn$7('Symbol'); + var keyFor = Symbol$4.keyFor; + var thisSymbolValue$1 = uncurryThis$f(Symbol$4.prototype.valueOf); + + // `Symbol.isRegisteredSymbol` method + // https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol + var symbolIsRegistered = Symbol$4.isRegisteredSymbol || function isRegisteredSymbol(value) { + try { + return keyFor(thisSymbolValue$1(value)) !== undefined; + } catch (error) { + return false; + } + }; + + var $$T = _export; + var isRegisteredSymbol$1 = symbolIsRegistered; + + // `Symbol.isRegisteredSymbol` method + // https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol + $$T({ target: 'Symbol', stat: true }, { + isRegisteredSymbol: isRegisteredSymbol$1 + }); + + var shared = sharedExports; + var getBuiltIn$6 = getBuiltIn$f; + var uncurryThis$e = functionUncurryThis; + var isSymbol = isSymbol$5; + var wellKnownSymbol$7 = wellKnownSymbol$p; + + var Symbol$3 = getBuiltIn$6('Symbol'); + var $isWellKnownSymbol = Symbol$3.isWellKnownSymbol; + var getOwnPropertyNames = getBuiltIn$6('Object', 'getOwnPropertyNames'); + var thisSymbolValue = uncurryThis$e(Symbol$3.prototype.valueOf); + var WellKnownSymbolsStore = shared('wks'); + + for (var i$1 = 0, symbolKeys = getOwnPropertyNames(Symbol$3), symbolKeysLength = symbolKeys.length; i$1 < symbolKeysLength; i$1++) { + // some old engines throws on access to some keys like `arguments` or `caller` + try { + var symbolKey = symbolKeys[i$1]; + if (isSymbol(Symbol$3[symbolKey])) wellKnownSymbol$7(symbolKey); + } catch (error) { /* empty */ } + } + + // `Symbol.isWellKnownSymbol` method + // https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol + // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected + var symbolIsWellKnown = function isWellKnownSymbol(value) { + if ($isWellKnownSymbol && $isWellKnownSymbol(value)) return true; + try { + var symbol = thisSymbolValue(value); + for (var j = 0, keys = getOwnPropertyNames(WellKnownSymbolsStore), keysLength = keys.length; j < keysLength; j++) { + // eslint-disable-next-line eqeqeq -- polyfilled symbols case + if (WellKnownSymbolsStore[keys[j]] == symbol) return true; + } + } catch (error) { /* empty */ } + return false; + }; + + var $$S = _export; + var isWellKnownSymbol$1 = symbolIsWellKnown; + + // `Symbol.isWellKnownSymbol` method + // https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol + // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected + $$S({ target: 'Symbol', stat: true, forced: true }, { + isWellKnownSymbol: isWellKnownSymbol$1 + }); + + var defineWellKnownSymbol$4 = wellKnownSymbolDefine; + + // `Symbol.matcher` well-known symbol + // https://github.com/tc39/proposal-pattern-matching + defineWellKnownSymbol$4('matcher'); + + var defineWellKnownSymbol$3 = wellKnownSymbolDefine; + + // `Symbol.observable` well-known symbol + // https://github.com/tc39/proposal-observable + defineWellKnownSymbol$3('observable'); + + var $$R = _export; + var isRegisteredSymbol = symbolIsRegistered; + + // `Symbol.isRegistered` method + // obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol + $$R({ target: 'Symbol', stat: true, name: 'isRegisteredSymbol' }, { + isRegistered: isRegisteredSymbol + }); + + var $$Q = _export; + var isWellKnownSymbol = symbolIsWellKnown; + + // `Symbol.isWellKnown` method + // obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol + // We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected + $$Q({ target: 'Symbol', stat: true, name: 'isWellKnownSymbol', forced: true }, { + isWellKnown: isWellKnownSymbol + }); + + var defineWellKnownSymbol$2 = wellKnownSymbolDefine; + + // `Symbol.metadataKey` well-known symbol + // https://github.com/tc39/proposal-decorator-metadata + defineWellKnownSymbol$2('metadataKey'); + + // TODO: remove from `core-js@4` + var defineWellKnownSymbol$1 = wellKnownSymbolDefine; + + // `Symbol.patternMatch` well-known symbol + // https://github.com/tc39/proposal-pattern-matching + defineWellKnownSymbol$1('patternMatch'); + + // TODO: remove from `core-js@4` + var defineWellKnownSymbol = wellKnownSymbolDefine; + + defineWellKnownSymbol('replaceAll'); + + var parent$1b = symbol$3; + + + + + // TODO: Remove from `core-js@4` + + + + + + + var symbol$2 = parent$1b; + + var symbol$1 = symbol$2; + + var _Symbol$1 = /*@__PURE__*/getDefaultExportFromCjs(symbol$1); + + var WrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped; + + var iterator$5 = WrappedWellKnownSymbolModule$1.f('iterator'); + + var parent$1a = iterator$5; + + + var iterator$4 = parent$1a; + + var parent$19 = iterator$4; + + var iterator$3 = parent$19; + + var parent$18 = iterator$3; + + var iterator$2 = parent$18; + + var iterator$1 = iterator$2; + + var _Symbol$iterator$1 = /*@__PURE__*/getDefaultExportFromCjs(iterator$1); + + function _typeof$1(o) { + "@babel/helpers - typeof"; + + return _typeof$1 = "function" == typeof _Symbol$1 && "symbol" == typeof _Symbol$iterator$1 ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof _Symbol$1 && o.constructor === _Symbol$1 && o !== _Symbol$1.prototype ? "symbol" : typeof o; + }, _typeof$1(o); + } + + var WrappedWellKnownSymbolModule = wellKnownSymbolWrapped; + + var toPrimitive$4 = WrappedWellKnownSymbolModule.f('toPrimitive'); + + var parent$17 = toPrimitive$4; + + var toPrimitive$3 = parent$17; + + var parent$16 = toPrimitive$3; + + var toPrimitive$2 = parent$16; + + var parent$15 = toPrimitive$2; + + var toPrimitive$1 = parent$15; + + var toPrimitive = toPrimitive$1; + + var _Symbol$toPrimitive = /*@__PURE__*/getDefaultExportFromCjs(toPrimitive); + + function _toPrimitive(input, hint) { + if (_typeof$1(input) !== "object" || input === null) return input; + var prim = input[_Symbol$toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (_typeof$1(res) !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return _typeof$1(key) === "symbol" ? key : String(key); + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + _Object$defineProperty$1(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + _Object$defineProperty$1(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + var $$P = _export; + var isArray$a = isArray$e; + + // `Array.isArray` method + // https://tc39.es/ecma262/#sec-array.isarray + $$P({ target: 'Array', stat: true }, { + isArray: isArray$a + }); + + var path$n = path$u; + + var isArray$9 = path$n.Array.isArray; + + var parent$14 = isArray$9; + + var isArray$8 = parent$14; + + var parent$13 = isArray$8; + + var isArray$7 = parent$13; + + var parent$12 = isArray$7; + + var isArray$6 = parent$12; + + var isArray$5 = isArray$6; + + var _Array$isArray$1 = /*@__PURE__*/getDefaultExportFromCjs(isArray$5); + + function _arrayWithHoles(arr) { + if (_Array$isArray$1(arr)) return arr; + } + + var DESCRIPTORS$9 = descriptors; + var isArray$4 = isArray$e; + + var $TypeError$8 = TypeError; + // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + var getOwnPropertyDescriptor$5 = Object.getOwnPropertyDescriptor; + + // Safari < 13 does not throw an error in this case + var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS$9 && !function () { + // makes no sense without proper strict mode support + if (this !== undefined) return true; + try { + // eslint-disable-next-line es/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).length = 1; + } catch (error) { + return error instanceof TypeError; + } + }(); + + var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) { + if (isArray$4(O) && !getOwnPropertyDescriptor$5(O, 'length').writable) { + throw new $TypeError$8('Cannot set read only .length'); + } return O.length = length; + } : function (O, length) { + return O.length = length; + }; + + var $$O = _export; + var toObject$8 = toObject$f; + var lengthOfArrayLike$8 = lengthOfArrayLike$e; + var setArrayLength$1 = arraySetLength; + var doesNotExceedSafeInteger$2 = doesNotExceedSafeInteger$4; + var fails$i = fails$y; + + var INCORRECT_TO_LENGTH = fails$i(function () { + return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; + }); + + // V8 and Safari <= 15.4, FF < 23 throws InternalError + // https://bugs.chromium.org/p/v8/issues/detail?id=12681 + var properErrorOnNonWritableLength = function () { + try { + // eslint-disable-next-line es/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).push(); + } catch (error) { + return error instanceof TypeError; + } + }; + + var FORCED$7 = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength(); + + // `Array.prototype.push` method + // https://tc39.es/ecma262/#sec-array.prototype.push + $$O({ target: 'Array', proto: true, arity: 1, forced: FORCED$7 }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + push: function push(item) { + var O = toObject$8(this); + var len = lengthOfArrayLike$8(O); + var argCount = arguments.length; + doesNotExceedSafeInteger$2(len + argCount); + for (var i = 0; i < argCount; i++) { + O[len] = arguments[i]; + len++; + } + setArrayLength$1(O, len); + return len; + } + }); + + var path$m = path$u; + + var entryVirtual$o = function (CONSTRUCTOR) { + return path$m[CONSTRUCTOR + 'Prototype']; + }; + + var entryVirtual$n = entryVirtual$o; + + var push$9 = entryVirtual$n('Array').push; + + var isPrototypeOf$p = objectIsPrototypeOf; + var method$l = push$9; + + var ArrayPrototype$k = Array.prototype; + + var push$8 = function (it) { + var own = it.push; + return it === ArrayPrototype$k || (isPrototypeOf$p(ArrayPrototype$k, it) && own === ArrayPrototype$k.push) ? method$l : own; + }; + + var parent$11 = push$8; + + var push$7 = parent$11; + + var parent$10 = push$7; + + var push$6 = parent$10; + + var parent$$ = push$6; + + var push$5 = parent$$; + + var push$4 = push$5; + + var _pushInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(push$4); + + function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof _Symbol$1 && _getIteratorMethod$1(r) || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (_pushInstanceProperty(a).call(a, e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } + } + + var $$N = _export; + var isArray$3 = isArray$e; + var isConstructor$1 = isConstructor$4; + var isObject$a = isObject$j; + var toAbsoluteIndex$2 = toAbsoluteIndex$5; + var lengthOfArrayLike$7 = lengthOfArrayLike$e; + var toIndexedObject$3 = toIndexedObject$b; + var createProperty$2 = createProperty$6; + var wellKnownSymbol$6 = wellKnownSymbol$p; + var arrayMethodHasSpeciesSupport$3 = arrayMethodHasSpeciesSupport$5; + var nativeSlice = arraySlice$5; + + var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport$3('slice'); + + var SPECIES$3 = wellKnownSymbol$6('species'); + var $Array = Array; + var max$1 = Math.max; + + // `Array.prototype.slice` method + // https://tc39.es/ecma262/#sec-array.prototype.slice + // fallback for not array-like ES3 strings and DOM objects + $$N({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, { + slice: function slice(start, end) { + var O = toIndexedObject$3(this); + var length = lengthOfArrayLike$7(O); + var k = toAbsoluteIndex$2(start, length); + var fin = toAbsoluteIndex$2(end === undefined ? length : end, length); + // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible + var Constructor, result, n; + if (isArray$3(O)) { + Constructor = O.constructor; + // cross-realm fallback + if (isConstructor$1(Constructor) && (Constructor === $Array || isArray$3(Constructor.prototype))) { + Constructor = undefined; + } else if (isObject$a(Constructor)) { + Constructor = Constructor[SPECIES$3]; + if (Constructor === null) Constructor = undefined; + } + if (Constructor === $Array || Constructor === undefined) { + return nativeSlice(O, k, fin); + } + } + result = new (Constructor === undefined ? $Array : Constructor)(max$1(fin - k, 0)); + for (n = 0; k < fin; k++, n++) if (k in O) createProperty$2(result, n, O[k]); + result.length = n; + return result; + } + }); + + var entryVirtual$m = entryVirtual$o; + + var slice$6 = entryVirtual$m('Array').slice; + + var isPrototypeOf$o = objectIsPrototypeOf; + var method$k = slice$6; + + var ArrayPrototype$j = Array.prototype; + + var slice$5 = function (it) { + var own = it.slice; + return it === ArrayPrototype$j || (isPrototypeOf$o(ArrayPrototype$j, it) && own === ArrayPrototype$j.slice) ? method$k : own; + }; + + var parent$_ = slice$5; + + var slice$4 = parent$_; + + var parent$Z = slice$4; + + var slice$3 = parent$Z; + + var parent$Y = slice$3; + + var slice$2 = parent$Y; + + var slice$1 = slice$2; + + var _sliceInstanceProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(slice$1); + + var parent$X = from$4; + + var from$2 = parent$X; + + var parent$W = from$2; + + var from$1 = parent$W; + + var from = from$1; + + var _Array$from = /*@__PURE__*/getDefaultExportFromCjs(from); + + function _arrayLikeToArray$8(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + + function _unsupportedIterableToArray$8(o, minLen) { + var _context; + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$8(o, minLen); + var n = _sliceInstanceProperty$1(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return _Array$from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest(); + } + + function _arrayWithoutHoles(arr) { + if (_Array$isArray$1(arr)) return _arrayLikeToArray$8(arr); + } + + function _iterableToArray(iter) { + if (typeof _Symbol$1 !== "undefined" && _getIteratorMethod$1(iter) != null || iter["@@iterator"] != null) return _Array$from(iter); + } + + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$8(arr) || _nonIterableSpread(); + } + + var symbol = symbol$4; + + var _Symbol = /*@__PURE__*/getDefaultExportFromCjs(symbol); + + var entryVirtual$l = entryVirtual$o; + + var concat$6 = entryVirtual$l('Array').concat; + + var isPrototypeOf$n = objectIsPrototypeOf; + var method$j = concat$6; + + var ArrayPrototype$i = Array.prototype; + + var concat$5 = function (it) { + var own = it.concat; + return it === ArrayPrototype$i || (isPrototypeOf$n(ArrayPrototype$i, it) && own === ArrayPrototype$i.concat) ? method$j : own; + }; + + var parent$V = concat$5; + + var concat$4 = parent$V; + + var concat$3 = concat$4; + + var _concatInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(concat$3); + + var slice = slice$4; + + var _sliceInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(slice); + + var getBuiltIn$5 = getBuiltIn$f; + var uncurryThis$d = functionUncurryThis; + var getOwnPropertyNamesModule$1 = objectGetOwnPropertyNames; + var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols; + var anObject$4 = anObject$d; + + var concat$2 = uncurryThis$d([].concat); + + // all object keys, includes non-enumerable and symbols + var ownKeys$8 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) { + var keys = getOwnPropertyNamesModule$1.f(anObject$4(it)); + var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f; + return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys; + }; + + var $$M = _export; + var ownKeys$7 = ownKeys$8; + + // `Reflect.ownKeys` method + // https://tc39.es/ecma262/#sec-reflect.ownkeys + $$M({ target: 'Reflect', stat: true }, { + ownKeys: ownKeys$7 + }); + + var path$l = path$u; + + var ownKeys$6 = path$l.Reflect.ownKeys; + + var parent$U = ownKeys$6; + + var ownKeys$5 = parent$U; + + var ownKeys$4 = ownKeys$5; + + var _Reflect$ownKeys = /*@__PURE__*/getDefaultExportFromCjs(ownKeys$4); + + var isArray$2 = isArray$8; + + var _Array$isArray = /*@__PURE__*/getDefaultExportFromCjs(isArray$2); + + var $$L = _export; + var $map = arrayIteration.map; + var arrayMethodHasSpeciesSupport$2 = arrayMethodHasSpeciesSupport$5; + + var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport$2('map'); + + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + // with adding support of @@species + $$L({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$k = entryVirtual$o; + + var map$6 = entryVirtual$k('Array').map; + + var isPrototypeOf$m = objectIsPrototypeOf; + var method$i = map$6; + + var ArrayPrototype$h = Array.prototype; + + var map$5 = function (it) { + var own = it.map; + return it === ArrayPrototype$h || (isPrototypeOf$m(ArrayPrototype$h, it) && own === ArrayPrototype$h.map) ? method$i : own; + }; + + var parent$T = map$5; + + var map$4 = parent$T; + + var map$3 = map$4; + + var _mapInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(map$3); + + var $$K = _export; + var toObject$7 = toObject$f; + var nativeKeys = objectKeys$4; + var fails$h = fails$y; + + var FAILS_ON_PRIMITIVES$2 = fails$h(function () { nativeKeys(1); }); + + // `Object.keys` method + // https://tc39.es/ecma262/#sec-object.keys + $$K({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$2 }, { + keys: function keys(it) { + return nativeKeys(toObject$7(it)); + } + }); + + var path$k = path$u; + + var keys$6 = path$k.Object.keys; + + var parent$S = keys$6; + + var keys$5 = parent$S; + + var keys$4 = keys$5; + + var _Object$keys = /*@__PURE__*/getDefaultExportFromCjs(keys$4); + + // TODO: Remove from `core-js@4` + var $$J = _export; + var uncurryThis$c = functionUncurryThis; + + var $Date = Date; + var thisTimeValue = uncurryThis$c($Date.prototype.getTime); + + // `Date.now` method + // https://tc39.es/ecma262/#sec-date.now + $$J({ target: 'Date', stat: true }, { + now: function now() { + return thisTimeValue(new $Date()); + } + }); + + var path$j = path$u; + + var now$3 = path$j.Date.now; + + var parent$R = now$3; + + var now$2 = parent$R; + + var now$1 = now$2; + + var _Date$now = /*@__PURE__*/getDefaultExportFromCjs(now$1); + + var uncurryThis$b = functionUncurryThis; + var aCallable$9 = aCallable$e; + var isObject$9 = isObject$j; + var hasOwn$7 = hasOwnProperty_1; + var arraySlice$3 = arraySlice$5; + var NATIVE_BIND = functionBindNative; + + var $Function = Function; + var concat$1 = uncurryThis$b([].concat); + var join = uncurryThis$b([].join); + var factories = {}; + + var construct$3 = function (C, argsLength, args) { + if (!hasOwn$7(factories, argsLength)) { + var list = []; + var i = 0; + for (; i < argsLength; i++) list[i] = 'a[' + i + ']'; + factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')'); + } return factories[argsLength](C, args); + }; + + // `Function.prototype.bind` method implementation + // https://tc39.es/ecma262/#sec-function.prototype.bind + // eslint-disable-next-line es/no-function-prototype-bind -- detection + var functionBind = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) { + var F = aCallable$9(this); + var Prototype = F.prototype; + var partArgs = arraySlice$3(arguments, 1); + var boundFunction = function bound(/* args... */) { + var args = concat$1(partArgs, arraySlice$3(arguments)); + return this instanceof boundFunction ? construct$3(F, args.length, args) : F.apply(that, args); + }; + if (isObject$9(Prototype)) boundFunction.prototype = Prototype; + return boundFunction; + }; + + // TODO: Remove from `core-js@4` + var $$I = _export; + var bind$e = functionBind; + + // `Function.prototype.bind` method + // https://tc39.es/ecma262/#sec-function.prototype.bind + // eslint-disable-next-line es/no-function-prototype-bind -- detection + $$I({ target: 'Function', proto: true, forced: Function.bind !== bind$e }, { + bind: bind$e + }); + + var entryVirtual$j = entryVirtual$o; + + var bind$d = entryVirtual$j('Function').bind; + + var isPrototypeOf$l = objectIsPrototypeOf; + var method$h = bind$d; + + var FunctionPrototype = Function.prototype; + + var bind$c = function (it) { + var own = it.bind; + return it === FunctionPrototype || (isPrototypeOf$l(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method$h : own; + }; + + var parent$Q = bind$c; + + var bind$b = parent$Q; + + var bind$a = bind$b; + + var _bindInstanceProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(bind$a); + + var fails$g = fails$y; + + var arrayMethodIsStrict$6 = function (METHOD_NAME, argument) { + var method = [][METHOD_NAME]; + return !!method && fails$g(function () { + // eslint-disable-next-line no-useless-call -- required for testing + method.call(null, argument || function () { return 1; }, 1); + }); + }; + + var $forEach = arrayIteration.forEach; + var arrayMethodIsStrict$5 = arrayMethodIsStrict$6; + + var STRICT_METHOD$3 = arrayMethodIsStrict$5('forEach'); + + // `Array.prototype.forEach` method implementation + // https://tc39.es/ecma262/#sec-array.prototype.foreach + var arrayForEach = !STRICT_METHOD$3 ? function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + // eslint-disable-next-line es/no-array-prototype-foreach -- safe + } : [].forEach; + + var $$H = _export; + var forEach$9 = arrayForEach; + + // `Array.prototype.forEach` method + // https://tc39.es/ecma262/#sec-array.prototype.foreach + // eslint-disable-next-line es/no-array-prototype-foreach -- safe + $$H({ target: 'Array', proto: true, forced: [].forEach !== forEach$9 }, { + forEach: forEach$9 + }); + + var entryVirtual$i = entryVirtual$o; + + var forEach$8 = entryVirtual$i('Array').forEach; + + var parent$P = forEach$8; + + var forEach$7 = parent$P; + + var classof$6 = classof$g; + var hasOwn$6 = hasOwnProperty_1; + var isPrototypeOf$k = objectIsPrototypeOf; + var method$g = forEach$7; + + var ArrayPrototype$g = Array.prototype; + + var DOMIterables$3 = { + DOMTokenList: true, + NodeList: true + }; + + var forEach$6 = function (it) { + var own = it.forEach; + return it === ArrayPrototype$g || (isPrototypeOf$k(ArrayPrototype$g, it) && own === ArrayPrototype$g.forEach) + || hasOwn$6(DOMIterables$3, classof$6(it)) ? method$g : own; + }; + + var forEach$5 = forEach$6; + + var _forEachInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(forEach$5); + + var $$G = _export; + var uncurryThis$a = functionUncurryThis; + var isArray$1 = isArray$e; + + var nativeReverse = uncurryThis$a([].reverse); + var test$1 = [1, 2]; + + // `Array.prototype.reverse` method + // https://tc39.es/ecma262/#sec-array.prototype.reverse + // fix for Safari 12.0 bug + // https://bugs.webkit.org/show_bug.cgi?id=188794 + $$G({ target: 'Array', proto: true, forced: String(test$1) === String(test$1.reverse()) }, { + reverse: function reverse() { + // eslint-disable-next-line no-self-assign -- dirty hack + if (isArray$1(this)) this.length = this.length; + return nativeReverse(this); + } + }); + + var entryVirtual$h = entryVirtual$o; + + var reverse$6 = entryVirtual$h('Array').reverse; + + var isPrototypeOf$j = objectIsPrototypeOf; + var method$f = reverse$6; + + var ArrayPrototype$f = Array.prototype; + + var reverse$5 = function (it) { + var own = it.reverse; + return it === ArrayPrototype$f || (isPrototypeOf$j(ArrayPrototype$f, it) && own === ArrayPrototype$f.reverse) ? method$f : own; + }; + + var parent$O = reverse$5; + + var reverse$4 = parent$O; + + var reverse$3 = reverse$4; + + var _reverseInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(reverse$3); + + var tryToString$2 = tryToString$6; + + var $TypeError$7 = TypeError; + + var deletePropertyOrThrow$2 = function (O, P) { + if (!delete O[P]) throw new $TypeError$7('Cannot delete property ' + tryToString$2(P) + ' of ' + tryToString$2(O)); + }; + + var $$F = _export; + var toObject$6 = toObject$f; + var toAbsoluteIndex$1 = toAbsoluteIndex$5; + var toIntegerOrInfinity$1 = toIntegerOrInfinity$5; + var lengthOfArrayLike$6 = lengthOfArrayLike$e; + var setArrayLength = arraySetLength; + var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$4; + var arraySpeciesCreate$1 = arraySpeciesCreate$4; + var createProperty$1 = createProperty$6; + var deletePropertyOrThrow$1 = deletePropertyOrThrow$2; + var arrayMethodHasSpeciesSupport$1 = arrayMethodHasSpeciesSupport$5; + + var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('splice'); + + var max = Math.max; + var min = Math.min; + + // `Array.prototype.splice` method + // https://tc39.es/ecma262/#sec-array.prototype.splice + // with adding support of @@species + $$F({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { + splice: function splice(start, deleteCount /* , ...items */) { + var O = toObject$6(this); + var len = lengthOfArrayLike$6(O); + var actualStart = toAbsoluteIndex$1(start, len); + var argumentsLength = arguments.length; + var insertCount, actualDeleteCount, A, k, from, to; + if (argumentsLength === 0) { + insertCount = actualDeleteCount = 0; + } else if (argumentsLength === 1) { + insertCount = 0; + actualDeleteCount = len - actualStart; + } else { + insertCount = argumentsLength - 2; + actualDeleteCount = min(max(toIntegerOrInfinity$1(deleteCount), 0), len - actualStart); + } + doesNotExceedSafeInteger$1(len + insertCount - actualDeleteCount); + A = arraySpeciesCreate$1(O, actualDeleteCount); + for (k = 0; k < actualDeleteCount; k++) { + from = actualStart + k; + if (from in O) createProperty$1(A, k, O[from]); + } + A.length = actualDeleteCount; + if (insertCount < actualDeleteCount) { + for (k = actualStart; k < len - actualDeleteCount; k++) { + from = k + actualDeleteCount; + to = k + insertCount; + if (from in O) O[to] = O[from]; + else deletePropertyOrThrow$1(O, to); + } + for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow$1(O, k - 1); + } else if (insertCount > actualDeleteCount) { + for (k = len - actualDeleteCount; k > actualStart; k--) { + from = k + actualDeleteCount - 1; + to = k + insertCount - 1; + if (from in O) O[to] = O[from]; + else deletePropertyOrThrow$1(O, to); + } + } + for (k = 0; k < insertCount; k++) { + O[k + actualStart] = arguments[k + 2]; + } + setArrayLength(O, len - actualDeleteCount + insertCount); + return A; + } + }); + + var entryVirtual$g = entryVirtual$o; + + var splice$3 = entryVirtual$g('Array').splice; + + var isPrototypeOf$i = objectIsPrototypeOf; + var method$e = splice$3; + + var ArrayPrototype$e = Array.prototype; + + var splice$2 = function (it) { + var own = it.splice; + return it === ArrayPrototype$e || (isPrototypeOf$i(ArrayPrototype$e, it) && own === ArrayPrototype$e.splice) ? method$e : own; + }; + + var parent$N = splice$2; + + var splice$1 = parent$N; + + var splice = splice$1; + + var _spliceInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(splice); + + var DESCRIPTORS$8 = descriptors; + var uncurryThis$9 = functionUncurryThis; + var call$7 = functionCall; + var fails$f = fails$y; + var objectKeys$1 = objectKeys$4; + var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; + var propertyIsEnumerableModule = objectPropertyIsEnumerable; + var toObject$5 = toObject$f; + var IndexedObject$1 = indexedObject; + + // eslint-disable-next-line es/no-object-assign -- safe + var $assign = Object.assign; + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + var defineProperty$3 = Object.defineProperty; + var concat = uncurryThis$9([].concat); + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + var objectAssign = !$assign || fails$f(function () { + // should have correct order of operations (Edge bug) + if (DESCRIPTORS$8 && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', { + enumerable: true, + get: function () { + defineProperty$3(this, 'b', { + value: 3, + enumerable: false + }); + } + }), { b: 2 })).b !== 1) return true; + // should work with symbols and should have deterministic property order (V8 bug) + var A = {}; + var B = {}; + // eslint-disable-next-line es/no-symbol -- safe + var symbol = Symbol('assign detection'); + var alphabet = 'abcdefghijklmnopqrst'; + A[symbol] = 7; + alphabet.split('').forEach(function (chr) { B[chr] = chr; }); + return $assign({}, A)[symbol] !== 7 || objectKeys$1($assign({}, B)).join('') !== alphabet; + }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` + var T = toObject$5(target); + var argumentsLength = arguments.length; + var index = 1; + var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; + var propertyIsEnumerable = propertyIsEnumerableModule.f; + while (argumentsLength > index) { + var S = IndexedObject$1(arguments[index++]); + var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) { + key = keys[j++]; + if (!DESCRIPTORS$8 || call$7(propertyIsEnumerable, S, key)) T[key] = S[key]; + } + } return T; + } : $assign; + + var $$E = _export; + var assign$5 = objectAssign; + + // `Object.assign` method + // https://tc39.es/ecma262/#sec-object.assign + // eslint-disable-next-line es/no-object-assign -- required for testing + $$E({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign$5 }, { + assign: assign$5 + }); + + var path$i = path$u; + + var assign$4 = path$i.Object.assign; + + var parent$M = assign$4; + + var assign$3 = parent$M; + + var assign$2 = assign$3; + + var _Object$assign = /*@__PURE__*/getDefaultExportFromCjs(assign$2); + + var $$D = _export; + var $includes = arrayIncludes.includes; + var fails$e = fails$y; + + // FF99+ bug + var BROKEN_ON_SPARSE = fails$e(function () { + // eslint-disable-next-line es/no-array-prototype-includes -- detection + return !Array(1).includes(); + }); + + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + $$D({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$f = entryVirtual$o; + + var includes$4 = entryVirtual$f('Array').includes; + + var isObject$8 = isObject$j; + var classof$5 = classofRaw$2; + var wellKnownSymbol$5 = wellKnownSymbol$p; + + var MATCH$1 = wellKnownSymbol$5('match'); + + // `IsRegExp` abstract operation + // https://tc39.es/ecma262/#sec-isregexp + var isRegexp = function (it) { + var isRegExp; + return isObject$8(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$5(it) === 'RegExp'); + }; + + var isRegExp = isRegexp; + + var $TypeError$6 = TypeError; + + var notARegexp = function (it) { + if (isRegExp(it)) { + throw new $TypeError$6("The method doesn't accept regular expressions"); + } return it; + }; + + var wellKnownSymbol$4 = wellKnownSymbol$p; + + var MATCH = wellKnownSymbol$4('match'); + + var correctIsRegexpLogic = function (METHOD_NAME) { + var regexp = /./; + try { + '/./'[METHOD_NAME](regexp); + } catch (error1) { + try { + regexp[MATCH] = false; + return '/./'[METHOD_NAME](regexp); + } catch (error2) { /* empty */ } + } return false; + }; + + var $$C = _export; + var uncurryThis$8 = functionUncurryThis; + var notARegExp = notARegexp; + var requireObjectCoercible$2 = requireObjectCoercible$6; + var toString$6 = toString$c; + var correctIsRegExpLogic = correctIsRegexpLogic; + + var stringIndexOf = uncurryThis$8(''.indexOf); + + // `String.prototype.includes` method + // https://tc39.es/ecma262/#sec-string.prototype.includes + $$C({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, { + includes: function includes(searchString /* , position = 0 */) { + return !!~stringIndexOf( + toString$6(requireObjectCoercible$2(this)), + toString$6(notARegExp(searchString)), + arguments.length > 1 ? arguments[1] : undefined + ); + } + }); + + var entryVirtual$e = entryVirtual$o; + + var includes$3 = entryVirtual$e('String').includes; + + var isPrototypeOf$h = objectIsPrototypeOf; + var arrayMethod = includes$4; + var stringMethod = includes$3; + + var ArrayPrototype$d = Array.prototype; + var StringPrototype$1 = String.prototype; + + var includes$2 = function (it) { + var own = it.includes; + if (it === ArrayPrototype$d || (isPrototypeOf$h(ArrayPrototype$d, it) && own === ArrayPrototype$d.includes)) return arrayMethod; + if (typeof it == 'string' || it === StringPrototype$1 || (isPrototypeOf$h(StringPrototype$1, it) && own === StringPrototype$1.includes)) { + return stringMethod; + } return own; + }; + + var parent$L = includes$2; + + var includes$1 = parent$L; + + var includes = includes$1; + + var _includesInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(includes); + + var $$B = _export; + var fails$d = fails$y; + var toObject$4 = toObject$f; + var nativeGetPrototypeOf = objectGetPrototypeOf$1; + var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter; + + var FAILS_ON_PRIMITIVES$1 = fails$d(function () { nativeGetPrototypeOf(1); }); + + // `Object.getPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.getprototypeof + $$B({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$1, sham: !CORRECT_PROTOTYPE_GETTER }, { + getPrototypeOf: function getPrototypeOf(it) { + return nativeGetPrototypeOf(toObject$4(it)); + } + }); + + var path$h = path$u; + + var getPrototypeOf$6 = path$h.Object.getPrototypeOf; + + var parent$K = getPrototypeOf$6; + + var getPrototypeOf$5 = parent$K; + + var getPrototypeOf$4 = getPrototypeOf$5; + + var _Object$getPrototypeOf$1 = /*@__PURE__*/getDefaultExportFromCjs(getPrototypeOf$4); + + var $$A = _export; + var $filter = arrayIteration.filter; + var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$5; + + var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); + + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + // with adding support of @@species + $$A({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$d = entryVirtual$o; + + var filter$3 = entryVirtual$d('Array').filter; + + var isPrototypeOf$g = objectIsPrototypeOf; + var method$d = filter$3; + + var ArrayPrototype$c = Array.prototype; + + var filter$2 = function (it) { + var own = it.filter; + return it === ArrayPrototype$c || (isPrototypeOf$g(ArrayPrototype$c, it) && own === ArrayPrototype$c.filter) ? method$d : own; + }; + + var parent$J = filter$2; + + var filter$1 = parent$J; + + var filter = filter$1; + + var _filterInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(filter); + + var DESCRIPTORS$7 = descriptors; + var fails$c = fails$y; + var uncurryThis$7 = functionUncurryThis; + var objectGetPrototypeOf = objectGetPrototypeOf$1; + var objectKeys = objectKeys$4; + var toIndexedObject$2 = toIndexedObject$b; + var $propertyIsEnumerable = objectPropertyIsEnumerable.f; + + var propertyIsEnumerable = uncurryThis$7($propertyIsEnumerable); + var push$3 = uncurryThis$7([].push); + + // in some IE versions, `propertyIsEnumerable` returns incorrect result on integer keys + // of `null` prototype objects + var IE_BUG = DESCRIPTORS$7 && fails$c(function () { + // eslint-disable-next-line es/no-object-create -- safe + var O = Object.create(null); + O[2] = 2; + return !propertyIsEnumerable(O, 2); + }); + + // `Object.{ entries, values }` methods implementation + var createMethod$2 = function (TO_ENTRIES) { + return function (it) { + var O = toIndexedObject$2(it); + var keys = objectKeys(O); + var IE_WORKAROUND = IE_BUG && objectGetPrototypeOf(O) === null; + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) { + key = keys[i++]; + if (!DESCRIPTORS$7 || (IE_WORKAROUND ? key in O : propertyIsEnumerable(O, key))) { + push$3(result, TO_ENTRIES ? [key, O[key]] : O[key]); + } + } + return result; + }; + }; + + var objectToArray = { + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + entries: createMethod$2(true), + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + values: createMethod$2(false) + }; + + var $$z = _export; + var $values = objectToArray.values; + + // `Object.values` method + // https://tc39.es/ecma262/#sec-object.values + $$z({ target: 'Object', stat: true }, { + values: function values(O) { + return $values(O); + } + }); + + var path$g = path$u; + + var values$6 = path$g.Object.values; + + var parent$I = values$6; + + var values$5 = parent$I; + + var values$4 = values$5; + + var _Object$values2 = /*@__PURE__*/getDefaultExportFromCjs(values$4); + + // a string of all valid unicode whitespaces + var whitespaces$3 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + + var uncurryThis$6 = functionUncurryThis; + var requireObjectCoercible$1 = requireObjectCoercible$6; + var toString$5 = toString$c; + var whitespaces$2 = whitespaces$3; + + var replace$1 = uncurryThis$6(''.replace); + var ltrim = RegExp('^[' + whitespaces$2 + ']+'); + var rtrim = RegExp('(^|[^' + whitespaces$2 + '])[' + whitespaces$2 + ']+$'); + + // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation + var createMethod$1 = function (TYPE) { + return function ($this) { + var string = toString$5(requireObjectCoercible$1($this)); + if (TYPE & 1) string = replace$1(string, ltrim, ''); + if (TYPE & 2) string = replace$1(string, rtrim, '$1'); + return string; + }; + }; + + var stringTrim = { + // `String.prototype.{ trimLeft, trimStart }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + start: createMethod$1(1), + // `String.prototype.{ trimRight, trimEnd }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimend + end: createMethod$1(2), + // `String.prototype.trim` method + // https://tc39.es/ecma262/#sec-string.prototype.trim + trim: createMethod$1(3) + }; + + var global$c = global$q; + var fails$b = fails$y; + var uncurryThis$5 = functionUncurryThis; + var toString$4 = toString$c; + var trim$1 = stringTrim.trim; + var whitespaces$1 = whitespaces$3; + + var $parseInt$1 = global$c.parseInt; + var Symbol$2 = global$c.Symbol; + var ITERATOR$1 = Symbol$2 && Symbol$2.iterator; + var hex = /^[+-]?0x/i; + var exec = uncurryThis$5(hex.exec); + var FORCED$6 = $parseInt$1(whitespaces$1 + '08') !== 8 || $parseInt$1(whitespaces$1 + '0x16') !== 22 + // MS Edge 18- broken with boxed symbols + || (ITERATOR$1 && !fails$b(function () { $parseInt$1(Object(ITERATOR$1)); })); + + // `parseInt` method + // https://tc39.es/ecma262/#sec-parseint-string-radix + var numberParseInt = FORCED$6 ? function parseInt(string, radix) { + var S = trim$1(toString$4(string)); + return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10)); + } : $parseInt$1; + + var $$y = _export; + var $parseInt = numberParseInt; + + // `parseInt` method + // https://tc39.es/ecma262/#sec-parseint-string-radix + $$y({ global: true, forced: parseInt !== $parseInt }, { + parseInt: $parseInt + }); + + var path$f = path$u; + + var _parseInt$3 = path$f.parseInt; + + var parent$H = _parseInt$3; + + var _parseInt$2 = parent$H; + + var _parseInt = _parseInt$2; + + var _parseInt$1 = /*@__PURE__*/getDefaultExportFromCjs(_parseInt); + + /* eslint-disable es/no-array-prototype-indexof -- required for testing */ + var $$x = _export; + var uncurryThis$4 = functionUncurryThisClause; + var $indexOf = arrayIncludes.indexOf; + var arrayMethodIsStrict$4 = arrayMethodIsStrict$6; + + var nativeIndexOf = uncurryThis$4([].indexOf); + + var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0; + var FORCED$5 = NEGATIVE_ZERO || !arrayMethodIsStrict$4('indexOf'); + + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + $$x({ target: 'Array', proto: true, forced: FORCED$5 }, { + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + var fromIndex = arguments.length > 1 ? arguments[1] : undefined; + return NEGATIVE_ZERO + // convert -0 to +0 + ? nativeIndexOf(this, searchElement, fromIndex) || 0 + : $indexOf(this, searchElement, fromIndex); + } + }); + + var entryVirtual$c = entryVirtual$o; + + var indexOf$3 = entryVirtual$c('Array').indexOf; + + var isPrototypeOf$f = objectIsPrototypeOf; + var method$c = indexOf$3; + + var ArrayPrototype$b = Array.prototype; + + var indexOf$2 = function (it) { + var own = it.indexOf; + return it === ArrayPrototype$b || (isPrototypeOf$f(ArrayPrototype$b, it) && own === ArrayPrototype$b.indexOf) ? method$c : own; + }; + + var parent$G = indexOf$2; + + var indexOf$1 = parent$G; + + var indexOf = indexOf$1; + + var _indexOfInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(indexOf); + + var $$w = _export; + var $entries = objectToArray.entries; + + // `Object.entries` method + // https://tc39.es/ecma262/#sec-object.entries + $$w({ target: 'Object', stat: true }, { + entries: function entries(O) { + return $entries(O); + } + }); + + var path$e = path$u; + + var entries$6 = path$e.Object.entries; + + var parent$F = entries$6; + + var entries$5 = parent$F; + + var entries$4 = entries$5; + + var _Object$entries2 = /*@__PURE__*/getDefaultExportFromCjs(entries$4); + + // TODO: Remove from `core-js@4` + var $$v = _export; + var DESCRIPTORS$6 = descriptors; + var create$9 = objectCreate; + + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + $$v({ target: 'Object', stat: true, sham: !DESCRIPTORS$6 }, { + create: create$9 + }); + + var path$d = path$u; + + var Object$3 = path$d.Object; + + var create$8 = function create(P, D) { + return Object$3.create(P, D); + }; + + var parent$E = create$8; + + var create$7 = parent$E; + + var create$6 = create$7; + + var _Object$create$1 = /*@__PURE__*/getDefaultExportFromCjs(create$6); + + var path$c = path$u; + var apply$3 = functionApply; + + // eslint-disable-next-line es/no-json -- safe + if (!path$c.JSON) path$c.JSON = { stringify: JSON.stringify }; + + // eslint-disable-next-line no-unused-vars -- required for `.length` + var stringify$2 = function stringify(it, replacer, space) { + return apply$3(path$c.JSON.stringify, null, arguments); + }; + + var parent$D = stringify$2; + + var stringify$1 = parent$D; + + var stringify = stringify$1; + + var _JSON$stringify = /*@__PURE__*/getDefaultExportFromCjs(stringify); + + /* global Bun -- Deno case */ + var engineIsBun = typeof Bun == 'function' && Bun && typeof Bun.version == 'string'; + + var $TypeError$5 = TypeError; + + var validateArgumentsLength$2 = function (passed, required) { + if (passed < required) throw new $TypeError$5('Not enough arguments'); + return passed; + }; + + var global$b = global$q; + var apply$2 = functionApply; + var isCallable$5 = isCallable$m; + var ENGINE_IS_BUN = engineIsBun; + var USER_AGENT = engineUserAgent; + var arraySlice$2 = arraySlice$5; + var validateArgumentsLength$1 = validateArgumentsLength$2; + + var Function$2 = global$b.Function; + // dirty IE9- and Bun 0.3.0- checks + var WRAP = /MSIE .\./.test(USER_AGENT) || ENGINE_IS_BUN && (function () { + var version = global$b.Bun.version.split('.'); + return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0'); + })(); + + // IE9- / Bun 0.3.0- setTimeout / setInterval / setImmediate additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers + // https://github.com/oven-sh/bun/issues/1633 + var schedulersFix$2 = function (scheduler, hasTimeArg) { + var firstParamIndex = hasTimeArg ? 2 : 1; + return WRAP ? function (handler, timeout /* , ...arguments */) { + var boundArgs = validateArgumentsLength$1(arguments.length, 1) > firstParamIndex; + var fn = isCallable$5(handler) ? handler : Function$2(handler); + var params = boundArgs ? arraySlice$2(arguments, firstParamIndex) : []; + var callback = boundArgs ? function () { + apply$2(fn, this, params); + } : fn; + return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback); + } : scheduler; + }; + + var $$u = _export; + var global$a = global$q; + var schedulersFix$1 = schedulersFix$2; + + var setInterval$2 = schedulersFix$1(global$a.setInterval, true); + + // Bun / IE9- setInterval additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + $$u({ global: true, bind: true, forced: global$a.setInterval !== setInterval$2 }, { + setInterval: setInterval$2 + }); + + var $$t = _export; + var global$9 = global$q; + var schedulersFix = schedulersFix$2; + + var setTimeout$3 = schedulersFix(global$9.setTimeout, true); + + // Bun / IE9- setTimeout additional parameters fix + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + $$t({ global: true, bind: true, forced: global$9.setTimeout !== setTimeout$3 }, { + setTimeout: setTimeout$3 + }); + + var path$b = path$u; + + var setTimeout$2 = path$b.setTimeout; + + var setTimeout$1 = setTimeout$2; + + var _setTimeout = /*@__PURE__*/getDefaultExportFromCjs(setTimeout$1); + + var toObject$3 = toObject$f; + var toAbsoluteIndex = toAbsoluteIndex$5; + var lengthOfArrayLike$5 = lengthOfArrayLike$e; + + // `Array.prototype.fill` method implementation + // https://tc39.es/ecma262/#sec-array.prototype.fill + var arrayFill = function fill(value /* , start = 0, end = @length */) { + var O = toObject$3(this); + var length = lengthOfArrayLike$5(O); + var argumentsLength = arguments.length; + var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); + var end = argumentsLength > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; + }; + + var $$s = _export; + var fill$4 = arrayFill; + + // `Array.prototype.fill` method + // https://tc39.es/ecma262/#sec-array.prototype.fill + $$s({ target: 'Array', proto: true }, { + fill: fill$4 + }); + + var entryVirtual$b = entryVirtual$o; + + var fill$3 = entryVirtual$b('Array').fill; + + var isPrototypeOf$e = objectIsPrototypeOf; + var method$b = fill$3; + + var ArrayPrototype$a = Array.prototype; + + var fill$2 = function (it) { + var own = it.fill; + return it === ArrayPrototype$a || (isPrototypeOf$e(ArrayPrototype$a, it) && own === ArrayPrototype$a.fill) ? method$b : own; + }; + + var parent$C = fill$2; + + var fill$1 = parent$C; + + var fill = fill$1; + + var _fillInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(fill); + + var componentEmitter = {exports: {}}; + + (function (module) { + /** + * Expose `Emitter`. + */ + + { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + } + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + + // Remove event specific arrays for event types that no + // one is subscribed for to avoid memory leak. + if (callbacks.length === 0) { + delete this._callbacks['$' + event]; + } + + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + + var args = new Array(arguments.length - 1) + , callbacks = this._callbacks['$' + event]; + + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + } (componentEmitter)); + + var componentEmitterExports = componentEmitter.exports; + var Emitter = /*@__PURE__*/getDefaultExportFromCjs(componentEmitterExports); + + /*! Hammer.JS - v2.0.17-rc - 2019-12-16 + * http://naver.github.io/egjs + * + * Forked By Naver egjs + * Copyright (c) hammerjs + * Licensed under the MIT license */ + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized$1(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} target + * @param {...Object} objects_to_assign + * @returns {Object} target + */ + var assign; + + if (typeof Object.assign !== 'function') { + assign = function assign(target) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + + return output; + }; + } else { + assign = Object.assign; + } + + var assign$1 = assign; + + var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + var TEST_ELEMENT = typeof document === "undefined" ? { + style: {} + } : document.createElement('div'); + var TYPE_FUNCTION = 'function'; + var round = Math.round, + abs = Math.abs; + var now = Date.now; + + /** + * @private + * get the prefixed property + * @param {Object} obj + * @param {String} property + * @returns {String|Undefined} prefixed + */ + + function prefixed(obj, property) { + var prefix; + var prop; + var camelProp = property[0].toUpperCase() + property.slice(1); + var i = 0; + + while (i < VENDOR_PREFIXES.length) { + prefix = VENDOR_PREFIXES[i]; + prop = prefix ? prefix + camelProp : property; + + if (prop in obj) { + return prop; + } + + i++; + } + + return undefined; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win; + + if (typeof window === "undefined") { + // window is undefined in node.js + win = {}; + } else { + win = window; + } + + var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); + var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; + function getTouchActionProps() { + if (!NATIVE_TOUCH_ACTION) { + return false; + } + + var touchMap = {}; + var cssSupports = win.CSS && win.CSS.supports; + ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) { + // If css.supports is not supported but there is native touch-action assume it supports + // all values. This is the case for IE 10 and 11. + return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true; + }); + return touchMap; + } + + var TOUCH_ACTION_COMPUTE = 'compute'; + var TOUCH_ACTION_AUTO = 'auto'; + var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented + + var TOUCH_ACTION_NONE = 'none'; + var TOUCH_ACTION_PAN_X = 'pan-x'; + var TOUCH_ACTION_PAN_Y = 'pan-y'; + var TOUCH_ACTION_MAP = getTouchActionProps(); + + var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + var SUPPORT_TOUCH = 'ontouchstart' in win; + var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined; + var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); + var INPUT_TYPE_TOUCH = 'touch'; + var INPUT_TYPE_PEN = 'pen'; + var INPUT_TYPE_MOUSE = 'mouse'; + var INPUT_TYPE_KINECT = 'kinect'; + var COMPUTE_INTERVAL = 25; + var INPUT_START = 1; + var INPUT_MOVE = 2; + var INPUT_END = 4; + var INPUT_CANCEL = 8; + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; + var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; + var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; + var PROPS_XY = ['x', 'y']; + var PROPS_CLIENT_XY = ['clientX', 'clientY']; + + /** + * @private + * walk objects and arrays + * @param {Object} obj + * @param {Function} iterator + * @param {Object} context + */ + function each(obj, iterator, context) { + var i; + + if (!obj) { + return; + } + + if (obj.forEach) { + obj.forEach(iterator, context); + } else if (obj.length !== undefined) { + i = 0; + + while (i < obj.length) { + iterator.call(context, obj[i], i, obj); + i++; + } + } else { + for (i in obj) { + obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); + } + } + } + + /** + * @private + * let a boolean value also be a function that must return a boolean + * this first item in args will be used as the context + * @param {Boolean|Function} val + * @param {Array} [args] + * @returns {Boolean} + */ + + function boolOrFn(val, args) { + if (typeof val === TYPE_FUNCTION) { + return val.apply(args ? args[0] || undefined : undefined, args); + } + + return val; + } + + /** + * @private + * small indexOf wrapper + * @param {String} str + * @param {String} find + * @returns {Boolean} found + */ + function inStr(str, find) { + return str.indexOf(find) > -1; + } + + /** + * @private + * when the touchActions are collected they are not a valid value, so we need to clean things up. * + * @param {String} actions + * @returns {*} + */ + + function cleanTouchActions(actions) { + // none + if (inStr(actions, TOUCH_ACTION_NONE)) { + return TOUCH_ACTION_NONE; + } + + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers + // for different directions, e.g. horizontal pan but vertical swipe?) + // we need none (as otherwise with pan-x pan-y combined none of these + // recognizers will work, since the browser would handle all panning + + if (hasPanX && hasPanY) { + return TOUCH_ACTION_NONE; + } // pan-x OR pan-y + + + if (hasPanX || hasPanY) { + return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; + } // manipulation + + + if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { + return TOUCH_ACTION_MANIPULATION; + } + + return TOUCH_ACTION_AUTO; + } + + /** + * @private + * Touch Action + * sets the touchAction property or uses the js alternative + * @param {Manager} manager + * @param {String} value + * @constructor + */ + + var TouchAction = + /*#__PURE__*/ + function () { + function TouchAction(manager, value) { + this.manager = manager; + this.set(value); + } + /** + * @private + * set the touchAction value on the element or enable the polyfill + * @param {String} value + */ + + + var _proto = TouchAction.prototype; + + _proto.set = function set(value) { + // find out the touch-action by the event handlers + if (value === TOUCH_ACTION_COMPUTE) { + value = this.compute(); + } + + if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { + this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; + } + + this.actions = value.toLowerCase().trim(); + }; + /** + * @private + * just re-set the touchAction value + */ + + + _proto.update = function update() { + this.set(this.manager.options.touchAction); + }; + /** + * @private + * compute the value for the touchAction property based on the recognizer's settings + * @returns {String} value + */ + + + _proto.compute = function compute() { + var actions = []; + each(this.manager.recognizers, function (recognizer) { + if (boolOrFn(recognizer.options.enable, [recognizer])) { + actions = actions.concat(recognizer.getTouchAction()); + } + }); + return cleanTouchActions(actions.join(' ')); + }; + /** + * @private + * this method is called on each input cycle and provides the preventing of the browser behavior + * @param {Object} input + */ + + + _proto.preventDefaults = function preventDefaults(input) { + var srcEvent = input.srcEvent; + var direction = input.offsetDirection; // if the touch action did prevented once this session + + if (this.manager.session.prevented) { + srcEvent.preventDefault(); + return; + } + + var actions = this.actions; + var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; + + if (hasNone) { + // do not prevent defaults if this is a tap gesture + var isTapPointer = input.pointers.length === 1; + var isTapMovement = input.distance < 2; + var isTapTouchTime = input.deltaTime < 250; + + if (isTapPointer && isTapMovement && isTapTouchTime) { + return; + } + } + + if (hasPanX && hasPanY) { + // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent + return; + } + + if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) { + return this.preventSrc(srcEvent); + } + }; + /** + * @private + * call preventDefault to prevent the browser's default behavior (scrolling in most cases) + * @param {Object} srcEvent + */ + + + _proto.preventSrc = function preventSrc(srcEvent) { + this.manager.session.prevented = true; + srcEvent.preventDefault(); + }; + + return TouchAction; + }(); + + /** + * @private + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ + function hasParent$1(node, parent) { + while (node) { + if (node === parent) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + /** + * @private + * get the center of all the pointers + * @param {Array} pointers + * @return {Object} center contains `x` and `y` properties + */ + + function getCenter(pointers) { + var pointersLength = pointers.length; // no need to loop when only one touch + + if (pointersLength === 1) { + return { + x: round(pointers[0].clientX), + y: round(pointers[0].clientY) + }; + } + + var x = 0; + var y = 0; + var i = 0; + + while (i < pointersLength) { + x += pointers[i].clientX; + y += pointers[i].clientY; + i++; + } + + return { + x: round(x / pointersLength), + y: round(y / pointersLength) + }; + } + + /** + * @private + * create a simple clone from the input used for storage of firstInput and firstMultiple + * @param {Object} input + * @returns {Object} clonedInputData + */ + + function simpleCloneInputData(input) { + // make a simple copy of the pointers because we will get a reference if we don't + // we only need clientXY for the calculations + var pointers = []; + var i = 0; + + while (i < input.pointers.length) { + pointers[i] = { + clientX: round(input.pointers[i].clientX), + clientY: round(input.pointers[i].clientY) + }; + i++; + } + + return { + timeStamp: now(), + pointers: pointers, + center: getCenter(pointers), + deltaX: input.deltaX, + deltaY: input.deltaY + }; + } + + /** + * @private + * calculate the absolute distance between two points + * @param {Object} p1 {x, y} + * @param {Object} p2 {x, y} + * @param {Array} [props] containing x and y keys + * @return {Number} distance + */ + + function getDistance(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.sqrt(x * x + y * y); + } + + /** + * @private + * calculate the angle between two coordinates + * @param {Object} p1 + * @param {Object} p2 + * @param {Array} [props] containing x and y keys + * @return {Number} angle + */ + + function getAngle(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.atan2(y, x) * 180 / Math.PI; + } + + /** + * @private + * get the direction between two points + * @param {Number} x + * @param {Number} y + * @return {Number} direction + */ + + function getDirection(x, y) { + if (x === y) { + return DIRECTION_NONE; + } + + if (abs(x) >= abs(y)) { + return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + + return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + } + + function computeDeltaXY(session, input) { + var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session; + // jscs throwing error on defalut destructured values and without defaults tests fail + + var offset = session.offsetDelta || {}; + var prevDelta = session.prevDelta || {}; + var prevInput = session.prevInput || {}; + + if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { + prevDelta = session.prevDelta = { + x: prevInput.deltaX || 0, + y: prevInput.deltaY || 0 + }; + offset = session.offsetDelta = { + x: center.x, + y: center.y + }; + } + + input.deltaX = prevDelta.x + (center.x - offset.x); + input.deltaY = prevDelta.y + (center.y - offset.y); + } + + /** + * @private + * calculate the velocity between two points. unit is in px per ms. + * @param {Number} deltaTime + * @param {Number} x + * @param {Number} y + * @return {Object} velocity `x` and `y` + */ + function getVelocity(deltaTime, x, y) { + return { + x: x / deltaTime || 0, + y: y / deltaTime || 0 + }; + } + + /** + * @private + * calculate the scale factor between two pointersets + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} scale + */ + + function getScale(start, end) { + return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); + } + + /** + * @private + * calculate the rotation degrees between two pointersets + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} rotation + */ + + function getRotation(start, end) { + return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); + } + + /** + * @private + * velocity is calculated every x ms + * @param {Object} session + * @param {Object} input + */ + + function computeIntervalInputData(session, input) { + var last = session.lastInterval || input; + var deltaTime = input.timeStamp - last.timeStamp; + var velocity; + var velocityX; + var velocityY; + var direction; + + if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { + var deltaX = input.deltaX - last.deltaX; + var deltaY = input.deltaY - last.deltaY; + var v = getVelocity(deltaTime, deltaX, deltaY); + velocityX = v.x; + velocityY = v.y; + velocity = abs(v.x) > abs(v.y) ? v.x : v.y; + direction = getDirection(deltaX, deltaY); + session.lastInterval = input; + } else { + // use latest velocity info if it doesn't overtake a minimum period + velocity = last.velocity; + velocityX = last.velocityX; + velocityY = last.velocityY; + direction = last.direction; + } + + input.velocity = velocity; + input.velocityX = velocityX; + input.velocityY = velocityY; + input.direction = direction; + } + + /** + * @private + * extend the data with some usable properties like scale, rotate, velocity etc + * @param {Object} manager + * @param {Object} input + */ + + function computeInputData(manager, input) { + var session = manager.session; + var pointers = input.pointers; + var pointersLength = pointers.length; // store the first input to calculate the distance and direction + + if (!session.firstInput) { + session.firstInput = simpleCloneInputData(input); + } // to compute scale and rotation we need to store the multiple touches + + + if (pointersLength > 1 && !session.firstMultiple) { + session.firstMultiple = simpleCloneInputData(input); + } else if (pointersLength === 1) { + session.firstMultiple = false; + } + + var firstInput = session.firstInput, + firstMultiple = session.firstMultiple; + var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; + var center = input.center = getCenter(pointers); + input.timeStamp = now(); + input.deltaTime = input.timeStamp - firstInput.timeStamp; + input.angle = getAngle(offsetCenter, center); + input.distance = getDistance(offsetCenter, center); + computeDeltaXY(session, input); + input.offsetDirection = getDirection(input.deltaX, input.deltaY); + var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); + input.overallVelocityX = overallVelocity.x; + input.overallVelocityY = overallVelocity.y; + input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; + input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; + input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; + input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; + computeIntervalInputData(session, input); // find the correct target + + var target = manager.element; + var srcEvent = input.srcEvent; + var srcEventTarget; + + if (srcEvent.composedPath) { + srcEventTarget = srcEvent.composedPath()[0]; + } else if (srcEvent.path) { + srcEventTarget = srcEvent.path[0]; + } else { + srcEventTarget = srcEvent.target; + } + + if (hasParent$1(srcEventTarget, target)) { + target = srcEventTarget; + } + + input.target = target; + } + + /** + * @private + * handle input events + * @param {Manager} manager + * @param {String} eventType + * @param {Object} input + */ + + function inputHandler(manager, eventType, input) { + var pointersLen = input.pointers.length; + var changedPointersLen = input.changedPointers.length; + var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0; + var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0; + input.isFirst = !!isFirst; + input.isFinal = !!isFinal; + + if (isFirst) { + manager.session = {}; + } // source event is the normalized value of the domEvents + // like 'touchstart, mouseup, pointerdown' + + + input.eventType = eventType; // compute scale, rotation etc + + computeInputData(manager, input); // emit secret event + + manager.emit('hammer.input', input); + manager.recognize(input); + manager.session.prevInput = input; + } + + /** + * @private + * split string on whitespace + * @param {String} str + * @returns {Array} words + */ + function splitStr(str) { + return str.trim().split(/\s+/g); + } + + /** + * @private + * addEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function addEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.addEventListener(type, handler, false); + }); + } + + /** + * @private + * removeEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function removeEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.removeEventListener(type, handler, false); + }); + } + + /** + * @private + * get the window object of an element + * @param {HTMLElement} element + * @returns {DocumentView|Window} + */ + function getWindowForElement(element) { + var doc = element.ownerDocument || element; + return doc.defaultView || doc.parentWindow || window; + } + + /** + * @private + * create new input type manager + * @param {Manager} manager + * @param {Function} callback + * @returns {Input} + * @constructor + */ + + var Input = + /*#__PURE__*/ + function () { + function Input(manager, callback) { + var self = this; + this.manager = manager; + this.callback = callback; + this.element = manager.element; + this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, + // so when disabled the input events are completely bypassed. + + this.domHandler = function (ev) { + if (boolOrFn(manager.options.enable, [manager])) { + self.handler(ev); + } + }; + + this.init(); + } + /** + * @private + * should handle the inputEvent data and trigger the callback + * @virtual + */ + + + var _proto = Input.prototype; + + _proto.handler = function handler() {}; + /** + * @private + * bind the events + */ + + + _proto.init = function init() { + this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + /** + * @private + * unbind the events + */ + + + _proto.destroy = function destroy() { + this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + + return Input; + }(); + + /** + * @private + * find if a array contains the object using indexOf or a simple polyFill + * @param {Array} src + * @param {String} find + * @param {String} [findByKey] + * @return {Boolean|Number} false when not found, or the index + */ + function inArray(src, find, findByKey) { + if (src.indexOf && !findByKey) { + return src.indexOf(find); + } else { + var i = 0; + + while (i < src.length) { + if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) { + // do not use === here, test fails + return i; + } + + i++; + } + + return -1; + } + } + + var POINTER_INPUT_MAP = { + pointerdown: INPUT_START, + pointermove: INPUT_MOVE, + pointerup: INPUT_END, + pointercancel: INPUT_CANCEL, + pointerout: INPUT_CANCEL + }; // in IE10 the pointer types is defined as an enum + + var IE10_POINTER_TYPE_ENUM = { + 2: INPUT_TYPE_TOUCH, + 3: INPUT_TYPE_PEN, + 4: INPUT_TYPE_MOUSE, + 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 + + }; + var POINTER_ELEMENT_EVENTS = 'pointerdown'; + var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive + + if (win.MSPointerEvent && !win.PointerEvent) { + POINTER_ELEMENT_EVENTS = 'MSPointerDown'; + POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; + } + /** + * @private + * Pointer events input + * @constructor + * @extends Input + */ + + + var PointerEventInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose(PointerEventInput, _Input); + + function PointerEventInput() { + var _this; + + var proto = PointerEventInput.prototype; + proto.evEl = POINTER_ELEMENT_EVENTS; + proto.evWin = POINTER_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.store = _this.manager.session.pointerEvents = []; + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = PointerEventInput.prototype; + + _proto.handler = function handler(ev) { + var store = this.store; + var removePointer = false; + var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); + var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; + var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; + var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store + + var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down + + if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { + if (storeIndex < 0) { + store.push(ev); + storeIndex = store.length - 1; + } + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + removePointer = true; + } // it not found, so the pointer hasn't been down (so it's probably a hover) + + + if (storeIndex < 0) { + return; + } // update the event in the store + + + store[storeIndex] = ev; + this.callback(this.manager, eventType, { + pointers: store, + changedPointers: [ev], + pointerType: pointerType, + srcEvent: ev + }); + + if (removePointer) { + // remove from the store + store.splice(storeIndex, 1); + } + }; + + return PointerEventInput; + }(Input); + + /** + * @private + * convert array-like objects to real arrays + * @param {Object} obj + * @returns {Array} + */ + function toArray$1(obj) { + return Array.prototype.slice.call(obj, 0); + } + + /** + * @private + * unique array with objects based on a key (like 'id') or just by the array's value + * @param {Array} src [{id:1},{id:2},{id:1}] + * @param {String} [key] + * @param {Boolean} [sort=False] + * @returns {Array} [{id:1},{id:2}] + */ + + function uniqueArray(src, key, sort) { + var results = []; + var values = []; + var i = 0; + + while (i < src.length) { + var val = key ? src[i][key] : src[i]; + + if (inArray(values, val) < 0) { + results.push(src[i]); + } + + values[i] = val; + i++; + } + + if (sort) { + if (!key) { + results = results.sort(); + } else { + results = results.sort(function (a, b) { + return a[key] > b[key]; + }); + } + } + + return results; + } + + var TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Multi-user touch events input + * @constructor + * @extends Input + */ + + var TouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose(TouchInput, _Input); + + function TouchInput() { + var _this; + + TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS; + + return _this; + } + + var _proto = TouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = TOUCH_INPUT_MAP[ev.type]; + var touches = getTouches.call(this, ev, type); + + if (!touches) { + return; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return TouchInput; + }(Input); + + function getTouches(ev, type) { + var allTouches = toArray$1(ev.touches); + var targetIds = this.targetIds; // when there is only one touch, the process can be simplified + + if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { + targetIds[allTouches[0].identifier] = true; + return [allTouches, allTouches]; + } + + var i; + var targetTouches; + var changedTouches = toArray$1(ev.changedTouches); + var changedTargetTouches = []; + var target = this.target; // get target touches from touches + + targetTouches = allTouches.filter(function (touch) { + return hasParent$1(touch.target, target); + }); // collect touches + + if (type === INPUT_START) { + i = 0; + + while (i < targetTouches.length) { + targetIds[targetTouches[i].identifier] = true; + i++; + } + } // filter changed touches to only contain touches that exist in the collected target ids + + + i = 0; + + while (i < changedTouches.length) { + if (targetIds[changedTouches[i].identifier]) { + changedTargetTouches.push(changedTouches[i]); + } // cleanup removed touches + + + if (type & (INPUT_END | INPUT_CANCEL)) { + delete targetIds[changedTouches[i].identifier]; + } + + i++; + } + + if (!changedTargetTouches.length) { + return; + } + + return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' + uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches]; + } + + var MOUSE_INPUT_MAP = { + mousedown: INPUT_START, + mousemove: INPUT_MOVE, + mouseup: INPUT_END + }; + var MOUSE_ELEMENT_EVENTS = 'mousedown'; + var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + /** + * @private + * Mouse events input + * @constructor + * @extends Input + */ + + var MouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose(MouseInput, _Input); + + function MouseInput() { + var _this; + + var proto = MouseInput.prototype; + proto.evEl = MOUSE_ELEMENT_EVENTS; + proto.evWin = MOUSE_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.pressed = false; // mousedown state + + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = MouseInput.prototype; + + _proto.handler = function handler(ev) { + var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down + + if (eventType & INPUT_START && ev.button === 0) { + this.pressed = true; + } + + if (eventType & INPUT_MOVE && ev.which !== 1) { + eventType = INPUT_END; + } // mouse must be down + + + if (!this.pressed) { + return; + } + + if (eventType & INPUT_END) { + this.pressed = false; + } + + this.callback(this.manager, eventType, { + pointers: [ev], + changedPointers: [ev], + pointerType: INPUT_TYPE_MOUSE, + srcEvent: ev + }); + }; + + return MouseInput; + }(Input); + + /** + * @private + * Combined touch and mouse input + * + * Touch has a higher priority then mouse, and while touching no mouse events are allowed. + * This because touch devices also emit mouse events while doing a touch. + * + * @constructor + * @extends Input + */ + + var DEDUP_TIMEOUT = 2500; + var DEDUP_DISTANCE = 25; + + function setLastTouch(eventData) { + var _eventData$changedPoi = eventData.changedPointers, + touch = _eventData$changedPoi[0]; + + if (touch.identifier === this.primaryTouch) { + var lastTouch = { + x: touch.clientX, + y: touch.clientY + }; + var lts = this.lastTouches; + this.lastTouches.push(lastTouch); + + var removeLastTouch = function removeLastTouch() { + var i = lts.indexOf(lastTouch); + + if (i > -1) { + lts.splice(i, 1); + } + }; + + setTimeout(removeLastTouch, DEDUP_TIMEOUT); + } + } + + function recordTouches(eventType, eventData) { + if (eventType & INPUT_START) { + this.primaryTouch = eventData.changedPointers[0].identifier; + setLastTouch.call(this, eventData); + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + setLastTouch.call(this, eventData); + } + } + + function isSyntheticEvent(eventData) { + var x = eventData.srcEvent.clientX; + var y = eventData.srcEvent.clientY; + + for (var i = 0; i < this.lastTouches.length; i++) { + var t = this.lastTouches[i]; + var dx = Math.abs(x - t.x); + var dy = Math.abs(y - t.y); + + if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { + return true; + } + } + + return false; + } + + var TouchMouseInput = + /*#__PURE__*/ + function () { + var TouchMouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose(TouchMouseInput, _Input); + + function TouchMouseInput(_manager, callback) { + var _this; + + _this = _Input.call(this, _manager, callback) || this; + + _this.handler = function (manager, inputEvent, inputData) { + var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH; + var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE; + + if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { + return; + } // when we're in a touch event, record touches to de-dupe synthetic mouse event + + + if (isTouch) { + recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData); + } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) { + return; + } + + _this.callback(manager, inputEvent, inputData); + }; + + _this.touch = new TouchInput(_this.manager, _this.handler); + _this.mouse = new MouseInput(_this.manager, _this.handler); + _this.primaryTouch = null; + _this.lastTouches = []; + return _this; + } + /** + * @private + * handle mouse and touch events + * @param {Hammer} manager + * @param {String} inputEvent + * @param {Object} inputData + */ + + + var _proto = TouchMouseInput.prototype; + + /** + * @private + * remove the event listeners + */ + _proto.destroy = function destroy() { + this.touch.destroy(); + this.mouse.destroy(); + }; + + return TouchMouseInput; + }(Input); + + return TouchMouseInput; + }(); + + /** + * @private + * create new input type manager + * called by the Manager constructor + * @param {Hammer} manager + * @returns {Input} + */ + + function createInputInstance(manager) { + var Type; // let inputClass = manager.options.inputClass; + + var inputClass = manager.options.inputClass; + + if (inputClass) { + Type = inputClass; + } else if (SUPPORT_POINTER_EVENTS) { + Type = PointerEventInput; + } else if (SUPPORT_ONLY_TOUCH) { + Type = TouchInput; + } else if (!SUPPORT_TOUCH) { + Type = MouseInput; + } else { + Type = TouchMouseInput; + } + + return new Type(manager, inputHandler); + } + + /** + * @private + * if the argument is an array, we want to execute the fn on each entry + * if it aint an array we don't want to do a thing. + * this is used by all the methods that accept a single and array argument. + * @param {*|Array} arg + * @param {String} fn + * @param {Object} [context] + * @returns {Boolean} + */ + + function invokeArrayArg(arg, fn, context) { + if (Array.isArray(arg)) { + each(arg, context[fn], context); + return true; + } + + return false; + } + + var STATE_POSSIBLE = 1; + var STATE_BEGAN = 2; + var STATE_CHANGED = 4; + var STATE_ENDED = 8; + var STATE_RECOGNIZED = STATE_ENDED; + var STATE_CANCELLED = 16; + var STATE_FAILED = 32; + + /** + * @private + * get a unique id + * @returns {number} uniqueId + */ + var _uniqueId = 1; + function uniqueId() { + return _uniqueId++; + } + + /** + * @private + * get a recognizer by name if it is bound to a manager + * @param {Recognizer|String} otherRecognizer + * @param {Recognizer} recognizer + * @returns {Recognizer} + */ + function getRecognizerByNameIfManager(otherRecognizer, recognizer) { + var manager = recognizer.manager; + + if (manager) { + return manager.get(otherRecognizer); + } + + return otherRecognizer; + } + + /** + * @private + * get a usable string, used as event postfix + * @param {constant} state + * @returns {String} state + */ + + function stateStr(state) { + if (state & STATE_CANCELLED) { + return 'cancel'; + } else if (state & STATE_ENDED) { + return 'end'; + } else if (state & STATE_CHANGED) { + return 'move'; + } else if (state & STATE_BEGAN) { + return 'start'; + } + + return ''; + } + + /** + * @private + * Recognizer flow explained; * + * All recognizers have the initial state of POSSIBLE when a input session starts. + * The definition of a input session is from the first input until the last input, with all it's movement in it. * + * Example session for mouse-input: mousedown -> mousemove -> mouseup + * + * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed + * which determines with state it should be. + * + * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to + * POSSIBLE to give it another change on the next cycle. + * + * Possible + * | + * +-----+---------------+ + * | | + * +-----+-----+ | + * | | | + * Failed Cancelled | + * +-------+------+ + * | | + * Recognized Began + * | + * Changed + * | + * Ended/Recognized + */ + + /** + * @private + * Recognizer + * Every recognizer needs to extend from this class. + * @constructor + * @param {Object} options + */ + + var Recognizer = + /*#__PURE__*/ + function () { + function Recognizer(options) { + if (options === void 0) { + options = {}; + } + + this.options = _extends({ + enable: true + }, options); + this.id = uniqueId(); + this.manager = null; // default is enable true + + this.state = STATE_POSSIBLE; + this.simultaneous = {}; + this.requireFail = []; + } + /** + * @private + * set options + * @param {Object} options + * @return {Recognizer} + */ + + + var _proto = Recognizer.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state + + this.manager && this.manager.touchAction.update(); + return this; + }; + /** + * @private + * recognize simultaneous with an other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.recognizeWith = function recognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { + return this; + } + + var simultaneous = this.simultaneous; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (!simultaneous[otherRecognizer.id]) { + simultaneous[otherRecognizer.id] = otherRecognizer; + otherRecognizer.recognizeWith(this); + } + + return this; + }; + /** + * @private + * drop the simultaneous link. it doesnt remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + delete this.simultaneous[otherRecognizer.id]; + return this; + }; + /** + * @private + * recognizer can only run when an other is failing + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.requireFailure = function requireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { + return this; + } + + var requireFail = this.requireFail; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (inArray(requireFail, otherRecognizer) === -1) { + requireFail.push(otherRecognizer); + otherRecognizer.requireFailure(this); + } + + return this; + }; + /** + * @private + * drop the requireFailure link. it does not remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + var index = inArray(this.requireFail, otherRecognizer); + + if (index > -1) { + this.requireFail.splice(index, 1); + } + + return this; + }; + /** + * @private + * has require failures boolean + * @returns {boolean} + */ + + + _proto.hasRequireFailures = function hasRequireFailures() { + return this.requireFail.length > 0; + }; + /** + * @private + * if the recognizer can recognize simultaneous with an other recognizer + * @param {Recognizer} otherRecognizer + * @returns {Boolean} + */ + + + _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { + return !!this.simultaneous[otherRecognizer.id]; + }; + /** + * @private + * You should use `tryEmit` instead of `emit` directly to check + * that all the needed recognizers has failed before emitting. + * @param {Object} input + */ + + + _proto.emit = function emit(input) { + var self = this; + var state = this.state; + + function emit(event) { + self.manager.emit(event, input); + } // 'panstart' and 'panmove' + + + if (state < STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + + emit(self.options.event); // simple 'eventName' events + + if (input.additionalEvent) { + // additional event(panleft, panright, pinchin, pinchout...) + emit(input.additionalEvent); + } // panend and pancancel + + + if (state >= STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + }; + /** + * @private + * Check that all the require failure recognizers has failed, + * if true, it emits a gesture event, + * otherwise, setup the state to FAILED. + * @param {Object} input + */ + + + _proto.tryEmit = function tryEmit(input) { + if (this.canEmit()) { + return this.emit(input); + } // it's failing anyway + + + this.state = STATE_FAILED; + }; + /** + * @private + * can we emit? + * @returns {boolean} + */ + + + _proto.canEmit = function canEmit() { + var i = 0; + + while (i < this.requireFail.length) { + if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { + return false; + } + + i++; + } + + return true; + }; + /** + * @private + * update the recognizer + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + // make a new copy of the inputData + // so we can change the inputData without messing up the other recognizers + var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing? + + if (!boolOrFn(this.options.enable, [this, inputDataClone])) { + this.reset(); + this.state = STATE_FAILED; + return; + } // reset when we've reached the end + + + if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { + this.state = STATE_POSSIBLE; + } + + this.state = this.process(inputDataClone); // the recognizer has recognized a gesture + // so trigger an event + + if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { + this.tryEmit(inputDataClone); + } + }; + /** + * @private + * return the state of the recognizer + * the actual recognizing happens in this method + * @virtual + * @param {Object} inputData + * @returns {constant} STATE + */ + + /* jshint ignore:start */ + + + _proto.process = function process(inputData) {}; + /* jshint ignore:end */ + + /** + * @private + * return the preferred touch-action + * @virtual + * @returns {Array} + */ + + + _proto.getTouchAction = function getTouchAction() {}; + /** + * @private + * called when the gesture isn't allowed to recognize + * like when another is being recognized or it is disabled + * @virtual + */ + + + _proto.reset = function reset() {}; + + return Recognizer; + }(); + + /** + * @private + * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur + * between the given interval and position. The delay option can be used to recognize multi-taps without firing + * a single tap. + * + * The eventData from the emitted event contains the property `tapCount`, which contains the amount of + * multi-taps being recognized. + * @constructor + * @extends Recognizer + */ + + var TapRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose(TapRecognizer, _Recognizer); + + function TapRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends({ + event: 'tap', + pointers: 1, + taps: 1, + interval: 300, + // max time between the multi-tap taps + time: 250, + // max time of the pointer to be down (like finger on the screen) + threshold: 9, + // a minimal movement is ok, but keep it low + posThreshold: 10 + }, options)) || this; // previous time and center, + // used for tap counting + + _this.pTime = false; + _this.pCenter = false; + _this._timer = null; + _this._input = null; + _this.count = 0; + return _this; + } + + var _proto = TapRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_MANIPULATION]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTouchTime = input.deltaTime < options.time; + this.reset(); + + if (input.eventType & INPUT_START && this.count === 0) { + return this.failTimeout(); + } // we only allow little movement + // and we've reached an end event, so a tap is possible + + + if (validMovement && validTouchTime && validPointers) { + if (input.eventType !== INPUT_END) { + return this.failTimeout(); + } + + var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; + var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; + this.pTime = input.timeStamp; + this.pCenter = input.center; + + if (!validMultiTap || !validInterval) { + this.count = 1; + } else { + this.count += 1; + } + + this._input = input; // if tap count matches we have recognized it, + // else it has began recognizing... + + var tapCount = this.count % options.taps; + + if (tapCount === 0) { + // no failing requirements, immediately trigger the tap event + // or wait as long as the multitap interval to trigger + if (!this.hasRequireFailures()) { + return STATE_RECOGNIZED; + } else { + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.interval); + return STATE_BEGAN; + } + } + } + + return STATE_FAILED; + }; + + _proto.failTimeout = function failTimeout() { + var _this3 = this; + + this._timer = setTimeout(function () { + _this3.state = STATE_FAILED; + }, this.options.interval); + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit() { + if (this.state === STATE_RECOGNIZED) { + this._input.tapCount = this.count; + this.manager.emit(this.options.event, this._input); + } + }; + + return TapRecognizer; + }(Recognizer); + + /** + * @private + * This recognizer is just used as a base for the simple attribute recognizers. + * @constructor + * @extends Recognizer + */ + + var AttrRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose(AttrRecognizer, _Recognizer); + + function AttrRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _Recognizer.call(this, _extends({ + pointers: 1 + }, options)) || this; + } + /** + * @private + * Used to check if it the recognizer receives valid input, like input.distance > 10. + * @memberof AttrRecognizer + * @param {Object} input + * @returns {Boolean} recognized + */ + + + var _proto = AttrRecognizer.prototype; + + _proto.attrTest = function attrTest(input) { + var optionPointers = this.options.pointers; + return optionPointers === 0 || input.pointers.length === optionPointers; + }; + /** + * @private + * Process the input and return the state for the recognizer + * @memberof AttrRecognizer + * @param {Object} input + * @returns {*} State + */ + + + _proto.process = function process(input) { + var state = this.state; + var eventType = input.eventType; + var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); + var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED + + if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { + return state | STATE_CANCELLED; + } else if (isRecognized || isValid) { + if (eventType & INPUT_END) { + return state | STATE_ENDED; + } else if (!(state & STATE_BEGAN)) { + return STATE_BEGAN; + } + + return state | STATE_CHANGED; + } + + return STATE_FAILED; + }; + + return AttrRecognizer; + }(Recognizer); + + /** + * @private + * direction cons to string + * @param {constant} direction + * @returns {String} + */ + + function directionStr(direction) { + if (direction === DIRECTION_DOWN) { + return 'down'; + } else if (direction === DIRECTION_UP) { + return 'up'; + } else if (direction === DIRECTION_LEFT) { + return 'left'; + } else if (direction === DIRECTION_RIGHT) { + return 'right'; + } + + return ''; + } + + /** + * @private + * Pan + * Recognized when the pointer is down and moved in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var PanRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose(PanRecognizer, _AttrRecognizer); + + function PanRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _AttrRecognizer.call(this, _extends({ + event: 'pan', + threshold: 10, + pointers: 1, + direction: DIRECTION_ALL + }, options)) || this; + _this.pX = null; + _this.pY = null; + return _this; + } + + var _proto = PanRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + var direction = this.options.direction; + var actions = []; + + if (direction & DIRECTION_HORIZONTAL) { + actions.push(TOUCH_ACTION_PAN_Y); + } + + if (direction & DIRECTION_VERTICAL) { + actions.push(TOUCH_ACTION_PAN_X); + } + + return actions; + }; + + _proto.directionTest = function directionTest(input) { + var options = this.options; + var hasMoved = true; + var distance = input.distance; + var direction = input.direction; + var x = input.deltaX; + var y = input.deltaY; // lock to axis? + + if (!(direction & options.direction)) { + if (options.direction & DIRECTION_HORIZONTAL) { + direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + hasMoved = x !== this.pX; + distance = Math.abs(input.deltaX); + } else { + direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + hasMoved = y !== this.pY; + distance = Math.abs(input.deltaY); + } + } + + input.direction = direction; + return hasMoved && distance > options.threshold && direction & options.direction; + }; + + _proto.attrTest = function attrTest(input) { + return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call + this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input)); + }; + + _proto.emit = function emit(input) { + this.pX = input.deltaX; + this.pY = input.deltaY; + var direction = directionStr(input.direction); + + if (direction) { + input.additionalEvent = this.options.event + direction; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PanRecognizer; + }(AttrRecognizer); + + /** + * @private + * Swipe + * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var SwipeRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose(SwipeRecognizer, _AttrRecognizer); + + function SwipeRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends({ + event: 'swipe', + threshold: 10, + velocity: 0.3, + direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, + pointers: 1 + }, options)) || this; + } + + var _proto = SwipeRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return PanRecognizer.prototype.getTouchAction.call(this); + }; + + _proto.attrTest = function attrTest(input) { + var direction = this.options.direction; + var velocity; + + if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { + velocity = input.overallVelocity; + } else if (direction & DIRECTION_HORIZONTAL) { + velocity = input.overallVelocityX; + } else if (direction & DIRECTION_VERTICAL) { + velocity = input.overallVelocityY; + } + + return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; + }; + + _proto.emit = function emit(input) { + var direction = directionStr(input.offsetDirection); + + if (direction) { + this.manager.emit(this.options.event + direction, input); + } + + this.manager.emit(this.options.event, input); + }; + + return SwipeRecognizer; + }(AttrRecognizer); + + /** + * @private + * Pinch + * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). + * @constructor + * @extends AttrRecognizer + */ + + var PinchRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose(PinchRecognizer, _AttrRecognizer); + + function PinchRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends({ + event: 'pinch', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = PinchRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); + }; + + _proto.emit = function emit(input) { + if (input.scale !== 1) { + var inOut = input.scale < 1 ? 'in' : 'out'; + input.additionalEvent = this.options.event + inOut; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PinchRecognizer; + }(AttrRecognizer); + + /** + * @private + * Rotate + * Recognized when two or more pointer are moving in a circular motion. + * @constructor + * @extends AttrRecognizer + */ + + var RotateRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose(RotateRecognizer, _AttrRecognizer); + + function RotateRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends({ + event: 'rotate', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = RotateRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); + }; + + return RotateRecognizer; + }(AttrRecognizer); + + /** + * @private + * Press + * Recognized when the pointer is down for x ms without any movement. + * @constructor + * @extends Recognizer + */ + + var PressRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose(PressRecognizer, _Recognizer); + + function PressRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends({ + event: 'press', + pointers: 1, + time: 251, + // minimal time of the pointer to be pressed + threshold: 9 + }, options)) || this; + _this._timer = null; + _this._input = null; + return _this; + } + + var _proto = PressRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_AUTO]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTime = input.deltaTime > options.time; + this._input = input; // we only allow little movement + // and we've reached an end event, so a tap is possible + + if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) { + this.reset(); + } else if (input.eventType & INPUT_START) { + this.reset(); + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.time); + } else if (input.eventType & INPUT_END) { + return STATE_RECOGNIZED; + } + + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit(input) { + if (this.state !== STATE_RECOGNIZED) { + return; + } + + if (input && input.eventType & INPUT_END) { + this.manager.emit(this.options.event + "up", input); + } else { + this._input.timeStamp = now(); + this.manager.emit(this.options.event, this._input); + } + }; + + return PressRecognizer; + }(Recognizer); + + var defaults = { + /** + * @private + * set if DOM events are being triggered. + * But this is slower and unused by simple implementations, so disabled by default. + * @type {Boolean} + * @default false + */ + domEvents: false, + + /** + * @private + * The value for the touchAction property/fallback. + * When set to `compute` it will magically set the correct value based on the added recognizers. + * @type {String} + * @default compute + */ + touchAction: TOUCH_ACTION_COMPUTE, + + /** + * @private + * @type {Boolean} + * @default true + */ + enable: true, + + /** + * @private + * EXPERIMENTAL FEATURE -- can be removed/changed + * Change the parent input target element. + * If Null, then it is being set the to main element. + * @type {Null|EventTarget} + * @default null + */ + inputTarget: null, + + /** + * @private + * force an input class + * @type {Null|Function} + * @default null + */ + inputClass: null, + + /** + * @private + * Some CSS properties can be used to improve the working of Hammer. + * Add them to this method and they will be set when creating a new Manager. + * @namespace + */ + cssProps: { + /** + * @private + * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userSelect: "none", + + /** + * @private + * Disable the Windows Phone grippers when pressing an element. + * @type {String} + * @default 'none' + */ + touchSelect: "none", + + /** + * @private + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @type {String} + * @default 'none' + */ + touchCallout: "none", + + /** + * @private + * Specifies whether zooming is enabled. Used by IE10> + * @type {String} + * @default 'none' + */ + contentZooming: "none", + + /** + * @private + * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userDrag: "none", + + /** + * @private + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in iOS. This property obeys the alpha value, if specified. + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: "rgba(0,0,0,0)" + } + }; + /** + * @private + * Default recognizer setup when calling `Hammer()` + * When creating a new Manager these will be skipped. + * This is separated with other defaults because of tree-shaking. + * @type {Array} + */ + + var preset = [[RotateRecognizer, { + enable: false + }], [PinchRecognizer, { + enable: false + }, ['rotate']], [SwipeRecognizer, { + direction: DIRECTION_HORIZONTAL + }], [PanRecognizer, { + direction: DIRECTION_HORIZONTAL + }, ['swipe']], [TapRecognizer], [TapRecognizer, { + event: 'doubletap', + taps: 2 + }, ['tap']], [PressRecognizer]]; + + var STOP = 1; + var FORCED_STOP = 2; + /** + * @private + * add/remove the css properties as defined in manager.options.cssProps + * @param {Manager} manager + * @param {Boolean} add + */ + + function toggleCssProps(manager, add) { + var element = manager.element; + + if (!element.style) { + return; + } + + var prop; + each(manager.options.cssProps, function (value, name) { + prop = prefixed(element.style, name); + + if (add) { + manager.oldCssProps[prop] = element.style[prop]; + element.style[prop] = value; + } else { + element.style[prop] = manager.oldCssProps[prop] || ""; + } + }); + + if (!add) { + manager.oldCssProps = {}; + } + } + /** + * @private + * trigger dom event + * @param {String} event + * @param {Object} data + */ + + + function triggerDomEvent(event, data) { + var gestureEvent = document.createEvent("Event"); + gestureEvent.initEvent(event, true, true); + gestureEvent.gesture = data; + data.target.dispatchEvent(gestureEvent); + } + /** + * @private + * Manager + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + + var Manager = + /*#__PURE__*/ + function () { + function Manager(element, options) { + var _this = this; + + this.options = assign$1({}, defaults, options || {}); + this.options.inputTarget = this.options.inputTarget || element; + this.handlers = {}; + this.session = {}; + this.recognizers = []; + this.oldCssProps = {}; + this.element = element; + this.input = createInputInstance(this); + this.touchAction = new TouchAction(this, this.options.touchAction); + toggleCssProps(this, true); + each(this.options.recognizers, function (item) { + var recognizer = _this.add(new item[0](item[1])); + + item[2] && recognizer.recognizeWith(item[2]); + item[3] && recognizer.requireFailure(item[3]); + }, this); + } + /** + * @private + * set options + * @param {Object} options + * @returns {Manager} + */ + + + var _proto = Manager.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // Options that need a little more setup + + if (options.touchAction) { + this.touchAction.update(); + } + + if (options.inputTarget) { + // Clean up existing event listeners and reinitialize + this.input.destroy(); + this.input.target = options.inputTarget; + this.input.init(); + } + + return this; + }; + /** + * @private + * stop recognizing for this session. + * This session will be discarded, when a new [input]start event is fired. + * When forced, the recognizer cycle is stopped immediately. + * @param {Boolean} [force] + */ + + + _proto.stop = function stop(force) { + this.session.stopped = force ? FORCED_STOP : STOP; + }; + /** + * @private + * run the recognizers! + * called by the inputHandler function on every movement of the pointers (touches) + * it walks through all the recognizers and tries to detect the gesture that is being made + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + var session = this.session; + + if (session.stopped) { + return; + } // run the touch-action polyfill + + + this.touchAction.preventDefaults(inputData); + var recognizer; + var recognizers = this.recognizers; // this holds the recognizer that is being recognized. + // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED + // if no recognizer is detecting a thing, it is set to `null` + + var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized + // or when we're in a new session + + if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) { + session.curRecognizer = null; + curRecognizer = null; + } + + var i = 0; + + while (i < recognizers.length) { + recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. + // 1. allow if the session is NOT forced stopped (see the .stop() method) + // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one + // that is being recognized. + // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. + // this can be setup with the `recognizeWith()` method on the recognizer. + + if (session.stopped !== FORCED_STOP && ( // 1 + !curRecognizer || recognizer === curRecognizer || // 2 + recognizer.canRecognizeWith(curRecognizer))) { + // 3 + recognizer.recognize(inputData); + } else { + recognizer.reset(); + } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the + // current active recognizer. but only if we don't already have an active recognizer + + + if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { + session.curRecognizer = recognizer; + curRecognizer = recognizer; + } + + i++; + } + }; + /** + * @private + * get a recognizer by its event name. + * @param {Recognizer|String} recognizer + * @returns {Recognizer|Null} + */ + + + _proto.get = function get(recognizer) { + if (recognizer instanceof Recognizer) { + return recognizer; + } + + var recognizers = this.recognizers; + + for (var i = 0; i < recognizers.length; i++) { + if (recognizers[i].options.event === recognizer) { + return recognizers[i]; + } + } + + return null; + }; + /** + * @private add a recognizer to the manager + * existing recognizers with the same event name will be removed + * @param {Recognizer} recognizer + * @returns {Recognizer|Manager} + */ + + + _proto.add = function add(recognizer) { + if (invokeArrayArg(recognizer, "add", this)) { + return this; + } // remove existing + + + var existing = this.get(recognizer.options.event); + + if (existing) { + this.remove(existing); + } + + this.recognizers.push(recognizer); + recognizer.manager = this; + this.touchAction.update(); + return recognizer; + }; + /** + * @private + * remove a recognizer by name or instance + * @param {Recognizer|String} recognizer + * @returns {Manager} + */ + + + _proto.remove = function remove(recognizer) { + if (invokeArrayArg(recognizer, "remove", this)) { + return this; + } + + var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists + + if (recognizer) { + var recognizers = this.recognizers; + var index = inArray(recognizers, targetRecognizer); + + if (index !== -1) { + recognizers.splice(index, 1); + this.touchAction.update(); + } + } + + return this; + }; + /** + * @private + * bind event + * @param {String} events + * @param {Function} handler + * @returns {EventEmitter} this + */ + + + _proto.on = function on(events, handler) { + if (events === undefined || handler === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + handlers[event] = handlers[event] || []; + handlers[event].push(handler); + }); + return this; + }; + /** + * @private unbind event, leave emit blank to remove all handlers + * @param {String} events + * @param {Function} [handler] + * @returns {EventEmitter} this + */ + + + _proto.off = function off(events, handler) { + if (events === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + if (!handler) { + delete handlers[event]; + } else { + handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); + } + }); + return this; + }; + /** + * @private emit event to the listeners + * @param {String} event + * @param {Object} data + */ + + + _proto.emit = function emit(event, data) { + // we also want to trigger dom events + if (this.options.domEvents) { + triggerDomEvent(event, data); + } // no handlers, so skip it all + + + var handlers = this.handlers[event] && this.handlers[event].slice(); + + if (!handlers || !handlers.length) { + return; + } + + data.type = event; + + data.preventDefault = function () { + data.srcEvent.preventDefault(); + }; + + var i = 0; + + while (i < handlers.length) { + handlers[i](data); + i++; + } + }; + /** + * @private + * destroy the manager and unbinds all events + * it doesn't unbind dom events, that is the user own responsibility + */ + + + _proto.destroy = function destroy() { + this.element && toggleCssProps(this, false); + this.handlers = {}; + this.session = {}; + this.input.destroy(); + this.element = null; + }; + + return Manager; + }(); + + var SINGLE_TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; + var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Touch events input + * @constructor + * @extends Input + */ + + var SingleTouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose(SingleTouchInput, _Input); + + function SingleTouchInput() { + var _this; + + var proto = SingleTouchInput.prototype; + proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS; + proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.started = false; + return _this; + } + + var _proto = SingleTouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? + + if (type === INPUT_START) { + this.started = true; + } + + if (!this.started) { + return; + } + + var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state + + if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { + this.started = false; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return SingleTouchInput; + }(Input); + + function normalizeSingleTouches(ev, type) { + var all = toArray$1(ev.touches); + var changed = toArray$1(ev.changedTouches); + + if (type & (INPUT_END | INPUT_CANCEL)) { + all = uniqueArray(all.concat(changed), 'identifier', true); + } + + return [all, changed]; + } + + /** + * @private + * wrap a method with a deprecation warning and stack trace + * @param {Function} method + * @param {String} name + * @param {String} message + * @returns {Function} A new function wrapping the supplied method. + */ + function deprecate(method, name, message) { + var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; + return function () { + var e = new Error('get-stack-trace'); + var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; + var log = window.console && (window.console.warn || window.console.log); + + if (log) { + log.call(window.console, deprecationMessage, stack); + } + + return method.apply(this, arguments); + }; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] + * @returns {Object} dest + */ + + var extend$1 = deprecate(function (dest, src, merge) { + var keys = Object.keys(src); + var i = 0; + + while (i < keys.length) { + if (!merge || merge && dest[keys[i]] === undefined) { + dest[keys[i]] = src[keys[i]]; + } + + i++; + } + + return dest; + }, 'extend', 'Use `assign`.'); + + /** + * @private + * merge the values from src in the dest. + * means that properties that exist in dest will not be overwritten by src + * @param {Object} dest + * @param {Object} src + * @returns {Object} dest + */ + + var merge$1 = deprecate(function (dest, src) { + return extend$1(dest, src, true); + }, 'merge', 'Use `assign`.'); + + /** + * @private + * simple class inheritance + * @param {Function} child + * @param {Function} base + * @param {Object} [properties] + */ + + function inherit(child, base, properties) { + var baseP = base.prototype; + var childP; + childP = child.prototype = Object.create(baseP); + childP.constructor = child; + childP._super = baseP; + + if (properties) { + assign$1(childP, properties); + } + } + + /** + * @private + * simple function bind + * @param {Function} fn + * @param {Object} context + * @returns {Function} + */ + function bindFn(fn, context) { + return function boundFn() { + return fn.apply(context, arguments); + }; + } + + /** + * @private + * Simple way to create a manager with a default set of recognizers. + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + var Hammer$3 = + /*#__PURE__*/ + function () { + var Hammer = + /** + * @private + * @const {string} + */ + function Hammer(element, options) { + if (options === void 0) { + options = {}; + } + + return new Manager(element, _extends({ + recognizers: preset.concat() + }, options)); + }; + + Hammer.VERSION = "2.0.17-rc"; + Hammer.DIRECTION_ALL = DIRECTION_ALL; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.DIRECTION_LEFT = DIRECTION_LEFT; + Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT; + Hammer.DIRECTION_UP = DIRECTION_UP; + Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + Hammer.DIRECTION_NONE = DIRECTION_NONE; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.INPUT_START = INPUT_START; + Hammer.INPUT_MOVE = INPUT_MOVE; + Hammer.INPUT_END = INPUT_END; + Hammer.INPUT_CANCEL = INPUT_CANCEL; + Hammer.STATE_POSSIBLE = STATE_POSSIBLE; + Hammer.STATE_BEGAN = STATE_BEGAN; + Hammer.STATE_CHANGED = STATE_CHANGED; + Hammer.STATE_ENDED = STATE_ENDED; + Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED; + Hammer.STATE_CANCELLED = STATE_CANCELLED; + Hammer.STATE_FAILED = STATE_FAILED; + Hammer.Manager = Manager; + Hammer.Input = Input; + Hammer.TouchAction = TouchAction; + Hammer.TouchInput = TouchInput; + Hammer.MouseInput = MouseInput; + Hammer.PointerEventInput = PointerEventInput; + Hammer.TouchMouseInput = TouchMouseInput; + Hammer.SingleTouchInput = SingleTouchInput; + Hammer.Recognizer = Recognizer; + Hammer.AttrRecognizer = AttrRecognizer; + Hammer.Tap = TapRecognizer; + Hammer.Pan = PanRecognizer; + Hammer.Swipe = SwipeRecognizer; + Hammer.Pinch = PinchRecognizer; + Hammer.Rotate = RotateRecognizer; + Hammer.Press = PressRecognizer; + Hammer.on = addEventListeners; + Hammer.off = removeEventListeners; + Hammer.each = each; + Hammer.merge = merge$1; + Hammer.extend = extend$1; + Hammer.bindFn = bindFn; + Hammer.assign = assign$1; + Hammer.inherit = inherit; + Hammer.bindFn = bindFn; + Hammer.prefixed = prefixed; + Hammer.toArray = toArray$1; + Hammer.inArray = inArray; + Hammer.uniqueArray = uniqueArray; + Hammer.splitStr = splitStr; + Hammer.boolOrFn = boolOrFn; + Hammer.hasParent = hasParent$1; + Hammer.addEventListeners = addEventListeners; + Hammer.removeEventListeners = removeEventListeners; + Hammer.defaults = assign$1({}, defaults, { + preset: preset + }); + return Hammer; + }(); + + // style loader but by script tag, not by the loader. + + Hammer$3.defaults; + + var Hammer$4 = Hammer$3; + + function _createForOfIteratorHelper$7(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$7(o, minLen) { var _context17; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$7(o, minLen); var n = _sliceInstanceProperty(_context17 = Object.prototype.toString.call(o)).call(_context17, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen); } + function _arrayLikeToArray$7(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + + /** + * Use this symbol to delete properies in deepObjectAssign. + */ + var DELETE = _Symbol("DELETE"); + /** + * Pure version of deepObjectAssign, it doesn't modify any of it's arguments. + * + * @param base - The base object that fullfils the whole interface T. + * @param updates - Updates that may change or delete props. + * @returns A brand new instance with all the supplied objects deeply merged. + */ + function pureDeepObjectAssign(base) { + var _context; + for (var _len = arguments.length, updates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + updates[_key - 1] = arguments[_key]; + } + return deepObjectAssign.apply(void 0, _concatInstanceProperty(_context = [{}, base]).call(_context, updates)); + } + /** + * Deep version of object assign with additional deleting by the DELETE symbol. + * + * @param values - Objects to be deeply merged. + * @returns The first object from values. + */ + function deepObjectAssign() { + var merged = deepObjectAssignNonentry.apply(void 0, arguments); + stripDelete(merged); + return merged; + } + /** + * Deep version of object assign with additional deleting by the DELETE symbol. + * + * @remarks + * This doesn't strip the DELETE symbols so they may end up in the final object. + * @param values - Objects to be deeply merged. + * @returns The first object from values. + */ + function deepObjectAssignNonentry() { + for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + values[_key2] = arguments[_key2]; + } + if (values.length < 2) { + return values[0]; + } else if (values.length > 2) { + var _context2; + return deepObjectAssignNonentry.apply(void 0, _concatInstanceProperty(_context2 = [deepObjectAssign(values[0], values[1])]).call(_context2, _toConsumableArray(_sliceInstanceProperty(values).call(values, 2)))); + } + var a = values[0]; + var b = values[1]; + if (a instanceof Date && b instanceof Date) { + a.setTime(b.getTime()); + return a; + } + var _iterator = _createForOfIteratorHelper$7(_Reflect$ownKeys(b)), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var prop = _step.value; + if (!Object.prototype.propertyIsEnumerable.call(b, prop)) ;else if (b[prop] === DELETE) { + delete a[prop]; + } else if (a[prop] !== null && b[prop] !== null && _typeof$1(a[prop]) === "object" && _typeof$1(b[prop]) === "object" && !_Array$isArray(a[prop]) && !_Array$isArray(b[prop])) { + a[prop] = deepObjectAssignNonentry(a[prop], b[prop]); + } else { + a[prop] = clone(b[prop]); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return a; + } + /** + * Deep clone given object or array. In case of primitive simply return. + * + * @param a - Anything. + * @returns Deep cloned object/array or unchanged a. + */ + function clone(a) { + if (_Array$isArray(a)) { + return _mapInstanceProperty(a).call(a, function (value) { + return clone(value); + }); + } else if (_typeof$1(a) === "object" && a !== null) { + if (a instanceof Date) { + return new Date(a.getTime()); + } + return deepObjectAssignNonentry({}, a); + } else { + return a; + } + } + /** + * Strip DELETE from given object. + * + * @param a - Object which may contain DELETE but won't after this is executed. + */ + function stripDelete(a) { + for (var _i = 0, _Object$keys$1 = _Object$keys(a); _i < _Object$keys$1.length; _i++) { + var prop = _Object$keys$1[_i]; + if (a[prop] === DELETE) { + delete a[prop]; + } else if (_typeof$1(a[prop]) === "object" && a[prop] !== null) { + stripDelete(a[prop]); + } + } + } + + /** + * Seedable, fast and reasonably good (not crypto but more than okay for our + * needs) random number generator. + * + * @remarks + * Adapted from {@link https://web.archive.org/web/20110429100736/http://baagoe.com:80/en/RandomMusings/javascript}. + * Original algorithm created by Johannes Baagøe \ in 2010. + */ + /** + * Create a seeded pseudo random generator based on Alea by Johannes Baagøe. + * + * @param seed - All supplied arguments will be used as a seed. In case nothing + * is supplied the current time will be used to seed the generator. + * @returns A ready to use seeded generator. + */ + function Alea() { + for (var _len3 = arguments.length, seed = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + seed[_key3] = arguments[_key3]; + } + return AleaImplementation(seed.length ? seed : [_Date$now()]); + } + /** + * An implementation of [[Alea]] without user input validation. + * + * @param seed - The data that will be used to seed the generator. + * @returns A ready to use seeded generator. + */ + function AleaImplementation(seed) { + var _mashSeed = mashSeed(seed), + _mashSeed2 = _slicedToArray(_mashSeed, 3), + s0 = _mashSeed2[0], + s1 = _mashSeed2[1], + s2 = _mashSeed2[2]; + var c = 1; + var random = function random() { + var t = 2091639 * s0 + c * 2.3283064365386963e-10; // 2^-32 + s0 = s1; + s1 = s2; + return s2 = t - (c = t | 0); + }; + random.uint32 = function () { + return random() * 0x100000000; + }; // 2^32 + random.fract53 = function () { + return random() + (random() * 0x200000 | 0) * 1.1102230246251565e-16; + }; // 2^-53 + random.algorithm = "Alea"; + random.seed = seed; + random.version = "0.9"; + return random; + } + /** + * Turn arbitrary data into values [[AleaImplementation]] can use to generate + * random numbers. + * + * @param seed - Arbitrary data that will be used as the seed. + * @returns Three numbers to use as initial values for [[AleaImplementation]]. + */ + function mashSeed() { + var mash = Mash(); + var s0 = mash(" "); + var s1 = mash(" "); + var s2 = mash(" "); + for (var i = 0; i < arguments.length; i++) { + s0 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]); + if (s0 < 0) { + s0 += 1; + } + s1 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]); + if (s1 < 0) { + s1 += 1; + } + s2 -= mash(i < 0 || arguments.length <= i ? undefined : arguments[i]); + if (s2 < 0) { + s2 += 1; + } + } + return [s0, s1, s2]; + } + /** + * Create a new mash function. + * + * @returns A nonpure function that takes arbitrary [[Mashable]] data and turns + * them into numbers. + */ + function Mash() { + var n = 0xefc8249d; + return function (data) { + var string = data.toString(); + for (var i = 0; i < string.length; i++) { + n += string.charCodeAt(i); + var h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000; // 2^32 + } + + return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 + }; + } + + /** + * Setup a mock hammer.js object, for unit testing. + * + * Inspiration: https://github.com/uber/deck.gl/pull/658 + * + * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} + */ + function hammerMock$1() { + var noop = function noop() {}; + return { + on: noop, + off: noop, + destroy: noop, + emit: noop, + get: function get() { + return { + set: noop + }; + } + }; + } + var Hammer$1 = typeof window !== "undefined" ? window.Hammer || Hammer$4 : function () { + // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object. + return hammerMock$1(); + }; + + /** + * Turn an element into an clickToUse element. + * When not active, the element has a transparent overlay. When the overlay is + * clicked, the mode is changed to active. + * When active, the element is displayed with a blue border around it, and + * the interactive contents of the element can be used. When clicked outside + * the element, the elements mode is changed to inactive. + * + * @param {Element} container + * @class Activator + */ + function Activator$1(container) { + var _this = this, + _context3; + this._cleanupQueue = []; + this.active = false; + this._dom = { + container: container, + overlay: document.createElement("div") + }; + this._dom.overlay.classList.add("vis-overlay"); + this._dom.container.appendChild(this._dom.overlay); + this._cleanupQueue.push(function () { + _this._dom.overlay.parentNode.removeChild(_this._dom.overlay); + }); + var hammer = Hammer$1(this._dom.overlay); + hammer.on("tap", _bindInstanceProperty$1(_context3 = this._onTapOverlay).call(_context3, this)); + this._cleanupQueue.push(function () { + hammer.destroy(); + // FIXME: cleaning up hammer instances doesn't work (Timeline not removed + // from memory) + }); + + // block all touch events (except tap) + var events = ["tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend"]; + _forEachInstanceProperty(events).call(events, function (event) { + hammer.on(event, function (event) { + event.srcEvent.stopPropagation(); + }); + }); + + // attach a click event to the window, in order to deactivate when clicking outside the timeline + if (document && document.body) { + this._onClick = function (event) { + if (!_hasParent$1(event.target, container)) { + _this.deactivate(); + } + }; + document.body.addEventListener("click", this._onClick); + this._cleanupQueue.push(function () { + document.body.removeEventListener("click", _this._onClick); + }); + } + + // prepare escape key listener for deactivating when active + this._escListener = function (event) { + if ("key" in event ? event.key === "Escape" : event.keyCode === 27 /* the keyCode is for IE11 */) { + _this.deactivate(); + } + }; + } + + // turn into an event emitter + Emitter(Activator$1.prototype); + + // The currently active activator + Activator$1.current = null; + + /** + * Destroy the activator. Cleans up all created DOM and event listeners + */ + Activator$1.prototype.destroy = function () { + var _context4, _context5; + this.deactivate(); + var _iterator2 = _createForOfIteratorHelper$7(_reverseInstanceProperty(_context4 = _spliceInstanceProperty(_context5 = this._cleanupQueue).call(_context5, 0)).call(_context4)), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var callback = _step2.value; + callback(); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + }; + + /** + * Activate the element + * Overlay is hidden, element is decorated with a blue shadow border + */ + Activator$1.prototype.activate = function () { + // we allow only one active activator at a time + if (Activator$1.current) { + Activator$1.current.deactivate(); + } + Activator$1.current = this; + this.active = true; + this._dom.overlay.style.display = "none"; + this._dom.container.classList.add("vis-active"); + this.emit("change"); + this.emit("activate"); + + // ugly hack: bind ESC after emitting the events, as the Network rebinds all + // keyboard events on a 'change' event + document.body.addEventListener("keydown", this._escListener); + }; + + /** + * Deactivate the element + * Overlay is displayed on top of the element + */ + Activator$1.prototype.deactivate = function () { + this.active = false; + this._dom.overlay.style.display = "block"; + this._dom.container.classList.remove("vis-active"); + document.body.removeEventListener("keydown", this._escListener); + this.emit("change"); + this.emit("deactivate"); + }; + + /** + * Handle a tap event: activate the container + * + * @param {Event} event The event + * @private + */ + Activator$1.prototype._onTapOverlay = function (event) { + // activate the container + this.activate(); + event.srcEvent.stopPropagation(); + }; + + /** + * Test whether the element has the requested parent element somewhere in + * its chain of parent nodes. + * + * @param {HTMLElement} element + * @param {HTMLElement} parent + * @returns {boolean} Returns true when the parent is found somewhere in the + * chain of parent nodes. + * @private + */ + function _hasParent$1(element, parent) { + while (element) { + if (element === parent) { + return true; + } + element = element.parentNode; + } + return false; + } + + // utility functions + // parse ASP.Net Date pattern, + // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' + // code from http://momentjs.com/ + var ASPDateRegex$1 = /^\/?Date\((-?\d+)/i; + // Color REs + var fullHexRE = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; + var shortHexRE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; + var rgbRE = /^rgb\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *\)$/i; + var rgbaRE = /^rgba\( *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *(1?\d{1,2}|2[0-4]\d|25[0-5]) *, *([01]|0?\.\d+) *\)$/i; + /** + * Test whether given object is a number. + * + * @param value - Input value of unknown type. + * @returns True if number, false otherwise. + */ + function isNumber(value) { + return value instanceof Number || typeof value === "number"; + } + /** + * Remove everything in the DOM object. + * + * @param DOMobject - Node whose child nodes will be recursively deleted. + */ + function recursiveDOMDelete(DOMobject) { + if (DOMobject) { + while (DOMobject.hasChildNodes() === true) { + var child = DOMobject.firstChild; + if (child) { + recursiveDOMDelete(child); + DOMobject.removeChild(child); + } + } + } + } + /** + * Test whether given object is a string. + * + * @param value - Input value of unknown type. + * @returns True if string, false otherwise. + */ + function isString(value) { + return value instanceof String || typeof value === "string"; + } + /** + * Test whether given object is a object (not primitive or null). + * + * @param value - Input value of unknown type. + * @returns True if not null object, false otherwise. + */ + function isObject$7(value) { + return _typeof$1(value) === "object" && value !== null; + } + /** + * Test whether given object is a Date, or a String containing a Date. + * + * @param value - Input value of unknown type. + * @returns True if Date instance or string date representation, false otherwise. + */ + function isDate(value) { + if (value instanceof Date) { + return true; + } else if (isString(value)) { + // test whether this string contains a date + var match = ASPDateRegex$1.exec(value); + if (match) { + return true; + } else if (!isNaN(Date.parse(value))) { + return true; + } + } + return false; + } + /** + * Copy property from b to a if property present in a. + * If property in b explicitly set to null, delete it if `allowDeletion` set. + * + * Internal helper routine, should not be exported. Not added to `exports` for that reason. + * + * @param a - Target object. + * @param b - Source object. + * @param prop - Name of property to copy from b to a. + * @param allowDeletion - If true, delete property in a if explicitly set to null in b. + */ + function copyOrDelete(a, b, prop, allowDeletion) { + var doDeletion = false; + if (allowDeletion === true) { + doDeletion = b[prop] === null && a[prop] !== undefined; + } + if (doDeletion) { + delete a[prop]; + } else { + a[prop] = b[prop]; // Remember, this is a reference copy! + } + } + /** + * Fill an object with a possibly partially defined other object. + * + * Only copies values for the properties already present in a. + * That means an object is not created on a property if only the b object has it. + * + * @param a - The object that will have it's properties updated. + * @param b - The object with property updates. + * @param allowDeletion - If true, delete properties in a that are explicitly set to null in b. + */ + function fillIfDefined(a, b) { + var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + // NOTE: iteration of properties of a + // NOTE: prototype properties iterated over as well + for (var prop in a) { + if (b[prop] !== undefined) { + if (b[prop] === null || _typeof$1(b[prop]) !== "object") { + // Note: typeof null === 'object' + copyOrDelete(a, b, prop, allowDeletion); + } else { + var aProp = a[prop]; + var bProp = b[prop]; + if (isObject$7(aProp) && isObject$7(bProp)) { + fillIfDefined(aProp, bProp, allowDeletion); + } + } + } + } + } + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * + * @param target - The target object to copy to. + * @param source - The source object from which to copy properties. + * @returns The target object. + */ + var extend = _Object$assign; + /** + * Extend object a with selected properties of object b or a series of objects. + * + * @remarks + * Only properties with defined values are copied. + * @param props - Properties to be copied to a. + * @param a - The target. + * @param others - The sources. + * @returns Argument a. + */ + function selectiveExtend(props, a) { + if (!_Array$isArray(props)) { + throw new Error("Array with property names expected as first argument"); + } + for (var _len4 = arguments.length, others = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { + others[_key4 - 2] = arguments[_key4]; + } + for (var _i2 = 0, _others = others; _i2 < _others.length; _i2++) { + var other = _others[_i2]; + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other && Object.prototype.hasOwnProperty.call(other, prop)) { + a[prop] = other[prop]; + } + } + } + return a; + } + /** + * Extend object a with selected properties of object b. + * Only properties with defined values are copied. + * + * @remarks + * Previous version of this routine implied that multiple source objects could + * be used; however, the implementation was **wrong**. Since multiple (\>1) + * sources weren't used anywhere in the `vis.js` code, this has been removed + * @param props - Names of first-level properties to copy over. + * @param a - Target object. + * @param b - Source object. + * @param allowDeletion - If true, delete property in a if explicitly set to null in b. + * @returns Argument a. + */ + function selectiveDeepExtend(props, a, b) { + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + // TODO: add support for Arrays to deepExtend + if (_Array$isArray(b)) { + throw new TypeError("Arrays are not supported by deepExtend"); + } + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (Object.prototype.hasOwnProperty.call(b, prop)) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + deepExtend(a[prop], b[prop], false, allowDeletion); + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } else if (_Array$isArray(b[prop])) { + throw new TypeError("Arrays are not supported by deepExtend"); + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } + } + return a; + } + /** + * Extend object `a` with properties of object `b`, ignoring properties which + * are explicitly specified to be excluded. + * + * @remarks + * The properties of `b` are considered for copying. Properties which are + * themselves objects are are also extended. Only properties with defined + * values are copied. + * @param propsToExclude - Names of properties which should *not* be copied. + * @param a - Object to extend. + * @param b - Object to take properties from for extension. + * @param allowDeletion - If true, delete properties in a that are explicitly + * set to null in b. + * @returns Argument a. + */ + function selectiveNotDeepExtend(propsToExclude, a, b) { + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + // TODO: add support for Arrays to deepExtend + // NOTE: array properties have an else-below; apparently, there is a problem here. + if (_Array$isArray(b)) { + throw new TypeError("Arrays are not supported by deepExtend"); + } + for (var prop in b) { + if (!Object.prototype.hasOwnProperty.call(b, prop)) { + continue; + } // Handle local properties only + if (_includesInstanceProperty(propsToExclude).call(propsToExclude, prop)) { + continue; + } // In exclusion list, skip + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + deepExtend(a[prop], b[prop]); // NOTE: allowDeletion not propagated! + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } else if (_Array$isArray(b[prop])) { + a[prop] = []; + for (var i = 0; i < b[prop].length; i++) { + a[prop].push(b[prop][i]); + } + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } + return a; + } + /** + * Deep extend an object a with the properties of object b. + * + * @param a - Target object. + * @param b - Source object. + * @param protoExtend - If true, the prototype values will also be extended. + * (That is the options objects that inherit from others will also get the + * inherited options). + * @param allowDeletion - If true, the values of fields that are null will be deleted. + * @returns Argument a. + */ + function deepExtend(a, b) { + var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + for (var prop in b) { + if (Object.prototype.hasOwnProperty.call(b, prop) || protoExtend === true) { + if (_typeof$1(b[prop]) === "object" && b[prop] !== null && _Object$getPrototypeOf$1(b[prop]) === Object.prototype) { + if (a[prop] === undefined) { + a[prop] = deepExtend({}, b[prop], protoExtend); // NOTE: allowDeletion not propagated! + } else if (_typeof$1(a[prop]) === "object" && a[prop] !== null && _Object$getPrototypeOf$1(a[prop]) === Object.prototype) { + deepExtend(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated! + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } else if (_Array$isArray(b[prop])) { + var _context6; + a[prop] = _sliceInstanceProperty(_context6 = b[prop]).call(_context6); + } else { + copyOrDelete(a, b, prop, allowDeletion); + } + } + } + return a; + } + /** + * Test whether all elements in two arrays are equal. + * + * @param a - First array. + * @param b - Second array. + * @returns True if both arrays have the same length and same elements (1 = '1'). + */ + function equalArray(a, b) { + if (a.length !== b.length) { + return false; + } + for (var i = 0, len = a.length; i < len; i++) { + if (a[i] != b[i]) { + return false; + } + } + return true; + } + /** + * Get the type of an object, for example exports.getType([]) returns 'Array'. + * + * @param object - Input value of unknown type. + * @returns Detected type. + */ + function getType(object) { + var type = _typeof$1(object); + if (type === "object") { + if (object === null) { + return "null"; + } + if (object instanceof Boolean) { + return "Boolean"; + } + if (object instanceof Number) { + return "Number"; + } + if (object instanceof String) { + return "String"; + } + if (_Array$isArray(object)) { + return "Array"; + } + if (object instanceof Date) { + return "Date"; + } + return "Object"; + } + if (type === "number") { + return "Number"; + } + if (type === "boolean") { + return "Boolean"; + } + if (type === "string") { + return "String"; + } + if (type === undefined) { + return "undefined"; + } + return type; + } + /** + * Used to extend an array and copy it. This is used to propagate paths recursively. + * + * @param arr - First part. + * @param newValue - The value to be aadded into the array. + * @returns A new array with all items from arr and newValue (which is last). + */ + function copyAndExtendArray(arr, newValue) { + var _context7; + return _concatInstanceProperty(_context7 = []).call(_context7, _toConsumableArray(arr), [newValue]); + } + /** + * Used to extend an array and copy it. This is used to propagate paths recursively. + * + * @param arr - The array to be copied. + * @returns Shallow copy of arr. + */ + function copyArray(arr) { + return _sliceInstanceProperty(arr).call(arr); + } + /** + * Retrieve the absolute left value of a DOM element. + * + * @param elem - A dom element, for example a div. + * @returns The absolute left position of this element in the browser page. + */ + function getAbsoluteLeft(elem) { + return elem.getBoundingClientRect().left; + } + /** + * Retrieve the absolute right value of a DOM element. + * + * @param elem - A dom element, for example a div. + * @returns The absolute right position of this element in the browser page. + */ + function getAbsoluteRight(elem) { + return elem.getBoundingClientRect().right; + } + /** + * Retrieve the absolute top value of a DOM element. + * + * @param elem - A dom element, for example a div. + * @returns The absolute top position of this element in the browser page. + */ + function getAbsoluteTop(elem) { + return elem.getBoundingClientRect().top; + } + /** + * Add a className to the given elements style. + * + * @param elem - The element to which the classes will be added. + * @param classNames - Space separated list of classes. + */ + function addClassName(elem, classNames) { + var classes = elem.className.split(" "); + var newClasses = classNames.split(" "); + classes = _concatInstanceProperty(classes).call(classes, _filterInstanceProperty(newClasses).call(newClasses, function (className) { + return !_includesInstanceProperty(classes).call(classes, className); + })); + elem.className = classes.join(" "); + } + /** + * Remove a className from the given elements style. + * + * @param elem - The element from which the classes will be removed. + * @param classNames - Space separated list of classes. + */ + function removeClassName(elem, classNames) { + var classes = elem.className.split(" "); + var oldClasses = classNames.split(" "); + classes = _filterInstanceProperty(classes).call(classes, function (className) { + return !_includesInstanceProperty(oldClasses).call(oldClasses, className); + }); + elem.className = classes.join(" "); + } + /** + * For each method for both arrays and objects. + * In case of an array, the built-in Array.forEach() is applied (**No, it's not!**). + * In case of an Object, the method loops over all properties of the object. + * + * @param object - An Object or Array to be iterated over. + * @param callback - Array.forEach-like callback. + */ + function forEach$4(object, callback) { + if (_Array$isArray(object)) { + // array + var len = object.length; + for (var i = 0; i < len; i++) { + callback(object[i], i, object); + } + } else { + // object + for (var key in object) { + if (Object.prototype.hasOwnProperty.call(object, key)) { + callback(object[key], key, object); + } + } + } + } + /** + * Convert an object into an array: all objects properties are put into the array. The resulting array is unordered. + * + * @param o - Object that contains the properties and methods. + * @returns An array of unordered values. + */ + var toArray = _Object$values2; + /** + * Update a property in an object. + * + * @param object - The object whose property will be updated. + * @param key - Name of the property to be updated. + * @param value - The new value to be assigned. + * @returns Whether the value was updated (true) or already strictly the same in the original object (false). + */ + function updateProperty(object, key, value) { + if (object[key] !== value) { + object[key] = value; + return true; + } else { + return false; + } + } + /** + * Throttle the given function to be only executed once per animation frame. + * + * @param fn - The original function. + * @returns The throttled function. + */ + function throttle(fn) { + var scheduled = false; + return function () { + if (!scheduled) { + scheduled = true; + requestAnimationFrame(function () { + scheduled = false; + fn(); + }); + } + }; + } + /** + * Add and event listener. Works for all browsers. + * + * @param element - The element to bind the event listener to. + * @param action - Same as Element.addEventListener(action, —, —). + * @param listener - Same as Element.addEventListener(—, listener, —). + * @param useCapture - Same as Element.addEventListener(—, —, useCapture). + */ + function addEventListener(element, action, listener, useCapture) { + if (element.addEventListener) { + var _context8; + if (useCapture === undefined) { + useCapture = false; + } + if (action === "mousewheel" && _includesInstanceProperty(_context8 = navigator.userAgent).call(_context8, "Firefox")) { + action = "DOMMouseScroll"; // For Firefox + } + + element.addEventListener(action, listener, useCapture); + } else { + // @TODO: IE types? Does anyone care? + element.attachEvent("on" + action, listener); // IE browsers + } + } + /** + * Remove an event listener from an element. + * + * @param element - The element to bind the event listener to. + * @param action - Same as Element.removeEventListener(action, —, —). + * @param listener - Same as Element.removeEventListener(—, listener, —). + * @param useCapture - Same as Element.removeEventListener(—, —, useCapture). + */ + function removeEventListener(element, action, listener, useCapture) { + if (element.removeEventListener) { + var _context9; + // non-IE browsers + if (useCapture === undefined) { + useCapture = false; + } + if (action === "mousewheel" && _includesInstanceProperty(_context9 = navigator.userAgent).call(_context9, "Firefox")) { + action = "DOMMouseScroll"; // For Firefox + } + + element.removeEventListener(action, listener, useCapture); + } else { + // @TODO: IE types? Does anyone care? + element.detachEvent("on" + action, listener); // IE browsers + } + } + /** + * Cancels the event's default action if it is cancelable, without stopping further propagation of the event. + * + * @param event - The event whose default action should be prevented. + */ + function preventDefault(event) { + if (!event) { + event = window.event; + } + if (!event) ;else if (event.preventDefault) { + event.preventDefault(); // non-IE browsers + } else { + // @TODO: IE types? Does anyone care? + event.returnValue = false; // IE browsers + } + } + /** + * Get HTML element which is the target of the event. + * + * @param event - The event. + * @returns The element or null if not obtainable. + */ + function getTarget() { + var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event; + // code from http://www.quirksmode.org/js/events_properties.html + // @TODO: EventTarget can be almost anything, is it okay to return only Elements? + var target = null; + if (!event) ;else if (event.target) { + target = event.target; + } else if (event.srcElement) { + target = event.srcElement; + } + if (!(target instanceof Element)) { + return null; + } + if (target.nodeType != null && target.nodeType == 3) { + // defeat Safari bug + target = target.parentNode; + if (!(target instanceof Element)) { + return null; + } + } + return target; + } + /** + * Check if given element contains given parent somewhere in the DOM tree. + * + * @param element - The element to be tested. + * @param parent - The ancestor (not necessarily parent) of the element. + * @returns True if parent is an ancestor of the element, false otherwise. + */ + function hasParent(element, parent) { + var elem = element; + while (elem) { + if (elem === parent) { + return true; + } else if (elem.parentNode) { + elem = elem.parentNode; + } else { + return false; + } + } + return false; + } + var option = { + /** + * Convert a value into a boolean. + * + * @param value - Value to be converted intoboolean, a function will be executed as `(() => unknown)`. + * @param defaultValue - If the value or the return value of the function == null then this will be returned. + * @returns Corresponding boolean value, if none then the default value, if none then null. + */ + asBoolean: function asBoolean(value, defaultValue) { + if (typeof value == "function") { + value = value(); + } + if (value != null) { + return value != false; + } + return defaultValue || null; + }, + /** + * Convert a value into a number. + * + * @param value - Value to be converted intonumber, a function will be executed as `(() => unknown)`. + * @param defaultValue - If the value or the return value of the function == null then this will be returned. + * @returns Corresponding **boxed** number value, if none then the default value, if none then null. + */ + asNumber: function asNumber(value, defaultValue) { + if (typeof value == "function") { + value = value(); + } + if (value != null) { + return Number(value) || defaultValue || null; + } + return defaultValue || null; + }, + /** + * Convert a value into a string. + * + * @param value - Value to be converted intostring, a function will be executed as `(() => unknown)`. + * @param defaultValue - If the value or the return value of the function == null then this will be returned. + * @returns Corresponding **boxed** string value, if none then the default value, if none then null. + */ + asString: function asString(value, defaultValue) { + if (typeof value == "function") { + value = value(); + } + if (value != null) { + return String(value); + } + return defaultValue || null; + }, + /** + * Convert a value into a size. + * + * @param value - Value to be converted intosize, a function will be executed as `(() => unknown)`. + * @param defaultValue - If the value or the return value of the function == null then this will be returned. + * @returns Corresponding string value (number + 'px'), if none then the default value, if none then null. + */ + asSize: function asSize(value, defaultValue) { + if (typeof value == "function") { + value = value(); + } + if (isString(value)) { + return value; + } else if (isNumber(value)) { + return value + "px"; + } else { + return defaultValue || null; + } + }, + /** + * Convert a value into a DOM Element. + * + * @param value - Value to be converted into DOM Element, a function will be executed as `(() => unknown)`. + * @param defaultValue - If the value or the return value of the function == null then this will be returned. + * @returns The DOM Element, if none then the default value, if none then null. + */ + asElement: function asElement(value, defaultValue) { + if (typeof value == "function") { + value = value(); + } + return value || defaultValue || null; + } + }; + /** + * Convert hex color string into RGB color object. + * + * @remarks + * {@link http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb} + * @param hex - Hex color string (3 or 6 digits, with or without #). + * @returns RGB color object. + */ + function hexToRGB(hex) { + var result; + switch (hex.length) { + case 3: + case 4: + result = shortHexRE.exec(hex); + return result ? { + r: _parseInt$1(result[1] + result[1], 16), + g: _parseInt$1(result[2] + result[2], 16), + b: _parseInt$1(result[3] + result[3], 16) + } : null; + case 6: + case 7: + result = fullHexRE.exec(hex); + return result ? { + r: _parseInt$1(result[1], 16), + g: _parseInt$1(result[2], 16), + b: _parseInt$1(result[3], 16) + } : null; + default: + return null; + } + } + /** + * This function takes string color in hex or RGB format and adds the opacity, RGBA is passed through unchanged. + * + * @param color - The color string (hex, RGB, RGBA). + * @param opacity - The new opacity. + * @returns RGBA string, for example 'rgba(255, 0, 127, 0.3)'. + */ + function overrideOpacity(color, opacity) { + if (_includesInstanceProperty(color).call(color, "rgba")) { + return color; + } else if (_includesInstanceProperty(color).call(color, "rgb")) { + var rgb = color.substr(_indexOfInstanceProperty(color).call(color, "(") + 1).replace(")", "").split(","); + return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"; + } else { + var _rgb = hexToRGB(color); + if (_rgb == null) { + return color; + } else { + return "rgba(" + _rgb.r + "," + _rgb.g + "," + _rgb.b + "," + opacity + ")"; + } + } + } + /** + * Convert RGB \<0, 255\> into hex color string. + * + * @param red - Red channel. + * @param green - Green channel. + * @param blue - Blue channel. + * @returns Hex color string (for example: '#0acdc0'). + */ + function RGBToHex(red, green, blue) { + var _context10; + return "#" + _sliceInstanceProperty(_context10 = ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16)).call(_context10, 1); + } + /** + * Parse a color property into an object with border, background, and highlight colors. + * + * @param inputColor - Shorthand color string or input color object. + * @param defaultColor - Full color object to fill in missing values in inputColor. + * @returns Color object. + */ + function parseColor(inputColor, defaultColor) { + if (isString(inputColor)) { + var colorStr = inputColor; + if (isValidRGB(colorStr)) { + var _context11; + var rgb = _mapInstanceProperty(_context11 = colorStr.substr(4).substr(0, colorStr.length - 5).split(",")).call(_context11, function (value) { + return _parseInt$1(value); + }); + colorStr = RGBToHex(rgb[0], rgb[1], rgb[2]); + } + if (isValidHex(colorStr) === true) { + var hsv = hexToHSV(colorStr); + var lighterColorHSV = { + h: hsv.h, + s: hsv.s * 0.8, + v: Math.min(1, hsv.v * 1.02) + }; + var darkerColorHSV = { + h: hsv.h, + s: Math.min(1, hsv.s * 1.25), + v: hsv.v * 0.8 + }; + var darkerColorHex = HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v); + var lighterColorHex = HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v); + return { + background: colorStr, + border: darkerColorHex, + highlight: { + background: lighterColorHex, + border: darkerColorHex + }, + hover: { + background: lighterColorHex, + border: darkerColorHex + } + }; + } else { + return { + background: colorStr, + border: colorStr, + highlight: { + background: colorStr, + border: colorStr + }, + hover: { + background: colorStr, + border: colorStr + } + }; + } + } else { + if (defaultColor) { + var color = { + background: inputColor.background || defaultColor.background, + border: inputColor.border || defaultColor.border, + highlight: isString(inputColor.highlight) ? { + border: inputColor.highlight, + background: inputColor.highlight + } : { + background: inputColor.highlight && inputColor.highlight.background || defaultColor.highlight.background, + border: inputColor.highlight && inputColor.highlight.border || defaultColor.highlight.border + }, + hover: isString(inputColor.hover) ? { + border: inputColor.hover, + background: inputColor.hover + } : { + border: inputColor.hover && inputColor.hover.border || defaultColor.hover.border, + background: inputColor.hover && inputColor.hover.background || defaultColor.hover.background + } + }; + return color; + } else { + var _color = { + background: inputColor.background || undefined, + border: inputColor.border || undefined, + highlight: isString(inputColor.highlight) ? { + border: inputColor.highlight, + background: inputColor.highlight + } : { + background: inputColor.highlight && inputColor.highlight.background || undefined, + border: inputColor.highlight && inputColor.highlight.border || undefined + }, + hover: isString(inputColor.hover) ? { + border: inputColor.hover, + background: inputColor.hover + } : { + border: inputColor.hover && inputColor.hover.border || undefined, + background: inputColor.hover && inputColor.hover.background || undefined + } + }; + return _color; + } + } + } + /** + * Convert RGB \<0, 255\> into HSV object. + * + * @remarks + * {@link http://www.javascripter.net/faq/rgb2hsv.htm} + * @param red - Red channel. + * @param green - Green channel. + * @param blue - Blue channel. + * @returns HSV color object. + */ + function RGBToHSV(red, green, blue) { + red = red / 255; + green = green / 255; + blue = blue / 255; + var minRGB = Math.min(red, Math.min(green, blue)); + var maxRGB = Math.max(red, Math.max(green, blue)); + // Black-gray-white + if (minRGB === maxRGB) { + return { + h: 0, + s: 0, + v: minRGB + }; + } + // Colors other than black-gray-white: + var d = red === minRGB ? green - blue : blue === minRGB ? red - green : blue - red; + var h = red === minRGB ? 3 : blue === minRGB ? 1 : 5; + var hue = 60 * (h - d / (maxRGB - minRGB)) / 360; + var saturation = (maxRGB - minRGB) / maxRGB; + var value = maxRGB; + return { + h: hue, + s: saturation, + v: value + }; + } + /** + * Split a string with css styles into an object with key/values. + * + * @param cssText - CSS source code to split into key/value object. + * @returns Key/value object corresponding to {@link cssText}. + */ + function splitCSSText(cssText) { + var tmpEllement = document.createElement("div"); + var styles = {}; + tmpEllement.style.cssText = cssText; + for (var i = 0; i < tmpEllement.style.length; ++i) { + styles[tmpEllement.style[i]] = tmpEllement.style.getPropertyValue(tmpEllement.style[i]); + } + return styles; + } + /** + * Append a string with css styles to an element. + * + * @param element - The element that will receive new styles. + * @param cssText - The styles to be appended. + */ + function addCssText(element, cssText) { + var cssStyle = splitCSSText(cssText); + for (var _i3 = 0, _Object$entries = _Object$entries2(cssStyle); _i3 < _Object$entries.length; _i3++) { + var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2), + key = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + element.style.setProperty(key, value); + } + } + /** + * Remove a string with css styles from an element. + * + * @param element - The element from which styles should be removed. + * @param cssText - The styles to be removed. + */ + function removeCssText(element, cssText) { + var cssStyle = splitCSSText(cssText); + for (var _i4 = 0, _Object$keys3 = _Object$keys(cssStyle); _i4 < _Object$keys3.length; _i4++) { + var key = _Object$keys3[_i4]; + element.style.removeProperty(key); + } + } + /** + * Convert HSV \<0, 1\> into RGB color object. + * + * @remarks + * {@link https://gist.github.com/mjijackson/5311256} + * @param h - Hue. + * @param s - Saturation. + * @param v - Value. + * @returns RGB color object. + */ + function HSVToRGB(h, s, v) { + var r; + var g; + var b; + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); + switch (i % 6) { + case 0: + r = v, g = t, b = p; + break; + case 1: + r = q, g = v, b = p; + break; + case 2: + r = p, g = v, b = t; + break; + case 3: + r = p, g = q, b = v; + break; + case 4: + r = t, g = p, b = v; + break; + case 5: + r = v, g = p, b = q; + break; + } + return { + r: Math.floor(r * 255), + g: Math.floor(g * 255), + b: Math.floor(b * 255) + }; + } + /** + * Convert HSV \<0, 1\> into hex color string. + * + * @param h - Hue. + * @param s - Saturation. + * @param v - Value. + * @returns Hex color string. + */ + function HSVToHex(h, s, v) { + var rgb = HSVToRGB(h, s, v); + return RGBToHex(rgb.r, rgb.g, rgb.b); + } + /** + * Convert hex color string into HSV \<0, 1\>. + * + * @param hex - Hex color string. + * @returns HSV color object. + */ + function hexToHSV(hex) { + var rgb = hexToRGB(hex); + if (!rgb) { + throw new TypeError("'".concat(hex, "' is not a valid color.")); + } + return RGBToHSV(rgb.r, rgb.g, rgb.b); + } + /** + * Validate hex color string. + * + * @param hex - Unknown string that may contain a color. + * @returns True if the string is valid, false otherwise. + */ + function isValidHex(hex) { + var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); + return isOk; + } + /** + * Validate RGB color string. + * + * @param rgb - Unknown string that may contain a color. + * @returns True if the string is valid, false otherwise. + */ + function isValidRGB(rgb) { + return rgbRE.test(rgb); + } + /** + * Validate RGBA color string. + * + * @param rgba - Unknown string that may contain a color. + * @returns True if the string is valid, false otherwise. + */ + function isValidRGBA(rgba) { + return rgbaRE.test(rgba); + } + /** + * This recursively redirects the prototype of JSON objects to the referenceObject. + * This is used for default options. + * + * @param fields - Names of properties to be bridged. + * @param referenceObject - The original object. + * @returns A new object inheriting from the referenceObject. + */ + function selectiveBridgeObject(fields, referenceObject) { + if (referenceObject !== null && _typeof$1(referenceObject) === "object") { + // !!! typeof null === 'object' + var objectTo = _Object$create$1(referenceObject); + for (var i = 0; i < fields.length; i++) { + if (Object.prototype.hasOwnProperty.call(referenceObject, fields[i])) { + if (_typeof$1(referenceObject[fields[i]]) == "object") { + objectTo[fields[i]] = bridgeObject(referenceObject[fields[i]]); + } + } + } + return objectTo; + } else { + return null; + } + } + /** + * This recursively redirects the prototype of JSON objects to the referenceObject. + * This is used for default options. + * + * @param referenceObject - The original object. + * @returns The Element if the referenceObject is an Element, or a new object inheriting from the referenceObject. + */ + function bridgeObject(referenceObject) { + if (referenceObject === null || _typeof$1(referenceObject) !== "object") { + return null; + } + if (referenceObject instanceof Element) { + // Avoid bridging DOM objects + return referenceObject; + } + var objectTo = _Object$create$1(referenceObject); + for (var i in referenceObject) { + if (Object.prototype.hasOwnProperty.call(referenceObject, i)) { + if (_typeof$1(referenceObject[i]) == "object") { + objectTo[i] = bridgeObject(referenceObject[i]); + } + } + } + return objectTo; + } + /** + * This method provides a stable sort implementation, very fast for presorted data. + * + * @param a - The array to be sorted (in-place). + * @param compare - An order comparator. + * @returns The argument a. + */ + function insertSort(a, compare) { + for (var i = 0; i < a.length; i++) { + var k = a[i]; + var j = void 0; + for (j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) { + a[j] = a[j - 1]; + } + a[j] = k; + } + return a; + } + /** + * This is used to set the options of subobjects in the options object. + * + * A requirement of these subobjects is that they have an 'enabled' element + * which is optional for the user but mandatory for the program. + * + * The added value here of the merge is that option 'enabled' is set as required. + * + * @param mergeTarget - Either this.options or the options used for the groups. + * @param options - Options. + * @param option - Option key in the options argument. + * @param globalOptions - Global options, passed in to determine value of option 'enabled'. + */ + function mergeOptions(mergeTarget, options, option) { + var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + // Local helpers + var isPresent = function isPresent(obj) { + return obj !== null && obj !== undefined; + }; + var isObject = function isObject(obj) { + return obj !== null && _typeof$1(obj) === "object"; + }; + // https://stackoverflow.com/a/34491287/1223531 + var isEmpty = function isEmpty(obj) { + for (var x in obj) { + if (Object.prototype.hasOwnProperty.call(obj, x)) { + return false; + } + } + return true; + }; + // Guards + if (!isObject(mergeTarget)) { + throw new Error("Parameter mergeTarget must be an object"); + } + if (!isObject(options)) { + throw new Error("Parameter options must be an object"); + } + if (!isPresent(option)) { + throw new Error("Parameter option must have a value"); + } + if (!isObject(globalOptions)) { + throw new Error("Parameter globalOptions must be an object"); + } + // + // Actual merge routine, separated from main logic + // Only a single level of options is merged. Deeper levels are ref'd. This may actually be an issue. + // + var doMerge = function doMerge(target, options, option) { + if (!isObject(target[option])) { + target[option] = {}; + } + var src = options[option]; + var dst = target[option]; + for (var prop in src) { + if (Object.prototype.hasOwnProperty.call(src, prop)) { + dst[prop] = src[prop]; + } + } + }; + // Local initialization + var srcOption = options[option]; + var globalPassed = isObject(globalOptions) && !isEmpty(globalOptions); + var globalOption = globalPassed ? globalOptions[option] : undefined; + var globalEnabled = globalOption ? globalOption.enabled : undefined; + ///////////////////////////////////////// + // Main routine + ///////////////////////////////////////// + if (srcOption === undefined) { + return; // Nothing to do + } + + if (typeof srcOption === "boolean") { + if (!isObject(mergeTarget[option])) { + mergeTarget[option] = {}; + } + mergeTarget[option].enabled = srcOption; + return; + } + if (srcOption === null && !isObject(mergeTarget[option])) { + // If possible, explicit copy from globals + if (isPresent(globalOption)) { + mergeTarget[option] = _Object$create$1(globalOption); + } else { + return; // Nothing to do + } + } + + if (!isObject(srcOption)) { + return; + } + // + // Ensure that 'enabled' is properly set. It is required internally + // Note that the value from options will always overwrite the existing value + // + var enabled = true; // default value + if (srcOption.enabled !== undefined) { + enabled = srcOption.enabled; + } else { + // Take from globals, if present + if (globalEnabled !== undefined) { + enabled = globalOption.enabled; + } + } + doMerge(mergeTarget, options, option); + mergeTarget[option].enabled = enabled; + } + /** + * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses + * this function will then iterate in both directions over this sorted list to find all visible items. + * + * @param orderedItems - Items ordered by start. + * @param comparator - -1 is lower, 0 is equal, 1 is higher. + * @param field - Property name on an item (That is item[field]). + * @param field2 - Second property name on an item (That is item[field][field2]). + * @returns Index of the found item or -1 if nothing was found. + */ + function binarySearchCustom(orderedItems, comparator, field, field2) { + var maxIterations = 10000; + var iteration = 0; + var low = 0; + var high = orderedItems.length - 1; + while (low <= high && iteration < maxIterations) { + var middle = Math.floor((low + high) / 2); + var item = orderedItems[middle]; + var value = field2 === undefined ? item[field] : item[field][field2]; + var searchResult = comparator(value); + if (searchResult == 0) { + // jihaa, found a visible item! + return middle; + } else if (searchResult == -1) { + // it is too small --> increase low + low = middle + 1; + } else { + // it is too big --> decrease high + high = middle - 1; + } + iteration++; + } + return -1; + } + /** + * This function does a binary search for a specific value in a sorted array. + * If it does not exist but is in between of two values, we return either the + * one before or the one after, depending on user input If it is found, we + * return the index, else -1. + * + * @param orderedItems - Sorted array. + * @param target - The searched value. + * @param field - Name of the property in items to be searched. + * @param sidePreference - If the target is between two values, should the index of the before or the after be returned? + * @param comparator - An optional comparator, returning -1, 0, 1 for \<, ===, \>. + * @returns The index of found value or -1 if nothing was found. + */ + function binarySearchValue(orderedItems, target, field, sidePreference, comparator) { + var maxIterations = 10000; + var iteration = 0; + var low = 0; + var high = orderedItems.length - 1; + var prevValue; + var value; + var nextValue; + var middle; + comparator = comparator != undefined ? comparator : function (a, b) { + return a == b ? 0 : a < b ? -1 : 1; + }; + while (low <= high && iteration < maxIterations) { + // get a new guess + middle = Math.floor(0.5 * (high + low)); + prevValue = orderedItems[Math.max(0, middle - 1)][field]; + value = orderedItems[middle][field]; + nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field]; + if (comparator(value, target) == 0) { + // we found the target + return middle; + } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) { + // target is in between of the previous and the current + return sidePreference == "before" ? Math.max(0, middle - 1) : middle; + } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) { + // target is in between of the current and the next + return sidePreference == "before" ? middle : Math.min(orderedItems.length - 1, middle + 1); + } else { + // didnt find the target, we need to change our boundaries. + if (comparator(value, target) < 0) { + // it is too small --> increase low + low = middle + 1; + } else { + // it is too big --> decrease high + high = middle - 1; + } + } + iteration++; + } + // didnt find anything. Return -1. + return -1; + } + /* + * Easing Functions. + * Only considering the t value for the range [0, 1] => [0, 1]. + * + * Inspiration: from http://gizma.com/easing/ + * https://gist.github.com/gre/1650294 + */ + var easingFunctions = { + /** + * Provides no easing and no acceleration. + * + * @param t - Time. + * @returns Value at time t. + */ + linear: function linear(t) { + return t; + }, + /** + * Accelerate from zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInQuad: function easeInQuad(t) { + return t * t; + }, + /** + * Decelerate to zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeOutQuad: function easeOutQuad(t) { + return t * (2 - t); + }, + /** + * Accelerate until halfway, then decelerate. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInOutQuad: function easeInOutQuad(t) { + return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; + }, + /** + * Accelerate from zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInCubic: function easeInCubic(t) { + return t * t * t; + }, + /** + * Decelerate to zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeOutCubic: function easeOutCubic(t) { + return --t * t * t + 1; + }, + /** + * Accelerate until halfway, then decelerate. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInOutCubic: function easeInOutCubic(t) { + return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; + }, + /** + * Accelerate from zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInQuart: function easeInQuart(t) { + return t * t * t * t; + }, + /** + * Decelerate to zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeOutQuart: function easeOutQuart(t) { + return 1 - --t * t * t * t; + }, + /** + * Accelerate until halfway, then decelerate. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInOutQuart: function easeInOutQuart(t) { + return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; + }, + /** + * Accelerate from zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInQuint: function easeInQuint(t) { + return t * t * t * t * t; + }, + /** + * Decelerate to zero velocity. + * + * @param t - Time. + * @returns Value at time t. + */ + easeOutQuint: function easeOutQuint(t) { + return 1 + --t * t * t * t * t; + }, + /** + * Accelerate until halfway, then decelerate. + * + * @param t - Time. + * @returns Value at time t. + */ + easeInOutQuint: function easeInOutQuint(t) { + return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t; + } + }; + /** + * Experimentaly compute the width of the scrollbar for this browser. + * + * @returns The width in pixels. + */ + function getScrollBarWidth() { + var inner = document.createElement("p"); + inner.style.width = "100%"; + inner.style.height = "200px"; + var outer = document.createElement("div"); + outer.style.position = "absolute"; + outer.style.top = "0px"; + outer.style.left = "0px"; + outer.style.visibility = "hidden"; + outer.style.width = "200px"; + outer.style.height = "150px"; + outer.style.overflow = "hidden"; + outer.appendChild(inner); + document.body.appendChild(outer); + var w1 = inner.offsetWidth; + outer.style.overflow = "scroll"; + var w2 = inner.offsetWidth; + if (w1 == w2) { + w2 = outer.clientWidth; + } + document.body.removeChild(outer); + return w1 - w2; + } + // @TODO: This doesn't work properly. + // It works only for single property objects, + // otherwise it combines all of the types in a union. + // export function topMost ( + // pile: Record[], + // accessors: K1 | [K1] + // ): undefined | V1 + // export function topMost ( + // pile: Record>[], + // accessors: [K1, K2] + // ): undefined | V1 | V2 + // export function topMost ( + // pile: Record>>[], + // accessors: [K1, K2, K3] + // ): undefined | V1 | V2 | V3 + /** + * Get the top most property value from a pile of objects. + * + * @param pile - Array of objects, no required format. + * @param accessors - Array of property names. + * For example `object['foo']['bar']` → `['foo', 'bar']`. + * @returns Value of the property with given accessors path from the first pile item where it's not undefined. + */ + function topMost(pile, accessors) { + var candidate; + if (!_Array$isArray(accessors)) { + accessors = [accessors]; + } + var _iterator3 = _createForOfIteratorHelper$7(pile), + _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var member = _step3.value; + if (member) { + candidate = member[accessors[0]]; + for (var i = 1; i < accessors.length; i++) { + if (candidate) { + candidate = candidate[accessors[i]]; + } + } + if (typeof candidate !== "undefined") { + break; + } + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + return candidate; + } + var htmlColors$1 = { + black: "#000000", + navy: "#000080", + darkblue: "#00008B", + mediumblue: "#0000CD", + blue: "#0000FF", + darkgreen: "#006400", + green: "#008000", + teal: "#008080", + darkcyan: "#008B8B", + deepskyblue: "#00BFFF", + darkturquoise: "#00CED1", + mediumspringgreen: "#00FA9A", + lime: "#00FF00", + springgreen: "#00FF7F", + aqua: "#00FFFF", + cyan: "#00FFFF", + midnightblue: "#191970", + dodgerblue: "#1E90FF", + lightseagreen: "#20B2AA", + forestgreen: "#228B22", + seagreen: "#2E8B57", + darkslategray: "#2F4F4F", + limegreen: "#32CD32", + mediumseagreen: "#3CB371", + turquoise: "#40E0D0", + royalblue: "#4169E1", + steelblue: "#4682B4", + darkslateblue: "#483D8B", + mediumturquoise: "#48D1CC", + indigo: "#4B0082", + darkolivegreen: "#556B2F", + cadetblue: "#5F9EA0", + cornflowerblue: "#6495ED", + mediumaquamarine: "#66CDAA", + dimgray: "#696969", + slateblue: "#6A5ACD", + olivedrab: "#6B8E23", + slategray: "#708090", + lightslategray: "#778899", + mediumslateblue: "#7B68EE", + lawngreen: "#7CFC00", + chartreuse: "#7FFF00", + aquamarine: "#7FFFD4", + maroon: "#800000", + purple: "#800080", + olive: "#808000", + gray: "#808080", + skyblue: "#87CEEB", + lightskyblue: "#87CEFA", + blueviolet: "#8A2BE2", + darkred: "#8B0000", + darkmagenta: "#8B008B", + saddlebrown: "#8B4513", + darkseagreen: "#8FBC8F", + lightgreen: "#90EE90", + mediumpurple: "#9370D8", + darkviolet: "#9400D3", + palegreen: "#98FB98", + darkorchid: "#9932CC", + yellowgreen: "#9ACD32", + sienna: "#A0522D", + brown: "#A52A2A", + darkgray: "#A9A9A9", + lightblue: "#ADD8E6", + greenyellow: "#ADFF2F", + paleturquoise: "#AFEEEE", + lightsteelblue: "#B0C4DE", + powderblue: "#B0E0E6", + firebrick: "#B22222", + darkgoldenrod: "#B8860B", + mediumorchid: "#BA55D3", + rosybrown: "#BC8F8F", + darkkhaki: "#BDB76B", + silver: "#C0C0C0", + mediumvioletred: "#C71585", + indianred: "#CD5C5C", + peru: "#CD853F", + chocolate: "#D2691E", + tan: "#D2B48C", + lightgrey: "#D3D3D3", + palevioletred: "#D87093", + thistle: "#D8BFD8", + orchid: "#DA70D6", + goldenrod: "#DAA520", + crimson: "#DC143C", + gainsboro: "#DCDCDC", + plum: "#DDA0DD", + burlywood: "#DEB887", + lightcyan: "#E0FFFF", + lavender: "#E6E6FA", + darksalmon: "#E9967A", + violet: "#EE82EE", + palegoldenrod: "#EEE8AA", + lightcoral: "#F08080", + khaki: "#F0E68C", + aliceblue: "#F0F8FF", + honeydew: "#F0FFF0", + azure: "#F0FFFF", + sandybrown: "#F4A460", + wheat: "#F5DEB3", + beige: "#F5F5DC", + whitesmoke: "#F5F5F5", + mintcream: "#F5FFFA", + ghostwhite: "#F8F8FF", + salmon: "#FA8072", + antiquewhite: "#FAEBD7", + linen: "#FAF0E6", + lightgoldenrodyellow: "#FAFAD2", + oldlace: "#FDF5E6", + red: "#FF0000", + fuchsia: "#FF00FF", + magenta: "#FF00FF", + deeppink: "#FF1493", + orangered: "#FF4500", + tomato: "#FF6347", + hotpink: "#FF69B4", + coral: "#FF7F50", + darkorange: "#FF8C00", + lightsalmon: "#FFA07A", + orange: "#FFA500", + lightpink: "#FFB6C1", + pink: "#FFC0CB", + gold: "#FFD700", + peachpuff: "#FFDAB9", + navajowhite: "#FFDEAD", + moccasin: "#FFE4B5", + bisque: "#FFE4C4", + mistyrose: "#FFE4E1", + blanchedalmond: "#FFEBCD", + papayawhip: "#FFEFD5", + lavenderblush: "#FFF0F5", + seashell: "#FFF5EE", + cornsilk: "#FFF8DC", + lemonchiffon: "#FFFACD", + floralwhite: "#FFFAF0", + snow: "#FFFAFA", + yellow: "#FFFF00", + lightyellow: "#FFFFE0", + ivory: "#FFFFF0", + white: "#FFFFFF" + }; + + /** + * @param {number} [pixelRatio=1] + */ + var ColorPicker$1 = /*#__PURE__*/function () { + /** + * @param {number} [pixelRatio=1] + */ + function ColorPicker() { + var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + _classCallCheck(this, ColorPicker); + this.pixelRatio = pixelRatio; + this.generated = false; + this.centerCoordinates = { + x: 289 / 2, + y: 289 / 2 + }; + this.r = 289 * 0.49; + this.color = { + r: 255, + g: 255, + b: 255, + a: 1.0 + }; + this.hueCircle = undefined; + this.initialColor = { + r: 255, + g: 255, + b: 255, + a: 1.0 + }; + this.previousColor = undefined; + this.applied = false; + + // bound by + this.updateCallback = function () {}; + this.closeCallback = function () {}; + + // create all DOM elements + this._create(); + } + + /** + * this inserts the colorPicker into a div from the DOM + * + * @param {Element} container + */ + _createClass(ColorPicker, [{ + key: "insertTo", + value: function insertTo(container) { + if (this.hammer !== undefined) { + this.hammer.destroy(); + this.hammer = undefined; + } + this.container = container; + this.container.appendChild(this.frame); + this._bindHammer(); + this._setSize(); + } + + /** + * the callback is executed on apply and save. Bind it to the application + * + * @param {Function} callback + */ + }, { + key: "setUpdateCallback", + value: function setUpdateCallback(callback) { + if (typeof callback === "function") { + this.updateCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker update callback is not a function."); + } + } + + /** + * the callback is executed on apply and save. Bind it to the application + * + * @param {Function} callback + */ + }, { + key: "setCloseCallback", + value: function setCloseCallback(callback) { + if (typeof callback === "function") { + this.closeCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker closing callback is not a function."); + } + } + + /** + * + * @param {string} color + * @returns {string} + * @private + */ + }, { + key: "_isColorString", + value: function _isColorString(color) { + if (typeof color === "string") { + return htmlColors$1[color]; + } + } + + /** + * Set the color of the colorPicker + * Supported formats: + * 'red' --> HTML color string + * '#ffffff' --> hex string + * 'rgb(255,255,255)' --> rgb string + * 'rgba(255,255,255,1.0)' --> rgba string + * {r:255,g:255,b:255} --> rgb object + * {r:255,g:255,b:255,a:1.0} --> rgba object + * + * @param {string | object} color + * @param {boolean} [setInitial=true] + */ + }, { + key: "setColor", + value: function setColor(color) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + if (color === "none") { + return; + } + var rgba; + + // if a html color shorthand is used, convert to hex + var htmlColor = this._isColorString(color); + if (htmlColor !== undefined) { + color = htmlColor; + } + + // check format + if (isString(color) === true) { + if (isValidRGB(color) === true) { + var rgbaArray = color.substr(4).substr(0, color.length - 5).split(","); + rgba = { + r: rgbaArray[0], + g: rgbaArray[1], + b: rgbaArray[2], + a: 1.0 + }; + } else if (isValidRGBA(color) === true) { + var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(","); + rgba = { + r: _rgbaArray[0], + g: _rgbaArray[1], + b: _rgbaArray[2], + a: _rgbaArray[3] + }; + } else if (isValidHex(color) === true) { + var rgbObj = hexToRGB(color); + rgba = { + r: rgbObj.r, + g: rgbObj.g, + b: rgbObj.b, + a: 1.0 + }; + } + } else { + if (color instanceof Object) { + if (color.r !== undefined && color.g !== undefined && color.b !== undefined) { + var alpha = color.a !== undefined ? color.a : "1.0"; + rgba = { + r: color.r, + g: color.g, + b: color.b, + a: alpha + }; + } + } + } + + // set color + if (rgba === undefined) { + throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + _JSON$stringify(color)); + } else { + this._setColor(rgba, setInitial); + } + } + + /** + * this shows the color picker. + * The hue circle is constructed once and stored. + */ + }, { + key: "show", + value: function show() { + if (this.closeCallback !== undefined) { + this.closeCallback(); + this.closeCallback = undefined; + } + this.applied = false; + this.frame.style.display = "block"; + this._generateHueCircle(); + } + + // ------------------------------------------ PRIVATE ----------------------------- // + + /** + * Hide the picker. Is called by the cancel button. + * Optional boolean to store the previous color for easy access later on. + * + * @param {boolean} [storePrevious=true] + * @private + */ + }, { + key: "_hide", + value: function _hide() { + var _this2 = this; + var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + // store the previous color for next time; + if (storePrevious === true) { + this.previousColor = _Object$assign({}, this.color); + } + if (this.applied === true) { + this.updateCallback(this.initialColor); + } + this.frame.style.display = "none"; + + // call the closing callback, restoring the onclick method. + // this is in a setTimeout because it will trigger the show again before the click is done. + _setTimeout(function () { + if (_this2.closeCallback !== undefined) { + _this2.closeCallback(); + _this2.closeCallback = undefined; + } + }, 0); + } + + /** + * bound to the save button. Saves and hides. + * + * @private + */ + }, { + key: "_save", + value: function _save() { + this.updateCallback(this.color); + this.applied = false; + this._hide(); + } + + /** + * Bound to apply button. Saves but does not close. Is undone by the cancel button. + * + * @private + */ + }, { + key: "_apply", + value: function _apply() { + this.applied = true; + this.updateCallback(this.color); + this._updatePicker(this.color); + } + + /** + * load the color from the previous session. + * + * @private + */ + }, { + key: "_loadLast", + value: function _loadLast() { + if (this.previousColor !== undefined) { + this.setColor(this.previousColor, false); + } else { + alert("There is no last color to load..."); + } + } + + /** + * set the color, place the picker + * + * @param {object} rgba + * @param {boolean} [setInitial=true] + * @private + */ + }, { + key: "_setColor", + value: function _setColor(rgba) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + // store the initial color + if (setInitial === true) { + this.initialColor = _Object$assign({}, rgba); + } + this.color = rgba; + var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b); + var angleConvert = 2 * Math.PI; + var radius = this.r * hsv.s; + var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h); + var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h); + this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + "px"; + this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + "px"; + this._updatePicker(rgba); + } + + /** + * bound to opacity control + * + * @param {number} value + * @private + */ + }, { + key: "_setOpacity", + value: function _setOpacity(value) { + this.color.a = value / 100; + this._updatePicker(this.color); + } + + /** + * bound to brightness control + * + * @param {number} value + * @private + */ + }, { + key: "_setBrightness", + value: function _setBrightness(value) { + var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.v = value / 100; + var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba["a"] = this.color.a; + this.color = rgba; + this._updatePicker(); + } + + /** + * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing. + * + * @param {object} rgba + * @private + */ + }, { + key: "_updatePicker", + value: function _updatePicker() { + var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color; + var hsv = RGBToHSV(rgba.r, rgba.g, rgba.b); + var ctx = this.colorPickerCanvas.getContext("2d"); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + } + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); + ctx.putImageData(this.hueCircle, 0, 0); + ctx.fillStyle = "rgba(0,0,0," + (1 - hsv.v) + ")"; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + _fillInstanceProperty(ctx).call(ctx); + this.brightnessRange.value = 100 * hsv.v; + this.opacityRange.value = 100 * rgba.a; + this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")"; + this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"; + } + + /** + * used by create to set the size of the canvas. + * + * @private + */ + }, { + key: "_setSize", + value: function _setSize() { + this.colorPickerCanvas.style.width = "100%"; + this.colorPickerCanvas.style.height = "100%"; + this.colorPickerCanvas.width = 289 * this.pixelRatio; + this.colorPickerCanvas.height = 289 * this.pixelRatio; + } + + /** + * create all dom elements + * TODO: cleanup, lots of similar dom elements + * + * @private + */ + }, { + key: "_create", + value: function _create() { + var _context12, _context13, _context14, _context15; + this.frame = document.createElement("div"); + this.frame.className = "vis-color-picker"; + this.colorPickerDiv = document.createElement("div"); + this.colorPickerSelector = document.createElement("div"); + this.colorPickerSelector.className = "vis-selector"; + this.colorPickerDiv.appendChild(this.colorPickerSelector); + this.colorPickerCanvas = document.createElement("canvas"); + this.colorPickerDiv.appendChild(this.colorPickerCanvas); + if (!this.colorPickerCanvas.getContext) { + var noCanvas = document.createElement("DIV"); + noCanvas.style.color = "red"; + noCanvas.style.fontWeight = "bold"; + noCanvas.style.padding = "10px"; + noCanvas.innerText = "Error: your browser does not support HTML canvas"; + this.colorPickerCanvas.appendChild(noCanvas); + } else { + var ctx = this.colorPickerCanvas.getContext("2d"); + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + } + this.colorPickerDiv.className = "vis-color"; + this.opacityDiv = document.createElement("div"); + this.opacityDiv.className = "vis-opacity"; + this.brightnessDiv = document.createElement("div"); + this.brightnessDiv.className = "vis-brightness"; + this.arrowDiv = document.createElement("div"); + this.arrowDiv.className = "vis-arrow"; + this.opacityRange = document.createElement("input"); + try { + this.opacityRange.type = "range"; // Not supported on IE9 + this.opacityRange.min = "0"; + this.opacityRange.max = "100"; + } catch (err) { + // TODO: Add some error handling. + } + this.opacityRange.value = "100"; + this.opacityRange.className = "vis-range"; + this.brightnessRange = document.createElement("input"); + try { + this.brightnessRange.type = "range"; // Not supported on IE9 + this.brightnessRange.min = "0"; + this.brightnessRange.max = "100"; + } catch (err) { + // TODO: Add some error handling. + } + this.brightnessRange.value = "100"; + this.brightnessRange.className = "vis-range"; + this.opacityDiv.appendChild(this.opacityRange); + this.brightnessDiv.appendChild(this.brightnessRange); + var me = this; + this.opacityRange.onchange = function () { + me._setOpacity(this.value); + }; + this.opacityRange.oninput = function () { + me._setOpacity(this.value); + }; + this.brightnessRange.onchange = function () { + me._setBrightness(this.value); + }; + this.brightnessRange.oninput = function () { + me._setBrightness(this.value); + }; + this.brightnessLabel = document.createElement("div"); + this.brightnessLabel.className = "vis-label vis-brightness"; + this.brightnessLabel.innerText = "brightness:"; + this.opacityLabel = document.createElement("div"); + this.opacityLabel.className = "vis-label vis-opacity"; + this.opacityLabel.innerText = "opacity:"; + this.newColorDiv = document.createElement("div"); + this.newColorDiv.className = "vis-new-color"; + this.newColorDiv.innerText = "new"; + this.initialColorDiv = document.createElement("div"); + this.initialColorDiv.className = "vis-initial-color"; + this.initialColorDiv.innerText = "initial"; + this.cancelButton = document.createElement("div"); + this.cancelButton.className = "vis-button vis-cancel"; + this.cancelButton.innerText = "cancel"; + this.cancelButton.onclick = _bindInstanceProperty$1(_context12 = this._hide).call(_context12, this, false); + this.applyButton = document.createElement("div"); + this.applyButton.className = "vis-button vis-apply"; + this.applyButton.innerText = "apply"; + this.applyButton.onclick = _bindInstanceProperty$1(_context13 = this._apply).call(_context13, this); + this.saveButton = document.createElement("div"); + this.saveButton.className = "vis-button vis-save"; + this.saveButton.innerText = "save"; + this.saveButton.onclick = _bindInstanceProperty$1(_context14 = this._save).call(_context14, this); + this.loadButton = document.createElement("div"); + this.loadButton.className = "vis-button vis-load"; + this.loadButton.innerText = "load last"; + this.loadButton.onclick = _bindInstanceProperty$1(_context15 = this._loadLast).call(_context15, this); + this.frame.appendChild(this.colorPickerDiv); + this.frame.appendChild(this.arrowDiv); + this.frame.appendChild(this.brightnessLabel); + this.frame.appendChild(this.brightnessDiv); + this.frame.appendChild(this.opacityLabel); + this.frame.appendChild(this.opacityDiv); + this.frame.appendChild(this.newColorDiv); + this.frame.appendChild(this.initialColorDiv); + this.frame.appendChild(this.cancelButton); + this.frame.appendChild(this.applyButton); + this.frame.appendChild(this.saveButton); + this.frame.appendChild(this.loadButton); + } + + /** + * bind hammer to the color picker + * + * @private + */ + }, { + key: "_bindHammer", + value: function _bindHammer() { + var _this3 = this; + this.drag = {}; + this.pinch = {}; + this.hammer = new Hammer$1(this.colorPickerCanvas); + this.hammer.get("pinch").set({ + enable: true + }); + this.hammer.on("hammer.input", function (event) { + if (event.isFirst) { + _this3._moveSelector(event); + } + }); + this.hammer.on("tap", function (event) { + _this3._moveSelector(event); + }); + this.hammer.on("panstart", function (event) { + _this3._moveSelector(event); + }); + this.hammer.on("panmove", function (event) { + _this3._moveSelector(event); + }); + this.hammer.on("panend", function (event) { + _this3._moveSelector(event); + }); + } + + /** + * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. + * + * @private + */ + }, { + key: "_generateHueCircle", + value: function _generateHueCircle() { + if (this.generated === false) { + var ctx = this.colorPickerCanvas.getContext("2d"); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + } + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); + + // draw hue circle + var x, y, hue, sat; + this.centerCoordinates = { + x: w * 0.5, + y: h * 0.5 + }; + this.r = 0.49 * w; + var angleConvert = 2 * Math.PI / 360; + var hfac = 1 / 360; + var sfac = 1 / this.r; + var rgb; + for (hue = 0; hue < 360; hue++) { + for (sat = 0; sat < this.r; sat++) { + x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue); + y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue); + rgb = HSVToRGB(hue * hfac, sat * sfac, 1); + ctx.fillStyle = "rgb(" + rgb.r + "," + rgb.g + "," + rgb.b + ")"; + ctx.fillRect(x - 0.5, y - 0.5, 2, 2); + } + } + ctx.strokeStyle = "rgba(0,0,0,1)"; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + ctx.stroke(); + this.hueCircle = ctx.getImageData(0, 0, w, h); + } + this.generated = true; + } + + /** + * move the selector. This is called by hammer functions. + * + * @param {Event} event The event + * @private + */ + }, { + key: "_moveSelector", + value: function _moveSelector(event) { + var rect = this.colorPickerDiv.getBoundingClientRect(); + var left = event.center.x - rect.left; + var top = event.center.y - rect.top; + var centerY = 0.5 * this.colorPickerDiv.clientHeight; + var centerX = 0.5 * this.colorPickerDiv.clientWidth; + var x = left - centerX; + var y = top - centerY; + var angle = Math.atan2(x, y); + var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX); + var newTop = Math.cos(angle) * radius + centerY; + var newLeft = Math.sin(angle) * radius + centerX; + this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + "px"; + this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + "px"; + + // set color + var h = angle / (2 * Math.PI); + h = h < 0 ? h + 1 : h; + var s = radius / this.r; + var hsv = RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.h = h; + hsv.s = s; + var rgba = HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba["a"] = this.color.a; + this.color = rgba; + + // update previews + this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")"; + this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"; + } + }]); + return ColorPicker; + }(); + + /** + * Wrap given text (last argument) in HTML elements (all preceding arguments). + * + * @param {...any} rest - List of tag names followed by inner text. + * @returns An element or a text node. + */ + function wrapInTag() { + for (var _len5 = arguments.length, rest = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + rest[_key5] = arguments[_key5]; + } + if (rest.length < 1) { + throw new TypeError("Invalid arguments."); + } else if (rest.length === 1) { + return document.createTextNode(rest[0]); + } else { + var element = document.createElement(rest[0]); + element.appendChild(wrapInTag.apply(void 0, _toConsumableArray(_sliceInstanceProperty(rest).call(rest, 1)))); + return element; + } + } + + /** + * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. + * Boolean options are recognised as Boolean + * Number options should be written as array: [default value, min value, max value, stepsize] + * Colors should be written as array: ['color', '#ffffff'] + * Strings with should be written as array: [option1, option2, option3, ..] + * + * The options are matched with their counterparts in each of the modules and the values used in the configuration are + */ + var Configurator$1 = /*#__PURE__*/function () { + /** + * @param {object} parentModule | the location where parentModule.setOptions() can be called + * @param {object} defaultContainer | the default container of the module + * @param {object} configureOptions | the fully configured and predefined options set found in allOptions.js + * @param {number} pixelRatio | canvas pixel ratio + * @param {Function} hideOption | custom logic to dynamically hide options + */ + function Configurator(parentModule, defaultContainer, configureOptions) { + var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + var hideOption = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () { + return false; + }; + _classCallCheck(this, Configurator); + this.parent = parentModule; + this.changedOptions = []; + this.container = defaultContainer; + this.allowCreation = false; + this.hideOption = hideOption; + this.options = {}; + this.initialized = false; + this.popupCounter = 0; + this.defaultOptions = { + enabled: false, + filter: true, + container: undefined, + showButton: true + }; + _Object$assign(this.options, this.defaultOptions); + this.configureOptions = configureOptions; + this.moduleOptions = {}; + this.domElements = []; + this.popupDiv = {}; + this.popupLimit = 5; + this.popupHistory = {}; + this.colorPicker = new ColorPicker$1(pixelRatio); + this.wrapper = undefined; + } + + /** + * refresh all options. + * Because all modules parse their options by themselves, we just use their options. We copy them here. + * + * @param {object} options + */ + _createClass(Configurator, [{ + key: "setOptions", + value: function setOptions(options) { + if (options !== undefined) { + // reset the popup history because the indices may have been changed. + this.popupHistory = {}; + this._removePopup(); + var enabled = true; + if (typeof options === "string") { + this.options.filter = options; + } else if (_Array$isArray(options)) { + this.options.filter = options.join(); + } else if (_typeof$1(options) === "object") { + if (options == null) { + throw new TypeError("options cannot be null"); + } + if (options.container !== undefined) { + this.options.container = options.container; + } + if (_filterInstanceProperty(options) !== undefined) { + this.options.filter = _filterInstanceProperty(options); + } + if (options.showButton !== undefined) { + this.options.showButton = options.showButton; + } + if (options.enabled !== undefined) { + enabled = options.enabled; + } + } else if (typeof options === "boolean") { + this.options.filter = true; + enabled = options; + } else if (typeof options === "function") { + this.options.filter = options; + enabled = true; + } + if (_filterInstanceProperty(this.options) === false) { + enabled = false; + } + this.options.enabled = enabled; + } + this._clean(); + } + + /** + * + * @param {object} moduleOptions + */ + }, { + key: "setModuleOptions", + value: function setModuleOptions(moduleOptions) { + this.moduleOptions = moduleOptions; + if (this.options.enabled === true) { + this._clean(); + if (this.options.container !== undefined) { + this.container = this.options.container; + } + this._create(); + } + } + + /** + * Create all DOM elements + * + * @private + */ + }, { + key: "_create", + value: function _create() { + this._clean(); + this.changedOptions = []; + var filter = _filterInstanceProperty(this.options); + var counter = 0; + var show = false; + for (var _option in this.configureOptions) { + if (Object.prototype.hasOwnProperty.call(this.configureOptions, _option)) { + this.allowCreation = false; + show = false; + if (typeof filter === "function") { + show = filter(_option, []); + show = show || this._handleObject(this.configureOptions[_option], [_option], true); + } else if (filter === true || _indexOfInstanceProperty(filter).call(filter, _option) !== -1) { + show = true; + } + if (show !== false) { + this.allowCreation = true; + + // linebreak between categories + if (counter > 0) { + this._makeItem([]); + } + // a header for the category + this._makeHeader(_option); + + // get the sub options + this._handleObject(this.configureOptions[_option], [_option]); + } + counter++; + } + } + this._makeButton(); + this._push(); + //~ this.colorPicker.insertTo(this.container); + } + + /** + * draw all DOM elements on the screen + * + * @private + */ + }, { + key: "_push", + value: function _push() { + this.wrapper = document.createElement("div"); + this.wrapper.className = "vis-configuration-wrapper"; + this.container.appendChild(this.wrapper); + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.appendChild(this.domElements[i]); + } + this._showPopupIfNeeded(); + } + + /** + * delete all DOM elements + * + * @private + */ + }, { + key: "_clean", + value: function _clean() { + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.removeChild(this.domElements[i]); + } + if (this.wrapper !== undefined) { + this.container.removeChild(this.wrapper); + this.wrapper = undefined; + } + this.domElements = []; + this._removePopup(); + } + + /** + * get the value from the actualOptions if it exists + * + * @param {Array} path | where to look for the actual option + * @returns {*} + * @private + */ + }, { + key: "_getValue", + value: function _getValue(path) { + var base = this.moduleOptions; + for (var i = 0; i < path.length; i++) { + if (base[path[i]] !== undefined) { + base = base[path[i]]; + } else { + base = undefined; + break; + } + } + return base; + } + + /** + * all option elements are wrapped in an item + * + * @param {Array} path | where to look for the actual option + * @param {Array.} domElements + * @returns {number} + * @private + */ + }, { + key: "_makeItem", + value: function _makeItem(path) { + if (this.allowCreation === true) { + var item = document.createElement("div"); + item.className = "vis-configuration vis-config-item vis-config-s" + path.length; + for (var _len6 = arguments.length, domElements = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + domElements[_key6 - 1] = arguments[_key6]; + } + _forEachInstanceProperty(domElements).call(domElements, function (element) { + item.appendChild(element); + }); + this.domElements.push(item); + return this.domElements.length; + } + return 0; + } + + /** + * header for major subjects + * + * @param {string} name + * @private + */ + }, { + key: "_makeHeader", + value: function _makeHeader(name) { + var div = document.createElement("div"); + div.className = "vis-configuration vis-config-header"; + div.innerText = name; + this._makeItem([], div); + } + + /** + * make a label, if it is an object label, it gets different styling. + * + * @param {string} name + * @param {Array} path | where to look for the actual option + * @param {string} objectLabel + * @returns {HTMLElement} + * @private + */ + }, { + key: "_makeLabel", + value: function _makeLabel(name, path) { + var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var div = document.createElement("div"); + div.className = "vis-configuration vis-config-label vis-config-s" + path.length; + if (objectLabel === true) { + while (div.firstChild) { + div.removeChild(div.firstChild); + } + div.appendChild(wrapInTag("i", "b", name)); + } else { + div.innerText = name + ":"; + } + return div; + } + + /** + * make a dropdown list for multiple possible string optoins + * + * @param {Array.} arr + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeDropdown", + value: function _makeDropdown(arr, value, path) { + var select = document.createElement("select"); + select.className = "vis-configuration vis-config-select"; + var selectedValue = 0; + if (value !== undefined) { + if (_indexOfInstanceProperty(arr).call(arr, value) !== -1) { + selectedValue = _indexOfInstanceProperty(arr).call(arr, value); + } + } + for (var i = 0; i < arr.length; i++) { + var _option2 = document.createElement("option"); + _option2.value = arr[i]; + if (i === selectedValue) { + _option2.selected = "selected"; + } + _option2.innerText = arr[i]; + select.appendChild(_option2); + } + var me = this; + select.onchange = function () { + me._update(this.value, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, select); + } + + /** + * make a range object for numeric options + * + * @param {Array.} arr + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeRange", + value: function _makeRange(arr, value, path) { + var defaultValue = arr[0]; + var min = arr[1]; + var max = arr[2]; + var step = arr[3]; + var range = document.createElement("input"); + range.className = "vis-configuration vis-config-range"; + try { + range.type = "range"; // not supported on IE9 + range.min = min; + range.max = max; + } catch (err) { + // TODO: Add some error handling. + } + range.step = step; + + // set up the popup settings in case they are needed. + var popupString = ""; + var popupValue = 0; + if (value !== undefined) { + var factor = 1.2; + if (value < 0 && value * factor < min) { + range.min = Math.ceil(value * factor); + popupValue = range.min; + popupString = "range increased"; + } else if (value / factor < min) { + range.min = Math.ceil(value / factor); + popupValue = range.min; + popupString = "range increased"; + } + if (value * factor > max && max !== 1) { + range.max = Math.ceil(value * factor); + popupValue = range.max; + popupString = "range increased"; + } + range.value = value; + } else { + range.value = defaultValue; + } + var input = document.createElement("input"); + input.className = "vis-configuration vis-config-rangeinput"; + input.value = range.value; + var me = this; + range.onchange = function () { + input.value = this.value; + me._update(Number(this.value), path); + }; + range.oninput = function () { + input.value = this.value; + }; + var label = this._makeLabel(path[path.length - 1], path); + var itemIndex = this._makeItem(path, label, range, input); + + // if a popup is needed AND it has not been shown for this value, show it. + if (popupString !== "" && this.popupHistory[itemIndex] !== popupValue) { + this.popupHistory[itemIndex] = popupValue; + this._setupPopup(popupString, itemIndex); + } + } + + /** + * make a button object + * + * @private + */ + }, { + key: "_makeButton", + value: function _makeButton() { + var _this4 = this; + if (this.options.showButton === true) { + var generateButton = document.createElement("div"); + generateButton.className = "vis-configuration vis-config-button"; + generateButton.innerText = "generate options"; + generateButton.onclick = function () { + _this4._printOptions(); + }; + generateButton.onmouseover = function () { + generateButton.className = "vis-configuration vis-config-button hover"; + }; + generateButton.onmouseout = function () { + generateButton.className = "vis-configuration vis-config-button"; + }; + this.optionsContainer = document.createElement("div"); + this.optionsContainer.className = "vis-configuration vis-config-option-container"; + this.domElements.push(this.optionsContainer); + this.domElements.push(generateButton); + } + } + + /** + * prepare the popup + * + * @param {string} string + * @param {number} index + * @private + */ + }, { + key: "_setupPopup", + value: function _setupPopup(string, index) { + var _this5 = this; + if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) { + var div = document.createElement("div"); + div.id = "vis-configuration-popup"; + div.className = "vis-configuration-popup"; + div.innerText = string; + div.onclick = function () { + _this5._removePopup(); + }; + this.popupCounter += 1; + this.popupDiv = { + html: div, + index: index + }; + } + } + + /** + * remove the popup from the dom + * + * @private + */ + }, { + key: "_removePopup", + value: function _removePopup() { + if (this.popupDiv.html !== undefined) { + this.popupDiv.html.parentNode.removeChild(this.popupDiv.html); + clearTimeout(this.popupDiv.hideTimeout); + clearTimeout(this.popupDiv.deleteTimeout); + this.popupDiv = {}; + } + } + + /** + * Show the popup if it is needed. + * + * @private + */ + }, { + key: "_showPopupIfNeeded", + value: function _showPopupIfNeeded() { + var _this6 = this; + if (this.popupDiv.html !== undefined) { + var correspondingElement = this.domElements[this.popupDiv.index]; + var rect = correspondingElement.getBoundingClientRect(); + this.popupDiv.html.style.left = rect.left + "px"; + this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height; + document.body.appendChild(this.popupDiv.html); + this.popupDiv.hideTimeout = _setTimeout(function () { + _this6.popupDiv.html.style.opacity = 0; + }, 1500); + this.popupDiv.deleteTimeout = _setTimeout(function () { + _this6._removePopup(); + }, 1800); + } + } + + /** + * make a checkbox for boolean options. + * + * @param {number} defaultValue + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeCheckbox", + value: function _makeCheckbox(defaultValue, value, path) { + var checkbox = document.createElement("input"); + checkbox.type = "checkbox"; + checkbox.className = "vis-configuration vis-config-checkbox"; + checkbox.checked = defaultValue; + if (value !== undefined) { + checkbox.checked = value; + if (value !== defaultValue) { + if (_typeof$1(defaultValue) === "object") { + if (value !== defaultValue.enabled) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else { + this.changedOptions.push({ + path: path, + value: value + }); + } + } + } + var me = this; + checkbox.onchange = function () { + me._update(this.checked, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); + } + + /** + * make a text input field for string options. + * + * @param {number} defaultValue + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeTextInput", + value: function _makeTextInput(defaultValue, value, path) { + var checkbox = document.createElement("input"); + checkbox.type = "text"; + checkbox.className = "vis-configuration vis-config-text"; + checkbox.value = value; + if (value !== defaultValue) { + this.changedOptions.push({ + path: path, + value: value + }); + } + var me = this; + checkbox.onchange = function () { + me._update(this.value, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); + } + + /** + * make a color field with a color picker for color fields + * + * @param {Array.} arr + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeColorField", + value: function _makeColorField(arr, value, path) { + var _this7 = this; + var defaultColor = arr[1]; + var div = document.createElement("div"); + value = value === undefined ? defaultColor : value; + if (value !== "none") { + div.className = "vis-configuration vis-config-colorBlock"; + div.style.backgroundColor = value; + } else { + div.className = "vis-configuration vis-config-colorBlock none"; + } + value = value === undefined ? defaultColor : value; + div.onclick = function () { + _this7._showColorPicker(value, div, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, div); + } + + /** + * used by the color buttons to call the color picker. + * + * @param {number} value + * @param {HTMLElement} div + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_showColorPicker", + value: function _showColorPicker(value, div, path) { + var _this8 = this; + // clear the callback from this div + div.onclick = function () {}; + this.colorPicker.insertTo(div); + this.colorPicker.show(); + this.colorPicker.setColor(value); + this.colorPicker.setUpdateCallback(function (color) { + var colorString = "rgba(" + color.r + "," + color.g + "," + color.b + "," + color.a + ")"; + div.style.backgroundColor = colorString; + _this8._update(colorString, path); + }); + + // on close of the colorpicker, restore the callback. + this.colorPicker.setCloseCallback(function () { + div.onclick = function () { + _this8._showColorPicker(value, div, path); + }; + }); + } + + /** + * parse an object and draw the correct items + * + * @param {object} obj + * @param {Array} [path=[]] | where to look for the actual option + * @param {boolean} [checkOnly=false] + * @returns {boolean} + * @private + */ + }, { + key: "_handleObject", + value: function _handleObject(obj) { + var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var show = false; + var filter = _filterInstanceProperty(this.options); + var visibleInSet = false; + for (var subObj in obj) { + if (Object.prototype.hasOwnProperty.call(obj, subObj)) { + show = true; + var item = obj[subObj]; + var newPath = copyAndExtendArray(path, subObj); + if (typeof filter === "function") { + show = filter(subObj, path); + + // if needed we must go deeper into the object. + if (show === false) { + if (!_Array$isArray(item) && typeof item !== "string" && typeof item !== "boolean" && item instanceof Object) { + this.allowCreation = false; + show = this._handleObject(item, newPath, true); + this.allowCreation = checkOnly === false; + } + } + } + if (show !== false) { + visibleInSet = true; + var value = this._getValue(newPath); + if (_Array$isArray(item)) { + this._handleArray(item, value, newPath); + } else if (typeof item === "string") { + this._makeTextInput(item, value, newPath); + } else if (typeof item === "boolean") { + this._makeCheckbox(item, value, newPath); + } else if (item instanceof Object) { + // skip the options that are not enabled + if (!this.hideOption(path, subObj, this.moduleOptions)) { + // initially collapse options with an disabled enabled option. + if (item.enabled !== undefined) { + var enabledPath = copyAndExtendArray(newPath, "enabled"); + var enabledValue = this._getValue(enabledPath); + if (enabledValue === true) { + var label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } else { + this._makeCheckbox(item, enabledValue, newPath); + } + } else { + var _label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, _label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } + } + } else { + console.error("dont know how to handle", item, subObj, newPath); + } + } + } + } + return visibleInSet; + } + + /** + * handle the array type of option + * + * @param {Array.} arr + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_handleArray", + value: function _handleArray(arr, value, path) { + if (typeof arr[0] === "string" && arr[0] === "color") { + this._makeColorField(arr, value, path); + if (arr[1] !== value) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else if (typeof arr[0] === "string") { + this._makeDropdown(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else if (typeof arr[0] === "number") { + this._makeRange(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ + path: path, + value: Number(value) + }); + } + } + } + + /** + * called to update the network with the new settings. + * + * @param {number} value + * @param {Array} path | where to look for the actual option + * @private + */ + }, { + key: "_update", + value: function _update(value, path) { + var options = this._constructOptions(value, path); + if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) { + this.parent.body.emitter.emit("configChange", options); + } + this.initialized = true; + this.parent.setOptions(options); + } + + /** + * + * @param {string | boolean} value + * @param {Array.} path + * @param {{}} optionsObj + * @returns {{}} + * @private + */ + }, { + key: "_constructOptions", + value: function _constructOptions(value, path) { + var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var pointer = optionsObj; + + // when dropdown boxes can be string or boolean, we typecast it into correct types + value = value === "true" ? true : value; + value = value === "false" ? false : value; + for (var i = 0; i < path.length; i++) { + if (path[i] !== "global") { + if (pointer[path[i]] === undefined) { + pointer[path[i]] = {}; + } + if (i !== path.length - 1) { + pointer = pointer[path[i]]; + } else { + pointer[path[i]] = value; + } + } + } + return optionsObj; + } + + /** + * @private + */ + }, { + key: "_printOptions", + value: function _printOptions() { + var options = this.getOptions(); + while (this.optionsContainer.firstChild) { + this.optionsContainer.removeChild(this.optionsContainer.firstChild); + } + this.optionsContainer.appendChild(wrapInTag("pre", "const options = " + _JSON$stringify(options, null, 2))); + } + + /** + * + * @returns {{}} options + */ + }, { + key: "getOptions", + value: function getOptions() { + var options = {}; + for (var i = 0; i < this.changedOptions.length; i++) { + this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options); + } + return options; + } + }]); + return Configurator; + }(); + + /** + * Popup is a class to create a popup window with some text + */ + var Popup$1 = /*#__PURE__*/function () { + /** + * @param {Element} container The container object. + * @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap') + */ + function Popup(container, overflowMethod) { + _classCallCheck(this, Popup); + this.container = container; + this.overflowMethod = overflowMethod || "cap"; + this.x = 0; + this.y = 0; + this.padding = 5; + this.hidden = false; + + // create the frame + this.frame = document.createElement("div"); + this.frame.className = "vis-tooltip"; + this.container.appendChild(this.frame); + } + + /** + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window + */ + _createClass(Popup, [{ + key: "setPosition", + value: function setPosition(x, y) { + this.x = _parseInt$1(x); + this.y = _parseInt$1(y); + } + + /** + * Set the content for the popup window. This can be HTML code or text. + * + * @param {string | Element} content + */ + }, { + key: "setText", + value: function setText(content) { + if (content instanceof Element) { + while (this.frame.firstChild) { + this.frame.removeChild(this.frame.firstChild); + } + this.frame.appendChild(content); + } else { + // String containing literal text, element has to be used for HTML due to + // XSS risks associated with innerHTML (i.e. prevent XSS by accident). + this.frame.innerText = content; + } + } + + /** + * Show the popup window + * + * @param {boolean} [doShow] Show or hide the window + */ + }, { + key: "show", + value: function show(doShow) { + if (doShow === undefined) { + doShow = true; + } + if (doShow === true) { + var height = this.frame.clientHeight; + var width = this.frame.clientWidth; + var maxHeight = this.frame.parentNode.clientHeight; + var maxWidth = this.frame.parentNode.clientWidth; + var left = 0, + top = 0; + if (this.overflowMethod == "flip") { + var isLeft = false, + isTop = true; // Where around the position it's located + + if (this.y - height < this.padding) { + isTop = false; + } + if (this.x + width > maxWidth - this.padding) { + isLeft = true; + } + if (isLeft) { + left = this.x - width; + } else { + left = this.x; + } + if (isTop) { + top = this.y - height; + } else { + top = this.y; + } + } else { + top = this.y - height; + if (top + height + this.padding > maxHeight) { + top = maxHeight - height - this.padding; + } + if (top < this.padding) { + top = this.padding; + } + left = this.x; + if (left + width + this.padding > maxWidth) { + left = maxWidth - width - this.padding; + } + if (left < this.padding) { + left = this.padding; + } + } + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; + this.hidden = false; + } else { + this.hide(); + } + } + + /** + * Hide the popup window + */ + }, { + key: "hide", + value: function hide() { + this.hidden = true; + this.frame.style.left = "0"; + this.frame.style.top = "0"; + this.frame.style.visibility = "hidden"; + } + + /** + * Remove the popup window + */ + }, { + key: "destroy", + value: function destroy() { + this.frame.parentNode.removeChild(this.frame); // Remove element from DOM + } + }]); + return Popup; + }(); + var errorFound$1 = false; + var allOptions$3; + var VALIDATOR_PRINT_STYLE$1 = "background: #FFeeee; color: #dd0000"; + + /** + * Used to validate options. + */ + var Validator$1 = /*#__PURE__*/function () { + function Validator() { + _classCallCheck(this, Validator); + } + _createClass(Validator, null, [{ + key: "validate", + value: + /** + * Main function to be called + * + * @param {object} options + * @param {object} referenceOptions + * @param {object} subObject + * @returns {boolean} + * @static + */ + function validate(options, referenceOptions, subObject) { + errorFound$1 = false; + allOptions$3 = referenceOptions; + var usedOptions = referenceOptions; + if (subObject !== undefined) { + usedOptions = referenceOptions[subObject]; + } + Validator.parse(options, usedOptions, []); + return errorFound$1; + } + + /** + * Will traverse an object recursively and check every value + * + * @param {object} options + * @param {object} referenceOptions + * @param {Array} path | where to look for the actual option + * @static + */ + }, { + key: "parse", + value: function parse(options, referenceOptions, path) { + for (var _option3 in options) { + if (Object.prototype.hasOwnProperty.call(options, _option3)) { + Validator.check(_option3, options, referenceOptions, path); + } + } + } + + /** + * Check every value. If the value is an object, call the parse function on that object. + * + * @param {string} option + * @param {object} options + * @param {object} referenceOptions + * @param {Array} path | where to look for the actual option + * @static + */ + }, { + key: "check", + value: function check(option, options, referenceOptions, path) { + if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) { + Validator.getSuggestion(option, referenceOptions, path); + return; + } + var referenceOption = option; + var is_object = true; + if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { + // NOTE: This only triggers if the __any__ is in the top level of the options object. + // THAT'S A REALLY BAD PLACE TO ALLOW IT!!!! + // TODO: Examine if needed, remove if possible + + // __any__ is a wildcard. Any value is accepted and will be further analysed by reference. + referenceOption = "__any__"; + + // if the any-subgroup is not a predefined object in the configurator, + // we do not look deeper into the object. + is_object = Validator.getType(options[option]) === "object"; + } + var refOptionObj = referenceOptions[referenceOption]; + if (is_object && refOptionObj.__type__ !== undefined) { + refOptionObj = refOptionObj.__type__; + } + Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path); + } + + /** + * + * @param {string} option | the option property + * @param {object} options | The supplied options object + * @param {object} referenceOptions | The reference options containing all options and their allowed formats + * @param {string} referenceOption | Usually this is the same as option, except when handling an __any__ tag. + * @param {string} refOptionObj | This is the type object from the reference options + * @param {Array} path | where in the object is the option + * @static + */ + }, { + key: "checkFields", + value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) { + var log = function log(message) { + console.error("%c" + message + Validator.printLocation(path, option), VALIDATOR_PRINT_STYLE$1); + }; + var optionType = Validator.getType(options[option]); + var refOptionType = refOptionObj[optionType]; + if (refOptionType !== undefined) { + // if the type is correct, we check if it is supposed to be one of a few select values + if (Validator.getType(refOptionType) === "array" && _indexOfInstanceProperty(refOptionType).call(refOptionType, options[option]) === -1) { + log('Invalid option detected in "' + option + '".' + " Allowed values are:" + Validator.print(refOptionType) + ' not "' + options[option] + '". '); + errorFound$1 = true; + } else if (optionType === "object" && referenceOption !== "__any__") { + path = copyAndExtendArray(path, option); + Validator.parse(options[option], referenceOptions[referenceOption], path); + } + } else if (refOptionObj["any"] === undefined) { + // type of the field is incorrect and the field cannot be any + log('Invalid type received for "' + option + '". Expected: ' + Validator.print(_Object$keys(refOptionObj)) + ". Received [" + optionType + '] "' + options[option] + '"'); + errorFound$1 = true; + } + } + + /** + * + * @param {object | boolean | number | string | Array. | Date | Node | Moment | undefined | null} object + * @returns {string} + * @static + */ + }, { + key: "getType", + value: function getType(object) { + var type = _typeof$1(object); + if (type === "object") { + if (object === null) { + return "null"; + } + if (object instanceof Boolean) { + return "boolean"; + } + if (object instanceof Number) { + return "number"; + } + if (object instanceof String) { + return "string"; + } + if (_Array$isArray(object)) { + return "array"; + } + if (object instanceof Date) { + return "date"; + } + if (object.nodeType !== undefined) { + return "dom"; + } + if (object._isAMomentObject === true) { + return "moment"; + } + return "object"; + } else if (type === "number") { + return "number"; + } else if (type === "boolean") { + return "boolean"; + } else if (type === "string") { + return "string"; + } else if (type === undefined) { + return "undefined"; + } + return type; + } + + /** + * @param {string} option + * @param {object} options + * @param {Array.} path + * @static + */ + }, { + key: "getSuggestion", + value: function getSuggestion(option, options, path) { + var localSearch = Validator.findInOptions(option, options, path, false); + var globalSearch = Validator.findInOptions(option, allOptions$3, [], true); + var localSearchThreshold = 8; + var globalSearchThreshold = 4; + var msg; + if (localSearch.indexMatch !== undefined) { + msg = " in " + Validator.printLocation(localSearch.path, option, "") + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n'; + } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) { + msg = " in " + Validator.printLocation(localSearch.path, option, "") + "Perhaps it was misplaced? Matching option found at: " + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, ""); + } else if (localSearch.distance <= localSearchThreshold) { + msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option); + } else { + msg = ". Did you mean one of these: " + Validator.print(_Object$keys(options)) + Validator.printLocation(path, option); + } + console.error('%cUnknown option detected: "' + option + '"' + msg, VALIDATOR_PRINT_STYLE$1); + errorFound$1 = true; + } + + /** + * traverse the options in search for a match. + * + * @param {string} option + * @param {object} options + * @param {Array} path | where to look for the actual option + * @param {boolean} [recursive=false] + * @returns {{closestMatch: string, path: Array, distance: number}} + * @static + */ + }, { + key: "findInOptions", + value: function findInOptions(option, options, path) { + var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + var min = 1e9; + var closestMatch = ""; + var closestMatchPath = []; + var lowerCaseOption = option.toLowerCase(); + var indexMatch = undefined; + for (var op in options) { + var distance = void 0; + if (options[op].__type__ !== undefined && recursive === true) { + var result = Validator.findInOptions(option, options[op], copyAndExtendArray(path, op)); + if (min > result.distance) { + closestMatch = result.closestMatch; + closestMatchPath = result.path; + min = result.distance; + indexMatch = result.indexMatch; + } + } else { + var _context16; + if (_indexOfInstanceProperty(_context16 = op.toLowerCase()).call(_context16, lowerCaseOption) !== -1) { + indexMatch = op; + } + distance = Validator.levenshteinDistance(option, op); + if (min > distance) { + closestMatch = op; + closestMatchPath = copyArray(path); + min = distance; + } + } + } + return { + closestMatch: closestMatch, + path: closestMatchPath, + distance: min, + indexMatch: indexMatch + }; + } + + /** + * @param {Array.} path + * @param {object} option + * @param {string} prefix + * @returns {string} + * @static + */ + }, { + key: "printLocation", + value: function printLocation(path, option) { + var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Problem value found at: \n"; + var str = "\n\n" + prefix + "options = {\n"; + for (var i = 0; i < path.length; i++) { + for (var j = 0; j < i + 1; j++) { + str += " "; + } + str += path[i] + ": {\n"; + } + for (var _j = 0; _j < path.length + 1; _j++) { + str += " "; + } + str += option + "\n"; + for (var _i5 = 0; _i5 < path.length + 1; _i5++) { + for (var _j2 = 0; _j2 < path.length - _i5; _j2++) { + str += " "; + } + str += "}\n"; + } + return str + "\n\n"; + } + + /** + * @param {object} options + * @returns {string} + * @static + */ + }, { + key: "print", + value: function print(options) { + return _JSON$stringify(options).replace(/(")|(\[)|(\])|(,"__type__")/g, "").replace(/(,)/g, ", "); + } + + /** + * Compute the edit distance between the two given strings + * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript + * + * Copyright (c) 2011 Andrei Mackenzie + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @param {string} a + * @param {string} b + * @returns {Array.>}} + * @static + */ + }, { + key: "levenshteinDistance", + value: function levenshteinDistance(a, b) { + if (a.length === 0) return b.length; + if (b.length === 0) return a.length; + var matrix = []; + + // increment along the first column of each row + var i; + for (i = 0; i <= b.length; i++) { + matrix[i] = [i]; + } + + // increment each column in the first row + var j; + for (j = 0; j <= a.length; j++) { + matrix[0][j] = j; + } + + // Fill in the rest of the matrix + for (i = 1; i <= b.length; i++) { + for (j = 1; j <= a.length; j++) { + if (b.charAt(i - 1) == a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, + // substitution + Math.min(matrix[i][j - 1] + 1, + // insertion + matrix[i - 1][j] + 1)); // deletion + } + } + } + + return matrix[b.length][a.length]; + } + }]); + return Validator; + }(); + var Activator$2 = Activator$1; + var ColorPicker$2 = ColorPicker$1; + var Configurator$2 = Configurator$1; + var Hammer$2 = Hammer$1; + var Popup$2 = Popup$1; + var VALIDATOR_PRINT_STYLE = VALIDATOR_PRINT_STYLE$1; + var Validator$2 = Validator$1; + + var util$2 = /*#__PURE__*/Object.freeze({ + __proto__: null, + Activator: Activator$2, + Alea: Alea, + ColorPicker: ColorPicker$2, + Configurator: Configurator$2, + DELETE: DELETE, + HSVToHex: HSVToHex, + HSVToRGB: HSVToRGB, + Hammer: Hammer$2, + Popup: Popup$2, + RGBToHSV: RGBToHSV, + RGBToHex: RGBToHex, + VALIDATOR_PRINT_STYLE: VALIDATOR_PRINT_STYLE, + Validator: Validator$2, + addClassName: addClassName, + addCssText: addCssText, + addEventListener: addEventListener, + binarySearchCustom: binarySearchCustom, + binarySearchValue: binarySearchValue, + bridgeObject: bridgeObject, + copyAndExtendArray: copyAndExtendArray, + copyArray: copyArray, + deepExtend: deepExtend, + deepObjectAssign: deepObjectAssign, + easingFunctions: easingFunctions, + equalArray: equalArray, + extend: extend, + fillIfDefined: fillIfDefined, + forEach: forEach$4, + getAbsoluteLeft: getAbsoluteLeft, + getAbsoluteRight: getAbsoluteRight, + getAbsoluteTop: getAbsoluteTop, + getScrollBarWidth: getScrollBarWidth, + getTarget: getTarget, + getType: getType, + hasParent: hasParent, + hexToHSV: hexToHSV, + hexToRGB: hexToRGB, + insertSort: insertSort, + isDate: isDate, + isNumber: isNumber, + isObject: isObject$7, + isString: isString, + isValidHex: isValidHex, + isValidRGB: isValidRGB, + isValidRGBA: isValidRGBA, + mergeOptions: mergeOptions, + option: option, + overrideOpacity: overrideOpacity, + parseColor: parseColor, + preventDefault: preventDefault, + pureDeepObjectAssign: pureDeepObjectAssign, + recursiveDOMDelete: recursiveDOMDelete, + removeClassName: removeClassName, + removeCssText: removeCssText, + removeEventListener: removeEventListener, + selectiveBridgeObject: selectiveBridgeObject, + selectiveDeepExtend: selectiveDeepExtend, + selectiveExtend: selectiveExtend, + selectiveNotDeepExtend: selectiveNotDeepExtend, + throttle: throttle, + toArray: toArray, + topMost: topMost, + updateProperty: updateProperty + }); + + // DOM utility methods + + /** + * this prepares the JSON container for allocating SVG elements + * @param {Object} JSONcontainer + * @private + */ + function prepareElements(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; + JSONcontainer[elementType].used = []; + } + } + } + + /** + * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from + * which to remove the redundant elements. + * + * @param {Object} JSONcontainer + * @private + */ + function cleanupElements(JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + if (JSONcontainer[elementType].redundant) { + for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { + JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); + } + JSONcontainer[elementType].redundant = []; + } + } + } + } + + /** + * Ensures that all elements are removed first up so they can be recreated cleanly + * @param {Object} JSONcontainer + */ + function resetElements(JSONcontainer) { + prepareElements(JSONcontainer); + cleanupElements(JSONcontainer); + prepareElements(JSONcontainer); + } + + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param {string} elementType + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @returns {Element} + * @private + */ + function getSVGElement(elementType, JSONcontainer, svgContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { + // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } else { + // create a new element and add it to the SVG + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + svgContainer.appendChild(element); + } + } else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + JSONcontainer[elementType] = { + used: [], + redundant: [] + }; + svgContainer.appendChild(element); + } + JSONcontainer[elementType].used.push(element); + return element; + } + + /** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param {string} elementType + * @param {Object} JSONcontainer + * @param {Element} DOMContainer + * @param {Element} insertBefore + * @returns {*} + */ + function getDOMElement(elementType, JSONcontainer, DOMContainer, insertBefore) { + var element; + // allocate DOM element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { + // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } else { + // create a new element and add it to the SVG + element = document.createElement(elementType); + if (insertBefore !== undefined) { + DOMContainer.insertBefore(element, insertBefore); + } else { + DOMContainer.appendChild(element); + } + } + } else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElement(elementType); + JSONcontainer[elementType] = { + used: [], + redundant: [] + }; + if (insertBefore !== undefined) { + DOMContainer.insertBefore(element, insertBefore); + } else { + DOMContainer.appendChild(element); + } + } + JSONcontainer[elementType].used.push(element); + return element; + } + + /** + * Draw a point object. This is a separate function because it can also be called by the legend. + * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions + * as well. + * + * @param {number} x + * @param {number} y + * @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' } + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @param {Object} labelObj + * @returns {vis.PointItem} + */ + function drawPoint(x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) { + var point; + if (groupTemplate.style == 'circle') { + point = getSVGElement('circle', JSONcontainer, svgContainer); + point.setAttributeNS(null, "cx", x); + point.setAttributeNS(null, "cy", y); + point.setAttributeNS(null, "r", 0.5 * groupTemplate.size); + } else { + point = getSVGElement('rect', JSONcontainer, svgContainer); + point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "width", groupTemplate.size); + point.setAttributeNS(null, "height", groupTemplate.size); + } + if (groupTemplate.styles !== undefined) { + point.setAttributeNS(null, "style", groupTemplate.styles); + } + point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); + //handle label + + if (labelObj) { + var label = getSVGElement('text', JSONcontainer, svgContainer); + if (labelObj.xOffset) { + x = x + labelObj.xOffset; + } + if (labelObj.yOffset) { + y = y + labelObj.yOffset; + } + if (labelObj.content) { + label.textContent = labelObj.content; + } + if (labelObj.className) { + label.setAttributeNS(null, "class", labelObj.className + " vis-label"); + } + label.setAttributeNS(null, "x", x); + label.setAttributeNS(null, "y", y); + } + return point; + } + + /** + * draw a bar SVG element centered on the X coordinate + * + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {string} className + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @param {string} style + */ + function drawBar(x, y, width, height, className, JSONcontainer, svgContainer, style) { + if (height != 0) { + if (height < 0) { + height *= -1; + y -= height; + } + var rect = getSVGElement('rect', JSONcontainer, svgContainer); + rect.setAttributeNS(null, "x", x - 0.5 * width); + rect.setAttributeNS(null, "y", y); + rect.setAttributeNS(null, "width", width); + rect.setAttributeNS(null, "height", height); + rect.setAttributeNS(null, "class", className); + if (style) { + rect.setAttributeNS(null, "style", style); + } + } + } + + /** + * get default language + * @returns {string} + */ + function getNavigatorLanguage() { + try { + if (!navigator) return 'en'; + if (navigator.languages && navigator.languages.length) { + return navigator.languages; + } else { + return navigator.userLanguage || navigator.language || navigator.browserLanguage || 'en'; + } + } catch (error) { + return 'en'; + } + } + + var DOMutil = /*#__PURE__*/Object.freeze({ + __proto__: null, + cleanupElements: cleanupElements, + drawBar: drawBar, + drawPoint: drawPoint, + getDOMElement: getDOMElement, + getNavigatorLanguage: getNavigatorLanguage, + getSVGElement: getSVGElement, + prepareElements: prepareElements, + resetElements: resetElements + }); + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self; + } + + var parent$B = create$7; + + var create$5 = parent$B; + + var parent$A = create$5; + + var create$4 = parent$A; + + var create$3 = create$4; + + var _Object$create = /*@__PURE__*/getDefaultExportFromCjs(create$3); + + var $$r = _export; + var setPrototypeOf$6 = objectSetPrototypeOf; + + // `Object.setPrototypeOf` method + // https://tc39.es/ecma262/#sec-object.setprototypeof + $$r({ target: 'Object', stat: true }, { + setPrototypeOf: setPrototypeOf$6 + }); + + var path$a = path$u; + + var setPrototypeOf$5 = path$a.Object.setPrototypeOf; + + var parent$z = setPrototypeOf$5; + + var setPrototypeOf$4 = parent$z; + + var parent$y = setPrototypeOf$4; + + var setPrototypeOf$3 = parent$y; + + var parent$x = setPrototypeOf$3; + + var setPrototypeOf$2 = parent$x; + + var setPrototypeOf$1 = setPrototypeOf$2; + + var _Object$setPrototypeOf = /*@__PURE__*/getDefaultExportFromCjs(setPrototypeOf$1); + + var parent$w = bind$b; + + var bind$9 = parent$w; + + var parent$v = bind$9; + + var bind$8 = parent$v; + + var bind$7 = bind$8; + + var _bindInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(bind$7); + + function _setPrototypeOf(o, p) { + var _context; + _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = _Object$create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + _Object$defineProperty$1(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _possibleConstructorReturn(self, call) { + if (call && (_typeof$1(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self); + } + + var parent$u = getPrototypeOf$5; + + var getPrototypeOf$3 = parent$u; + + var parent$t = getPrototypeOf$3; + + var getPrototypeOf$2 = parent$t; + + var getPrototypeOf$1 = getPrototypeOf$2; + + var _Object$getPrototypeOf = /*@__PURE__*/getDefaultExportFromCjs(getPrototypeOf$1); + + function _getPrototypeOf(o) { + var _context; + _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) { + return o.__proto__ || _Object$getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + _Object$defineProperty$1(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + + var regeneratorRuntime$1 = {exports: {}}; + + var _typeof = {exports: {}}; + + (function (module) { + var _Symbol = symbol$1; + var _Symbol$iterator = iterator$1; + function _typeof(o) { + "@babel/helpers - typeof"; + + return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof _Symbol && o.constructor === _Symbol && o !== _Symbol.prototype ? "symbol" : typeof o; + }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o); + } + module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; + } (_typeof)); + + var _typeofExports = _typeof.exports; + + var parent$s = forEach$6; + + var forEach$3 = parent$s; + + var parent$r = forEach$3; + + var forEach$2 = parent$r; + + var forEach$1 = forEach$2; + + var hasOwn$5 = hasOwnProperty_1; + var ownKeys$3 = ownKeys$8; + var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor; + var definePropertyModule = objectDefineProperty; + + var copyConstructorProperties$1 = function (target, source, exceptions) { + var keys = ownKeys$3(source); + var defineProperty = definePropertyModule.f; + var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule$1.f; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) { + defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + } + } + }; + + var isObject$6 = isObject$j; + var createNonEnumerableProperty$3 = createNonEnumerableProperty$9; + + // `InstallErrorCause` abstract operation + // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause + var installErrorCause$1 = function (O, options) { + if (isObject$6(options) && 'cause' in options) { + createNonEnumerableProperty$3(O, 'cause', options.cause); + } + }; + + var uncurryThis$3 = functionUncurryThis; + + var $Error$1 = Error; + var replace = uncurryThis$3(''.replace); + + var TEST = (function (arg) { return String(new $Error$1(arg).stack); })('zxcasd'); + // eslint-disable-next-line redos/no-vulnerable -- safe + var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; + var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); + + var errorStackClear = function (stack, dropEntries) { + if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error$1.prepareStackTrace) { + while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); + } return stack; + }; + + var fails$a = fails$y; + var createPropertyDescriptor$1 = createPropertyDescriptor$7; + + var errorStackInstallable = !fails$a(function () { + var error = new Error('a'); + if (!('stack' in error)) return true; + // eslint-disable-next-line es/no-object-defineproperty -- safe + Object.defineProperty(error, 'stack', createPropertyDescriptor$1(1, 7)); + return error.stack !== 7; + }); + + var createNonEnumerableProperty$2 = createNonEnumerableProperty$9; + var clearErrorStack = errorStackClear; + var ERROR_STACK_INSTALLABLE = errorStackInstallable; + + // non-standard V8 + var captureStackTrace = Error.captureStackTrace; + + var errorStackInstall = function (error, C, stack, dropEntries) { + if (ERROR_STACK_INSTALLABLE) { + if (captureStackTrace) captureStackTrace(error, C); + else createNonEnumerableProperty$2(error, 'stack', clearErrorStack(stack, dropEntries)); + } + }; + + var bind$6 = functionBindContext; + var call$6 = functionCall; + var anObject$3 = anObject$d; + var tryToString$1 = tryToString$6; + var isArrayIteratorMethod = isArrayIteratorMethod$2; + var lengthOfArrayLike$4 = lengthOfArrayLike$e; + var isPrototypeOf$d = objectIsPrototypeOf; + var getIterator$6 = getIterator$8; + var getIteratorMethod = getIteratorMethod$9; + var iteratorClose = iteratorClose$2; + + var $TypeError$4 = TypeError; + + var Result = function (stopped, result) { + this.stopped = stopped; + this.result = result; + }; + + var ResultPrototype = Result.prototype; + + var iterate$7 = function (iterable, unboundFunction, options) { + var that = options && options.that; + var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_RECORD = !!(options && options.IS_RECORD); + var IS_ITERATOR = !!(options && options.IS_ITERATOR); + var INTERRUPTED = !!(options && options.INTERRUPTED); + var fn = bind$6(unboundFunction, that); + var iterator, iterFn, index, length, result, next, step; + + var stop = function (condition) { + if (iterator) iteratorClose(iterator, 'normal', condition); + return new Result(true, condition); + }; + + var callFn = function (value) { + if (AS_ENTRIES) { + anObject$3(value); + return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); + } return INTERRUPTED ? fn(value, stop) : fn(value); + }; + + if (IS_RECORD) { + iterator = iterable.iterator; + } else if (IS_ITERATOR) { + iterator = iterable; + } else { + iterFn = getIteratorMethod(iterable); + if (!iterFn) throw new $TypeError$4(tryToString$1(iterable) + ' is not iterable'); + // optimisation for array iterators + if (isArrayIteratorMethod(iterFn)) { + for (index = 0, length = lengthOfArrayLike$4(iterable); length > index; index++) { + result = callFn(iterable[index]); + if (result && isPrototypeOf$d(ResultPrototype, result)) return result; + } return new Result(false); + } + iterator = getIterator$6(iterable, iterFn); + } + + next = IS_RECORD ? iterable.next : iterator.next; + while (!(step = call$6(next, iterator)).done) { + try { + result = callFn(step.value); + } catch (error) { + iteratorClose(iterator, 'throw', error); + } + if (typeof result == 'object' && result && isPrototypeOf$d(ResultPrototype, result)) return result; + } return new Result(false); + }; + + var toString$3 = toString$c; + + var normalizeStringArgument$1 = function (argument, $default) { + return argument === undefined ? arguments.length < 2 ? '' : $default : toString$3(argument); + }; + + var $$q = _export; + var isPrototypeOf$c = objectIsPrototypeOf; + var getPrototypeOf = objectGetPrototypeOf$1; + var setPrototypeOf = objectSetPrototypeOf; + var copyConstructorProperties = copyConstructorProperties$1; + var create$2 = objectCreate; + var createNonEnumerableProperty$1 = createNonEnumerableProperty$9; + var createPropertyDescriptor = createPropertyDescriptor$7; + var installErrorCause = installErrorCause$1; + var installErrorStack = errorStackInstall; + var iterate$6 = iterate$7; + var normalizeStringArgument = normalizeStringArgument$1; + var wellKnownSymbol$3 = wellKnownSymbol$p; + + var TO_STRING_TAG = wellKnownSymbol$3('toStringTag'); + var $Error = Error; + var push$2 = [].push; + + var $AggregateError = function AggregateError(errors, message /* , options */) { + var isInstance = isPrototypeOf$c(AggregateErrorPrototype, this); + var that; + if (setPrototypeOf) { + that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype); + } else { + that = isInstance ? this : create$2(AggregateErrorPrototype); + createNonEnumerableProperty$1(that, TO_STRING_TAG, 'Error'); + } + if (message !== undefined) createNonEnumerableProperty$1(that, 'message', normalizeStringArgument(message)); + installErrorStack(that, $AggregateError, that.stack, 1); + if (arguments.length > 2) installErrorCause(that, arguments[2]); + var errorsArray = []; + iterate$6(errors, push$2, { that: errorsArray }); + createNonEnumerableProperty$1(that, 'errors', errorsArray); + return that; + }; + + if (setPrototypeOf) setPrototypeOf($AggregateError, $Error); + else copyConstructorProperties($AggregateError, $Error, { name: true }); + + var AggregateErrorPrototype = $AggregateError.prototype = create$2($Error.prototype, { + constructor: createPropertyDescriptor(1, $AggregateError), + message: createPropertyDescriptor(1, ''), + name: createPropertyDescriptor(1, 'AggregateError') + }); + + // `AggregateError` constructor + // https://tc39.es/ecma262/#sec-aggregate-error-constructor + $$q({ global: true, constructor: true, arity: 2 }, { + AggregateError: $AggregateError + }); + + var global$8 = global$q; + var classof$4 = classofRaw$2; + + var engineIsNode = classof$4(global$8.process) === 'process'; + + var getBuiltIn$4 = getBuiltIn$f; + var defineBuiltInAccessor$1 = defineBuiltInAccessor$3; + var wellKnownSymbol$2 = wellKnownSymbol$p; + var DESCRIPTORS$5 = descriptors; + + var SPECIES$2 = wellKnownSymbol$2('species'); + + var setSpecies$2 = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME); + + if (DESCRIPTORS$5 && Constructor && !Constructor[SPECIES$2]) { + defineBuiltInAccessor$1(Constructor, SPECIES$2, { + configurable: true, + get: function () { return this; } + }); + } + }; + + var isPrototypeOf$b = objectIsPrototypeOf; + + var $TypeError$3 = TypeError; + + var anInstance$3 = function (it, Prototype) { + if (isPrototypeOf$b(Prototype, it)) return it; + throw new $TypeError$3('Incorrect invocation'); + }; + + var isConstructor = isConstructor$4; + var tryToString = tryToString$6; + + var $TypeError$2 = TypeError; + + // `Assert: IsConstructor(argument) is true` + var aConstructor$2 = function (argument) { + if (isConstructor(argument)) return argument; + throw new $TypeError$2(tryToString(argument) + ' is not a constructor'); + }; + + var anObject$2 = anObject$d; + var aConstructor$1 = aConstructor$2; + var isNullOrUndefined$2 = isNullOrUndefined$6; + var wellKnownSymbol$1 = wellKnownSymbol$p; + + var SPECIES$1 = wellKnownSymbol$1('species'); + + // `SpeciesConstructor` abstract operation + // https://tc39.es/ecma262/#sec-speciesconstructor + var speciesConstructor$2 = function (O, defaultConstructor) { + var C = anObject$2(O).constructor; + var S; + return C === undefined || isNullOrUndefined$2(S = anObject$2(C)[SPECIES$1]) ? defaultConstructor : aConstructor$1(S); + }; + + var userAgent$4 = engineUserAgent; + + // eslint-disable-next-line redos/no-vulnerable -- safe + var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$4); + + var global$7 = global$q; + var apply$1 = functionApply; + var bind$5 = functionBindContext; + var isCallable$4 = isCallable$m; + var hasOwn$4 = hasOwnProperty_1; + var fails$9 = fails$y; + var html = html$2; + var arraySlice$1 = arraySlice$5; + var createElement = documentCreateElement$1; + var validateArgumentsLength = validateArgumentsLength$2; + var IS_IOS$1 = engineIsIos; + var IS_NODE$4 = engineIsNode; + + var set$3 = global$7.setImmediate; + var clear = global$7.clearImmediate; + var process$2 = global$7.process; + var Dispatch = global$7.Dispatch; + var Function$1 = global$7.Function; + var MessageChannel = global$7.MessageChannel; + var String$1 = global$7.String; + var counter = 0; + var queue$2 = {}; + var ONREADYSTATECHANGE = 'onreadystatechange'; + var $location, defer, channel, port; + + fails$9(function () { + // Deno throws a ReferenceError on `location` access without `--location` flag + $location = global$7.location; + }); + + var run = function (id) { + if (hasOwn$4(queue$2, id)) { + var fn = queue$2[id]; + delete queue$2[id]; + fn(); + } + }; + + var runner = function (id) { + return function () { + run(id); + }; + }; + + var eventListener = function (event) { + run(event.data); + }; + + var globalPostMessageDefer = function (id) { + // old engines have not location.origin + global$7.postMessage(String$1(id), $location.protocol + '//' + $location.host); + }; + + // Node.js 0.9+ & IE10+ has setImmediate, otherwise: + if (!set$3 || !clear) { + set$3 = function setImmediate(handler) { + validateArgumentsLength(arguments.length, 1); + var fn = isCallable$4(handler) ? handler : Function$1(handler); + var args = arraySlice$1(arguments, 1); + queue$2[++counter] = function () { + apply$1(fn, undefined, args); + }; + defer(counter); + return counter; + }; + clear = function clearImmediate(id) { + delete queue$2[id]; + }; + // Node.js 0.8- + if (IS_NODE$4) { + defer = function (id) { + process$2.nextTick(runner(id)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(runner(id)); + }; + // Browsers with MessageChannel, includes WebWorkers + // except iOS - https://github.com/zloirock/core-js/issues/624 + } else if (MessageChannel && !IS_IOS$1) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = eventListener; + defer = bind$5(port.postMessage, port); + // Browsers with postMessage, skip WebWorkers + // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' + } else if ( + global$7.addEventListener && + isCallable$4(global$7.postMessage) && + !global$7.importScripts && + $location && $location.protocol !== 'file:' && + !fails$9(globalPostMessageDefer) + ) { + defer = globalPostMessageDefer; + global$7.addEventListener('message', eventListener, false); + // IE8- + } else if (ONREADYSTATECHANGE in createElement('script')) { + defer = function (id) { + html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(runner(id), 0); + }; + } + } + + var task$1 = { + set: set$3, + clear: clear + }; + + var Queue$3 = function () { + this.head = null; + this.tail = null; + }; + + Queue$3.prototype = { + add: function (item) { + var entry = { item: item, next: null }; + var tail = this.tail; + if (tail) tail.next = entry; + else this.head = entry; + this.tail = entry; + }, + get: function () { + var entry = this.head; + if (entry) { + var next = this.head = entry.next; + if (next === null) this.tail = null; + return entry.item; + } + } + }; + + var queue$1 = Queue$3; + + var userAgent$3 = engineUserAgent; + + var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$3) && typeof Pebble != 'undefined'; + + var userAgent$2 = engineUserAgent; + + var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent$2); + + var global$6 = global$q; + var bind$4 = functionBindContext; + var getOwnPropertyDescriptor$4 = objectGetOwnPropertyDescriptor.f; + var macrotask = task$1.set; + var Queue$2 = queue$1; + var IS_IOS = engineIsIos; + var IS_IOS_PEBBLE = engineIsIosPebble; + var IS_WEBOS_WEBKIT = engineIsWebosWebkit; + var IS_NODE$3 = engineIsNode; + + var MutationObserver = global$6.MutationObserver || global$6.WebKitMutationObserver; + var document$2 = global$6.document; + var process$1 = global$6.process; + var Promise$1 = global$6.Promise; + // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` + var queueMicrotaskDescriptor = getOwnPropertyDescriptor$4(global$6, 'queueMicrotask'); + var microtask$1 = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; + var notify$1, toggle, node, promise$5, then; + + // modern engines have queueMicrotask method + if (!microtask$1) { + var queue = new Queue$2(); + + var flush = function () { + var parent, fn; + if (IS_NODE$3 && (parent = process$1.domain)) parent.exit(); + while (fn = queue.get()) try { + fn(); + } catch (error) { + if (queue.head) notify$1(); + throw error; + } + if (parent) parent.enter(); + }; + + // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 + // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 + if (!IS_IOS && !IS_NODE$3 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) { + toggle = true; + node = document$2.createTextNode(''); + new MutationObserver(flush).observe(node, { characterData: true }); + notify$1 = function () { + node.data = toggle = !toggle; + }; + // environments with maybe non-completely correct, but existent Promise + } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) { + // Promise.resolve without an argument throws an error in LG WebOS 2 + promise$5 = Promise$1.resolve(undefined); + // workaround of WebKit ~ iOS Safari 10.1 bug + promise$5.constructor = Promise$1; + then = bind$4(promise$5.then, promise$5); + notify$1 = function () { + then(flush); + }; + // Node.js without promises + } else if (IS_NODE$3) { + notify$1 = function () { + process$1.nextTick(flush); + }; + // for other environments - macrotask based on: + // - setImmediate + // - MessageChannel + // - window.postMessage + // - onreadystatechange + // - setTimeout + } else { + // `webpack` dev server bug on IE global methods - use bind(fn, global) + macrotask = bind$4(macrotask, global$6); + notify$1 = function () { + macrotask(flush); + }; + } + + microtask$1 = function (fn) { + if (!queue.head) notify$1(); + queue.add(fn); + }; + } + + var microtask_1 = microtask$1; + + var hostReportErrors$1 = function (a, b) { + try { + // eslint-disable-next-line no-console -- safe + arguments.length === 1 ? console.error(a) : console.error(a, b); + } catch (error) { /* empty */ } + }; + + var perform$6 = function (exec) { + try { + return { error: false, value: exec() }; + } catch (error) { + return { error: true, value: error }; + } + }; + + var global$5 = global$q; + + var promiseNativeConstructor = global$5.Promise; + + /* global Deno -- Deno case */ + var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; + + var IS_DENO$1 = engineIsDeno; + var IS_NODE$2 = engineIsNode; + + var engineIsBrowser = !IS_DENO$1 && !IS_NODE$2 + && typeof window == 'object' + && typeof document == 'object'; + + var global$4 = global$q; + var NativePromiseConstructor$5 = promiseNativeConstructor; + var isCallable$3 = isCallable$m; + var isForced = isForced_1; + var inspectSource = inspectSource$2; + var wellKnownSymbol = wellKnownSymbol$p; + var IS_BROWSER = engineIsBrowser; + var IS_DENO = engineIsDeno; + var V8_VERSION = engineV8Version; + + var NativePromisePrototype$2 = NativePromiseConstructor$5 && NativePromiseConstructor$5.prototype; + var SPECIES = wellKnownSymbol('species'); + var SUBCLASSING = false; + var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$3(global$4.PromiseRejectionEvent); + + var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () { + var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$5); + var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$5); + // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // We can't detect it synchronously, so just check versions + if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; + // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution + if (!(NativePromisePrototype$2['catch'] && NativePromisePrototype$2['finally'])) return true; + // We can't use @@species feature detection in V8 since it causes + // deoptimization and performance degradation + // https://github.com/zloirock/core-js/issues/679 + if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { + // Detect correctness of subclassing with @@species support + var promise = new NativePromiseConstructor$5(function (resolve) { resolve(1); }); + var FakePromise = function (exec) { + exec(function () { /* empty */ }, function () { /* empty */ }); + }; + var constructor = promise.constructor = {}; + constructor[SPECIES] = FakePromise; + SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; + if (!SUBCLASSING) return true; + // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test + } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT$1; + }); + + var promiseConstructorDetection = { + CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5, + REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1, + SUBCLASSING: SUBCLASSING + }; + + var newPromiseCapability$2 = {}; + + var aCallable$8 = aCallable$e; + + var $TypeError$1 = TypeError; + + var PromiseCapability = function (C) { + var resolve, reject; + this.promise = new C(function ($$resolve, $$reject) { + if (resolve !== undefined || reject !== undefined) throw new $TypeError$1('Bad Promise constructor'); + resolve = $$resolve; + reject = $$reject; + }); + this.resolve = aCallable$8(resolve); + this.reject = aCallable$8(reject); + }; + + // `NewPromiseCapability` abstract operation + // https://tc39.es/ecma262/#sec-newpromisecapability + newPromiseCapability$2.f = function (C) { + return new PromiseCapability(C); + }; + + var $$p = _export; + var IS_NODE$1 = engineIsNode; + var global$3 = global$q; + var call$5 = functionCall; + var defineBuiltIn$1 = defineBuiltIn$6; + var setToStringTag$1 = setToStringTag$7; + var setSpecies$1 = setSpecies$2; + var aCallable$7 = aCallable$e; + var isCallable$2 = isCallable$m; + var isObject$5 = isObject$j; + var anInstance$2 = anInstance$3; + var speciesConstructor$1 = speciesConstructor$2; + var task = task$1.set; + var microtask = microtask_1; + var hostReportErrors = hostReportErrors$1; + var perform$5 = perform$6; + var Queue$1 = queue$1; + var InternalStateModule$2 = internalState; + var NativePromiseConstructor$4 = promiseNativeConstructor; + var PromiseConstructorDetection = promiseConstructorDetection; + var newPromiseCapabilityModule$7 = newPromiseCapability$2; + + var PROMISE = 'Promise'; + var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR; + var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT; + PromiseConstructorDetection.SUBCLASSING; + var getInternalPromiseState = InternalStateModule$2.getterFor(PROMISE); + var setInternalState$2 = InternalStateModule$2.set; + var NativePromisePrototype$1 = NativePromiseConstructor$4 && NativePromiseConstructor$4.prototype; + var PromiseConstructor = NativePromiseConstructor$4; + var PromisePrototype = NativePromisePrototype$1; + var TypeError$1 = global$3.TypeError; + var document$1 = global$3.document; + var process = global$3.process; + var newPromiseCapability$1 = newPromiseCapabilityModule$7.f; + var newGenericPromiseCapability = newPromiseCapability$1; + + var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$3.dispatchEvent); + var UNHANDLED_REJECTION = 'unhandledrejection'; + var REJECTION_HANDLED = 'rejectionhandled'; + var PENDING = 0; + var FULFILLED = 1; + var REJECTED = 2; + var HANDLED = 1; + var UNHANDLED = 2; + + var Internal, OwnPromiseCapability, PromiseWrapper; + + // helpers + var isThenable = function (it) { + var then; + return isObject$5(it) && isCallable$2(then = it.then) ? then : false; + }; + + var callReaction = function (reaction, state) { + var value = state.value; + var ok = state.state === FULFILLED; + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (state.rejection === UNHANDLED) onHandleUnhandled(state); + state.rejection = HANDLED; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // can throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(new TypeError$1('Promise-chain cycle')); + } else if (then = isThenable(result)) { + call$5(then, result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (error) { + if (domain && !exited) domain.exit(); + reject(error); + } + }; + + var notify = function (state, isReject) { + if (state.notified) return; + state.notified = true; + microtask(function () { + var reactions = state.reactions; + var reaction; + while (reaction = reactions.get()) { + callReaction(reaction, state); + } + state.notified = false; + if (isReject && !state.rejection) onUnhandled(state); + }); + }; + + var dispatchEvent = function (name, promise, reason) { + var event, handler; + if (DISPATCH_EVENT) { + event = document$1.createEvent('Event'); + event.promise = promise; + event.reason = reason; + event.initEvent(name, false, true); + global$3.dispatchEvent(event); + } else event = { promise: promise, reason: reason }; + if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global$3['on' + name])) handler(event); + else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); + }; + + var onUnhandled = function (state) { + call$5(task, global$3, function () { + var promise = state.facade; + var value = state.value; + var IS_UNHANDLED = isUnhandled(state); + var result; + if (IS_UNHANDLED) { + result = perform$5(function () { + if (IS_NODE$1) { + process.emit('unhandledRejection', value, promise); + } else dispatchEvent(UNHANDLED_REJECTION, promise, value); + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED; + if (result.error) throw result.value; + } + }); + }; + + var isUnhandled = function (state) { + return state.rejection !== HANDLED && !state.parent; + }; + + var onHandleUnhandled = function (state) { + call$5(task, global$3, function () { + var promise = state.facade; + if (IS_NODE$1) { + process.emit('rejectionHandled', promise); + } else dispatchEvent(REJECTION_HANDLED, promise, state.value); + }); + }; + + var bind$3 = function (fn, state, unwrap) { + return function (value) { + fn(state, value, unwrap); + }; + }; + + var internalReject = function (state, value, unwrap) { + if (state.done) return; + state.done = true; + if (unwrap) state = unwrap; + state.value = value; + state.state = REJECTED; + notify(state, true); + }; + + var internalResolve = function (state, value, unwrap) { + if (state.done) return; + state.done = true; + if (unwrap) state = unwrap; + try { + if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself"); + var then = isThenable(value); + if (then) { + microtask(function () { + var wrapper = { done: false }; + try { + call$5(then, value, + bind$3(internalResolve, wrapper, state), + bind$3(internalReject, wrapper, state) + ); + } catch (error) { + internalReject(wrapper, error, state); + } + }); + } else { + state.value = value; + state.state = FULFILLED; + notify(state, false); + } + } catch (error) { + internalReject({ done: false }, error, state); + } + }; + + // constructor polyfill + if (FORCED_PROMISE_CONSTRUCTOR$4) { + // 25.4.3.1 Promise(executor) + PromiseConstructor = function Promise(executor) { + anInstance$2(this, PromisePrototype); + aCallable$7(executor); + call$5(Internal, this); + var state = getInternalPromiseState(this); + try { + executor(bind$3(internalResolve, state), bind$3(internalReject, state)); + } catch (error) { + internalReject(state, error); + } + }; + + PromisePrototype = PromiseConstructor.prototype; + + // eslint-disable-next-line no-unused-vars -- required for `.length` + Internal = function Promise(executor) { + setInternalState$2(this, { + type: PROMISE, + done: false, + notified: false, + parent: false, + reactions: new Queue$1(), + rejection: false, + state: PENDING, + value: undefined + }); + }; + + // `Promise.prototype.then` method + // https://tc39.es/ecma262/#sec-promise.prototype.then + Internal.prototype = defineBuiltIn$1(PromisePrototype, 'then', function then(onFulfilled, onRejected) { + var state = getInternalPromiseState(this); + var reaction = newPromiseCapability$1(speciesConstructor$1(this, PromiseConstructor)); + state.parent = true; + reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true; + reaction.fail = isCallable$2(onRejected) && onRejected; + reaction.domain = IS_NODE$1 ? process.domain : undefined; + if (state.state === PENDING) state.reactions.add(reaction); + else microtask(function () { + callReaction(reaction, state); + }); + return reaction.promise; + }); + + OwnPromiseCapability = function () { + var promise = new Internal(); + var state = getInternalPromiseState(promise); + this.promise = promise; + this.resolve = bind$3(internalResolve, state); + this.reject = bind$3(internalReject, state); + }; + + newPromiseCapabilityModule$7.f = newPromiseCapability$1 = function (C) { + return C === PromiseConstructor || C === PromiseWrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; + } + + $$p({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, { + Promise: PromiseConstructor + }); + + setToStringTag$1(PromiseConstructor, PROMISE, false, true); + setSpecies$1(PROMISE); + + var NativePromiseConstructor$3 = promiseNativeConstructor; + var checkCorrectnessOfIteration = checkCorrectnessOfIteration$2; + var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR; + + var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) { + NativePromiseConstructor$3.all(iterable).then(undefined, function () { /* empty */ }); + }); + + var $$o = _export; + var call$4 = functionCall; + var aCallable$6 = aCallable$e; + var newPromiseCapabilityModule$6 = newPromiseCapability$2; + var perform$4 = perform$6; + var iterate$5 = iterate$7; + var PROMISE_STATICS_INCORRECT_ITERATION$3 = promiseStaticsIncorrectIteration; + + // `Promise.all` method + // https://tc39.es/ecma262/#sec-promise.all + $$o({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$3 }, { + all: function all(iterable) { + var C = this; + var capability = newPromiseCapabilityModule$6.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform$4(function () { + var $promiseResolve = aCallable$6(C.resolve); + var values = []; + var counter = 0; + var remaining = 1; + iterate$5(iterable, function (promise) { + var index = counter++; + var alreadyCalled = false; + remaining++; + call$4($promiseResolve, C, promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.error) reject(result.value); + return capability.promise; + } + }); + + var $$n = _export; + var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR; + var NativePromiseConstructor$2 = promiseNativeConstructor; + + NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype; + + // `Promise.prototype.catch` method + // https://tc39.es/ecma262/#sec-promise.prototype.catch + $$n({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, { + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + + var $$m = _export; + var call$3 = functionCall; + var aCallable$5 = aCallable$e; + var newPromiseCapabilityModule$5 = newPromiseCapability$2; + var perform$3 = perform$6; + var iterate$4 = iterate$7; + var PROMISE_STATICS_INCORRECT_ITERATION$2 = promiseStaticsIncorrectIteration; + + // `Promise.race` method + // https://tc39.es/ecma262/#sec-promise.race + $$m({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$2 }, { + race: function race(iterable) { + var C = this; + var capability = newPromiseCapabilityModule$5.f(C); + var reject = capability.reject; + var result = perform$3(function () { + var $promiseResolve = aCallable$5(C.resolve); + iterate$4(iterable, function (promise) { + call$3($promiseResolve, C, promise).then(capability.resolve, reject); + }); + }); + if (result.error) reject(result.value); + return capability.promise; + } + }); + + var $$l = _export; + var call$2 = functionCall; + var newPromiseCapabilityModule$4 = newPromiseCapability$2; + var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR; + + // `Promise.reject` method + // https://tc39.es/ecma262/#sec-promise.reject + $$l({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, { + reject: function reject(r) { + var capability = newPromiseCapabilityModule$4.f(this); + call$2(capability.reject, undefined, r); + return capability.promise; + } + }); + + var anObject$1 = anObject$d; + var isObject$4 = isObject$j; + var newPromiseCapability = newPromiseCapability$2; + + var promiseResolve$2 = function (C, x) { + anObject$1(C); + if (isObject$4(x) && x.constructor === C) return x; + var promiseCapability = newPromiseCapability.f(C); + var resolve = promiseCapability.resolve; + resolve(x); + return promiseCapability.promise; + }; + + var $$k = _export; + var getBuiltIn$3 = getBuiltIn$f; + var IS_PURE = isPure; + var NativePromiseConstructor$1 = promiseNativeConstructor; + var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR; + var promiseResolve$1 = promiseResolve$2; + + var PromiseConstructorWrapper = getBuiltIn$3('Promise'); + var CHECK_WRAPPER = !FORCED_PROMISE_CONSTRUCTOR; + + // `Promise.resolve` method + // https://tc39.es/ecma262/#sec-promise.resolve + $$k({ target: 'Promise', stat: true, forced: IS_PURE }, { + resolve: function resolve(x) { + return promiseResolve$1(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor$1 : this, x); + } + }); + + var $$j = _export; + var call$1 = functionCall; + var aCallable$4 = aCallable$e; + var newPromiseCapabilityModule$3 = newPromiseCapability$2; + var perform$2 = perform$6; + var iterate$3 = iterate$7; + var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration; + + // `Promise.allSettled` method + // https://tc39.es/ecma262/#sec-promise.allsettled + $$j({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, { + allSettled: function allSettled(iterable) { + var C = this; + var capability = newPromiseCapabilityModule$3.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform$2(function () { + var promiseResolve = aCallable$4(C.resolve); + var values = []; + var counter = 0; + var remaining = 1; + iterate$3(iterable, function (promise) { + var index = counter++; + var alreadyCalled = false; + remaining++; + call$1(promiseResolve, C, promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[index] = { status: 'fulfilled', value: value }; + --remaining || resolve(values); + }, function (error) { + if (alreadyCalled) return; + alreadyCalled = true; + values[index] = { status: 'rejected', reason: error }; + --remaining || resolve(values); + }); + }); + --remaining || resolve(values); + }); + if (result.error) reject(result.value); + return capability.promise; + } + }); + + var $$i = _export; + var call = functionCall; + var aCallable$3 = aCallable$e; + var getBuiltIn$2 = getBuiltIn$f; + var newPromiseCapabilityModule$2 = newPromiseCapability$2; + var perform$1 = perform$6; + var iterate$2 = iterate$7; + var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration; + + var PROMISE_ANY_ERROR = 'No one promise resolved'; + + // `Promise.any` method + // https://tc39.es/ecma262/#sec-promise.any + $$i({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { + any: function any(iterable) { + var C = this; + var AggregateError = getBuiltIn$2('AggregateError'); + var capability = newPromiseCapabilityModule$2.f(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform$1(function () { + var promiseResolve = aCallable$3(C.resolve); + var errors = []; + var counter = 0; + var remaining = 1; + var alreadyResolved = false; + iterate$2(iterable, function (promise) { + var index = counter++; + var alreadyRejected = false; + remaining++; + call(promiseResolve, C, promise).then(function (value) { + if (alreadyRejected || alreadyResolved) return; + alreadyResolved = true; + resolve(value); + }, function (error) { + if (alreadyRejected || alreadyResolved) return; + alreadyRejected = true; + errors[index] = error; + --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); + }); + }); + --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); + }); + if (result.error) reject(result.value); + return capability.promise; + } + }); + + var $$h = _export; + var NativePromiseConstructor = promiseNativeConstructor; + var fails$8 = fails$y; + var getBuiltIn$1 = getBuiltIn$f; + var isCallable$1 = isCallable$m; + var speciesConstructor = speciesConstructor$2; + var promiseResolve = promiseResolve$2; + + var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; + + // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 + var NON_GENERIC = !!NativePromiseConstructor && fails$8(function () { + // eslint-disable-next-line unicorn/no-thenable -- required for testing + NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); + }); + + // `Promise.prototype.finally` method + // https://tc39.es/ecma262/#sec-promise.prototype.finally + $$h({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { + 'finally': function (onFinally) { + var C = speciesConstructor(this, getBuiltIn$1('Promise')); + var isFunction = isCallable$1(onFinally); + return this.then( + isFunction ? function (x) { + return promiseResolve(C, onFinally()).then(function () { return x; }); + } : onFinally, + isFunction ? function (e) { + return promiseResolve(C, onFinally()).then(function () { throw e; }); + } : onFinally + ); + } + }); + + var path$9 = path$u; + + var promise$4 = path$9.Promise; + + var parent$q = promise$4; + + + var promise$3 = parent$q; + + var $$g = _export; + var newPromiseCapabilityModule$1 = newPromiseCapability$2; + + // `Promise.withResolvers` method + // https://github.com/tc39/proposal-promise-with-resolvers + $$g({ target: 'Promise', stat: true }, { + withResolvers: function withResolvers() { + var promiseCapability = newPromiseCapabilityModule$1.f(this); + return { + promise: promiseCapability.promise, + resolve: promiseCapability.resolve, + reject: promiseCapability.reject + }; + } + }); + + var parent$p = promise$3; + + + var promise$2 = parent$p; + + // TODO: Remove from `core-js@4` + var $$f = _export; + var newPromiseCapabilityModule = newPromiseCapability$2; + var perform = perform$6; + + // `Promise.try` method + // https://github.com/tc39/proposal-promise-try + $$f({ target: 'Promise', stat: true, forced: true }, { + 'try': function (callbackfn) { + var promiseCapability = newPromiseCapabilityModule.f(this); + var result = perform(callbackfn); + (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); + return promiseCapability.promise; + } + }); + + var parent$o = promise$2; + // TODO: Remove from `core-js@4` + + + + + + var promise$1 = parent$o; + + var promise = promise$1; + + var parent$n = reverse$4; + + var reverse$2 = parent$n; + + var parent$m = reverse$2; + + var reverse$1 = parent$m; + + var reverse = reverse$1; + + (function (module) { + var _typeof = _typeofExports["default"]; + var _Object$defineProperty = defineProperty$7; + var _Symbol = symbol$1; + var _Object$create = create$3; + var _Object$getPrototypeOf = getPrototypeOf$1; + var _forEachInstanceProperty = forEach$1; + var _pushInstanceProperty = push$4; + var _Object$setPrototypeOf = setPrototypeOf$1; + var _Promise = promise; + var _reverseInstanceProperty = reverse; + var _sliceInstanceProperty = slice$1; + function _regeneratorRuntime() { + module.exports = _regeneratorRuntime = function _regeneratorRuntime() { + return e; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = _Object$defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof _Symbol ? _Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return _Object$defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function define(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = _Object$create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = _Object$getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(p); + function defineIteratorMethods(t) { + var _context; + _forEachInstanceProperty(_context = ["next", "throw", "return"]).call(_context, function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function value(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw new Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var _context2; + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), _pushInstanceProperty(_context2 = this.tryEntries).call(_context2, e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], _forEachInstanceProperty(t).call(t, pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return _Object$setPrototypeOf ? _Object$setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = _Object$create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = _Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) _pushInstanceProperty(r).call(r, n); + return _reverseInstanceProperty(r).call(r), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e) { + var _context3; + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, _forEachInstanceProperty(_context3 = this.tryEntries).call(_context3, resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+_sliceInstanceProperty(r).call(r, 1)) && (this[r] = t); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw new Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + "catch": function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; + } (regeneratorRuntime$1)); + + var regeneratorRuntimeExports = regeneratorRuntime$1.exports; + + // TODO(Babel 8): Remove this file. + + var runtime = regeneratorRuntimeExports(); + var regenerator = runtime; + + // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= + try { + regeneratorRuntime = runtime; + } catch (accidentalStrictMode) { + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } + } + + var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator); + + var aCallable$2 = aCallable$e; + var toObject$2 = toObject$f; + var IndexedObject = indexedObject; + var lengthOfArrayLike$3 = lengthOfArrayLike$e; + + var $TypeError = TypeError; + + // `Array.prototype.{ reduce, reduceRight }` methods implementation + var createMethod = function (IS_RIGHT) { + return function (that, callbackfn, argumentsLength, memo) { + aCallable$2(callbackfn); + var O = toObject$2(that); + var self = IndexedObject(O); + var length = lengthOfArrayLike$3(O); + var index = IS_RIGHT ? length - 1 : 0; + var i = IS_RIGHT ? -1 : 1; + if (argumentsLength < 2) while (true) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (IS_RIGHT ? index < 0 : length <= index) { + throw new $TypeError('Reduce of empty array with no initial value'); + } + } + for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; + }; + }; + + var arrayReduce = { + // `Array.prototype.reduce` method + // https://tc39.es/ecma262/#sec-array.prototype.reduce + left: createMethod(false), + // `Array.prototype.reduceRight` method + // https://tc39.es/ecma262/#sec-array.prototype.reduceright + right: createMethod(true) + }; + + var $$e = _export; + var $reduce = arrayReduce.left; + var arrayMethodIsStrict$3 = arrayMethodIsStrict$6; + var CHROME_VERSION = engineV8Version; + var IS_NODE = engineIsNode; + + // Chrome 80-82 has a critical bug + // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 + var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; + var FORCED$4 = CHROME_BUG || !arrayMethodIsStrict$3('reduce'); + + // `Array.prototype.reduce` method + // https://tc39.es/ecma262/#sec-array.prototype.reduce + $$e({ target: 'Array', proto: true, forced: FORCED$4 }, { + reduce: function reduce(callbackfn /* , initialValue */) { + var length = arguments.length; + return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$a = entryVirtual$o; + + var reduce$3 = entryVirtual$a('Array').reduce; + + var isPrototypeOf$a = objectIsPrototypeOf; + var method$a = reduce$3; + + var ArrayPrototype$9 = Array.prototype; + + var reduce$2 = function (it) { + var own = it.reduce; + return it === ArrayPrototype$9 || (isPrototypeOf$a(ArrayPrototype$9, it) && own === ArrayPrototype$9.reduce) ? method$a : own; + }; + + var parent$l = reduce$2; + + var reduce$1 = parent$l; + + var reduce = reduce$1; + + var _reduceInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(reduce); + + var isArray = isArray$e; + var lengthOfArrayLike$2 = lengthOfArrayLike$e; + var doesNotExceedSafeInteger = doesNotExceedSafeInteger$4; + var bind$2 = functionBindContext; + + // `FlattenIntoArray` abstract operation + // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray + var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { + var targetIndex = start; + var sourceIndex = 0; + var mapFn = mapper ? bind$2(mapper, thisArg) : false; + var element, elementLen; + + while (sourceIndex < sourceLen) { + if (sourceIndex in source) { + element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; + + if (depth > 0 && isArray(element)) { + elementLen = lengthOfArrayLike$2(element); + targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1; + } else { + doesNotExceedSafeInteger(targetIndex + 1); + target[targetIndex] = element; + } + + targetIndex++; + } + sourceIndex++; + } + return targetIndex; + }; + + var flattenIntoArray_1 = flattenIntoArray$1; + + var $$d = _export; + var flattenIntoArray = flattenIntoArray_1; + var aCallable$1 = aCallable$e; + var toObject$1 = toObject$f; + var lengthOfArrayLike$1 = lengthOfArrayLike$e; + var arraySpeciesCreate = arraySpeciesCreate$4; + + // `Array.prototype.flatMap` method + // https://tc39.es/ecma262/#sec-array.prototype.flatmap + $$d({ target: 'Array', proto: true }, { + flatMap: function flatMap(callbackfn /* , thisArg */) { + var O = toObject$1(this); + var sourceLen = lengthOfArrayLike$1(O); + var A; + aCallable$1(callbackfn); + A = arraySpeciesCreate(O, 0); + A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return A; + } + }); + + var entryVirtual$9 = entryVirtual$o; + + var flatMap$3 = entryVirtual$9('Array').flatMap; + + var isPrototypeOf$9 = objectIsPrototypeOf; + var method$9 = flatMap$3; + + var ArrayPrototype$8 = Array.prototype; + + var flatMap$2 = function (it) { + var own = it.flatMap; + return it === ArrayPrototype$8 || (isPrototypeOf$9(ArrayPrototype$8, it) && own === ArrayPrototype$8.flatMap) ? method$9 : own; + }; + + var parent$k = flatMap$2; + + var flatMap$1 = parent$k; + + var flatMap = flatMap$1; + + var _flatMapInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(flatMap); + + var internalMetadata = {exports: {}}; + + // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it + var fails$7 = fails$y; + + var arrayBufferNonExtensible = fails$7(function () { + if (typeof ArrayBuffer == 'function') { + var buffer = new ArrayBuffer(8); + // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe + if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); + } + }); + + var fails$6 = fails$y; + var isObject$3 = isObject$j; + var classof$3 = classofRaw$2; + var ARRAY_BUFFER_NON_EXTENSIBLE = arrayBufferNonExtensible; + + // eslint-disable-next-line es/no-object-isextensible -- safe + var $isExtensible = Object.isExtensible; + var FAILS_ON_PRIMITIVES = fails$6(function () { $isExtensible(1); }); + + // `Object.isExtensible` method + // https://tc39.es/ecma262/#sec-object.isextensible + var objectIsExtensible = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { + if (!isObject$3(it)) return false; + if (ARRAY_BUFFER_NON_EXTENSIBLE && classof$3(it) === 'ArrayBuffer') return false; + return $isExtensible ? $isExtensible(it) : true; + } : $isExtensible; + + var fails$5 = fails$y; + + var freezing = !fails$5(function () { + // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing + return Object.isExtensible(Object.preventExtensions({})); + }); + + var $$c = _export; + var uncurryThis$2 = functionUncurryThis; + var hiddenKeys = hiddenKeys$6; + var isObject$2 = isObject$j; + var hasOwn$3 = hasOwnProperty_1; + var defineProperty$2 = objectDefineProperty.f; + var getOwnPropertyNamesModule = objectGetOwnPropertyNames; + var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal; + var isExtensible = objectIsExtensible; + var uid = uid$4; + var FREEZING = freezing; + + var REQUIRED = false; + var METADATA = uid('meta'); + var id = 0; + + var setMetadata = function (it) { + defineProperty$2(it, METADATA, { value: { + objectID: 'O' + id++, // object ID + weakData: {} // weak collections IDs + } }); + }; + + var fastKey$1 = function (it, create) { + // return a primitive with prefix + if (!isObject$2(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!hasOwn$3(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMetadata(it); + // return object ID + } return it[METADATA].objectID; + }; + + var getWeakData = function (it, create) { + if (!hasOwn$3(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMetadata(it); + // return the store of weak collections IDs + } return it[METADATA].weakData; + }; + + // add metadata on freeze-family methods calling + var onFreeze = function (it) { + if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn$3(it, METADATA)) setMetadata(it); + return it; + }; + + var enable = function () { + meta.enable = function () { /* empty */ }; + REQUIRED = true; + var getOwnPropertyNames = getOwnPropertyNamesModule.f; + var splice = uncurryThis$2([].splice); + var test = {}; + test[METADATA] = 1; + + // prevent exposing of metadata key + if (getOwnPropertyNames(test).length) { + getOwnPropertyNamesModule.f = function (it) { + var result = getOwnPropertyNames(it); + for (var i = 0, length = result.length; i < length; i++) { + if (result[i] === METADATA) { + splice(result, i, 1); + break; + } + } return result; + }; + + $$c({ target: 'Object', stat: true, forced: true }, { + getOwnPropertyNames: getOwnPropertyNamesExternalModule.f + }); + } + }; + + var meta = internalMetadata.exports = { + enable: enable, + fastKey: fastKey$1, + getWeakData: getWeakData, + onFreeze: onFreeze + }; + + hiddenKeys[METADATA] = true; + + var internalMetadataExports = internalMetadata.exports; + + var $$b = _export; + var global$2 = global$q; + var InternalMetadataModule = internalMetadataExports; + var fails$4 = fails$y; + var createNonEnumerableProperty = createNonEnumerableProperty$9; + var iterate$1 = iterate$7; + var anInstance$1 = anInstance$3; + var isCallable = isCallable$m; + var isObject$1 = isObject$j; + var isNullOrUndefined$1 = isNullOrUndefined$6; + var setToStringTag = setToStringTag$7; + var defineProperty$1 = objectDefineProperty.f; + var forEach = arrayIteration.forEach; + var DESCRIPTORS$4 = descriptors; + var InternalStateModule$1 = internalState; + + var setInternalState$1 = InternalStateModule$1.set; + var internalStateGetterFor$1 = InternalStateModule$1.getterFor; + + var collection$2 = function (CONSTRUCTOR_NAME, wrapper, common) { + var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; + var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; + var ADDER = IS_MAP ? 'set' : 'add'; + var NativeConstructor = global$2[CONSTRUCTOR_NAME]; + var NativePrototype = NativeConstructor && NativeConstructor.prototype; + var exported = {}; + var Constructor; + + if (!DESCRIPTORS$4 || !isCallable(NativeConstructor) + || !(IS_WEAK || NativePrototype.forEach && !fails$4(function () { new NativeConstructor().entries().next(); })) + ) { + // create collection constructor + Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); + InternalMetadataModule.enable(); + } else { + Constructor = wrapper(function (target, iterable) { + setInternalState$1(anInstance$1(target, Prototype), { + type: CONSTRUCTOR_NAME, + collection: new NativeConstructor() + }); + if (!isNullOrUndefined$1(iterable)) iterate$1(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); + }); + + var Prototype = Constructor.prototype; + + var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); + + forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) { + var IS_ADDER = KEY === 'add' || KEY === 'set'; + if (KEY in NativePrototype && !(IS_WEAK && KEY === 'clear')) { + createNonEnumerableProperty(Prototype, KEY, function (a, b) { + var collection = getInternalState(this).collection; + if (!IS_ADDER && IS_WEAK && !isObject$1(a)) return KEY === 'get' ? undefined : false; + var result = collection[KEY](a === 0 ? 0 : a, b); + return IS_ADDER ? this : result; + }); + } + }); + + IS_WEAK || defineProperty$1(Prototype, 'size', { + configurable: true, + get: function () { + return getInternalState(this).collection.size; + } + }); + } + + setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true); + + exported[CONSTRUCTOR_NAME] = Constructor; + $$b({ global: true, forced: true }, exported); + + if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); + + return Constructor; + }; + + var defineBuiltIn = defineBuiltIn$6; + + var defineBuiltIns$1 = function (target, src, options) { + for (var key in src) { + if (options && options.unsafe && target[key]) target[key] = src[key]; + else defineBuiltIn(target, key, src[key], options); + } return target; + }; + + var create$1 = objectCreate; + var defineBuiltInAccessor = defineBuiltInAccessor$3; + var defineBuiltIns = defineBuiltIns$1; + var bind$1 = functionBindContext; + var anInstance = anInstance$3; + var isNullOrUndefined = isNullOrUndefined$6; + var iterate = iterate$7; + var defineIterator = iteratorDefine; + var createIterResultObject = createIterResultObject$3; + var setSpecies = setSpecies$2; + var DESCRIPTORS$3 = descriptors; + var fastKey = internalMetadataExports.fastKey; + var InternalStateModule = internalState; + + var setInternalState = InternalStateModule.set; + var internalStateGetterFor = InternalStateModule.getterFor; + + var collectionStrong$2 = { + getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { + var Constructor = wrapper(function (that, iterable) { + anInstance(that, Prototype); + setInternalState(that, { + type: CONSTRUCTOR_NAME, + index: create$1(null), + first: undefined, + last: undefined, + size: 0 + }); + if (!DESCRIPTORS$3) that.size = 0; + if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); + }); + + var Prototype = Constructor.prototype; + + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); + + var define = function (that, key, value) { + var state = getInternalState(that); + var entry = getEntry(that, key); + var previous, index; + // change existing entry + if (entry) { + entry.value = value; + // create new entry + } else { + state.last = entry = { + index: index = fastKey(key, true), + key: key, + value: value, + previous: previous = state.last, + next: undefined, + removed: false + }; + if (!state.first) state.first = entry; + if (previous) previous.next = entry; + if (DESCRIPTORS$3) state.size++; + else that.size++; + // add to index + if (index !== 'F') state.index[index] = entry; + } return that; + }; + + var getEntry = function (that, key) { + var state = getInternalState(that); + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return state.index[index]; + // frozen object case + for (entry = state.first; entry; entry = entry.next) { + if (entry.key === key) return entry; + } + }; + + defineBuiltIns(Prototype, { + // `{ Map, Set }.prototype.clear()` methods + // https://tc39.es/ecma262/#sec-map.prototype.clear + // https://tc39.es/ecma262/#sec-set.prototype.clear + clear: function clear() { + var that = this; + var state = getInternalState(that); + var data = state.index; + var entry = state.first; + while (entry) { + entry.removed = true; + if (entry.previous) entry.previous = entry.previous.next = undefined; + delete data[entry.index]; + entry = entry.next; + } + state.first = state.last = undefined; + if (DESCRIPTORS$3) state.size = 0; + else that.size = 0; + }, + // `{ Map, Set }.prototype.delete(key)` methods + // https://tc39.es/ecma262/#sec-map.prototype.delete + // https://tc39.es/ecma262/#sec-set.prototype.delete + 'delete': function (key) { + var that = this; + var state = getInternalState(that); + var entry = getEntry(that, key); + if (entry) { + var next = entry.next; + var prev = entry.previous; + delete state.index[entry.index]; + entry.removed = true; + if (prev) prev.next = next; + if (next) next.previous = prev; + if (state.first === entry) state.first = next; + if (state.last === entry) state.last = prev; + if (DESCRIPTORS$3) state.size--; + else that.size--; + } return !!entry; + }, + // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods + // https://tc39.es/ecma262/#sec-map.prototype.foreach + // https://tc39.es/ecma262/#sec-set.prototype.foreach + forEach: function forEach(callbackfn /* , that = undefined */) { + var state = getInternalState(this); + var boundFunction = bind$1(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var entry; + while (entry = entry ? entry.next : state.first) { + boundFunction(entry.value, entry.key, this); + // revert to the last existing entry + while (entry && entry.removed) entry = entry.previous; + } + }, + // `{ Map, Set}.prototype.has(key)` methods + // https://tc39.es/ecma262/#sec-map.prototype.has + // https://tc39.es/ecma262/#sec-set.prototype.has + has: function has(key) { + return !!getEntry(this, key); + } + }); + + defineBuiltIns(Prototype, IS_MAP ? { + // `Map.prototype.get(key)` method + // https://tc39.es/ecma262/#sec-map.prototype.get + get: function get(key) { + var entry = getEntry(this, key); + return entry && entry.value; + }, + // `Map.prototype.set(key, value)` method + // https://tc39.es/ecma262/#sec-map.prototype.set + set: function set(key, value) { + return define(this, key === 0 ? 0 : key, value); + } + } : { + // `Set.prototype.add(value)` method + // https://tc39.es/ecma262/#sec-set.prototype.add + add: function add(value) { + return define(this, value = value === 0 ? 0 : value, value); + } + }); + if (DESCRIPTORS$3) defineBuiltInAccessor(Prototype, 'size', { + configurable: true, + get: function () { + return getInternalState(this).size; + } + }); + return Constructor; + }, + setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { + var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; + var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); + var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); + // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods + // https://tc39.es/ecma262/#sec-map.prototype.entries + // https://tc39.es/ecma262/#sec-map.prototype.keys + // https://tc39.es/ecma262/#sec-map.prototype.values + // https://tc39.es/ecma262/#sec-map.prototype-@@iterator + // https://tc39.es/ecma262/#sec-set.prototype.entries + // https://tc39.es/ecma262/#sec-set.prototype.keys + // https://tc39.es/ecma262/#sec-set.prototype.values + // https://tc39.es/ecma262/#sec-set.prototype-@@iterator + defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { + setInternalState(this, { + type: ITERATOR_NAME, + target: iterated, + state: getInternalCollectionState(iterated), + kind: kind, + last: undefined + }); + }, function () { + var state = getInternalIteratorState(this); + var kind = state.kind; + var entry = state.last; + // revert to the last existing entry + while (entry && entry.removed) entry = entry.previous; + // get next entry + if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { + // or finish the iteration + state.target = undefined; + return createIterResultObject(undefined, true); + } + // return step by kind + if (kind === 'keys') return createIterResultObject(entry.key, false); + if (kind === 'values') return createIterResultObject(entry.value, false); + return createIterResultObject([entry.key, entry.value], false); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // `{ Map, Set }.prototype[@@species]` accessors + // https://tc39.es/ecma262/#sec-get-map-@@species + // https://tc39.es/ecma262/#sec-get-set-@@species + setSpecies(CONSTRUCTOR_NAME); + } + }; + + var collection$1 = collection$2; + var collectionStrong$1 = collectionStrong$2; + + // `Map` constructor + // https://tc39.es/ecma262/#sec-map-objects + collection$1('Map', function (init) { + return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; + }, collectionStrong$1); + + var path$8 = path$u; + + var map$2 = path$8.Map; + + var parent$j = map$2; + + + var map$1 = parent$j; + + var map = map$1; + + var _Map = /*@__PURE__*/getDefaultExportFromCjs(map); + + var collection = collection$2; + var collectionStrong = collectionStrong$2; + + // `Set` constructor + // https://tc39.es/ecma262/#sec-set-objects + collection('Set', function (init) { + return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; + }, collectionStrong); + + var path$7 = path$u; + + var set$2 = path$7.Set; + + var parent$i = set$2; + + + var set$1 = parent$i; + + var set = set$1; + + var _Set = /*@__PURE__*/getDefaultExportFromCjs(set); + + var iterator = iterator$4; + + var _Symbol$iterator2 = /*@__PURE__*/getDefaultExportFromCjs(iterator); + + var getIterator$5 = getIterator$8; + + var getIterator_1 = getIterator$5; + + var parent$h = getIterator_1; + + + var getIterator$4 = parent$h; + + var parent$g = getIterator$4; + + var getIterator$3 = parent$g; + + var parent$f = getIterator$3; + + var getIterator$2 = parent$f; + + var getIterator$1 = getIterator$2; + + var getIterator = getIterator$1; + + var _getIterator = /*@__PURE__*/getDefaultExportFromCjs(getIterator); + + var arraySlice = arraySliceSimple; + + var floor = Math.floor; + + var mergeSort = function (array, comparefn) { + var length = array.length; + var middle = floor(length / 2); + return length < 8 ? insertionSort(array, comparefn) : merge( + array, + mergeSort(arraySlice(array, 0, middle), comparefn), + mergeSort(arraySlice(array, middle), comparefn), + comparefn + ); + }; + + var insertionSort = function (array, comparefn) { + var length = array.length; + var i = 1; + var element, j; + + while (i < length) { + j = i; + element = array[i]; + while (j && comparefn(array[j - 1], element) > 0) { + array[j] = array[--j]; + } + if (j !== i++) array[j] = element; + } return array; + }; + + var merge = function (array, left, right, comparefn) { + var llength = left.length; + var rlength = right.length; + var lindex = 0; + var rindex = 0; + + while (lindex < llength || rindex < rlength) { + array[lindex + rindex] = (lindex < llength && rindex < rlength) + ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] + : lindex < llength ? left[lindex++] : right[rindex++]; + } return array; + }; + + var arraySort = mergeSort; + + var userAgent$1 = engineUserAgent; + + var firefox = userAgent$1.match(/firefox\/(\d+)/i); + + var engineFfVersion = !!firefox && +firefox[1]; + + var UA = engineUserAgent; + + var engineIsIeOrEdge = /MSIE|Trident/.test(UA); + + var userAgent = engineUserAgent; + + var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); + + var engineWebkitVersion = !!webkit && +webkit[1]; + + var $$a = _export; + var uncurryThis$1 = functionUncurryThis; + var aCallable = aCallable$e; + var toObject = toObject$f; + var lengthOfArrayLike = lengthOfArrayLike$e; + var deletePropertyOrThrow = deletePropertyOrThrow$2; + var toString$2 = toString$c; + var fails$3 = fails$y; + var internalSort = arraySort; + var arrayMethodIsStrict$2 = arrayMethodIsStrict$6; + var FF = engineFfVersion; + var IE_OR_EDGE = engineIsIeOrEdge; + var V8 = engineV8Version; + var WEBKIT = engineWebkitVersion; + + var test = []; + var nativeSort = uncurryThis$1(test.sort); + var push$1 = uncurryThis$1(test.push); + + // IE8- + var FAILS_ON_UNDEFINED = fails$3(function () { + test.sort(undefined); + }); + // V8 bug + var FAILS_ON_NULL = fails$3(function () { + test.sort(null); + }); + // Old WebKit + var STRICT_METHOD$2 = arrayMethodIsStrict$2('sort'); + + var STABLE_SORT = !fails$3(function () { + // feature detection can be too slow, so check engines versions + if (V8) return V8 < 70; + if (FF && FF > 3) return; + if (IE_OR_EDGE) return true; + if (WEBKIT) return WEBKIT < 603; + + var result = ''; + var code, chr, value, index; + + // generate an array with more 512 elements (Chakra and old V8 fails only in this case) + for (code = 65; code < 76; code++) { + chr = String.fromCharCode(code); + + switch (code) { + case 66: case 69: case 70: case 72: value = 3; break; + case 68: case 71: value = 4; break; + default: value = 2; + } + + for (index = 0; index < 47; index++) { + test.push({ k: chr + index, v: value }); + } + } + + test.sort(function (a, b) { return b.v - a.v; }); + + for (index = 0; index < test.length; index++) { + chr = test[index].k.charAt(0); + if (result.charAt(result.length - 1) !== chr) result += chr; + } + + return result !== 'DGBEFHACIJK'; + }); + + var FORCED$3 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$2 || !STABLE_SORT; + + var getSortCompare = function (comparefn) { + return function (x, y) { + if (y === undefined) return -1; + if (x === undefined) return 1; + if (comparefn !== undefined) return +comparefn(x, y) || 0; + return toString$2(x) > toString$2(y) ? 1 : -1; + }; + }; + + // `Array.prototype.sort` method + // https://tc39.es/ecma262/#sec-array.prototype.sort + $$a({ target: 'Array', proto: true, forced: FORCED$3 }, { + sort: function sort(comparefn) { + if (comparefn !== undefined) aCallable(comparefn); + + var array = toObject(this); + + if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn); + + var items = []; + var arrayLength = lengthOfArrayLike(array); + var itemsLength, index; + + for (index = 0; index < arrayLength; index++) { + if (index in array) push$1(items, array[index]); + } + + internalSort(items, getSortCompare(comparefn)); + + itemsLength = lengthOfArrayLike(items); + index = 0; + + while (index < itemsLength) array[index] = items[index++]; + while (index < arrayLength) deletePropertyOrThrow(array, index++); + + return array; + } + }); + + var entryVirtual$8 = entryVirtual$o; + + var sort$3 = entryVirtual$8('Array').sort; + + var isPrototypeOf$8 = objectIsPrototypeOf; + var method$8 = sort$3; + + var ArrayPrototype$7 = Array.prototype; + + var sort$2 = function (it) { + var own = it.sort; + return it === ArrayPrototype$7 || (isPrototypeOf$8(ArrayPrototype$7, it) && own === ArrayPrototype$7.sort) ? method$8 : own; + }; + + var parent$e = sort$2; + + var sort$1 = parent$e; + + var sort = sort$1; + + var _sortInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(sort); + + var $$9 = _export; + var $some = arrayIteration.some; + var arrayMethodIsStrict$1 = arrayMethodIsStrict$6; + + var STRICT_METHOD$1 = arrayMethodIsStrict$1('some'); + + // `Array.prototype.some` method + // https://tc39.es/ecma262/#sec-array.prototype.some + $$9({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 }, { + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$7 = entryVirtual$o; + + var some$3 = entryVirtual$7('Array').some; + + var isPrototypeOf$7 = objectIsPrototypeOf; + var method$7 = some$3; + + var ArrayPrototype$6 = Array.prototype; + + var some$2 = function (it) { + var own = it.some; + return it === ArrayPrototype$6 || (isPrototypeOf$7(ArrayPrototype$6, it) && own === ArrayPrototype$6.some) ? method$7 : own; + }; + + var parent$d = some$2; + + var some$1 = parent$d; + + var some = some$1; + + var _someInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(some); + + var entryVirtual$6 = entryVirtual$o; + + var keys$3 = entryVirtual$6('Array').keys; + + var parent$c = keys$3; + + var keys$2 = parent$c; + + var classof$2 = classof$g; + var hasOwn$2 = hasOwnProperty_1; + var isPrototypeOf$6 = objectIsPrototypeOf; + var method$6 = keys$2; + + var ArrayPrototype$5 = Array.prototype; + + var DOMIterables$2 = { + DOMTokenList: true, + NodeList: true + }; + + var keys$1 = function (it) { + var own = it.keys; + return it === ArrayPrototype$5 || (isPrototypeOf$6(ArrayPrototype$5, it) && own === ArrayPrototype$5.keys) + || hasOwn$2(DOMIterables$2, classof$2(it)) ? method$6 : own; + }; + + var keys = keys$1; + + var _keysInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(keys); + + var entryVirtual$5 = entryVirtual$o; + + var values$3 = entryVirtual$5('Array').values; + + var parent$b = values$3; + + var values$2 = parent$b; + + var classof$1 = classof$g; + var hasOwn$1 = hasOwnProperty_1; + var isPrototypeOf$5 = objectIsPrototypeOf; + var method$5 = values$2; + + var ArrayPrototype$4 = Array.prototype; + + var DOMIterables$1 = { + DOMTokenList: true, + NodeList: true + }; + + var values$1 = function (it) { + var own = it.values; + return it === ArrayPrototype$4 || (isPrototypeOf$5(ArrayPrototype$4, it) && own === ArrayPrototype$4.values) + || hasOwn$1(DOMIterables$1, classof$1(it)) ? method$5 : own; + }; + + var values = values$1; + + var _valuesInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(values); + + var entryVirtual$4 = entryVirtual$o; + + var entries$3 = entryVirtual$4('Array').entries; + + var parent$a = entries$3; + + var entries$2 = parent$a; + + var classof = classof$g; + var hasOwn = hasOwnProperty_1; + var isPrototypeOf$4 = objectIsPrototypeOf; + var method$4 = entries$2; + + var ArrayPrototype$3 = Array.prototype; + + var DOMIterables = { + DOMTokenList: true, + NodeList: true + }; + + var entries$1 = function (it) { + var own = it.entries; + return it === ArrayPrototype$3 || (isPrototypeOf$4(ArrayPrototype$3, it) && own === ArrayPrototype$3.entries) + || hasOwn(DOMIterables, classof(it)) ? method$4 : own; + }; + + var entries = entries$1; + + var _entriesInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(entries); + + var defineProperty = defineProperty$a; + + var _Object$defineProperty = /*@__PURE__*/getDefaultExportFromCjs(defineProperty); + + var $$8 = _export; + var getBuiltIn = getBuiltIn$f; + var apply = functionApply; + var bind = functionBind; + var aConstructor = aConstructor$2; + var anObject = anObject$d; + var isObject = isObject$j; + var create = objectCreate; + var fails$2 = fails$y; + + var nativeConstruct = getBuiltIn('Reflect', 'construct'); + var ObjectPrototype = Object.prototype; + var push = [].push; + + // `Reflect.construct` method + // https://tc39.es/ecma262/#sec-reflect.construct + // MS Edge supports only 2 arguments and argumentsList argument is optional + // FF Nightly sets third argument as `new.target`, but does not create `this` from it + var NEW_TARGET_BUG = fails$2(function () { + function F() { /* empty */ } + return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); + }); + + var ARGS_BUG = !fails$2(function () { + nativeConstruct(function () { /* empty */ }); + }); + + var FORCED$2 = NEW_TARGET_BUG || ARGS_BUG; + + $$8({ target: 'Reflect', stat: true, forced: FORCED$2, sham: FORCED$2 }, { + construct: function construct(Target, args /* , newTarget */) { + aConstructor(Target); + anObject(args); + var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); + if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); + if (Target === newTarget) { + // w/o altered newTarget, optimization for 0-4 arguments + switch (args.length) { + case 0: return new Target(); + case 1: return new Target(args[0]); + case 2: return new Target(args[0], args[1]); + case 3: return new Target(args[0], args[1], args[2]); + case 4: return new Target(args[0], args[1], args[2], args[3]); + } + // w/o altered newTarget, lot of arguments case + var $args = [null]; + apply(push, $args, args); + return new (apply(bind, Target, $args))(); + } + // with altered newTarget, not support built-in constructors + var proto = newTarget.prototype; + var instance = create(isObject(proto) ? proto : ObjectPrototype); + var result = apply(Target, instance, args); + return isObject(result) ? result : instance; + } + }); + + var path$6 = path$u; + + var construct$2 = path$6.Reflect.construct; + + var parent$9 = construct$2; + + var construct$1 = parent$9; + + var construct = construct$1; + + var _Reflect$construct = /*@__PURE__*/getDefaultExportFromCjs(construct); + + var path$5 = path$u; + + var getOwnPropertySymbols$2 = path$5.Object.getOwnPropertySymbols; + + var parent$8 = getOwnPropertySymbols$2; + + var getOwnPropertySymbols$1 = parent$8; + + var getOwnPropertySymbols = getOwnPropertySymbols$1; + + var _Object$getOwnPropertySymbols = /*@__PURE__*/getDefaultExportFromCjs(getOwnPropertySymbols); + + var getOwnPropertyDescriptor$3 = {exports: {}}; + + var $$7 = _export; + var fails$1 = fails$y; + var toIndexedObject$1 = toIndexedObject$b; + var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; + var DESCRIPTORS$2 = descriptors; + + var FORCED$1 = !DESCRIPTORS$2 || fails$1(function () { nativeGetOwnPropertyDescriptor(1); }); + + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor + $$7({ target: 'Object', stat: true, forced: FORCED$1, sham: !DESCRIPTORS$2 }, { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { + return nativeGetOwnPropertyDescriptor(toIndexedObject$1(it), key); + } + }); + + var path$4 = path$u; + + var Object$2 = path$4.Object; + + var getOwnPropertyDescriptor$2 = getOwnPropertyDescriptor$3.exports = function getOwnPropertyDescriptor(it, key) { + return Object$2.getOwnPropertyDescriptor(it, key); + }; + + if (Object$2.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor$2.sham = true; + + var getOwnPropertyDescriptorExports = getOwnPropertyDescriptor$3.exports; + + var parent$7 = getOwnPropertyDescriptorExports; + + var getOwnPropertyDescriptor$1 = parent$7; + + var getOwnPropertyDescriptor = getOwnPropertyDescriptor$1; + + var _Object$getOwnPropertyDescriptor = /*@__PURE__*/getDefaultExportFromCjs(getOwnPropertyDescriptor); + + var $$6 = _export; + var DESCRIPTORS$1 = descriptors; + var ownKeys$2 = ownKeys$8; + var toIndexedObject = toIndexedObject$b; + var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor; + var createProperty = createProperty$6; + + // `Object.getOwnPropertyDescriptors` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors + $$6({ target: 'Object', stat: true, sham: !DESCRIPTORS$1 }, { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIndexedObject(object); + var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; + var keys = ownKeys$2(O); + var result = {}; + var index = 0; + var key, descriptor; + while (keys.length > index) { + descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); + if (descriptor !== undefined) createProperty(result, key, descriptor); + } + return result; + } + }); + + var path$3 = path$u; + + var getOwnPropertyDescriptors$2 = path$3.Object.getOwnPropertyDescriptors; + + var parent$6 = getOwnPropertyDescriptors$2; + + var getOwnPropertyDescriptors$1 = parent$6; + + var getOwnPropertyDescriptors = getOwnPropertyDescriptors$1; + + var _Object$getOwnPropertyDescriptors = /*@__PURE__*/getDefaultExportFromCjs(getOwnPropertyDescriptors); + + var defineProperties$4 = {exports: {}}; + + var $$5 = _export; + var DESCRIPTORS = descriptors; + var defineProperties$3 = objectDefineProperties.f; + + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + // eslint-disable-next-line es/no-object-defineproperties -- safe + $$5({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties$3, sham: !DESCRIPTORS }, { + defineProperties: defineProperties$3 + }); + + var path$2 = path$u; + + var Object$1 = path$2.Object; + + var defineProperties$2 = defineProperties$4.exports = function defineProperties(T, D) { + return Object$1.defineProperties(T, D); + }; + + if (Object$1.defineProperties.sham) defineProperties$2.sham = true; + + var definePropertiesExports = defineProperties$4.exports; + + var parent$5 = definePropertiesExports; + + var defineProperties$1 = parent$5; + + var defineProperties = defineProperties$1; + + var _Object$defineProperties = /*@__PURE__*/getDefaultExportFromCjs(defineProperties); + + // Unique ID creation requires a high quality random # generator. In the browser we therefore + // require the crypto API and do not support built-in fallback to lower quality random number + // generators (like Math.random()). + let getRandomValues; + const rnds8 = new Uint8Array(16); + function rng() { + // lazy load so that environments that need to polyfill have a chance to do so + if (!getRandomValues) { + // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. + getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); + + if (!getRandomValues) { + throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); + } + } + + return getRandomValues(rnds8); + } + + /** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ + + const byteToHex = []; + + for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).slice(1)); + } + + function unsafeStringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; + } + + const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); + var native = { + randomUUID + }; + + function v4(options, buf, offset) { + if (native.randomUUID && !buf && !options) { + return native.randomUUID(); + } + + options = options || {}; + const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return unsafeStringify(rnds); + } + + var _Symbol$iterator; + function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } + function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context32, _context33; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context32 = ownKeys$1(Object(t), !0)).call(_context32, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context33 = ownKeys$1(Object(t))).call(_context33, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } + function _createSuper$d(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$d(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$d() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$6(o, minLen) { var _context31; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = _sliceInstanceProperty(_context31 = Object.prototype.toString.call(o)).call(_context31, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); } + function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + + /** + * Create new data pipe. + * + * @param from - The source data set or data view. + * @remarks + * Example usage: + * ```typescript + * interface AppItem { + * whoami: string; + * appData: unknown; + * visData: VisItem; + * } + * interface VisItem { + * id: number; + * label: string; + * color: string; + * x: number; + * y: number; + * } + * + * const ds1 = new DataSet([], { fieldId: "whoami" }); + * const ds2 = new DataSet(); + * + * const pipe = createNewDataPipeFrom(ds1) + * .filter((item): boolean => item.enabled === true) + * .map((item): VisItem => item.visData) + * .to(ds2); + * + * pipe.start(); + * ``` + * @returns A factory whose methods can be used to configure the pipe. + */ + function createNewDataPipeFrom(from) { + return new DataPipeUnderConstruction(from); + } + /** + * Internal implementation of the pipe. This should be accessible only through + * `createNewDataPipeFrom` from the outside. + * + * @typeParam SI - Source item type. + * @typeParam SP - Source item type's id property name. + * @typeParam TI - Target item type. + * @typeParam TP - Target item type's id property name. + */ + var SimpleDataPipe = /*#__PURE__*/function () { + /** + * Create a new data pipe. + * + * @param _source - The data set or data view that will be observed. + * @param _transformers - An array of transforming functions to be used to + * filter or transform the items in the pipe. + * @param _target - The data set or data view that will receive the items. + */ + function SimpleDataPipe(_source, _transformers, _target) { + var _context, _context2, _context3; + _classCallCheck(this, SimpleDataPipe); + _defineProperty(this, "_source", void 0); + _defineProperty(this, "_transformers", void 0); + _defineProperty(this, "_target", void 0); + /** + * Bound listeners for use with `DataInterface['on' | 'off']`. + */ + _defineProperty(this, "_listeners", { + add: _bindInstanceProperty$1(_context = this._add).call(_context, this), + remove: _bindInstanceProperty$1(_context2 = this._remove).call(_context2, this), + update: _bindInstanceProperty$1(_context3 = this._update).call(_context3, this) + }); + this._source = _source; + this._transformers = _transformers; + this._target = _target; + } + /** @inheritDoc */ + _createClass(SimpleDataPipe, [{ + key: "all", + value: function all() { + this._target.update(this._transformItems(this._source.get())); + return this; + } + /** @inheritDoc */ + }, { + key: "start", + value: function start() { + this._source.on("add", this._listeners.add); + this._source.on("remove", this._listeners.remove); + this._source.on("update", this._listeners.update); + return this; + } + /** @inheritDoc */ + }, { + key: "stop", + value: function stop() { + this._source.off("add", this._listeners.add); + this._source.off("remove", this._listeners.remove); + this._source.off("update", this._listeners.update); + return this; + } + /** + * Apply the transformers to the items. + * + * @param items - The items to be transformed. + * @returns The transformed items. + */ + }, { + key: "_transformItems", + value: function _transformItems(items) { + var _context4; + return _reduceInstanceProperty(_context4 = this._transformers).call(_context4, function (items, transform) { + return transform(items); + }, items); + } + /** + * Handle an add event. + * + * @param _name - Ignored. + * @param payload - The payload containing the ids of the added items. + */ + }, { + key: "_add", + value: function _add(_name, payload) { + if (payload == null) { + return; + } + this._target.add(this._transformItems(this._source.get(payload.items))); + } + /** + * Handle an update event. + * + * @param _name - Ignored. + * @param payload - The payload containing the ids of the updated items. + */ + }, { + key: "_update", + value: function _update(_name, payload) { + if (payload == null) { + return; + } + this._target.update(this._transformItems(this._source.get(payload.items))); + } + /** + * Handle a remove event. + * + * @param _name - Ignored. + * @param payload - The payload containing the data of the removed items. + */ + }, { + key: "_remove", + value: function _remove(_name, payload) { + if (payload == null) { + return; + } + this._target.remove(this._transformItems(payload.oldData)); + } + }]); + return SimpleDataPipe; + }(); + /** + * Internal implementation of the pipe factory. This should be accessible + * only through `createNewDataPipeFrom` from the outside. + * + * @typeParam TI - Target item type. + * @typeParam TP - Target item type's id property name. + */ + var DataPipeUnderConstruction = /*#__PURE__*/function () { + /** + * Create a new data pipe factory. This is an internal constructor that + * should never be called from outside of this file. + * + * @param _source - The source data set or data view for this pipe. + */ + function DataPipeUnderConstruction(_source) { + _classCallCheck(this, DataPipeUnderConstruction); + _defineProperty(this, "_source", void 0); + /** + * Array transformers used to transform items within the pipe. This is typed + * as any for the sake of simplicity. + */ + _defineProperty(this, "_transformers", []); + this._source = _source; + } + /** + * Filter the items. + * + * @param callback - A filtering function that returns true if given item + * should be piped and false if not. + * @returns This factory for further configuration. + */ + _createClass(DataPipeUnderConstruction, [{ + key: "filter", + value: function filter(callback) { + this._transformers.push(function (input) { + return _filterInstanceProperty(input).call(input, callback); + }); + return this; + } + /** + * Map each source item to a new type. + * + * @param callback - A mapping function that takes a source item and returns + * corresponding mapped item. + * @typeParam TI - Target item type. + * @typeParam TP - Target item type's id property name. + * @returns This factory for further configuration. + */ + }, { + key: "map", + value: function map(callback) { + this._transformers.push(function (input) { + return _mapInstanceProperty(input).call(input, callback); + }); + return this; + } + /** + * Map each source item to zero or more items of a new type. + * + * @param callback - A mapping function that takes a source item and returns + * an array of corresponding mapped items. + * @typeParam TI - Target item type. + * @typeParam TP - Target item type's id property name. + * @returns This factory for further configuration. + */ + }, { + key: "flatMap", + value: function flatMap(callback) { + this._transformers.push(function (input) { + return _flatMapInstanceProperty(input).call(input, callback); + }); + return this; + } + /** + * Connect this pipe to given data set. + * + * @param target - The data set that will receive the items from this pipe. + * @returns The pipe connected between given data sets and performing + * configured transformation on the processed items. + */ + }, { + key: "to", + value: function to(target) { + return new SimpleDataPipe(this._source, this._transformers, target); + } + }]); + return DataPipeUnderConstruction; + }(); + /** + * Determine whether a value can be used as an id. + * + * @param value - Input value of unknown type. + * @returns True if the value is valid id, false otherwise. + */ + function isId(value) { + return typeof value === "string" || typeof value === "number"; + } + + /** + * A queue. + * + * @typeParam T - The type of method names to be replaced by queued versions. + */ + var Queue = /*#__PURE__*/function () { + /** + * Construct a new Queue. + * + * @param options - Queue configuration. + */ + function Queue(options) { + _classCallCheck(this, Queue); + /** Delay in milliseconds. If defined the queue will be periodically flushed. */ + _defineProperty(this, "delay", void 0); + /** Maximum number of entries in the queue before it will be flushed. */ + _defineProperty(this, "max", void 0); + _defineProperty(this, "_queue", []); + _defineProperty(this, "_timeout", null); + _defineProperty(this, "_extended", null); + // options + this.delay = null; + this.max = Infinity; + this.setOptions(options); + } + /** + * Update the configuration of the queue. + * + * @param options - Queue configuration. + */ + _createClass(Queue, [{ + key: "setOptions", + value: function setOptions(options) { + if (options && typeof options.delay !== "undefined") { + this.delay = options.delay; + } + if (options && typeof options.max !== "undefined") { + this.max = options.max; + } + this._flushIfNeeded(); + } + /** + * Extend an object with queuing functionality. + * The object will be extended with a function flush, and the methods provided in options.replace will be replaced with queued ones. + * + * @param object - The object to be extended. + * @param options - Additional options. + * @returns The created queue. + */ + }, { + key: "destroy", + value: + /** + * Destroy the queue. The queue will first flush all queued actions, and in case it has extended an object, will restore the original object. + */ + function destroy() { + this.flush(); + if (this._extended) { + var object = this._extended.object; + var methods = this._extended.methods; + for (var i = 0; i < methods.length; i++) { + var method = methods[i]; + if (method.original) { + // @TODO: better solution? + object[method.name] = method.original; + } else { + // @TODO: better solution? + delete object[method.name]; + } + } + this._extended = null; + } + } + /** + * Replace a method on an object with a queued version. + * + * @param object - Object having the method. + * @param method - The method name. + */ + }, { + key: "replace", + value: function replace(object, method) { + /* eslint-disable-next-line @typescript-eslint/no-this-alias -- Function this is necessary in the function bellow, so class this has to be saved into a variable here. */ + var me = this; + var original = object[method]; + if (!original) { + throw new Error("Method " + method + " undefined"); + } + object[method] = function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + // add this call to the queue + me.queue({ + args: args, + fn: original, + context: this + }); + }; + } + /** + * Queue a call. + * + * @param entry - The function or entry to be queued. + */ + }, { + key: "queue", + value: function queue(entry) { + if (typeof entry === "function") { + this._queue.push({ + fn: entry + }); + } else { + this._queue.push(entry); + } + this._flushIfNeeded(); + } + /** + * Check whether the queue needs to be flushed. + */ + }, { + key: "_flushIfNeeded", + value: function _flushIfNeeded() { + var _this = this; + // flush when the maximum is exceeded. + if (this._queue.length > this.max) { + this.flush(); + } + // flush after a period of inactivity when a delay is configured + if (this._timeout != null) { + clearTimeout(this._timeout); + this._timeout = null; + } + if (this.queue.length > 0 && typeof this.delay === "number") { + this._timeout = _setTimeout(function () { + _this.flush(); + }, this.delay); + } + } + /** + * Flush all queued calls + */ + }, { + key: "flush", + value: function flush() { + var _context5, _context6; + _forEachInstanceProperty(_context5 = _spliceInstanceProperty(_context6 = this._queue).call(_context6, 0)).call(_context5, function (entry) { + entry.fn.apply(entry.context || entry.fn, entry.args || []); + }); + } + }], [{ + key: "extend", + value: function extend(object, options) { + var queue = new Queue(options); + if (object.flush !== undefined) { + throw new Error("Target object already has a property flush"); + } + object.flush = function () { + queue.flush(); + }; + var methods = [{ + name: "flush", + original: undefined + }]; + if (options && options.replace) { + for (var i = 0; i < options.replace.length; i++) { + var name = options.replace[i]; + methods.push({ + name: name, + // @TODO: better solution? + original: object[name] + }); + // @TODO: better solution? + queue.replace(object, name); + } + } + queue._extended = { + object: object, + methods: methods + }; + return queue; + } + }]); + return Queue; + }(); + /** + * {@link DataSet} code that can be reused in {@link DataView} or other similar implementations of {@link DataInterface}. + * + * @typeParam Item - Item type that may or may not have an id. + * @typeParam IdProp - Name of the property that contains the id. + */ + var DataSetPart = /*#__PURE__*/function () { + function DataSetPart() { + _classCallCheck(this, DataSetPart); + _defineProperty(this, "_subscribers", { + "*": [], + add: [], + remove: [], + update: [] + }); + /** + * @deprecated Use on instead (PS: DataView.subscribe === DataView.on). + */ + _defineProperty(this, "subscribe", DataSetPart.prototype.on); + /** + * @deprecated Use off instead (PS: DataView.unsubscribe === DataView.off). + */ + _defineProperty(this, "unsubscribe", DataSetPart.prototype.off); + } + _createClass(DataSetPart, [{ + key: "_trigger", + value: + /** + * Trigger an event + * + * @param event - Event name. + * @param payload - Event payload. + * @param senderId - Id of the sender. + */ + function _trigger(event, payload, senderId) { + var _context7, _context8; + if (event === "*") { + throw new Error("Cannot trigger event *"); + } + _forEachInstanceProperty(_context7 = _concatInstanceProperty(_context8 = []).call(_context8, _toConsumableArray(this._subscribers[event]), _toConsumableArray(this._subscribers["*"]))).call(_context7, function (subscriber) { + subscriber(event, payload, senderId != null ? senderId : null); + }); + } + /** + * Subscribe to an event, add an event listener. + * + * @remarks Non-function callbacks are ignored. + * @param event - Event name. + * @param callback - Callback method. + */ + }, { + key: "on", + value: function on(event, callback) { + if (typeof callback === "function") { + this._subscribers[event].push(callback); + } + // @TODO: Maybe throw for invalid callbacks? + } + /** + * Unsubscribe from an event, remove an event listener. + * + * @remarks If the same callback was subscribed more than once **all** occurences will be removed. + * @param event - Event name. + * @param callback - Callback method. + */ + }, { + key: "off", + value: function off(event, callback) { + var _context9; + this._subscribers[event] = _filterInstanceProperty(_context9 = this._subscribers[event]).call(_context9, function (subscriber) { + return subscriber !== callback; + }); + } + }]); + return DataSetPart; + }(); + /** + * Data stream + * + * @remarks + * {@link DataStream} offers an always up to date stream of items from a {@link DataSet} or {@link DataView}. + * That means that the stream is evaluated at the time of iteration, conversion to another data type or when {@link cache} is called, not when the {@link DataStream} was created. + * Multiple invocations of for example {@link toItemArray} may yield different results (if the data source like for example {@link DataSet} gets modified). + * @typeParam Item - The item type this stream is going to work with. + */ + _Symbol$iterator = _Symbol$iterator2; + var DataStream = /*#__PURE__*/function () { + /** + * Create a new data stream. + * + * @param pairs - The id, item pairs. + */ + function DataStream(pairs) { + _classCallCheck(this, DataStream); + _defineProperty(this, "_pairs", void 0); + this._pairs = pairs; + } + /** + * Return an iterable of key, value pairs for every entry in the stream. + */ + _createClass(DataStream, [{ + key: _Symbol$iterator, + value: + /*#__PURE__*/ + _regeneratorRuntime.mark(function value() { + var _iterator, _step, _step$value, id, item; + return _regeneratorRuntime.wrap(function value$(_context10) { + while (1) switch (_context10.prev = _context10.next) { + case 0: + _iterator = _createForOfIteratorHelper$6(this._pairs); + _context10.prev = 1; + _iterator.s(); + case 3: + if ((_step = _iterator.n()).done) { + _context10.next = 9; + break; + } + _step$value = _slicedToArray(_step.value, 2), id = _step$value[0], item = _step$value[1]; + _context10.next = 7; + return [id, item]; + case 7: + _context10.next = 3; + break; + case 9: + _context10.next = 14; + break; + case 11: + _context10.prev = 11; + _context10.t0 = _context10["catch"](1); + _iterator.e(_context10.t0); + case 14: + _context10.prev = 14; + _iterator.f(); + return _context10.finish(14); + case 17: + case "end": + return _context10.stop(); + } + }, value, this, [[1, 11, 14, 17]]); + }) + /** + * Return an iterable of key, value pairs for every entry in the stream. + */ + }, { + key: "entries", + value: + /*#__PURE__*/ + _regeneratorRuntime.mark(function entries() { + var _iterator2, _step2, _step2$value, id, item; + return _regeneratorRuntime.wrap(function entries$(_context11) { + while (1) switch (_context11.prev = _context11.next) { + case 0: + _iterator2 = _createForOfIteratorHelper$6(this._pairs); + _context11.prev = 1; + _iterator2.s(); + case 3: + if ((_step2 = _iterator2.n()).done) { + _context11.next = 9; + break; + } + _step2$value = _slicedToArray(_step2.value, 2), id = _step2$value[0], item = _step2$value[1]; + _context11.next = 7; + return [id, item]; + case 7: + _context11.next = 3; + break; + case 9: + _context11.next = 14; + break; + case 11: + _context11.prev = 11; + _context11.t0 = _context11["catch"](1); + _iterator2.e(_context11.t0); + case 14: + _context11.prev = 14; + _iterator2.f(); + return _context11.finish(14); + case 17: + case "end": + return _context11.stop(); + } + }, entries, this, [[1, 11, 14, 17]]); + }) + /** + * Return an iterable of keys in the stream. + */ + }, { + key: "keys", + value: + /*#__PURE__*/ + _regeneratorRuntime.mark(function keys() { + var _iterator3, _step3, _step3$value, id; + return _regeneratorRuntime.wrap(function keys$(_context12) { + while (1) switch (_context12.prev = _context12.next) { + case 0: + _iterator3 = _createForOfIteratorHelper$6(this._pairs); + _context12.prev = 1; + _iterator3.s(); + case 3: + if ((_step3 = _iterator3.n()).done) { + _context12.next = 9; + break; + } + _step3$value = _slicedToArray(_step3.value, 1), id = _step3$value[0]; + _context12.next = 7; + return id; + case 7: + _context12.next = 3; + break; + case 9: + _context12.next = 14; + break; + case 11: + _context12.prev = 11; + _context12.t0 = _context12["catch"](1); + _iterator3.e(_context12.t0); + case 14: + _context12.prev = 14; + _iterator3.f(); + return _context12.finish(14); + case 17: + case "end": + return _context12.stop(); + } + }, keys, this, [[1, 11, 14, 17]]); + }) + /** + * Return an iterable of values in the stream. + */ + }, { + key: "values", + value: + /*#__PURE__*/ + _regeneratorRuntime.mark(function values() { + var _iterator4, _step4, _step4$value, item; + return _regeneratorRuntime.wrap(function values$(_context13) { + while (1) switch (_context13.prev = _context13.next) { + case 0: + _iterator4 = _createForOfIteratorHelper$6(this._pairs); + _context13.prev = 1; + _iterator4.s(); + case 3: + if ((_step4 = _iterator4.n()).done) { + _context13.next = 9; + break; + } + _step4$value = _slicedToArray(_step4.value, 2), item = _step4$value[1]; + _context13.next = 7; + return item; + case 7: + _context13.next = 3; + break; + case 9: + _context13.next = 14; + break; + case 11: + _context13.prev = 11; + _context13.t0 = _context13["catch"](1); + _iterator4.e(_context13.t0); + case 14: + _context13.prev = 14; + _iterator4.f(); + return _context13.finish(14); + case 17: + case "end": + return _context13.stop(); + } + }, values, this, [[1, 11, 14, 17]]); + }) + /** + * Return an array containing all the ids in this stream. + * + * @remarks + * The array may contain duplicities. + * @returns The array with all ids from this stream. + */ + }, { + key: "toIdArray", + value: function toIdArray() { + var _context14; + return _mapInstanceProperty(_context14 = _toConsumableArray(this._pairs)).call(_context14, function (pair) { + return pair[0]; + }); + } + /** + * Return an array containing all the items in this stream. + * + * @remarks + * The array may contain duplicities. + * @returns The array with all items from this stream. + */ + }, { + key: "toItemArray", + value: function toItemArray() { + var _context15; + return _mapInstanceProperty(_context15 = _toConsumableArray(this._pairs)).call(_context15, function (pair) { + return pair[1]; + }); + } + /** + * Return an array containing all the entries in this stream. + * + * @remarks + * The array may contain duplicities. + * @returns The array with all entries from this stream. + */ + }, { + key: "toEntryArray", + value: function toEntryArray() { + return _toConsumableArray(this._pairs); + } + /** + * Return an object map containing all the items in this stream accessible by ids. + * + * @remarks + * In case of duplicate ids (coerced to string so `7 == '7'`) the last encoutered appears in the returned object. + * @returns The object map of all id → item pairs from this stream. + */ + }, { + key: "toObjectMap", + value: function toObjectMap() { + var map = _Object$create$1(null); + var _iterator5 = _createForOfIteratorHelper$6(this._pairs), + _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var _step5$value = _slicedToArray(_step5.value, 2), + id = _step5$value[0], + item = _step5$value[1]; + map[id] = item; + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + return map; + } + /** + * Return a map containing all the items in this stream accessible by ids. + * + * @returns The map of all id → item pairs from this stream. + */ + }, { + key: "toMap", + value: function toMap() { + return new _Map(this._pairs); + } + /** + * Return a set containing all the (unique) ids in this stream. + * + * @returns The set of all ids from this stream. + */ + }, { + key: "toIdSet", + value: function toIdSet() { + return new _Set(this.toIdArray()); + } + /** + * Return a set containing all the (unique) items in this stream. + * + * @returns The set of all items from this stream. + */ + }, { + key: "toItemSet", + value: function toItemSet() { + return new _Set(this.toItemArray()); + } + /** + * Cache the items from this stream. + * + * @remarks + * This method allows for items to be fetched immediatelly and used (possibly multiple times) later. + * It can also be used to optimize performance as {@link DataStream} would otherwise reevaluate everything upon each iteration. + * + * ## Example + * ```javascript + * const ds = new DataSet([…]) + * + * const cachedStream = ds.stream() + * .filter(…) + * .sort(…) + * .map(…) + * .cached(…) // Data are fetched, processed and cached here. + * + * ds.clear() + * chachedStream // Still has all the items. + * ``` + * @returns A new {@link DataStream} with cached items (detached from the original {@link DataSet}). + */ + }, { + key: "cache", + value: function cache() { + return new DataStream(_toConsumableArray(this._pairs)); + } + /** + * Get the distinct values of given property. + * + * @param callback - The function that picks and possibly converts the property. + * @typeParam T - The type of the distinct value. + * @returns A set of all distinct properties. + */ + }, { + key: "distinct", + value: function distinct(callback) { + var set = new _Set(); + var _iterator6 = _createForOfIteratorHelper$6(this._pairs), + _step6; + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var _step6$value = _slicedToArray(_step6.value, 2), + id = _step6$value[0], + item = _step6$value[1]; + set.add(callback(item, id)); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + return set; + } + /** + * Filter the items of the stream. + * + * @param callback - The function that decides whether an item will be included. + * @returns A new data stream with the filtered items. + */ + }, { + key: "filter", + value: function filter(callback) { + var pairs = this._pairs; + return new DataStream(_defineProperty({}, _Symbol$iterator2, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { + var _iterator7, _step7, _step7$value, id, item; + return _regeneratorRuntime.wrap(function _callee$(_context16) { + while (1) switch (_context16.prev = _context16.next) { + case 0: + _iterator7 = _createForOfIteratorHelper$6(pairs); + _context16.prev = 1; + _iterator7.s(); + case 3: + if ((_step7 = _iterator7.n()).done) { + _context16.next = 10; + break; + } + _step7$value = _slicedToArray(_step7.value, 2), id = _step7$value[0], item = _step7$value[1]; + if (!callback(item, id)) { + _context16.next = 8; + break; + } + _context16.next = 8; + return [id, item]; + case 8: + _context16.next = 3; + break; + case 10: + _context16.next = 15; + break; + case 12: + _context16.prev = 12; + _context16.t0 = _context16["catch"](1); + _iterator7.e(_context16.t0); + case 15: + _context16.prev = 15; + _iterator7.f(); + return _context16.finish(15); + case 18: + case "end": + return _context16.stop(); + } + }, _callee, null, [[1, 12, 15, 18]]); + }))); + } + /** + * Execute a callback for each item of the stream. + * + * @param callback - The function that will be invoked for each item. + */ + }, { + key: "forEach", + value: function forEach(callback) { + var _iterator8 = _createForOfIteratorHelper$6(this._pairs), + _step8; + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { + var _step8$value = _slicedToArray(_step8.value, 2), + id = _step8$value[0], + item = _step8$value[1]; + callback(item, id); + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + } + /** + * Map the items into a different type. + * + * @param callback - The function that does the conversion. + * @typeParam Mapped - The type of the item after mapping. + * @returns A new data stream with the mapped items. + */ + }, { + key: "map", + value: function map(callback) { + var pairs = this._pairs; + return new DataStream(_defineProperty({}, _Symbol$iterator2, /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() { + var _iterator9, _step9, _step9$value, id, item; + return _regeneratorRuntime.wrap(function _callee2$(_context17) { + while (1) switch (_context17.prev = _context17.next) { + case 0: + _iterator9 = _createForOfIteratorHelper$6(pairs); + _context17.prev = 1; + _iterator9.s(); + case 3: + if ((_step9 = _iterator9.n()).done) { + _context17.next = 9; + break; + } + _step9$value = _slicedToArray(_step9.value, 2), id = _step9$value[0], item = _step9$value[1]; + _context17.next = 7; + return [id, callback(item, id)]; + case 7: + _context17.next = 3; + break; + case 9: + _context17.next = 14; + break; + case 11: + _context17.prev = 11; + _context17.t0 = _context17["catch"](1); + _iterator9.e(_context17.t0); + case 14: + _context17.prev = 14; + _iterator9.f(); + return _context17.finish(14); + case 17: + case "end": + return _context17.stop(); + } + }, _callee2, null, [[1, 11, 14, 17]]); + }))); + } + /** + * Get the item with the maximum value of given property. + * + * @param callback - The function that picks and possibly converts the property. + * @returns The item with the maximum if found otherwise null. + */ + }, { + key: "max", + value: function max(callback) { + var iter = _getIterator(this._pairs); + var curr = iter.next(); + if (curr.done) { + return null; + } + var maxItem = curr.value[1]; + var maxValue = callback(curr.value[1], curr.value[0]); + while (!(curr = iter.next()).done) { + var _curr$value = _slicedToArray(curr.value, 2), + id = _curr$value[0], + item = _curr$value[1]; + var _value = callback(item, id); + if (_value > maxValue) { + maxValue = _value; + maxItem = item; + } + } + return maxItem; + } + /** + * Get the item with the minimum value of given property. + * + * @param callback - The function that picks and possibly converts the property. + * @returns The item with the minimum if found otherwise null. + */ + }, { + key: "min", + value: function min(callback) { + var iter = _getIterator(this._pairs); + var curr = iter.next(); + if (curr.done) { + return null; + } + var minItem = curr.value[1]; + var minValue = callback(curr.value[1], curr.value[0]); + while (!(curr = iter.next()).done) { + var _curr$value2 = _slicedToArray(curr.value, 2), + id = _curr$value2[0], + item = _curr$value2[1]; + var _value2 = callback(item, id); + if (_value2 < minValue) { + minValue = _value2; + minItem = item; + } + } + return minItem; + } + /** + * Reduce the items into a single value. + * + * @param callback - The function that does the reduction. + * @param accumulator - The initial value of the accumulator. + * @typeParam T - The type of the accumulated value. + * @returns The reduced value. + */ + }, { + key: "reduce", + value: function reduce(callback, accumulator) { + var _iterator10 = _createForOfIteratorHelper$6(this._pairs), + _step10; + try { + for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { + var _step10$value = _slicedToArray(_step10.value, 2), + id = _step10$value[0], + item = _step10$value[1]; + accumulator = callback(accumulator, item, id); + } + } catch (err) { + _iterator10.e(err); + } finally { + _iterator10.f(); + } + return accumulator; + } + /** + * Sort the items. + * + * @param callback - Item comparator. + * @returns A new stream with sorted items. + */ + }, { + key: "sort", + value: function sort(callback) { + var _this2 = this; + return new DataStream(_defineProperty({}, _Symbol$iterator2, function () { + var _context18; + return _getIterator(_sortInstanceProperty(_context18 = _toConsumableArray(_this2._pairs)).call(_context18, function (_ref, _ref2) { + var _ref3 = _slicedToArray(_ref, 2), + idA = _ref3[0], + itemA = _ref3[1]; + var _ref4 = _slicedToArray(_ref2, 2), + idB = _ref4[0], + itemB = _ref4[1]; + return callback(itemA, itemB, idA, idB); + })); + })); + } + }]); + return DataStream; + }(); + /** + * Add an id to given item if it doesn't have one already. + * + * @remarks + * The item will be modified. + * @param item - The item that will have an id after a call to this function. + * @param idProp - The key of the id property. + * @typeParam Item - Item type that may or may not have an id. + * @typeParam IdProp - Name of the property that contains the id. + * @returns true + */ + function ensureFullItem(item, idProp) { + if (item[idProp] == null) { + // generate an id + item[idProp] = v4(); + } + return item; + } + /** + * # DataSet + * + * Vis.js comes with a flexible DataSet, which can be used to hold and + * manipulate unstructured data and listen for changes in the data. The DataSet + * is key/value based. Data items can be added, updated and removed from the + * DataSet, and one can subscribe to changes in the DataSet. The data in the + * DataSet can be filtered and ordered. Data can be normalized when appending it + * to the DataSet as well. + * + * ## Example + * + * The following example shows how to use a DataSet. + * + * ```javascript + * // create a DataSet + * var options = {}; + * var data = new vis.DataSet(options); + * + * // add items + * // note that the data items can contain different properties and data formats + * data.add([ + * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true}, + * {id: 2, text: 'item 2', date: '2013-06-23', group: 2}, + * {id: 3, text: 'item 3', date: '2013-06-25', group: 2}, + * {id: 4, text: 'item 4'} + * ]); + * + * // subscribe to any change in the DataSet + * data.on('*', function (event, properties, senderId) { + * console.log('event', event, properties); + * }); + * + * // update an existing item + * data.update({id: 2, group: 1}); + * + * // remove an item + * data.remove(4); + * + * // get all ids + * var ids = data.getIds(); + * console.log('ids', ids); + * + * // get a specific item + * var item1 = data.get(1); + * console.log('item1', item1); + * + * // retrieve a filtered subset of the data + * var items = data.get({ + * filter: function (item) { + * return item.group == 1; + * } + * }); + * console.log('filtered items', items); + * ``` + * + * @typeParam Item - Item type that may or may not have an id. + * @typeParam IdProp - Name of the property that contains the id. + */ + var DataSet = /*#__PURE__*/function (_DataSetPart) { + _inherits(DataSet, _DataSetPart); + var _super = _createSuper$d(DataSet); + /** + * Construct a new DataSet. + * + * @param data - Initial data or options. + * @param options - Options (type error if data is also options). + */ + function DataSet(data, options) { + var _this3; + _classCallCheck(this, DataSet); + _this3 = _super.call(this); + // correctly read optional arguments + /** Flush all queued calls. */ + _defineProperty(_assertThisInitialized(_this3), "flush", void 0); + /** @inheritDoc */ + _defineProperty(_assertThisInitialized(_this3), "length", void 0); + _defineProperty(_assertThisInitialized(_this3), "_options", void 0); + _defineProperty(_assertThisInitialized(_this3), "_data", void 0); + _defineProperty(_assertThisInitialized(_this3), "_idProp", void 0); + _defineProperty(_assertThisInitialized(_this3), "_queue", null); + if (data && !_Array$isArray(data)) { + options = data; + data = []; + } + _this3._options = options || {}; + _this3._data = new _Map(); // map with data indexed by id + _this3.length = 0; // number of items in the DataSet + _this3._idProp = _this3._options.fieldId || "id"; // name of the field containing id + // add initial data when provided + if (data && data.length) { + _this3.add(data); + } + _this3.setOptions(options); + return _this3; + } + /** + * Set new options. + * + * @param options - The new options. + */ + _createClass(DataSet, [{ + key: "idProp", + get: /** @inheritDoc */ + function get() { + return this._idProp; + } + }, { + key: "setOptions", + value: function setOptions(options) { + if (options && options.queue !== undefined) { + if (options.queue === false) { + // delete queue if loaded + if (this._queue) { + this._queue.destroy(); + this._queue = null; + } + } else { + // create queue and update its options + if (!this._queue) { + this._queue = Queue.extend(this, { + replace: ["add", "update", "remove"] + }); + } + if (options.queue && _typeof$1(options.queue) === "object") { + this._queue.setOptions(options.queue); + } + } + } + } + /** + * Add a data item or an array with items. + * + * After the items are added to the DataSet, the DataSet will trigger an event `add`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. + * + * ## Example + * + * ```javascript + * // create a DataSet + * const data = new vis.DataSet() + * + * // add items + * const ids = data.add([ + * { id: 1, text: 'item 1' }, + * { id: 2, text: 'item 2' }, + * { text: 'item without an id' } + * ]) + * + * console.log(ids) // [1, 2, ''] + * ``` + * + * @param data - Items to be added (ids will be generated if missing). + * @param senderId - Sender id. + * @returns addedIds - Array with the ids (generated if not present) of the added items. + * @throws When an item with the same id as any of the added items already exists. + */ + }, { + key: "add", + value: function add(data, senderId) { + var _this4 = this; + var addedIds = []; + var id; + if (_Array$isArray(data)) { + // Array + var idsToAdd = _mapInstanceProperty(data).call(data, function (d) { + return d[_this4._idProp]; + }); + if (_someInstanceProperty(idsToAdd).call(idsToAdd, function (id) { + return _this4._data.has(id); + })) { + throw new Error("A duplicate id was found in the parameter array."); + } + for (var i = 0, len = data.length; i < len; i++) { + id = this._addItem(data[i]); + addedIds.push(id); + } + } else if (data && _typeof$1(data) === "object") { + // Single item + id = this._addItem(data); + addedIds.push(id); + } else { + throw new Error("Unknown dataType"); + } + if (addedIds.length) { + this._trigger("add", { + items: addedIds + }, senderId); + } + return addedIds; + } + /** + * Update existing items. When an item does not exist, it will be created. + * + * @remarks + * The provided properties will be merged in the existing item. When an item does not exist, it will be created. + * + * After the items are updated, the DataSet will trigger an event `add` for the added items, and an event `update`. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. + * + * ## Example + * + * ```javascript + * // create a DataSet + * const data = new vis.DataSet([ + * { id: 1, text: 'item 1' }, + * { id: 2, text: 'item 2' }, + * { id: 3, text: 'item 3' } + * ]) + * + * // update items + * const ids = data.update([ + * { id: 2, text: 'item 2 (updated)' }, + * { id: 4, text: 'item 4 (new)' } + * ]) + * + * console.log(ids) // [2, 4] + * ``` + * + * ## Warning for TypeScript users + * This method may introduce partial items into the data set. Use add or updateOnly instead for better type safety. + * @param data - Items to be updated (if the id is already present) or added (if the id is missing). + * @param senderId - Sender id. + * @returns updatedIds - The ids of the added (these may be newly generated if there was no id in the item from the data) or updated items. + * @throws When the supplied data is neither an item nor an array of items. + */ + }, { + key: "update", + value: function update(data, senderId) { + var _this5 = this; + var addedIds = []; + var updatedIds = []; + var oldData = []; + var updatedData = []; + var idProp = this._idProp; + var addOrUpdate = function addOrUpdate(item) { + var origId = item[idProp]; + if (origId != null && _this5._data.has(origId)) { + var fullItem = item; // it has an id, therefore it is a fullitem + var oldItem = _Object$assign({}, _this5._data.get(origId)); + // update item + var id = _this5._updateItem(fullItem); + updatedIds.push(id); + updatedData.push(fullItem); + oldData.push(oldItem); + } else { + // add new item + var _id = _this5._addItem(item); + addedIds.push(_id); + } + }; + if (_Array$isArray(data)) { + // Array + for (var i = 0, len = data.length; i < len; i++) { + if (data[i] && _typeof$1(data[i]) === "object") { + addOrUpdate(data[i]); + } else { + console.warn("Ignoring input item, which is not an object at index " + i); + } + } + } else if (data && _typeof$1(data) === "object") { + // Single item + addOrUpdate(data); + } else { + throw new Error("Unknown dataType"); + } + if (addedIds.length) { + this._trigger("add", { + items: addedIds + }, senderId); + } + if (updatedIds.length) { + var props = { + items: updatedIds, + oldData: oldData, + data: updatedData + }; + // TODO: remove deprecated property 'data' some day + //Object.defineProperty(props, 'data', { + // 'get': (function() { + // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data'); + // return updatedData; + // }).bind(this) + //}); + this._trigger("update", props, senderId); + } + return _concatInstanceProperty(addedIds).call(addedIds, updatedIds); + } + /** + * Update existing items. When an item does not exist, an error will be thrown. + * + * @remarks + * The provided properties will be deeply merged into the existing item. + * When an item does not exist (id not present in the data set or absent), an error will be thrown and nothing will be changed. + * + * After the items are updated, the DataSet will trigger an event `update`. + * When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. + * + * ## Example + * + * ```javascript + * // create a DataSet + * const data = new vis.DataSet([ + * { id: 1, text: 'item 1' }, + * { id: 2, text: 'item 2' }, + * { id: 3, text: 'item 3' }, + * ]) + * + * // update items + * const ids = data.update([ + * { id: 2, text: 'item 2 (updated)' }, // works + * // { id: 4, text: 'item 4 (new)' }, // would throw + * // { text: 'item 4 (new)' }, // would also throw + * ]) + * + * console.log(ids) // [2] + * ``` + * @param data - Updates (the id and optionally other props) to the items in this data set. + * @param senderId - Sender id. + * @returns updatedIds - The ids of the updated items. + * @throws When the supplied data is neither an item nor an array of items, when the ids are missing. + */ + }, { + key: "updateOnly", + value: function updateOnly(data, senderId) { + var _context19, + _this6 = this; + if (!_Array$isArray(data)) { + data = [data]; + } + var updateEventData = _mapInstanceProperty(_context19 = _mapInstanceProperty(data).call(data, function (update) { + var oldData = _this6._data.get(update[_this6._idProp]); + if (oldData == null) { + throw new Error("Updating non-existent items is not allowed."); + } + return { + oldData: oldData, + update: update + }; + })).call(_context19, function (_ref5) { + var oldData = _ref5.oldData, + update = _ref5.update; + var id = oldData[_this6._idProp]; + var updatedData = pureDeepObjectAssign(oldData, update); + _this6._data.set(id, updatedData); + return { + id: id, + oldData: oldData, + updatedData: updatedData + }; + }); + if (updateEventData.length) { + var props = { + items: _mapInstanceProperty(updateEventData).call(updateEventData, function (value) { + return value.id; + }), + oldData: _mapInstanceProperty(updateEventData).call(updateEventData, function (value) { + return value.oldData; + }), + data: _mapInstanceProperty(updateEventData).call(updateEventData, function (value) { + return value.updatedData; + }) + }; + // TODO: remove deprecated property 'data' some day + //Object.defineProperty(props, 'data', { + // 'get': (function() { + // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data'); + // return updatedData; + // }).bind(this) + //}); + this._trigger("update", props, senderId); + return props.items; + } else { + return []; + } + } + /** @inheritDoc */ + }, { + key: "get", + value: function get(first, second) { + // @TODO: Woudn't it be better to split this into multiple methods? + // parse the arguments + var id = undefined; + var ids = undefined; + var options = undefined; + if (isId(first)) { + // get(id [, options]) + id = first; + options = second; + } else if (_Array$isArray(first)) { + // get(ids [, options]) + ids = first; + options = second; + } else { + // get([, options]) + options = first; + } + // determine the return type + var returnType = options && options.returnType === "Object" ? "Object" : "Array"; + // @TODO: WTF is this? Or am I missing something? + // var returnType + // if (options && options.returnType) { + // var allowedValues = ['Array', 'Object'] + // returnType = + // allowedValues.indexOf(options.returnType) == -1 + // ? 'Array' + // : options.returnType + // } else { + // returnType = 'Array' + // } + // build options + var filter = options && _filterInstanceProperty(options); + var items = []; + var item = undefined; + var itemIds = undefined; + var itemId = undefined; + // convert items + if (id != null) { + // return a single item + item = this._data.get(id); + if (item && filter && !filter(item)) { + item = undefined; + } + } else if (ids != null) { + // return a subset of items + for (var i = 0, len = ids.length; i < len; i++) { + item = this._data.get(ids[i]); + if (item != null && (!filter || filter(item))) { + items.push(item); + } + } + } else { + var _context20; + // return all items + itemIds = _toConsumableArray(_keysInstanceProperty(_context20 = this._data).call(_context20)); + for (var _i = 0, _len2 = itemIds.length; _i < _len2; _i++) { + itemId = itemIds[_i]; + item = this._data.get(itemId); + if (item != null && (!filter || filter(item))) { + items.push(item); + } + } + } + // order the results + if (options && options.order && id == undefined) { + this._sort(items, options.order); + } + // filter fields of the items + if (options && options.fields) { + var fields = options.fields; + if (id != undefined && item != null) { + item = this._filterFields(item, fields); + } else { + for (var _i2 = 0, _len3 = items.length; _i2 < _len3; _i2++) { + items[_i2] = this._filterFields(items[_i2], fields); + } + } + } + // return the results + if (returnType == "Object") { + var result = {}; + for (var _i3 = 0, _len4 = items.length; _i3 < _len4; _i3++) { + var resultant = items[_i3]; + // @TODO: Shoudn't this be this._fieldId? + // result[resultant.id] = resultant + var _id2 = resultant[this._idProp]; + result[_id2] = resultant; + } + return result; + } else { + if (id != null) { + var _item; + // a single item + return (_item = item) !== null && _item !== void 0 ? _item : null; + } else { + // just return our array + return items; + } + } + } + /** @inheritDoc */ + }, { + key: "getIds", + value: function getIds(options) { + var data = this._data; + var filter = options && _filterInstanceProperty(options); + var order = options && options.order; + var itemIds = _toConsumableArray(_keysInstanceProperty(data).call(data)); + var ids = []; + if (filter) { + // get filtered items + if (order) { + // create ordered list + var items = []; + for (var i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = this._data.get(id); + if (item != null && filter(item)) { + items.push(item); + } + } + this._sort(items, order); + for (var _i4 = 0, _len5 = items.length; _i4 < _len5; _i4++) { + ids.push(items[_i4][this._idProp]); + } + } else { + // create unordered list + for (var _i5 = 0, _len6 = itemIds.length; _i5 < _len6; _i5++) { + var _id3 = itemIds[_i5]; + var _item2 = this._data.get(_id3); + if (_item2 != null && filter(_item2)) { + ids.push(_item2[this._idProp]); + } + } + } + } else { + // get all items + if (order) { + // create an ordered list + var _items = []; + for (var _i6 = 0, _len7 = itemIds.length; _i6 < _len7; _i6++) { + var _id4 = itemIds[_i6]; + _items.push(data.get(_id4)); + } + this._sort(_items, order); + for (var _i7 = 0, _len8 = _items.length; _i7 < _len8; _i7++) { + ids.push(_items[_i7][this._idProp]); + } + } else { + // create unordered list + for (var _i8 = 0, _len9 = itemIds.length; _i8 < _len9; _i8++) { + var _id5 = itemIds[_i8]; + var _item3 = data.get(_id5); + if (_item3 != null) { + ids.push(_item3[this._idProp]); + } + } + } + } + return ids; + } + /** @inheritDoc */ + }, { + key: "getDataSet", + value: function getDataSet() { + return this; + } + /** @inheritDoc */ + }, { + key: "forEach", + value: function forEach(callback, options) { + var filter = options && _filterInstanceProperty(options); + var data = this._data; + var itemIds = _toConsumableArray(_keysInstanceProperty(data).call(data)); + if (options && options.order) { + // execute forEach on ordered list + var items = this.get(options); + for (var i = 0, len = items.length; i < len; i++) { + var item = items[i]; + var id = item[this._idProp]; + callback(item, id); + } + } else { + // unordered + for (var _i9 = 0, _len10 = itemIds.length; _i9 < _len10; _i9++) { + var _id6 = itemIds[_i9]; + var _item4 = this._data.get(_id6); + if (_item4 != null && (!filter || filter(_item4))) { + callback(_item4, _id6); + } + } + } + } + /** @inheritDoc */ + }, { + key: "map", + value: function map(callback, options) { + var filter = options && _filterInstanceProperty(options); + var mappedItems = []; + var data = this._data; + var itemIds = _toConsumableArray(_keysInstanceProperty(data).call(data)); + // convert and filter items + for (var i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = this._data.get(id); + if (item != null && (!filter || filter(item))) { + mappedItems.push(callback(item, id)); + } + } + // order items + if (options && options.order) { + this._sort(mappedItems, options.order); + } + return mappedItems; + } + /** + * Filter the fields of an item. + * + * @param item - The item whose fields should be filtered. + * @param fields - The names of the fields that will be kept. + * @typeParam K - Field name type. + * @returns The item without any additional fields. + */ + }, { + key: "_filterFields", + value: function _filterFields(item, fields) { + var _context21; + if (!item) { + // item is null + return item; + } + return _reduceInstanceProperty(_context21 = _Array$isArray(fields) ? + // Use the supplied array + fields : + // Use the keys of the supplied object + _Object$keys(fields)).call(_context21, function (filteredItem, field) { + filteredItem[field] = item[field]; + return filteredItem; + }, {}); + } + /** + * Sort the provided array with items. + * + * @param items - Items to be sorted in place. + * @param order - A field name or custom sort function. + * @typeParam T - The type of the items in the items array. + */ + }, { + key: "_sort", + value: function _sort(items, order) { + if (typeof order === "string") { + // order by provided field name + var name = order; // field name + _sortInstanceProperty(items).call(items, function (a, b) { + // @TODO: How to treat missing properties? + var av = a[name]; + var bv = b[name]; + return av > bv ? 1 : av < bv ? -1 : 0; + }); + } else if (typeof order === "function") { + // order by sort function + _sortInstanceProperty(items).call(items, order); + } else { + // TODO: extend order by an Object {field:string, direction:string} + // where direction can be 'asc' or 'desc' + throw new TypeError("Order must be a function or a string"); + } + } + /** + * Remove an item or multiple items by “reference” (only the id is used) or by id. + * + * The method ignores removal of non-existing items, and returns an array containing the ids of the items which are actually removed from the DataSet. + * + * After the items are removed, the DataSet will trigger an event `remove` for the removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. + * + * ## Example + * ```javascript + * // create a DataSet + * const data = new vis.DataSet([ + * { id: 1, text: 'item 1' }, + * { id: 2, text: 'item 2' }, + * { id: 3, text: 'item 3' } + * ]) + * + * // remove items + * const ids = data.remove([2, { id: 3 }, 4]) + * + * console.log(ids) // [2, 3] + * ``` + * + * @param id - One or more items or ids of items to be removed. + * @param senderId - Sender id. + * @returns The ids of the removed items. + */ + }, { + key: "remove", + value: function remove(id, senderId) { + var removedIds = []; + var removedItems = []; + // force everything to be an array for simplicity + var ids = _Array$isArray(id) ? id : [id]; + for (var i = 0, len = ids.length; i < len; i++) { + var item = this._remove(ids[i]); + if (item) { + var itemId = item[this._idProp]; + if (itemId != null) { + removedIds.push(itemId); + removedItems.push(item); + } + } + } + if (removedIds.length) { + this._trigger("remove", { + items: removedIds, + oldData: removedItems + }, senderId); + } + return removedIds; + } + /** + * Remove an item by its id or reference. + * + * @param id - Id of an item or the item itself. + * @returns The removed item if removed, null otherwise. + */ + }, { + key: "_remove", + value: function _remove(id) { + // @TODO: It origianlly returned the item although the docs say id. + // The code expects the item, so probably an error in the docs. + var ident; + // confirm the id to use based on the args type + if (isId(id)) { + ident = id; + } else if (id && _typeof$1(id) === "object") { + ident = id[this._idProp]; // look for the identifier field using ._idProp + } + // do the removing if the item is found + if (ident != null && this._data.has(ident)) { + var item = this._data.get(ident) || null; + this._data.delete(ident); + --this.length; + return item; + } + return null; + } + /** + * Clear the entire data set. + * + * After the items are removed, the {@link DataSet} will trigger an event `remove` for all removed items. When a `senderId` is provided, this id will be passed with the triggered event to all subscribers. + * + * @param senderId - Sender id. + * @returns removedIds - The ids of all removed items. + */ + }, { + key: "clear", + value: function clear(senderId) { + var _context22; + var ids = _toConsumableArray(_keysInstanceProperty(_context22 = this._data).call(_context22)); + var items = []; + for (var i = 0, len = ids.length; i < len; i++) { + items.push(this._data.get(ids[i])); + } + this._data.clear(); + this.length = 0; + this._trigger("remove", { + items: ids, + oldData: items + }, senderId); + return ids; + } + /** + * Find the item with maximum value of a specified field. + * + * @param field - Name of the property that should be searched for max value. + * @returns Item containing max value, or null if no items. + */ + }, { + key: "max", + value: function max(field) { + var _context23; + var max = null; + var maxField = null; + var _iterator11 = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context23 = this._data).call(_context23)), + _step11; + try { + for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { + var item = _step11.value; + var itemField = item[field]; + if (typeof itemField === "number" && (maxField == null || itemField > maxField)) { + max = item; + maxField = itemField; + } + } + } catch (err) { + _iterator11.e(err); + } finally { + _iterator11.f(); + } + return max || null; + } + /** + * Find the item with minimum value of a specified field. + * + * @param field - Name of the property that should be searched for min value. + * @returns Item containing min value, or null if no items. + */ + }, { + key: "min", + value: function min(field) { + var _context24; + var min = null; + var minField = null; + var _iterator12 = _createForOfIteratorHelper$6(_valuesInstanceProperty(_context24 = this._data).call(_context24)), + _step12; + try { + for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { + var item = _step12.value; + var itemField = item[field]; + if (typeof itemField === "number" && (minField == null || itemField < minField)) { + min = item; + minField = itemField; + } + } + } catch (err) { + _iterator12.e(err); + } finally { + _iterator12.f(); + } + return min || null; + } + /** + * Find all distinct values of a specified field + * + * @param prop - The property name whose distinct values should be returned. + * @returns Unordered array containing all distinct values. Items without specified property are ignored. + */ + }, { + key: "distinct", + value: function distinct(prop) { + var data = this._data; + var itemIds = _toConsumableArray(_keysInstanceProperty(data).call(data)); + var values = []; + var count = 0; + for (var i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = data.get(id); + var _value3 = item[prop]; + var exists = false; + for (var j = 0; j < count; j++) { + if (values[j] == _value3) { + exists = true; + break; + } + } + if (!exists && _value3 !== undefined) { + values[count] = _value3; + count++; + } + } + return values; + } + /** + * Add a single item. Will fail when an item with the same id already exists. + * + * @param item - A new item to be added. + * @returns Added item's id. An id is generated when it is not present in the item. + */ + }, { + key: "_addItem", + value: function _addItem(item) { + var fullItem = ensureFullItem(item, this._idProp); + var id = fullItem[this._idProp]; + // check whether this id is already taken + if (this._data.has(id)) { + // item already exists + throw new Error("Cannot add item: item with id " + id + " already exists"); + } + this._data.set(id, fullItem); + ++this.length; + return id; + } + /** + * Update a single item: merge with existing item. + * Will fail when the item has no id, or when there does not exist an item with the same id. + * + * @param update - The new item + * @returns The id of the updated item. + */ + }, { + key: "_updateItem", + value: function _updateItem(update) { + var id = update[this._idProp]; + if (id == null) { + throw new Error("Cannot update item: item has no id (item: " + _JSON$stringify(update) + ")"); + } + var item = this._data.get(id); + if (!item) { + // item doesn't exist + throw new Error("Cannot update item: no item with id " + id + " found"); + } + this._data.set(id, _objectSpread$1(_objectSpread$1({}, item), update)); + return id; + } + /** @inheritDoc */ + }, { + key: "stream", + value: function stream(ids) { + if (ids) { + var data = this._data; + return new DataStream(_defineProperty({}, _Symbol$iterator2, /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { + var _iterator13, _step13, id, item; + return _regeneratorRuntime.wrap(function _callee3$(_context25) { + while (1) switch (_context25.prev = _context25.next) { + case 0: + _iterator13 = _createForOfIteratorHelper$6(ids); + _context25.prev = 1; + _iterator13.s(); + case 3: + if ((_step13 = _iterator13.n()).done) { + _context25.next = 11; + break; + } + id = _step13.value; + item = data.get(id); + if (!(item != null)) { + _context25.next = 9; + break; + } + _context25.next = 9; + return [id, item]; + case 9: + _context25.next = 3; + break; + case 11: + _context25.next = 16; + break; + case 13: + _context25.prev = 13; + _context25.t0 = _context25["catch"](1); + _iterator13.e(_context25.t0); + case 16: + _context25.prev = 16; + _iterator13.f(); + return _context25.finish(16); + case 19: + case "end": + return _context25.stop(); + } + }, _callee3, null, [[1, 13, 16, 19]]); + }))); + } else { + var _context26; + return new DataStream(_defineProperty({}, _Symbol$iterator2, _bindInstanceProperty$1(_context26 = _entriesInstanceProperty(this._data)).call(_context26, this._data))); + } + } + }]); + return DataSet; + }(DataSetPart); + /** + * DataView + * + * A DataView offers a filtered and/or formatted view on a DataSet. One can subscribe to changes in a DataView, and easily get filtered or formatted data without having to specify filters and field types all the time. + * + * ## Example + * ```javascript + * // create a DataSet + * var data = new vis.DataSet(); + * data.add([ + * {id: 1, text: 'item 1', date: new Date(2013, 6, 20), group: 1, first: true}, + * {id: 2, text: 'item 2', date: '2013-06-23', group: 2}, + * {id: 3, text: 'item 3', date: '2013-06-25', group: 2}, + * {id: 4, text: 'item 4'} + * ]); + * + * // create a DataView + * // the view will only contain items having a property group with value 1, + * // and will only output fields id, text, and date. + * var view = new vis.DataView(data, { + * filter: function (item) { + * return (item.group == 1); + * }, + * fields: ['id', 'text', 'date'] + * }); + * + * // subscribe to any change in the DataView + * view.on('*', function (event, properties, senderId) { + * console.log('event', event, properties); + * }); + * + * // update an item in the data set + * data.update({id: 2, group: 1}); + * + * // get all ids in the view + * var ids = view.getIds(); + * console.log('ids', ids); // will output [1, 2] + * + * // get all items in the view + * var items = view.get(); + * ``` + * + * @typeParam Item - Item type that may or may not have an id. + * @typeParam IdProp - Name of the property that contains the id. + */ + var DataView = /*#__PURE__*/function (_DataSetPart2) { + _inherits(DataView, _DataSetPart2); + var _super2 = _createSuper$d(DataView); + /** + * Create a DataView. + * + * @param data - The instance containing data (directly or indirectly). + * @param options - Options to configure this data view. + */ + function DataView(data, options) { + var _context27; + var _this7; + _classCallCheck(this, DataView); + _this7 = _super2.call(this); + /** @inheritDoc */ + _defineProperty(_assertThisInitialized(_this7), "length", 0); + _defineProperty(_assertThisInitialized(_this7), "_listener", void 0); + _defineProperty(_assertThisInitialized(_this7), "_data", void 0); + // constructor → setData + _defineProperty(_assertThisInitialized(_this7), "_ids", new _Set()); + // ids of the items currently in memory (just contains a boolean true) + _defineProperty(_assertThisInitialized(_this7), "_options", void 0); + _this7._options = options || {}; + _this7._listener = _bindInstanceProperty$1(_context27 = _this7._onEvent).call(_context27, _assertThisInitialized(_this7)); + _this7.setData(data); + return _this7; + } + // TODO: implement a function .config() to dynamically update things like configured filter + // and trigger changes accordingly + /** + * Set a data source for the view. + * + * @param data - The instance containing data (directly or indirectly). + * @remarks + * Note that when the data view is bound to a data set it won't be garbage + * collected unless the data set is too. Use `dataView.setData(null)` or + * `dataView.dispose()` to enable garbage collection before you lose the last + * reference. + */ + _createClass(DataView, [{ + key: "idProp", + get: /** @inheritDoc */ + function get() { + return this.getDataSet().idProp; + } + }, { + key: "setData", + value: function setData(data) { + if (this._data) { + // unsubscribe from current dataset + if (this._data.off) { + this._data.off("*", this._listener); + } + // trigger a remove of all items in memory + var ids = this._data.getIds({ + filter: _filterInstanceProperty(this._options) + }); + var items = this._data.get(ids); + this._ids.clear(); + this.length = 0; + this._trigger("remove", { + items: ids, + oldData: items + }); + } + if (data != null) { + this._data = data; + // trigger an add of all added items + var _ids = this._data.getIds({ + filter: _filterInstanceProperty(this._options) + }); + for (var i = 0, len = _ids.length; i < len; i++) { + var id = _ids[i]; + this._ids.add(id); + } + this.length = _ids.length; + this._trigger("add", { + items: _ids + }); + } else { + this._data = new DataSet(); + } + // subscribe to new dataset + if (this._data.on) { + this._data.on("*", this._listener); + } + } + /** + * Refresh the DataView. + * Useful when the DataView has a filter function containing a variable parameter. + */ + }, { + key: "refresh", + value: function refresh() { + var ids = this._data.getIds({ + filter: _filterInstanceProperty(this._options) + }); + var oldIds = _toConsumableArray(this._ids); + var newIds = {}; + var addedIds = []; + var removedIds = []; + var removedItems = []; + // check for additions + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + newIds[id] = true; + if (!this._ids.has(id)) { + addedIds.push(id); + this._ids.add(id); + } + } + // check for removals + for (var _i10 = 0, _len11 = oldIds.length; _i10 < _len11; _i10++) { + var _id7 = oldIds[_i10]; + var item = this._data.get(_id7); + if (item == null) { + // @TODO: Investigate. + // Doesn't happen during tests or examples. + // Is it really impossible or could it eventually happen? + // How to handle it if it does? The types guarantee non-nullable items. + console.error("If you see this, report it please."); + } else if (!newIds[_id7]) { + removedIds.push(_id7); + removedItems.push(item); + this._ids.delete(_id7); + } + } + this.length += addedIds.length - removedIds.length; + // trigger events + if (addedIds.length) { + this._trigger("add", { + items: addedIds + }); + } + if (removedIds.length) { + this._trigger("remove", { + items: removedIds, + oldData: removedItems + }); + } + } + /** @inheritDoc */ + }, { + key: "get", + value: function get(first, second) { + if (this._data == null) { + return null; + } + // parse the arguments + var ids = null; + var options; + if (isId(first) || _Array$isArray(first)) { + ids = first; + options = second; + } else { + options = first; + } + // extend the options with the default options and provided options + var viewOptions = _Object$assign({}, this._options, options); + // create a combined filter method when needed + var thisFilter = _filterInstanceProperty(this._options); + var optionsFilter = options && _filterInstanceProperty(options); + if (thisFilter && optionsFilter) { + viewOptions.filter = function (item) { + return thisFilter(item) && optionsFilter(item); + }; + } + if (ids == null) { + return this._data.get(viewOptions); + } else { + return this._data.get(ids, viewOptions); + } + } + /** @inheritDoc */ + }, { + key: "getIds", + value: function getIds(options) { + if (this._data.length) { + var defaultFilter = _filterInstanceProperty(this._options); + var optionsFilter = options != null ? _filterInstanceProperty(options) : null; + var filter; + if (optionsFilter) { + if (defaultFilter) { + filter = function filter(item) { + return defaultFilter(item) && optionsFilter(item); + }; + } else { + filter = optionsFilter; + } + } else { + filter = defaultFilter; + } + return this._data.getIds({ + filter: filter, + order: options && options.order + }); + } else { + return []; + } + } + /** @inheritDoc */ + }, { + key: "forEach", + value: function forEach(callback, options) { + if (this._data) { + var _context28; + var defaultFilter = _filterInstanceProperty(this._options); + var optionsFilter = options && _filterInstanceProperty(options); + var filter; + if (optionsFilter) { + if (defaultFilter) { + filter = function filter(item) { + return defaultFilter(item) && optionsFilter(item); + }; + } else { + filter = optionsFilter; + } + } else { + filter = defaultFilter; + } + _forEachInstanceProperty(_context28 = this._data).call(_context28, callback, { + filter: filter, + order: options && options.order + }); + } + } + /** @inheritDoc */ + }, { + key: "map", + value: function map(callback, options) { + if (this._data) { + var _context29; + var defaultFilter = _filterInstanceProperty(this._options); + var optionsFilter = options && _filterInstanceProperty(options); + var filter; + if (optionsFilter) { + if (defaultFilter) { + filter = function filter(item) { + return defaultFilter(item) && optionsFilter(item); + }; + } else { + filter = optionsFilter; + } + } else { + filter = defaultFilter; + } + return _mapInstanceProperty(_context29 = this._data).call(_context29, callback, { + filter: filter, + order: options && options.order + }); + } else { + return []; + } + } + /** @inheritDoc */ + }, { + key: "getDataSet", + value: function getDataSet() { + return this._data.getDataSet(); + } + /** @inheritDoc */ + }, { + key: "stream", + value: function stream(ids) { + var _context30; + return this._data.stream(ids || _defineProperty({}, _Symbol$iterator2, _bindInstanceProperty$1(_context30 = _keysInstanceProperty(this._ids)).call(_context30, this._ids))); + } + /** + * Render the instance unusable prior to garbage collection. + * + * @remarks + * The intention of this method is to help discover scenarios where the data + * view is being used when the programmer thinks it has been garbage collected + * already. It's stricter version of `dataView.setData(null)`. + */ + }, { + key: "dispose", + value: function dispose() { + var _this$_data; + if ((_this$_data = this._data) !== null && _this$_data !== void 0 && _this$_data.off) { + this._data.off("*", this._listener); + } + var message = "This data view has already been disposed of."; + var replacement = { + get: function get() { + throw new Error(message); + }, + set: function set() { + throw new Error(message); + }, + configurable: false + }; + var _iterator14 = _createForOfIteratorHelper$6(_Reflect$ownKeys(DataView.prototype)), + _step14; + try { + for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) { + var key = _step14.value; + _Object$defineProperty(this, key, replacement); + } + } catch (err) { + _iterator14.e(err); + } finally { + _iterator14.f(); + } + } + /** + * Event listener. Will propagate all events from the connected data set to the subscribers of the DataView, but will filter the items and only trigger when there are changes in the filtered data set. + * + * @param event - The name of the event. + * @param params - Parameters of the event. + * @param senderId - Id supplied by the sender. + */ + }, { + key: "_onEvent", + value: function _onEvent(event, params, senderId) { + if (!params || !params.items || !this._data) { + return; + } + var ids = params.items; + var addedIds = []; + var updatedIds = []; + var removedIds = []; + var oldItems = []; + var updatedItems = []; + var removedItems = []; + switch (event) { + case "add": + // filter the ids of the added items + for (var i = 0, len = ids.length; i < len; i++) { + var id = ids[i]; + var item = this.get(id); + if (item) { + this._ids.add(id); + addedIds.push(id); + } + } + break; + case "update": + // determine the event from the views viewpoint: an updated + // item can be added, updated, or removed from this view. + for (var _i11 = 0, _len12 = ids.length; _i11 < _len12; _i11++) { + var _id8 = ids[_i11]; + var _item5 = this.get(_id8); + if (_item5) { + if (this._ids.has(_id8)) { + updatedIds.push(_id8); + updatedItems.push(params.data[_i11]); + oldItems.push(params.oldData[_i11]); + } else { + this._ids.add(_id8); + addedIds.push(_id8); + } + } else { + if (this._ids.has(_id8)) { + this._ids.delete(_id8); + removedIds.push(_id8); + removedItems.push(params.oldData[_i11]); + } + } + } + break; + case "remove": + // filter the ids of the removed items + for (var _i12 = 0, _len13 = ids.length; _i12 < _len13; _i12++) { + var _id9 = ids[_i12]; + if (this._ids.has(_id9)) { + this._ids.delete(_id9); + removedIds.push(_id9); + removedItems.push(params.oldData[_i12]); + } + } + break; + } + this.length += addedIds.length - removedIds.length; + if (addedIds.length) { + this._trigger("add", { + items: addedIds + }, senderId); + } + if (updatedIds.length) { + this._trigger("update", { + items: updatedIds, + oldData: oldItems, + data: updatedItems + }, senderId); + } + if (removedIds.length) { + this._trigger("remove", { + items: removedIds, + oldData: removedItems + }, senderId); + } + } + }]); + return DataView; + }(DataSetPart); + /** + * Check that given value is compatible with Vis Data Set interface. + * + * @param idProp - The expected property to contain item id. + * @param v - The value to be tested. + * @returns True if all expected values and methods match, false otherwise. + */ + function isDataSetLike(idProp, v) { + return _typeof$1(v) === "object" && v !== null && idProp === v.idProp && typeof v.add === "function" && typeof v.clear === "function" && typeof v.distinct === "function" && typeof _forEachInstanceProperty(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof _mapInstanceProperty(v) === "function" && typeof v.max === "function" && typeof v.min === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.remove === "function" && typeof v.setOptions === "function" && typeof v.stream === "function" && typeof v.update === "function" && typeof v.updateOnly === "function"; + } + + /** + * Check that given value is compatible with Vis Data View interface. + * + * @param idProp - The expected property to contain item id. + * @param v - The value to be tested. + * @returns True if all expected values and methods match, false otherwise. + */ + function isDataViewLike$1(idProp, v) { + return _typeof$1(v) === "object" && v !== null && idProp === v.idProp && typeof _forEachInstanceProperty(v) === "function" && typeof v.get === "function" && typeof v.getDataSet === "function" && typeof v.getIds === "function" && typeof v.length === "number" && typeof _mapInstanceProperty(v) === "function" && typeof v.off === "function" && typeof v.on === "function" && typeof v.stream === "function" && isDataSetLike(idProp, v.getDataSet()); + } + + // first check if moment.js is already loaded in the browser window, if so, + // use this instance. Else, load via commonjs. + // + // Note: This doesn't work in ESM. + var moment$3 = typeof window !== 'undefined' && window['moment'] || requireMoment(); + var moment$4 = /*@__PURE__*/getDefaultExportFromCjs(moment$3); + + var momentExports = requireMoment(); + var moment$2 = /*@__PURE__*/getDefaultExportFromCjs(momentExports); + + var lib$1 = {exports: {}}; + + var _default$1 = {}; + + var lib = {exports: {}}; + + var _default = {}; + + /** + * cssfilter + * + * @author 老雷 + */ + + function getDefaultWhiteList$1 () { + // 白名单值说明: + // true: 允许该属性 + // Function: function (val) { } 返回true表示允许该属性,其他值均表示不允许 + // RegExp: regexp.test(val) 返回true表示允许该属性,其他值均表示不允许 + // 除上面列出的值外均表示不允许 + var whiteList = {}; + + whiteList['align-content'] = false; // default: auto + whiteList['align-items'] = false; // default: auto + whiteList['align-self'] = false; // default: auto + whiteList['alignment-adjust'] = false; // default: auto + whiteList['alignment-baseline'] = false; // default: baseline + whiteList['all'] = false; // default: depending on individual properties + whiteList['anchor-point'] = false; // default: none + whiteList['animation'] = false; // default: depending on individual properties + whiteList['animation-delay'] = false; // default: 0 + whiteList['animation-direction'] = false; // default: normal + whiteList['animation-duration'] = false; // default: 0 + whiteList['animation-fill-mode'] = false; // default: none + whiteList['animation-iteration-count'] = false; // default: 1 + whiteList['animation-name'] = false; // default: none + whiteList['animation-play-state'] = false; // default: running + whiteList['animation-timing-function'] = false; // default: ease + whiteList['azimuth'] = false; // default: center + whiteList['backface-visibility'] = false; // default: visible + whiteList['background'] = true; // default: depending on individual properties + whiteList['background-attachment'] = true; // default: scroll + whiteList['background-clip'] = true; // default: border-box + whiteList['background-color'] = true; // default: transparent + whiteList['background-image'] = true; // default: none + whiteList['background-origin'] = true; // default: padding-box + whiteList['background-position'] = true; // default: 0% 0% + whiteList['background-repeat'] = true; // default: repeat + whiteList['background-size'] = true; // default: auto + whiteList['baseline-shift'] = false; // default: baseline + whiteList['binding'] = false; // default: none + whiteList['bleed'] = false; // default: 6pt + whiteList['bookmark-label'] = false; // default: content() + whiteList['bookmark-level'] = false; // default: none + whiteList['bookmark-state'] = false; // default: open + whiteList['border'] = true; // default: depending on individual properties + whiteList['border-bottom'] = true; // default: depending on individual properties + whiteList['border-bottom-color'] = true; // default: current color + whiteList['border-bottom-left-radius'] = true; // default: 0 + whiteList['border-bottom-right-radius'] = true; // default: 0 + whiteList['border-bottom-style'] = true; // default: none + whiteList['border-bottom-width'] = true; // default: medium + whiteList['border-collapse'] = true; // default: separate + whiteList['border-color'] = true; // default: depending on individual properties + whiteList['border-image'] = true; // default: none + whiteList['border-image-outset'] = true; // default: 0 + whiteList['border-image-repeat'] = true; // default: stretch + whiteList['border-image-slice'] = true; // default: 100% + whiteList['border-image-source'] = true; // default: none + whiteList['border-image-width'] = true; // default: 1 + whiteList['border-left'] = true; // default: depending on individual properties + whiteList['border-left-color'] = true; // default: current color + whiteList['border-left-style'] = true; // default: none + whiteList['border-left-width'] = true; // default: medium + whiteList['border-radius'] = true; // default: 0 + whiteList['border-right'] = true; // default: depending on individual properties + whiteList['border-right-color'] = true; // default: current color + whiteList['border-right-style'] = true; // default: none + whiteList['border-right-width'] = true; // default: medium + whiteList['border-spacing'] = true; // default: 0 + whiteList['border-style'] = true; // default: depending on individual properties + whiteList['border-top'] = true; // default: depending on individual properties + whiteList['border-top-color'] = true; // default: current color + whiteList['border-top-left-radius'] = true; // default: 0 + whiteList['border-top-right-radius'] = true; // default: 0 + whiteList['border-top-style'] = true; // default: none + whiteList['border-top-width'] = true; // default: medium + whiteList['border-width'] = true; // default: depending on individual properties + whiteList['bottom'] = false; // default: auto + whiteList['box-decoration-break'] = true; // default: slice + whiteList['box-shadow'] = true; // default: none + whiteList['box-sizing'] = true; // default: content-box + whiteList['box-snap'] = true; // default: none + whiteList['box-suppress'] = true; // default: show + whiteList['break-after'] = true; // default: auto + whiteList['break-before'] = true; // default: auto + whiteList['break-inside'] = true; // default: auto + whiteList['caption-side'] = false; // default: top + whiteList['chains'] = false; // default: none + whiteList['clear'] = true; // default: none + whiteList['clip'] = false; // default: auto + whiteList['clip-path'] = false; // default: none + whiteList['clip-rule'] = false; // default: nonzero + whiteList['color'] = true; // default: implementation dependent + whiteList['color-interpolation-filters'] = true; // default: auto + whiteList['column-count'] = false; // default: auto + whiteList['column-fill'] = false; // default: balance + whiteList['column-gap'] = false; // default: normal + whiteList['column-rule'] = false; // default: depending on individual properties + whiteList['column-rule-color'] = false; // default: current color + whiteList['column-rule-style'] = false; // default: medium + whiteList['column-rule-width'] = false; // default: medium + whiteList['column-span'] = false; // default: none + whiteList['column-width'] = false; // default: auto + whiteList['columns'] = false; // default: depending on individual properties + whiteList['contain'] = false; // default: none + whiteList['content'] = false; // default: normal + whiteList['counter-increment'] = false; // default: none + whiteList['counter-reset'] = false; // default: none + whiteList['counter-set'] = false; // default: none + whiteList['crop'] = false; // default: auto + whiteList['cue'] = false; // default: depending on individual properties + whiteList['cue-after'] = false; // default: none + whiteList['cue-before'] = false; // default: none + whiteList['cursor'] = false; // default: auto + whiteList['direction'] = false; // default: ltr + whiteList['display'] = true; // default: depending on individual properties + whiteList['display-inside'] = true; // default: auto + whiteList['display-list'] = true; // default: none + whiteList['display-outside'] = true; // default: inline-level + whiteList['dominant-baseline'] = false; // default: auto + whiteList['elevation'] = false; // default: level + whiteList['empty-cells'] = false; // default: show + whiteList['filter'] = false; // default: none + whiteList['flex'] = false; // default: depending on individual properties + whiteList['flex-basis'] = false; // default: auto + whiteList['flex-direction'] = false; // default: row + whiteList['flex-flow'] = false; // default: depending on individual properties + whiteList['flex-grow'] = false; // default: 0 + whiteList['flex-shrink'] = false; // default: 1 + whiteList['flex-wrap'] = false; // default: nowrap + whiteList['float'] = false; // default: none + whiteList['float-offset'] = false; // default: 0 0 + whiteList['flood-color'] = false; // default: black + whiteList['flood-opacity'] = false; // default: 1 + whiteList['flow-from'] = false; // default: none + whiteList['flow-into'] = false; // default: none + whiteList['font'] = true; // default: depending on individual properties + whiteList['font-family'] = true; // default: implementation dependent + whiteList['font-feature-settings'] = true; // default: normal + whiteList['font-kerning'] = true; // default: auto + whiteList['font-language-override'] = true; // default: normal + whiteList['font-size'] = true; // default: medium + whiteList['font-size-adjust'] = true; // default: none + whiteList['font-stretch'] = true; // default: normal + whiteList['font-style'] = true; // default: normal + whiteList['font-synthesis'] = true; // default: weight style + whiteList['font-variant'] = true; // default: normal + whiteList['font-variant-alternates'] = true; // default: normal + whiteList['font-variant-caps'] = true; // default: normal + whiteList['font-variant-east-asian'] = true; // default: normal + whiteList['font-variant-ligatures'] = true; // default: normal + whiteList['font-variant-numeric'] = true; // default: normal + whiteList['font-variant-position'] = true; // default: normal + whiteList['font-weight'] = true; // default: normal + whiteList['grid'] = false; // default: depending on individual properties + whiteList['grid-area'] = false; // default: depending on individual properties + whiteList['grid-auto-columns'] = false; // default: auto + whiteList['grid-auto-flow'] = false; // default: none + whiteList['grid-auto-rows'] = false; // default: auto + whiteList['grid-column'] = false; // default: depending on individual properties + whiteList['grid-column-end'] = false; // default: auto + whiteList['grid-column-start'] = false; // default: auto + whiteList['grid-row'] = false; // default: depending on individual properties + whiteList['grid-row-end'] = false; // default: auto + whiteList['grid-row-start'] = false; // default: auto + whiteList['grid-template'] = false; // default: depending on individual properties + whiteList['grid-template-areas'] = false; // default: none + whiteList['grid-template-columns'] = false; // default: none + whiteList['grid-template-rows'] = false; // default: none + whiteList['hanging-punctuation'] = false; // default: none + whiteList['height'] = true; // default: auto + whiteList['hyphens'] = false; // default: manual + whiteList['icon'] = false; // default: auto + whiteList['image-orientation'] = false; // default: auto + whiteList['image-resolution'] = false; // default: normal + whiteList['ime-mode'] = false; // default: auto + whiteList['initial-letters'] = false; // default: normal + whiteList['inline-box-align'] = false; // default: last + whiteList['justify-content'] = false; // default: auto + whiteList['justify-items'] = false; // default: auto + whiteList['justify-self'] = false; // default: auto + whiteList['left'] = false; // default: auto + whiteList['letter-spacing'] = true; // default: normal + whiteList['lighting-color'] = true; // default: white + whiteList['line-box-contain'] = false; // default: block inline replaced + whiteList['line-break'] = false; // default: auto + whiteList['line-grid'] = false; // default: match-parent + whiteList['line-height'] = false; // default: normal + whiteList['line-snap'] = false; // default: none + whiteList['line-stacking'] = false; // default: depending on individual properties + whiteList['line-stacking-ruby'] = false; // default: exclude-ruby + whiteList['line-stacking-shift'] = false; // default: consider-shifts + whiteList['line-stacking-strategy'] = false; // default: inline-line-height + whiteList['list-style'] = true; // default: depending on individual properties + whiteList['list-style-image'] = true; // default: none + whiteList['list-style-position'] = true; // default: outside + whiteList['list-style-type'] = true; // default: disc + whiteList['margin'] = true; // default: depending on individual properties + whiteList['margin-bottom'] = true; // default: 0 + whiteList['margin-left'] = true; // default: 0 + whiteList['margin-right'] = true; // default: 0 + whiteList['margin-top'] = true; // default: 0 + whiteList['marker-offset'] = false; // default: auto + whiteList['marker-side'] = false; // default: list-item + whiteList['marks'] = false; // default: none + whiteList['mask'] = false; // default: border-box + whiteList['mask-box'] = false; // default: see individual properties + whiteList['mask-box-outset'] = false; // default: 0 + whiteList['mask-box-repeat'] = false; // default: stretch + whiteList['mask-box-slice'] = false; // default: 0 fill + whiteList['mask-box-source'] = false; // default: none + whiteList['mask-box-width'] = false; // default: auto + whiteList['mask-clip'] = false; // default: border-box + whiteList['mask-image'] = false; // default: none + whiteList['mask-origin'] = false; // default: border-box + whiteList['mask-position'] = false; // default: center + whiteList['mask-repeat'] = false; // default: no-repeat + whiteList['mask-size'] = false; // default: border-box + whiteList['mask-source-type'] = false; // default: auto + whiteList['mask-type'] = false; // default: luminance + whiteList['max-height'] = true; // default: none + whiteList['max-lines'] = false; // default: none + whiteList['max-width'] = true; // default: none + whiteList['min-height'] = true; // default: 0 + whiteList['min-width'] = true; // default: 0 + whiteList['move-to'] = false; // default: normal + whiteList['nav-down'] = false; // default: auto + whiteList['nav-index'] = false; // default: auto + whiteList['nav-left'] = false; // default: auto + whiteList['nav-right'] = false; // default: auto + whiteList['nav-up'] = false; // default: auto + whiteList['object-fit'] = false; // default: fill + whiteList['object-position'] = false; // default: 50% 50% + whiteList['opacity'] = false; // default: 1 + whiteList['order'] = false; // default: 0 + whiteList['orphans'] = false; // default: 2 + whiteList['outline'] = false; // default: depending on individual properties + whiteList['outline-color'] = false; // default: invert + whiteList['outline-offset'] = false; // default: 0 + whiteList['outline-style'] = false; // default: none + whiteList['outline-width'] = false; // default: medium + whiteList['overflow'] = false; // default: depending on individual properties + whiteList['overflow-wrap'] = false; // default: normal + whiteList['overflow-x'] = false; // default: visible + whiteList['overflow-y'] = false; // default: visible + whiteList['padding'] = true; // default: depending on individual properties + whiteList['padding-bottom'] = true; // default: 0 + whiteList['padding-left'] = true; // default: 0 + whiteList['padding-right'] = true; // default: 0 + whiteList['padding-top'] = true; // default: 0 + whiteList['page'] = false; // default: auto + whiteList['page-break-after'] = false; // default: auto + whiteList['page-break-before'] = false; // default: auto + whiteList['page-break-inside'] = false; // default: auto + whiteList['page-policy'] = false; // default: start + whiteList['pause'] = false; // default: implementation dependent + whiteList['pause-after'] = false; // default: implementation dependent + whiteList['pause-before'] = false; // default: implementation dependent + whiteList['perspective'] = false; // default: none + whiteList['perspective-origin'] = false; // default: 50% 50% + whiteList['pitch'] = false; // default: medium + whiteList['pitch-range'] = false; // default: 50 + whiteList['play-during'] = false; // default: auto + whiteList['position'] = false; // default: static + whiteList['presentation-level'] = false; // default: 0 + whiteList['quotes'] = false; // default: text + whiteList['region-fragment'] = false; // default: auto + whiteList['resize'] = false; // default: none + whiteList['rest'] = false; // default: depending on individual properties + whiteList['rest-after'] = false; // default: none + whiteList['rest-before'] = false; // default: none + whiteList['richness'] = false; // default: 50 + whiteList['right'] = false; // default: auto + whiteList['rotation'] = false; // default: 0 + whiteList['rotation-point'] = false; // default: 50% 50% + whiteList['ruby-align'] = false; // default: auto + whiteList['ruby-merge'] = false; // default: separate + whiteList['ruby-position'] = false; // default: before + whiteList['shape-image-threshold'] = false; // default: 0.0 + whiteList['shape-outside'] = false; // default: none + whiteList['shape-margin'] = false; // default: 0 + whiteList['size'] = false; // default: auto + whiteList['speak'] = false; // default: auto + whiteList['speak-as'] = false; // default: normal + whiteList['speak-header'] = false; // default: once + whiteList['speak-numeral'] = false; // default: continuous + whiteList['speak-punctuation'] = false; // default: none + whiteList['speech-rate'] = false; // default: medium + whiteList['stress'] = false; // default: 50 + whiteList['string-set'] = false; // default: none + whiteList['tab-size'] = false; // default: 8 + whiteList['table-layout'] = false; // default: auto + whiteList['text-align'] = true; // default: start + whiteList['text-align-last'] = true; // default: auto + whiteList['text-combine-upright'] = true; // default: none + whiteList['text-decoration'] = true; // default: none + whiteList['text-decoration-color'] = true; // default: currentColor + whiteList['text-decoration-line'] = true; // default: none + whiteList['text-decoration-skip'] = true; // default: objects + whiteList['text-decoration-style'] = true; // default: solid + whiteList['text-emphasis'] = true; // default: depending on individual properties + whiteList['text-emphasis-color'] = true; // default: currentColor + whiteList['text-emphasis-position'] = true; // default: over right + whiteList['text-emphasis-style'] = true; // default: none + whiteList['text-height'] = true; // default: auto + whiteList['text-indent'] = true; // default: 0 + whiteList['text-justify'] = true; // default: auto + whiteList['text-orientation'] = true; // default: mixed + whiteList['text-overflow'] = true; // default: clip + whiteList['text-shadow'] = true; // default: none + whiteList['text-space-collapse'] = true; // default: collapse + whiteList['text-transform'] = true; // default: none + whiteList['text-underline-position'] = true; // default: auto + whiteList['text-wrap'] = true; // default: normal + whiteList['top'] = false; // default: auto + whiteList['transform'] = false; // default: none + whiteList['transform-origin'] = false; // default: 50% 50% 0 + whiteList['transform-style'] = false; // default: flat + whiteList['transition'] = false; // default: depending on individual properties + whiteList['transition-delay'] = false; // default: 0s + whiteList['transition-duration'] = false; // default: 0s + whiteList['transition-property'] = false; // default: all + whiteList['transition-timing-function'] = false; // default: ease + whiteList['unicode-bidi'] = false; // default: normal + whiteList['vertical-align'] = false; // default: baseline + whiteList['visibility'] = false; // default: visible + whiteList['voice-balance'] = false; // default: center + whiteList['voice-duration'] = false; // default: auto + whiteList['voice-family'] = false; // default: implementation dependent + whiteList['voice-pitch'] = false; // default: medium + whiteList['voice-range'] = false; // default: medium + whiteList['voice-rate'] = false; // default: normal + whiteList['voice-stress'] = false; // default: normal + whiteList['voice-volume'] = false; // default: medium + whiteList['volume'] = false; // default: medium + whiteList['white-space'] = false; // default: normal + whiteList['widows'] = false; // default: 2 + whiteList['width'] = true; // default: auto + whiteList['will-change'] = false; // default: auto + whiteList['word-break'] = true; // default: normal + whiteList['word-spacing'] = true; // default: normal + whiteList['word-wrap'] = true; // default: normal + whiteList['wrap-flow'] = false; // default: auto + whiteList['wrap-through'] = false; // default: wrap + whiteList['writing-mode'] = false; // default: horizontal-tb + whiteList['z-index'] = false; // default: auto + + return whiteList; + } + + + /** + * 匹配到白名单上的一个属性时 + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {String} + */ + function onAttr (name, value, options) { + // do nothing + } + + /** + * 匹配到不在白名单上的一个属性时 + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {String} + */ + function onIgnoreAttr (name, value, options) { + // do nothing + } + + var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img; + + /** + * 过滤属性值 + * + * @param {String} name + * @param {String} value + * @return {String} + */ + function safeAttrValue$1(name, value) { + if (REGEXP_URL_JAVASCRIPT.test(value)) return ''; + return value; + } + + + _default.whiteList = getDefaultWhiteList$1(); + _default.getDefaultWhiteList = getDefaultWhiteList$1; + _default.onAttr = onAttr; + _default.onIgnoreAttr = onIgnoreAttr; + _default.safeAttrValue = safeAttrValue$1; + + var util$1 = { + indexOf: function (arr, item) { + var i, j; + if (Array.prototype.indexOf) { + return arr.indexOf(item); + } + for (i = 0, j = arr.length; i < j; i++) { + if (arr[i] === item) { + return i; + } + } + return -1; + }, + forEach: function (arr, fn, scope) { + var i, j; + if (Array.prototype.forEach) { + return arr.forEach(fn, scope); + } + for (i = 0, j = arr.length; i < j; i++) { + fn.call(scope, arr[i], i, arr); + } + }, + trim: function (str) { + if (String.prototype.trim) { + return str.trim(); + } + return str.replace(/(^\s*)|(\s*$)/g, ''); + }, + trimRight: function (str) { + if (String.prototype.trimRight) { + return str.trimRight(); + } + return str.replace(/(\s*$)/g, ''); + } + }; + + /** + * cssfilter + * + * @author 老雷 + */ + + var _$3 = util$1; + + + /** + * 解析style + * + * @param {String} css + * @param {Function} onAttr 处理属性的函数 + * 参数格式: function (sourcePosition, position, name, value, source) + * @return {String} + */ + function parseStyle$1 (css, onAttr) { + css = _$3.trimRight(css); + if (css[css.length - 1] !== ';') css += ';'; + var cssLength = css.length; + var isParenthesisOpen = false; + var lastPos = 0; + var i = 0; + var retCSS = ''; + + function addNewAttr () { + // 如果没有正常的闭合圆括号,则直接忽略当前属性 + if (!isParenthesisOpen) { + var source = _$3.trim(css.slice(lastPos, i)); + var j = source.indexOf(':'); + if (j !== -1) { + var name = _$3.trim(source.slice(0, j)); + var value = _$3.trim(source.slice(j + 1)); + // 必须有属性名称 + if (name) { + var ret = onAttr(lastPos, retCSS.length, name, value, source); + if (ret) retCSS += ret + '; '; + } + } + } + lastPos = i + 1; + } + + for (; i < cssLength; i++) { + var c = css[i]; + if (c === '/' && css[i + 1] === '*') { + // 备注开始 + var j = css.indexOf('*/', i + 2); + // 如果没有正常的备注结束,则后面的部分全部跳过 + if (j === -1) break; + // 直接将当前位置调到备注结尾,并且初始化状态 + i = j + 1; + lastPos = i + 1; + isParenthesisOpen = false; + } else if (c === '(') { + isParenthesisOpen = true; + } else if (c === ')') { + isParenthesisOpen = false; + } else if (c === ';') { + if (isParenthesisOpen) ; else { + addNewAttr(); + } + } else if (c === '\n') { + addNewAttr(); + } + } + + return _$3.trim(retCSS); + } + + var parser$2 = parseStyle$1; + + /** + * cssfilter + * + * @author 老雷 + */ + + var DEFAULT$1 = _default; + var parseStyle = parser$2; + + + /** + * 返回值是否为空 + * + * @param {Object} obj + * @return {Boolean} + */ + function isNull$1 (obj) { + return (obj === undefined || obj === null); + } + + /** + * 浅拷贝对象 + * + * @param {Object} obj + * @return {Object} + */ + function shallowCopyObject$1 (obj) { + var ret = {}; + for (var i in obj) { + ret[i] = obj[i]; + } + return ret; + } + + /** + * 创建CSS过滤器 + * + * @param {Object} options + * - {Object} whiteList + * - {Function} onAttr + * - {Function} onIgnoreAttr + * - {Function} safeAttrValue + */ + function FilterCSS$2 (options) { + options = shallowCopyObject$1(options || {}); + options.whiteList = options.whiteList || DEFAULT$1.whiteList; + options.onAttr = options.onAttr || DEFAULT$1.onAttr; + options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT$1.onIgnoreAttr; + options.safeAttrValue = options.safeAttrValue || DEFAULT$1.safeAttrValue; + this.options = options; + } + + FilterCSS$2.prototype.process = function (css) { + // 兼容各种奇葩输入 + css = css || ''; + css = css.toString(); + if (!css) return ''; + + var me = this; + var options = me.options; + var whiteList = options.whiteList; + var onAttr = options.onAttr; + var onIgnoreAttr = options.onIgnoreAttr; + var safeAttrValue = options.safeAttrValue; + + var retCSS = parseStyle(css, function (sourcePosition, position, name, value, source) { + + var check = whiteList[name]; + var isWhite = false; + if (check === true) isWhite = check; + else if (typeof check === 'function') isWhite = check(value); + else if (check instanceof RegExp) isWhite = check.test(value); + if (isWhite !== true) isWhite = false; + + // 如果过滤后 value 为空则直接忽略 + value = safeAttrValue(name, value); + if (!value) return; + + var opts = { + position: position, + sourcePosition: sourcePosition, + source: source, + isWhite: isWhite + }; + + if (isWhite) { + + var ret = onAttr(name, value, opts); + if (isNull$1(ret)) { + return name + ':' + value; + } else { + return ret; + } + + } else { + + var ret = onIgnoreAttr(name, value, opts); + if (!isNull$1(ret)) { + return ret; + } + + } + }); + + return retCSS; + }; + + + var css = FilterCSS$2; + + /** + * cssfilter + * + * @author 老雷 + */ + + (function (module, exports) { + var DEFAULT = _default; + var FilterCSS = css; + + + /** + * XSS过滤 + * + * @param {String} css 要过滤的CSS代码 + * @param {Object} options 选项:whiteList, onAttr, onIgnoreAttr + * @return {String} + */ + function filterCSS (html, options) { + var xss = new FilterCSS(options); + return xss.process(html); + } + + + // 输出 + exports = module.exports = filterCSS; + exports.FilterCSS = FilterCSS; + for (var i in DEFAULT) exports[i] = DEFAULT[i]; + + // 在浏览器端使用 + if (typeof window !== 'undefined') { + window.filterCSS = module.exports; + } + } (lib, lib.exports)); + + var libExports$1 = lib.exports; + + var util = { + indexOf: function (arr, item) { + var i, j; + if (Array.prototype.indexOf) { + return arr.indexOf(item); + } + for (i = 0, j = arr.length; i < j; i++) { + if (arr[i] === item) { + return i; + } + } + return -1; + }, + forEach: function (arr, fn, scope) { + var i, j; + if (Array.prototype.forEach) { + return arr.forEach(fn, scope); + } + for (i = 0, j = arr.length; i < j; i++) { + fn.call(scope, arr[i], i, arr); + } + }, + trim: function (str) { + if (String.prototype.trim) { + return str.trim(); + } + return str.replace(/(^\s*)|(\s*$)/g, ""); + }, + spaceIndex: function (str) { + var reg = /\s|\n|\t/; + var match = reg.exec(str); + return match ? match.index : -1; + }, + }; + + /** + * default settings + * + * @author Zongmin Lei + */ + + var FilterCSS$1 = libExports$1.FilterCSS; + var getDefaultCSSWhiteList = libExports$1.getDefaultWhiteList; + var _$2 = util; + + function getDefaultWhiteList() { + return { + a: ["target", "href", "title"], + abbr: ["title"], + address: [], + area: ["shape", "coords", "href", "alt"], + article: [], + aside: [], + audio: [ + "autoplay", + "controls", + "crossorigin", + "loop", + "muted", + "preload", + "src", + ], + b: [], + bdi: ["dir"], + bdo: ["dir"], + big: [], + blockquote: ["cite"], + br: [], + caption: [], + center: [], + cite: [], + code: [], + col: ["align", "valign", "span", "width"], + colgroup: ["align", "valign", "span", "width"], + dd: [], + del: ["datetime"], + details: ["open"], + div: [], + dl: [], + dt: [], + em: [], + figcaption: [], + figure: [], + font: ["color", "size", "face"], + footer: [], + h1: [], + h2: [], + h3: [], + h4: [], + h5: [], + h6: [], + header: [], + hr: [], + i: [], + img: ["src", "alt", "title", "width", "height"], + ins: ["datetime"], + li: [], + mark: [], + nav: [], + ol: [], + p: [], + pre: [], + s: [], + section: [], + small: [], + span: [], + sub: [], + summary: [], + sup: [], + strong: [], + strike: [], + table: ["width", "border", "align", "valign"], + tbody: ["align", "valign"], + td: ["width", "rowspan", "colspan", "align", "valign"], + tfoot: ["align", "valign"], + th: ["width", "rowspan", "colspan", "align", "valign"], + thead: ["align", "valign"], + tr: ["rowspan", "align", "valign"], + tt: [], + u: [], + ul: [], + video: [ + "autoplay", + "controls", + "crossorigin", + "loop", + "muted", + "playsinline", + "poster", + "preload", + "src", + "height", + "width", + ], + }; + } + + var defaultCSSFilter = new FilterCSS$1(); + + /** + * default onTag function + * + * @param {String} tag + * @param {String} html + * @param {Object} options + * @return {String} + */ + function onTag(tag, html, options) { + // do nothing + } + + /** + * default onIgnoreTag function + * + * @param {String} tag + * @param {String} html + * @param {Object} options + * @return {String} + */ + function onIgnoreTag(tag, html, options) { + // do nothing + } + + /** + * default onTagAttr function + * + * @param {String} tag + * @param {String} name + * @param {String} value + * @return {String} + */ + function onTagAttr(tag, name, value) { + // do nothing + } + + /** + * default onIgnoreTagAttr function + * + * @param {String} tag + * @param {String} name + * @param {String} value + * @return {String} + */ + function onIgnoreTagAttr(tag, name, value) { + // do nothing + } + + /** + * default escapeHtml function + * + * @param {String} html + */ + function escapeHtml(html) { + return html.replace(REGEXP_LT, "<").replace(REGEXP_GT, ">"); + } + + /** + * default safeAttrValue function + * + * @param {String} tag + * @param {String} name + * @param {String} value + * @param {Object} cssFilter + * @return {String} + */ + function safeAttrValue(tag, name, value, cssFilter) { + // unescape attribute value firstly + value = friendlyAttrValue(value); + + if (name === "href" || name === "src") { + // filter `href` and `src` attribute + // only allow the value that starts with `http://` | `https://` | `mailto:` | `/` | `#` + value = _$2.trim(value); + if (value === "#") return "#"; + if ( + !( + value.substr(0, 7) === "http://" || + value.substr(0, 8) === "https://" || + value.substr(0, 7) === "mailto:" || + value.substr(0, 4) === "tel:" || + value.substr(0, 11) === "data:image/" || + value.substr(0, 6) === "ftp://" || + value.substr(0, 2) === "./" || + value.substr(0, 3) === "../" || + value[0] === "#" || + value[0] === "/" + ) + ) { + return ""; + } + } else if (name === "background") { + // filter `background` attribute (maybe no use) + // `javascript:` + REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0; + if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) { + return ""; + } + } else if (name === "style") { + // `expression()` + REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0; + if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) { + return ""; + } + // `url()` + REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0; + if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) { + REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0; + if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) { + return ""; + } + } + if (cssFilter !== false) { + cssFilter = cssFilter || defaultCSSFilter; + value = cssFilter.process(value); + } + } + + // escape `<>"` before returns + value = escapeAttrValue(value); + return value; + } + + // RegExp list + var REGEXP_LT = //g; + var REGEXP_QUOTE = /"/g; + var REGEXP_QUOTE_2 = /"/g; + var REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/gim; + var REGEXP_ATTR_VALUE_COLON = /:?/gim; + var REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/gim; + // var REGEXP_DEFAULT_ON_TAG_ATTR_3 = /\/\*|\*\//gm; + var REGEXP_DEFAULT_ON_TAG_ATTR_4 = + /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi; + // var REGEXP_DEFAULT_ON_TAG_ATTR_5 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:/gi; + // var REGEXP_DEFAULT_ON_TAG_ATTR_6 = /^[\s"'`]*(d\s*a\s*t\s*a\s*)\:\s*image\//gi; + var REGEXP_DEFAULT_ON_TAG_ATTR_7 = + /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi; + var REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\s*r\s*l\s*\(.*/gi; + + /** + * escape double quote + * + * @param {String} str + * @return {String} str + */ + function escapeQuote(str) { + return str.replace(REGEXP_QUOTE, """); + } + + /** + * unescape double quote + * + * @param {String} str + * @return {String} str + */ + function unescapeQuote(str) { + return str.replace(REGEXP_QUOTE_2, '"'); + } + + /** + * escape html entities + * + * @param {String} str + * @return {String} + */ + function escapeHtmlEntities(str) { + return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode(str, code) { + return code[0] === "x" || code[0] === "X" + ? String.fromCharCode(parseInt(code.substr(1), 16)) + : String.fromCharCode(parseInt(code, 10)); + }); + } + + /** + * escape html5 new danger entities + * + * @param {String} str + * @return {String} + */ + function escapeDangerHtml5Entities(str) { + return str + .replace(REGEXP_ATTR_VALUE_COLON, ":") + .replace(REGEXP_ATTR_VALUE_NEWLINE, " "); + } + + /** + * clear nonprintable characters + * + * @param {String} str + * @return {String} + */ + function clearNonPrintableCharacter(str) { + var str2 = ""; + for (var i = 0, len = str.length; i < len; i++) { + str2 += str.charCodeAt(i) < 32 ? " " : str.charAt(i); + } + return _$2.trim(str2); + } + + /** + * get friendly attribute value + * + * @param {String} str + * @return {String} + */ + function friendlyAttrValue(str) { + str = unescapeQuote(str); + str = escapeHtmlEntities(str); + str = escapeDangerHtml5Entities(str); + str = clearNonPrintableCharacter(str); + return str; + } + + /** + * unescape attribute value + * + * @param {String} str + * @return {String} + */ + function escapeAttrValue(str) { + str = escapeQuote(str); + str = escapeHtml(str); + return str; + } + + /** + * `onIgnoreTag` function for removing all the tags that are not in whitelist + */ + function onIgnoreTagStripAll() { + return ""; + } + + /** + * remove tag body + * specify a `tags` list, if the tag is not in the `tags` list then process by the specify function (optional) + * + * @param {array} tags + * @param {function} next + */ + function StripTagBody(tags, next) { + if (typeof next !== "function") { + next = function () {}; + } + + var isRemoveAllTag = !Array.isArray(tags); + function isRemoveTag(tag) { + if (isRemoveAllTag) return true; + return _$2.indexOf(tags, tag) !== -1; + } + + var removeList = []; + var posStart = false; + + return { + onIgnoreTag: function (tag, html, options) { + if (isRemoveTag(tag)) { + if (options.isClosing) { + var ret = "[/removed]"; + var end = options.position + ret.length; + removeList.push([ + posStart !== false ? posStart : options.position, + end, + ]); + posStart = false; + return ret; + } else { + if (!posStart) { + posStart = options.position; + } + return "[removed]"; + } + } else { + return next(tag, html, options); + } + }, + remove: function (html) { + var rethtml = ""; + var lastPos = 0; + _$2.forEach(removeList, function (pos) { + rethtml += html.slice(lastPos, pos[0]); + lastPos = pos[1]; + }); + rethtml += html.slice(lastPos); + return rethtml; + }, + }; + } + + /** + * remove html comments + * + * @param {String} html + * @return {String} + */ + function stripCommentTag(html) { + var retHtml = ""; + var lastPos = 0; + while (lastPos < html.length) { + var i = html.indexOf("", i); + if (j === -1) { + break; + } + lastPos = j + 3; + } + return retHtml; + } + + /** + * remove invisible characters + * + * @param {String} html + * @return {String} + */ + function stripBlankChar(html) { + var chars = html.split(""); + chars = chars.filter(function (char) { + var c = char.charCodeAt(0); + if (c === 127) return false; + if (c <= 31) { + if (c === 10 || c === 13) return true; + return false; + } + return true; + }); + return chars.join(""); + } + + _default$1.whiteList = getDefaultWhiteList(); + _default$1.getDefaultWhiteList = getDefaultWhiteList; + _default$1.onTag = onTag; + _default$1.onIgnoreTag = onIgnoreTag; + _default$1.onTagAttr = onTagAttr; + _default$1.onIgnoreTagAttr = onIgnoreTagAttr; + _default$1.safeAttrValue = safeAttrValue; + _default$1.escapeHtml = escapeHtml; + _default$1.escapeQuote = escapeQuote; + _default$1.unescapeQuote = unescapeQuote; + _default$1.escapeHtmlEntities = escapeHtmlEntities; + _default$1.escapeDangerHtml5Entities = escapeDangerHtml5Entities; + _default$1.clearNonPrintableCharacter = clearNonPrintableCharacter; + _default$1.friendlyAttrValue = friendlyAttrValue; + _default$1.escapeAttrValue = escapeAttrValue; + _default$1.onIgnoreTagStripAll = onIgnoreTagStripAll; + _default$1.StripTagBody = StripTagBody; + _default$1.stripCommentTag = stripCommentTag; + _default$1.stripBlankChar = stripBlankChar; + _default$1.cssFilter = defaultCSSFilter; + _default$1.getDefaultCSSWhiteList = getDefaultCSSWhiteList; + + var parser$1 = {}; + + /** + * Simple HTML Parser + * + * @author Zongmin Lei + */ + + var _$1 = util; + + /** + * get tag name + * + * @param {String} html e.g. '' + * @return {String} + */ + function getTagName(html) { + var i = _$1.spaceIndex(html); + var tagName; + if (i === -1) { + tagName = html.slice(1, -1); + } else { + tagName = html.slice(1, i + 1); + } + tagName = _$1.trim(tagName).toLowerCase(); + if (tagName.slice(0, 1) === "/") tagName = tagName.slice(1); + if (tagName.slice(-1) === "/") tagName = tagName.slice(0, -1); + return tagName; + } + + /** + * is close tag? + * + * @param {String} html 如:'' + * @return {Boolean} + */ + function isClosing(html) { + return html.slice(0, 2) === "" || currentPos === len - 1) { + rethtml += escapeHtml(html.slice(lastPos, tagStart)); + currentHtml = html.slice(tagStart, currentPos + 1); + currentTagName = getTagName(currentHtml); + rethtml += onTag( + tagStart, + rethtml.length, + currentTagName, + currentHtml, + isClosing(currentHtml) + ); + lastPos = currentPos + 1; + tagStart = false; + continue; + } + if (c === '"' || c === "'") { + var i = 1; + var ic = html.charAt(currentPos - i); + + while (ic.trim() === "" || ic === "=") { + if (ic === "=") { + quoteStart = c; + continue chariterator; + } + ic = html.charAt(currentPos - ++i); + } + } + } else { + if (c === quoteStart) { + quoteStart = false; + continue; + } + } + } + } + if (lastPos < len) { + rethtml += escapeHtml(html.substr(lastPos)); + } + + return rethtml; + } + + var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9\\_:.-]/gim; + + /** + * parse input attributes and returns processed attributes + * + * @param {String} html e.g. `href="#" target="_blank"` + * @param {Function} onAttr e.g. `function (name, value)` + * @return {String} + */ + function parseAttr$1(html, onAttr) { + + var lastPos = 0; + var lastMarkPos = 0; + var retAttrs = []; + var tmpName = false; + var len = html.length; + + function addAttr(name, value) { + name = _$1.trim(name); + name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase(); + if (name.length < 1) return; + var ret = onAttr(name, value || ""); + if (ret) retAttrs.push(ret); + } + + // 逐个分析字符 + for (var i = 0; i < len; i++) { + var c = html.charAt(i); + var v, j; + if (tmpName === false && c === "=") { + tmpName = html.slice(lastPos, i); + lastPos = i + 1; + lastMarkPos = html.charAt(lastPos) === '"' || html.charAt(lastPos) === "'" ? lastPos : findNextQuotationMark(html, i + 1); + continue; + } + if (tmpName !== false) { + if ( + i === lastMarkPos + ) { + j = html.indexOf(c, i + 1); + if (j === -1) { + break; + } else { + v = _$1.trim(html.slice(lastMarkPos + 1, j)); + addAttr(tmpName, v); + tmpName = false; + i = j; + lastPos = i + 1; + continue; + } + } + } + if (/\s|\n|\t/.test(c)) { + html = html.replace(/\s|\n|\t/g, " "); + if (tmpName === false) { + j = findNextEqual(html, i); + if (j === -1) { + v = _$1.trim(html.slice(lastPos, i)); + addAttr(v); + tmpName = false; + lastPos = i + 1; + continue; + } else { + i = j - 1; + continue; + } + } else { + j = findBeforeEqual(html, i - 1); + if (j === -1) { + v = _$1.trim(html.slice(lastPos, i)); + v = stripQuoteWrap(v); + addAttr(tmpName, v); + tmpName = false; + lastPos = i + 1; + continue; + } else { + continue; + } + } + } + } + + if (lastPos < html.length) { + if (tmpName === false) { + addAttr(html.slice(lastPos)); + } else { + addAttr(tmpName, stripQuoteWrap(_$1.trim(html.slice(lastPos)))); + } + } + + return _$1.trim(retAttrs.join(" ")); + } + + function findNextEqual(str, i) { + for (; i < str.length; i++) { + var c = str[i]; + if (c === " ") continue; + if (c === "=") return i; + return -1; + } + } + + function findNextQuotationMark(str, i) { + for (; i < str.length; i++) { + var c = str[i]; + if (c === " ") continue; + if (c === "'" || c === '"') return i; + return -1; + } + } + + function findBeforeEqual(str, i) { + for (; i > 0; i--) { + var c = str[i]; + if (c === " ") continue; + if (c === "=") return i; + return -1; + } + } + + function isQuoteWrapString(text) { + if ( + (text[0] === '"' && text[text.length - 1] === '"') || + (text[0] === "'" && text[text.length - 1] === "'") + ) { + return true; + } else { + return false; + } + } + + function stripQuoteWrap(text) { + if (isQuoteWrapString(text)) { + return text.substr(1, text.length - 2); + } else { + return text; + } + } + + parser$1.parseTag = parseTag$1; + parser$1.parseAttr = parseAttr$1; + + /** + * filter xss + * + * @author Zongmin Lei + */ + + var FilterCSS = libExports$1.FilterCSS; + var DEFAULT = _default$1; + var parser = parser$1; + var parseTag = parser.parseTag; + var parseAttr = parser.parseAttr; + var _ = util; + + /** + * returns `true` if the input value is `undefined` or `null` + * + * @param {Object} obj + * @return {Boolean} + */ + function isNull(obj) { + return obj === undefined || obj === null; + } + + /** + * get attributes for a tag + * + * @param {String} html + * @return {Object} + * - {String} html + * - {Boolean} closing + */ + function getAttrs(html) { + var i = _.spaceIndex(html); + if (i === -1) { + return { + html: "", + closing: html[html.length - 2] === "/", + }; + } + html = _.trim(html.slice(i + 1, -1)); + var isClosing = html[html.length - 1] === "/"; + if (isClosing) html = _.trim(html.slice(0, -1)); + return { + html: html, + closing: isClosing, + }; + } + + /** + * shallow copy + * + * @param {Object} obj + * @return {Object} + */ + function shallowCopyObject(obj) { + var ret = {}; + for (var i in obj) { + ret[i] = obj[i]; + } + return ret; + } + + function keysToLowerCase(obj) { + var ret = {}; + for (var i in obj) { + if (Array.isArray(obj[i])) { + ret[i.toLowerCase()] = obj[i].map(function (item) { + return item.toLowerCase(); + }); + } else { + ret[i.toLowerCase()] = obj[i]; + } + } + return ret; + } + + /** + * FilterXSS class + * + * @param {Object} options + * whiteList (or allowList), onTag, onTagAttr, onIgnoreTag, + * onIgnoreTagAttr, safeAttrValue, escapeHtml + * stripIgnoreTagBody, allowCommentTag, stripBlankChar + * css{whiteList, onAttr, onIgnoreAttr} `css=false` means don't use `cssfilter` + */ + function FilterXSS(options) { + options = shallowCopyObject(options || {}); + + if (options.stripIgnoreTag) { + if (options.onIgnoreTag) { + console.error( + 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time' + ); + } + options.onIgnoreTag = DEFAULT.onIgnoreTagStripAll; + } + if (options.whiteList || options.allowList) { + options.whiteList = keysToLowerCase(options.whiteList || options.allowList); + } else { + options.whiteList = DEFAULT.whiteList; + } + + options.onTag = options.onTag || DEFAULT.onTag; + options.onTagAttr = options.onTagAttr || DEFAULT.onTagAttr; + options.onIgnoreTag = options.onIgnoreTag || DEFAULT.onIgnoreTag; + options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT.onIgnoreTagAttr; + options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue; + options.escapeHtml = options.escapeHtml || DEFAULT.escapeHtml; + this.options = options; + + if (options.css === false) { + this.cssFilter = false; + } else { + options.css = options.css || {}; + this.cssFilter = new FilterCSS(options.css); + } + } + + /** + * start process and returns result + * + * @param {String} html + * @return {String} + */ + FilterXSS.prototype.process = function (html) { + // compatible with the input + html = html || ""; + html = html.toString(); + if (!html) return ""; + + var me = this; + var options = me.options; + var whiteList = options.whiteList; + var onTag = options.onTag; + var onIgnoreTag = options.onIgnoreTag; + var onTagAttr = options.onTagAttr; + var onIgnoreTagAttr = options.onIgnoreTagAttr; + var safeAttrValue = options.safeAttrValue; + var escapeHtml = options.escapeHtml; + var cssFilter = me.cssFilter; + + // remove invisible characters + if (options.stripBlankChar) { + html = DEFAULT.stripBlankChar(html); + } + + // remove html comments + if (!options.allowCommentTag) { + html = DEFAULT.stripCommentTag(html); + } + + // if enable stripIgnoreTagBody + var stripIgnoreTagBody = false; + if (options.stripIgnoreTagBody) { + stripIgnoreTagBody = DEFAULT.StripTagBody( + options.stripIgnoreTagBody, + onIgnoreTag + ); + onIgnoreTag = stripIgnoreTagBody.onIgnoreTag; + } + + var retHtml = parseTag( + html, + function (sourcePosition, position, tag, html, isClosing) { + var info = { + sourcePosition: sourcePosition, + position: position, + isClosing: isClosing, + isWhite: Object.prototype.hasOwnProperty.call(whiteList, tag), + }; + + // call `onTag()` + var ret = onTag(tag, html, info); + if (!isNull(ret)) return ret; + + if (info.isWhite) { + if (info.isClosing) { + return ""; + } + + var attrs = getAttrs(html); + var whiteAttrList = whiteList[tag]; + var attrsHtml = parseAttr(attrs.html, function (name, value) { + // call `onTagAttr()` + var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1; + var ret = onTagAttr(tag, name, value, isWhiteAttr); + if (!isNull(ret)) return ret; + + if (isWhiteAttr) { + // call `safeAttrValue()` + value = safeAttrValue(tag, name, value, cssFilter); + if (value) { + return name + '="' + value + '"'; + } else { + return name; + } + } else { + // call `onIgnoreTagAttr()` + ret = onIgnoreTagAttr(tag, name, value, isWhiteAttr); + if (!isNull(ret)) return ret; + return; + } + }); + + // build new tag html + html = "<" + tag; + if (attrsHtml) html += " " + attrsHtml; + if (attrs.closing) html += " /"; + html += ">"; + return html; + } else { + // call `onIgnoreTag()` + ret = onIgnoreTag(tag, html, info); + if (!isNull(ret)) return ret; + return escapeHtml(html); + } + }, + escapeHtml + ); + + // if enable stripIgnoreTagBody + if (stripIgnoreTagBody) { + retHtml = stripIgnoreTagBody.remove(retHtml); + } + + return retHtml; + }; + + var xss = FilterXSS; + + /** + * xss + * + * @author Zongmin Lei + */ + + (function (module, exports) { + var DEFAULT = _default$1; + var parser = parser$1; + var FilterXSS = xss; + + /** + * filter xss function + * + * @param {String} html + * @param {Object} options { whiteList, onTag, onTagAttr, onIgnoreTag, onIgnoreTagAttr, safeAttrValue, escapeHtml } + * @return {String} + */ + function filterXSS(html, options) { + var xss = new FilterXSS(options); + return xss.process(html); + } + + exports = module.exports = filterXSS; + exports.filterXSS = filterXSS; + exports.FilterXSS = FilterXSS; + + (function () { + for (var i in DEFAULT) { + exports[i] = DEFAULT[i]; + } + for (var j in parser) { + exports[j] = parser[j]; + } + })(); + + // using `xss` on the browser, output `filterXSS` to the globals + if (typeof window !== "undefined") { + window.filterXSS = module.exports; + } + + // using `xss` on the WebWorker, output `filterXSS` to the globals + function isWorkerEnv() { + return ( + typeof self !== "undefined" && + typeof DedicatedWorkerGlobalScope !== "undefined" && + self instanceof DedicatedWorkerGlobalScope + ); + } + if (isWorkerEnv()) { + self.filterXSS = module.exports; + } + } (lib$1, lib$1.exports)); + + var libExports = lib$1.exports; + var xssFilter = /*@__PURE__*/getDefaultExportFromCjs(libExports); + + function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } + function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context8 = ownKeys(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context9 = ownKeys(Object(t))).call(_context9, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } + /** + * Test if an object implements the DataView interface from vis-data. + * Uses the idProp property instead of expecting a hardcoded id field "id". + */ + function isDataViewLike(obj) { + var _obj$idProp; + if (!obj) { + return false; + } + var idProp = (_obj$idProp = obj.idProp) !== null && _obj$idProp !== void 0 ? _obj$idProp : obj._idProp; + if (!idProp) { + return false; + } + return isDataViewLike$1(idProp, obj); + } + + // parse ASP.Net Date pattern, + // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' + // code from http://momentjs.com/ + var ASPDateRegex = /^\/?Date\((-?\d+)/i; + var NumericRegex = /^\d+$/; + /** + * Convert an object into another type + * + * @param object - Value of unknown type. + * @param type - Name of the desired type. + * + * @returns Object in the desired type. + * @throws Error + */ + function convert(object, type) { + var match; + if (object === undefined) { + return undefined; + } + if (object === null) { + return null; + } + if (!type) { + return object; + } + if (!(typeof type === "string") && !(type instanceof String)) { + throw new Error("Type must be a string"); + } + + //noinspection FallthroughInSwitchStatementJS + switch (type) { + case "boolean": + case "Boolean": + return Boolean(object); + case "number": + case "Number": + if (isString(object) && !isNaN(Date.parse(object))) { + return moment$2(object).valueOf(); + } else { + // @TODO: I don't think that Number and String constructors are a good idea. + // This could also fail if the object doesn't have valueOf method or if it's redefined. + // For example: Object.create(null) or { valueOf: 7 }. + return Number(object.valueOf()); + } + case "string": + case "String": + return String(object); + case "Date": + try { + return convert(object, "Moment").toDate(); + } catch (e) { + if (e instanceof TypeError) { + throw new TypeError("Cannot convert object of type " + getType(object) + " to type " + type); + } else { + throw e; + } + } + case "Moment": + if (isNumber(object)) { + return moment$2(object); + } + if (object instanceof Date) { + return moment$2(object.valueOf()); + } else if (moment$2.isMoment(object)) { + return moment$2(object); + } + if (isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return moment$2(Number(match[1])); // parse number + } + + match = NumericRegex.exec(object); + if (match) { + return moment$2(Number(object)); + } + return moment$2(object); // parse string + } else { + throw new TypeError("Cannot convert object of type " + getType(object) + " to type " + type); + } + case "ISODate": + if (isNumber(object)) { + return new Date(object); + } else if (object instanceof Date) { + return object.toISOString(); + } else if (moment$2.isMoment(object)) { + return object.toDate().toISOString(); + } else if (isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])).toISOString(); // parse number + } else { + return moment$2(object).format(); // ISO 8601 + } + } else { + throw new Error("Cannot convert object of type " + getType(object) + " to type ISODate"); + } + case "ASPDate": + if (isNumber(object)) { + return "/Date(" + object + ")/"; + } else if (object instanceof Date || moment$2.isMoment(object)) { + return "/Date(" + object.valueOf() + ")/"; + } else if (isString(object)) { + match = ASPDateRegex.exec(object); + var value; + if (match) { + // object is an ASP date + value = new Date(Number(match[1])).valueOf(); // parse number + } else { + value = new Date(object).valueOf(); // parse string + } + + return "/Date(" + value + ")/"; + } else { + throw new Error("Cannot convert object of type " + getType(object) + " to type ASPDate"); + } + default: + throw new Error("Unknown type ".concat(type)); + } + } + + /** + * Create a Data Set like wrapper to seamlessly coerce data types. + * + * @param rawDS - The Data Set with raw uncoerced data. + * @param type - A record assigning a data type to property name. + * + * @remarks + * The write operations (`add`, `remove`, `update` and `updateOnly`) write into + * the raw (uncoerced) data set. These values are then picked up by a pipe + * which coerces the values using the [[convert]] function and feeds them into + * the coerced data set. When querying (`forEach`, `get`, `getIds`, `off` and + * `on`) the values are then fetched from the coerced data set and already have + * the required data types. The values are coerced only once when inserted and + * then the same value is returned each time until it is updated or deleted. + * + * For example: `typeCoercedDataSet.add({ id: 7, start: "2020-01-21" })` would + * result in `typeCoercedDataSet.get(7)` returning `{ id: 7, start: moment(new + * Date("2020-01-21")).toDate() }`. + * + * Use the dispose method prior to throwing a reference to this away. Otherwise + * the pipe connecting the two Data Sets will keep the unaccessible coerced + * Data Set alive and updated as long as the raw Data Set exists. + * + * @returns A Data Set like object that saves data into the raw Data Set and + * retrieves them from the coerced Data Set. + */ + function typeCoerceDataSet(rawDS) { + var _context, _context3, _context4, _context5, _context6, _context7; + var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + start: "Date", + end: "Date" + }; + var idProp = rawDS._idProp; + var coercedDS = new DataSet({ + fieldId: idProp + }); + var pipe = _mapInstanceProperty(_context = createNewDataPipeFrom(rawDS)).call(_context, function (item) { + var _context2; + return _reduceInstanceProperty(_context2 = _Object$keys(item)).call(_context2, function (acc, key) { + acc[key] = convert(item[key], type[key]); + return acc; + }, {}); + }).to(coercedDS); + pipe.all().start(); + return { + // Write only. + add: function add() { + var _rawDS$getDataSet; + return (_rawDS$getDataSet = rawDS.getDataSet()).add.apply(_rawDS$getDataSet, arguments); + }, + remove: function remove() { + var _rawDS$getDataSet2; + return (_rawDS$getDataSet2 = rawDS.getDataSet()).remove.apply(_rawDS$getDataSet2, arguments); + }, + update: function update() { + var _rawDS$getDataSet3; + return (_rawDS$getDataSet3 = rawDS.getDataSet()).update.apply(_rawDS$getDataSet3, arguments); + }, + updateOnly: function updateOnly() { + var _rawDS$getDataSet4; + return (_rawDS$getDataSet4 = rawDS.getDataSet()).updateOnly.apply(_rawDS$getDataSet4, arguments); + }, + clear: function clear() { + var _rawDS$getDataSet5; + return (_rawDS$getDataSet5 = rawDS.getDataSet()).clear.apply(_rawDS$getDataSet5, arguments); + }, + // Read only. + forEach: _bindInstanceProperty$1(_context3 = _forEachInstanceProperty(coercedDS)).call(_context3, coercedDS), + get: _bindInstanceProperty$1(_context4 = coercedDS.get).call(_context4, coercedDS), + getIds: _bindInstanceProperty$1(_context5 = coercedDS.getIds).call(_context5, coercedDS), + off: _bindInstanceProperty$1(_context6 = coercedDS.off).call(_context6, coercedDS), + on: _bindInstanceProperty$1(_context7 = coercedDS.on).call(_context7, coercedDS), + get length() { + return coercedDS.length; + }, + // Non standard. + idProp: idProp, + type: type, + rawDS: rawDS, + coercedDS: coercedDS, + dispose: function dispose() { + return pipe.stop(); + } + }; + } + + // Configure XSS protection + var setupXSSCleaner = function setupXSSCleaner(options) { + var customXSS = new xssFilter.FilterXSS(options); + return function (string) { + return customXSS.process(string); + }; + }; + var setupNoOpCleaner = function setupNoOpCleaner(string) { + return string; + }; + + // when nothing else is configured: filter XSS with the lib's default options + var configuredXSSProtection = setupXSSCleaner(); + var setupXSSProtection = function setupXSSProtection(options) { + // No options? Do nothing. + if (!options) { + return; + } + + // Disable XSS protection completely on request + if (options.disabled === true) { + configuredXSSProtection = setupNoOpCleaner; + console.warn('You disabled XSS protection for vis-Timeline. I sure hope you know what you\'re doing!'); + } else { + // Configure XSS protection with some custom options. + // For a list of valid options check the lib's documentation: + // https://github.com/leizongmin/js-xss#custom-filter-rules + if (options.filterOptions) { + configuredXSSProtection = setupXSSCleaner(options.filterOptions); + } + } + }; + var availableUtils = _objectSpread(_objectSpread({}, util$2), {}, { + convert: convert, + setupXSSProtection: setupXSSProtection + }); + _Object$defineProperty(availableUtils, 'xss', { + get: function get() { + return configuredXSSProtection; + } + }); + + var global$1 = global$q; + var fails = fails$y; + var uncurryThis = functionUncurryThis; + var toString$1 = toString$c; + var trim = stringTrim.trim; + var whitespaces = whitespaces$3; + + var charAt = uncurryThis(''.charAt); + var $parseFloat$1 = global$1.parseFloat; + var Symbol$1 = global$1.Symbol; + var ITERATOR = Symbol$1 && Symbol$1.iterator; + var FORCED = 1 / $parseFloat$1(whitespaces + '-0') !== -Infinity + // MS Edge 18- broken with boxed symbols + || (ITERATOR && !fails(function () { $parseFloat$1(Object(ITERATOR)); })); + + // `parseFloat` method + // https://tc39.es/ecma262/#sec-parsefloat-string + var numberParseFloat = FORCED ? function parseFloat(string) { + var trimmedString = trim(toString$1(string)); + var result = $parseFloat$1(trimmedString); + return result === 0 && charAt(trimmedString, 0) === '-' ? -0 : result; + } : $parseFloat$1; + + var $$4 = _export; + var $parseFloat = numberParseFloat; + + // `parseFloat` method + // https://tc39.es/ecma262/#sec-parsefloat-string + $$4({ global: true, forced: parseFloat !== $parseFloat }, { + parseFloat: $parseFloat + }); + + var path$1 = path$u; + + var _parseFloat$3 = path$1.parseFloat; + + var parent$4 = _parseFloat$3; + + var _parseFloat$2 = parent$4; + + var _parseFloat = _parseFloat$2; + + var _parseFloat$1 = /*@__PURE__*/getDefaultExportFromCjs(_parseFloat); + + /** Prototype for visual components */ + var Component = /*#__PURE__*/function () { + /** + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] + * @param {Object} [options] + */ + function Component(body, options) { + _classCallCheck(this, Component); + // eslint-disable-line no-unused-vars + this.options = null; + this.props = null; + } + + /** + * Set options for the component. The new options will be merged into the + * current options. + * @param {Object} options + */ + _createClass(Component, [{ + key: "setOptions", + value: function setOptions(options) { + if (options) { + availableUtils.extend(this.options, options); + } + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + // should be implemented by the component + return false; + } + + /** + * Destroy the component. Cleanup DOM and event listeners + */ + }, { + key: "destroy", + value: function destroy() { + // should be implemented by the component + } + + /** + * Test whether the component is resized since the last time _isResized() was + * called. + * @return {Boolean} Returns true if the component is resized + * @protected + */ + }, { + key: "_isResized", + value: function _isResized() { + var resized = this.props._previousWidth !== this.props.width || this.props._previousHeight !== this.props.height; + this.props._previousWidth = this.props.width; + this.props._previousHeight = this.props.height; + return resized; + } + }]); + return Component; + }(); + + var toIntegerOrInfinity = toIntegerOrInfinity$5; + var toString = toString$c; + var requireObjectCoercible = requireObjectCoercible$6; + + var $RangeError = RangeError; + + // `String.prototype.repeat` method implementation + // https://tc39.es/ecma262/#sec-string.prototype.repeat + var stringRepeat = function repeat(count) { + var str = toString(requireObjectCoercible(this)); + var result = ''; + var n = toIntegerOrInfinity(count); + if (n < 0 || n === Infinity) throw new $RangeError('Wrong number of repetitions'); + for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; + return result; + }; + + var $$3 = _export; + var repeat$4 = stringRepeat; + + // `String.prototype.repeat` method + // https://tc39.es/ecma262/#sec-string.prototype.repeat + $$3({ target: 'String', proto: true }, { + repeat: repeat$4 + }); + + var entryVirtual$3 = entryVirtual$o; + + var repeat$3 = entryVirtual$3('String').repeat; + + var isPrototypeOf$3 = objectIsPrototypeOf; + var method$3 = repeat$3; + + var StringPrototype = String.prototype; + + var repeat$2 = function (it) { + var own = it.repeat; + return typeof it == 'string' || it === StringPrototype + || (isPrototypeOf$3(StringPrototype, it) && own === StringPrototype.repeat) ? method$3 : own; + }; + + var parent$3 = repeat$2; + + var repeat$1 = parent$3; + + var repeat = repeat$1; + + var _repeatInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(repeat); + + /** + * used in Core to convert the options into a volatile variable + * + * @param {function} moment + * @param {Object} body + * @param {Array | Object} hiddenDates + * @returns {number} + */ + function convertHiddenOptions(moment, body, hiddenDates) { + if (hiddenDates && !_Array$isArray(hiddenDates)) { + return convertHiddenOptions(moment, body, [hiddenDates]); + } + body.hiddenDates = []; + if (hiddenDates) { + if (_Array$isArray(hiddenDates) == true) { + var _context; + for (var i = 0; i < hiddenDates.length; i++) { + if (_repeatInstanceProperty(hiddenDates[i]) === undefined) { + var dateItem = {}; + dateItem.start = moment(hiddenDates[i].start).toDate().valueOf(); + dateItem.end = moment(hiddenDates[i].end).toDate().valueOf(); + body.hiddenDates.push(dateItem); + } + } + _sortInstanceProperty(_context = body.hiddenDates).call(_context, function (a, b) { + return a.start - b.start; + }); // sort by start time + } + } + } + + /** + * create new entrees for the repeating hidden dates + * + * @param {function} moment + * @param {Object} body + * @param {Array | Object} hiddenDates + * @returns {null} + */ + function updateHiddenDates(moment, body, hiddenDates) { + if (hiddenDates && !_Array$isArray(hiddenDates)) { + return updateHiddenDates(moment, body, [hiddenDates]); + } + if (hiddenDates && body.domProps.centerContainer.width !== undefined) { + convertHiddenOptions(moment, body, hiddenDates); + var start = moment(body.range.start); + var end = moment(body.range.end); + var totalRange = body.range.end - body.range.start; + var pixelTime = totalRange / body.domProps.centerContainer.width; + for (var i = 0; i < hiddenDates.length; i++) { + if (_repeatInstanceProperty(hiddenDates[i]) !== undefined) { + var startDate = moment(hiddenDates[i].start); + var endDate = moment(hiddenDates[i].end); + if (startDate._d == "Invalid Date") { + throw new Error("Supplied start date is not valid: ".concat(hiddenDates[i].start)); + } + if (endDate._d == "Invalid Date") { + throw new Error("Supplied end date is not valid: ".concat(hiddenDates[i].end)); + } + var duration = endDate - startDate; + if (duration >= 4 * pixelTime) { + var offset = 0; + var runUntil = end.clone(); + switch (_repeatInstanceProperty(hiddenDates[i])) { + case "daily": + // case of time + if (startDate.day() != endDate.day()) { + offset = 1; + } + startDate.dayOfYear(start.dayOfYear()); + startDate.year(start.year()); + startDate.subtract(7, 'days'); + endDate.dayOfYear(start.dayOfYear()); + endDate.year(start.year()); + endDate.subtract(7 - offset, 'days'); + runUntil.add(1, 'weeks'); + break; + case "weekly": + { + var dayOffset = endDate.diff(startDate, 'days'); + var day = startDate.day(); + + // set the start date to the range.start + startDate.date(start.date()); + startDate.month(start.month()); + startDate.year(start.year()); + endDate = startDate.clone(); + + // force + startDate.day(day); + endDate.day(day); + endDate.add(dayOffset, 'days'); + startDate.subtract(1, 'weeks'); + endDate.subtract(1, 'weeks'); + runUntil.add(1, 'weeks'); + break; + } + case "monthly": + if (startDate.month() != endDate.month()) { + offset = 1; + } + startDate.month(start.month()); + startDate.year(start.year()); + startDate.subtract(1, 'months'); + endDate.month(start.month()); + endDate.year(start.year()); + endDate.subtract(1, 'months'); + endDate.add(offset, 'months'); + runUntil.add(1, 'months'); + break; + case "yearly": + if (startDate.year() != endDate.year()) { + offset = 1; + } + startDate.year(start.year()); + startDate.subtract(1, 'years'); + endDate.year(start.year()); + endDate.subtract(1, 'years'); + endDate.add(offset, 'years'); + runUntil.add(1, 'years'); + break; + default: + console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", _repeatInstanceProperty(hiddenDates[i])); + return; + } + while (startDate < runUntil) { + body.hiddenDates.push({ + start: startDate.valueOf(), + end: endDate.valueOf() + }); + switch (_repeatInstanceProperty(hiddenDates[i])) { + case "daily": + startDate.add(1, 'days'); + endDate.add(1, 'days'); + break; + case "weekly": + startDate.add(1, 'weeks'); + endDate.add(1, 'weeks'); + break; + case "monthly": + startDate.add(1, 'months'); + endDate.add(1, 'months'); + break; + case "yearly": + startDate.add(1, 'y'); + endDate.add(1, 'y'); + break; + default: + console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", _repeatInstanceProperty(hiddenDates[i])); + return; + } + } + body.hiddenDates.push({ + start: startDate.valueOf(), + end: endDate.valueOf() + }); + } + } + } + // remove duplicates, merge where possible + removeDuplicates(body); + // ensure the new positions are not on hidden dates + var startHidden = getIsHidden(body.range.start, body.hiddenDates); + var endHidden = getIsHidden(body.range.end, body.hiddenDates); + var rangeStart = body.range.start; + var rangeEnd = body.range.end; + if (startHidden.hidden == true) { + rangeStart = body.range.startToFront == true ? startHidden.startDate - 1 : startHidden.endDate + 1; + } + if (endHidden.hidden == true) { + rangeEnd = body.range.endToFront == true ? endHidden.startDate - 1 : endHidden.endDate + 1; + } + if (startHidden.hidden == true || endHidden.hidden == true) { + body.range._applyRange(rangeStart, rangeEnd); + } + } + } + + /** + * remove duplicates from the hidden dates list. Duplicates are evil. They mess everything up. + * Scales with N^2 + * + * @param {Object} body + */ + function removeDuplicates(body) { + var _context2; + var hiddenDates = body.hiddenDates; + var safeDates = []; + for (var i = 0; i < hiddenDates.length; i++) { + for (var j = 0; j < hiddenDates.length; j++) { + if (i != j && hiddenDates[j].remove != true && hiddenDates[i].remove != true) { + // j inside i + if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { + hiddenDates[j].remove = true; + } + // j start inside i + else if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].start <= hiddenDates[i].end) { + hiddenDates[i].end = hiddenDates[j].end; + hiddenDates[j].remove = true; + } + // j end inside i + else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { + hiddenDates[i].start = hiddenDates[j].start; + hiddenDates[j].remove = true; + } + } + } + } + for (i = 0; i < hiddenDates.length; i++) { + if (hiddenDates[i].remove !== true) { + safeDates.push(hiddenDates[i]); + } + } + body.hiddenDates = safeDates; + _sortInstanceProperty(_context2 = body.hiddenDates).call(_context2, function (a, b) { + return a.start - b.start; + }); // sort by start time + } + + /** + * Prints dates to console + * @param {array} dates + */ + function printDates(dates) { + for (var i = 0; i < dates.length; i++) { + console.log(i, new Date(dates[i].start), new Date(dates[i].end), dates[i].start, dates[i].end, dates[i].remove); + } + } + + /** + * Used in TimeStep to avoid the hidden times. + * @param {function} moment + * @param {TimeStep} timeStep + * @param {Date} previousTime + */ + function stepOverHiddenDates(moment, timeStep, previousTime) { + var stepInHidden = false; + var currentValue = timeStep.current.valueOf(); + for (var i = 0; i < timeStep.hiddenDates.length; i++) { + var startDate = timeStep.hiddenDates[i].start; + var endDate = timeStep.hiddenDates[i].end; + if (currentValue >= startDate && currentValue < endDate) { + stepInHidden = true; + break; + } + } + if (stepInHidden == true && currentValue < timeStep._end.valueOf() && currentValue != previousTime) { + var prevValue = moment(previousTime); + var newValue = moment(endDate); + //check if the next step should be major + if (prevValue.year() != newValue.year()) { + timeStep.switchedYear = true; + } else if (prevValue.month() != newValue.month()) { + timeStep.switchedMonth = true; + } else if (prevValue.dayOfYear() != newValue.dayOfYear()) { + timeStep.switchedDay = true; + } + timeStep.current = newValue; + } + } + + ///** + // * Used in TimeStep to avoid the hidden times. + // * @param timeStep + // * @param previousTime + // */ + //checkFirstStep = function(timeStep) { + // var stepInHidden = false; + // var currentValue = timeStep.current.valueOf(); + // for (var i = 0; i < timeStep.hiddenDates.length; i++) { + // var startDate = timeStep.hiddenDates[i].start; + // var endDate = timeStep.hiddenDates[i].end; + // if (currentValue >= startDate && currentValue < endDate) { + // stepInHidden = true; + // break; + // } + // } + // + // if (stepInHidden == true && currentValue <= timeStep._end.valueOf()) { + // var newValue = moment(endDate); + // timeStep.current = newValue.toDate(); + // } + //}; + + /** + * replaces the Core toScreen methods + * + * @param {timeline.Core} Core + * @param {Date} time + * @param {number} width + * @returns {number} + */ + function toScreen(Core, time, width) { + var conversion; + if (Core.body.hiddenDates.length == 0) { + conversion = Core.range.conversion(width); + return (time.valueOf() - conversion.offset) * conversion.scale; + } else { + var hidden = getIsHidden(time, Core.body.hiddenDates); + if (hidden.hidden == true) { + time = hidden.startDate; + } + var duration = getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); + if (time < Core.range.start) { + conversion = Core.range.conversion(width, duration); + var hiddenBeforeStart = getHiddenDurationBeforeStart(Core.body.hiddenDates, time, conversion.offset); + time = Core.options.moment(time).toDate().valueOf(); + time = time + hiddenBeforeStart; + return -(conversion.offset - time.valueOf()) * conversion.scale; + } else if (time > Core.range.end) { + var rangeAfterEnd = { + start: Core.range.start, + end: time + }; + time = correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, rangeAfterEnd, time); + conversion = Core.range.conversion(width, duration); + return (time.valueOf() - conversion.offset) * conversion.scale; + } else { + time = correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, Core.range, time); + conversion = Core.range.conversion(width, duration); + return (time.valueOf() - conversion.offset) * conversion.scale; + } + } + } + + /** + * Replaces the core toTime methods + * + * @param {timeline.Core} Core + * @param {number} x + * @param {number} width + * @returns {Date} + */ + function toTime(Core, x, width) { + if (Core.body.hiddenDates.length == 0) { + var conversion = Core.range.conversion(width); + return new Date(x / conversion.scale + conversion.offset); + } else { + var hiddenDuration = getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); + var totalDuration = Core.range.end - Core.range.start - hiddenDuration; + var partialDuration = totalDuration * x / width; + var accumulatedHiddenDuration = getAccumulatedHiddenDuration(Core.body.hiddenDates, Core.range, partialDuration); + return new Date(accumulatedHiddenDuration + partialDuration + Core.range.start); + } + } + + /** + * Support function + * + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {number} start + * @param {number} end + * @returns {number} + */ + function getHiddenDurationBetween(hiddenDates, start, end) { + var duration = 0; + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= start && endDate < end) { + duration += endDate - startDate; + } + } + return duration; + } + + /** + * Support function + * + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {number} start + * @param {number} end + * @returns {number} + */ + function getHiddenDurationBeforeStart(hiddenDates, start, end) { + var duration = 0; + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + if (startDate >= start && endDate <= end) { + duration += endDate - startDate; + } + } + return duration; + } + + /** + * Support function + * @param {function} moment + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {{start: number, end: number}} range + * @param {Date} time + * @returns {number} + */ + function correctTimeForHidden(moment, hiddenDates, range, time) { + time = moment(time).toDate().valueOf(); + time -= getHiddenDurationBefore(moment, hiddenDates, range, time); + return time; + } + + /** + * Support function + * @param {function} moment + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {{start: number, end: number}} range + * @param {Date} time + * @returns {number} + */ + function getHiddenDurationBefore(moment, hiddenDates, range, time) { + var timeOffset = 0; + time = moment(time).toDate().valueOf(); + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= range.start && endDate < range.end) { + if (time >= endDate) { + timeOffset += endDate - startDate; + } + } + } + return timeOffset; + } + + /** + * sum the duration from start to finish, including the hidden duration, + * until the required amount has been reached, return the accumulated hidden duration + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {{start: number, end: number}} range + * @param {number} [requiredDuration=0] + * @returns {number} + */ + function getAccumulatedHiddenDuration(hiddenDates, range, requiredDuration) { + var hiddenDuration = 0; + var duration = 0; + var previousPoint = range.start; + //printDates(hiddenDates) + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= range.start && endDate < range.end) { + duration += startDate - previousPoint; + previousPoint = endDate; + if (duration >= requiredDuration) { + break; + } else { + hiddenDuration += endDate - startDate; + } + } + } + return hiddenDuration; + } + + /** + * used to step over to either side of a hidden block. Correction is disabled on tablets, might be set to true + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {Date} time + * @param {number} direction + * @param {boolean} correctionEnabled + * @returns {Date|number} + */ + function snapAwayFromHidden(hiddenDates, time, direction, correctionEnabled) { + var isHidden = getIsHidden(time, hiddenDates); + if (isHidden.hidden == true) { + if (direction < 0) { + if (correctionEnabled == true) { + return isHidden.startDate - (isHidden.endDate - time) - 1; + } else { + return isHidden.startDate - 1; + } + } else { + if (correctionEnabled == true) { + return isHidden.endDate + (time - isHidden.startDate) + 1; + } else { + return isHidden.endDate + 1; + } + } + } else { + return time; + } + } + + /** + * Check if a time is hidden + * + * @param {Date} time + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @returns {{hidden: boolean, startDate: Window.start, endDate: *}} + */ + function getIsHidden(time, hiddenDates) { + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + if (time >= startDate && time < endDate) { + // if the start is entering a hidden zone + return { + hidden: true, + startDate: startDate, + endDate: endDate + }; + } + } + return { + hidden: false, + startDate: startDate, + endDate: endDate + }; + } + + var DateUtil = /*#__PURE__*/Object.freeze({ + __proto__: null, + convertHiddenOptions: convertHiddenOptions, + correctTimeForHidden: correctTimeForHidden, + getAccumulatedHiddenDuration: getAccumulatedHiddenDuration, + getHiddenDurationBefore: getHiddenDurationBefore, + getHiddenDurationBeforeStart: getHiddenDurationBeforeStart, + getHiddenDurationBetween: getHiddenDurationBetween, + getIsHidden: getIsHidden, + printDates: printDates, + removeDuplicates: removeDuplicates, + snapAwayFromHidden: snapAwayFromHidden, + stepOverHiddenDates: stepOverHiddenDates, + toScreen: toScreen, + toTime: toTime, + updateHiddenDates: updateHiddenDates + }); + + function _createSuper$c(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$c() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * A Range controls a numeric range with a start and end value. + * The Range adjusts the range based on mouse events or programmatic changes, + * and triggers events when the range is changing or has been changed. + */ + var Range = /*#__PURE__*/function (_Component) { + _inherits(Range, _Component); + var _super = _createSuper$c(Range); + /** + * @param {{dom: Object, domProps: Object, emitter: Emitter}} body + * @param {Object} [options] See description at Range.setOptions + * @constructor Range + * @extends Component + */ + function Range(body, options) { + var _context, _context2, _context3, _context4, _context5, _context6, _context7; + var _this; + _classCallCheck(this, Range); + _this = _super.call(this); + var now = moment$4().hours(0).minutes(0).seconds(0).milliseconds(0); + var start = now.clone().add(-3, 'days').valueOf(); + var end = now.clone().add(3, 'days').valueOf(); + _this.millisecondsPerPixelCache = undefined; + if (options === undefined) { + _this.start = start; + _this.end = end; + } else { + _this.start = options.start || start; + _this.end = options.end || end; + } + _this.rolling = false; + _this.body = body; + _this.deltaDifference = 0; + _this.scaleOffset = 0; + _this.startToFront = false; + _this.endToFront = true; + + // default options + _this.defaultOptions = { + rtl: false, + start: null, + end: null, + moment: moment$4, + direction: 'horizontal', + // 'horizontal' or 'vertical' + moveable: true, + zoomable: true, + min: null, + max: null, + zoomMin: 10, + // milliseconds + zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000, + // milliseconds + rollingMode: { + follow: false, + offset: 0.5 + } + }; + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.props = { + touch: {} + }; + _this.animationTimer = null; + + // drag listeners for dragging + _this.body.emitter.on('panstart', _bindInstanceProperty$1(_context = _this._onDragStart).call(_context, _assertThisInitialized(_this))); + _this.body.emitter.on('panmove', _bindInstanceProperty$1(_context2 = _this._onDrag).call(_context2, _assertThisInitialized(_this))); + _this.body.emitter.on('panend', _bindInstanceProperty$1(_context3 = _this._onDragEnd).call(_context3, _assertThisInitialized(_this))); + + // mouse wheel for zooming + _this.body.emitter.on('mousewheel', _bindInstanceProperty$1(_context4 = _this._onMouseWheel).call(_context4, _assertThisInitialized(_this))); + + // pinch to zoom + _this.body.emitter.on('touch', _bindInstanceProperty$1(_context5 = _this._onTouch).call(_context5, _assertThisInitialized(_this))); + _this.body.emitter.on('pinch', _bindInstanceProperty$1(_context6 = _this._onPinch).call(_context6, _assertThisInitialized(_this))); + + // on click of rolling mode button + _this.body.dom.rollingModeBtn.addEventListener('click', _bindInstanceProperty$1(_context7 = _this.startRolling).call(_context7, _assertThisInitialized(_this))); + _this.setOptions(options); + return _this; + } + + /** + * Set options for the range controller + * @param {Object} options Available options: + * {number | Date | String} start Start date for the range + * {number | Date | String} end End date for the range + * {number} min Minimum value for start + * {number} max Maximum value for end + * {number} zoomMin Set a minimum value for + * (end - start). + * {number} zoomMax Set a maximum value for + * (end - start). + * {boolean} moveable Enable moving of the range + * by dragging. True by default + * {boolean} zoomable Enable zooming of the range + * by pinching/scrolling. True by default + */ + _createClass(Range, [{ + key: "setOptions", + value: function setOptions(options) { + if (options) { + // copy the options that we know + var fields = ['animation', 'direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable', 'moment', 'activate', 'hiddenDates', 'zoomKey', 'zoomFriction', 'rtl', 'showCurrentTime', 'rollingMode', 'horizontalScroll']; + availableUtils.selectiveExtend(fields, this.options, options); + if (options.rollingMode && options.rollingMode.follow) { + this.startRolling(); + } + if ('start' in options || 'end' in options) { + // apply a new range. both start and end are optional + this.setRange(options.start, options.end); + } + } + } + + /** + * Start auto refreshing the current time bar + */ + }, { + key: "startRolling", + value: function startRolling() { + var me = this; + + /** + * Updates the current time. + */ + function update() { + me.stopRolling(); + me.rolling = true; + var interval = me.end - me.start; + var t = availableUtils.convert(new Date(), 'Date').valueOf(); + var rollingModeOffset = me.options.rollingMode && me.options.rollingMode.offset || 0.5; + var start = t - interval * rollingModeOffset; + var end = t + interval * (1 - rollingModeOffset); + var options = { + animation: false + }; + me.setRange(start, end, options); + + // determine interval to refresh + var scale = me.conversion(me.body.domProps.center.width).scale; + interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; + me.body.dom.rollingModeBtn.style.visibility = "hidden"; + // start a renderTimer to adjust for the new time + me.currentTimeTimer = _setTimeout(update, interval); + } + update(); + } + + /** + * Stop auto refreshing the current time bar + */ + }, { + key: "stopRolling", + value: function stopRolling() { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + this.rolling = false; + this.body.dom.rollingModeBtn.style.visibility = "visible"; + } + } + + /** + * Set a new start and end range + * @param {Date | number | string} start + * @param {Date | number | string} end + * @param {Object} options Available options: + * {boolean | {duration: number, easingFunction: string}} [animation=false] + * If true, the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * {boolean} [byUser=false] + * {Event} event Mouse event + * @param {Function} callback a callback function to be executed at the end of this function + * @param {Function} frameCallback a callback function executed each frame of the range animation. + * The callback will be passed three parameters: + * {number} easeCoefficient an easing coefficent + * {boolean} willDraw If true the caller will redraw after the callback completes + * {boolean} done If true then animation is ending after the current frame + * @return {void} + */ + }, { + key: "setRange", + value: function setRange(start, end, options, callback, frameCallback) { + if (!options) { + options = {}; + } + if (options.byUser !== true) { + options.byUser = false; + } + var me = this; + var finalStart = start != undefined ? availableUtils.convert(start, 'Date').valueOf() : null; + var finalEnd = end != undefined ? availableUtils.convert(end, 'Date').valueOf() : null; + this._cancelAnimation(); + this.millisecondsPerPixelCache = undefined; + if (options.animation) { + // true or an Object + var initStart = this.start; + var initEnd = this.end; + var duration = _typeof$1(options.animation) === 'object' && 'duration' in options.animation ? options.animation.duration : 500; + var easingName = _typeof$1(options.animation) === 'object' && 'easingFunction' in options.animation ? options.animation.easingFunction : 'easeInOutQuad'; + var easingFunction = availableUtils.easingFunctions[easingName]; + if (!easingFunction) { + var _context8; + throw new Error(_concatInstanceProperty(_context8 = "Unknown easing function ".concat(_JSON$stringify(easingName), ". Choose from: ")).call(_context8, _Object$keys(availableUtils.easingFunctions).join(', '))); + } + var initTime = _Date$now(); + var anyChanged = false; + var next = function next() { + if (!me.props.touch.dragging) { + var now = _Date$now(); + var time = now - initTime; + var ease = easingFunction(time / duration); + var done = time > duration; + var s = done || finalStart === null ? finalStart : initStart + (finalStart - initStart) * ease; + var e = done || finalEnd === null ? finalEnd : initEnd + (finalEnd - initEnd) * ease; + changed = me._applyRange(s, e); + updateHiddenDates(me.options.moment, me.body, me.options.hiddenDates); + anyChanged = anyChanged || changed; + var params = { + start: new Date(me.start), + end: new Date(me.end), + byUser: options.byUser, + event: options.event + }; + if (frameCallback) { + frameCallback(ease, changed, done); + } + if (changed) { + me.body.emitter.emit('rangechange', params); + } + if (done) { + if (anyChanged) { + me.body.emitter.emit('rangechanged', params); + if (callback) { + return callback(); + } + } + } else { + // animate with as high as possible frame rate, leave 20 ms in between + // each to prevent the browser from blocking + me.animationTimer = _setTimeout(next, 20); + } + } + }; + return next(); + } else { + var changed = this._applyRange(finalStart, finalEnd); + updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); + if (changed) { + var params = { + start: new Date(this.start), + end: new Date(this.end), + byUser: options.byUser, + event: options.event + }; + this.body.emitter.emit('rangechange', params); + clearTimeout(me.timeoutID); + me.timeoutID = _setTimeout(function () { + me.body.emitter.emit('rangechanged', params); + }, 200); + if (callback) { + return callback(); + } + } + } + } + + /** + * Get the number of milliseconds per pixel. + * + * @returns {undefined|number} + */ + }, { + key: "getMillisecondsPerPixel", + value: function getMillisecondsPerPixel() { + if (this.millisecondsPerPixelCache === undefined) { + this.millisecondsPerPixelCache = (this.end - this.start) / this.body.dom.center.clientWidth; + } + return this.millisecondsPerPixelCache; + } + + /** + * Stop an animation + * @private + */ + }, { + key: "_cancelAnimation", + value: function _cancelAnimation() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + } + } + + /** + * Set a new start and end range. This method is the same as setRange, but + * does not trigger a range change and range changed event, and it returns + * true when the range is changed + * @param {number} [start] + * @param {number} [end] + * @return {boolean} changed + * @private + */ + }, { + key: "_applyRange", + value: function _applyRange(start, end) { + var newStart = start != null ? availableUtils.convert(start, 'Date').valueOf() : this.start; + var newEnd = end != null ? availableUtils.convert(end, 'Date').valueOf() : this.end; + var max = this.options.max != null ? availableUtils.convert(this.options.max, 'Date').valueOf() : null; + var min = this.options.min != null ? availableUtils.convert(this.options.min, 'Date').valueOf() : null; + var diff; + + // check for valid number + if (isNaN(newStart) || newStart === null) { + throw new Error("Invalid start \"".concat(start, "\"")); + } + if (isNaN(newEnd) || newEnd === null) { + throw new Error("Invalid end \"".concat(end, "\"")); + } + + // prevent end < start + if (newEnd < newStart) { + newEnd = newStart; + } + + // prevent start < min + if (min !== null) { + if (newStart < min) { + diff = min - newStart; + newStart += diff; + newEnd += diff; + + // prevent end > max + if (max != null) { + if (newEnd > max) { + newEnd = max; + } + } + } + } + + // prevent end > max + if (max !== null) { + if (newEnd > max) { + diff = newEnd - max; + newStart -= diff; + newEnd -= diff; + + // prevent start < min + if (min != null) { + if (newStart < min) { + newStart = min; + } + } + } + } + + // prevent (end-start) < zoomMin + if (this.options.zoomMin !== null) { + var zoomMin = _parseFloat$1(this.options.zoomMin); + if (zoomMin < 0) { + zoomMin = 0; + } + if (newEnd - newStart < zoomMin) { + // compensate for a scale of 0.5 ms + var compensation = 0.5; + if (this.end - this.start === zoomMin && newStart >= this.start - compensation && newEnd <= this.end) { + // ignore this action, we are already zoomed to the minimum + newStart = this.start; + newEnd = this.end; + } else { + // zoom to the minimum + diff = zoomMin - (newEnd - newStart); + newStart -= diff / 2; + newEnd += diff / 2; + } + } + } + + // prevent (end-start) > zoomMax + if (this.options.zoomMax !== null) { + var zoomMax = _parseFloat$1(this.options.zoomMax); + if (zoomMax < 0) { + zoomMax = 0; + } + if (newEnd - newStart > zoomMax) { + if (this.end - this.start === zoomMax && newStart < this.start && newEnd > this.end) { + // ignore this action, we are already zoomed to the maximum + newStart = this.start; + newEnd = this.end; + } else { + // zoom to the maximum + diff = newEnd - newStart - zoomMax; + newStart += diff / 2; + newEnd -= diff / 2; + } + } + } + var changed = this.start != newStart || this.end != newEnd; + + // if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not necessarily of type Range) + if (!(newStart >= this.start && newStart <= this.end || newEnd >= this.start && newEnd <= this.end) && !(this.start >= newStart && this.start <= newEnd || this.end >= newStart && this.end <= newEnd)) { + this.body.emitter.emit('checkRangedItems'); + } + this.start = newStart; + this.end = newEnd; + return changed; + } + + /** + * Retrieve the current range. + * @return {Object} An object with start and end properties + */ + }, { + key: "getRange", + value: function getRange() { + return { + start: this.start, + end: this.end + }; + } + + /** + * Calculate the conversion offset and scale for current range, based on + * the provided width + * @param {number} width + * @param {number} [totalHidden=0] + * @returns {{offset: number, scale: number}} conversion + */ + }, { + key: "conversion", + value: function conversion(width, totalHidden) { + return Range.conversion(this.start, this.end, width, totalHidden); + } + + /** + * Static method to calculate the conversion offset and scale for a range, + * based on the provided start, end, and width + * @param {number} start + * @param {number} end + * @param {number} width + * @param {number} [totalHidden=0] + * @returns {{offset: number, scale: number}} conversion + */ + }, { + key: "_onDragStart", + value: + /** + * Start dragging horizontally or vertically + * @param {Event} event + * @private + */ + function _onDragStart(event) { + this.deltaDifference = 0; + this.previousDelta = 0; + + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // only start dragging when the mouse is inside the current range + if (!this._isInsideRange(event)) return; + + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + this.stopRolling(); + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.dragging = true; + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'move'; + } + } + + /** + * Perform dragging operation + * @param {Event} event + * @private + */ + }, { + key: "_onDrag", + value: function _onDrag(event) { + if (!event) return; + if (!this.props.touch.dragging) return; + + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // TODO: this may be redundant in hammerjs2 + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + var direction = this.options.direction; + validateDirection(direction); + var delta = direction == 'horizontal' ? event.deltaX : event.deltaY; + delta -= this.deltaDifference; + var interval = this.props.touch.end - this.props.touch.start; + + // normalize dragging speed if cutout is in between. + var duration = getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + interval -= duration; + var width = direction == 'horizontal' ? this.body.domProps.center.width : this.body.domProps.center.height; + var diffRange; + if (this.options.rtl) { + diffRange = delta / width * interval; + } else { + diffRange = -delta / width * interval; + } + var newStart = this.props.touch.start + diffRange; + var newEnd = this.props.touch.end + diffRange; + + // snapping times away from hidden zones + var safeStart = snapAwayFromHidden(this.body.hiddenDates, newStart, this.previousDelta - delta, true); + var safeEnd = snapAwayFromHidden(this.body.hiddenDates, newEnd, this.previousDelta - delta, true); + if (safeStart != newStart || safeEnd != newEnd) { + this.deltaDifference += delta; + this.props.touch.start = safeStart; + this.props.touch.end = safeEnd; + this._onDrag(event); + return; + } + this.previousDelta = delta; + this._applyRange(newStart, newEnd); + var startDate = new Date(this.start); + var endDate = new Date(this.end); + + // fire a rangechange event + this.body.emitter.emit('rangechange', { + start: startDate, + end: endDate, + byUser: true, + event: event + }); + + // fire a panmove event + this.body.emitter.emit('panmove'); + } + + /** + * Stop dragging operation + * @param {event} event + * @private + */ + }, { + key: "_onDragEnd", + value: function _onDragEnd(event) { + if (!this.props.touch.dragging) return; + + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // TODO: this may be redundant in hammerjs2 + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + this.props.touch.dragging = false; + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'auto'; + } + + // fire a rangechanged event + this.body.emitter.emit('rangechanged', { + start: new Date(this.start), + end: new Date(this.end), + byUser: true, + event: event + }); + } + + /** + * Event handler for mouse wheel event, used to zoom + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {Event} event + * @private + */ + }, { + key: "_onMouseWheel", + value: function _onMouseWheel(event) { + // retrieve delta + var delta = 0; + if (event.wheelDelta) { + /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { + /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; + } else if (event.deltaY) { + delta = -event.deltaY / 3; + } + + // don't allow zoom when the according key is pressed and the zoomKey option or not zoomable but movable + if (this.options.zoomKey && !event[this.options.zoomKey] && this.options.zoomable || !this.options.zoomable && this.options.moveable) { + return; + } + + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + // only zoom when the mouse is inside the current range + if (!this._isInsideRange(event)) return; + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + // perform the zoom action. Delta is normally 1 or -1 + + // adjust a negative delta such that zooming in with delta 0.1 + // equals zooming out with a delta -0.1 + + var zoomFriction = this.options.zoomFriction || 5; + var scale; + if (delta < 0) { + scale = 1 - delta / zoomFriction; + } else { + scale = 1 / (1 + delta / zoomFriction); + } + + // calculate center, the date to zoom around + var pointerDate; + if (this.rolling) { + var rollingModeOffset = this.options.rollingMode && this.options.rollingMode.offset || 0.5; + pointerDate = this.start + (this.end - this.start) * rollingModeOffset; + } else { + var pointer = this.getPointer({ + x: event.clientX, + y: event.clientY + }, this.body.dom.center); + pointerDate = this._pointerToDate(pointer); + } + this.zoom(scale, pointerDate, delta, event); + + // Prevent default actions caused by mouse wheel + // (else the page and timeline both scroll) + event.preventDefault(); + } + } + + /** + * Start of a touch gesture + * @param {Event} event + * @private + */ + }, { + key: "_onTouch", + value: function _onTouch(event) { + // eslint-disable-line no-unused-vars + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.allowDragging = true; + this.props.touch.center = null; + this.props.touch.centerDate = null; + this.scaleOffset = 0; + this.deltaDifference = 0; + // Disable the browser default handling of this event. + availableUtils.preventDefault(event); + } + + /** + * Handle pinch event + * @param {Event} event + * @private + */ + }, { + key: "_onPinch", + value: function _onPinch(event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + // Disable the browser default handling of this event. + availableUtils.preventDefault(event); + this.props.touch.allowDragging = false; + if (!this.props.touch.center) { + this.props.touch.center = this.getPointer(event.center, this.body.dom.center); + this.props.touch.centerDate = this._pointerToDate(this.props.touch.center); + } + this.stopRolling(); + var scale = 1 / (event.scale + this.scaleOffset); + var centerDate = this.props.touch.centerDate; + var hiddenDuration = getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + var hiddenDurationBefore = getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, centerDate); + var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; + + // calculate new start and end + var newStart = centerDate - hiddenDurationBefore + (this.props.touch.start - (centerDate - hiddenDurationBefore)) * scale; + var newEnd = centerDate + hiddenDurationAfter + (this.props.touch.end - (centerDate + hiddenDurationAfter)) * scale; + + // snapping times away from hidden zones + this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times + this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times + + var safeStart = snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); + var safeEnd = snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); + if (safeStart != newStart || safeEnd != newEnd) { + this.props.touch.start = safeStart; + this.props.touch.end = safeEnd; + this.scaleOffset = 1 - event.scale; + newStart = safeStart; + newEnd = safeEnd; + } + var options = { + animation: false, + byUser: true, + event: event + }; + this.setRange(newStart, newEnd, options); + this.startToFront = false; // revert to default + this.endToFront = true; // revert to default + } + + /** + * Test whether the mouse from a mouse event is inside the visible window, + * between the current start and end date + * @param {Object} event + * @return {boolean} Returns true when inside the visible window + * @private + */ + }, { + key: "_isInsideRange", + value: function _isInsideRange(event) { + // calculate the time where the mouse is, check whether inside + // and no scroll action should happen. + var clientX = event.center ? event.center.x : event.clientX; + var centerContainerRect = this.body.dom.centerContainer.getBoundingClientRect(); + var x = this.options.rtl ? clientX - centerContainerRect.left : centerContainerRect.right - clientX; + var time = this.body.util.toTime(x); + return time >= this.start && time <= this.end; + } + + /** + * Helper function to calculate the center date for zooming + * @param {{x: number, y: number}} pointer + * @return {number} date + * @private + */ + }, { + key: "_pointerToDate", + value: function _pointerToDate(pointer) { + var conversion; + var direction = this.options.direction; + validateDirection(direction); + if (direction == 'horizontal') { + return this.body.util.toTime(pointer.x).valueOf(); + } else { + var height = this.body.domProps.center.height; + conversion = this.conversion(height); + return pointer.y / conversion.scale + conversion.offset; + } + } + + /** + * Get the pointer location relative to the location of the dom element + * @param {{x: number, y: number}} touch + * @param {Element} element HTML DOM element + * @return {{x: number, y: number}} pointer + * @private + */ + }, { + key: "getPointer", + value: function getPointer(touch, element) { + var elementRect = element.getBoundingClientRect(); + if (this.options.rtl) { + return { + x: elementRect.right - touch.x, + y: touch.y - elementRect.top + }; + } else { + return { + x: touch.x - elementRect.left, + y: touch.y - elementRect.top + }; + } + } + + /** + * Zoom the range the given scale in or out. Start and end date will + * be adjusted, and the timeline will be redrawn. You can optionally give a + * date around which to zoom. + * For example, try scale = 0.9 or 1.1 + * @param {number} scale Scaling factor. Values above 1 will zoom out, + * values below 1 will zoom in. + * @param {number} [center] Value representing a date around which will + * be zoomed. + * @param {number} delta + * @param {Event} event + */ + }, { + key: "zoom", + value: function zoom(scale, center, delta, event) { + // if centerDate is not provided, take it half between start Date and end Date + if (center == null) { + center = (this.start + this.end) / 2; + } + var hiddenDuration = getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + var hiddenDurationBefore = getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, center); + var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; + + // calculate new start and end + var newStart = center - hiddenDurationBefore + (this.start - (center - hiddenDurationBefore)) * scale; + var newEnd = center + hiddenDurationAfter + (this.end - (center + hiddenDurationAfter)) * scale; + + // snapping times away from hidden zones + this.startToFront = delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times + this.endToFront = -delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times + var safeStart = snapAwayFromHidden(this.body.hiddenDates, newStart, delta, true); + var safeEnd = snapAwayFromHidden(this.body.hiddenDates, newEnd, -delta, true); + if (safeStart != newStart || safeEnd != newEnd) { + newStart = safeStart; + newEnd = safeEnd; + } + var options = { + animation: false, + byUser: true, + event: event + }; + this.setRange(newStart, newEnd, options); + this.startToFront = false; // revert to default + this.endToFront = true; // revert to default + } + + /** + * Move the range with a given delta to the left or right. Start and end + * value will be adjusted. For example, try delta = 0.1 or -0.1 + * @param {number} delta Moving amount. Positive value will move right, + * negative value will move left + */ + }, { + key: "move", + value: function move(delta) { + // zoom start Date and end Date relative to the centerDate + var diff = this.end - this.start; + + // apply new values + var newStart = this.start + diff * delta; + var newEnd = this.end + diff * delta; + + // TODO: reckon with min and max range + + this.start = newStart; + this.end = newEnd; + } + + /** + * Move the range to a new center point + * @param {number} moveTo New center point of the range + */ + }, { + key: "moveTo", + value: function moveTo(_moveTo) { + var center = (this.start + this.end) / 2; + var diff = center - _moveTo; + + // calculate new start and end + var newStart = this.start - diff; + var newEnd = this.end - diff; + var options = { + animation: false, + byUser: true, + event: null + }; + this.setRange(newStart, newEnd, options); + } + + /** + * Destroy the Range + */ + }, { + key: "destroy", + value: function destroy() { + this.stopRolling(); + } + }], [{ + key: "conversion", + value: function conversion(start, end, width, totalHidden) { + if (totalHidden === undefined) { + totalHidden = 0; + } + if (width != 0 && end - start != 0) { + return { + offset: start, + scale: width / (end - start - totalHidden) + }; + } else { + return { + offset: 0, + scale: 1 + }; + } + } + }]); + return Range; + }(Component); + function validateDirection(direction) { + if (direction != 'horizontal' && direction != 'vertical') { + throw new TypeError("Unknown direction \"".concat(direction, "\". Choose \"horizontal\" or \"vertical\".")); + } + } + + var path = path$u; + + var setInterval$1 = path.setInterval; + + var setInterval = setInterval$1; + + var _setInterval = /*@__PURE__*/getDefaultExportFromCjs(setInterval); + + var _firstTarget = null; // singleton, will contain the target element where the touch event started + + /** + * Extend an Hammer.js instance with event propagation. + * + * Features: + * - Events emitted by hammer will propagate in order from child to parent + * elements. + * - Events are extended with a function `event.stopPropagation()` to stop + * propagation to parent elements. + * - An option `preventDefault` to stop all default browser behavior. + * + * Usage: + * var hammer = propagatingHammer(new Hammer(element)); + * var hammer = propagatingHammer(new Hammer(element), {preventDefault: true}); + * + * @param {Hammer.Manager} hammer An hammer instance. + * @param {Object} [options] Available options: + * - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`. + * Enforce preventing the default browser behavior. + * Cannot be set to `false`. + * @return {Hammer.Manager} Returns the same hammer instance with extended + * functionality + */ + function propagating(hammer, options) { + var _options = options || { + preventDefault: false + }; + + if (hammer.Manager) { + // This looks like the Hammer constructor. + // Overload the constructors with our own. + var Hammer = hammer; + + var PropagatingHammer = function(element, options) { + var o = Object.create(_options); + if (options) Hammer.assign(o, options); + return propagating(new Hammer(element, o), o); + }; + Hammer.assign(PropagatingHammer, Hammer); + + PropagatingHammer.Manager = function (element, options) { + var o = Object.create(_options); + if (options) Hammer.assign(o, options); + return propagating(new Hammer.Manager(element, o), o); + }; + + return PropagatingHammer; + } + + // create a wrapper object which will override the functions + // `on`, `off`, `destroy`, and `emit` of the hammer instance + var wrapper = Object.create(hammer); + + // attach to DOM element + var element = hammer.element; + + if(!element.hammer) element.hammer = []; + element.hammer.push(wrapper); + + // register an event to catch the start of a gesture and store the + // target in a singleton + hammer.on('hammer.input', function (event) { + if (_options.preventDefault === true || (_options.preventDefault === event.pointerType)) { + event.preventDefault(); + } + if (event.isFirst) { + _firstTarget = event.target; + } + }); + + /** @type {Object.>} */ + wrapper._handlers = {}; + + /** + * Register a handler for one or multiple events + * @param {String} events A space separated string with events + * @param {function} handler A callback function, called as handler(event) + * @returns {Hammer.Manager} Returns the hammer instance + */ + wrapper.on = function (events, handler) { + // register the handler + split(events).forEach(function (event) { + var _handlers = wrapper._handlers[event]; + if (!_handlers) { + wrapper._handlers[event] = _handlers = []; + + // register the static, propagated handler + hammer.on(event, propagatedHandler); + } + _handlers.push(handler); + }); + + return wrapper; + }; + + /** + * Unregister a handler for one or multiple events + * @param {String} events A space separated string with events + * @param {function} [handler] Optional. The registered handler. If not + * provided, all handlers for given events + * are removed. + * @returns {Hammer.Manager} Returns the hammer instance + */ + wrapper.off = function (events, handler) { + // unregister the handler + split(events).forEach(function (event) { + var _handlers = wrapper._handlers[event]; + if (_handlers) { + _handlers = handler ? _handlers.filter(function (h) { + return h !== handler; + }) : []; + + if (_handlers.length > 0) { + wrapper._handlers[event] = _handlers; + } + else { + // remove static, propagated handler + hammer.off(event, propagatedHandler); + delete wrapper._handlers[event]; + } + } + }); + + return wrapper; + }; + + /** + * Emit to the event listeners + * @param {string} eventType + * @param {Event} event + */ + wrapper.emit = function(eventType, event) { + _firstTarget = event.target; + hammer.emit(eventType, event); + }; + + wrapper.destroy = function () { + // Detach from DOM element + var hammers = hammer.element.hammer; + var idx = hammers.indexOf(wrapper); + if(idx !== -1) hammers.splice(idx,1); + if(!hammers.length) delete hammer.element.hammer; + + // clear all handlers + wrapper._handlers = {}; + + // call original hammer destroy + hammer.destroy(); + }; + + // split a string with space separated words + function split(events) { + return events.match(/[^ ]+/g); + } + + /** + * A static event handler, applying event propagation. + * @param {Object} event + */ + function propagatedHandler(event) { + // let only a single hammer instance handle this event + if (event.type !== 'hammer.input') { + // it is possible that the same srcEvent is used with multiple hammer events, + // we keep track on which events are handled in an object _handled + if (!event.srcEvent._handled) { + event.srcEvent._handled = {}; + } + + if (event.srcEvent._handled[event.type]) { + return; + } + else { + event.srcEvent._handled[event.type] = true; + } + } + + // attach a stopPropagation function to the event + var stopped = false; + event.stopPropagation = function () { + stopped = true; + }; + + //wrap the srcEvent's stopPropagation to also stop hammer propagation: + var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent); + if(typeof srcStop == "function") { + event.srcEvent.stopPropagation = function(){ + srcStop(); + event.stopPropagation(); + }; + } + + // attach firstTarget property to the event + event.firstTarget = _firstTarget; + + // propagate over all elements (until stopped) + var elem = _firstTarget; + while (elem && !stopped) { + var elemHammer = elem.hammer; + if(elemHammer){ + var _handlers; + for(var k = 0; k < elemHammer.length; k++){ + _handlers = elemHammer[k]._handlers[event.type]; + if(_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) { + _handlers[i](event); + } + } + } + elem = elem.parentNode; + } + } + + return wrapper; + } + + /** + * Setup a mock hammer.js object, for unit testing. + * + * Inspiration: https://github.com/uber/deck.gl/pull/658 + * + * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} + */ + function hammerMock() { + var noop = function noop() {}; + return { + on: noop, + off: noop, + destroy: noop, + emit: noop, + get: function get(m) { + //eslint-disable-line no-unused-vars + return { + set: noop + }; + } + }; + } + var modifiedHammer; + if (typeof window !== 'undefined') { + var OurHammer = window['Hammer'] || Hammer$4; + modifiedHammer = propagating(OurHammer, { + preventDefault: 'mouse' + }); + } else { + modifiedHammer = function modifiedHammer() { + return ( + // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object. + hammerMock() + ); + }; + } + var Hammer = modifiedHammer; + + /** + * Register a touch event, taking place before a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + */ + function onTouch(hammer, callback) { + callback.inputHandler = function (event) { + if (event.isFirst) { + callback(event); + } + }; + hammer.on('hammer.input', callback.inputHandler); + } + + /** + * Register a release event, taking place after a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + * @returns {*} + */ + function onRelease(hammer, callback) { + callback.inputHandler = function (event) { + if (event.isFinal) { + callback(event); + } + }; + return hammer.on('hammer.input', callback.inputHandler); + } + + /** + * Hack the PinchRecognizer such that it doesn't prevent default behavior + * for vertical panning. + * + * Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932 + * + * @param {Hammer.Pinch} pinchRecognizer + * @return {Hammer.Pinch} returns the pinchRecognizer + */ + function disablePreventDefaultVertically(pinchRecognizer) { + var TOUCH_ACTION_PAN_Y = 'pan-y'; + pinchRecognizer.getTouchAction = function () { + // default method returns [TOUCH_ACTION_NONE] + return [TOUCH_ACTION_PAN_Y]; + }; + return pinchRecognizer; + } + + /** + * The class TimeStep is an iterator for dates. You provide a start date and an + * end date. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + */ + var TimeStep = /*#__PURE__*/function () { + /** + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {number} [minimumStep] Optional. Minimum step size in milliseconds + * @param {Date|Array.} [hiddenDates] Optional. + * @param {{showMajorLabels: boolean, showWeekScale: boolean}} [options] Optional. + * @constructor TimeStep + */ + function TimeStep(start, end, minimumStep, hiddenDates, options) { + _classCallCheck(this, TimeStep); + this.moment = options && options.moment || moment$4; + this.options = options ? options : {}; + + // variables + this.current = this.moment(); + this._start = this.moment(); + this._end = this.moment(); + this.autoScale = true; + this.scale = 'day'; + this.step = 1; + + // initialize the range + this.setRange(start, end, minimumStep); + + // hidden Dates options + this.switchedDay = false; + this.switchedMonth = false; + this.switchedYear = false; + if (_Array$isArray(hiddenDates)) { + this.hiddenDates = hiddenDates; + } else if (hiddenDates != undefined) { + this.hiddenDates = [hiddenDates]; + } else { + this.hiddenDates = []; + } + this.format = TimeStep.FORMAT; // default formatting + } + + /** + * Set custom constructor function for moment. Can be used to set dates + * to UTC or to set a utcOffset. + * @param {function} moment + */ + _createClass(TimeStep, [{ + key: "setMoment", + value: function setMoment(moment) { + this.moment = moment; + + // update the date properties, can have a new utcOffset + this.current = this.moment(this.current.valueOf()); + this._start = this.moment(this._start.valueOf()); + this._end = this.moment(this._end.valueOf()); + } + + /** + * Set custom formatting for the minor an major labels of the TimeStep. + * Both `minorLabels` and `majorLabels` are an Object with properties: + * 'millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. + * @param {{minorLabels: Object, majorLabels: Object}} format + */ + }, { + key: "setFormat", + value: function setFormat(format) { + var defaultFormat = availableUtils.deepExtend({}, TimeStep.FORMAT); + this.format = availableUtils.deepExtend(defaultFormat, format); + } + + /** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Date} [start] The start date and time. + * @param {Date} [end] The end date and time. + * @param {int} [minimumStep] Optional. Minimum step size in milliseconds + */ + }, { + key: "setRange", + value: function setRange(start, end, minimumStep) { + if (!(start instanceof Date) || !(end instanceof Date)) { + throw "No legal start or end date in method setRange"; + } + this._start = start != undefined ? this.moment(start.valueOf()) : _Date$now(); + this._end = end != undefined ? this.moment(end.valueOf()) : _Date$now(); + if (this.autoScale) { + this.setMinimumStep(minimumStep); + } + } + + /** + * Set the range iterator to the start date. + */ + }, { + key: "start", + value: function start() { + this.current = this._start.clone(); + this.roundToMinor(); + } + + /** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ + }, { + key: "roundToMinor", + value: function roundToMinor() { + // round to floor + // to prevent year & month scales rounding down to the first day of week we perform this separately + if (this.scale == 'week') { + this.current.weekday(0); + } + // IMPORTANT: we have no breaks in this switch! (this is no bug) + // noinspection FallThroughInSwitchStatementJS + switch (this.scale) { + case 'year': + this.current.year(this.step * Math.floor(this.current.year() / this.step)); + this.current.month(0); + // eslint-disable-line no-fallthrough + case 'month': + this.current.date(1); + // eslint-disable-line no-fallthrough + case 'week': // eslint-disable-line no-fallthrough + case 'day': // eslint-disable-line no-fallthrough + case 'weekday': + this.current.hours(0); + // eslint-disable-line no-fallthrough + case 'hour': + this.current.minutes(0); + // eslint-disable-line no-fallthrough + case 'minute': + this.current.seconds(0); + // eslint-disable-line no-fallthrough + case 'second': + this.current.milliseconds(0); + // eslint-disable-line no-fallthrough + //case 'millisecond': // nothing to do for milliseconds + } + + if (this.step != 1) { + // round down to the first minor value that is a multiple of the current step size + var priorCurrent = this.current.clone(); + switch (this.scale) { + case 'millisecond': + this.current.subtract(this.current.milliseconds() % this.step, 'milliseconds'); + break; + case 'second': + this.current.subtract(this.current.seconds() % this.step, 'seconds'); + break; + case 'minute': + this.current.subtract(this.current.minutes() % this.step, 'minutes'); + break; + case 'hour': + this.current.subtract(this.current.hours() % this.step, 'hours'); + break; + case 'weekday': // intentional fall through + case 'day': + this.current.subtract((this.current.date() - 1) % this.step, 'day'); + break; + case 'week': + this.current.subtract(this.current.week() % this.step, 'week'); + break; + case 'month': + this.current.subtract(this.current.month() % this.step, 'month'); + break; + case 'year': + this.current.subtract(this.current.year() % this.step, 'year'); + break; + } + if (!priorCurrent.isSame(this.current)) { + this.current = this.moment(snapAwayFromHidden(this.hiddenDates, this.current.valueOf(), -1, true)); + } + } + } + + /** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ + }, { + key: "hasNext", + value: function hasNext() { + return this.current.valueOf() <= this._end.valueOf(); + } + + /** + * Do the next step + */ + }, { + key: "next", + value: function next() { + var prev = this.current.valueOf(); + + // Two cases, needed to prevent issues with switching daylight savings + // (end of March and end of October) + switch (this.scale) { + case 'millisecond': + this.current.add(this.step, 'millisecond'); + break; + case 'second': + this.current.add(this.step, 'second'); + break; + case 'minute': + this.current.add(this.step, 'minute'); + break; + case 'hour': + this.current.add(this.step, 'hour'); + if (this.current.month() < 6) { + this.current.subtract(this.current.hours() % this.step, 'hour'); + } else { + if (this.current.hours() % this.step !== 0) { + this.current.add(this.step - this.current.hours() % this.step, 'hour'); + } + } + break; + case 'weekday': // intentional fall through + case 'day': + this.current.add(this.step, 'day'); + break; + case 'week': + if (this.current.weekday() !== 0) { + // we had a month break not correlating with a week's start before + this.current.weekday(0); // switch back to week cycles + this.current.add(this.step, 'week'); + } else if (this.options.showMajorLabels === false) { + this.current.add(this.step, 'week'); // the default case + } else { + // first day of the week + var nextWeek = this.current.clone(); + nextWeek.add(1, 'week'); + if (nextWeek.isSame(this.current, 'month')) { + // is the first day of the next week in the same month? + this.current.add(this.step, 'week'); // the default case + } else { + // inject a step at each first day of the month + this.current.add(this.step, 'week'); + this.current.date(1); + } + } + break; + case 'month': + this.current.add(this.step, 'month'); + break; + case 'year': + this.current.add(this.step, 'year'); + break; + } + if (this.step != 1) { + // round down to the correct major value + switch (this.scale) { + case 'millisecond': + if (this.current.milliseconds() > 0 && this.current.milliseconds() < this.step) this.current.milliseconds(0); + break; + case 'second': + if (this.current.seconds() > 0 && this.current.seconds() < this.step) this.current.seconds(0); + break; + case 'minute': + if (this.current.minutes() > 0 && this.current.minutes() < this.step) this.current.minutes(0); + break; + case 'hour': + if (this.current.hours() > 0 && this.current.hours() < this.step) this.current.hours(0); + break; + case 'weekday': // intentional fall through + case 'day': + if (this.current.date() < this.step + 1) this.current.date(1); + break; + case 'week': + if (this.current.week() < this.step) this.current.week(1); + break; + // week numbering starts at 1, not 0 + case 'month': + if (this.current.month() < this.step) this.current.month(0); + break; + } + } + + // safety mechanism: if current time is still unchanged, move to the end + if (this.current.valueOf() == prev) { + this.current = this._end.clone(); + } + + // Reset switches for year, month and day. Will get set to true where appropriate in DateUtil.stepOverHiddenDates + this.switchedDay = false; + this.switchedMonth = false; + this.switchedYear = false; + stepOverHiddenDates(this.moment, this, prev); + } + + /** + * Get the current datetime + * @return {Moment} current The current date + */ + }, { + key: "getCurrent", + value: function getCurrent() { + return this.current.clone(); + } + + /** + * Set a custom scale. Autoscaling will be disabled. + * For example setScale('minute', 5) will result + * in minor steps of 5 minutes, and major steps of an hour. + * + * @param {{scale: string, step: number}} params + * An object containing two properties: + * - A string 'scale'. Choose from 'millisecond', 'second', + * 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. + * - A number 'step'. A step size, by default 1. + * Choose for example 1, 2, 5, or 10. + */ + }, { + key: "setScale", + value: function setScale(params) { + if (params && typeof params.scale == 'string') { + this.scale = params.scale; + this.step = params.step > 0 ? params.step : 1; + this.autoScale = false; + } + } + + /** + * Enable or disable autoscaling + * @param {boolean} enable If true, autoascaling is set true + */ + }, { + key: "setAutoScale", + value: function setAutoScale(enable) { + this.autoScale = enable; + } + + /** + * Automatically determine the scale that bests fits the provided minimum step + * @param {number} [minimumStep] The minimum step size in milliseconds + */ + }, { + key: "setMinimumStep", + value: function setMinimumStep(minimumStep) { + if (minimumStep == undefined) { + return; + } + + //var b = asc + ds; + + var stepYear = 1000 * 60 * 60 * 24 * 30 * 12; + var stepMonth = 1000 * 60 * 60 * 24 * 30; + var stepDay = 1000 * 60 * 60 * 24; + var stepHour = 1000 * 60 * 60; + var stepMinute = 1000 * 60; + var stepSecond = 1000; + var stepMillisecond = 1; + + // find the smallest step that is larger than the provided minimumStep + if (stepYear * 1000 > minimumStep) { + this.scale = 'year'; + this.step = 1000; + } + if (stepYear * 500 > minimumStep) { + this.scale = 'year'; + this.step = 500; + } + if (stepYear * 100 > minimumStep) { + this.scale = 'year'; + this.step = 100; + } + if (stepYear * 50 > minimumStep) { + this.scale = 'year'; + this.step = 50; + } + if (stepYear * 10 > minimumStep) { + this.scale = 'year'; + this.step = 10; + } + if (stepYear * 5 > minimumStep) { + this.scale = 'year'; + this.step = 5; + } + if (stepYear > minimumStep) { + this.scale = 'year'; + this.step = 1; + } + if (stepMonth * 3 > minimumStep) { + this.scale = 'month'; + this.step = 3; + } + if (stepMonth > minimumStep) { + this.scale = 'month'; + this.step = 1; + } + if (stepDay * 7 > minimumStep && this.options.showWeekScale) { + this.scale = 'week'; + this.step = 1; + } + if (stepDay * 2 > minimumStep) { + this.scale = 'day'; + this.step = 2; + } + if (stepDay > minimumStep) { + this.scale = 'day'; + this.step = 1; + } + if (stepDay / 2 > minimumStep) { + this.scale = 'weekday'; + this.step = 1; + } + if (stepHour * 4 > minimumStep) { + this.scale = 'hour'; + this.step = 4; + } + if (stepHour > minimumStep) { + this.scale = 'hour'; + this.step = 1; + } + if (stepMinute * 15 > minimumStep) { + this.scale = 'minute'; + this.step = 15; + } + if (stepMinute * 10 > minimumStep) { + this.scale = 'minute'; + this.step = 10; + } + if (stepMinute * 5 > minimumStep) { + this.scale = 'minute'; + this.step = 5; + } + if (stepMinute > minimumStep) { + this.scale = 'minute'; + this.step = 1; + } + if (stepSecond * 15 > minimumStep) { + this.scale = 'second'; + this.step = 15; + } + if (stepSecond * 10 > minimumStep) { + this.scale = 'second'; + this.step = 10; + } + if (stepSecond * 5 > minimumStep) { + this.scale = 'second'; + this.step = 5; + } + if (stepSecond > minimumStep) { + this.scale = 'second'; + this.step = 1; + } + if (stepMillisecond * 200 > minimumStep) { + this.scale = 'millisecond'; + this.step = 200; + } + if (stepMillisecond * 100 > minimumStep) { + this.scale = 'millisecond'; + this.step = 100; + } + if (stepMillisecond * 50 > minimumStep) { + this.scale = 'millisecond'; + this.step = 50; + } + if (stepMillisecond * 10 > minimumStep) { + this.scale = 'millisecond'; + this.step = 10; + } + if (stepMillisecond * 5 > minimumStep) { + this.scale = 'millisecond'; + this.step = 5; + } + if (stepMillisecond > minimumStep) { + this.scale = 'millisecond'; + this.step = 1; + } + } + + /** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * Static function + * @param {Date} date the date to be snapped. + * @param {string} scale Current scale, can be 'millisecond', 'second', + * 'minute', 'hour', 'weekday, 'day', 'week', 'month', 'year'. + * @param {number} step Current step (1, 2, 4, 5, ... + * @return {Date} snappedDate + */ + }, { + key: "isMajor", + value: + /** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ + function isMajor() { + if (this.switchedYear == true) { + switch (this.scale) { + case 'year': + case 'month': + case 'week': + case 'weekday': + case 'day': + case 'hour': + case 'minute': + case 'second': + case 'millisecond': + return true; + default: + return false; + } + } else if (this.switchedMonth == true) { + switch (this.scale) { + case 'week': + case 'weekday': + case 'day': + case 'hour': + case 'minute': + case 'second': + case 'millisecond': + return true; + default: + return false; + } + } else if (this.switchedDay == true) { + switch (this.scale) { + case 'millisecond': + case 'second': + case 'minute': + case 'hour': + return true; + default: + return false; + } + } + var date = this.moment(this.current); + switch (this.scale) { + case 'millisecond': + return date.milliseconds() == 0; + case 'second': + return date.seconds() == 0; + case 'minute': + return date.hours() == 0 && date.minutes() == 0; + case 'hour': + return date.hours() == 0; + case 'weekday': // intentional fall through + case 'day': + return this.options.showWeekScale ? date.isoWeekday() == 1 : date.date() == 1; + case 'week': + return date.date() == 1; + case 'month': + return date.month() == 0; + case 'year': + return false; + default: + return false; + } + } + + /** + * Returns formatted text for the minor axislabel, depending on the current + * date and the scale. For example when scale is MINUTE, the current time is + * formatted as "hh:mm". + * @param {Date} [date=this.current] custom date. if not provided, current date is taken + * @returns {String} + */ + }, { + key: "getLabelMinor", + value: function getLabelMinor(date) { + if (date == undefined) { + date = this.current; + } + if (date instanceof Date) { + date = this.moment(date); + } + if (typeof this.format.minorLabels === "function") { + return this.format.minorLabels(date, this.scale, this.step); + } + var format = this.format.minorLabels[this.scale]; + // noinspection FallThroughInSwitchStatementJS + switch (this.scale) { + case 'week': + // Don't draw the minor label if this date is the first day of a month AND if it's NOT the start of the week. + // The 'date' variable may actually be the 'next' step when called from TimeAxis' _repaintLabels. + if (date.date() === 1 && date.weekday() !== 0) { + return ""; + } + default: + // eslint-disable-line no-fallthrough + return format && format.length > 0 ? this.moment(date).format(format) : ''; + } + } + + /** + * Returns formatted text for the major axis label, depending on the current + * date and the scale. For example when scale is MINUTE, the major scale is + * hours, and the hour will be formatted as "hh". + * @param {Date} [date=this.current] custom date. if not provided, current date is taken + * @returns {String} + */ + }, { + key: "getLabelMajor", + value: function getLabelMajor(date) { + if (date == undefined) { + date = this.current; + } + if (date instanceof Date) { + date = this.moment(date); + } + if (typeof this.format.majorLabels === "function") { + return this.format.majorLabels(date, this.scale, this.step); + } + var format = this.format.majorLabels[this.scale]; + return format && format.length > 0 ? this.moment(date).format(format) : ''; + } + + /** + * get class name + * @return {string} class name + */ + }, { + key: "getClassName", + value: function getClassName() { + var _context; + var _moment = this.moment; + var m = this.moment(this.current); + var current = m.locale ? m.locale('en') : m.lang('en'); // old versions of moment have .lang() function + var step = this.step; + var classNames = []; + + /** + * + * @param {number} value + * @returns {String} + */ + function even(value) { + return value / step % 2 == 0 ? ' vis-even' : ' vis-odd'; + } + + /** + * + * @param {Date} date + * @returns {String} + */ + function today(date) { + if (date.isSame(_Date$now(), 'day')) { + return ' vis-today'; + } + if (date.isSame(_moment().add(1, 'day'), 'day')) { + return ' vis-tomorrow'; + } + if (date.isSame(_moment().add(-1, 'day'), 'day')) { + return ' vis-yesterday'; + } + return ''; + } + + /** + * + * @param {Date} date + * @returns {String} + */ + function currentWeek(date) { + return date.isSame(_Date$now(), 'week') ? ' vis-current-week' : ''; + } + + /** + * + * @param {Date} date + * @returns {String} + */ + function currentMonth(date) { + return date.isSame(_Date$now(), 'month') ? ' vis-current-month' : ''; + } + + /** + * + * @param {Date} date + * @returns {String} + */ + function currentYear(date) { + return date.isSame(_Date$now(), 'year') ? ' vis-current-year' : ''; + } + switch (this.scale) { + case 'millisecond': + classNames.push(today(current)); + classNames.push(even(current.milliseconds())); + break; + case 'second': + classNames.push(today(current)); + classNames.push(even(current.seconds())); + break; + case 'minute': + classNames.push(today(current)); + classNames.push(even(current.minutes())); + break; + case 'hour': + classNames.push(_concatInstanceProperty(_context = "vis-h".concat(current.hours())).call(_context, this.step == 4 ? '-h' + (current.hours() + 4) : '')); + classNames.push(today(current)); + classNames.push(even(current.hours())); + break; + case 'weekday': + classNames.push("vis-".concat(current.format('dddd').toLowerCase())); + classNames.push(today(current)); + classNames.push(currentWeek(current)); + classNames.push(even(current.date())); + break; + case 'day': + classNames.push("vis-day".concat(current.date())); + classNames.push("vis-".concat(current.format('MMMM').toLowerCase())); + classNames.push(today(current)); + classNames.push(currentMonth(current)); + classNames.push(this.step <= 2 ? today(current) : ''); + classNames.push(this.step <= 2 ? "vis-".concat(current.format('dddd').toLowerCase()) : ''); + classNames.push(even(current.date() - 1)); + break; + case 'week': + classNames.push("vis-week".concat(current.format('w'))); + classNames.push(currentWeek(current)); + classNames.push(even(current.week())); + break; + case 'month': + classNames.push("vis-".concat(current.format('MMMM').toLowerCase())); + classNames.push(currentMonth(current)); + classNames.push(even(current.month())); + break; + case 'year': + classNames.push("vis-year".concat(current.year())); + classNames.push(currentYear(current)); + classNames.push(even(current.year())); + break; + } + return _filterInstanceProperty(classNames).call(classNames, String).join(" "); + } + }], [{ + key: "snap", + value: function snap(date, scale, step) { + var clone = moment$4(date); + if (scale == 'year') { + var year = clone.year() + Math.round(clone.month() / 12); + clone.year(Math.round(year / step) * step); + clone.month(0); + clone.date(0); + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'month') { + if (clone.date() > 15) { + clone.date(1); + clone.add(1, 'month'); + // important: first set Date to 1, after that change the month. + } else { + clone.date(1); + } + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'week') { + if (clone.weekday() > 2) { + // doing it the momentjs locale aware way + clone.weekday(0); + clone.add(1, 'week'); + } else { + clone.weekday(0); + } + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'day') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 5: + case 2: + clone.hours(Math.round(clone.hours() / 24) * 24); + break; + default: + clone.hours(Math.round(clone.hours() / 12) * 12); + break; + } + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'weekday') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 5: + case 2: + clone.hours(Math.round(clone.hours() / 12) * 12); + break; + default: + clone.hours(Math.round(clone.hours() / 6) * 6); + break; + } + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'hour') { + switch (step) { + case 4: + clone.minutes(Math.round(clone.minutes() / 60) * 60); + break; + default: + clone.minutes(Math.round(clone.minutes() / 30) * 30); + break; + } + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'minute') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 15: + case 10: + clone.minutes(Math.round(clone.minutes() / 5) * 5); + clone.seconds(0); + break; + case 5: + clone.seconds(Math.round(clone.seconds() / 60) * 60); + break; + default: + clone.seconds(Math.round(clone.seconds() / 30) * 30); + break; + } + clone.milliseconds(0); + } else if (scale == 'second') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 15: + case 10: + clone.seconds(Math.round(clone.seconds() / 5) * 5); + clone.milliseconds(0); + break; + case 5: + clone.milliseconds(Math.round(clone.milliseconds() / 1000) * 1000); + break; + default: + clone.milliseconds(Math.round(clone.milliseconds() / 500) * 500); + break; + } + } else if (scale == 'millisecond') { + var _step = step > 5 ? step / 2 : 1; + clone.milliseconds(Math.round(clone.milliseconds() / _step) * _step); + } + return clone; + } + }]); + return TimeStep; + }(); // Time formatting + TimeStep.FORMAT = { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + week: 'w', + month: 'MMM', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + week: 'MMMM YYYY', + month: 'YYYY', + year: '' + } + }; + + function styleInject(css, ref) { + if ( ref === void 0 ) ref = {}; + var insertAt = ref.insertAt; + + if (!css || typeof document === 'undefined') { return; } + + var head = document.head || document.getElementsByTagName('head')[0]; + var style = document.createElement('style'); + style.type = 'text/css'; + + if (insertAt === 'top') { + if (head.firstChild) { + head.insertBefore(style, head.firstChild); + } else { + head.appendChild(style); + } + } else { + head.appendChild(style); + } + + if (style.styleSheet) { + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + } + + var css_248z$e = ".vis-time-axis {\n position: relative;\n overflow: hidden;\n}\n\n.vis-time-axis.vis-foreground {\n top: 0;\n left: 0;\n width: 100%;\n}\n\n.vis-time-axis.vis-background {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.vis-time-axis .vis-text {\n position: absolute;\n color: #4d4d4d;\n padding: 3px;\n overflow: hidden;\n box-sizing: border-box;\n\n white-space: nowrap;\n}\n\n.vis-time-axis .vis-text.vis-measure {\n position: absolute;\n padding-left: 0;\n padding-right: 0;\n margin-left: 0;\n margin-right: 0;\n visibility: hidden;\n}\n\n.vis-time-axis .vis-grid.vis-vertical {\n position: absolute;\n border-left: 1px solid;\n}\n\n.vis-time-axis .vis-grid.vis-vertical-rtl {\n position: absolute;\n border-right: 1px solid;\n}\n\n.vis-time-axis .vis-grid.vis-minor {\n border-color: #e5e5e5;\n}\n\n.vis-time-axis .vis-grid.vis-major {\n border-color: #bfbfbf;\n}\n"; + styleInject(css_248z$e); + + function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$b(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$b() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** A horizontal time axis */ + var TimeAxis = /*#__PURE__*/function (_Component) { + _inherits(TimeAxis, _Component); + var _super = _createSuper$b(TimeAxis); + /** + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See TimeAxis.setOptions for the available + * options. + * @constructor TimeAxis + * @extends Component + */ + function TimeAxis(body, options) { + var _this; + _classCallCheck(this, TimeAxis); + _this = _super.call(this); + _this.dom = { + foreground: null, + lines: [], + majorTexts: [], + minorTexts: [], + redundant: { + lines: [], + majorTexts: [], + minorTexts: [] + } + }; + _this.props = { + range: { + start: 0, + end: 0, + minimumStep: 0 + }, + lineTop: 0 + }; + _this.defaultOptions = { + orientation: { + axis: 'bottom' + }, + // axis orientation: 'top' or 'bottom' + showMinorLabels: true, + showMajorLabels: true, + showWeekScale: false, + maxMinorChars: 7, + format: availableUtils.extend({}, TimeStep.FORMAT), + moment: moment$4, + timeAxis: null + }; + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.body = body; + + // create the HTML DOM + _this._create(); + _this.setOptions(options); + return _this; + } + + /** + * Set options for the TimeAxis. + * Parameters will be merged in current options. + * @param {Object} options Available options: + * {string} [orientation.axis] + * {boolean} [showMinorLabels] + * {boolean} [showMajorLabels] + * {boolean} [showWeekScale] + */ + _createClass(TimeAxis, [{ + key: "setOptions", + value: function setOptions(options) { + if (options) { + // copy all options that we know + availableUtils.selectiveExtend(['showMinorLabels', 'showMajorLabels', 'showWeekScale', 'maxMinorChars', 'hiddenDates', 'timeAxis', 'moment', 'rtl'], this.options, options); + + // deep copy the format options + availableUtils.selectiveDeepExtend(['format'], this.options, options); + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation.axis = options.orientation; + } else if (_typeof$1(options.orientation) === 'object' && 'axis' in options.orientation) { + this.options.orientation.axis = options.orientation.axis; + } + } + + // apply locale to moment.js + // TODO: not so nice, this is applied globally to moment.js + if ('locale' in options) { + if (typeof moment$4.locale === 'function') { + // moment.js 2.8.1+ + moment$4.locale(options.locale); + } else { + moment$4.lang(options.locale); + } + } + } + } + + /** + * Create the HTML DOM for the TimeAxis + */ + }, { + key: "_create", + value: function _create() { + this.dom.foreground = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.foreground.className = 'vis-time-axis vis-foreground'; + this.dom.background.className = 'vis-time-axis vis-background'; + } + + /** + * Destroy the TimeAxis + */ + }, { + key: "destroy", + value: function destroy() { + // remove from DOM + if (this.dom.foreground.parentNode) { + this.dom.foreground.parentNode.removeChild(this.dom.foreground); + } + if (this.dom.background.parentNode) { + this.dom.background.parentNode.removeChild(this.dom.background); + } + this.body = null; + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + var props = this.props; + var foreground = this.dom.foreground; + var background = this.dom.background; + + // determine the correct parent DOM element (depending on option orientation) + var parent = this.options.orientation.axis == 'top' ? this.body.dom.top : this.body.dom.bottom; + var parentChanged = foreground.parentNode !== parent; + + // calculate character width and height + this._calculateCharSize(); + + // TODO: recalculate sizes only needed when parent is resized or options is changed + var showMinorLabels = this.options.showMinorLabels && this.options.orientation.axis !== 'none'; + var showMajorLabels = this.options.showMajorLabels && this.options.orientation.axis !== 'none'; + + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + props.height = props.minorLabelHeight + props.majorLabelHeight; + props.width = foreground.offsetWidth; + props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - (this.options.orientation.axis == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); + props.minorLineWidth = 1; // TODO: really calculate width + props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; + props.majorLineWidth = 1; // TODO: really calculate width + + // take foreground and background offline while updating (is almost twice as fast) + var foregroundNextSibling = foreground.nextSibling; + var backgroundNextSibling = background.nextSibling; + foreground.parentNode && foreground.parentNode.removeChild(foreground); + background.parentNode && background.parentNode.removeChild(background); + foreground.style.height = "".concat(this.props.height, "px"); + this._repaintLabels(); + + // put DOM online again (at the same place) + if (foregroundNextSibling) { + parent.insertBefore(foreground, foregroundNextSibling); + } else { + parent.appendChild(foreground); + } + if (backgroundNextSibling) { + this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); + } else { + this.body.dom.backgroundVertical.appendChild(background); + } + return this._isResized() || parentChanged; + } + + /** + * Repaint major and minor text labels and vertical grid lines + * @private + */ + }, { + key: "_repaintLabels", + value: function _repaintLabels() { + var orientation = this.options.orientation.axis; + + // calculate range and step (step such that we have space for 7 characters per label) + var start = availableUtils.convert(this.body.range.start, 'Number'); + var end = availableUtils.convert(this.body.range.end, 'Number'); + var timeLabelsize = this.body.util.toTime((this.props.minorCharWidth || 10) * this.options.maxMinorChars).valueOf(); + var minimumStep = timeLabelsize - getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this.body.range, timeLabelsize); + minimumStep -= this.body.util.toTime(0).valueOf(); + var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates, this.options); + step.setMoment(this.options.moment); + if (this.options.format) { + step.setFormat(this.options.format); + } + if (this.options.timeAxis) { + step.setScale(this.options.timeAxis); + } + this.step = step; + + // Move all DOM elements to a "redundant" list, where they + // can be picked for re-use, and clear the lists with lines and texts. + // At the end of the function _repaintLabels, left over elements will be cleaned up + var dom = this.dom; + dom.redundant.lines = dom.lines; + dom.redundant.majorTexts = dom.majorTexts; + dom.redundant.minorTexts = dom.minorTexts; + dom.lines = []; + dom.majorTexts = []; + dom.minorTexts = []; + var current; + var next; + var x; + var xNext; + var isMajor; + var showMinorGrid; + var width = 0; + var prevWidth; + var line; + var xFirstMajorLabel = undefined; + var count = 0; + var MAX = 1000; + var className; + step.start(); + next = step.getCurrent(); + xNext = this.body.util.toScreen(next); + while (step.hasNext() && count < MAX) { + count++; + isMajor = step.isMajor(); + className = step.getClassName(); + current = next; + x = xNext; + step.next(); + next = step.getCurrent(); + xNext = this.body.util.toScreen(next); + prevWidth = width; + width = xNext - x; + switch (step.scale) { + case 'week': + showMinorGrid = true; + break; + default: + showMinorGrid = width >= prevWidth * 0.4; + break; + // prevent displaying of the 31th of the month on a scale of 5 days + } + + if (this.options.showMinorLabels && showMinorGrid) { + var label = this._repaintMinorText(x, step.getLabelMinor(current), orientation, className); + label.style.width = "".concat(width, "px"); // set width to prevent overflow + } + + if (isMajor && this.options.showMajorLabels) { + if (x > 0) { + if (xFirstMajorLabel == undefined) { + xFirstMajorLabel = x; + } + label = this._repaintMajorText(x, step.getLabelMajor(current), orientation, className); + } + line = this._repaintMajorLine(x, width, orientation, className); + } else { + // minor line + if (showMinorGrid) { + line = this._repaintMinorLine(x, width, orientation, className); + } else { + if (line) { + // adjust the width of the previous grid + line.style.width = "".concat(_parseInt$1(line.style.width) + width, "px"); + } + } + } + } + if (count === MAX && !warnedForOverflow) { + console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to ".concat(MAX, " lines.")); + warnedForOverflow = true; + } + + // create a major label on the left when needed + if (this.options.showMajorLabels) { + var leftTime = this.body.util.toTime(0); // upper bound estimation + var leftText = step.getLabelMajor(leftTime); + var widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; + if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { + this._repaintMajorText(0, leftText, orientation, className); + } + } + + // Cleanup leftover DOM elements from the redundant list + _forEachInstanceProperty(availableUtils).call(availableUtils, this.dom.redundant, function (arr) { + while (arr.length) { + var elem = arr.pop(); + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + }); + } + + /** + * Create a minor label for the axis at position x + * @param {number} x + * @param {string} text + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the HTML element of the created label + * @private + */ + }, { + key: "_repaintMinorText", + value: function _repaintMinorText(x, text, orientation, className) { + // reuse redundant label + var label = this.dom.redundant.minorTexts.shift(); + if (!label) { + // create new label + var content = document.createTextNode(''); + label = document.createElement('div'); + label.appendChild(content); + this.dom.foreground.appendChild(label); + } + this.dom.minorTexts.push(label); + label.innerHTML = availableUtils.xss(text); + var y = orientation == 'top' ? this.props.majorLabelHeight : 0; + this._setXY(label, x, y); + label.className = "vis-text vis-minor ".concat(className); + //label.title = title; // TODO: this is a heavy operation + + return label; + } + + /** + * Create a Major label for the axis at position x + * @param {number} x + * @param {string} text + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the HTML element of the created label + * @private + */ + }, { + key: "_repaintMajorText", + value: function _repaintMajorText(x, text, orientation, className) { + // reuse redundant label + var label = this.dom.redundant.majorTexts.shift(); + if (!label) { + // create label + var content = document.createElement('div'); + label = document.createElement('div'); + label.appendChild(content); + this.dom.foreground.appendChild(label); + } + label.childNodes[0].innerHTML = availableUtils.xss(text); + label.className = "vis-text vis-major ".concat(className); + //label.title = title; // TODO: this is a heavy operation + + var y = orientation == 'top' ? 0 : this.props.minorLabelHeight; + this._setXY(label, x, y); + this.dom.majorTexts.push(label); + return label; + } + + /** + * sets xy + * @param {string} label + * @param {number} x + * @param {number} y + * @private + */ + }, { + key: "_setXY", + value: function _setXY(label, x, y) { + var _context; + // If rtl is true, inverse x. + var directionX = this.options.rtl ? x * -1 : x; + label.style.transform = _concatInstanceProperty(_context = "translate(".concat(directionX, "px, ")).call(_context, y, "px)"); + } + + /** + * Create a minor line for the axis at position x + * @param {number} left + * @param {number} width + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the created line + * @private + */ + }, { + key: "_repaintMinorLine", + value: function _repaintMinorLine(left, width, orientation, className) { + var _context2; + // reuse redundant line + var line = this.dom.redundant.lines.shift(); + if (!line) { + // create vertical line + line = document.createElement('div'); + this.dom.background.appendChild(line); + } + this.dom.lines.push(line); + var props = this.props; + line.style.width = "".concat(width, "px"); + line.style.height = "".concat(props.minorLineHeight, "px"); + var y = orientation == 'top' ? props.majorLabelHeight : this.body.domProps.top.height; + var x = left - props.minorLineWidth / 2; + this._setXY(line, x, y); + line.className = _concatInstanceProperty(_context2 = "vis-grid ".concat(this.options.rtl ? 'vis-vertical-rtl' : 'vis-vertical', " vis-minor ")).call(_context2, className); + return line; + } + + /** + * Create a Major line for the axis at position x + * @param {number} left + * @param {number} width + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the created line + * @private + */ + }, { + key: "_repaintMajorLine", + value: function _repaintMajorLine(left, width, orientation, className) { + var _context3; + // reuse redundant line + var line = this.dom.redundant.lines.shift(); + if (!line) { + // create vertical line + line = document.createElement('div'); + this.dom.background.appendChild(line); + } + this.dom.lines.push(line); + var props = this.props; + line.style.width = "".concat(width, "px"); + line.style.height = "".concat(props.majorLineHeight, "px"); + var y = orientation == 'top' ? 0 : this.body.domProps.top.height; + var x = left - props.majorLineWidth / 2; + this._setXY(line, x, y); + line.className = _concatInstanceProperty(_context3 = "vis-grid ".concat(this.options.rtl ? 'vis-vertical-rtl' : 'vis-vertical', " vis-major ")).call(_context3, className); + return line; + } + + /** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ + }, { + key: "_calculateCharSize", + value: function _calculateCharSize() { + // Note: We calculate char size with every redraw. Size may change, for + // example when any of the timelines parents had display:none for example. + + // determine the char width and height on the minor axis + if (!this.dom.measureCharMinor) { + this.dom.measureCharMinor = document.createElement('DIV'); + this.dom.measureCharMinor.className = 'vis-text vis-minor vis-measure'; + this.dom.measureCharMinor.style.position = 'absolute'; + this.dom.measureCharMinor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMinor); + } + this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; + this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; + + // determine the char width and height on the major axis + if (!this.dom.measureCharMajor) { + this.dom.measureCharMajor = document.createElement('DIV'); + this.dom.measureCharMajor.className = 'vis-text vis-major vis-measure'; + this.dom.measureCharMajor.style.position = 'absolute'; + this.dom.measureCharMajor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMajor); + } + this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; + this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; + } + }]); + return TimeAxis; + }(Component); + var warnedForOverflow = false; + + /** + * Created by Alex on 11/6/2014. + */ + function keycharm(options) { + var preventDefault = options && options.preventDefault || false; + + var container = options && options.container || window; + + var _exportFunctions = {}; + var _bound = {keydown:{}, keyup:{}}; + var _keys = {}; + var i; + + // a - z + for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};} + // A - Z + for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};} + // 0 - 9 + for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};} + // F1 - F12 + for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};} + // num0 - num9 + for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};} + + // numpad misc + _keys['num*'] = {code:106, shift: false}; + _keys['num+'] = {code:107, shift: false}; + _keys['num-'] = {code:109, shift: false}; + _keys['num/'] = {code:111, shift: false}; + _keys['num.'] = {code:110, shift: false}; + // arrows + _keys['left'] = {code:37, shift: false}; + _keys['up'] = {code:38, shift: false}; + _keys['right'] = {code:39, shift: false}; + _keys['down'] = {code:40, shift: false}; + // extra keys + _keys['space'] = {code:32, shift: false}; + _keys['enter'] = {code:13, shift: false}; + _keys['shift'] = {code:16, shift: undefined}; + _keys['esc'] = {code:27, shift: false}; + _keys['backspace'] = {code:8, shift: false}; + _keys['tab'] = {code:9, shift: false}; + _keys['ctrl'] = {code:17, shift: false}; + _keys['alt'] = {code:18, shift: false}; + _keys['delete'] = {code:46, shift: false}; + _keys['pageup'] = {code:33, shift: false}; + _keys['pagedown'] = {code:34, shift: false}; + // symbols + _keys['='] = {code:187, shift: false}; + _keys['-'] = {code:189, shift: false}; + _keys[']'] = {code:221, shift: false}; + _keys['['] = {code:219, shift: false}; + + + + var down = function(event) {handleEvent(event,'keydown');}; + var up = function(event) {handleEvent(event,'keyup');}; + + // handle the actualy bound key with the event + var handleEvent = function(event,type) { + if (_bound[type][event.keyCode] !== undefined) { + var bound = _bound[type][event.keyCode]; + for (var i = 0; i < bound.length; i++) { + if (bound[i].shift === undefined) { + bound[i].fn(event); + } + else if (bound[i].shift == true && event.shiftKey == true) { + bound[i].fn(event); + } + else if (bound[i].shift == false && event.shiftKey == false) { + bound[i].fn(event); + } + } + + if (preventDefault == true) { + event.preventDefault(); + } + } + }; + + // bind a key to a callback + _exportFunctions.bind = function(key, callback, type) { + if (type === undefined) { + type = 'keydown'; + } + if (_keys[key] === undefined) { + throw new Error("unsupported key: " + key); + } + if (_bound[type][_keys[key].code] === undefined) { + _bound[type][_keys[key].code] = []; + } + _bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift}); + }; + + + // bind all keys to a call back (demo purposes) + _exportFunctions.bindAll = function(callback, type) { + if (type === undefined) { + type = 'keydown'; + } + for (var key in _keys) { + if (_keys.hasOwnProperty(key)) { + _exportFunctions.bind(key,callback,type); + } + } + }; + + // get the key label from an event + _exportFunctions.getKey = function(event) { + for (var key in _keys) { + if (_keys.hasOwnProperty(key)) { + if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) { + return key; + } + else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) { + return key; + } + else if (event.keyCode == _keys[key].code && key == 'shift') { + return key; + } + } + } + return "unknown key, currently not supported"; + }; + + // unbind either a specific callback from a key or all of them (by leaving callback undefined) + _exportFunctions.unbind = function(key, callback, type) { + if (type === undefined) { + type = 'keydown'; + } + if (_keys[key] === undefined) { + throw new Error("unsupported key: " + key); + } + if (callback !== undefined) { + var newBindings = []; + var bound = _bound[type][_keys[key].code]; + if (bound !== undefined) { + for (var i = 0; i < bound.length; i++) { + if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) { + newBindings.push(_bound[type][_keys[key].code][i]); + } + } + } + _bound[type][_keys[key].code] = newBindings; + } + else { + _bound[type][_keys[key].code] = []; + } + }; + + // reset all bound variables. + _exportFunctions.reset = function() { + _bound = {keydown:{}, keyup:{}}; + }; + + // unbind all listeners and reset all variables. + _exportFunctions.destroy = function() { + _bound = {keydown:{}, keyup:{}}; + container.removeEventListener('keydown', down, true); + container.removeEventListener('keyup', up, true); + }; + + // create listeners. + container.addEventListener('keydown',down,true); + container.addEventListener('keyup',up,true); + + // return the public functions. + return _exportFunctions; + } + + var css_248z$d = ".vis .overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n /* Must be displayed above for example selected Timeline items */\n z-index: 10;\n}\n\n.vis-active {\n box-shadow: 0 0 10px #86d5f8;\n}\n"; + styleInject(css_248z$d); + + /** + * Turn an element into an clickToUse element. + * When not active, the element has a transparent overlay. When the overlay is + * clicked, the mode is changed to active. + * When active, the element is displayed with a blue border around it, and + * the interactive contents of the element can be used. When clicked outside + * the element, the elements mode is changed to inactive. + * @param {Element} container + * @constructor Activator + */ + function Activator(container) { + var _context, _context2; + this.active = false; + this.dom = { + container: container + }; + this.dom.overlay = document.createElement('div'); + this.dom.overlay.className = 'vis-overlay'; + this.dom.container.appendChild(this.dom.overlay); + this.hammer = Hammer(this.dom.overlay); + this.hammer.on('tap', _bindInstanceProperty$1(_context = this._onTapOverlay).call(_context, this)); + + // block all touch events (except tap) + var me = this; + var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend']; + _forEachInstanceProperty(events).call(events, function (event) { + me.hammer.on(event, function (event) { + event.stopPropagation(); + }); + }); + + // attach a click event to the window, in order to deactivate when clicking outside the timeline + if (document && document.body) { + this.onClick = function (event) { + if (!_hasParent(event.target, container)) { + me.deactivate(); + } + }; + document.body.addEventListener('click', this.onClick); + } + if (this.keycharm !== undefined) { + this.keycharm.destroy(); + } + this.keycharm = keycharm(); + + // keycharm listener only bounded when active) + this.escListener = _bindInstanceProperty$1(_context2 = this.deactivate).call(_context2, this); + } + + // turn into an event emitter + Emitter(Activator.prototype); + + // The currently active activator + Activator.current = null; + + /** + * Destroy the activator. Cleans up all created DOM and event listeners + */ + Activator.prototype.destroy = function () { + this.deactivate(); + + // remove dom + this.dom.overlay.parentNode.removeChild(this.dom.overlay); + + // remove global event listener + if (this.onClick) { + document.body.removeEventListener('click', this.onClick); + } + // remove keycharm + if (this.keycharm !== undefined) { + this.keycharm.destroy(); + } + this.keycharm = null; + // cleanup hammer instances + this.hammer.destroy(); + this.hammer = null; + // FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory) + }; + + /** + * Activate the element + * Overlay is hidden, element is decorated with a blue shadow border + */ + Activator.prototype.activate = function () { + var _context3; + // we allow only one active activator at a time + if (Activator.current) { + Activator.current.deactivate(); + } + Activator.current = this; + this.active = true; + this.dom.overlay.style.display = 'none'; + availableUtils.addClassName(this.dom.container, 'vis-active'); + this.emit('change'); + this.emit('activate'); + + // ugly hack: bind ESC after emitting the events, as the Network rebinds all + // keyboard events on a 'change' event + _bindInstanceProperty$1(_context3 = this.keycharm).call(_context3, 'esc', this.escListener); + }; + + /** + * Deactivate the element + * Overlay is displayed on top of the element + */ + Activator.prototype.deactivate = function () { + if (Activator.current === this) { + Activator.current = null; + } + this.active = false; + this.dom.overlay.style.display = ''; + availableUtils.removeClassName(this.dom.container, 'vis-active'); + this.keycharm.unbind('esc', this.escListener); + this.emit('change'); + this.emit('deactivate'); + }; + + /** + * Handle a tap event: activate the container + * @param {Event} event The event + * @private + */ + Activator.prototype._onTapOverlay = function (event) { + // activate the container + this.activate(); + event.stopPropagation(); + }; + + /** + * Test whether the element has the requested parent element somewhere in + * its chain of parent nodes. + * @param {HTMLElement} element + * @param {HTMLElement} parent + * @returns {boolean} Returns true when the parent is found somewhere in the + * chain of parent nodes. + * @private + */ + function _hasParent(element, parent) { + while (element) { + if (element === parent) { + return true; + } + element = element.parentNode; + } + return false; + } + + /* + * IMPORTANT: Locales for Moment has to be imported in the legacy and standalone + * entry points. For the peer build it's users responsibility to do so. + */ + + // English + var en = { + current: 'current', + time: 'time', + deleteSelected: 'Delete selected' + }; + var en_EN = en; + var en_US = en; + + // Italiano + var it = { + current: 'attuale', + time: 'tempo', + deleteSelected: 'Cancella la selezione' + }; + var it_IT = it; + var it_CH = it; + + // Dutch + var nl = { + current: 'huidige', + time: 'tijd', + deleteSelected: 'Selectie verwijderen' + }; + var nl_NL = nl; + var nl_BE = nl; + + // German + var de = { + current: 'Aktuelle', + time: 'Zeit', + deleteSelected: "L\xF6sche Auswahl" + }; + var de_DE = de; + + // French + var fr = { + current: 'actuel', + time: 'heure', + deleteSelected: 'Effacer la selection' + }; + var fr_FR = fr; + var fr_CA = fr; + var fr_BE = fr; + + // Espanol + var es = { + current: 'corriente', + time: 'hora', + deleteSelected: "Eliminar selecci\xF3n" + }; + var es_ES = es; + + // Ukrainian + var uk = { + current: 'поточний', + time: 'час', + deleteSelected: 'Видалити обране' + }; + var uk_UA = uk; + + // Russian + var ru = { + current: 'текущее', + time: 'время', + deleteSelected: 'Удалить выбранное' + }; + var ru_RU = ru; + + // Polish + var pl = { + current: 'aktualny', + time: 'czas', + deleteSelected: 'Usuń wybrane' + }; + var pl_PL = pl; + + // Portuguese + var pt = { + current: 'atual', + time: 'data', + deleteSelected: 'Apagar selecionado' + }; + var pt_BR = pt; + var pt_PT = pt; + + // Japanese + var ja = { + current: '現在', + time: '時刻', + deleteSelected: '選択されたものを削除' + }; + var ja_JP = ja; + + // Swedish + var sv = { + current: 'nuvarande', + time: 'tid', + deleteSelected: 'Radera valda' + }; + var sv_SE = sv; + + // Norwegian + var nb = { + current: 'nåværende', + time: 'tid', + deleteSelected: 'Slett valgte' + }; + var nb_NO = nb; + var nn = nb; + var nn_NO = nb; + + // Lithuanian + var lt = { + current: 'einamas', + time: 'laikas', + deleteSelected: 'Pašalinti pasirinktą' + }; + var lt_LT = lt; + var locales = { + en: en, + en_EN: en_EN, + en_US: en_US, + it: it, + it_IT: it_IT, + it_CH: it_CH, + nl: nl, + nl_NL: nl_NL, + nl_BE: nl_BE, + de: de, + de_DE: de_DE, + fr: fr, + fr_FR: fr_FR, + fr_CA: fr_CA, + fr_BE: fr_BE, + es: es, + es_ES: es_ES, + uk: uk, + uk_UA: uk_UA, + ru: ru, + ru_RU: ru_RU, + pl: pl, + pl_PL: pl_PL, + pt: pt, + pt_BR: pt_BR, + pt_PT: pt_PT, + ja: ja, + ja_JP: ja_JP, + lt: lt, + lt_LT: lt_LT, + sv: sv, + sv_SE: sv_SE, + nb: nb, + nn: nn, + nb_NO: nb_NO, + nn_NO: nn_NO + }; + + var css_248z$c = ".vis-custom-time {\n background-color: #6E94FF;\n width: 2px;\n cursor: move;\n z-index: 1;\n}\n\n.vis-custom-time > .vis-custom-time-marker {\n background-color: inherit;\n color: white;\n font-size: 12px;\n white-space: nowrap;\n padding: 3px 5px;\n top: 0px;\n cursor: initial;\n z-index: inherit;\n}"; + styleInject(css_248z$c); + + function _createSuper$a(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$a(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$a() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** A custom time bar */ + var CustomTime = /*#__PURE__*/function (_Component) { + _inherits(CustomTime, _Component); + var _super = _createSuper$a(CustomTime); + /** + * @param {{range: Range, dom: Object}} body + * @param {Object} [options] Available parameters: + * {number | string} id + * {string} locales + * {string} locale + * @constructor CustomTime + * @extends Component + */ + function CustomTime(body, options) { + var _context; + var _this; + _classCallCheck(this, CustomTime); + _this = _super.call(this); + _this.body = body; + + // default options + _this.defaultOptions = { + moment: moment$4, + locales: locales, + locale: 'en', + id: undefined, + title: undefined + }; + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.setOptions(options); + _this.options.locales = availableUtils.extend({}, locales, _this.options.locales); + var defaultLocales = _this.defaultOptions.locales[_this.defaultOptions.locale]; + _forEachInstanceProperty(_context = _Object$keys(_this.options.locales)).call(_context, function (locale) { + _this.options.locales[locale] = availableUtils.extend({}, defaultLocales, _this.options.locales[locale]); + }); + if (options && options.time != null) { + _this.customTime = options.time; + } else { + _this.customTime = new Date(); + } + _this.eventParams = {}; // stores state parameters while dragging the bar + + // create the DOM + _this._create(); + return _this; + } + + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {number | string} id + * {string} locales + * {string} locale + */ + _createClass(CustomTime, [{ + key: "setOptions", + value: function setOptions(options) { + if (options) { + // copy all options that we know + availableUtils.selectiveExtend(['moment', 'locale', 'locales', 'id', 'title', 'rtl', 'snap'], this.options, options); + } + } + + /** + * Create the DOM for the custom time + * @private + */ + }, { + key: "_create", + value: function _create() { + var _context2, _context3, _context4; + var bar = document.createElement('div'); + bar['custom-time'] = this; + bar.className = "vis-custom-time ".concat(this.options.id || ''); + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + this.bar = bar; + var drag = document.createElement('div'); + drag.style.position = 'relative'; + drag.style.top = '0px'; + if (this.options.rtl) { + drag.style.right = '-10px'; + } else { + drag.style.left = '-10px'; + } + drag.style.height = '100%'; + drag.style.width = '20px'; + + /** + * + * @param {WheelEvent} e + */ + function onMouseWheel(e) { + this.body.range._onMouseWheel(e); + } + if (drag.addEventListener) { + // IE9, Chrome, Safari, Opera + drag.addEventListener("mousewheel", _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this), false); + // Firefox + drag.addEventListener("DOMMouseScroll", _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this), false); + } else { + // IE 6/7/8 + drag.attachEvent("onmousewheel", _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this)); + } + bar.appendChild(drag); + // attach event listeners + this.hammer = new Hammer(drag); + this.hammer.on('panstart', _bindInstanceProperty$1(_context2 = this._onDragStart).call(_context2, this)); + this.hammer.on('panmove', _bindInstanceProperty$1(_context3 = this._onDrag).call(_context3, this)); + this.hammer.on('panend', _bindInstanceProperty$1(_context4 = this._onDragEnd).call(_context4, this)); + this.hammer.get('pan').set({ + threshold: 5, + direction: Hammer.DIRECTION_ALL + }); + // delay addition on item click for trackpads... + this.hammer.get('press').set({ + time: 10000 + }); + } + + /** + * Destroy the CustomTime bar + */ + }, { + key: "destroy", + value: function destroy() { + this.hide(); + this.hammer.destroy(); + this.hammer = null; + this.body = null; + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + } + var x = this.body.util.toScreen(this.customTime); + var locale = this.options.locales[this.options.locale]; + if (!locale) { + if (!this.warned) { + console.warn("WARNING: options.locales['".concat(this.options.locale, "'] not found. See https://visjs.github.io/vis-timeline/docs/timeline/#Localization")); + this.warned = true; + } + locale = this.options.locales['en']; // fall back on english when not available + } + + var title = this.options.title; + // To hide the title completely use empty string ''. + if (title === undefined) { + var _context5; + title = _concatInstanceProperty(_context5 = "".concat(locale.time, ": ")).call(_context5, this.options.moment(this.customTime).format('dddd, MMMM Do YYYY, H:mm:ss')); + title = title.charAt(0).toUpperCase() + title.substring(1); + } else if (typeof title === "function") { + title = title.call(this, this.customTime); + } + this.options.rtl ? this.bar.style.right = "".concat(x, "px") : this.bar.style.left = "".concat(x, "px"); + this.bar.title = title; + return false; + } + + /** + * Remove the CustomTime from the DOM + */ + }, { + key: "hide", + value: function hide() { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + } + + /** + * Set custom time. + * @param {Date | number | string} time + */ + }, { + key: "setCustomTime", + value: function setCustomTime(time) { + this.customTime = availableUtils.convert(time, 'Date'); + this.redraw(); + } + + /** + * Retrieve the current custom time. + * @return {Date} customTime + */ + }, { + key: "getCustomTime", + value: function getCustomTime() { + return new Date(this.customTime.valueOf()); + } + + /** + * Set custom marker. + * @param {string} [title] Title of the custom marker + * @param {boolean} [editable] Make the custom marker editable. + */ + }, { + key: "setCustomMarker", + value: function setCustomMarker(title, editable) { + if (this.marker) { + this.bar.removeChild(this.marker); + } + this.marker = document.createElement('div'); + this.marker.className = "vis-custom-time-marker"; + this.marker.innerHTML = availableUtils.xss(title); + this.marker.style.position = 'absolute'; + if (editable) { + var _context6, _context7; + this.marker.setAttribute('contenteditable', 'true'); + this.marker.addEventListener('pointerdown', function () { + this.marker.focus(); + }); + this.marker.addEventListener('input', _bindInstanceProperty$1(_context6 = this._onMarkerChange).call(_context6, this)); + // The editable div element has no change event, so here emulates the change event. + this.marker.title = title; + this.marker.addEventListener('blur', _bindInstanceProperty$1(_context7 = function _context7(event) { + if (this.title != event.target.innerHTML) { + this._onMarkerChanged(event); + this.title = event.target.innerHTML; + } + }).call(_context7, this)); + } + this.bar.appendChild(this.marker); + } + + /** + * Set custom title. + * @param {Date | number | string} title + */ + }, { + key: "setCustomTitle", + value: function setCustomTitle(title) { + this.options.title = title; + } + + /** + * Start moving horizontally + * @param {Event} event + * @private + */ + }, { + key: "_onDragStart", + value: function _onDragStart(event) { + this.eventParams.dragging = true; + this.eventParams.customTime = this.customTime; + event.stopPropagation(); + } + + /** + * Perform moving operating. + * @param {Event} event + * @private + */ + }, { + key: "_onDrag", + value: function _onDrag(event) { + if (!this.eventParams.dragging) return; + var deltaX = this.options.rtl ? -1 * event.deltaX : event.deltaX; + var x = this.body.util.toScreen(this.eventParams.customTime) + deltaX; + var time = this.body.util.toTime(x); + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var snap = this.options.snap; + var snappedTime = snap ? snap(time, scale, step) : time; + this.setCustomTime(snappedTime); + + // fire a timechange event + this.body.emitter.emit('timechange', { + id: this.options.id, + time: new Date(this.customTime.valueOf()), + event: event + }); + event.stopPropagation(); + } + + /** + * Stop moving operating. + * @param {Event} event + * @private + */ + }, { + key: "_onDragEnd", + value: function _onDragEnd(event) { + if (!this.eventParams.dragging) return; + + // fire a timechanged event + this.body.emitter.emit('timechanged', { + id: this.options.id, + time: new Date(this.customTime.valueOf()), + event: event + }); + event.stopPropagation(); + } + + /** + * Perform input operating. + * @param {Event} event + * @private + */ + }, { + key: "_onMarkerChange", + value: function _onMarkerChange(event) { + this.body.emitter.emit('markerchange', { + id: this.options.id, + title: event.target.innerHTML, + event: event + }); + event.stopPropagation(); + } + + /** + * Perform change operating. + * @param {Event} event + * @private + */ + }, { + key: "_onMarkerChanged", + value: function _onMarkerChanged(event) { + this.body.emitter.emit('markerchanged', { + id: this.options.id, + title: event.target.innerHTML, + event: event + }); + event.stopPropagation(); + } + + /** + * Find a custom time from an event target: + * searches for the attribute 'custom-time' in the event target's element tree + * @param {Event} event + * @return {CustomTime | null} customTime + */ + }], [{ + key: "customTimeFromTarget", + value: function customTimeFromTarget(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('custom-time')) { + return target['custom-time']; + } + target = target.parentNode; + } + return null; + } + }]); + return CustomTime; + }(Component); + + var css_248z$b = ".vis-timeline {\n /*\n -webkit-transition: height .4s ease-in-out;\n transition: height .4s ease-in-out;\n */\n}\n\n.vis-panel {\n /*\n -webkit-transition: height .4s ease-in-out, top .4s ease-in-out;\n transition: height .4s ease-in-out, top .4s ease-in-out;\n */\n}\n\n.vis-axis {\n /*\n -webkit-transition: top .4s ease-in-out;\n transition: top .4s ease-in-out;\n */\n}\n\n/* TODO: get animation working nicely\n\n.vis-item {\n -webkit-transition: top .4s ease-in-out;\n transition: top .4s ease-in-out;\n}\n\n.vis-item.line {\n -webkit-transition: height .4s ease-in-out, top .4s ease-in-out;\n transition: height .4s ease-in-out, top .4s ease-in-out;\n}\n/**/"; + styleInject(css_248z$b); + + var css_248z$a = ".vis-current-time {\n background-color: #FF7F6E;\n width: 2px;\n z-index: 1;\n pointer-events: none;\n}\n\n.vis-rolling-mode-btn {\n height: 40px;\n width: 40px;\n position: absolute;\n top: 7px;\n right: 20px;\n border-radius: 50%;\n font-size: 28px;\n cursor: pointer;\n opacity: 0.8;\n color: white;\n font-weight: bold;\n text-align: center;\n background: #3876c2;\n}\n.vis-rolling-mode-btn:before {\n content: \"\\26F6\";\n}\n\n.vis-rolling-mode-btn:hover {\n opacity: 1;\n}"; + styleInject(css_248z$a); + + var css_248z$9 = ".vis-panel {\n position: absolute;\n\n padding: 0;\n margin: 0;\n\n box-sizing: border-box;\n}\n\n.vis-panel.vis-center,\n.vis-panel.vis-left,\n.vis-panel.vis-right,\n.vis-panel.vis-top,\n.vis-panel.vis-bottom {\n border: 1px #bfbfbf;\n}\n\n.vis-panel.vis-center,\n.vis-panel.vis-left,\n.vis-panel.vis-right {\n border-top-style: solid;\n border-bottom-style: solid;\n overflow: hidden;\n}\n\n.vis-left.vis-panel.vis-vertical-scroll, .vis-right.vis-panel.vis-vertical-scroll {\n height: 100%;\n overflow-x: hidden;\n overflow-y: scroll;\n} \n\n.vis-left.vis-panel.vis-vertical-scroll {\n direction: rtl;\n}\n\n.vis-left.vis-panel.vis-vertical-scroll .vis-content {\n direction: ltr;\n}\n\n.vis-right.vis-panel.vis-vertical-scroll {\n direction: ltr;\n}\n\n.vis-right.vis-panel.vis-vertical-scroll .vis-content {\n direction: rtl;\n}\n\n.vis-panel.vis-center,\n.vis-panel.vis-top,\n.vis-panel.vis-bottom {\n border-left-style: solid;\n border-right-style: solid;\n}\n\n.vis-background {\n overflow: hidden;\n}\n\n.vis-panel > .vis-content {\n position: relative;\n}\n\n.vis-panel .vis-shadow {\n position: absolute;\n width: 100%;\n height: 1px;\n box-shadow: 0 0 10px rgba(0,0,0,0.8);\n /* TODO: find a nice way to ensure vis-shadows are drawn on top of items\n z-index: 1;\n */\n}\n\n.vis-panel .vis-shadow.vis-top {\n top: -1px;\n left: 0;\n}\n\n.vis-panel .vis-shadow.vis-bottom {\n bottom: -1px;\n left: 0;\n}"; + styleInject(css_248z$9); + + var css_248z$8 = ".vis-graph-group0 {\n fill:#4f81bd;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #4f81bd;\n}\n\n.vis-graph-group1 {\n fill:#f79646;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #f79646;\n}\n\n.vis-graph-group2 {\n fill: #8c51cf;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #8c51cf;\n}\n\n.vis-graph-group3 {\n fill: #75c841;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #75c841;\n}\n\n.vis-graph-group4 {\n fill: #ff0100;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #ff0100;\n}\n\n.vis-graph-group5 {\n fill: #37d8e6;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #37d8e6;\n}\n\n.vis-graph-group6 {\n fill: #042662;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #042662;\n}\n\n.vis-graph-group7 {\n fill:#00ff26;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #00ff26;\n}\n\n.vis-graph-group8 {\n fill:#ff00ff;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #ff00ff;\n}\n\n.vis-graph-group9 {\n fill: #8f3938;\n fill-opacity:0;\n stroke-width:2px;\n stroke: #8f3938;\n}\n\n.vis-timeline .vis-fill {\n fill-opacity:0.1;\n stroke: none;\n}\n\n\n.vis-timeline .vis-bar {\n fill-opacity:0.5;\n stroke-width:1px;\n}\n\n.vis-timeline .vis-point {\n stroke-width:2px;\n fill-opacity:1.0;\n}\n\n\n.vis-timeline .vis-legend-background {\n stroke-width:1px;\n fill-opacity:0.9;\n fill: #ffffff;\n stroke: #c2c2c2;\n}\n\n\n.vis-timeline .vis-outline {\n stroke-width:1px;\n fill-opacity:1;\n fill: #ffffff;\n stroke: #e5e5e5;\n}\n\n.vis-timeline .vis-icon-fill {\n fill-opacity:0.3;\n stroke: none;\n}\n"; + styleInject(css_248z$8); + + var css_248z$7 = "\n.vis-timeline {\n position: relative;\n border: 1px solid #bfbfbf;\n overflow: hidden;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.vis-loading-screen {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n}"; + styleInject(css_248z$7); + + var css_248z$6 = "/* override some bootstrap styles screwing up the timelines css */\n\n.vis [class*=\"span\"] {\n min-height: 0;\n width: auto;\n}\n"; + styleInject(css_248z$6); + + /** + * Create a timeline visualization + * @constructor Core + */ + var Core = /*#__PURE__*/function () { + function Core() { + _classCallCheck(this, Core); + } + _createClass(Core, [{ + key: "_create", + value: + /** + * Create the main DOM for the Core: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Core will + * be attached. + * @protected + */ + function _create(container) { + var _this = this, + _context, + _context2, + _context3; + this.dom = {}; + this.dom.container = container; + this.dom.container.style.position = 'relative'; + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + this.dom.rollingModeBtn = document.createElement('div'); + this.dom.loadingScreen = document.createElement('div'); + this.dom.root.className = 'vis-timeline'; + this.dom.background.className = 'vis-panel vis-background'; + this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical'; + this.dom.backgroundHorizontal.className = 'vis-panel vis-background vis-horizontal'; + this.dom.centerContainer.className = 'vis-panel vis-center'; + this.dom.leftContainer.className = 'vis-panel vis-left'; + this.dom.rightContainer.className = 'vis-panel vis-right'; + this.dom.top.className = 'vis-panel vis-top'; + this.dom.bottom.className = 'vis-panel vis-bottom'; + this.dom.left.className = 'vis-content'; + this.dom.center.className = 'vis-content'; + this.dom.right.className = 'vis-content'; + this.dom.shadowTop.className = 'vis-shadow vis-top'; + this.dom.shadowBottom.className = 'vis-shadow vis-bottom'; + this.dom.shadowTopLeft.className = 'vis-shadow vis-top'; + this.dom.shadowBottomLeft.className = 'vis-shadow vis-bottom'; + this.dom.shadowTopRight.className = 'vis-shadow vis-top'; + this.dom.shadowBottomRight.className = 'vis-shadow vis-bottom'; + this.dom.rollingModeBtn.className = 'vis-rolling-mode-btn'; + this.dom.loadingScreen.className = 'vis-loading-screen'; + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontal); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + this.dom.root.appendChild(this.dom.rollingModeBtn); + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + this.on('rangechange', function () { + if (_this.initialDrawDone === true) { + _this._redraw(); + } + }); + this.on('rangechanged', function () { + if (!_this.initialRangeChangeDone) { + _this.initialRangeChangeDone = true; + } + }); + this.on('touch', _bindInstanceProperty$1(_context = this._onTouch).call(_context, this)); + this.on('panmove', _bindInstanceProperty$1(_context2 = this._onDrag).call(_context2, this)); + var me = this; + this._origRedraw = _bindInstanceProperty$1(_context3 = this._redraw).call(_context3, this); + this._redraw = availableUtils.throttle(this._origRedraw); + this.on('_change', function (properties) { + if (me.itemSet && me.itemSet.initialItemSetDrawn && properties && properties.queue == true) { + me._redraw(); + } else { + me._origRedraw(); + } + }); + + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = new Hammer(this.dom.root); + var pinchRecognizer = this.hammer.get('pinch').set({ + enable: true + }); + pinchRecognizer && disablePreventDefaultVertically(pinchRecognizer); + this.hammer.get('pan').set({ + threshold: 5, + direction: Hammer.DIRECTION_ALL + }); + this.timelineListeners = {}; + var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend' + // TODO: cleanup + //'touch', 'pinch', + //'tap', 'doubletap', 'hold', + //'dragstart', 'drag', 'dragend', + //'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + + _forEachInstanceProperty(events).call(events, function (type) { + var listener = function listener(event) { + if (me.isActive()) { + me.emit(type, event); + } + }; + me.hammer.on(type, listener); + me.timelineListeners[type] = listener; + }); + + // emulate a touch event (emitted before the start of a pan, pinch, tap, or press) + onTouch(this.hammer, function (event) { + me.emit('touch', event); + }); + + // emulate a release event (emitted after a pan, pinch, tap, or press) + onRelease(this.hammer, function (event) { + me.emit('release', event); + }); + + /** + * + * @param {WheelEvent} event + */ + function onMouseWheel(event) { + // Reasonable default wheel deltas + var LINE_HEIGHT = 40; + var PAGE_HEIGHT = 800; + if (this.isActive()) { + this.emit('mousewheel', event); + } + + // deltaX and deltaY normalization from jquery.mousewheel.js + var deltaX = 0; + var deltaY = 0; + + // Old school scrollwheel delta + if ('detail' in event) { + deltaY = event.detail * -1; + } + if ('wheelDelta' in event) { + deltaY = event.wheelDelta; + } + if ('wheelDeltaY' in event) { + deltaY = event.wheelDeltaY; + } + if ('wheelDeltaX' in event) { + deltaX = event.wheelDeltaX * -1; + } + + // Firefox < 17 horizontal scrolling related to DOMMouseScroll event + if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) { + deltaX = deltaY * -1; + deltaY = 0; + } + + // New school wheel delta (wheel event) + if ('deltaY' in event) { + deltaY = event.deltaY * -1; + } + if ('deltaX' in event) { + deltaX = event.deltaX; + } + + // Normalize deltas + if (event.deltaMode) { + if (event.deltaMode === 1) { + // delta in LINE units + deltaX *= LINE_HEIGHT; + deltaY *= LINE_HEIGHT; + } else { + // delta in PAGE units + deltaX *= LINE_HEIGHT; + deltaY *= PAGE_HEIGHT; + } + } + // Prevent scrolling when zooming (no zoom key, or pressing zoom key) + if (this.options.preferZoom) { + if (!this.options.zoomKey || event[this.options.zoomKey]) return; + } else { + if (this.options.zoomKey && event[this.options.zoomKey]) return; + } + // Don't preventDefault if you can't scroll + if (!this.options.verticalScroll && !this.options.horizontalScroll) return; + if (this.options.verticalScroll && Math.abs(deltaY) >= Math.abs(deltaX)) { + var current = this.props.scrollTop; + var adjusted = current + deltaY; + if (this.isActive()) { + var newScrollTop = this._setScrollTop(adjusted); + if (newScrollTop !== current) { + this._redraw(); + this.emit('scroll', event); + + // Prevent default actions caused by mouse wheel + // (else the page and timeline both scroll) + event.preventDefault(); + } + } + } else if (this.options.horizontalScroll) { + var delta = Math.abs(deltaX) >= Math.abs(deltaY) ? deltaX : deltaY; + + // calculate a single scroll jump relative to the range scale + var diff = delta / 120 * (this.range.end - this.range.start) / 20; + // calculate new start and end + var newStart = this.range.start + diff; + var newEnd = this.range.end + diff; + var options = { + animation: false, + byUser: true, + event: event + }; + this.range.setRange(newStart, newEnd, options); + event.preventDefault(); + } + } + + // Add modern wheel event listener + var wheelType = "onwheel" in document.createElement("div") ? "wheel" : + // Modern browsers support "wheel" + document.onmousewheel !== undefined ? "mousewheel" : + // Webkit and IE support at least "mousewheel" + + // DOMMouseScroll - Older Firefox versions use "DOMMouseScroll" + // onmousewheel - All the use "onmousewheel" + this.dom.centerContainer.addEventListener ? "DOMMouseScroll" : "onmousewheel"; + this.dom.top.addEventListener ? "DOMMouseScroll" : "onmousewheel"; + this.dom.bottom.addEventListener ? "DOMMouseScroll" : "onmousewheel"; + this.dom.centerContainer.addEventListener(wheelType, _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this), false); + this.dom.top.addEventListener(wheelType, _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this), false); + this.dom.bottom.addEventListener(wheelType, _bindInstanceProperty$1(onMouseWheel).call(onMouseWheel, this), false); + + /** + * + * @param {scroll} event + */ + function onMouseScrollSide(event) { + if (!me.options.verticalScroll) return; + event.preventDefault(); + if (me.isActive()) { + var adjusted = -event.target.scrollTop; + me._setScrollTop(adjusted); + me._redraw(); + me.emit('scrollSide', event); + } + } + this.dom.left.parentNode.addEventListener('scroll', _bindInstanceProperty$1(onMouseScrollSide).call(onMouseScrollSide, this)); + this.dom.right.parentNode.addEventListener('scroll', _bindInstanceProperty$1(onMouseScrollSide).call(onMouseScrollSide, this)); + var itemAddedToTimeline = false; + + /** + * + * @param {dragover} event + * @returns {boolean} + */ + function handleDragOver(event) { + var _context4; + if (event.preventDefault) { + me.emit('dragover', me.getEventProperties(event)); + event.preventDefault(); // Necessary. Allows us to drop. + } + + // make sure your target is a timeline element + if (!(_indexOfInstanceProperty(_context4 = event.target.className).call(_context4, "timeline") > -1)) return; + + // make sure only one item is added every time you're over the timeline + if (itemAddedToTimeline) return; + event.dataTransfer.dropEffect = 'move'; + itemAddedToTimeline = true; + return false; + } + + /** + * + * @param {drop} event + * @returns {boolean} + */ + function handleDrop(event) { + // prevent redirect to blank page - Firefox + if (event.preventDefault) { + event.preventDefault(); + } + if (event.stopPropagation) { + event.stopPropagation(); + } + // return when dropping non-timeline items + try { + var itemData = JSON.parse(event.dataTransfer.getData("text")); + if (!itemData || !itemData.content) return; + } catch (err) { + return false; + } + itemAddedToTimeline = false; + event.center = { + x: event.clientX, + y: event.clientY + }; + if (itemData.target !== 'item') { + me.itemSet._onAddItem(event); + } else { + me.itemSet._onDropObjectOnItem(event); + } + me.emit('drop', me.getEventProperties(event)); + return false; + } + this.dom.center.addEventListener('dragover', _bindInstanceProperty$1(handleDragOver).call(handleDragOver, this), false); + this.dom.center.addEventListener('drop', _bindInstanceProperty$1(handleDrop).call(handleDrop, this), false); + this.customTimes = []; + + // store state information needed for touch events + this.touch = {}; + this.redrawCount = 0; + this.initialDrawDone = false; + this.initialRangeChangeDone = false; + + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); + container.appendChild(this.dom.loadingScreen); + } + + /** + * Set options. Options will be passed to all components loaded in the Timeline. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Timeline, + * can be 'bottom' (default) or 'top'. + * {string | number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {string | number} height + * Fixed height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Timeline will automatically size such that + * its contents fit. + * {string | number} minHeight + * Minimum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {string | number} maxHeight + * Maximum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {number | Date | string} start + * Start date for the visible window + * {number | Date | string} end + * End date for the visible window + */ + }, { + key: "setOptions", + value: function setOptions(options) { + var _context7; + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'preferZoom', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll', 'longSelectPressTime', 'snap']; + availableUtils.selectiveExtend(fields, this.options, options); + this.dom.rollingModeBtn.style.visibility = 'hidden'; + if (this.options.rtl) { + this.dom.container.style.direction = "rtl"; + this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl'; + } + if (this.options.verticalScroll) { + if (this.options.rtl) { + this.dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; + } else { + this.dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; + } + } + if (_typeof$1(this.options.orientation) !== 'object') { + this.options.orientation = { + item: undefined, + axis: undefined + }; + } + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation = { + item: options.orientation, + axis: options.orientation + }; + } else if (_typeof$1(options.orientation) === 'object') { + if ('item' in options.orientation) { + this.options.orientation.item = options.orientation.item; + } + if ('axis' in options.orientation) { + this.options.orientation.axis = options.orientation.axis; + } + } + } + if (this.options.orientation.axis === 'both') { + if (!this.timeAxis2) { + var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body, this.options); + timeAxis2.setOptions = function (options) { + var _options = options ? availableUtils.extend({}, options) : {}; + _options.orientation = 'top'; // override the orientation option, always top + TimeAxis.prototype.setOptions.call(timeAxis2, _options); + }; + this.components.push(timeAxis2); + } + } else { + if (this.timeAxis2) { + var _context5; + var index = _indexOfInstanceProperty(_context5 = this.components).call(_context5, this.timeAxis2); + if (index !== -1) { + var _context6; + _spliceInstanceProperty(_context6 = this.components).call(_context6, index, 1); + } + this.timeAxis2.destroy(); + this.timeAxis2 = null; + } + } + + // if the graph2d's drawPoints is a function delegate the callback to the onRender property + if (typeof options.drawPoints == 'function') { + options.drawPoints = { + onRender: options.drawPoints + }; + } + if ('hiddenDates' in this.options) { + convertHiddenOptions(this.options.moment, this.body, this.options.hiddenDates); + } + if ('clickToUse' in options) { + if (options.clickToUse) { + if (!this.activator) { + this.activator = new Activator(this.dom.root); + } + } else { + if (this.activator) { + this.activator.destroy(); + delete this.activator; + } + } + } + + // enable/disable autoResize + this._initAutoResize(); + } + + // propagate options to all components + _forEachInstanceProperty(_context7 = this.components).call(_context7, function (component) { + return component.setOptions(options); + }); + + // enable/disable configure + if ('configure' in options) { + var _context8; + if (!this.configurator) { + this.configurator = this._createConfigurator(); + } + this.configurator.setOptions(options.configure); + + // collect the settings of all components, and pass them to the configuration system + var appliedOptions = availableUtils.deepExtend({}, this.options); + _forEachInstanceProperty(_context8 = this.components).call(_context8, function (component) { + availableUtils.deepExtend(appliedOptions, component.options); + }); + this.configurator.setModuleOptions({ + global: appliedOptions + }); + } + this._redraw(); + } + + /** + * Returns true when the Timeline is active. + * @returns {boolean} + */ + }, { + key: "isActive", + value: function isActive() { + return !this.activator || this.activator.active; + } + + /** + * Destroy the Core, clean up all DOM elements and event listeners. + */ + }, { + key: "destroy", + value: function destroy() { + var _context9; + // unbind datasets + this.setItems(null); + this.setGroups(null); + + // remove all event listeners + this.off(); + + // stop checking for changed size + this._stopAutoResize(); + + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + } + this.dom = null; + + // remove Activator + if (this.activator) { + this.activator.destroy(); + delete this.activator; + } + + // cleanup hammer touch events + for (var event in this.timelineListeners) { + if (this.timelineListeners.hasOwnProperty(event)) { + delete this.timelineListeners[event]; + } + } + this.timelineListeners = null; + this.hammer && this.hammer.destroy(); + this.hammer = null; + + // give all components the opportunity to cleanup + _forEachInstanceProperty(_context9 = this.components).call(_context9, function (component) { + return component.destroy(); + }); + this.body = null; + } + + /** + * Set a custom time bar + * @param {Date} time + * @param {number} [id=undefined] Optional id of the custom time bar to be adjusted. + */ + }, { + key: "setCustomTime", + value: function setCustomTime(time, id) { + var _context10; + var customTimes = _filterInstanceProperty(_context10 = this.customTimes).call(_context10, function (component) { + return id === component.options.id; + }); + if (customTimes.length === 0) { + throw new Error("No custom time bar found with id ".concat(_JSON$stringify(id))); + } + if (customTimes.length > 0) { + customTimes[0].setCustomTime(time); + } + } + + /** + * Retrieve the current custom time. + * @param {number} [id=undefined] Id of the custom time bar. + * @return {Date | undefined} customTime + */ + }, { + key: "getCustomTime", + value: function getCustomTime(id) { + var _context11; + var customTimes = _filterInstanceProperty(_context11 = this.customTimes).call(_context11, function (component) { + return component.options.id === id; + }); + if (customTimes.length === 0) { + throw new Error("No custom time bar found with id ".concat(_JSON$stringify(id))); + } + return customTimes[0].getCustomTime(); + } + + /** + * Set a custom marker for the custom time bar. + * @param {string} [title] Title of the custom marker. + * @param {number} [id=undefined] Id of the custom marker. + * @param {boolean} [editable=false] Make the custom marker editable. + */ + }, { + key: "setCustomTimeMarker", + value: function setCustomTimeMarker(title, id, editable) { + var _context12; + var customTimes = _filterInstanceProperty(_context12 = this.customTimes).call(_context12, function (component) { + return component.options.id === id; + }); + if (customTimes.length === 0) { + throw new Error("No custom time bar found with id ".concat(_JSON$stringify(id))); + } + if (customTimes.length > 0) { + customTimes[0].setCustomMarker(title, editable); + } + } + + /** + * Set a custom title for the custom time bar. + * @param {string} [title] Custom title + * @param {number} [id=undefined] Id of the custom time bar. + * @returns {*} + */ + }, { + key: "setCustomTimeTitle", + value: function setCustomTimeTitle(title, id) { + var _context13; + var customTimes = _filterInstanceProperty(_context13 = this.customTimes).call(_context13, function (component) { + return component.options.id === id; + }); + if (customTimes.length === 0) { + throw new Error("No custom time bar found with id ".concat(_JSON$stringify(id))); + } + if (customTimes.length > 0) { + return customTimes[0].setCustomTitle(title); + } + } + + /** + * Retrieve meta information from an event. + * Should be overridden by classes extending Core + * @param {Event} event + * @return {Object} An object with related information. + */ + }, { + key: "getEventProperties", + value: function getEventProperties(event) { + return { + event: event + }; + } + + /** + * Add custom vertical bar + * @param {Date | string | number} [time] A Date, unix timestamp, or + * ISO date string. Time point where + * the new bar should be placed. + * If not provided, `new Date()` will + * be used. + * @param {number | string} [id=undefined] Id of the new bar. Optional + * @return {number | string} Returns the id of the new bar + */ + }, { + key: "addCustomTime", + value: function addCustomTime(time, id) { + var _context14; + var timestamp = time !== undefined ? availableUtils.convert(time, 'Date') : new Date(); + var exists = _someInstanceProperty(_context14 = this.customTimes).call(_context14, function (customTime) { + return customTime.options.id === id; + }); + if (exists) { + throw new Error("A custom time with id ".concat(_JSON$stringify(id), " already exists")); + } + var customTime = new CustomTime(this.body, availableUtils.extend({}, this.options, { + time: timestamp, + id: id, + snap: this.itemSet ? this.itemSet.options.snap : this.options.snap + })); + this.customTimes.push(customTime); + this.components.push(customTime); + this._redraw(); + return id; + } + + /** + * Remove previously added custom bar + * @param {int} id ID of the custom bar to be removed + * [at]returns {boolean} True if the bar exists and is removed, false otherwise + */ + }, { + key: "removeCustomTime", + value: function removeCustomTime(id) { + var _context15, + _this2 = this; + var customTimes = _filterInstanceProperty(_context15 = this.customTimes).call(_context15, function (bar) { + return bar.options.id === id; + }); + if (customTimes.length === 0) { + throw new Error("No custom time bar found with id ".concat(_JSON$stringify(id))); + } + _forEachInstanceProperty(customTimes).call(customTimes, function (customTime) { + var _context16, _context17, _context18, _context19; + _spliceInstanceProperty(_context16 = _this2.customTimes).call(_context16, _indexOfInstanceProperty(_context17 = _this2.customTimes).call(_context17, customTime), 1); + _spliceInstanceProperty(_context18 = _this2.components).call(_context18, _indexOfInstanceProperty(_context19 = _this2.components).call(_context19, customTime), 1); + customTime.destroy(); + }); + } + + /** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ + }, { + key: "getVisibleItems", + value: function getVisibleItems() { + return this.itemSet && this.itemSet.getVisibleItems() || []; + } + + /** + * Get the id's of the items at specific time, where a click takes place on the timeline. + * @returns {Array} The ids of all items in existence at the time of event. + */ + }, { + key: "getItemsAtCurrentTime", + value: function getItemsAtCurrentTime(timeOfEvent) { + this.time = timeOfEvent; + return this.itemSet && this.itemSet.getItemsAtCurrentTime(this.time) || []; + } + + /** + * Get the id's of the currently visible groups. + * @returns {Array} The ids of the visible groups + */ + }, { + key: "getVisibleGroups", + value: function getVisibleGroups() { + return this.itemSet && this.itemSet.getVisibleGroups() || []; + } + + /** + * Set Core window such that it fits all items + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ + }, { + key: "fit", + value: function fit(options, callback) { + var range = this.getDataRange(); + + // skip range set if there is no min and max date + if (range.min === null && range.max === null) { + return; + } + + // apply a margin of 1% left and right of the data + var interval = range.max - range.min; + var min = new Date(range.min.valueOf() - interval * 0.01); + var max = new Date(range.max.valueOf() + interval * 0.01); + var animation = options && options.animation !== undefined ? options.animation : true; + this.range.setRange(min, max, { + animation: animation + }, callback); + } + + /** + * Calculate the data range of the items start and end dates + * [at]returns {{min: [Date], max: [Date]}} + * @protected + */ + }, { + key: "getDataRange", + value: function getDataRange() { + // must be implemented by Timeline and Graph2d + throw new Error('Cannot invoke abstract method getDataRange'); + } + + /** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(start, end, options) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | number | string | Object} [start] Start date of visible window + * @param {Date | number | string} [end] End date of visible window + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ + }, { + key: "setWindow", + value: function setWindow(start, end, options, callback) { + if (typeof arguments[2] == "function") { + callback = arguments[2]; + options = {}; + } + var animation; + var range; + if (arguments.length == 1) { + range = arguments[0]; + animation = range.animation !== undefined ? range.animation : true; + this.range.setRange(range.start, range.end, { + animation: animation + }); + } else if (arguments.length == 2 && typeof arguments[1] == "function") { + range = arguments[0]; + callback = arguments[1]; + animation = range.animation !== undefined ? range.animation : true; + this.range.setRange(range.start, range.end, { + animation: animation + }, callback); + } else { + animation = options && options.animation !== undefined ? options.animation : true; + this.range.setRange(start, end, { + animation: animation + }, callback); + } + } + + /** + * Move the window such that given time is centered on screen. + * @param {Date | number | string} time + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ + }, { + key: "moveTo", + value: function moveTo(time, options, callback) { + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var interval = this.range.end - this.range.start; + var t = availableUtils.convert(time, 'Date').valueOf(); + var start = t - interval / 2; + var end = t + interval / 2; + var animation = options && options.animation !== undefined ? options.animation : true; + this.range.setRange(start, end, { + animation: animation + }, callback); + } + + /** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ + }, { + key: "getWindow", + value: function getWindow() { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) + }; + } + + /** + * Zoom in the window such that given time is centered on screen. + * @param {number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ + }, { + key: "zoomIn", + value: function zoomIn(percentage, options, callback) { + if (!percentage || percentage < 0 || percentage > 1) return; + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var range = this.getWindow(); + var start = range.start.valueOf(); + var end = range.end.valueOf(); + var interval = end - start; + var newInterval = interval / (1 + percentage); + var distance = (interval - newInterval) / 2; + var newStart = start + distance; + var newEnd = end - distance; + this.setWindow(newStart, newEnd, options, callback); + } + + /** + * Zoom out the window such that given time is centered on screen. + * @param {number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ + }, { + key: "zoomOut", + value: function zoomOut(percentage, options, callback) { + if (!percentage || percentage < 0 || percentage > 1) return; + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var range = this.getWindow(); + var start = range.start.valueOf(); + var end = range.end.valueOf(); + var interval = end - start; + var newStart = start - interval * percentage / 2; + var newEnd = end + interval * percentage / 2; + this.setWindow(newStart, newEnd, options, callback); + } + + /** + * Force a redraw. Can be overridden by implementations of Core + * + * Note: this function will be overridden on construction with a trottled version + */ + }, { + key: "redraw", + value: function redraw() { + this._redraw(); + } + + /** + * Redraw for internal use. Redraws all components. See also the public + * method redraw. + * @protected + */ + }, { + key: "_redraw", + value: function _redraw() { + var _context20; + this.redrawCount++; + var dom = this.dom; + if (!dom || !dom.container || dom.root.offsetWidth == 0) return; // when destroyed, or invisible + + var resized = false; + var options = this.options; + var props = this.props; + updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); + + // update class names + if (options.orientation == 'top') { + availableUtils.addClassName(dom.root, 'vis-top'); + availableUtils.removeClassName(dom.root, 'vis-bottom'); + } else { + availableUtils.removeClassName(dom.root, 'vis-top'); + availableUtils.addClassName(dom.root, 'vis-bottom'); + } + if (options.rtl) { + availableUtils.addClassName(dom.root, 'vis-rtl'); + availableUtils.removeClassName(dom.root, 'vis-ltr'); + } else { + availableUtils.addClassName(dom.root, 'vis-ltr'); + availableUtils.removeClassName(dom.root, 'vis-rtl'); + } + + // update root width and height options + dom.root.style.maxHeight = availableUtils.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = availableUtils.option.asSize(options.minHeight, ''); + dom.root.style.width = availableUtils.option.asSize(options.width, ''); + var rootOffsetWidth = dom.root.offsetWidth; + + // calculate border widths + props.border.left = 1; + props.border.right = 1; + props.border.top = 1; + props.border.bottom = 1; + + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = Math.round(dom.bottom.getBoundingClientRect().height) || dom.bottom.clientHeight || -props.border.bottom; + + // TODO: compensate borders when any of the panels is empty. + + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + props.border.top + props.border.bottom; + dom.root.style.height = availableUtils.option.asSize(options.height, "".concat(autoHeight, "px")); + + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height; + var containerHeight = props.root.height - props.top.height - props.bottom.height; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; + + // calculate the widths of the panels + props.root.width = rootOffsetWidth; + props.background.width = props.root.width; + if (!this.initialDrawDone) { + props.scrollbarWidth = availableUtils.getScrollBarWidth(); + } + var leftContainerClientWidth = dom.leftContainer.clientWidth; + var rightContainerClientWidth = dom.rightContainer.clientWidth; + if (options.verticalScroll) { + if (options.rtl) { + props.left.width = leftContainerClientWidth || -props.border.left; + props.right.width = rightContainerClientWidth + props.scrollbarWidth || -props.border.right; + } else { + props.left.width = leftContainerClientWidth + props.scrollbarWidth || -props.border.left; + props.right.width = rightContainerClientWidth || -props.border.right; + } + } else { + props.left.width = leftContainerClientWidth || -props.border.left; + props.right.width = rightContainerClientWidth || -props.border.right; + } + this._setDOM(); + + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Core or of the contents of the center changed + var offset = this._updateScrollTop(); + + // reposition the scrollable contents + if (options.orientation.item != 'top') { + offset += Math.max(props.centerContainer.height - props.center.height - props.border.top - props.border.bottom, 0); + } + dom.center.style.transform = "translateY(".concat(offset, "px)"); + + // show shadows when vertical scrolling is available + var visibilityTop = props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = props.scrollTop == props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; + if (options.verticalScroll) { + dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; + dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; + dom.shadowTopRight.style.visibility = "hidden"; + dom.shadowBottomRight.style.visibility = "hidden"; + dom.shadowTopLeft.style.visibility = "hidden"; + dom.shadowBottomLeft.style.visibility = "hidden"; + dom.left.style.top = '0px'; + dom.right.style.top = '0px'; + } + if (!options.verticalScroll || props.center.height < props.centerContainer.height) { + dom.left.style.top = "".concat(offset, "px"); + dom.right.style.top = "".concat(offset, "px"); + dom.rightContainer.className = dom.rightContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); + dom.leftContainer.className = dom.leftContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); + props.left.width = leftContainerClientWidth || -props.border.left; + props.right.width = rightContainerClientWidth || -props.border.right; + this._setDOM(); + } + + // enable/disable vertical panning + var contentsOverflow = props.center.height > props.centerContainer.height; + this.hammer.get('pan').set({ + direction: contentsOverflow ? Hammer.DIRECTION_ALL : Hammer.DIRECTION_HORIZONTAL + }); + + // set the long press time + this.hammer.get('press').set({ + time: this.options.longSelectPressTime + }); + + // redraw all components + _forEachInstanceProperty(_context20 = this.components).call(_context20, function (component) { + resized = component.redraw() || resized; + }); + var MAX_REDRAW = 5; + if (resized) { + if (this.redrawCount < MAX_REDRAW) { + this.body.emitter.emit('_change'); + return; + } else { + console.log('WARNING: infinite loop in redraw?'); + } + } else { + this.redrawCount = 0; + } + + //Emit public 'changed' event for UI updates, see issue #1592 + this.body.emitter.emit("changed"); + } + + /** + * sets the basic DOM components needed for the timeline\graph2d + */ + }, { + key: "_setDOM", + value: function _setDOM() { + var props = this.props; + var dom = this.dom; + props.leftContainer.width = props.left.width; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = "".concat(props.background.height, "px"); + dom.backgroundVertical.style.height = "".concat(props.background.height, "px"); + dom.backgroundHorizontal.style.height = "".concat(props.centerContainer.height, "px"); + dom.centerContainer.style.height = "".concat(props.centerContainer.height, "px"); + dom.leftContainer.style.height = "".concat(props.leftContainer.height, "px"); + dom.rightContainer.style.height = "".concat(props.rightContainer.height, "px"); + dom.background.style.width = "".concat(props.background.width, "px"); + dom.backgroundVertical.style.width = "".concat(props.centerContainer.width, "px"); + dom.backgroundHorizontal.style.width = "".concat(props.background.width, "px"); + dom.centerContainer.style.width = "".concat(props.center.width, "px"); + dom.top.style.width = "".concat(props.top.width, "px"); + dom.bottom.style.width = "".concat(props.bottom.width, "px"); + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = "".concat(props.left.width + props.border.left, "px"); + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = "".concat(props.top.height, "px"); + dom.centerContainer.style.left = "".concat(props.left.width, "px"); + dom.centerContainer.style.top = "".concat(props.top.height, "px"); + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = "".concat(props.top.height, "px"); + dom.rightContainer.style.left = "".concat(props.left.width + props.center.width, "px"); + dom.rightContainer.style.top = "".concat(props.top.height, "px"); + dom.top.style.left = "".concat(props.left.width, "px"); + dom.top.style.top = '0'; + dom.bottom.style.left = "".concat(props.left.width, "px"); + dom.bottom.style.top = "".concat(props.top.height + props.centerContainer.height, "px"); + dom.center.style.left = '0'; + dom.left.style.left = '0'; + dom.right.style.left = '0'; + } + + /** + * Set a current time. This can be used for example to ensure that a client's + * time is synchronized with a shared server time. + * Only applicable when option `showCurrentTime` is true. + * @param {Date | string | number} time A Date, unix timestamp, or + * ISO date string. + */ + }, { + key: "setCurrentTime", + value: function setCurrentTime(time) { + if (!this.currentTime) { + throw new Error('Option showCurrentTime must be true'); + } + this.currentTime.setCurrentTime(time); + } + + /** + * Get the current time. + * Only applicable when option `showCurrentTime` is true. + * @return {Date} Returns the current time. + */ + }, { + key: "getCurrentTime", + value: function getCurrentTime() { + if (!this.currentTime) { + throw new Error('Option showCurrentTime must be true'); + } + return this.currentTime.getCurrentTime(); + } + + /** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @protected + * TODO: move this function to Range + */ + }, { + key: "_toTime", + value: function _toTime(x) { + return toTime(this, x, this.props.center.width); + } + + /** + * Convert a position on the global screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @protected + * TODO: move this function to Range + */ + }, { + key: "_toGlobalTime", + value: function _toGlobalTime(x) { + return toTime(this, x, this.props.root.width); + //var conversion = this.range.conversion(this.props.root.width); + //return new Date(x / conversion.scale + conversion.offset); + } + + /** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @protected + * TODO: move this function to Range + */ + }, { + key: "_toScreen", + value: function _toScreen(time) { + return toScreen(this, time, this.props.center.width); + } + + /** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @protected + * TODO: move this function to Range + */ + }, { + key: "_toGlobalScreen", + value: function _toGlobalScreen(time) { + return toScreen(this, time, this.props.root.width); + //var conversion = this.range.conversion(this.props.root.width); + //return (time.valueOf() - conversion.offset) * conversion.scale; + } + + /** + * Initialize watching when option autoResize is true + * @private + */ + }, { + key: "_initAutoResize", + value: function _initAutoResize() { + if (this.options.autoResize == true) { + this._startAutoResize(); + } else { + this._stopAutoResize(); + } + } + + /** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ + }, { + key: "_startAutoResize", + value: function _startAutoResize() { + var me = this; + this._stopAutoResize(); + this._onResize = function () { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; + } + if (me.dom.root) { + var rootOffsetHeight = me.dom.root.offsetHeight; + var rootOffsetWidth = me.dom.root.offsetWidth; + // check whether the frame is resized + // Note: we compare offsetWidth here, not clientWidth. For some reason, + // IE does not restore the clientWidth from 0 to the actual width after + // changing the timeline's container display style from none to visible + if (rootOffsetWidth != me.props.lastWidth || rootOffsetHeight != me.props.lastHeight) { + me.props.lastWidth = rootOffsetWidth; + me.props.lastHeight = rootOffsetHeight; + me.props.scrollbarWidth = availableUtils.getScrollBarWidth(); + me.body.emitter.emit('_change'); + } + } + }; + + // add event listener to window resize + window.addEventListener('resize', this._onResize); + + //Prevent initial unnecessary redraw + if (me.dom.root) { + me.props.lastWidth = me.dom.root.offsetWidth; + me.props.lastHeight = me.dom.root.offsetHeight; + } + this.watchTimer = _setInterval(this._onResize, 1000); + } + + /** + * Stop watching for a resize of the frame. + * @private + */ + }, { + key: "_stopAutoResize", + value: function _stopAutoResize() { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; + } + + // remove event listener on window.resize + if (this._onResize) { + window.removeEventListener('resize', this._onResize); + this._onResize = null; + } + } + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + }, { + key: "_onTouch", + value: function _onTouch(event) { + // eslint-disable-line no-unused-vars + this.touch.allowDragging = true; + this.touch.initialScrollTop = this.props.scrollTop; + } + + /** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ + }, { + key: "_onPinch", + value: function _onPinch(event) { + // eslint-disable-line no-unused-vars + this.touch.allowDragging = false; + } + + /** + * Move the timeline vertically + * @param {Event} event + * @private + */ + }, { + key: "_onDrag", + value: function _onDrag(event) { + if (!event) return; + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; + var delta = event.deltaY; + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); + if (this.options.verticalScroll) { + this.dom.left.parentNode.scrollTop = -this.props.scrollTop; + this.dom.right.parentNode.scrollTop = -this.props.scrollTop; + } + if (newScrollTop != oldScrollTop) { + this.emit("verticalDrag"); + } + } + + /** + * Apply a scrollTop + * @param {number} scrollTop + * @returns {number} scrollTop Returns the applied scrollTop + * @private + */ + }, { + key: "_setScrollTop", + value: function _setScrollTop(scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; + } + + /** + * Update the current scrollTop when the height of the containers has been changed + * @returns {number} scrollTop Returns the applied scrollTop + * @private + */ + }, { + key: "_updateScrollTop", + value: function _updateScrollTop() { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.border.top - this.props.border.bottom - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation.item != 'top') { + this.props.scrollTop += scrollTopMin - this.props.scrollTopMin; + } + this.props.scrollTopMin = scrollTopMin; + } + + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; + if (this.options.verticalScroll) { + this.dom.left.parentNode.scrollTop = -this.props.scrollTop; + this.dom.right.parentNode.scrollTop = -this.props.scrollTop; + } + return this.props.scrollTop; + } + + /** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ + }, { + key: "_getScrollTop", + value: function _getScrollTop() { + return this.props.scrollTop; + } + + /** + * Load a configurator + * [at]returns {Object} + * @private + */ + }, { + key: "_createConfigurator", + value: function _createConfigurator() { + throw new Error('Cannot invoke abstract method _createConfigurator'); + } + }]); + return Core; + }(); // turn Core into an event emitter + Emitter(Core.prototype); + + function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$9() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * A current time bar + */ + var CurrentTime = /*#__PURE__*/function (_Component) { + _inherits(CurrentTime, _Component); + var _super = _createSuper$9(CurrentTime); + /** + * @param {{range: Range, dom: Object, domProps: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCurrentTime] + * {String} [alignCurrentTime] + * @constructor CurrentTime + * @extends Component + */ + function CurrentTime(body, options) { + var _context; + var _this; + _classCallCheck(this, CurrentTime); + _this = _super.call(this); + _this.body = body; + + // default options + _this.defaultOptions = { + rtl: false, + showCurrentTime: true, + alignCurrentTime: undefined, + moment: moment$4, + locales: locales, + locale: 'en' + }; + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.setOptions(options); + _this.options.locales = availableUtils.extend({}, locales, _this.options.locales); + var defaultLocales = _this.defaultOptions.locales[_this.defaultOptions.locale]; + _forEachInstanceProperty(_context = _Object$keys(_this.options.locales)).call(_context, function (locale) { + _this.options.locales[locale] = availableUtils.extend({}, defaultLocales, _this.options.locales[locale]); + }); + _this.offset = 0; + _this._create(); + return _this; + } + + /** + * Create the HTML DOM for the current time bar + * @private + */ + _createClass(CurrentTime, [{ + key: "_create", + value: function _create() { + var bar = document.createElement('div'); + bar.className = 'vis-current-time'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + this.bar = bar; + } + + /** + * Destroy the CurrentTime bar + */ + }, { + key: "destroy", + value: function destroy() { + this.options.showCurrentTime = false; + this.redraw(); // will remove the bar from the DOM and stop refreshing + + this.body = null; + } + + /** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCurrentTime] + * {String} [alignCurrentTime] + */ + }, { + key: "setOptions", + value: function setOptions(options) { + if (options) { + // copy all options that we know + availableUtils.selectiveExtend(['rtl', 'showCurrentTime', 'alignCurrentTime', 'moment', 'locale', 'locales'], this.options, options); + } + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + if (this.options.showCurrentTime) { + var _context2, _context3; + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); + this.start(); + } + var now = this.options.moment(_Date$now() + this.offset); + if (this.options.alignCurrentTime) { + now = now.startOf(this.options.alignCurrentTime); + } + var x = this.body.util.toScreen(now); + var locale = this.options.locales[this.options.locale]; + if (!locale) { + if (!this.warned) { + console.warn("WARNING: options.locales['".concat(this.options.locale, "'] not found. See https://visjs.github.io/vis-timeline/docs/timeline/#Localization")); + this.warned = true; + } + locale = this.options.locales['en']; // fall back on english when not available + } + + var title = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "".concat(locale.current, " ")).call(_context3, locale.time, ": ")).call(_context2, now.format('dddd, MMMM Do YYYY, H:mm:ss')); + title = title.charAt(0).toUpperCase() + title.substring(1); + if (this.options.rtl) { + this.bar.style.transform = "translateX(".concat(x * -1, "px)"); + } else { + this.bar.style.transform = "translateX(".concat(x, "px)"); + } + this.bar.title = title; + } else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + this.stop(); + } + return false; + } + + /** + * Start auto refreshing the current time bar + */ + }, { + key: "start", + value: function start() { + var me = this; + + /** + * Updates the current time. + */ + function update() { + me.stop(); + + // determine interval to refresh + var scale = me.body.range.conversion(me.body.domProps.center.width).scale; + var interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; + me.redraw(); + me.body.emitter.emit('currentTimeTick'); + + // start a renderTimer to adjust for the new time + me.currentTimeTimer = _setTimeout(update, interval); + } + update(); + } + + /** + * Stop auto refreshing the current time bar + */ + }, { + key: "stop", + value: function stop() { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + delete this.currentTimeTimer; + } + } + + /** + * Set a current time. This can be used for example to ensure that a client's + * time is synchronized with a shared server time. + * @param {Date | string | number} time A Date, unix timestamp, or + * ISO date string. + */ + }, { + key: "setCurrentTime", + value: function setCurrentTime(time) { + var t = availableUtils.convert(time, 'Date').valueOf(); + var now = _Date$now(); + this.offset = t - now; + this.redraw(); + } + + /** + * Get the current time. + * @return {Date} Returns the current time. + */ + }, { + key: "getCurrentTime", + value: function getCurrentTime() { + return new Date(_Date$now() + this.offset); + } + }]); + return CurrentTime; + }(Component); + + var $$2 = _export; + var $find = arrayIteration.find; + + var FIND = 'find'; + var SKIPS_HOLES$1 = true; + + // Shouldn't skip holes + // eslint-disable-next-line es/no-array-prototype-find -- testing + if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; }); + + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$2 = entryVirtual$o; + + var find$3 = entryVirtual$2('Array').find; + + var isPrototypeOf$2 = objectIsPrototypeOf; + var method$2 = find$3; + + var ArrayPrototype$2 = Array.prototype; + + var find$2 = function (it) { + var own = it.find; + return it === ArrayPrototype$2 || (isPrototypeOf$2(ArrayPrototype$2, it) && own === ArrayPrototype$2.find) ? method$2 : own; + }; + + var parent$2 = find$2; + + var find$1 = parent$2; + + var find = find$1; + + var _findInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(find); + + var $$1 = _export; + var $findIndex = arrayIteration.findIndex; + + var FIND_INDEX = 'findIndex'; + var SKIPS_HOLES = true; + + // Shouldn't skip holes + // eslint-disable-next-line es/no-array-prototype-findindex -- testing + if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); + + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findindex + $$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual$1 = entryVirtual$o; + + var findIndex$3 = entryVirtual$1('Array').findIndex; + + var isPrototypeOf$1 = objectIsPrototypeOf; + var method$1 = findIndex$3; + + var ArrayPrototype$1 = Array.prototype; + + var findIndex$2 = function (it) { + var own = it.findIndex; + return it === ArrayPrototype$1 || (isPrototypeOf$1(ArrayPrototype$1, it) && own === ArrayPrototype$1.findIndex) ? method$1 : own; + }; + + var parent$1 = findIndex$2; + + var findIndex$1 = parent$1; + + var findIndex = findIndex$1; + + var _findIndexInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(findIndex); + + function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$5(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); } + function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + // Utility functions for ordering and stacking of items + var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors + + /** + * Order items by their start data + * @param {Item[]} items + */ + function orderByStart(items) { + _sortInstanceProperty(items).call(items, function (a, b) { + return a.data.start - b.data.start; + }); + } + + /** + * Order items by their end date. If they have no end date, their start date + * is used. + * @param {Item[]} items + */ + function orderByEnd(items) { + _sortInstanceProperty(items).call(items, function (a, b) { + var aTime = 'end' in a.data ? a.data.end : a.data.start; + var bTime = 'end' in b.data ? b.data.end : b.data.start; + return aTime - bTime; + }); + } + + /** + * Adjust vertical positions of the items such that they don't overlap each + * other. + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {boolean} [force=false] + * If true, all items will be repositioned. If false (default), only + * items having a top===null will be re-stacked + * @param {function} shouldBailItemsRedrawFunction + * bailing function + * @return {boolean} shouldBail + */ + function stack(items, margin, force, shouldBailItemsRedrawFunction) { + var stackingResult = performStacking(items, margin.item, false, function (item) { + return item.stack && (force || item.top === null); + }, function (item) { + return item.stack; + }, function (item) { + return margin.axis; + }, shouldBailItemsRedrawFunction); + + // If shouldBail function returned true during stacking calculation + return stackingResult === null; + } + + /** + * Adjust vertical positions of the items within a single subgroup such that they + * don't overlap each other. + * @param {Item[]} items + * All items withina subgroup + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroup} subgroup + * The subgroup that is being stacked + */ + function substack(items, margin, subgroup) { + var subgroupHeight = performStacking(items, margin.item, false, function (item) { + return item.stack; + }, function (item) { + return true; + }, function (item) { + return item.baseTop; + }); + subgroup.height = subgroupHeight - subgroup.top + 0.5 * margin.item.vertical; + } + + /** + * Adjust vertical positions of the items without stacking them + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + * @param {boolean} isStackSubgroups + */ + function nostack(items, margin, subgroups, isStackSubgroups) { + for (var _i = 0; _i < items.length; _i++) { + if (items[_i].data.subgroup == undefined) { + items[_i].top = margin.item.vertical; + } else if (items[_i].data.subgroup !== undefined && isStackSubgroups) { + var newTop = 0; + for (var subgroup in subgroups) { + if (subgroups.hasOwnProperty(subgroup)) { + if (subgroups[subgroup].visible == true && subgroups[subgroup].index < subgroups[items[_i].data.subgroup].index) { + newTop += subgroups[subgroup].height; + subgroups[items[_i].data.subgroup].top = newTop; + } + } + } + items[_i].top = newTop + 0.5 * margin.item.vertical; + } + } + if (!isStackSubgroups) { + stackSubgroups(items, margin, subgroups); + } + } + + /** + * Adjust vertical positions of the subgroups such that they don't overlap each + * other. + * @param {Array.} items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + */ + function stackSubgroups(items, margin, subgroups) { + var _context; + performStacking(_sortInstanceProperty(_context = _Object$values2(subgroups)).call(_context, function (a, b) { + if (a.index > b.index) return 1; + if (a.index < b.index) return -1; + return 0; + }), { + vertical: 0 + }, true, function (item) { + return true; + }, function (item) { + return true; + }, function (item) { + return 0; + }); + for (var _i2 = 0; _i2 < items.length; _i2++) { + if (items[_i2].data.subgroup !== undefined) { + items[_i2].top = subgroups[items[_i2].data.subgroup].top + 0.5 * margin.item.vertical; + } + } + } + + /** + * Adjust vertical positions of the subgroups such that they don't overlap each + * other, then stacks the contents of each subgroup individually. + * @param {Item[]} subgroupItems + * All the items in a subgroup + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + */ + function stackSubgroupsWithInnerStack(subgroupItems, margin, subgroups) { + var doSubStack = false; + + // Run subgroups in their order (if any) + var subgroupOrder = []; + for (var subgroup in subgroups) { + if (subgroups[subgroup].hasOwnProperty("index")) { + subgroupOrder[subgroups[subgroup].index] = subgroup; + } else { + subgroupOrder.push(subgroup); + } + } + for (var j = 0; j < subgroupOrder.length; j++) { + subgroup = subgroupOrder[j]; + if (subgroups.hasOwnProperty(subgroup)) { + doSubStack = doSubStack || subgroups[subgroup].stack; + subgroups[subgroup].top = 0; + for (var otherSubgroup in subgroups) { + if (subgroups[otherSubgroup].visible && subgroups[subgroup].index > subgroups[otherSubgroup].index) { + subgroups[subgroup].top += subgroups[otherSubgroup].height; + } + } + var items = subgroupItems[subgroup]; + for (var _i3 = 0; _i3 < items.length; _i3++) { + if (items[_i3].data.subgroup !== undefined) { + items[_i3].top = subgroups[items[_i3].data.subgroup].top + 0.5 * margin.item.vertical; + if (subgroups[subgroup].stack) { + items[_i3].baseTop = items[_i3].top; + } + } + } + if (doSubStack && subgroups[subgroup].stack) { + substack(subgroupItems[subgroup], margin, subgroups[subgroup]); + } + } + } + } + + /** + * Reusable stacking function + * + * @param {Item[]} items + * An array of items to consider during stacking. + * @param {{horizontal: number, vertical: number}} margins + * Margins to be used for collision checking and placement of items. + * @param {boolean} compareTimes + * By default, horizontal collision is checked based on the spatial position of the items (left/right and width). + * If this argument is true, horizontal collision will instead be checked based on the start/end times of each item. + * Vertical collision is always checked spatially. + * @param {(Item) => number | null} shouldStack + * A callback function which is called before we start to process an item. The return value indicates whether the item will be processed. + * @param {(Item) => boolean} shouldOthersStack + * A callback function which indicates whether other items should consider this item when being stacked. + * @param {(Item) => number} getInitialHeight + * A callback function which determines the height items are initially placed at + * @param {() => boolean} shouldBail + * A callback function which should indicate if the stacking process should be aborted. + * + * @returns {null|number} + * if shouldBail was triggered, returns null + * otherwise, returns the maximum height + */ + function performStacking(items, margins, compareTimes, shouldStack, shouldOthersStack, getInitialHeight, shouldBail) { + // Time-based horizontal comparison + var getItemStart = function getItemStart(item) { + return item.start; + }; + var getItemEnd = function getItemEnd(item) { + return item.end; + }; + if (!compareTimes) { + // Spatial horizontal comparisons + var rtl = !!(items[0] && items[0].options.rtl); + if (rtl) { + getItemStart = function getItemStart(item) { + return item.right; + }; + } else { + getItemStart = function getItemStart(item) { + return item.left; + }; + } + getItemEnd = function getItemEnd(item) { + return getItemStart(item) + item.width + margins.horizontal; + }; + } + var itemsToPosition = []; + var itemsAlreadyPositioned = []; // It's vital that this array is kept sorted based on the start of each item + + // If the order we needed to place items was based purely on the start of each item, we could calculate stacking very efficiently. + // Unfortunately for us, this is not guaranteed. But the order is often based on the start of items at least to some degree, and + // we can use this to make some optimisations. While items are proceeding in order of start, we can keep moving our search indexes + // forwards. Then if we encounter an item that's out of order, we reset our indexes and search from the beginning of the array again. + var previousStart = null; + var insertionIndex = 0; + + // First let's handle any immoveable items + var _iterator = _createForOfIteratorHelper$5(items), + _step; + try { + var _loop2 = function _loop2() { + var item = _step.value; + if (shouldStack(item)) { + itemsToPosition.push(item); + } else { + if (shouldOthersStack(item)) { + var itemStart = getItemStart(item); + + // We need to put immoveable items into itemsAlreadyPositioned and ensure that this array is sorted. + // We could simply insert them, and then use JavaScript's sort function to sort them afterwards. + // This would achieve an average complexity of O(n log n). + // + // Instead, I'm gambling that the start of each item will usually be the same or later than the + // start of the previous item. While this holds (best case), we can insert items in O(n). + // In the worst case (where each item starts before the previous item) this grows to O(n^2). + // + // I am making the assumption that for most datasets, the "order" function will have relatively low cardinality, + // and therefore this tradeoff should be easily worth it. + if (previousStart !== null && itemStart < previousStart - EPSILON) { + insertionIndex = 0; + } + previousStart = itemStart; + insertionIndex = findIndexFrom(itemsAlreadyPositioned, function (i) { + return getItemStart(i) - EPSILON > itemStart; + }, insertionIndex); + _spliceInstanceProperty(itemsAlreadyPositioned).call(itemsAlreadyPositioned, insertionIndex, 0, item); + insertionIndex++; + } + } + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop2(); + } + + // Now we can loop through each item (in order) and find a position for them + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + previousStart = null; + var previousEnd = null; + insertionIndex = 0; + var horizontalOverlapStartIndex = 0; + var horizontalOverlapEndIndex = 0; + var maxHeight = 0; + var _loop = function _loop() { + var _context2, _context3; + var item = itemsToPosition.shift(); + item.top = getInitialHeight(item); + var itemStart = getItemStart(item); + var itemEnd = getItemEnd(item); + if (previousStart !== null && itemStart < previousStart - EPSILON) { + horizontalOverlapStartIndex = 0; + horizontalOverlapEndIndex = 0; + insertionIndex = 0; + previousEnd = null; + } + previousStart = itemStart; + + // Take advantage of the sorted itemsAlreadyPositioned array to narrow down the search + horizontalOverlapStartIndex = findIndexFrom(itemsAlreadyPositioned, function (i) { + return itemStart < getItemEnd(i) - EPSILON; + }, horizontalOverlapStartIndex); + // Since items aren't sorted by end time, it might increase or decrease from one item to the next. In order to keep an efficient search area, we will seek forwards/backwards accordingly. + if (previousEnd === null || previousEnd < itemEnd - EPSILON) { + horizontalOverlapEndIndex = findIndexFrom(itemsAlreadyPositioned, function (i) { + return itemEnd < getItemStart(i) - EPSILON; + }, Math.max(horizontalOverlapStartIndex, horizontalOverlapEndIndex)); + } + if (previousEnd !== null && previousEnd - EPSILON > itemEnd) { + horizontalOverlapEndIndex = findLastIndexBetween(itemsAlreadyPositioned, function (i) { + return itemEnd + EPSILON >= getItemStart(i); + }, horizontalOverlapStartIndex, horizontalOverlapEndIndex) + 1; + } + + // Sort by vertical position so we don't have to reconsider past items if we move an item + var horizontallyCollidingItems = _sortInstanceProperty(_context2 = _filterInstanceProperty(_context3 = _sliceInstanceProperty(itemsAlreadyPositioned).call(itemsAlreadyPositioned, horizontalOverlapStartIndex, horizontalOverlapEndIndex)).call(_context3, function (i) { + return itemStart < getItemEnd(i) - EPSILON && itemEnd - EPSILON > getItemStart(i); + })).call(_context2, function (a, b) { + return a.top - b.top; + }); + + // Keep moving the item down until it stops colliding with any other items + for (var i2 = 0; i2 < horizontallyCollidingItems.length; i2++) { + var otherItem = horizontallyCollidingItems[i2]; + if (checkVerticalSpatialCollision(item, otherItem, margins)) { + item.top = otherItem.top + otherItem.height + margins.vertical; + } + } + if (shouldOthersStack(item)) { + // Insert the item into itemsAlreadyPositioned, ensuring itemsAlreadyPositioned remains sorted. + // In the best case, we can insert an item in constant time O(1). In the worst case, we insert an item in linear time O(n). + // In both cases, this is better than doing a naive insert and then sort, which would cost on average O(n log n). + insertionIndex = findIndexFrom(itemsAlreadyPositioned, function (i) { + return getItemStart(i) - EPSILON > itemStart; + }, insertionIndex); + _spliceInstanceProperty(itemsAlreadyPositioned).call(itemsAlreadyPositioned, insertionIndex, 0, item); + insertionIndex++; + } + + // Keep track of the tallest item we've seen before + var currentHeight = item.top + item.height; + if (currentHeight > maxHeight) { + maxHeight = currentHeight; + } + if (shouldBail && shouldBail()) { + return { + v: null + }; + } + }, + _ret; + while (itemsToPosition.length > 0) { + _ret = _loop(); + if (_ret) return _ret.v; + } + return maxHeight; + } + + /** + * Test if the two provided items collide + * The items must have parameters left, width, top, and height. + * @param {Item} a The first item + * @param {Item} b The second item + * @param {{vertical: number}} margin + * An object containing a horizontal and vertical + * minimum required margin. + * @return {boolean} true if a and b collide, else false + */ + function checkVerticalSpatialCollision(a, b, margin) { + return a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top; + } + + /** + * Find index of first item to meet predicate after a certain index. + * If no such item is found, returns the length of the array. + * + * @param {any[]} arr The array + * @param {(item) => boolean} predicate A function that should return true when a suitable item is found + * @param {number|undefined} startIndex The index to start search from (inclusive). Optional, if not provided will search from the beginning of the array. + * + * @return {number} + */ + function findIndexFrom(arr, predicate, startIndex) { + var _context4; + if (!startIndex) { + startIndex = 0; + } + var matchIndex = _findIndexInstanceProperty(_context4 = _sliceInstanceProperty(arr).call(arr, startIndex)).call(_context4, predicate); + if (matchIndex === -1) { + return arr.length; + } + return matchIndex + startIndex; + } + + /** + * Find index of last item to meet predicate within a given range. + * If no such item is found, returns the index prior to the start of the range. + * + * @param {any[]} arr The array + * @param {(item) => boolean} predicate A function that should return true when a suitable item is found + * @param {number|undefined} startIndex The earliest index to search to (inclusive). Optional, if not provided will continue until the start of the array. + * @param {number|undefined} endIndex The end of the search range (exclusive). The search will begin on the index prior to this value. Optional, defaults to the end of array. + * + * @return {number} + */ + function findLastIndexBetween(arr, predicate, startIndex, endIndex) { + if (!startIndex) { + startIndex = 0; + } + if (!endIndex) { + endIndex = arr.length; + } + for (i = endIndex - 1; i >= startIndex; i--) { + if (predicate(arr[i])) { + return i; + } + } + return startIndex - 1; + } + + var stack$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + nostack: nostack, + orderByEnd: orderByEnd, + orderByStart: orderByStart, + stack: stack, + stackSubgroups: stackSubgroups, + stackSubgroupsWithInnerStack: stackSubgroupsWithInnerStack, + substack: substack + }); + + var UNGROUPED$3 = '__ungrouped__'; // reserved group id for ungrouped items + var BACKGROUND$2 = '__background__'; // reserved group id for background items without group + + var ReservedGroupIds$1 = { + UNGROUPED: UNGROUPED$3, + BACKGROUND: BACKGROUND$2 + }; + + /** + * @constructor Group + */ + var Group = /*#__PURE__*/function () { + /** + * @param {number | string} groupId + * @param {Object} data + * @param {ItemSet} itemSet + * @constructor Group + */ + function Group(groupId, data, itemSet) { + var _this = this; + _classCallCheck(this, Group); + this.groupId = groupId; + this.subgroups = {}; + this.subgroupStack = {}; + this.subgroupStackAll = false; + this.subgroupVisibility = {}; + this.doInnerStack = false; + this.shouldBailStackItems = false; + this.subgroupIndex = 0; + this.subgroupOrderer = data && data.subgroupOrder; + this.itemSet = itemSet; + this.isVisible = null; + this.stackDirty = true; // if true, items will be restacked on next redraw + + // This is a stack of functions (`() => void`) that will be executed before + // the instance is disposed off (method `dispose`). Anything that needs to + // be manually disposed off before garbage collection happens (or so that + // garbage collection can happen) should be added to this stack. + this._disposeCallbacks = []; + if (data && data.nestedGroups) { + this.nestedGroups = data.nestedGroups; + if (data.showNested == false) { + this.showNested = false; + } else { + this.showNested = true; + } + } + if (data && data.subgroupStack) { + if (typeof data.subgroupStack === "boolean") { + this.doInnerStack = data.subgroupStack; + this.subgroupStackAll = data.subgroupStack; + } else { + // We might be doing stacking on specific sub groups, but only + // if at least one is set to do stacking + for (var key in data.subgroupStack) { + this.subgroupStack[key] = data.subgroupStack[key]; + this.doInnerStack = this.doInnerStack || data.subgroupStack[key]; + } + } + } + if (data && data.heightMode) { + this.heightMode = data.heightMode; + } else { + this.heightMode = itemSet.options.groupHeightMode; + } + this.nestedInGroup = null; + this.dom = {}; + this.props = { + label: { + width: 0, + height: 0 + } + }; + this.className = null; + this.items = {}; // items filtered by groupId of this group + this.visibleItems = []; // items currently visible in window + this.itemsInRange = []; // items currently in range + this.orderedItems = { + byStart: [], + byEnd: [] + }; + this.checkRangedItems = false; // needed to refresh the ranged items if the window is programatically changed with NO overlap. + + var handleCheckRangedItems = function handleCheckRangedItems() { + _this.checkRangedItems = true; + }; + this.itemSet.body.emitter.on("checkRangedItems", handleCheckRangedItems); + this._disposeCallbacks.push(function () { + _this.itemSet.body.emitter.off("checkRangedItems", handleCheckRangedItems); + }); + this._create(); + this.setData(data); + } + + /** + * Create DOM elements for the group + * @private + */ + _createClass(Group, [{ + key: "_create", + value: function _create() { + var label = document.createElement('div'); + if (this.itemSet.options.groupEditable.order) { + label.className = 'vis-label draggable'; + } else { + label.className = 'vis-label'; + } + this.dom.label = label; + var inner = document.createElement('div'); + inner.className = 'vis-inner'; + label.appendChild(inner); + this.dom.inner = inner; + var foreground = document.createElement('div'); + foreground.className = 'vis-group'; + foreground['vis-group'] = this; + this.dom.foreground = foreground; + this.dom.background = document.createElement('div'); + this.dom.background.className = 'vis-group'; + this.dom.axis = document.createElement('div'); + this.dom.axis.className = 'vis-group'; + + // create a hidden marker to detect when the Timelines container is attached + // to the DOM, or the style of a parent of the Timeline is changed from + // display:none is changed to visible. + this.dom.marker = document.createElement('div'); + this.dom.marker.style.visibility = 'hidden'; + this.dom.marker.style.position = 'absolute'; + this.dom.marker.innerHTML = ''; + this.dom.background.appendChild(this.dom.marker); + } + + /** + * Set the group data for this group + * @param {Object} data Group data, can contain properties content and className + */ + }, { + key: "setData", + value: function setData(data) { + if (this.itemSet.groupTouchParams.isDragging) return; + + // update contents + var content; + var templateFunction; + if (data && data.subgroupVisibility) { + for (var key in data.subgroupVisibility) { + this.subgroupVisibility[key] = data.subgroupVisibility[key]; + } + } + if (this.itemSet.options && this.itemSet.options.groupTemplate) { + var _context; + templateFunction = _bindInstanceProperty$1(_context = this.itemSet.options.groupTemplate).call(_context, this); + content = templateFunction(data, this.dom.inner); + } else { + content = data && data.content; + } + if (content instanceof Element) { + while (this.dom.inner.firstChild) { + this.dom.inner.removeChild(this.dom.inner.firstChild); + } + this.dom.inner.appendChild(content); + } else if (content instanceof Object && content.isReactComponent) ; else if (content instanceof Object) { + templateFunction(data, this.dom.inner); + } else if (content !== undefined && content !== null) { + this.dom.inner.innerHTML = availableUtils.xss(content); + } else { + this.dom.inner.innerHTML = availableUtils.xss(this.groupId || ''); // groupId can be null + } + + // update title + this.dom.label.title = data && data.title || ''; + if (!this.dom.inner.firstChild) { + availableUtils.addClassName(this.dom.inner, 'vis-hidden'); + } else { + availableUtils.removeClassName(this.dom.inner, 'vis-hidden'); + } + if (data && data.nestedGroups) { + if (!this.nestedGroups || this.nestedGroups != data.nestedGroups) { + this.nestedGroups = data.nestedGroups; + } + if (data.showNested !== undefined || this.showNested === undefined) { + if (data.showNested == false) { + this.showNested = false; + } else { + this.showNested = true; + } + } + availableUtils.addClassName(this.dom.label, 'vis-nesting-group'); + if (this.showNested) { + availableUtils.removeClassName(this.dom.label, 'collapsed'); + availableUtils.addClassName(this.dom.label, 'expanded'); + } else { + availableUtils.removeClassName(this.dom.label, 'expanded'); + availableUtils.addClassName(this.dom.label, 'collapsed'); + } + } else if (this.nestedGroups) { + this.nestedGroups = null; + availableUtils.removeClassName(this.dom.label, 'collapsed'); + availableUtils.removeClassName(this.dom.label, 'expanded'); + availableUtils.removeClassName(this.dom.label, 'vis-nesting-group'); + } + if (data && (data.treeLevel || data.nestedInGroup)) { + availableUtils.addClassName(this.dom.label, 'vis-nested-group'); + if (data.treeLevel) { + availableUtils.addClassName(this.dom.label, 'vis-group-level-' + data.treeLevel); + } else { + // Nesting level is unknown, but we're sure it's at least 1 + availableUtils.addClassName(this.dom.label, 'vis-group-level-unknown-but-gte1'); + } + } else { + availableUtils.addClassName(this.dom.label, 'vis-group-level-0'); + } + + // update className + var className = data && data.className || null; + if (className != this.className) { + if (this.className) { + availableUtils.removeClassName(this.dom.label, this.className); + availableUtils.removeClassName(this.dom.foreground, this.className); + availableUtils.removeClassName(this.dom.background, this.className); + availableUtils.removeClassName(this.dom.axis, this.className); + } + availableUtils.addClassName(this.dom.label, className); + availableUtils.addClassName(this.dom.foreground, className); + availableUtils.addClassName(this.dom.background, className); + availableUtils.addClassName(this.dom.axis, className); + this.className = className; + } + + // update style + if (this.style) { + availableUtils.removeCssText(this.dom.label, this.style); + this.style = null; + } + if (data && data.style) { + availableUtils.addCssText(this.dom.label, data.style); + this.style = data.style; + } + } + + /** + * Get the width of the group label + * @return {number} width + */ + }, { + key: "getLabelWidth", + value: function getLabelWidth() { + return this.props.label.width; + } + + /** + * check if group has had an initial height hange + * @returns {boolean} + */ + }, { + key: "_didMarkerHeightChange", + value: function _didMarkerHeightChange() { + var markerHeight = this.dom.marker.clientHeight; + if (markerHeight != this.lastMarkerHeight) { + this.lastMarkerHeight = markerHeight; + var redrawQueue = {}; + var redrawQueueLength = 0; + _forEachInstanceProperty(availableUtils).call(availableUtils, this.items, function (item, key) { + item.dirty = true; + if (item.displayed) { + var returnQueue = true; + redrawQueue[key] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[key].length; + } + }); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + var _loop = function _loop(i) { + _forEachInstanceProperty(availableUtils).call(availableUtils, redrawQueue, function (fns) { + fns[i](); + }); + }; + // redraw all regular items + for (var i = 0; i < redrawQueueLength; i++) { + _loop(i); + } + } + return true; + } else { + return false; + } + } + + /** + * calculate group dimentions and position + * @param {number} pixels + */ + }, { + key: "_calculateGroupSizeAndPosition", + value: function _calculateGroupSizeAndPosition() { + var _this$dom$foreground = this.dom.foreground, + offsetTop = _this$dom$foreground.offsetTop, + offsetLeft = _this$dom$foreground.offsetLeft, + offsetWidth = _this$dom$foreground.offsetWidth; + this.top = offsetTop; + this.right = offsetLeft; + this.width = offsetWidth; + } + + /** + * checks if should bail redraw of items + * @returns {boolean} should bail + */ + }, { + key: "_shouldBailItemsRedraw", + value: function _shouldBailItemsRedraw() { + var me = this; + var timeoutOptions = this.itemSet.options.onTimeout; + var bailOptions = { + relativeBailingTime: this.itemSet.itemsSettingTime, + bailTimeMs: timeoutOptions && timeoutOptions.timeoutMs, + userBailFunction: timeoutOptions && timeoutOptions.callback, + shouldBailStackItems: this.shouldBailStackItems + }; + var bail = null; + if (!this.itemSet.initialDrawDone) { + if (bailOptions.shouldBailStackItems) { + return true; + } + if (Math.abs(_Date$now() - new Date(bailOptions.relativeBailingTime)) > bailOptions.bailTimeMs) { + if (bailOptions.userBailFunction && this.itemSet.userContinueNotBail == null) { + bailOptions.userBailFunction(function (didUserContinue) { + me.itemSet.userContinueNotBail = didUserContinue; + bail = !didUserContinue; + }); + } else if (me.itemSet.userContinueNotBail == false) { + bail = true; + } else { + bail = false; + } + } + } + return bail; + } + + /** + * redraws items + * @param {boolean} forceRestack + * @param {boolean} lastIsVisible + * @param {number} margin + * @param {object} range + * @private + */ + }, { + key: "_redrawItems", + value: function _redrawItems(forceRestack, lastIsVisible, margin, range) { + var _this2 = this; + var restack = forceRestack || this.stackDirty || this.isVisible && !lastIsVisible; + + // if restacking, reposition visible items vertically + if (restack) { + var _context2, _context3, _context4, _context5, _context6, _context7; + var orderedItems = { + byEnd: _filterInstanceProperty(_context2 = this.orderedItems.byEnd).call(_context2, function (item) { + return !item.isCluster; + }), + byStart: _filterInstanceProperty(_context3 = this.orderedItems.byStart).call(_context3, function (item) { + return !item.isCluster; + }) + }; + var orderedClusters = { + byEnd: _toConsumableArray(new _Set(_filterInstanceProperty(_context4 = _mapInstanceProperty(_context5 = this.orderedItems.byEnd).call(_context5, function (item) { + return item.cluster; + })).call(_context4, function (item) { + return !!item; + }))), + byStart: _toConsumableArray(new _Set(_filterInstanceProperty(_context6 = _mapInstanceProperty(_context7 = this.orderedItems.byStart).call(_context7, function (item) { + return item.cluster; + })).call(_context6, function (item) { + return !!item; + }))) + }; + + /** + * Get all visible items in range + * @return {array} items + */ + var getVisibleItems = function getVisibleItems() { + var _context8, _context9, _context10; + var visibleItems = _this2._updateItemsInRange(orderedItems, _filterInstanceProperty(_context8 = _this2.visibleItems).call(_context8, function (item) { + return !item.isCluster; + }), range); + var visibleClusters = _this2._updateClustersInRange(orderedClusters, _filterInstanceProperty(_context9 = _this2.visibleItems).call(_context9, function (item) { + return item.isCluster; + }), range); + return _concatInstanceProperty(_context10 = []).call(_context10, _toConsumableArray(visibleItems), _toConsumableArray(visibleClusters)); + }; + + /** + * Get visible items grouped by subgroup + * @param {function} orderFn An optional function to order items inside the subgroups + * @return {Object} + */ + var getVisibleItemsGroupedBySubgroup = function getVisibleItemsGroupedBySubgroup(orderFn) { + var visibleSubgroupsItems = {}; + var _loop2 = function _loop2(subgroup) { + var _context11; + var items = _filterInstanceProperty(_context11 = _this2.visibleItems).call(_context11, function (item) { + return item.data.subgroup === subgroup; + }); + visibleSubgroupsItems[subgroup] = orderFn ? _sortInstanceProperty(items).call(items, function (a, b) { + return orderFn(a.data, b.data); + }) : items; + }; + for (var subgroup in _this2.subgroups) { + _loop2(subgroup); + } + return visibleSubgroupsItems; + }; + if (typeof this.itemSet.options.order === 'function') { + // a custom order function + //show all items + var me = this; + if (this.doInnerStack && this.itemSet.options.stackSubgroups) { + // Order the items within each subgroup + var visibleSubgroupsItems = getVisibleItemsGroupedBySubgroup(this.itemSet.options.order); + stackSubgroupsWithInnerStack(visibleSubgroupsItems, margin, this.subgroups); + this.visibleItems = getVisibleItems(); + this._updateSubGroupHeights(margin); + } else { + var _context12, _context13, _context14, _context15; + this.visibleItems = getVisibleItems(); + this._updateSubGroupHeights(margin); + // order all items and force a restacking + // order all items outside clusters and force a restacking + var customOrderedItems = _sortInstanceProperty(_context12 = _filterInstanceProperty(_context13 = _sliceInstanceProperty(_context14 = this.visibleItems).call(_context14)).call(_context13, function (item) { + return item.isCluster || !item.isCluster && !item.cluster; + })).call(_context12, function (a, b) { + return me.itemSet.options.order(a.data, b.data); + }); + this.shouldBailStackItems = stack(customOrderedItems, margin, true, _bindInstanceProperty$1(_context15 = this._shouldBailItemsRedraw).call(_context15, this)); + } + } else { + // no custom order function, lazy stacking + this.visibleItems = getVisibleItems(); + this._updateSubGroupHeights(margin); + if (this.itemSet.options.stack) { + if (this.doInnerStack && this.itemSet.options.stackSubgroups) { + var _visibleSubgroupsItems = getVisibleItemsGroupedBySubgroup(); + stackSubgroupsWithInnerStack(_visibleSubgroupsItems, margin, this.subgroups); + } else { + var _context16; + // TODO: ugly way to access options... + this.shouldBailStackItems = stack(this.visibleItems, margin, true, _bindInstanceProperty$1(_context16 = this._shouldBailItemsRedraw).call(_context16, this)); + } + } else { + // no stacking + nostack(this.visibleItems, margin, this.subgroups, this.itemSet.options.stackSubgroups); + } + } + for (var i = 0; i < this.visibleItems.length; i++) { + this.visibleItems[i].repositionX(); + if (this.subgroupVisibility[this.visibleItems[i].data.subgroup] !== undefined) { + if (!this.subgroupVisibility[this.visibleItems[i].data.subgroup]) { + this.visibleItems[i].hide(); + } + } + } + if (this.itemSet.options.cluster) { + _forEachInstanceProperty(availableUtils).call(availableUtils, this.items, function (item) { + if (item.cluster && item.displayed) { + item.hide(); + } + }); + } + if (this.shouldBailStackItems) { + this.itemSet.body.emitter.emit('destroyTimeline'); + } + this.stackDirty = false; + } + } + + /** + * check if group resized + * @param {boolean} resized + * @param {number} height + * @return {boolean} did resize + */ + }, { + key: "_didResize", + value: function _didResize(resized, height) { + resized = availableUtils.updateProperty(this, 'height', height) || resized; + // recalculate size of label + var labelWidth = this.dom.inner.clientWidth; + var labelHeight = this.dom.inner.clientHeight; + resized = availableUtils.updateProperty(this.props.label, 'width', labelWidth) || resized; + resized = availableUtils.updateProperty(this.props.label, 'height', labelHeight) || resized; + return resized; + } + + /** + * apply group height + * @param {number} height + */ + }, { + key: "_applyGroupHeight", + value: function _applyGroupHeight(height) { + this.dom.background.style.height = "".concat(height, "px"); + this.dom.foreground.style.height = "".concat(height, "px"); + this.dom.label.style.height = "".concat(height, "px"); + } + + /** + * update vertical position of items after they are re-stacked and the height of the group is calculated + * @param {number} margin + */ + }, { + key: "_updateItemsVerticalPosition", + value: function _updateItemsVerticalPosition(margin) { + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(margin); + if (!this.isVisible && this.groupId != ReservedGroupIds$1.BACKGROUND) { + if (item.displayed) item.hide(); + } + } + } + + /** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [forceRestack=false] Force restacking of all items + * @param {boolean} [returnQueue=false] return the queue or if the group resized + * @return {boolean} Returns true if the group is resized or the redraw queue if returnQueue=true + */ + }, { + key: "redraw", + value: function redraw(range, margin, forceRestack, returnQueue) { + var _this3 = this, + _context17, + _context18, + _context21, + _context23, + _context27; + var resized = false; + var lastIsVisible = this.isVisible; + var height; + var queue = [function () { + forceRestack = _this3._didMarkerHeightChange.call(_this3) || forceRestack; + }, + // recalculate the height of the subgroups + _bindInstanceProperty$1(_context17 = this._updateSubGroupHeights).call(_context17, this, margin), + // calculate actual size and position + _bindInstanceProperty$1(_context18 = this._calculateGroupSizeAndPosition).call(_context18, this), function () { + var _context19; + _this3.isVisible = _bindInstanceProperty$1(_context19 = _this3._isGroupVisible).call(_context19, _this3)(range, margin); + }, function () { + var _context20; + _bindInstanceProperty$1(_context20 = _this3._redrawItems).call(_context20, _this3)(forceRestack, lastIsVisible, margin, range); + }, + // update subgroups + _bindInstanceProperty$1(_context21 = this._updateSubgroupsSizes).call(_context21, this), function () { + var _context22; + height = _bindInstanceProperty$1(_context22 = _this3._calculateHeight).call(_context22, _this3)(margin); + }, + // calculate actual size and position again + _bindInstanceProperty$1(_context23 = this._calculateGroupSizeAndPosition).call(_context23, this), function () { + var _context24; + resized = _bindInstanceProperty$1(_context24 = _this3._didResize).call(_context24, _this3)(resized, height); + }, function () { + var _context25; + _bindInstanceProperty$1(_context25 = _this3._applyGroupHeight).call(_context25, _this3)(height); + }, function () { + var _context26; + _bindInstanceProperty$1(_context26 = _this3._updateItemsVerticalPosition).call(_context26, _this3)(margin); + }, _bindInstanceProperty$1(_context27 = function _context27() { + if (!_this3.isVisible && _this3.height) { + resized = false; + } + return resized; + }).call(_context27, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * recalculate the height of the subgroups + * + * @param {{item: timeline.Item}} margin + * @private + */ + }, { + key: "_updateSubGroupHeights", + value: function _updateSubGroupHeights(margin) { + var _this4 = this; + if (_Object$keys(this.subgroups).length > 0) { + var me = this; + this._resetSubgroups(); + _forEachInstanceProperty(availableUtils).call(availableUtils, this.visibleItems, function (item) { + if (item.data.subgroup !== undefined) { + me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height, item.height + margin.item.vertical); + me.subgroups[item.data.subgroup].visible = typeof _this4.subgroupVisibility[item.data.subgroup] === 'undefined' ? true : Boolean(_this4.subgroupVisibility[item.data.subgroup]); + } + }); + } + } + + /** + * check if group is visible + * + * @param {timeline.Range} range + * @param {{axis: timeline.DataAxis}} margin + * @returns {boolean} is visible + * @private + */ + }, { + key: "_isGroupVisible", + value: function _isGroupVisible(range, margin) { + return this.top <= range.body.domProps.centerContainer.height - range.body.domProps.scrollTop + margin.axis && this.top + this.height + margin.axis >= -range.body.domProps.scrollTop; + } + + /** + * recalculate the height of the group + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @returns {number} Returns the height + * @private + */ + }, { + key: "_calculateHeight", + value: function _calculateHeight(margin) { + // recalculate the height of the group + var height; + var items; + if (this.heightMode === 'fixed') { + items = availableUtils.toArray(this.items); + } else { + // default or 'auto' + items = this.visibleItems; + } + if (items.length > 0) { + var min = items[0].top; + var max = items[0].top + items[0].height; + _forEachInstanceProperty(availableUtils).call(availableUtils, items, function (item) { + min = Math.min(min, item.top); + max = Math.max(max, item.top + item.height); + }); + if (min > margin.axis) { + // there is an empty gap between the lowest item and the axis + var offset = min - margin.axis; + max -= offset; + _forEachInstanceProperty(availableUtils).call(availableUtils, items, function (item) { + item.top -= offset; + }); + } + height = Math.ceil(max + margin.item.vertical / 2); + if (this.heightMode !== "fitItems") { + height = Math.max(height, this.props.label.height); + } + } else { + height = this.props.label.height; + } + return height; + } + + /** + * Show this group: attach to the DOM + */ + }, { + key: "show", + value: function show() { + if (!this.dom.label.parentNode) { + this.itemSet.dom.labelSet.appendChild(this.dom.label); + } + if (!this.dom.foreground.parentNode) { + this.itemSet.dom.foreground.appendChild(this.dom.foreground); + } + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } + if (!this.dom.axis.parentNode) { + this.itemSet.dom.axis.appendChild(this.dom.axis); + } + } + + /** + * Hide this group: remove from the DOM + */ + }, { + key: "hide", + value: function hide() { + var label = this.dom.label; + if (label.parentNode) { + label.parentNode.removeChild(label); + } + var foreground = this.dom.foreground; + if (foreground.parentNode) { + foreground.parentNode.removeChild(foreground); + } + var background = this.dom.background; + if (background.parentNode) { + background.parentNode.removeChild(background); + } + var axis = this.dom.axis; + if (axis.parentNode) { + axis.parentNode.removeChild(axis); + } + } + + /** + * Add an item to the group + * @param {Item} item + */ + }, { + key: "add", + value: function add(item) { + var _context28; + this.items[item.id] = item; + item.setParent(this); + this.stackDirty = true; + // add to + if (item.data.subgroup !== undefined) { + this._addToSubgroup(item); + this.orderSubgroups(); + } + if (!_includesInstanceProperty(_context28 = this.visibleItems).call(_context28, item)) { + var range = this.itemSet.body.range; // TODO: not nice accessing the range like this + this._checkIfVisible(item, this.visibleItems, range); + } + } + + /** + * add item to subgroup + * @param {object} item + * @param {string} subgroupId + */ + }, { + key: "_addToSubgroup", + value: function _addToSubgroup(item) { + var subgroupId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : item.data.subgroup; + if (subgroupId != undefined && this.subgroups[subgroupId] === undefined) { + this.subgroups[subgroupId] = { + height: 0, + top: 0, + start: item.data.start, + end: item.data.end || item.data.start, + visible: false, + index: this.subgroupIndex, + items: [], + stack: this.subgroupStackAll || this.subgroupStack[subgroupId] || false + }; + this.subgroupIndex++; + } + if (new Date(item.data.start) < new Date(this.subgroups[subgroupId].start)) { + this.subgroups[subgroupId].start = item.data.start; + } + var itemEnd = item.data.end || item.data.start; + if (new Date(itemEnd) > new Date(this.subgroups[subgroupId].end)) { + this.subgroups[subgroupId].end = itemEnd; + } + this.subgroups[subgroupId].items.push(item); + } + + /** + * update subgroup sizes + */ + }, { + key: "_updateSubgroupsSizes", + value: function _updateSubgroupsSizes() { + var me = this; + if (me.subgroups) { + var _loop3 = function _loop3() { + var _context29; + var initialEnd = me.subgroups[subgroup].items[0].data.end || me.subgroups[subgroup].items[0].data.start; + var newStart = me.subgroups[subgroup].items[0].data.start; + var newEnd = initialEnd - 1; + _forEachInstanceProperty(_context29 = me.subgroups[subgroup].items).call(_context29, function (item) { + if (new Date(item.data.start) < new Date(newStart)) { + newStart = item.data.start; + } + var itemEnd = item.data.end || item.data.start; + if (new Date(itemEnd) > new Date(newEnd)) { + newEnd = itemEnd; + } + }); + me.subgroups[subgroup].start = newStart; + me.subgroups[subgroup].end = new Date(newEnd - 1); // -1 to compensate for colliding end to start subgroups; + }; + for (var subgroup in me.subgroups) { + _loop3(); + } + } + } + + /** + * order subgroups + */ + }, { + key: "orderSubgroups", + value: function orderSubgroups() { + if (this.subgroupOrderer !== undefined) { + var sortArray = []; + if (typeof this.subgroupOrderer == 'string') { + for (var subgroup in this.subgroups) { + sortArray.push({ + subgroup: subgroup, + sortField: this.subgroups[subgroup].items[0].data[this.subgroupOrderer] + }); + } + _sortInstanceProperty(sortArray).call(sortArray, function (a, b) { + return a.sortField - b.sortField; + }); + } else if (typeof this.subgroupOrderer == 'function') { + for (var _subgroup in this.subgroups) { + sortArray.push(this.subgroups[_subgroup].items[0].data); + } + _sortInstanceProperty(sortArray).call(sortArray, this.subgroupOrderer); + } + if (sortArray.length > 0) { + for (var i = 0; i < sortArray.length; i++) { + this.subgroups[sortArray[i].subgroup].index = i; + } + } + } + } + + /** + * add item to subgroup + */ + }, { + key: "_resetSubgroups", + value: function _resetSubgroups() { + for (var subgroup in this.subgroups) { + if (this.subgroups.hasOwnProperty(subgroup)) { + this.subgroups[subgroup].visible = false; + this.subgroups[subgroup].height = 0; + } + } + } + + /** + * Remove an item from the group + * @param {Item} item + */ + }, { + key: "remove", + value: function remove(item) { + var _context30, _context31; + delete this.items[item.id]; + item.setParent(null); + this.stackDirty = true; + + // remove from visible items + var index = _indexOfInstanceProperty(_context30 = this.visibleItems).call(_context30, item); + if (index != -1) _spliceInstanceProperty(_context31 = this.visibleItems).call(_context31, index, 1); + if (item.data.subgroup !== undefined) { + this._removeFromSubgroup(item); + this.orderSubgroups(); + } + } + + /** + * remove item from subgroup + * @param {object} item + * @param {string} subgroupId + */ + }, { + key: "_removeFromSubgroup", + value: function _removeFromSubgroup(item) { + var subgroupId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : item.data.subgroup; + if (subgroupId != undefined) { + var subgroup = this.subgroups[subgroupId]; + if (subgroup) { + var _context32; + var itemIndex = _indexOfInstanceProperty(_context32 = subgroup.items).call(_context32, item); + // Check the item is actually in this subgroup. How should items not in the group be handled? + if (itemIndex >= 0) { + var _context33; + _spliceInstanceProperty(_context33 = subgroup.items).call(_context33, itemIndex, 1); + if (!subgroup.items.length) { + delete this.subgroups[subgroupId]; + } else { + this._updateSubgroupsSizes(); + } + } + } + } + } + + /** + * Remove an item from the corresponding DataSet + * @param {Item} item + */ + }, { + key: "removeFromDataSet", + value: function removeFromDataSet(item) { + this.itemSet.removeItem(item.id); + } + + /** + * Reorder the items + */ + }, { + key: "order", + value: function order() { + var array = availableUtils.toArray(this.items); + var startArray = []; + var endArray = []; + for (var i = 0; i < array.length; i++) { + if (array[i].data.end !== undefined) { + endArray.push(array[i]); + } + startArray.push(array[i]); + } + this.orderedItems = { + byStart: startArray, + byEnd: endArray + }; + orderByStart(this.orderedItems.byStart); + orderByEnd(this.orderedItems.byEnd); + } + + /** + * Update the visible items + * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date + * @param {Item[]} oldVisibleItems The previously visible items. + * @param {{start: number, end: number}} range Visible range + * @return {Item[]} visibleItems The new visible items. + * @private + */ + }, { + key: "_updateItemsInRange", + value: function _updateItemsInRange(orderedItems, oldVisibleItems, range) { + var visibleItems = []; + var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems + + if (!this.isVisible && this.height !== undefined && this.groupId != ReservedGroupIds$1.BACKGROUND) { + for (var i = 0; i < oldVisibleItems.length; i++) { + var item = oldVisibleItems[i]; + if (item.displayed) item.hide(); + } + return visibleItems; + } + var interval = (range.end - range.start) / 4; + var lowerBound = range.start - interval; + var upperBound = range.end + interval; + + // this function is used to do the binary search for items having start date only. + var startSearchFunction = function startSearchFunction(value) { + if (value < lowerBound) { + return -1; + } else if (value <= upperBound) { + return 0; + } else { + return 1; + } + }; + + // this function is used to do the binary search for items having start and end dates (range). + var endSearchFunction = function endSearchFunction(data) { + var start = data.start, + end = data.end; + if (end < lowerBound) { + return -1; + } else if (start <= upperBound) { + return 0; + } else { + return 1; + } + }; + + // first check if the items that were in view previously are still in view. + // IMPORTANT: this handles the case for the items with startdate before the window and enddate after the window! + // also cleans up invisible items. + if (oldVisibleItems.length > 0) { + for (var _i = 0; _i < oldVisibleItems.length; _i++) { + this._checkIfVisibleWithReference(oldVisibleItems[_i], visibleItems, visibleItemsLookup, range); + } + } + + // we do a binary search for the items that have only start values. + var initialPosByStart = availableUtils.binarySearchCustom(orderedItems.byStart, startSearchFunction, 'data', 'start'); + + // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the start values. + this._traceVisible(initialPosByStart, orderedItems.byStart, visibleItems, visibleItemsLookup, function (item) { + return item.data.start < lowerBound || item.data.start > upperBound; + }); + + // if the window has changed programmatically without overlapping the old window, the ranged items with start < lowerBound and end > upperbound are not shown. + // We therefore have to brute force check all items in the byEnd list + if (this.checkRangedItems == true) { + this.checkRangedItems = false; + for (var _i2 = 0; _i2 < orderedItems.byEnd.length; _i2++) { + this._checkIfVisibleWithReference(orderedItems.byEnd[_i2], visibleItems, visibleItemsLookup, range); + } + } else { + // we do a binary search for the items that have defined end times. + var initialPosByEnd = availableUtils.binarySearchCustom(orderedItems.byEnd, endSearchFunction, 'data'); + + // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the end values. + this._traceVisible(initialPosByEnd, orderedItems.byEnd, visibleItems, visibleItemsLookup, function (item) { + return item.data.end < lowerBound || item.data.start > upperBound; + }); + } + var redrawQueue = {}; + var redrawQueueLength = 0; + for (var _i3 = 0; _i3 < visibleItems.length; _i3++) { + var _item = visibleItems[_i3]; + if (!_item.displayed) { + var returnQueue = true; + redrawQueue[_i3] = _item.redraw(returnQueue); + redrawQueueLength = redrawQueue[_i3].length; + } + } + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + var _loop4 = function _loop4(j) { + _forEachInstanceProperty(availableUtils).call(availableUtils, redrawQueue, function (fns) { + fns[j](); + }); + }; + // redraw all regular items + for (var j = 0; j < redrawQueueLength; j++) { + _loop4(j); + } + } + for (var _i4 = 0; _i4 < visibleItems.length; _i4++) { + visibleItems[_i4].repositionX(); + } + return visibleItems; + } + + /** + * trace visible items in group + * @param {number} initialPos + * @param {array} items + * @param {aray} visibleItems + * @param {object} visibleItemsLookup + * @param {function} breakCondition + */ + }, { + key: "_traceVisible", + value: function _traceVisible(initialPos, items, visibleItems, visibleItemsLookup, breakCondition) { + if (initialPos != -1) { + for (var i = initialPos; i >= 0; i--) { + var item = items[i]; + if (breakCondition(item)) { + break; + } else { + if (!(item.isCluster && !item.hasItems()) && !item.cluster) { + if (visibleItemsLookup[item.id] === undefined) { + visibleItemsLookup[item.id] = true; + visibleItems.push(item); + } + } + } + } + for (var _i5 = initialPos + 1; _i5 < items.length; _i5++) { + var _item2 = items[_i5]; + if (breakCondition(_item2)) { + break; + } else { + if (!(_item2.isCluster && !_item2.hasItems()) && !_item2.cluster) { + if (visibleItemsLookup[_item2.id] === undefined) { + visibleItemsLookup[_item2.id] = true; + visibleItems.push(_item2); + } + } + } + } + } + } + + /** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array} visibleItems + * @param {{start:number, end:number}} range + * @private + */ + }, { + key: "_checkIfVisible", + value: function _checkIfVisible(item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + // reposition item horizontally + item.repositionX(); + visibleItems.push(item); + } else { + if (item.displayed) item.hide(); + } + } + + /** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array.} visibleItems + * @param {Object} visibleItemsLookup + * @param {{start:number, end:number}} range + * @private + */ + }, { + key: "_checkIfVisibleWithReference", + value: function _checkIfVisibleWithReference(item, visibleItems, visibleItemsLookup, range) { + if (item.isVisible(range)) { + if (visibleItemsLookup[item.id] === undefined) { + visibleItemsLookup[item.id] = true; + visibleItems.push(item); + } + } else { + if (item.displayed) item.hide(); + } + } + + /** + * Update the visible items + * @param {array} orderedClusters + * @param {array} oldVisibleClusters + * @param {{start: number, end: number}} range + * @return {Item[]} visibleItems + * @private + */ + }, { + key: "_updateClustersInRange", + value: function _updateClustersInRange(orderedClusters, oldVisibleClusters, range) { + // Clusters can overlap each other so we cannot use binary search here + var visibleClusters = []; + var visibleClustersLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems + + if (oldVisibleClusters.length > 0) { + for (var i = 0; i < oldVisibleClusters.length; i++) { + this._checkIfVisibleWithReference(oldVisibleClusters[i], visibleClusters, visibleClustersLookup, range); + } + } + for (var _i6 = 0; _i6 < orderedClusters.byStart.length; _i6++) { + this._checkIfVisibleWithReference(orderedClusters.byStart[_i6], visibleClusters, visibleClustersLookup, range); + } + for (var _i7 = 0; _i7 < orderedClusters.byEnd.length; _i7++) { + this._checkIfVisibleWithReference(orderedClusters.byEnd[_i7], visibleClusters, visibleClustersLookup, range); + } + var redrawQueue = {}; + var redrawQueueLength = 0; + for (var _i8 = 0; _i8 < visibleClusters.length; _i8++) { + var item = visibleClusters[_i8]; + if (!item.displayed) { + var returnQueue = true; + redrawQueue[_i8] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[_i8].length; + } + } + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + // redraw all regular items + for (var j = 0; j < redrawQueueLength; j++) { + _forEachInstanceProperty(availableUtils).call(availableUtils, redrawQueue, function (fns) { + fns[j](); + }); + } + } + for (var _i9 = 0; _i9 < visibleClusters.length; _i9++) { + visibleClusters[_i9].repositionX(); + } + return visibleClusters; + } + + /** + * change item subgroup + * @param {object} item + * @param {string} oldSubgroup + * @param {string} newSubgroup + */ + }, { + key: "changeSubgroup", + value: function changeSubgroup(item, oldSubgroup, newSubgroup) { + this._removeFromSubgroup(item, oldSubgroup); + this._addToSubgroup(item, newSubgroup); + this.orderSubgroups(); + } + + /** + * Call this method before you lose the last reference to an instance of this. + * It will remove listeners etc. + */ + }, { + key: "dispose", + value: function dispose() { + this.hide(); + var disposeCallback; + while (disposeCallback = this._disposeCallbacks.pop()) { + disposeCallback(); + } + } + }]); + return Group; + }(); + + function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$8(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * @constructor BackgroundGroup + * @extends Group + */ + var BackgroundGroup = /*#__PURE__*/function (_Group) { + _inherits(BackgroundGroup, _Group); + var _super = _createSuper$8(BackgroundGroup); + /** + * @param {number | string} groupId + * @param {Object} data + * @param {ItemSet} itemSet + */ + function BackgroundGroup(groupId, data, itemSet) { + var _this; + _classCallCheck(this, BackgroundGroup); + _this = _super.call(this, groupId, data, itemSet); + // Group.call(this, groupId, data, itemSet); + + _this.width = 0; + _this.height = 0; + _this.top = 0; + _this.left = 0; + return _this; + } + + /** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [forceRestack=false] Force restacking of all items + * @return {boolean} Returns true if the group is resized + */ + _createClass(BackgroundGroup, [{ + key: "redraw", + value: function redraw(range, margin, forceRestack) { + // eslint-disable-line no-unused-vars + var resized = false; + this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); + + // calculate actual size + this.width = this.dom.background.offsetWidth; + + // apply new height (just always zero for BackgroundGroup + this.dom.background.style.height = '0'; + + // update vertical position of items after they are re-stacked and the height of the group is calculated + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(margin); + } + return resized; + } + + /** + * Show this group: attach to the DOM + */ + }, { + key: "show", + value: function show() { + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } + } + }]); + return BackgroundGroup; + }(Group); + + var css_248z$5 = "\n.vis-item {\n position: absolute;\n color: #1A1A1A;\n border-color: #97B0F8;\n border-width: 1px;\n background-color: #D5DDF6;\n display: inline-block;\n z-index: 1;\n /*overflow: hidden;*/\n}\n\n.vis-item.vis-selected {\n border-color: #FFC200;\n background-color: #FFF785;\n\n /* z-index must be higher than the z-index of custom time bar and current time bar */\n z-index: 2;\n}\n\n.vis-editable.vis-selected {\n cursor: move;\n}\n\n.vis-item.vis-point.vis-selected {\n background-color: #FFF785;\n}\n\n.vis-item.vis-box {\n text-align: center;\n border-style: solid;\n border-radius: 2px;\n}\n\n.vis-item.vis-point {\n background: none;\n}\n\n.vis-item.vis-dot {\n position: absolute;\n padding: 0;\n border-width: 4px;\n border-style: solid;\n border-radius: 4px;\n}\n\n.vis-item.vis-range {\n border-style: solid;\n border-radius: 2px;\n box-sizing: border-box;\n}\n\n.vis-item.vis-background {\n border: none;\n background-color: rgba(213, 221, 246, 0.4);\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n}\n\n.vis-item .vis-item-overflow {\n position: relative;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n overflow: hidden;\n}\n\n.vis-item-visible-frame {\n white-space: nowrap;\n}\n\n.vis-item.vis-range .vis-item-content {\n position: relative;\n display: inline-block;\n}\n\n.vis-item.vis-background .vis-item-content {\n position: absolute;\n display: inline-block;\n}\n\n.vis-item.vis-line {\n padding: 0;\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.vis-item .vis-item-content {\n white-space: nowrap;\n box-sizing: border-box;\n padding: 5px;\n}\n\n.vis-item .vis-onUpdateTime-tooltip {\n position: absolute;\n background: #4f81bd;\n color: white;\n width: 200px;\n text-align: center;\n white-space: nowrap;\n padding: 5px;\n border-radius: 1px;\n transition: 0.4s;\n -o-transition: 0.4s;\n -moz-transition: 0.4s;\n -webkit-transition: 0.4s;\n}\n\n.vis-item .vis-delete, .vis-item .vis-delete-rtl {\n position: absolute;\n top: 0px;\n width: 24px;\n height: 24px;\n box-sizing: border-box;\n padding: 0px 5px;\n cursor: pointer;\n\n -webkit-transition: background 0.2s linear;\n -moz-transition: background 0.2s linear;\n -ms-transition: background 0.2s linear;\n -o-transition: background 0.2s linear;\n transition: background 0.2s linear;\n}\n\n.vis-item .vis-delete {\n right: -24px;\n}\n\n.vis-item .vis-delete-rtl {\n left: -24px;\n}\n\n.vis-item .vis-delete:after, .vis-item .vis-delete-rtl:after {\n content: \"\\00D7\"; /* MULTIPLICATION SIGN */\n color: red;\n font-family: arial, sans-serif;\n font-size: 22px;\n font-weight: bold;\n\n -webkit-transition: color 0.2s linear;\n -moz-transition: color 0.2s linear;\n -ms-transition: color 0.2s linear;\n -o-transition: color 0.2s linear;\n transition: color 0.2s linear;\n}\n\n.vis-item .vis-delete:hover, .vis-item .vis-delete-rtl:hover {\n background: red;\n}\n\n.vis-item .vis-delete:hover:after, .vis-item .vis-delete-rtl:hover:after {\n color: white;\n}\n\n.vis-item .vis-drag-center {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0px;\n cursor: move;\n}\n\n.vis-item.vis-range .vis-drag-left {\n position: absolute;\n width: 24px;\n max-width: 20%;\n min-width: 2px;\n height: 100%;\n top: 0;\n left: -4px;\n\n cursor: w-resize;\n}\n\n.vis-item.vis-range .vis-drag-right {\n position: absolute;\n width: 24px;\n max-width: 20%;\n min-width: 2px;\n height: 100%;\n top: 0;\n right: -4px;\n\n cursor: e-resize;\n}\n\n.vis-range.vis-item.vis-readonly .vis-drag-left,\n.vis-range.vis-item.vis-readonly .vis-drag-right {\n cursor: auto;\n}\n\n.vis-item.vis-cluster {\n vertical-align: center;\n text-align: center;\n border-style: solid;\n border-radius: 2px;\n}\n\n.vis-item.vis-cluster-line {\n padding: 0;\n position: absolute;\n width: 0;\n border-left-width: 1px;\n border-left-style: solid;\n}\n\n.vis-item.vis-cluster-dot {\n position: absolute;\n padding: 0;\n border-width: 4px;\n border-style: solid;\n border-radius: 4px;\n}"; + styleInject(css_248z$5); + + function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$4(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = _sliceInstanceProperty(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); } + function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + + /** + * Item + */ + var Item = /*#__PURE__*/function () { + /** + * @constructor Item + * @param {Object} data Object containing (optional) parameters type, + * start, end, content, group, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} options Configuration options + * // TODO: describe available options + */ + function Item(data, conversion, options) { + var _context, + _this = this; + _classCallCheck(this, Item); + this.id = null; + this.parent = null; + this.data = data; + this.dom = null; + this.conversion = conversion || {}; + this.defaultOptions = { + locales: locales, + locale: 'en' + }; + this.options = availableUtils.extend({}, this.defaultOptions, options); + this.options.locales = availableUtils.extend({}, locales, this.options.locales); + var defaultLocales = this.defaultOptions.locales[this.defaultOptions.locale]; + _forEachInstanceProperty(_context = _Object$keys(this.options.locales)).call(_context, function (locale) { + _this.options.locales[locale] = availableUtils.extend({}, defaultLocales, _this.options.locales[locale]); + }); + this.selected = false; + this.displayed = false; + this.groupShowing = true; + this.selectable = options && options.selectable || false; + this.dirty = true; + this.top = null; + this.right = null; + this.left = null; + this.width = null; + this.height = null; + this.setSelectability(data); + this.editable = null; + this._updateEditStatus(); + } + + /** + * Select current item + */ + _createClass(Item, [{ + key: "select", + value: function select() { + if (this.selectable) { + this.selected = true; + this.dirty = true; + if (this.displayed) this.redraw(); + } + } + + /** + * Unselect current item + */ + }, { + key: "unselect", + value: function unselect() { + this.selected = false; + this.dirty = true; + if (this.displayed) this.redraw(); + } + + /** + * Set data for the item. Existing data will be updated. The id should not + * be changed. When the item is displayed, it will be redrawn immediately. + * @param {Object} data + */ + }, { + key: "setData", + value: function setData(data) { + var groupChanged = data.group != undefined && this.data.group != data.group; + if (groupChanged && this.parent != null) { + this.parent.itemSet._moveToGroup(this, data.group); + } + this.setSelectability(data); + if (this.parent) { + this.parent.stackDirty = true; + } + var subGroupChanged = data.subgroup != undefined && this.data.subgroup != data.subgroup; + if (subGroupChanged && this.parent != null) { + this.parent.changeSubgroup(this, this.data.subgroup, data.subgroup); + } + this.data = data; + this._updateEditStatus(); + this.dirty = true; + if (this.displayed) this.redraw(); + } + + /** + * Set whether the item can be selected. + * Can only be set/unset if the timeline's `selectable` configuration option is `true`. + * @param {Object} data `data` from `constructor` and `setData` + */ + }, { + key: "setSelectability", + value: function setSelectability(data) { + if (data) { + this.selectable = typeof data.selectable === 'undefined' ? true : Boolean(data.selectable); + } + } + + /** + * Set a parent for the item + * @param {Group} parent + */ + }, { + key: "setParent", + value: function setParent(parent) { + if (this.displayed) { + this.hide(); + this.parent = parent; + if (this.parent) { + this.show(); + } + } else { + this.parent = parent; + } + } + + /** + * Check whether this item is visible inside given range + * @param {timeline.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + }, { + key: "isVisible", + value: function isVisible(range) { + // eslint-disable-line no-unused-vars + return false; + } + + /** + * Show the Item in the DOM (when not already visible) + * @return {Boolean} changed + */ + }, { + key: "show", + value: function show() { + return false; + } + + /** + * Hide the Item from the DOM (when visible) + * @return {Boolean} changed + */ + }, { + key: "hide", + value: function hide() { + return false; + } + + /** + * Repaint the item + */ + }, { + key: "redraw", + value: function redraw() { + // should be implemented by the item + } + + /** + * Reposition the Item horizontally + */ + }, { + key: "repositionX", + value: function repositionX() { + // should be implemented by the item + } + + /** + * Reposition the Item vertically + */ + }, { + key: "repositionY", + value: function repositionY() { + // should be implemented by the item + } + + /** + * Repaint a drag area on the center of the item when the item is selected + * @protected + */ + }, { + key: "_repaintDragCenter", + value: function _repaintDragCenter() { + if (this.selected && this.editable.updateTime && !this.dom.dragCenter) { + var _context2, _context3; + var me = this; + // create and show drag area + var dragCenter = document.createElement('div'); + dragCenter.className = 'vis-drag-center'; + dragCenter.dragCenterItem = this; + this.hammerDragCenter = new Hammer(dragCenter); + this.hammerDragCenter.on('tap', function (event) { + me.parent.itemSet.body.emitter.emit('click', { + event: event, + item: me.id + }); + }); + this.hammerDragCenter.on('doubletap', function (event) { + event.stopPropagation(); + me.parent.itemSet._onUpdateItem(me); + me.parent.itemSet.body.emitter.emit('doubleClick', { + event: event, + item: me.id + }); + }); + this.hammerDragCenter.on('panstart', function (event) { + // do not allow this event to propagate to the Range + event.stopPropagation(); + me.parent.itemSet._onDragStart(event); + }); + this.hammerDragCenter.on('panmove', _bindInstanceProperty$1(_context2 = me.parent.itemSet._onDrag).call(_context2, me.parent.itemSet)); + this.hammerDragCenter.on('panend', _bindInstanceProperty$1(_context3 = me.parent.itemSet._onDragEnd).call(_context3, me.parent.itemSet)); + // delay addition on item click for trackpads... + this.hammerDragCenter.get('press').set({ + time: 10000 + }); + if (this.dom.box) { + if (this.dom.dragLeft) { + this.dom.box.insertBefore(dragCenter, this.dom.dragLeft); + } else { + this.dom.box.appendChild(dragCenter); + } + } else if (this.dom.point) { + this.dom.point.appendChild(dragCenter); + } + this.dom.dragCenter = dragCenter; + } else if (!this.selected && this.dom.dragCenter) { + // delete drag area + if (this.dom.dragCenter.parentNode) { + this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter); + } + this.dom.dragCenter = null; + if (this.hammerDragCenter) { + this.hammerDragCenter.destroy(); + this.hammerDragCenter = null; + } + } + } + + /** + * Repaint a delete button on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected + */ + }, { + key: "_repaintDeleteButton", + value: function _repaintDeleteButton(anchor) { + var editable = (this.options.editable.overrideItems || this.editable == null) && this.options.editable.remove || !this.options.editable.overrideItems && this.editable != null && this.editable.remove; + if (this.selected && editable && !this.dom.deleteButton) { + // create and show button + var me = this; + var deleteButton = document.createElement('div'); + if (this.options.rtl) { + deleteButton.className = 'vis-delete-rtl'; + } else { + deleteButton.className = 'vis-delete'; + } + var optionsLocale = this.options.locales[this.options.locale]; + if (!optionsLocale) { + if (!this.warned) { + console.warn("WARNING: options.locales['".concat(this.options.locale, "'] not found. See https://visjs.github.io/vis-timeline/docs/timeline/#Localization")); + this.warned = true; + } + optionsLocale = this.options.locales['en']; // fall back on english when not available + } + + deleteButton.title = optionsLocale.deleteSelected; + + // TODO: be able to destroy the delete button + this.hammerDeleteButton = new Hammer(deleteButton).on('tap', function (event) { + event.stopPropagation(); + me.parent.removeFromDataSet(me); + }); + anchor.appendChild(deleteButton); + this.dom.deleteButton = deleteButton; + } else if ((!this.selected || !editable) && this.dom.deleteButton) { + // remove button + if (this.dom.deleteButton.parentNode) { + this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); + } + this.dom.deleteButton = null; + if (this.hammerDeleteButton) { + this.hammerDeleteButton.destroy(); + this.hammerDeleteButton = null; + } + } + } + + /** + * Repaint a onChange tooltip on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected + */ + }, { + key: "_repaintOnItemUpdateTimeTooltip", + value: function _repaintOnItemUpdateTimeTooltip(anchor) { + if (!this.options.tooltipOnItemUpdateTime) return; + var editable = (this.options.editable.updateTime || this.data.editable === true) && this.data.editable !== false; + if (this.selected && editable && !this.dom.onItemUpdateTimeTooltip) { + var onItemUpdateTimeTooltip = document.createElement('div'); + onItemUpdateTimeTooltip.className = 'vis-onUpdateTime-tooltip'; + anchor.appendChild(onItemUpdateTimeTooltip); + this.dom.onItemUpdateTimeTooltip = onItemUpdateTimeTooltip; + } else if (!this.selected && this.dom.onItemUpdateTimeTooltip) { + // remove button + if (this.dom.onItemUpdateTimeTooltip.parentNode) { + this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip); + } + this.dom.onItemUpdateTimeTooltip = null; + } + + // position onChange tooltip + if (this.dom.onItemUpdateTimeTooltip) { + // only show when editing + this.dom.onItemUpdateTimeTooltip.style.visibility = this.parent.itemSet.touchParams.itemIsDragging ? 'visible' : 'hidden'; + + // position relative to item's content + this.dom.onItemUpdateTimeTooltip.style.transform = 'translateX(-50%)'; + this.dom.onItemUpdateTimeTooltip.style.left = '50%'; + + // position above or below the item depending on the item's position in the window + var tooltipOffset = 50; // TODO: should be tooltip height (depends on template) + var scrollTop = this.parent.itemSet.body.domProps.scrollTop; + + // TODO: this.top for orientation:true is actually the items distance from the bottom... + // (should be this.bottom) + var itemDistanceFromTop; + if (this.options.orientation.item == 'top') { + itemDistanceFromTop = this.top; + } else { + itemDistanceFromTop = this.parent.height - this.top - this.height; + } + var isCloseToTop = itemDistanceFromTop + this.parent.top - tooltipOffset < -scrollTop; + if (isCloseToTop) { + this.dom.onItemUpdateTimeTooltip.style.bottom = ""; + this.dom.onItemUpdateTimeTooltip.style.top = "".concat(this.height + 2, "px"); + } else { + this.dom.onItemUpdateTimeTooltip.style.top = ""; + this.dom.onItemUpdateTimeTooltip.style.bottom = "".concat(this.height + 2, "px"); + } + + // handle tooltip content + var content; + var templateFunction; + if (this.options.tooltipOnItemUpdateTime && this.options.tooltipOnItemUpdateTime.template) { + var _context4; + templateFunction = _bindInstanceProperty$1(_context4 = this.options.tooltipOnItemUpdateTime.template).call(_context4, this); + content = templateFunction(this.data); + } else { + content = "start: ".concat(moment$4(this.data.start).format('MM/DD/YYYY hh:mm')); + if (this.data.end) { + content += "
end: ".concat(moment$4(this.data.end).format('MM/DD/YYYY hh:mm')); + } + } + this.dom.onItemUpdateTimeTooltip.innerHTML = availableUtils.xss(content); + } + } + + /** + * get item data + * @return {object} + * @private + */ + }, { + key: "_getItemData", + value: function _getItemData() { + return this.parent.itemSet.itemsData.get(this.id); + } + + /** + * Set HTML contents for the item + * @param {Element} element HTML element to fill with the contents + * @private + */ + }, { + key: "_updateContents", + value: function _updateContents(element) { + var content; + var changed; + var templateFunction; + var itemVisibleFrameContent; + var visibleFrameTemplateFunction; + var itemData = this._getItemData(); // get a clone of the data from the dataset + + var frameElement = this.dom.box || this.dom.point; + var itemVisibleFrameContentElement = frameElement.getElementsByClassName('vis-item-visible-frame')[0]; + if (this.options.visibleFrameTemplate) { + var _context5; + visibleFrameTemplateFunction = _bindInstanceProperty$1(_context5 = this.options.visibleFrameTemplate).call(_context5, this); + itemVisibleFrameContent = availableUtils.xss(visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement)); + } else { + itemVisibleFrameContent = ''; + } + if (itemVisibleFrameContentElement) { + if (itemVisibleFrameContent instanceof Object && !(itemVisibleFrameContent instanceof Element)) { + visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement); + } else { + changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent); + if (changed) { + // only replace the content when changed + if (itemVisibleFrameContent instanceof Element) { + itemVisibleFrameContentElement.innerHTML = ''; + itemVisibleFrameContentElement.appendChild(itemVisibleFrameContent); + } else if (itemVisibleFrameContent != undefined) { + itemVisibleFrameContentElement.innerHTML = availableUtils.xss(itemVisibleFrameContent); + } else { + if (!(this.data.type == 'background' && this.data.content === undefined)) { + throw new Error("Property \"content\" missing in item ".concat(this.id)); + } + } + this.itemVisibleFrameContent = itemVisibleFrameContent; + } + } + } + if (this.options.template) { + var _context6; + templateFunction = _bindInstanceProperty$1(_context6 = this.options.template).call(_context6, this); + content = templateFunction(itemData, element, this.data); + } else { + content = this.data.content; + } + if (content instanceof Object && !(content instanceof Element)) { + templateFunction(itemData, element); + } else { + changed = this._contentToString(this.content) !== this._contentToString(content); + if (changed) { + // only replace the content when changed + if (content instanceof Element) { + element.innerHTML = ''; + element.appendChild(content); + } else if (content != undefined) { + element.innerHTML = availableUtils.xss(content); + } else { + if (!(this.data.type == 'background' && this.data.content === undefined)) { + throw new Error("Property \"content\" missing in item ".concat(this.id)); + } + } + this.content = content; + } + } + } + + /** + * Process dataAttributes timeline option and set as data- attributes on dom.content + * @param {Element} element HTML element to which the attributes will be attached + * @private + */ + }, { + key: "_updateDataAttributes", + value: function _updateDataAttributes(element) { + if (this.options.dataAttributes && this.options.dataAttributes.length > 0) { + var attributes = []; + if (_Array$isArray(this.options.dataAttributes)) { + attributes = this.options.dataAttributes; + } else if (this.options.dataAttributes == 'all') { + attributes = _Object$keys(this.data); + } else { + return; + } + var _iterator = _createForOfIteratorHelper$4(attributes), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var name = _step.value; + var value = this.data[name]; + if (value != null) { + element.setAttribute("data-".concat(name), value); + } else { + element.removeAttribute("data-".concat(name)); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + } + + /** + * Update custom styles of the element + * @param {Element} element + * @private + */ + }, { + key: "_updateStyle", + value: function _updateStyle(element) { + // remove old styles + if (this.style) { + availableUtils.removeCssText(element, this.style); + this.style = null; + } + + // append new styles + if (this.data.style) { + availableUtils.addCssText(element, this.data.style); + this.style = this.data.style; + } + } + + /** + * Stringify the items contents + * @param {string | Element | undefined} content + * @returns {string | undefined} + * @private + */ + }, { + key: "_contentToString", + value: function _contentToString(content) { + if (typeof content === 'string') return content; + if (content && 'outerHTML' in content) return content.outerHTML; + return content; + } + + /** + * Update the editability of this item. + */ + }, { + key: "_updateEditStatus", + value: function _updateEditStatus() { + if (this.options) { + if (typeof this.options.editable === 'boolean') { + this.editable = { + updateTime: this.options.editable, + updateGroup: this.options.editable, + remove: this.options.editable + }; + } else if (_typeof$1(this.options.editable) === 'object') { + this.editable = {}; + availableUtils.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.options.editable); + } + } + // Item data overrides, except if options.editable.overrideItems is set. + if (!this.options || !this.options.editable || this.options.editable.overrideItems !== true) { + if (this.data) { + if (typeof this.data.editable === 'boolean') { + this.editable = { + updateTime: this.data.editable, + updateGroup: this.data.editable, + remove: this.data.editable + }; + } else if (_typeof$1(this.data.editable) === 'object') { + // TODO: in timeline.js 5.0, we should change this to not reset options from the timeline configuration. + // Basically just remove the next line... + this.editable = {}; + availableUtils.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.data.editable); + } + } + } + } + + /** + * Return the width of the item left from its start date + * @return {number} + */ + }, { + key: "getWidthLeft", + value: function getWidthLeft() { + return 0; + } + + /** + * Return the width of the item right from the max of its start and end date + * @return {number} + */ + }, { + key: "getWidthRight", + value: function getWidthRight() { + return 0; + } + + /** + * Return the title of the item + * @return {string | undefined} + */ + }, { + key: "getTitle", + value: function getTitle() { + if (this.options.tooltip && this.options.tooltip.template) { + var _context7; + var templateFunction = _bindInstanceProperty$1(_context7 = this.options.tooltip.template).call(_context7, this); + return templateFunction(this._getItemData(), this.data); + } + return this.data.title; + } + }]); + return Item; + }(); + Item.prototype.stack = true; + + function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * @constructor BoxItem + * @extends Item + */ + var BoxItem = /*#__PURE__*/function (_Item) { + _inherits(BoxItem, _Item); + var _super = _createSuper$7(BoxItem); + /** + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ + function BoxItem(data, conversion, options) { + var _this; + _classCallCheck(this, BoxItem); + _this = _super.call(this, data, conversion, options); + _this.props = { + dot: { + width: 0, + height: 0 + }, + line: { + width: 0, + height: 0 + } + }; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error("Property \"start\" missing in item ".concat(data)); + } + } + return _this; + } + + /** + * Check whether this item is visible inside given range + * @param {{start: number, end: number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + _createClass(BoxItem, [{ + key: "isVisible", + value: function isVisible(range) { + if (this.cluster) { + return false; + } + // determine visibility + var isVisible; + var align = this.data.align || this.options.align; + var widthInMs = this.width * range.getMillisecondsPerPixel(); + if (align == 'right') { + isVisible = this.data.start.getTime() > range.start && this.data.start.getTime() - widthInMs < range.end; + } else if (align == 'left') { + isVisible = this.data.start.getTime() + widthInMs > range.start && this.data.start.getTime() < range.end; + } else { + // default or 'center' + isVisible = this.data.start.getTime() + widthInMs / 2 > range.start && this.data.start.getTime() - widthInMs / 2 < range.end; + } + return isVisible; + } + + /** + * create DOM element + * @private + */ + }, { + key: "_createDomElement", + value: function _createDomElement() { + if (!this.dom) { + // create DOM + this.dom = {}; + + // create main box + this.dom.box = document.createElement('DIV'); + + // contents box (inside the background box). used for making margins + this.dom.content = document.createElement('DIV'); + this.dom.content.className = 'vis-item-content'; + this.dom.box.appendChild(this.dom.content); + + // line to axis + this.dom.line = document.createElement('DIV'); + this.dom.line.className = 'vis-line'; + + // dot on axis + this.dom.dot = document.createElement('DIV'); + this.dom.dot.className = 'vis-dot'; + + // attach this item as attribute + this.dom.box['vis-item'] = this; + this.dirty = true; + } + } + + /** + * append DOM element + * @private + */ + }, { + key: "_appendDomElement", + value: function _appendDomElement() { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) throw new Error('Cannot redraw item: parent has no foreground container element'); + foreground.appendChild(this.dom.box); + } + if (!this.dom.line.parentNode) { + var background = this.parent.dom.background; + if (!background) throw new Error('Cannot redraw item: parent has no background container element'); + background.appendChild(this.dom.line); + } + if (!this.dom.dot.parentNode) { + var axis = this.parent.dom.axis; + if (!background) throw new Error('Cannot redraw item: parent has no axis container element'); + axis.appendChild(this.dom.dot); + } + this.displayed = true; + } + + /** + * update dirty DOM element + * @private + */ + }, { + key: "_updateDirtyDomComponents", + value: function _updateDirtyDomComponents() { + // An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.box); + this._updateStyle(this.dom.box); + var editable = this.editable.updateTime || this.editable.updateGroup; + + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.box.className = "vis-item vis-box".concat(className); + this.dom.line.className = "vis-item vis-line".concat(className); + this.dom.dot.className = "vis-item vis-dot".concat(className); + } + } + + /** + * get DOM components sizes + * @return {object} + * @private + */ + }, { + key: "_getDomComponentsSizes", + value: function _getDomComponentsSizes() { + return { + previous: { + right: this.dom.box.style.right, + left: this.dom.box.style.left + }, + dot: { + height: this.dom.dot.offsetHeight, + width: this.dom.dot.offsetWidth + }, + line: { + width: this.dom.line.offsetWidth + }, + box: { + width: this.dom.box.offsetWidth, + height: this.dom.box.offsetHeight + } + }; + } + + /** + * update DOM components sizes + * @param {object} sizes + * @private + */ + }, { + key: "_updateDomComponentsSizes", + value: function _updateDomComponentsSizes(sizes) { + if (this.options.rtl) { + this.dom.box.style.right = "0px"; + } else { + this.dom.box.style.left = "0px"; + } + + // recalculate size + this.props.dot.height = sizes.dot.height; + this.props.dot.width = sizes.dot.width; + this.props.line.width = sizes.line.width; + this.width = sizes.box.width; + this.height = sizes.box.height; + + // restore previous position + if (this.options.rtl) { + this.dom.box.style.right = sizes.previous.right; + } else { + this.dom.box.style.left = sizes.previous.left; + } + this.dirty = false; + } + + /** + * repaint DOM additionals + * @private + */ + }, { + key: "_repaintDomAdditionals", + value: function _repaintDomAdditionals() { + this._repaintOnItemUpdateTimeTooltip(this.dom.box); + this._repaintDragCenter(); + this._repaintDeleteButton(this.dom.box); + } + + /** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "redraw", + value: function redraw(returnQueue) { + var _context, + _context2, + _context3, + _this2 = this, + _context5; + var sizes; + var queue = [ + // create item DOM + _bindInstanceProperty$1(_context = this._createDomElement).call(_context, this), + // append DOM to parent DOM + _bindInstanceProperty$1(_context2 = this._appendDomElement).call(_context2, this), + // update dirty DOM + _bindInstanceProperty$1(_context3 = this._updateDirtyDomComponents).call(_context3, this), function () { + if (_this2.dirty) { + sizes = _this2._getDomComponentsSizes(); + } + }, function () { + if (_this2.dirty) { + var _context4; + _bindInstanceProperty$1(_context4 = _this2._updateDomComponentsSizes).call(_context4, _this2)(sizes); + } + }, + // repaint DOM additionals + _bindInstanceProperty$1(_context5 = this._repaintDomAdditionals).call(_context5, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + * @param {boolean} [returnQueue=false] whether to return a queue of functions to execute instead of just executing them + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "show", + value: function show(returnQueue) { + if (!this.displayed) { + return this.redraw(returnQueue); + } + } + + /** + * Hide the item from the DOM (when visible) + */ + }, { + key: "hide", + value: function hide() { + if (this.displayed) { + var dom = this.dom; + if (dom.box.remove) dom.box.remove();else if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); // IE11 + + if (dom.line.remove) dom.line.remove();else if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); // IE11 + + if (dom.dot.remove) dom.dot.remove();else if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); // IE11 + + this.displayed = false; + } + } + + /** + * Reposition the item XY + */ + }, { + key: "repositionXY", + value: function repositionXY() { + var rtl = this.options.rtl; + var repositionXY = function repositionXY(element, x, y) { + var _context6; + var rtl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + if (x === undefined && y === undefined) return; + // If rtl invert the number. + var directionX = rtl ? x * -1 : x; + + //no y. translate x + if (y === undefined) { + element.style.transform = "translateX(".concat(directionX, "px)"); + return; + } + + //no x. translate y + if (x === undefined) { + element.style.transform = "translateY(".concat(y, "px)"); + return; + } + element.style.transform = _concatInstanceProperty(_context6 = "translate(".concat(directionX, "px, ")).call(_context6, y, "px)"); + }; + repositionXY(this.dom.box, this.boxX, this.boxY, rtl); + repositionXY(this.dom.dot, this.dotX, this.dotY, rtl); + repositionXY(this.dom.line, this.lineX, this.lineY, rtl); + } + + /** + * Reposition the item horizontally + * @Override + */ + }, { + key: "repositionX", + value: function repositionX() { + var start = this.conversion.toScreen(this.data.start); + var align = this.data.align === undefined ? this.options.align : this.data.align; + var lineWidth = this.props.line.width; + var dotWidth = this.props.dot.width; + if (align == 'right') { + // calculate right position of the box + this.boxX = start - this.width; + this.lineX = start - lineWidth; + this.dotX = start - lineWidth / 2 - dotWidth / 2; + } else if (align == 'left') { + // calculate left position of the box + this.boxX = start; + this.lineX = start; + this.dotX = start + lineWidth / 2 - dotWidth / 2; + } else { + // default or 'center' + this.boxX = start - this.width / 2; + this.lineX = this.options.rtl ? start - lineWidth : start - lineWidth / 2; + this.dotX = start - dotWidth / 2; + } + if (this.options.rtl) this.right = this.boxX;else this.left = this.boxX; + this.repositionXY(); + } + + /** + * Reposition the item vertically + * @Override + */ + }, { + key: "repositionY", + value: function repositionY() { + var orientation = this.options.orientation.item; + var lineStyle = this.dom.line.style; + if (orientation == 'top') { + var lineHeight = this.parent.top + this.top + 1; + this.boxY = this.top || 0; + lineStyle.height = "".concat(lineHeight, "px"); + lineStyle.bottom = ''; + lineStyle.top = '0'; + } else { + // orientation 'bottom' + var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty + var _lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + this.boxY = this.parent.height - this.top - (this.height || 0); + lineStyle.height = "".concat(_lineHeight, "px"); + lineStyle.top = ''; + lineStyle.bottom = '0'; + } + this.dotY = -this.props.dot.height / 2; + this.repositionXY(); + } + + /** + * Return the width of the item left from its start date + * @return {number} + */ + }, { + key: "getWidthLeft", + value: function getWidthLeft() { + return this.width / 2; + } + + /** + * Return the width of the item right from its start date + * @return {number} + */ + }, { + key: "getWidthRight", + value: function getWidthRight() { + return this.width / 2; + } + }]); + return BoxItem; + }(Item); + + function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * @constructor PointItem + * @extends Item + */ + var PointItem = /*#__PURE__*/function (_Item) { + _inherits(PointItem, _Item); + var _super = _createSuper$6(PointItem); + /** + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ + function PointItem(data, conversion, options) { + var _this; + _classCallCheck(this, PointItem); + _this = _super.call(this, data, conversion, options); + _this.props = { + dot: { + top: 0, + width: 0, + height: 0 + }, + content: { + height: 0, + marginLeft: 0, + marginRight: 0 + } + }; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error("Property \"start\" missing in item ".concat(data)); + } + } + return _this; + } + + /** + * Check whether this item is visible inside given range + * @param {{start: number, end: number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + _createClass(PointItem, [{ + key: "isVisible", + value: function isVisible(range) { + if (this.cluster) { + return false; + } + // determine visibility + var widthInMs = this.width * range.getMillisecondsPerPixel(); + return this.data.start.getTime() + widthInMs > range.start && this.data.start < range.end; + } + + /** + * create DOM element + * @private + */ + }, { + key: "_createDomElement", + value: function _createDomElement() { + if (!this.dom) { + // create DOM + this.dom = {}; + + // background box + this.dom.point = document.createElement('div'); + // className is updated in redraw() + + // contents box, right from the dot + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.point.appendChild(this.dom.content); + + // dot at start + this.dom.dot = document.createElement('div'); + this.dom.point.appendChild(this.dom.dot); + + // attach this item as attribute + this.dom.point['vis-item'] = this; + this.dirty = true; + } + } + + /** + * append DOM element + * @private + */ + }, { + key: "_appendDomElement", + value: function _appendDomElement() { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.point.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw item: parent has no foreground container element'); + } + foreground.appendChild(this.dom.point); + } + this.displayed = true; + } + + /** + * update dirty DOM components + * @private + */ + }, { + key: "_updateDirtyDomComponents", + value: function _updateDirtyDomComponents() { + // An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.point); + this._updateStyle(this.dom.point); + var editable = this.editable.updateTime || this.editable.updateGroup; + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.point.className = "vis-item vis-point".concat(className); + this.dom.dot.className = "vis-item vis-dot".concat(className); + } + } + + /** + * get DOM component sizes + * @return {object} + * @private + */ + }, { + key: "_getDomComponentsSizes", + value: function _getDomComponentsSizes() { + return { + dot: { + width: this.dom.dot.offsetWidth, + height: this.dom.dot.offsetHeight + }, + content: { + width: this.dom.content.offsetWidth, + height: this.dom.content.offsetHeight + }, + point: { + width: this.dom.point.offsetWidth, + height: this.dom.point.offsetHeight + } + }; + } + + /** + * update DOM components sizes + * @param {array} sizes + * @private + */ + }, { + key: "_updateDomComponentsSizes", + value: function _updateDomComponentsSizes(sizes) { + // recalculate size of dot and contents + this.props.dot.width = sizes.dot.width; + this.props.dot.height = sizes.dot.height; + this.props.content.height = sizes.content.height; + + // resize contents + if (this.options.rtl) { + this.dom.content.style.marginRight = "".concat(this.props.dot.width / 2, "px"); + } else { + this.dom.content.style.marginLeft = "".concat(this.props.dot.width / 2, "px"); + } + //this.dom.content.style.marginRight = ... + 'px'; // TODO: margin right + + // recalculate size + this.width = sizes.point.width; + this.height = sizes.point.height; + + // reposition the dot + this.dom.dot.style.top = "".concat((this.height - this.props.dot.height) / 2, "px"); + var dotWidth = this.props.dot.width; + var translateX = this.options.rtl ? dotWidth / 2 : dotWidth / 2 * -1; + this.dom.dot.style.transform = "translateX(".concat(translateX, "px"); + this.dirty = false; + } + + /** + * Repain DOM additionals + * @private + */ + }, { + key: "_repaintDomAdditionals", + value: function _repaintDomAdditionals() { + this._repaintOnItemUpdateTimeTooltip(this.dom.point); + this._repaintDragCenter(); + this._repaintDeleteButton(this.dom.point); + } + + /** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "redraw", + value: function redraw(returnQueue) { + var _context, + _context2, + _context3, + _this2 = this, + _context5; + var sizes; + var queue = [ + // create item DOM + _bindInstanceProperty$1(_context = this._createDomElement).call(_context, this), + // append DOM to parent DOM + _bindInstanceProperty$1(_context2 = this._appendDomElement).call(_context2, this), + // update dirty DOM + _bindInstanceProperty$1(_context3 = this._updateDirtyDomComponents).call(_context3, this), function () { + if (_this2.dirty) { + sizes = _this2._getDomComponentsSizes(); + } + }, function () { + if (_this2.dirty) { + var _context4; + _bindInstanceProperty$1(_context4 = _this2._updateDomComponentsSizes).call(_context4, _this2)(sizes); + } + }, + // repaint DOM additionals + _bindInstanceProperty$1(_context5 = this._repaintDomAdditionals).call(_context5, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * Reposition XY + */ + }, { + key: "repositionXY", + value: function repositionXY() { + var rtl = this.options.rtl; + var repositionXY = function repositionXY(element, x, y) { + var _context6; + var rtl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + if (x === undefined && y === undefined) return; + // If rtl invert the number. + var directionX = rtl ? x * -1 : x; + + //no y. translate x + if (y === undefined) { + element.style.transform = "translateX(".concat(directionX, "px)"); + return; + } + + //no x. translate y + if (x === undefined) { + element.style.transform = "translateY(".concat(y, "px)"); + return; + } + element.style.transform = _concatInstanceProperty(_context6 = "translate(".concat(directionX, "px, ")).call(_context6, y, "px)"); + }; + repositionXY(this.dom.point, this.pointX, this.pointY, rtl); + } + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + * @param {boolean} [returnQueue=false] whether to return a queue of functions to execute instead of just executing them + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "show", + value: function show(returnQueue) { + if (!this.displayed) { + return this.redraw(returnQueue); + } + } + + /** + * Hide the item from the DOM (when visible) + */ + }, { + key: "hide", + value: function hide() { + if (this.displayed) { + if (this.dom.point.parentNode) { + this.dom.point.parentNode.removeChild(this.dom.point); + } + this.displayed = false; + } + } + + /** + * Reposition the item horizontally + * @Override + */ + }, { + key: "repositionX", + value: function repositionX() { + var start = this.conversion.toScreen(this.data.start); + this.pointX = start; + if (this.options.rtl) { + this.right = start - this.props.dot.width; + } else { + this.left = start - this.props.dot.width; + } + this.repositionXY(); + } + + /** + * Reposition the item vertically + * @Override + */ + }, { + key: "repositionY", + value: function repositionY() { + var orientation = this.options.orientation.item; + if (orientation == 'top') { + this.pointY = this.top; + } else { + this.pointY = this.parent.height - this.top - this.height; + } + this.repositionXY(); + } + + /** + * Return the width of the item left from its start date + * @return {number} + */ + }, { + key: "getWidthLeft", + value: function getWidthLeft() { + return this.props.dot.width; + } + + /** + * Return the width of the item right from its start date + * @return {number} + */ + }, { + key: "getWidthRight", + value: function getWidthRight() { + return this.props.dot.width; + } + }]); + return PointItem; + }(Item); + + function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * @constructor RangeItem + * @extends Item + */ + var RangeItem = /*#__PURE__*/function (_Item) { + _inherits(RangeItem, _Item); + var _super = _createSuper$5(RangeItem); + /** + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + */ + function RangeItem(data, conversion, options) { + var _this; + _classCallCheck(this, RangeItem); + _this = _super.call(this, data, conversion, options); + _this.props = { + content: { + width: 0 + } + }; + _this.overflow = false; // if contents can overflow (css styling), this flag is set to true + // validate data + if (data) { + if (data.start == undefined) { + throw new Error("Property \"start\" missing in item ".concat(data.id)); + } + if (data.end == undefined) { + throw new Error("Property \"end\" missing in item ".concat(data.id)); + } + } + return _this; + } + + /** + * Check whether this item is visible inside given range + * + * @param {timeline.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + _createClass(RangeItem, [{ + key: "isVisible", + value: function isVisible(range) { + if (this.cluster) { + return false; + } + // determine visibility + return this.data.start < range.end && this.data.end > range.start; + } + + /** + * create DOM elements + * @private + */ + }, { + key: "_createDomElement", + value: function _createDomElement() { + if (!this.dom) { + // create DOM + this.dom = {}; + + // background box + this.dom.box = document.createElement('div'); + // className is updated in redraw() + + // frame box (to prevent the item contents from overflowing) + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-item-overflow'; + this.dom.box.appendChild(this.dom.frame); + + // visible frame box (showing the frame that is always visible) + this.dom.visibleFrame = document.createElement('div'); + this.dom.visibleFrame.className = 'vis-item-visible-frame'; + this.dom.box.appendChild(this.dom.visibleFrame); + + // contents box + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.frame.appendChild(this.dom.content); + + // attach this item as attribute + this.dom.box['vis-item'] = this; + this.dirty = true; + } + } + + /** + * append element to DOM + * @private + */ + }, { + key: "_appendDomElement", + value: function _appendDomElement() { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw item: parent has no foreground container element'); + } + foreground.appendChild(this.dom.box); + } + this.displayed = true; + } + + /** + * update dirty DOM components + * @private + */ + }, { + key: "_updateDirtyDomComponents", + value: function _updateDirtyDomComponents() { + // update dirty DOM. An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.box); + this._updateStyle(this.dom.box); + var editable = this.editable.updateTime || this.editable.updateGroup; + + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.box.className = this.baseClassName + className; + + // turn off max-width to be able to calculate the real width + // this causes an extra browser repaint/reflow, but so be it + this.dom.content.style.maxWidth = 'none'; + } + } + + /** + * get DOM component sizes + * @return {object} + * @private + */ + }, { + key: "_getDomComponentsSizes", + value: function _getDomComponentsSizes() { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(this.dom.frame).overflow !== 'hidden'; + this.whiteSpace = window.getComputedStyle(this.dom.content).whiteSpace !== 'nowrap'; + return { + content: { + width: this.dom.content.offsetWidth + }, + box: { + height: this.dom.box.offsetHeight + } + }; + } + + /** + * update DOM component sizes + * @param {array} sizes + * @private + */ + }, { + key: "_updateDomComponentsSizes", + value: function _updateDomComponentsSizes(sizes) { + this.props.content.width = sizes.content.width; + this.height = sizes.box.height; + this.dom.content.style.maxWidth = ''; + this.dirty = false; + } + + /** + * repaint DOM additional components + * @private + */ + }, { + key: "_repaintDomAdditionals", + value: function _repaintDomAdditionals() { + this._repaintOnItemUpdateTimeTooltip(this.dom.box); + this._repaintDeleteButton(this.dom.box); + this._repaintDragCenter(); + this._repaintDragLeft(); + this._repaintDragRight(); + } + + /** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "redraw", + value: function redraw(returnQueue) { + var _context, + _context2, + _context3, + _this2 = this, + _context6; + var sizes; + var queue = [ + // create item DOM + _bindInstanceProperty$1(_context = this._createDomElement).call(_context, this), + // append DOM to parent DOM + _bindInstanceProperty$1(_context2 = this._appendDomElement).call(_context2, this), + // update dirty DOM + _bindInstanceProperty$1(_context3 = this._updateDirtyDomComponents).call(_context3, this), function () { + if (_this2.dirty) { + var _context4; + sizes = _bindInstanceProperty$1(_context4 = _this2._getDomComponentsSizes).call(_context4, _this2)(); + } + }, function () { + if (_this2.dirty) { + var _context5; + _bindInstanceProperty$1(_context5 = _this2._updateDomComponentsSizes).call(_context5, _this2)(sizes); + } + }, + // repaint DOM additionals + _bindInstanceProperty$1(_context6 = this._repaintDomAdditionals).call(_context6, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + * @param {boolean} [returnQueue=false] whether to return a queue of functions to execute instead of just executing them + * @return {boolean} the redraw queue if returnQueue=true + */ + }, { + key: "show", + value: function show(returnQueue) { + if (!this.displayed) { + return this.redraw(returnQueue); + } + } + + /** + * Hide the item from the DOM (when visible) + */ + }, { + key: "hide", + value: function hide() { + if (this.displayed) { + var box = this.dom.box; + if (box.parentNode) { + box.parentNode.removeChild(box); + } + this.displayed = false; + } + } + + /** + * Reposition the item horizontally + * @param {boolean} [limitSize=true] If true (default), the width of the range + * item will be limited, as the browser cannot + * display very wide divs. This means though + * that the applied left and width may + * not correspond to the ranges start and end + * @Override + */ + }, { + key: "repositionX", + value: function repositionX(limitSize) { + var parentWidth = this.parent.width; + var start = this.conversion.toScreen(this.data.start); + var end = this.conversion.toScreen(this.data.end); + var align = this.data.align === undefined ? this.options.align : this.data.align; + var contentStartPosition; + var contentWidth; + + // limit the width of the range, as browsers cannot draw very wide divs + // unless limitSize: false is explicitly set in item data + if (this.data.limitSize !== false && (limitSize === undefined || limitSize === true)) { + if (start < -parentWidth) { + start = -parentWidth; + } + if (end > 2 * parentWidth) { + end = 2 * parentWidth; + } + } + + //round to 3 decimals to compensate floating-point values rounding + var boxWidth = Math.max(Math.round((end - start) * 1000) / 1000, 1); + if (this.overflow) { + if (this.options.rtl) { + this.right = start; + } else { + this.left = start; + } + this.width = boxWidth + this.props.content.width; + contentWidth = this.props.content.width; + + // Note: The calculation of width is an optimistic calculation, giving + // a width which will not change when moving the Timeline + // So no re-stacking needed, which is nicer for the eye; + } else { + if (this.options.rtl) { + this.right = start; + } else { + this.left = start; + } + this.width = boxWidth; + contentWidth = Math.min(end - start, this.props.content.width); + } + if (this.options.rtl) { + this.dom.box.style.transform = "translateX(".concat(this.right * -1, "px)"); + } else { + this.dom.box.style.transform = "translateX(".concat(this.left, "px)"); + } + this.dom.box.style.width = "".concat(boxWidth, "px"); + if (this.whiteSpace) { + this.height = this.dom.box.offsetHeight; + } + switch (align) { + case 'left': + this.dom.content.style.transform = 'translateX(0)'; + break; + case 'right': + if (this.options.rtl) { + var translateX = Math.max(boxWidth - contentWidth, 0) * -1; + this.dom.content.style.transform = "translateX(".concat(translateX, "px)"); + } else { + this.dom.content.style.transform = "translateX(".concat(Math.max(boxWidth - contentWidth, 0), "px)"); + } + break; + case 'center': + if (this.options.rtl) { + var _translateX = Math.max((boxWidth - contentWidth) / 2, 0) * -1; + this.dom.content.style.transform = "translateX(".concat(_translateX, "px)"); + } else { + this.dom.content.style.transform = "translateX(".concat(Math.max((boxWidth - contentWidth) / 2, 0), "px)"); + } + break; + default: + // 'auto' + // when range exceeds left of the window, position the contents at the left of the visible area + if (this.overflow) { + if (end > 0) { + contentStartPosition = Math.max(-start, 0); + } else { + contentStartPosition = -contentWidth; // ensure it's not visible anymore + } + } else { + if (start < 0) { + contentStartPosition = -start; + } else { + contentStartPosition = 0; + } + } + if (this.options.rtl) { + var _translateX2 = contentStartPosition * -1; + this.dom.content.style.transform = "translateX(".concat(_translateX2, "px)"); + } else { + this.dom.content.style.transform = "translateX(".concat(contentStartPosition, "px)"); + // this.dom.content.style.width = `calc(100% - ${contentStartPosition}px)`; + } + } + } + + /** + * Reposition the item vertically + * @Override + */ + }, { + key: "repositionY", + value: function repositionY() { + var orientation = this.options.orientation.item; + var box = this.dom.box; + if (orientation == 'top') { + box.style.top = "".concat(this.top, "px"); + } else { + box.style.top = "".concat(this.parent.height - this.top - this.height, "px"); + } + } + + /** + * Repaint a drag area on the left side of the range when the range is selected + * @protected + */ + }, { + key: "_repaintDragLeft", + value: function _repaintDragLeft() { + if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.editable.updateTime && !this.dom.dragLeft) { + // create and show drag area + var dragLeft = document.createElement('div'); + dragLeft.className = 'vis-drag-left'; + dragLeft.dragLeftItem = this; + this.dom.box.appendChild(dragLeft); + this.dom.dragLeft = dragLeft; + } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragLeft) { + // delete drag area + if (this.dom.dragLeft.parentNode) { + this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); + } + this.dom.dragLeft = null; + } + } + + /** + * Repaint a drag area on the right side of the range when the range is selected + * @protected + */ + }, { + key: "_repaintDragRight", + value: function _repaintDragRight() { + if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.editable.updateTime && !this.dom.dragRight) { + // create and show drag area + var dragRight = document.createElement('div'); + dragRight.className = 'vis-drag-right'; + dragRight.dragRightItem = this; + this.dom.box.appendChild(dragRight); + this.dom.dragRight = dragRight; + } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragRight) { + // delete drag area + if (this.dom.dragRight.parentNode) { + this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); + } + this.dom.dragRight = null; + } + } + }]); + return RangeItem; + }(Item); + RangeItem.prototype.baseClassName = 'vis-item vis-range'; + + function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * @constructor BackgroundItem + * @extends Item + */ + var BackgroundItem = /*#__PURE__*/function (_Item) { + _inherits(BackgroundItem, _Item); + var _super = _createSuper$4(BackgroundItem); + /** + * @constructor BackgroundItem + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + * // TODO: implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation + */ + function BackgroundItem(data, conversion, options) { + var _this; + _classCallCheck(this, BackgroundItem); + _this = _super.call(this, data, conversion, options); + _this.props = { + content: { + width: 0 + } + }; + _this.overflow = false; // if contents can overflow (css styling), this flag is set to true + + // validate data + if (data) { + if (data.start == undefined) { + throw new Error("Property \"start\" missing in item ".concat(data.id)); + } + if (data.end == undefined) { + throw new Error("Property \"end\" missing in item ".concat(data.id)); + } + } + return _this; + } + + /** + * Check whether this item is visible inside given range + * @param {timeline.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ + _createClass(BackgroundItem, [{ + key: "isVisible", + value: function isVisible(range) { + // determine visibility + return this.data.start < range.end && this.data.end > range.start; + } + + /** + * create DOM element + * @private + */ + }, { + key: "_createDomElement", + value: function _createDomElement() { + if (!this.dom) { + // create DOM + this.dom = {}; + + // background box + this.dom.box = document.createElement('div'); + // className is updated in redraw() + + // frame box (to prevent the item contents from overflowing + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-item-overflow'; + this.dom.box.appendChild(this.dom.frame); + + // contents box + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.frame.appendChild(this.dom.content); + + // Note: we do NOT attach this item as attribute to the DOM, + // such that background items cannot be selected + //this.dom.box['vis-item'] = this; + + this.dirty = true; + } + } + + /** + * append DOM element + * @private + */ + }, { + key: "_appendDomElement", + value: function _appendDomElement() { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var background = this.parent.dom.background; + if (!background) { + throw new Error('Cannot redraw item: parent has no background container element'); + } + background.appendChild(this.dom.box); + } + this.displayed = true; + } + + /** + * update DOM Dirty components + * @private + */ + }, { + key: "_updateDirtyDomComponents", + value: function _updateDirtyDomComponents() { + // update dirty DOM. An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.content); + this._updateStyle(this.dom.box); + + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : ''); + this.dom.box.className = this.baseClassName + className; + } + } + + /** + * get DOM components sizes + * @return {object} + * @private + */ + }, { + key: "_getDomComponentsSizes", + value: function _getDomComponentsSizes() { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(this.dom.content).overflow !== 'hidden'; + return { + content: { + width: this.dom.content.offsetWidth + } + }; + } + + /** + * update DOM components sizes + * @param {object} sizes + * @private + */ + }, { + key: "_updateDomComponentsSizes", + value: function _updateDomComponentsSizes(sizes) { + // recalculate size + this.props.content.width = sizes.content.width; + this.height = 0; // set height zero, so this item will be ignored when stacking items + + this.dirty = false; + } + + /** + * repaint DOM additionals + * @private + */ + }, { + key: "_repaintDomAdditionals", + value: function _repaintDomAdditionals() {} + + /** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw result or the redraw queue if returnQueue=true + */ + }, { + key: "redraw", + value: function redraw(returnQueue) { + var _context, + _context2, + _context3, + _this2 = this, + _context6; + var sizes; + var queue = [ + // create item DOM + _bindInstanceProperty$1(_context = this._createDomElement).call(_context, this), + // append DOM to parent DOM + _bindInstanceProperty$1(_context2 = this._appendDomElement).call(_context2, this), _bindInstanceProperty$1(_context3 = this._updateDirtyDomComponents).call(_context3, this), function () { + if (_this2.dirty) { + var _context4; + sizes = _bindInstanceProperty$1(_context4 = _this2._getDomComponentsSizes).call(_context4, _this2)(); + } + }, function () { + if (_this2.dirty) { + var _context5; + _bindInstanceProperty$1(_context5 = _this2._updateDomComponentsSizes).call(_context5, _this2)(sizes); + } + }, + // repaint DOM additionals + _bindInstanceProperty$1(_context6 = this._repaintDomAdditionals).call(_context6, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * Reposition the item vertically + * @Override + */ + }, { + key: "repositionY", + value: function repositionY(margin) { + // eslint-disable-line no-unused-vars + var height; + var orientation = this.options.orientation.item; + + // special positioning for subgroups + if (this.data.subgroup !== undefined) { + // TODO: instead of calculating the top position of the subgroups here for every BackgroundItem, calculate the top of the subgroup once in Itemset + var itemSubgroup = this.data.subgroup; + this.dom.box.style.height = "".concat(this.parent.subgroups[itemSubgroup].height, "px"); + if (orientation == 'top') { + this.dom.box.style.top = "".concat(this.parent.top + this.parent.subgroups[itemSubgroup].top, "px"); + } else { + this.dom.box.style.top = "".concat(this.parent.top + this.parent.height - this.parent.subgroups[itemSubgroup].top - this.parent.subgroups[itemSubgroup].height, "px"); + } + this.dom.box.style.bottom = ''; + } + // and in the case of no subgroups: + else { + // we want backgrounds with groups to only show in groups. + if (this.parent instanceof BackgroundGroup) { + // if the item is not in a group: + height = Math.max(this.parent.height, this.parent.itemSet.body.domProps.center.height, this.parent.itemSet.body.domProps.centerContainer.height); + this.dom.box.style.bottom = orientation == 'bottom' ? '0' : ''; + this.dom.box.style.top = orientation == 'top' ? '0' : ''; + } else { + height = this.parent.height; + // same alignment for items when orientation is top or bottom + this.dom.box.style.top = "".concat(this.parent.top, "px"); + this.dom.box.style.bottom = ''; + } + } + this.dom.box.style.height = "".concat(height, "px"); + } + }]); + return BackgroundItem; + }(Item); + BackgroundItem.prototype.baseClassName = 'vis-item vis-background'; + BackgroundItem.prototype.stack = false; + + /** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ + BackgroundItem.prototype.show = RangeItem.prototype.show; + + /** + * Hide the item from the DOM (when visible) + * @return {Boolean} changed + */ + BackgroundItem.prototype.hide = RangeItem.prototype.hide; + + /** + * Reposition the item horizontally + * @Override + */ + BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX; + + var css_248z$4 = "div.vis-tooltip {\n position: absolute;\n visibility: hidden;\n padding: 5px;\n white-space: nowrap;\n\n font-family: verdana;\n font-size:14px;\n color:#000000;\n background-color: #f5f4ed;\n\n -moz-border-radius: 3px;\n -webkit-border-radius: 3px;\n border-radius: 3px;\n border: 1px solid #808074;\n\n box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);\n pointer-events: none;\n\n z-index: 5;\n}\n"; + styleInject(css_248z$4); + + /** + * Popup is a class to create a popup window with some text + */ + var Popup = /*#__PURE__*/function () { + /** + * @param {Element} container The container object. + * @param {string} overflowMethod How the popup should act to overflowing ('flip', 'cap' or 'none') + */ + function Popup(container, overflowMethod) { + _classCallCheck(this, Popup); + this.container = container; + this.overflowMethod = overflowMethod || 'cap'; + this.x = 0; + this.y = 0; + this.padding = 5; + this.hidden = false; + + // create the frame + this.frame = document.createElement('div'); + this.frame.className = 'vis-tooltip'; + this.container.appendChild(this.frame); + } + + /** + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window + */ + _createClass(Popup, [{ + key: "setPosition", + value: function setPosition(x, y) { + this.x = _parseInt$1(x); + this.y = _parseInt$1(y); + } + + /** + * Set the content for the popup window. This can be HTML code or text. + * @param {string | Element} content + */ + }, { + key: "setText", + value: function setText(content) { + if (content instanceof Element) { + this.frame.innerHTML = ''; + this.frame.appendChild(content); + } else { + this.frame.innerHTML = availableUtils.xss(content); // string containing text or HTML + } + } + + /** + * Show the popup window + * @param {boolean} [doShow] Show or hide the window + */ + }, { + key: "show", + value: function show(doShow) { + if (doShow === undefined) { + doShow = true; + } + if (doShow === true) { + var height = this.frame.clientHeight; + var width = this.frame.clientWidth; + var maxHeight = this.frame.parentNode.clientHeight; + var maxWidth = this.frame.parentNode.clientWidth; + var left = 0, + top = 0; + if (this.overflowMethod == 'flip' || this.overflowMethod == 'none') { + var isLeft = false, + isTop = true; // Where around the position it's located + + if (this.overflowMethod == 'flip') { + if (this.y - height < this.padding) { + isTop = false; + } + if (this.x + width > maxWidth - this.padding) { + isLeft = true; + } + } + if (isLeft) { + left = this.x - width; + } else { + left = this.x; + } + if (isTop) { + top = this.y - height; + } else { + top = this.y; + } + } else { + // this.overflowMethod == 'cap' + top = this.y - height; + if (top + height + this.padding > maxHeight) { + top = maxHeight - height - this.padding; + } + if (top < this.padding) { + top = this.padding; + } + left = this.x; + if (left + width + this.padding > maxWidth) { + left = maxWidth - width - this.padding; + } + if (left < this.padding) { + left = this.padding; + } + } + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; + this.hidden = false; + } else { + this.hide(); + } + } + + /** + * Hide the popup window + */ + }, { + key: "hide", + value: function hide() { + this.hidden = true; + this.frame.style.left = "0"; + this.frame.style.top = "0"; + this.frame.style.visibility = "hidden"; + } + + /** + * Remove the popup window + */ + }, { + key: "destroy", + value: function destroy() { + this.frame.parentNode.removeChild(this.frame); // Remove element from DOM + } + }]); + return Popup; + }(); + + var $ = _export; + var $every = arrayIteration.every; + var arrayMethodIsStrict = arrayMethodIsStrict$6; + + var STRICT_METHOD = arrayMethodIsStrict('every'); + + // `Array.prototype.every` method + // https://tc39.es/ecma262/#sec-array.prototype.every + $({ target: 'Array', proto: true, forced: !STRICT_METHOD }, { + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } + }); + + var entryVirtual = entryVirtual$o; + + var every$3 = entryVirtual('Array').every; + + var isPrototypeOf = objectIsPrototypeOf; + var method = every$3; + + var ArrayPrototype = Array.prototype; + + var every$2 = function (it) { + var own = it.every; + return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.every) ? method : own; + }; + + var parent = every$2; + + var every$1 = parent; + + var every = every$1; + + var _everyInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(every); + + function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$3(o, minLen) { var _context14; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = _sliceInstanceProperty(_context14 = Object.prototype.toString.call(o)).call(_context14, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); } + function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * ClusterItem + */ + var ClusterItem = /*#__PURE__*/function (_Item) { + _inherits(ClusterItem, _Item); + var _super = _createSuper$3(ClusterItem); + /** + * @constructor Item + * @param {Object} data Object containing (optional) parameters type, + * start, end, content, group, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} options Configuration options + * // TODO: describe available options + */ + function ClusterItem(data, conversion, options) { + var _this; + _classCallCheck(this, ClusterItem); + var modifiedOptions = _Object$assign({}, { + fitOnDoubleClick: true + }, options, { + editable: false + }); + _this = _super.call(this, data, conversion, modifiedOptions); + _this.props = { + content: { + width: 0, + height: 0 + } + }; + if (!data || data.uiItems == undefined) { + throw new Error('Property "uiItems" missing in item ' + data.id); + } + _this.id = v4(); + _this.group = data.group; + _this._setupRange(); + _this.emitter = _this.data.eventEmitter; + _this.range = _this.data.range; + _this.attached = false; + _this.isCluster = true; + _this.data.isCluster = true; + return _this; + } + + /** + * check if there are items + * @return {boolean} + */ + _createClass(ClusterItem, [{ + key: "hasItems", + value: function hasItems() { + return this.data.uiItems && this.data.uiItems.length && this.attached; + } + + /** + * set UI items + * @param {array} items + */ + }, { + key: "setUiItems", + value: function setUiItems(items) { + this.detach(); + this.data.uiItems = items; + this._setupRange(); + this.attach(); + } + + /** + * check is visible + * @param {object} range + * @return {boolean} + */ + }, { + key: "isVisible", + value: function isVisible(range) { + var rangeWidth = this.data.end ? this.data.end - this.data.start : 0; + var widthInMs = this.width * range.getMillisecondsPerPixel(); + var end = Math.max(this.data.start.getTime() + rangeWidth, this.data.start.getTime() + widthInMs); + return this.data.start < range.end && end > range.start && this.hasItems(); + } + + /** + * get cluster data + * @return {object} + */ + }, { + key: "getData", + value: function getData() { + return { + isCluster: true, + id: this.id, + items: this.data.items || [], + data: this.data + }; + } + + /** + * redraw cluster item + * @param {boolean} returnQueue + * @return {boolean} + */ + }, { + key: "redraw", + value: function redraw(returnQueue) { + var _context, _context2, _context3, _context4, _context5, _context7; + var sizes; + var queue = [ + // create item DOM + _bindInstanceProperty$1(_context = this._createDomElement).call(_context, this), + // append DOM to parent DOM + _bindInstanceProperty$1(_context2 = this._appendDomElement).call(_context2, this), + // update dirty DOM + _bindInstanceProperty$1(_context3 = this._updateDirtyDomComponents).call(_context3, this), _bindInstanceProperty$1(_context4 = function _context4() { + if (this.dirty) { + sizes = this._getDomComponentsSizes(); + } + }).call(_context4, this), _bindInstanceProperty$1(_context5 = function _context5() { + if (this.dirty) { + var _context6; + _bindInstanceProperty$1(_context6 = this._updateDomComponentsSizes).call(_context6, this)(sizes); + } + }).call(_context5, this), + // repaint DOM additionals + _bindInstanceProperty$1(_context7 = this._repaintDomAdditionals).call(_context7, this)]; + if (returnQueue) { + return queue; + } else { + var result; + _forEachInstanceProperty(queue).call(queue, function (fn) { + result = fn(); + }); + return result; + } + } + + /** + * show cluster item + */ + }, { + key: "show", + value: function show() { + if (!this.displayed) { + this.redraw(); + } + } + + /** + * Hide the item from the DOM (when visible) + */ + }, { + key: "hide", + value: function hide() { + if (this.displayed) { + var dom = this.dom; + if (dom.box.parentNode) { + dom.box.parentNode.removeChild(dom.box); + } + if (this.options.showStipes) { + if (dom.line.parentNode) { + dom.line.parentNode.removeChild(dom.line); + } + if (dom.dot.parentNode) { + dom.dot.parentNode.removeChild(dom.dot); + } + } + this.displayed = false; + } + } + + /** + * reposition item x axis + */ + }, { + key: "repositionX", + value: function repositionX() { + var start = this.conversion.toScreen(this.data.start); + var end = this.data.end ? this.conversion.toScreen(this.data.end) : 0; + if (end) { + this.repositionXWithRanges(start, end); + } else { + var align = this.data.align === undefined ? this.options.align : this.data.align; + this.repositionXWithoutRanges(start, align); + } + if (this.options.showStipes) { + this.dom.line.style.display = this._isStipeVisible() ? 'block' : 'none'; + this.dom.dot.style.display = this._isStipeVisible() ? 'block' : 'none'; + if (this._isStipeVisible()) { + this.repositionStype(start, end); + } + } + } + + /** + * reposition item stype + * @param {date} start + * @param {date} end + */ + }, { + key: "repositionStype", + value: function repositionStype(start, end) { + this.dom.line.style.display = 'block'; + this.dom.dot.style.display = 'block'; + var lineOffsetWidth = this.dom.line.offsetWidth; + var dotOffsetWidth = this.dom.dot.offsetWidth; + if (end) { + var lineOffset = lineOffsetWidth + start + (end - start) / 2; + var dotOffset = lineOffset - dotOffsetWidth / 2; + var lineOffsetDirection = this.options.rtl ? lineOffset * -1 : lineOffset; + var dotOffsetDirection = this.options.rtl ? dotOffset * -1 : dotOffset; + this.dom.line.style.transform = "translateX(".concat(lineOffsetDirection, "px)"); + this.dom.dot.style.transform = "translateX(".concat(dotOffsetDirection, "px)"); + } else { + var _lineOffsetDirection = this.options.rtl ? start * -1 : start; + var _dotOffsetDirection = this.options.rtl ? (start - dotOffsetWidth / 2) * -1 : start - dotOffsetWidth / 2; + this.dom.line.style.transform = "translateX(".concat(_lineOffsetDirection, "px)"); + this.dom.dot.style.transform = "translateX(".concat(_dotOffsetDirection, "px)"); + } + } + + /** + * reposition x without ranges + * @param {date} start + * @param {string} align + */ + }, { + key: "repositionXWithoutRanges", + value: function repositionXWithoutRanges(start, align) { + // calculate left position of the box + if (align == 'right') { + if (this.options.rtl) { + this.right = start - this.width; + + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + } else { + this.left = start - this.width; + + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + } + } else if (align == 'left') { + if (this.options.rtl) { + this.right = start; + + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + } else { + this.left = start; + + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + } + } else { + // default or 'center' + if (this.options.rtl) { + this.right = start - this.width / 2; + + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + } else { + this.left = start - this.width / 2; + + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + } + } + } + + /** + * reposition x with ranges + * @param {date} start + * @param {date} end + */ + }, { + key: "repositionXWithRanges", + value: function repositionXWithRanges(start, end) { + var boxWidth = Math.round(Math.max(end - start + 0.5, 1)); + if (this.options.rtl) { + this.right = start; + } else { + this.left = start; + } + this.width = Math.max(boxWidth, this.minWidth || 0); + if (this.options.rtl) { + this.dom.box.style.right = this.right + 'px'; + } else { + this.dom.box.style.left = this.left + 'px'; + } + this.dom.box.style.width = boxWidth + 'px'; + } + + /** + * reposition item y axis + */ + }, { + key: "repositionY", + value: function repositionY() { + var orientation = this.options.orientation.item; + var box = this.dom.box; + if (orientation == 'top') { + box.style.top = (this.top || 0) + 'px'; + } else { + // orientation 'bottom' + box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; + } + if (this.options.showStipes) { + if (orientation == 'top') { + this.dom.line.style.top = '0'; + this.dom.line.style.height = this.parent.top + this.top + 1 + 'px'; + this.dom.line.style.bottom = ''; + } else { + // orientation 'bottom' + var itemSetHeight = this.parent.itemSet.props.height; + var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + this.dom.line.style.top = itemSetHeight - lineHeight + 'px'; + this.dom.line.style.bottom = '0'; + } + this.dom.dot.style.top = -this.dom.dot.offsetHeight / 2 + 'px'; + } + } + + /** + * get width left + * @return {number} + */ + }, { + key: "getWidthLeft", + value: function getWidthLeft() { + return this.width / 2; + } + + /** + * get width right + * @return {number} + */ + }, { + key: "getWidthRight", + value: function getWidthRight() { + return this.width / 2; + } + + /** + * move cluster item + */ + }, { + key: "move", + value: function move() { + this.repositionX(); + this.repositionY(); + } + + /** + * attach + */ + }, { + key: "attach", + value: function attach() { + var _context8; + var _iterator = _createForOfIteratorHelper$3(this.data.uiItems), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var item = _step.value; + item.cluster = this; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + this.data.items = _mapInstanceProperty(_context8 = this.data.uiItems).call(_context8, function (item) { + return item.data; + }); + this.attached = true; + this.dirty = true; + } + + /** + * detach + * @param {boolean} detachFromParent + * @return {void} + */ + }, { + key: "detach", + value: function detach() { + var detachFromParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + if (!this.hasItems()) { + return; + } + var _iterator2 = _createForOfIteratorHelper$3(this.data.uiItems), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var item = _step2.value; + delete item.cluster; + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + this.attached = false; + if (detachFromParent && this.group) { + this.group.remove(this); + this.group = null; + } + this.data.items = []; + this.dirty = true; + } + + /** + * handle on double click + */ + }, { + key: "_onDoubleClick", + value: function _onDoubleClick() { + this._fit(); + } + + /** + * set range + */ + }, { + key: "_setupRange", + value: function _setupRange() { + var _context9, _context10, _context11; + var stats = _mapInstanceProperty(_context9 = this.data.uiItems).call(_context9, function (item) { + return { + start: item.data.start.valueOf(), + end: item.data.end ? item.data.end.valueOf() : item.data.start.valueOf() + }; + }); + this.data.min = Math.min.apply(Math, _toConsumableArray(_mapInstanceProperty(stats).call(stats, function (s) { + return Math.min(s.start, s.end || s.start); + }))); + this.data.max = Math.max.apply(Math, _toConsumableArray(_mapInstanceProperty(stats).call(stats, function (s) { + return Math.max(s.start, s.end || s.start); + }))); + var centers = _mapInstanceProperty(_context10 = this.data.uiItems).call(_context10, function (item) { + return item.center; + }); + var avg = _reduceInstanceProperty(centers).call(centers, function (sum, value) { + return sum + value; + }, 0) / this.data.uiItems.length; + if (_someInstanceProperty(_context11 = this.data.uiItems).call(_context11, function (item) { + return item.data.end; + })) { + // contains ranges + this.data.start = new Date(this.data.min); + this.data.end = new Date(this.data.max); + } else { + this.data.start = new Date(avg); + this.data.end = null; + } + } + + /** + * get UI items + * @return {array} + */ + }, { + key: "_getUiItems", + value: function _getUiItems() { + var _this2 = this; + if (this.data.uiItems && this.data.uiItems.length) { + var _context12; + return _filterInstanceProperty(_context12 = this.data.uiItems).call(_context12, function (item) { + return item.cluster === _this2; + }); + } + return []; + } + + /** + * create DOM element + */ + }, { + key: "_createDomElement", + value: function _createDomElement() { + if (!this.dom) { + // create DOM + this.dom = {}; + + // create main box + this.dom.box = document.createElement('DIV'); + + // contents box (inside the background box). used for making margins + this.dom.content = document.createElement('DIV'); + this.dom.content.className = 'vis-item-content'; + this.dom.box.appendChild(this.dom.content); + if (this.options.showStipes) { + // line to axis + this.dom.line = document.createElement('DIV'); + this.dom.line.className = 'vis-cluster-line'; + this.dom.line.style.display = 'none'; + + // dot on axis + this.dom.dot = document.createElement('DIV'); + this.dom.dot.className = 'vis-cluster-dot'; + this.dom.dot.style.display = 'none'; + } + if (this.options.fitOnDoubleClick) { + var _context13; + this.dom.box.ondblclick = _bindInstanceProperty$1(_context13 = ClusterItem.prototype._onDoubleClick).call(_context13, this); + } + + // attach this item as attribute + this.dom.box['vis-item'] = this; + this.dirty = true; + } + } + + /** + * append element to DOM + */ + }, { + key: "_appendDomElement", + value: function _appendDomElement() { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw item: parent has no foreground container element'); + } + foreground.appendChild(this.dom.box); + } + var background = this.parent.dom.background; + if (this.options.showStipes) { + if (!this.dom.line.parentNode) { + if (!background) throw new Error('Cannot redraw item: parent has no background container element'); + background.appendChild(this.dom.line); + } + if (!this.dom.dot.parentNode) { + var axis = this.parent.dom.axis; + if (!background) throw new Error('Cannot redraw item: parent has no axis container element'); + axis.appendChild(this.dom.dot); + } + } + this.displayed = true; + } + + /** + * update dirty DOM components + */ + }, { + key: "_updateDirtyDomComponents", + value: function _updateDirtyDomComponents() { + // An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.box); + this._updateStyle(this.dom.box); + + // update class + var className = this.baseClassName + ' ' + (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + ' vis-readonly'; + this.dom.box.className = 'vis-item ' + className; + if (this.options.showStipes) { + this.dom.line.className = 'vis-item vis-cluster-line ' + (this.selected ? ' vis-selected' : ''); + this.dom.dot.className = 'vis-item vis-cluster-dot ' + (this.selected ? ' vis-selected' : ''); + } + if (this.data.end) { + // turn off max-width to be able to calculate the real width + // this causes an extra browser repaint/reflow, but so be it + this.dom.content.style.maxWidth = 'none'; + } + } + } + + /** + * get DOM components sizes + * @return {object} + */ + }, { + key: "_getDomComponentsSizes", + value: function _getDomComponentsSizes() { + var sizes = { + previous: { + right: this.dom.box.style.right, + left: this.dom.box.style.left + }, + box: { + width: this.dom.box.offsetWidth, + height: this.dom.box.offsetHeight + } + }; + if (this.options.showStipes) { + sizes.dot = { + height: this.dom.dot.offsetHeight, + width: this.dom.dot.offsetWidth + }; + sizes.line = { + width: this.dom.line.offsetWidth + }; + } + return sizes; + } + + /** + * update DOM components sizes + * @param {object} sizes + */ + }, { + key: "_updateDomComponentsSizes", + value: function _updateDomComponentsSizes(sizes) { + if (this.options.rtl) { + this.dom.box.style.right = "0px"; + } else { + this.dom.box.style.left = "0px"; + } + + // recalculate size + if (!this.data.end) { + this.width = sizes.box.width; + } else { + this.minWidth = sizes.box.width; + } + this.height = sizes.box.height; + + // restore previous position + if (this.options.rtl) { + this.dom.box.style.right = sizes.previous.right; + } else { + this.dom.box.style.left = sizes.previous.left; + } + this.dirty = false; + } + + /** + * repaint DOM additional components + */ + }, { + key: "_repaintDomAdditionals", + value: function _repaintDomAdditionals() { + this._repaintOnItemUpdateTimeTooltip(this.dom.box); + } + + /** + * check is stripe visible + * @return {number} + * @private + */ + }, { + key: "_isStipeVisible", + value: function _isStipeVisible() { + return this.minWidth >= this.width || !this.data.end; + } + + /** + * get fit range + * @return {object} + * @private + */ + }, { + key: "_getFitRange", + value: function _getFitRange() { + var offset = 0.05 * (this.data.max - this.data.min) / 2; + return { + fitStart: this.data.min - offset, + fitEnd: this.data.max + offset + }; + } + + /** + * fit + * @private + */ + }, { + key: "_fit", + value: function _fit() { + if (this.emitter) { + var _this$_getFitRange = this._getFitRange(), + fitStart = _this$_getFitRange.fitStart, + fitEnd = _this$_getFitRange.fitEnd; + var fitArgs = { + start: new Date(fitStart), + end: new Date(fitEnd), + animation: true + }; + this.emitter.emit('fit', fitArgs); + } + } + + /** + * get item data + * @return {object} + * @private + */ + }, { + key: "_getItemData", + value: function _getItemData() { + return this.data; + } + }]); + return ClusterItem; + }(Item); + ClusterItem.prototype.baseClassName = 'vis-item vis-range vis-cluster'; + + function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$2(o, minLen) { var _context4; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = _sliceInstanceProperty(_context4 = Object.prototype.toString.call(o)).call(_context4, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); } + function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + var UNGROUPED$2 = '__ungrouped__'; // reserved group id for ungrouped items + var BACKGROUND$1 = '__background__'; // reserved group id for background items without group + + var ReservedGroupIds = { + UNGROUPED: UNGROUPED$2, + BACKGROUND: BACKGROUND$1 + }; + + /** + * An Cluster generator generates cluster items + */ + var ClusterGenerator = /*#__PURE__*/function () { + /** + * @param {ItemSet} itemSet itemsSet instance + * @constructor ClusterGenerator + */ + function ClusterGenerator(itemSet) { + _classCallCheck(this, ClusterGenerator); + this.itemSet = itemSet; + this.groups = {}; + this.cache = {}; + this.cache[-1] = []; + } + + /** + * @param {Object} itemData Object containing parameters start content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * @return {Object} newItem + */ + _createClass(ClusterGenerator, [{ + key: "createClusterItem", + value: function createClusterItem(itemData, conversion, options) { + var newItem = new ClusterItem(itemData, conversion, options); + return newItem; + } + + /** + * Set the items to be clustered. + * This will clear cached clusters. + * @param {Item[]} items + * @param {Object} [options] Available options: + * {boolean} applyOnChangedLevel + * If true (default), the changed data is applied + * as soon the cluster level changes. If false, + * The changed data is applied immediately + */ + }, { + key: "setItems", + value: function setItems(items, options) { + this.items = items || []; + this.dataChanged = true; + this.applyOnChangedLevel = false; + if (options && options.applyOnChangedLevel) { + this.applyOnChangedLevel = options.applyOnChangedLevel; + } + } + + /** + * Update the current data set: clear cache, and recalculate the clustering for + * the current level + */ + }, { + key: "updateData", + value: function updateData() { + this.dataChanged = true; + this.applyOnChangedLevel = false; + } + + /** + * Cluster the items which are too close together + * @param {array} oldClusters + * @param {number} scale The scale of the current window : (windowWidth / (endDate - startDate)) + * @param {{maxItems: number, clusterCriteria: function, titleTemplate: string}} options + * @return {array} clusters + */ + }, { + key: "getClusters", + value: function getClusters(oldClusters, scale, options) { + var _ref = typeof options === "boolean" ? {} : options, + maxItems = _ref.maxItems, + clusterCriteria = _ref.clusterCriteria; + if (!clusterCriteria) { + clusterCriteria = function clusterCriteria() { + return true; + }; + } + maxItems = maxItems || 1; + var level = -1; + var granularity = 2; + var timeWindow = 0; + if (scale > 0) { + if (scale >= 1) { + return []; + } + level = Math.abs(Math.round(Math.log(100 / scale) / Math.log(granularity))); + timeWindow = Math.abs(Math.pow(granularity, level)); + } + + // clear the cache when and re-generate groups the data when needed. + if (this.dataChanged) { + var levelChanged = level != this.cacheLevel; + var applyDataNow = this.applyOnChangedLevel ? levelChanged : true; + if (applyDataNow) { + this._dropLevelsCache(); + this._filterData(); + } + } + this.cacheLevel = level; + var clusters = this.cache[level]; + if (!clusters) { + clusters = []; + for (var groupName in this.groups) { + if (this.groups.hasOwnProperty(groupName)) { + var items = this.groups[groupName]; + var iMax = items.length; + var i = 0; + while (i < iMax) { + // find all items around current item, within the timeWindow + var item = items[i]; + var neighbors = 1; // start at 1, to include itself) + + // loop through items left from the current item + var j = i - 1; + while (j >= 0 && item.center - items[j].center < timeWindow / 2) { + if (!items[j].cluster && clusterCriteria(item.data, items[j].data)) { + neighbors++; + } + j--; + } + + // loop through items right from the current item + var k = i + 1; + while (k < items.length && items[k].center - item.center < timeWindow / 2) { + if (clusterCriteria(item.data, items[k].data)) { + neighbors++; + } + k++; + } + + // loop through the created clusters + var l = clusters.length - 1; + while (l >= 0 && item.center - clusters[l].center < timeWindow) { + if (item.group == clusters[l].group && clusterCriteria(item.data, clusters[l].data)) { + neighbors++; + } + l--; + } + + // aggregate until the number of items is within maxItems + if (neighbors > maxItems) { + // too busy in this window. + var num = neighbors - maxItems + 1; + var clusterItems = []; + + // append the items to the cluster, + // and calculate the average start for the cluster + var m = i; + while (clusterItems.length < num && m < items.length) { + if (clusterCriteria(items[i].data, items[m].data)) { + clusterItems.push(items[m]); + } + m++; + } + var groupId = this.itemSet.getGroupId(item.data); + var group = this.itemSet.groups[groupId] || this.itemSet.groups[ReservedGroupIds.UNGROUPED]; + var cluster = this._getClusterForItems(clusterItems, group, oldClusters, options); + clusters.push(cluster); + i += num; + } else { + delete item.cluster; + i += 1; + } + } + } + } + this.cache[level] = clusters; + } + return clusters; + } + + /** + * Filter the items per group. + * @private + */ + }, { + key: "_filterData", + value: function _filterData() { + // filter per group + var groups = {}; + this.groups = groups; + + // split the items per group + for (var _i = 0, _Object$values = _Object$values2(this.items); _i < _Object$values.length; _i++) { + var item = _Object$values[_i]; + // put the item in the correct group + var groupName = item.parent ? item.parent.groupId : ''; + var group = groups[groupName]; + if (!group) { + group = []; + groups[groupName] = group; + } + group.push(item); + + // calculate the center of the item + if (item.data.start) { + if (item.data.end) { + // range + item.center = (item.data.start.valueOf() + item.data.end.valueOf()) / 2; + } else { + // box, dot + item.center = item.data.start.valueOf(); + } + } + } + + // sort the items per group + for (var currentGroupName in groups) { + if (groups.hasOwnProperty(currentGroupName)) { + var _context; + _sortInstanceProperty(_context = groups[currentGroupName]).call(_context, function (a, b) { + return a.center - b.center; + }); + } + } + this.dataChanged = false; + } + + /** + * Create new cluster or return existing + * @private + * @param {array} clusterItems + * @param {object} group + * @param {array} oldClusters + * @param {object} options + * @returns {object} cluster + */ + }, { + key: "_getClusterForItems", + value: function _getClusterForItems(clusterItems, group, oldClusters, options) { + var _context2; + var oldClustersLookup = _mapInstanceProperty(_context2 = oldClusters || []).call(_context2, function (cluster) { + var _context3; + return { + cluster: cluster, + itemsIds: new _Set(_mapInstanceProperty(_context3 = cluster.data.uiItems).call(_context3, function (item) { + return item.id; + })) + }; + }); + var cluster; + if (oldClustersLookup.length) { + var _iterator = _createForOfIteratorHelper$2(oldClustersLookup), + _step; + try { + var _loop = function _loop() { + var oldClusterData = _step.value; + if (oldClusterData.itemsIds.size === clusterItems.length && _everyInstanceProperty(clusterItems).call(clusterItems, function (clusterItem) { + return oldClusterData.itemsIds.has(clusterItem.id); + })) { + cluster = oldClusterData.cluster; + return 1; // break + } + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + if (_loop()) break; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + if (cluster) { + cluster.setUiItems(clusterItems); + if (cluster.group !== group) { + if (cluster.group) { + cluster.group.remove(cluster); + } + if (group) { + group.add(cluster); + cluster.group = group; + } + } + return cluster; + } + var titleTemplate = options.titleTemplate || ''; + var conversion = { + toScreen: this.itemSet.body.util.toScreen, + toTime: this.itemSet.body.util.toTime + }; + var title = titleTemplate.replace(/{count}/, clusterItems.length); + var clusterContent = '

'; + var clusterOptions = _Object$assign({}, options, this.itemSet.options); + var data = { + 'content': clusterContent, + 'title': title, + 'group': group, + 'uiItems': clusterItems, + 'eventEmitter': this.itemSet.body.emitter, + 'range': this.itemSet.body.range + }; + cluster = this.createClusterItem(data, conversion, clusterOptions); + if (group) { + group.add(cluster); + cluster.group = group; + } + cluster.attach(); + return cluster; + } + + /** + * Drop cache + * @private + */ + }, { + key: "_dropLevelsCache", + value: function _dropLevelsCache() { + this.cache = {}; + this.cacheLevel = -1; + this.cache[this.cacheLevel] = []; + } + }]); + return ClusterGenerator; + }(); + + var css_248z$3 = "\n.vis-itemset {\n position: relative;\n padding: 0;\n margin: 0;\n\n box-sizing: border-box;\n}\n\n.vis-itemset .vis-background,\n.vis-itemset .vis-foreground {\n position: absolute;\n width: 100%;\n height: 100%;\n overflow: visible;\n}\n\n.vis-axis {\n position: absolute;\n width: 100%;\n height: 0;\n left: 0;\n z-index: 1;\n}\n\n.vis-foreground .vis-group {\n position: relative;\n box-sizing: border-box;\n border-bottom: 1px solid #bfbfbf;\n}\n\n.vis-foreground .vis-group:last-child {\n border-bottom: none;\n}\n\n.vis-nesting-group {\n cursor: pointer;\n}\n\n.vis-label.vis-nested-group.vis-group-level-unknown-but-gte1 {\n background: #f5f5f5;\n}\n.vis-label.vis-nested-group.vis-group-level-0 {\n background-color: #ffffff;\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-0 .vis-inner {\n padding-left: 0;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-0 .vis-inner {\n padding-right: 0;\n}\n.vis-label.vis-nested-group.vis-group-level-1 {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-1 .vis-inner {\n padding-left: 15px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-1 .vis-inner {\n padding-right: 15px;\n}\n.vis-label.vis-nested-group.vis-group-level-2 {\n background-color: rgba(0, 0, 0, 0.1);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-2 .vis-inner {\n padding-left: 30px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-2 .vis-inner {\n padding-right: 30px;\n}\n.vis-label.vis-nested-group.vis-group-level-3 {\n background-color: rgba(0, 0, 0, 0.15);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-3 .vis-inner {\n padding-left: 45px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-3 .vis-inner {\n padding-right: 45px;\n}\n.vis-label.vis-nested-group.vis-group-level-4 {\n background-color: rgba(0, 0, 0, 0.2);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-4 .vis-inner {\n padding-left: 60px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-4 .vis-inner {\n padding-right: 60px;\n}\n.vis-label.vis-nested-group.vis-group-level-5 {\n background-color: rgba(0, 0, 0, 0.25);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-5 .vis-inner {\n padding-left: 75px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-5 .vis-inner {\n padding-right: 75px;\n}\n.vis-label.vis-nested-group.vis-group-level-6 {\n background-color: rgba(0, 0, 0, 0.3);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-6 .vis-inner {\n padding-left: 90px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-6 .vis-inner {\n padding-right: 90px;\n}\n.vis-label.vis-nested-group.vis-group-level-7 {\n background-color: rgba(0, 0, 0, 0.35);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-7 .vis-inner {\n padding-left: 105px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-7 .vis-inner {\n padding-right: 105px;\n}\n.vis-label.vis-nested-group.vis-group-level-8 {\n background-color: rgba(0, 0, 0, 0.4);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-8 .vis-inner {\n padding-left: 120px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-8 .vis-inner {\n padding-right: 120px;\n}\n.vis-label.vis-nested-group.vis-group-level-9 {\n background-color: rgba(0, 0, 0, 0.45);\n}\n.vis-ltr .vis-label.vis-nested-group.vis-group-level-9 .vis-inner {\n padding-left: 135px;\n}\n.vis-rtl .vis-label.vis-nested-group.vis-group-level-9 .vis-inner {\n padding-right: 135px;\n}\n/* default takes over beginning with level-10 (thats why we add .vis-nested-group\n to the selectors above, to have higher specifity than these rules for the defaults) */\n.vis-label.vis-nested-group {\n background-color: rgba(0, 0, 0, 0.5);\n}\n.vis-ltr .vis-label.vis-nested-group .vis-inner {\n padding-left: 150px;\n}\n.vis-rtl .vis-label.vis-nested-group .vis-inner {\n padding-right: 150px;\n}\n\n.vis-group-level-unknown-but-gte1 {\n border: 1px solid red;\n}\n\n/* expanded/collapsed indicators */\n.vis-label.vis-nesting-group:before,\n.vis-label.vis-nesting-group:before {\n display: inline-block;\n width: 15px;\n}\n.vis-label.vis-nesting-group.expanded:before {\n content: \"\\25BC\";\n}\n.vis-label.vis-nesting-group.collapsed:before {\n content: \"\\25B6\";\n}\n.vis-rtl .vis-label.vis-nesting-group.collapsed:before {\n content: \"\\25C0\";\n}\n/* compensate missing expanded/collapsed indicator, but only at levels > 0 */\n.vis-ltr .vis-label:not(.vis-nesting-group):not(.vis-group-level-0) {\n padding-left: 15px;\n}\n.vis-rtl .vis-label:not(.vis-nesting-group):not(.vis-group-level-0) {\n padding-right: 15px;\n}\n\n.vis-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}"; + styleInject(css_248z$3); + + var css_248z$2 = "\n.vis-labelset {\n position: relative;\n\n overflow: hidden;\n\n box-sizing: border-box;\n}\n\n.vis-labelset .vis-label {\n position: relative;\n left: 0;\n top: 0;\n width: 100%;\n color: #4d4d4d;\n\n box-sizing: border-box;\n}\n\n.vis-labelset .vis-label {\n border-bottom: 1px solid #bfbfbf;\n}\n\n.vis-labelset .vis-label.draggable {\n cursor: pointer;\n}\n\n.vis-group-is-dragging {\n background: rgba(0, 0, 0, .1);\n}\n\n.vis-labelset .vis-label:last-child {\n border-bottom: none;\n}\n\n.vis-labelset .vis-label .vis-inner {\n display: inline-block;\n padding: 5px;\n}\n\n.vis-labelset .vis-label .vis-inner.vis-hidden {\n padding: 0;\n}\n"; + styleInject(css_248z$2); + + function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray$1(o, minLen) { var _context34; if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = _sliceInstanceProperty(_context34 = Object.prototype.toString.call(o)).call(_context34, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } + function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + var UNGROUPED$1 = '__ungrouped__'; // reserved group id for ungrouped items + var BACKGROUND = '__background__'; // reserved group id for background items without group + + /** + * An ItemSet holds a set of items and ranges which can be displayed in a + * range. The width is determined by the parent of the ItemSet, and the height + * is determined by the size of the items. + */ + var ItemSet = /*#__PURE__*/function (_Component) { + _inherits(ItemSet, _Component); + var _super = _createSuper$2(ItemSet); + /** + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See ItemSet.setOptions for the available options. + * @constructor ItemSet + * @extends Component + */ + function ItemSet(body, options) { + var _this; + _classCallCheck(this, ItemSet); + _this = _super.call(this); + _this.body = body; + _this.defaultOptions = { + type: null, + // 'box', 'point', 'range', 'background' + orientation: { + item: 'bottom' // item orientation: 'top' or 'bottom' + }, + + align: 'auto', + // alignment of box items + stack: true, + stackSubgroups: true, + groupOrderSwap: function groupOrderSwap(fromGroup, toGroup, groups) { + // eslint-disable-line no-unused-vars + var targetOrder = toGroup.order; + toGroup.order = fromGroup.order; + fromGroup.order = targetOrder; + }, + groupOrder: 'order', + selectable: true, + multiselect: false, + longSelectPressTime: 251, + itemsAlwaysDraggable: { + item: false, + range: false + }, + editable: { + updateTime: false, + updateGroup: false, + add: false, + remove: false, + overrideItems: false + }, + groupEditable: { + order: false, + add: false, + remove: false + }, + snap: TimeStep.snap, + // Only called when `objectData.target === 'item'. + onDropObjectOnItem: function onDropObjectOnItem(objectData, item, callback) { + callback(item); + }, + onAdd: function onAdd(item, callback) { + callback(item); + }, + onUpdate: function onUpdate(item, callback) { + callback(item); + }, + onMove: function onMove(item, callback) { + callback(item); + }, + onRemove: function onRemove(item, callback) { + callback(item); + }, + onMoving: function onMoving(item, callback) { + callback(item); + }, + onAddGroup: function onAddGroup(item, callback) { + callback(item); + }, + onMoveGroup: function onMoveGroup(item, callback) { + callback(item); + }, + onRemoveGroup: function onRemoveGroup(item, callback) { + callback(item); + }, + margin: { + item: { + horizontal: 10, + vertical: 10 + }, + axis: 20 + }, + showTooltips: true, + tooltip: { + followMouse: false, + overflowMethod: 'flip', + delay: 500 + }, + tooltipOnItemUpdateTime: false + }; + + // options is shared by this ItemSet and all its items + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.options.rtl = options.rtl; + _this.options.onTimeout = options.onTimeout; + _this.conversion = { + toScreen: body.util.toScreen, + toTime: body.util.toTime + }; + _this.dom = {}; + _this.props = {}; + _this.hammer = null; + var me = _assertThisInitialized(_this); + _this.itemsData = null; // DataSet + _this.groupsData = null; // DataSet + _this.itemsSettingTime = null; + _this.initialItemSetDrawn = false; + _this.userContinueNotBail = null; + _this.sequentialSelection = false; + + // listeners for the DataSet of the items + _this.itemListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAdd(params.items); + if (me.options.cluster) { + me.clusterGenerator.setItems(me.items, { + applyOnChangedLevel: false + }); + } + me.redraw(); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdate(params.items); + if (me.options.cluster) { + me.clusterGenerator.setItems(me.items, { + applyOnChangedLevel: false + }); + } + me.redraw(); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemove(params.items); + if (me.options.cluster) { + me.clusterGenerator.setItems(me.items, { + applyOnChangedLevel: false + }); + } + me.redraw(); + } + }; + + // listeners for the DataSet of the groups + _this.groupListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAddGroups(params.items); + if (me.groupsData && me.groupsData.length > 0) { + var _context; + var groupsData = me.groupsData.getDataSet(); + _forEachInstanceProperty(_context = groupsData.get()).call(_context, function (groupData) { + if (groupData.nestedGroups) { + var _context2; + if (groupData.showNested != false) { + groupData.showNested = true; + } + var updatedGroups = []; + _forEachInstanceProperty(_context2 = groupData.nestedGroups).call(_context2, function (nestedGroupId) { + var updatedNestedGroup = groupsData.get(nestedGroupId); + if (!updatedNestedGroup) { + return; + } + updatedNestedGroup.nestedInGroup = groupData.id; + if (groupData.showNested == false) { + updatedNestedGroup.visible = false; + } + updatedGroups = _concatInstanceProperty(updatedGroups).call(updatedGroups, updatedNestedGroup); + }); + groupsData.update(updatedGroups, senderId); + } + }); + } + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdateGroups(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemoveGroups(params.items); + } + }; + _this.items = {}; // object with an Item for every data item + _this.groups = {}; // Group object for every group + _this.groupIds = []; + _this.selection = []; // list with the ids of all selected nodes + + _this.popup = null; + _this.popupTimer = null; + _this.touchParams = {}; // stores properties while dragging + _this.groupTouchParams = { + group: null, + isDragging: false + }; + + // create the HTML DOM + _this._create(); + _this.setOptions(options); + _this.clusters = []; + return _this; + } + + /** + * Create the HTML DOM for the ItemSet + */ + _createClass(ItemSet, [{ + key: "_create", + value: function _create() { + var _this2 = this, + _context3, + _context4, + _context5, + _context6, + _context7, + _context8, + _context9, + _context10, + _context11, + _context12, + _context13, + _context14, + _context15, + _context16, + _context17; + var frame = document.createElement('div'); + frame.className = 'vis-itemset'; + frame['vis-itemset'] = this; + this.dom.frame = frame; + + // create background panel + var background = document.createElement('div'); + background.className = 'vis-background'; + frame.appendChild(background); + this.dom.background = background; + + // create foreground panel + var foreground = document.createElement('div'); + foreground.className = 'vis-foreground'; + frame.appendChild(foreground); + this.dom.foreground = foreground; + + // create axis panel + var axis = document.createElement('div'); + axis.className = 'vis-axis'; + this.dom.axis = axis; + + // create labelset + var labelSet = document.createElement('div'); + labelSet.className = 'vis-labelset'; + this.dom.labelSet = labelSet; + + // create ungrouped Group + this._updateUngrouped(); + + // create background Group + var backgroundGroup = new BackgroundGroup(BACKGROUND, null, this); + backgroundGroup.show(); + this.groups[BACKGROUND] = backgroundGroup; + + // attach event listeners + // Note: we bind to the centerContainer for the case where the height + // of the center container is larger than of the ItemSet, so we + // can click in the empty area to create a new item or deselect an item. + this.hammer = new Hammer(this.body.dom.centerContainer); + + // drag items when selected + this.hammer.on('hammer.input', function (event) { + if (event.isFirst) { + _this2._onTouch(event); + } + }); + this.hammer.on('panstart', _bindInstanceProperty$1(_context3 = this._onDragStart).call(_context3, this)); + this.hammer.on('panmove', _bindInstanceProperty$1(_context4 = this._onDrag).call(_context4, this)); + this.hammer.on('panend', _bindInstanceProperty$1(_context5 = this._onDragEnd).call(_context5, this)); + this.hammer.get('pan').set({ + threshold: 5, + direction: Hammer.ALL + }); + // delay addition on item click for trackpads... + this.hammer.get('press').set({ + time: 10000 + }); + + // single select (or unselect) when tapping an item + this.hammer.on('tap', _bindInstanceProperty$1(_context6 = this._onSelectItem).call(_context6, this)); + + // multi select when holding mouse/touch, or on ctrl+click + this.hammer.on('press', _bindInstanceProperty$1(_context7 = this._onMultiSelectItem).call(_context7, this)); + // delay addition on item click for trackpads... + this.hammer.get('press').set({ + time: 10000 + }); + + // add item on doubletap + this.hammer.on('doubletap', _bindInstanceProperty$1(_context8 = this._onAddItem).call(_context8, this)); + if (this.options.rtl) { + this.groupHammer = new Hammer(this.body.dom.rightContainer); + } else { + this.groupHammer = new Hammer(this.body.dom.leftContainer); + } + this.groupHammer.on('tap', _bindInstanceProperty$1(_context9 = this._onGroupClick).call(_context9, this)); + this.groupHammer.on('panstart', _bindInstanceProperty$1(_context10 = this._onGroupDragStart).call(_context10, this)); + this.groupHammer.on('panmove', _bindInstanceProperty$1(_context11 = this._onGroupDrag).call(_context11, this)); + this.groupHammer.on('panend', _bindInstanceProperty$1(_context12 = this._onGroupDragEnd).call(_context12, this)); + this.groupHammer.get('pan').set({ + threshold: 5, + direction: Hammer.DIRECTION_VERTICAL + }); + this.body.dom.centerContainer.addEventListener('mouseover', _bindInstanceProperty$1(_context13 = this._onMouseOver).call(_context13, this)); + this.body.dom.centerContainer.addEventListener('mouseout', _bindInstanceProperty$1(_context14 = this._onMouseOut).call(_context14, this)); + this.body.dom.centerContainer.addEventListener('mousemove', _bindInstanceProperty$1(_context15 = this._onMouseMove).call(_context15, this)); + // right-click on timeline + this.body.dom.centerContainer.addEventListener('contextmenu', _bindInstanceProperty$1(_context16 = this._onDragEnd).call(_context16, this)); + this.body.dom.centerContainer.addEventListener('mousewheel', _bindInstanceProperty$1(_context17 = this._onMouseWheel).call(_context17, this)); + + // attach to the DOM + this.show(); + } + + /** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * {string} type + * Default type for the items. Choose from 'box' + * (default), 'point', 'range', or 'background'. + * The default style can be overwritten by + * individual items. + * {string} align + * Alignment for the items, only applicable for + * BoxItem. Choose 'center' (default), 'left', or + * 'right'. + * {string} orientation.item + * Orientation of the item set. Choose 'top' or + * 'bottom' (default). + * {Function} groupOrder + * A sorting function for ordering groups + * {boolean} stack + * If true (default), items will be stacked on + * top of each other. + * {number} margin.axis + * Margin between the axis and the items in pixels. + * Default is 20. + * {number} margin.item.horizontal + * Horizontal margin between items in pixels. + * Default is 10. + * {number} margin.item.vertical + * Vertical Margin between items in pixels. + * Default is 10. + * {number} margin.item + * Margin between items in pixels in both horizontal + * and vertical direction. Default is 10. + * {number} margin + * Set margin for both axis and items in pixels. + * {boolean} selectable + * If true (default), items can be selected. + * {boolean} multiselect + * If true, multiple items can be selected. + * False by default. + * {boolean} editable + * Set all editable options to true or false + * {boolean} editable.updateTime + * Allow dragging an item to an other moment in time + * {boolean} editable.updateGroup + * Allow dragging an item to an other group + * {boolean} editable.add + * Allow creating new items on double tap + * {boolean} editable.remove + * Allow removing items by clicking the delete button + * top right of a selected item. + * {Function(item: Item, callback: Function)} onAdd + * Callback function triggered when an item is about to be added: + * when the user double taps an empty space in the Timeline. + * {Function(item: Item, callback: Function)} onUpdate + * Callback function fired when an item is about to be updated. + * This function typically has to show a dialog where the user + * change the item. If not implemented, nothing happens. + * {Function(item: Item, callback: Function)} onMove + * Fired when an item has been moved. If not implemented, + * the move action will be accepted. + * {Function(item: Item, callback: Function)} onRemove + * Fired when an item is about to be deleted. + * If not implemented, the item will be always removed. + */ + }, { + key: "setOptions", + value: function setOptions(options) { + var _this3 = this; + if (options) { + var _context18, _context20; + // copy all options that we know + var fields = ['type', 'rtl', 'align', 'order', 'stack', 'stackSubgroups', 'selectable', 'multiselect', 'sequentialSelection', 'multiselectPerGroup', 'longSelectPressTime', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'visibleFrameTemplate', 'hide', 'snap', 'groupOrderSwap', 'showTooltips', 'tooltip', 'tooltipOnItemUpdateTime', 'groupHeightMode', 'onTimeout']; + availableUtils.selectiveExtend(fields, this.options, options); + if ('itemsAlwaysDraggable' in options) { + if (typeof options.itemsAlwaysDraggable === 'boolean') { + this.options.itemsAlwaysDraggable.item = options.itemsAlwaysDraggable; + this.options.itemsAlwaysDraggable.range = false; + } else if (_typeof$1(options.itemsAlwaysDraggable) === 'object') { + availableUtils.selectiveExtend(['item', 'range'], this.options.itemsAlwaysDraggable, options.itemsAlwaysDraggable); + // only allow range always draggable when item is always draggable as well + if (!this.options.itemsAlwaysDraggable.item) { + this.options.itemsAlwaysDraggable.range = false; + } + } + } + if ('sequentialSelection' in options) { + if (typeof options.sequentialSelection === 'boolean') { + this.options.sequentialSelection = options.sequentialSelection; + } + } + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation.item = options.orientation === 'top' ? 'top' : 'bottom'; + } else if (_typeof$1(options.orientation) === 'object' && 'item' in options.orientation) { + this.options.orientation.item = options.orientation.item; + } + } + if ('margin' in options) { + if (typeof options.margin === 'number') { + this.options.margin.axis = options.margin; + this.options.margin.item.horizontal = options.margin; + this.options.margin.item.vertical = options.margin; + } else if (_typeof$1(options.margin) === 'object') { + availableUtils.selectiveExtend(['axis'], this.options.margin, options.margin); + if ('item' in options.margin) { + if (typeof options.margin.item === 'number') { + this.options.margin.item.horizontal = options.margin.item; + this.options.margin.item.vertical = options.margin.item; + } else if (_typeof$1(options.margin.item) === 'object') { + availableUtils.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); + } + } + } + } + _forEachInstanceProperty(_context18 = ['locale', 'locales']).call(_context18, function (key) { + if (key in options) { + _this3.options[key] = options[key]; + } + }); + if ('editable' in options) { + if (typeof options.editable === 'boolean') { + this.options.editable.updateTime = options.editable; + this.options.editable.updateGroup = options.editable; + this.options.editable.add = options.editable; + this.options.editable.remove = options.editable; + this.options.editable.overrideItems = false; + } else if (_typeof$1(options.editable) === 'object') { + availableUtils.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove', 'overrideItems'], this.options.editable, options.editable); + } + } + if ('groupEditable' in options) { + if (typeof options.groupEditable === 'boolean') { + this.options.groupEditable.order = options.groupEditable; + this.options.groupEditable.add = options.groupEditable; + this.options.groupEditable.remove = options.groupEditable; + } else if (_typeof$1(options.groupEditable) === 'object') { + availableUtils.selectiveExtend(['order', 'add', 'remove'], this.options.groupEditable, options.groupEditable); + } + } + + // callback functions + var addCallback = function addCallback(name) { + var fn = options[name]; + if (fn) { + if (!(typeof fn === 'function')) { + var _context19; + throw new Error(_concatInstanceProperty(_context19 = "option ".concat(name, " must be a function ")).call(_context19, name, "(item, callback)")); + } + _this3.options[name] = fn; + } + }; + _forEachInstanceProperty(_context20 = ['onDropObjectOnItem', 'onAdd', 'onUpdate', 'onRemove', 'onMove', 'onMoving', 'onAddGroup', 'onMoveGroup', 'onRemoveGroup']).call(_context20, addCallback); + if (options.cluster) { + _Object$assign(this.options, { + cluster: options.cluster + }); + if (!this.clusterGenerator) { + this.clusterGenerator = new ClusterGenerator(this); + } + this.clusterGenerator.setItems(this.items, { + applyOnChangedLevel: false + }); + this.markDirty({ + refreshItems: true, + restackGroups: true + }); + this.redraw(); + } else if (this.clusterGenerator) { + this._detachAllClusters(); + this.clusters = []; + this.clusterGenerator = null; + this.options.cluster = undefined; + this.markDirty({ + refreshItems: true, + restackGroups: true + }); + this.redraw(); + } else { + // force the itemSet to refresh: options like orientation and margins may be changed + this.markDirty(); + } + } + } + + /** + * Mark the ItemSet dirty so it will refresh everything with next redraw. + * Optionally, all items can be marked as dirty and be refreshed. + * @param {{refreshItems: boolean}} [options] + */ + }, { + key: "markDirty", + value: function markDirty(options) { + this.groupIds = []; + if (options) { + if (options.refreshItems) { + _forEachInstanceProperty(availableUtils).call(availableUtils, this.items, function (item) { + item.dirty = true; + if (item.displayed) item.redraw(); + }); + } + if (options.restackGroups) { + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groups, function (group, key) { + if (key === BACKGROUND) return; + group.stackDirty = true; + }); + } + } + } + + /** + * Destroy the ItemSet + */ + }, { + key: "destroy", + value: function destroy() { + this.clearPopupTimer(); + this.hide(); + this.setItems(null); + this.setGroups(null); + this.hammer && this.hammer.destroy(); + this.groupHammer && this.groupHammer.destroy(); + this.hammer = null; + this.body = null; + this.conversion = null; + } + + /** + * Hide the component from the DOM + */ + }, { + key: "hide", + value: function hide() { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + + // remove the axis with dots + if (this.dom.axis.parentNode) { + this.dom.axis.parentNode.removeChild(this.dom.axis); + } + + // remove the labelset containing all group labels + if (this.dom.labelSet.parentNode) { + this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); + } + } + + /** + * Show the component in the DOM (when not already visible). + */ + }, { + key: "show", + value: function show() { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + + // show axis with dots + if (!this.dom.axis.parentNode) { + this.body.dom.backgroundVertical.appendChild(this.dom.axis); + } + + // show labelset containing labels + if (!this.dom.labelSet.parentNode) { + if (this.options.rtl) { + this.body.dom.right.appendChild(this.dom.labelSet); + } else { + this.body.dom.left.appendChild(this.dom.labelSet); + } + } + } + + /** + * Activates the popup timer to show the given popup after a fixed time. + * @param {Popup} popup + */ + }, { + key: "setPopupTimer", + value: function setPopupTimer(popup) { + this.clearPopupTimer(); + if (popup) { + var delay = this.options.tooltip.delay || typeof this.options.tooltip.delay === 'number' ? this.options.tooltip.delay : 500; + this.popupTimer = _setTimeout(function () { + popup.show(); + }, delay); + } + } + + /** + * Clears the popup timer for the tooltip. + */ + }, { + key: "clearPopupTimer", + value: function clearPopupTimer() { + if (this.popupTimer != null) { + clearTimeout(this.popupTimer); + this.popupTimer = null; + } + } + + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {string[] | string} [ids] An array with zero or more id's of the items to be + * selected, or a single item id. If ids is undefined + * or an empty array, all items will be unselected. + */ + }, { + key: "setSelection", + value: function setSelection(ids) { + var _context21; + if (ids == undefined) { + ids = []; + } + if (!_Array$isArray(ids)) { + ids = [ids]; + } + var idsToDeselect = _filterInstanceProperty(_context21 = this.selection).call(_context21, function (id) { + return _indexOfInstanceProperty(ids).call(ids, id) === -1; + }); + + // unselect currently selected items + var _iterator = _createForOfIteratorHelper$1(idsToDeselect), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var selectedId = _step.value; + var item = this.getItemById(selectedId); + if (item) { + item.unselect(); + } + } + + // select items + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + this.selection = _toConsumableArray(ids); + var _iterator2 = _createForOfIteratorHelper$1(ids), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var id = _step2.value; + var _item2 = this.getItemById(id); + if (_item2) { + _item2.select(); + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + }, { + key: "getSelection", + value: function getSelection() { + var _context22; + return _concatInstanceProperty(_context22 = this.selection).call(_context22, []); + } + + /** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ + }, { + key: "getVisibleItems", + value: function getVisibleItems() { + var range = this.body.range.getRange(); + var right; + var left; + if (this.options.rtl) { + right = this.body.util.toScreen(range.start); + left = this.body.util.toScreen(range.end); + } else { + left = this.body.util.toScreen(range.start); + right = this.body.util.toScreen(range.end); + } + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.isVisible ? group.visibleItems : []; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + var _iterator3 = _createForOfIteratorHelper$1(rawVisibleItems), + _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var item = _step3.value; + // TODO: also check whether visible vertically + if (this.options.rtl) { + if (item.right < left && item.right + item.width > right) { + ids.push(item.id); + } + } else { + if (item.left < right && item.left + item.width > left) { + ids.push(item.id); + } + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } + } + return ids; + } + + /** + * Get the id's of the items at specific time, where a click takes place on the timeline. + * @returns {Array} The ids of all items in existence at the time of click event on the timeline. + */ + }, { + key: "getItemsAtCurrentTime", + value: function getItemsAtCurrentTime(timeOfEvent) { + var right; + var left; + if (this.options.rtl) { + right = this.body.util.toScreen(timeOfEvent); + left = this.body.util.toScreen(timeOfEvent); + } else { + left = this.body.util.toScreen(timeOfEvent); + right = this.body.util.toScreen(timeOfEvent); + } + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.isVisible ? group.visibleItems : []; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + var _iterator4 = _createForOfIteratorHelper$1(rawVisibleItems), + _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var item = _step4.value; + if (this.options.rtl) { + if (item.right < left && item.right + item.width > right) { + ids.push(item.id); + } + } else { + if (item.left < right && item.left + item.width > left) { + ids.push(item.id); + } + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } + } + return ids; + } + + /** + * Get the id's of the currently visible groups. + * @returns {Array} The ids of the visible groups + */ + }, { + key: "getVisibleGroups", + value: function getVisibleGroups() { + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + if (group.isVisible) { + ids.push(groupId); + } + } + } + return ids; + } + + /** + * get item by id + * @param {string} id + * @return {object} item + */ + }, { + key: "getItemById", + value: function getItemById(id) { + var _context23; + return this.items[id] || _findInstanceProperty(_context23 = this.clusters).call(_context23, function (cluster) { + return cluster.id === id; + }); + } + + /** + * Deselect a selected item + * @param {string | number} id + * @private + */ + }, { + key: "_deselect", + value: function _deselect(id) { + var selection = this.selection; + for (var i = 0, ii = selection.length; i < ii; i++) { + if (selection[i] == id) { + // non-strict comparison! + _spliceInstanceProperty(selection).call(selection, i, 1); + break; + } + } + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + var margin = this.options.margin; + var range = this.body.range; + var asSize = availableUtils.option.asSize; + var options = this.options; + var orientation = options.orientation.item; + var resized = false; + var frame = this.dom.frame; + + // recalculate absolute position (before redrawing groups) + this.props.top = this.body.domProps.top.height + this.body.domProps.border.top; + if (this.options.rtl) { + this.props.right = this.body.domProps.right.width + this.body.domProps.border.right; + } else { + this.props.left = this.body.domProps.left.width + this.body.domProps.border.left; + } + + // update class name + frame.className = 'vis-itemset'; + if (this.options.cluster) { + this._clusterItems(); + } + + // reorder the groups (if needed) + resized = this._orderGroups() || resized; + + // check whether zoomed (in that case we need to re-stack everything) + // TODO: would be nicer to get this as a trigger from Range + var visibleInterval = range.end - range.start; + var zoomed = visibleInterval != this.lastVisibleInterval || this.props.width != this.props.lastWidth; + var scrolled = range.start != this.lastRangeStart; + var changedStackOption = options.stack != this.lastStack; + var changedStackSubgroupsOption = options.stackSubgroups != this.lastStackSubgroups; + var forceRestack = zoomed || scrolled || changedStackOption || changedStackSubgroupsOption; + this.lastVisibleInterval = visibleInterval; + this.lastRangeStart = range.start; + this.lastStack = options.stack; + this.lastStackSubgroups = options.stackSubgroups; + this.props.lastWidth = this.props.width; + var firstGroup = this._firstGroup(); + var firstMargin = { + item: margin.item, + axis: margin.axis + }; + var nonFirstMargin = { + item: margin.item, + axis: margin.item.vertical / 2 + }; + var height = 0; + var minHeight = margin.axis + margin.item.vertical; + + // redraw the background group + this.groups[BACKGROUND].redraw(range, nonFirstMargin, forceRestack); + var redrawQueue = {}; + var redrawQueueLength = 0; + + // collect redraw functions + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groups, function (group, key) { + if (key === BACKGROUND) return; + var groupMargin = group == firstGroup ? firstMargin : nonFirstMargin; + var returnQueue = true; + redrawQueue[key] = group.redraw(range, groupMargin, forceRestack, returnQueue); + redrawQueueLength = redrawQueue[key].length; + }); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + var redrawResults = {}; + var _loop = function _loop(i) { + _forEachInstanceProperty(availableUtils).call(availableUtils, redrawQueue, function (fns, key) { + redrawResults[key] = fns[i](); + }); + }; + for (var i = 0; i < redrawQueueLength; i++) { + _loop(i); + } + + // redraw all regular groups + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groups, function (group, key) { + if (key === BACKGROUND) return; + var groupResized = redrawResults[key]; + resized = groupResized || resized; + height += group.height; + }); + height = Math.max(height, minHeight); + } + height = Math.max(height, minHeight); + + // update frame height + frame.style.height = asSize(height); + + // calculate actual size + this.props.width = frame.offsetWidth; + this.props.height = height; + + // reposition axis + this.dom.axis.style.top = asSize(orientation == 'top' ? this.body.domProps.top.height + this.body.domProps.border.top : this.body.domProps.top.height + this.body.domProps.centerContainer.height); + if (this.options.rtl) { + this.dom.axis.style.right = '0'; + } else { + this.dom.axis.style.left = '0'; + } + this.hammer.get('press').set({ + time: this.options.longSelectPressTime + }); + this.initialItemSetDrawn = true; + // check if this component is resized + resized = this._isResized() || resized; + return resized; + } + + /** + * Get the first group, aligned with the axis + * @return {Group | null} firstGroup + * @private + */ + }, { + key: "_firstGroup", + value: function _firstGroup() { + var firstGroupIndex = this.options.orientation.item == 'top' ? 0 : this.groupIds.length - 1; + var firstGroupId = this.groupIds[firstGroupIndex]; + var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED$1]; + return firstGroup || null; + } + + /** + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. + * @protected + */ + }, { + key: "_updateUngrouped", + value: function _updateUngrouped() { + var ungrouped = this.groups[UNGROUPED$1]; + var item; + var itemId; + if (this.groupsData) { + // remove the group holding all ungrouped items + if (ungrouped) { + ungrouped.dispose(); + delete this.groups[UNGROUPED$1]; + for (itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + item = this.items[itemId]; + item.parent && item.parent.remove(item); + var groupId = this.getGroupId(item.data); + var group = this.groups[groupId]; + group && group.add(item) || item.hide(); + } + } + } + } else { + // create a group holding all (unfiltered) items + if (!ungrouped) { + var id = null; + var data = null; + ungrouped = new Group(id, data, this); + this.groups[UNGROUPED$1] = ungrouped; + for (itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + item = this.items[itemId]; + ungrouped.add(item); + } + } + ungrouped.show(); + } + } + } + + /** + * Get the element for the labelset + * @return {HTMLElement} labelSet + */ + }, { + key: "getLabelSet", + value: function getLabelSet() { + return this.dom.labelSet; + } + + /** + * Set items + * @param {vis.DataSet | null} items + */ + }, { + key: "setItems", + value: function setItems(items) { + this.itemsSettingTime = new Date(); + var me = this; + var ids; + var oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } else if (isDataViewLike(items)) { + this.itemsData = typeCoerceDataSet(items); + } else { + throw new TypeError('Data must implement the interface of DataSet or DataView'); + } + if (oldItemsData) { + // unsubscribe from old dataset + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); + + // stop maintaining a coerced version of the old data set + oldItemsData.dispose(); + + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + + // update the group holding all ungrouped items + this._updateUngrouped(); + } + this.body.emitter.emit('_change', { + queue: true + }); + } + + /** + * Get the current items + * @returns {vis.DataSet | null} + */ + }, { + key: "getItems", + value: function getItems() { + return this.itemsData != null ? this.itemsData.rawDS : null; + } + + /** + * Set groups + * @param {vis.DataSet} groups + */ + }, { + key: "setGroups", + value: function setGroups(groups) { + var me = this; + var ids; + + // unsubscribe from current dataset + if (this.groupsData) { + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groupListeners, function (callback, event) { + me.groupsData.off(event, callback); + }); + + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw + } + + // replace the dataset + if (!groups) { + this.groupsData = null; + } else if (isDataViewLike(groups)) { + this.groupsData = groups; + } else { + throw new TypeError('Data must implement the interface of DataSet or DataView'); + } + if (this.groupsData) { + var _context24; + // go over all groups nesting + var groupsData = this.groupsData.getDataSet(); + _forEachInstanceProperty(_context24 = groupsData.get()).call(_context24, function (group) { + if (group.nestedGroups) { + var _context25; + _forEachInstanceProperty(_context25 = group.nestedGroups).call(_context25, function (nestedGroupId) { + var updatedNestedGroup = groupsData.get(nestedGroupId); + updatedNestedGroup.nestedInGroup = group.id; + if (group.showNested == false) { + updatedNestedGroup.visible = false; + } + groupsData.update(updatedNestedGroup); + }); + } + }); + + // subscribe to new dataset + var id = this.id; + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); + + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } + + // update the group holding all ungrouped items + this._updateUngrouped(); + + // update the order of all items in each group + this._order(); + if (this.options.cluster) { + this.clusterGenerator.updateData(); + this._clusterItems(); + this.markDirty({ + refreshItems: true, + restackGroups: true + }); + } + this.body.emitter.emit('_change', { + queue: true + }); + } + + /** + * Get the current groups + * @returns {vis.DataSet | null} groups + */ + }, { + key: "getGroups", + value: function getGroups() { + return this.groupsData; + } + + /** + * Remove an item by its id + * @param {string | number} id + */ + }, { + key: "removeItem", + value: function removeItem(id) { + var _this4 = this; + var item = this.itemsData.get(id); + if (item) { + // confirm deletion + this.options.onRemove(item, function (item) { + if (item) { + // remove by id here, it is possible that an item has no id defined + // itself, so better not delete by the item itself + _this4.itemsData.remove(id); + } + }); + } + } + + /** + * Get the time of an item based on it's data and options.type + * @param {Object} itemData + * @returns {string} Returns the type + * @private + */ + }, { + key: "_getType", + value: function _getType(itemData) { + return itemData.type || this.options.type || (itemData.end ? 'range' : 'box'); + } + + /** + * Get the group id for an item + * @param {Object} itemData + * @returns {string} Returns the groupId + * @private + */ + }, { + key: "getGroupId", + value: function getGroupId(itemData) { + var type = this._getType(itemData); + if (type == 'background' && itemData.group == undefined) { + return BACKGROUND; + } else { + return this.groupsData ? itemData.group : UNGROUPED$1; + } + } + + /** + * Handle updated items + * @param {number[]} ids + * @protected + */ + }, { + key: "_onUpdate", + value: function _onUpdate(ids) { + var _this5 = this; + var me = this; + _forEachInstanceProperty(ids).call(ids, function (id) { + var itemData = me.itemsData.get(id); + var item = me.items[id]; + var type = itemData ? me._getType(itemData) : null; + var constructor = ItemSet.types[type]; + var selected; + if (item) { + // update item + if (!constructor || !(item instanceof constructor)) { + // item type has changed, delete the item and recreate it + selected = item.selected; // preserve selection of this item + me._removeItem(item); + item = null; + } else { + me._updateItem(item, itemData); + } + } + if (!item && itemData) { + // create item + if (constructor) { + item = new constructor(itemData, me.conversion, me.options); + item.id = id; // TODO: not so nice setting id afterwards + + me._addItem(item); + if (selected) { + _this5.selection.push(id); + item.select(); + } + } else { + throw new TypeError("Unknown item type \"".concat(type, "\"")); + } + } + }); + this._order(); + if (this.options.cluster) { + this.clusterGenerator.setItems(this.items, { + applyOnChangedLevel: false + }); + this._clusterItems(); + } + this.body.emitter.emit('_change', { + queue: true + }); + } + + /** + * Handle removed items + * @param {number[]} ids + * @protected + */ + }, { + key: "_onRemove", + value: function _onRemove(ids) { + var count = 0; + var me = this; + _forEachInstanceProperty(ids).call(ids, function (id) { + var item = me.items[id]; + if (item) { + count++; + me._removeItem(item); + } + }); + if (count) { + // update order + this._order(); + this.body.emitter.emit('_change', { + queue: true + }); + } + } + + /** + * Update the order of item in all groups + * @private + */ + }, { + key: "_order", + value: function _order() { + // reorder the items in all groups + // TODO: optimization: only reorder groups affected by the changed items + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groups, function (group) { + group.order(); + }); + } + + /** + * Handle updated groups + * @param {number[]} ids + * @private + */ + }, { + key: "_onUpdateGroups", + value: function _onUpdateGroups(ids) { + this._onAddGroups(ids); + } + + /** + * Handle changed groups (added or updated) + * @param {number[]} ids + * @private + */ + }, { + key: "_onAddGroups", + value: function _onAddGroups(ids) { + var me = this; + _forEachInstanceProperty(ids).call(ids, function (id) { + var groupData = me.groupsData.get(id); + var group = me.groups[id]; + if (!group) { + // check for reserved ids + if (id == UNGROUPED$1 || id == BACKGROUND) { + throw new Error("Illegal group id. ".concat(id, " is a reserved id.")); + } + var groupOptions = _Object$create$1(me.options); + availableUtils.extend(groupOptions, { + height: null + }); + group = new Group(id, groupData, me); + me.groups[id] = group; + + // add items with this groupId to the new group + for (var itemId in me.items) { + if (me.items.hasOwnProperty(itemId)) { + var item = me.items[itemId]; + if (item.data.group == id) { + group.add(item); + } + } + } + group.order(); + group.show(); + } else { + // update group + group.setData(groupData); + } + }); + this.body.emitter.emit('_change', { + queue: true + }); + } + + /** + * Handle removed groups + * @param {number[]} ids + * @private + */ + }, { + key: "_onRemoveGroups", + value: function _onRemoveGroups(ids) { + var _this6 = this; + _forEachInstanceProperty(ids).call(ids, function (id) { + var group = _this6.groups[id]; + if (group) { + group.dispose(); + delete _this6.groups[id]; + } + }); + if (this.options.cluster) { + this.clusterGenerator.updateData(); + this._clusterItems(); + } + this.markDirty({ + restackGroups: !!this.options.cluster + }); + this.body.emitter.emit('_change', { + queue: true + }); + } + + /** + * Reorder the groups if needed + * @return {boolean} changed + * @private + */ + }, { + key: "_orderGroups", + value: function _orderGroups() { + if (this.groupsData) { + // reorder the groups + var groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); + groupIds = this._orderNestedGroups(groupIds); + var changed = !availableUtils.equalArray(groupIds, this.groupIds); + if (changed) { + // hide all groups, removes them from the DOM + var groups = this.groups; + _forEachInstanceProperty(groupIds).call(groupIds, function (groupId) { + groups[groupId].hide(); + }); + + // show the groups again, attach them to the DOM in correct order + _forEachInstanceProperty(groupIds).call(groupIds, function (groupId) { + groups[groupId].show(); + }); + this.groupIds = groupIds; + } + return changed; + } else { + return false; + } + } + + /** + * Reorder the nested groups + * + * @param {Array.} groupIds + * @returns {Array.} + * @private + */ + }, { + key: "_orderNestedGroups", + value: function _orderNestedGroups(groupIds) { + var _this7 = this; + /** + * Recursively order nested groups + * + * @param {ItemSet} t + * @param {Array.} groupIds + * @returns {Array.} + * @private + */ + function getOrderedNestedGroups(t, groupIds) { + var result = []; + _forEachInstanceProperty(groupIds).call(groupIds, function (groupId) { + result.push(groupId); + var groupData = t.groupsData.get(groupId); + if (groupData.nestedGroups) { + var _context26; + var nestedGroupIds = _mapInstanceProperty(_context26 = t.groupsData.get({ + filter: function filter(nestedGroup) { + return nestedGroup.nestedInGroup == groupId; + }, + order: t.options.groupOrder + })).call(_context26, function (nestedGroup) { + return nestedGroup.id; + }); + result = _concatInstanceProperty(result).call(result, getOrderedNestedGroups(t, nestedGroupIds)); + } + }); + return result; + } + var topGroupIds = _filterInstanceProperty(groupIds).call(groupIds, function (groupId) { + return !_this7.groupsData.get(groupId).nestedInGroup; + }); + return getOrderedNestedGroups(this, topGroupIds); + } + + /** + * Add a new item + * @param {Item} item + * @private + */ + }, { + key: "_addItem", + value: function _addItem(item) { + this.items[item.id] = item; + + // add to group + var groupId = this.getGroupId(item.data); + var group = this.groups[groupId]; + if (!group) { + item.groupShowing = false; + } else if (group && group.data && group.data.showNested) { + item.groupShowing = true; + } + if (group) group.add(item); + } + + /** + * Update an existing item + * @param {Item} item + * @param {Object} itemData + * @private + */ + }, { + key: "_updateItem", + value: function _updateItem(item, itemData) { + // update the items data (will redraw the item when displayed) + item.setData(itemData); + var groupId = this.getGroupId(item.data); + var group = this.groups[groupId]; + if (!group) { + item.groupShowing = false; + } else if (group && group.data && group.data.showNested) { + item.groupShowing = true; + } + } + + /** + * Delete an item from the ItemSet: remove it from the DOM, from the map + * with items, and from the map with visible items, and from the selection + * @param {Item} item + * @private + */ + }, { + key: "_removeItem", + value: function _removeItem(item) { + var _context27, _context28; + // remove from DOM + item.hide(); + + // remove from items + delete this.items[item.id]; + + // remove from selection + var index = _indexOfInstanceProperty(_context27 = this.selection).call(_context27, item.id); + if (index != -1) _spliceInstanceProperty(_context28 = this.selection).call(_context28, index, 1); + + // remove from group + item.parent && item.parent.remove(item); + + // remove Tooltip from DOM + if (this.popup != null) { + this.popup.hide(); + } + } + + /** + * Create an array containing all items being a range (having an end date) + * @param {Array.} array + * @returns {Array} + * @private + */ + }, { + key: "_constructByEndArray", + value: function _constructByEndArray(array) { + var endArray = []; + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof RangeItem) { + endArray.push(array[i]); + } + } + return endArray; + } + + /** + * Register the clicked item on touch, before dragStart is initiated. + * + * dragStart is initiated from a mousemove event, AFTER the mouse/touch is + * already moving. Therefore, the mouse/touch can sometimes be above an other + * DOM element than the item itself. + * + * @param {Event} event + * @private + */ + }, { + key: "_onTouch", + value: function _onTouch(event) { + // store the touched item, used in _onDragStart + this.touchParams.item = this.itemFromTarget(event); + this.touchParams.dragLeftItem = event.target.dragLeftItem || false; + this.touchParams.dragRightItem = event.target.dragRightItem || false; + this.touchParams.itemProps = null; + } + + /** + * Given an group id, returns the index it has. + * + * @param {number} groupId + * @returns {number} index / groupId + * @private + */ + }, { + key: "_getGroupIndex", + value: function _getGroupIndex(groupId) { + for (var i = 0; i < this.groupIds.length; i++) { + if (groupId == this.groupIds[i]) return i; + } + } + + /** + * Start dragging the selected events + * @param {Event} event + * @private + */ + }, { + key: "_onDragStart", + value: function _onDragStart(event) { + var _this8 = this; + if (this.touchParams.itemIsDragging) { + return; + } + var item = this.touchParams.item || null; + var me = this; + var props; + if (item && (item.selected || this.options.itemsAlwaysDraggable.item)) { + if (this.options.editable.overrideItems && !this.options.editable.updateTime && !this.options.editable.updateGroup) { + return; + } + + // override options.editable + if (item.editable != null && !item.editable.updateTime && !item.editable.updateGroup && !this.options.editable.overrideItems) { + return; + } + var dragLeftItem = this.touchParams.dragLeftItem; + var dragRightItem = this.touchParams.dragRightItem; + this.touchParams.itemIsDragging = true; + this.touchParams.selectedItem = item; + if (dragLeftItem) { + props = { + item: dragLeftItem, + initialX: event.center.x, + dragLeft: true, + data: this._cloneItemData(item.data) + }; + this.touchParams.itemProps = [props]; + } else if (dragRightItem) { + props = { + item: dragRightItem, + initialX: event.center.x, + dragRight: true, + data: this._cloneItemData(item.data) + }; + this.touchParams.itemProps = [props]; + } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) { + // create a new range item when dragging with ctrl key down + this._onDragStartAddItem(event); + } else { + if (this.groupIds.length < 1) { + // Mitigates a race condition if _onDragStart() is + // called after markDirty() without redraw() being called between. + this.redraw(); + } + var baseGroupIndex = this._getGroupIndex(item.data.group); + var itemsToDrag = this.options.itemsAlwaysDraggable.item && !item.selected ? [item.id] : this.getSelection(); + this.touchParams.itemProps = _mapInstanceProperty(itemsToDrag).call(itemsToDrag, function (id) { + var item = me.items[id]; + var groupIndex = me._getGroupIndex(item.data.group); + return { + item: item, + initialX: event.center.x, + groupOffset: baseGroupIndex - groupIndex, + data: _this8._cloneItemData(item.data) + }; + }); + } + event.stopPropagation(); + } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) { + // create a new range item when dragging with ctrl key down + this._onDragStartAddItem(event); + } + } + + /** + * Start creating a new range item by dragging. + * @param {Event} event + * @private + */ + }, { + key: "_onDragStartAddItem", + value: function _onDragStartAddItem(event) { + var snap = this.options.snap || null; + var frameRect = this.dom.frame.getBoundingClientRect(); + + // plus (if rtl) 10 to compensate for the drag starting as soon as you've moved 10px + var x = this.options.rtl ? frameRect.right - event.center.x + 10 : event.center.x - frameRect.left - 10; + var time = this.body.util.toTime(x); + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var start = snap ? snap(time, scale, step) : time; + var end = start; + var itemData = { + type: 'range', + start: start, + end: end, + content: 'new item' + }; + var id = v4(); + itemData[this.itemsData.idProp] = id; + var group = this.groupFromTarget(event); + if (group) { + itemData.group = group.groupId; + } + var newItem = new RangeItem(itemData, this.conversion, this.options); + newItem.id = id; // TODO: not so nice setting id afterwards + newItem.data = this._cloneItemData(itemData); + this._addItem(newItem); + this.touchParams.selectedItem = newItem; + var props = { + item: newItem, + initialX: event.center.x, + data: newItem.data + }; + if (this.options.rtl) { + props.dragLeft = true; + } else { + props.dragRight = true; + } + this.touchParams.itemProps = [props]; + event.stopPropagation(); + } + + /** + * Drag selected items + * @param {Event} event + * @private + */ + }, { + key: "_onDrag", + value: function _onDrag(event) { + var _this9 = this; + if (this.popup != null && this.options.showTooltips && !this.popup.hidden) { + // this.popup.hide(); + var container = this.body.dom.centerContainer; + var containerRect = container.getBoundingClientRect(); + this.popup.setPosition(event.center.x - containerRect.left + container.offsetLeft, event.center.y - containerRect.top + container.offsetTop); + this.popup.show(); // redraw + } + + if (this.touchParams.itemProps) { + var _context29; + event.stopPropagation(); + var me = this; + var snap = this.options.snap || null; + var domRootOffsetLeft = this.body.dom.root.offsetLeft; + var xOffset = this.options.rtl ? domRootOffsetLeft + this.body.domProps.right.width : domRootOffsetLeft + this.body.domProps.left.width; + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + + //only calculate the new group for the item that's actually dragged + var selectedItem = this.touchParams.selectedItem; + var updateGroupAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateGroup || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateGroup; + var newGroupBase = null; + if (updateGroupAllowed && selectedItem) { + if (selectedItem.data.group != undefined) { + // drag from one group to another + var group = me.groupFromTarget(event); + if (group) { + //we know the offset for all items, so the new group for all items + //will be relative to this one. + newGroupBase = this._getGroupIndex(group.groupId); + } + } + } + + // move + _forEachInstanceProperty(_context29 = this.touchParams.itemProps).call(_context29, function (props) { + var current = me.body.util.toTime(event.center.x - xOffset); + var initial = me.body.util.toTime(props.initialX - xOffset); + var offset; + var initialStart; + var initialEnd; + var start; + var end; + if (_this9.options.rtl) { + offset = -(current - initial); // ms + } else { + offset = current - initial; // ms + } + + var itemData = _this9._cloneItemData(props.item.data); // clone the data + if (props.item.editable != null && !props.item.editable.updateTime && !props.item.editable.updateGroup && !me.options.editable.overrideItems) { + return; + } + var updateTimeAllowed = (_this9.options.editable.overrideItems || selectedItem.editable == null) && _this9.options.editable.updateTime || !_this9.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateTime; + if (updateTimeAllowed) { + if (props.dragLeft) { + // drag left side of a range item + if (_this9.options.rtl) { + if (itemData.end != undefined) { + initialEnd = availableUtils.convert(props.data.end, 'Date'); + end = new Date(initialEnd.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.end = snap ? snap(end, scale, step) : end; + } + } else { + if (itemData.start != undefined) { + initialStart = availableUtils.convert(props.data.start, 'Date'); + start = new Date(initialStart.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } + } + } else if (props.dragRight) { + // drag right side of a range item + if (_this9.options.rtl) { + if (itemData.start != undefined) { + initialStart = availableUtils.convert(props.data.start, 'Date'); + start = new Date(initialStart.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } + } else { + if (itemData.end != undefined) { + initialEnd = availableUtils.convert(props.data.end, 'Date'); + end = new Date(initialEnd.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.end = snap ? snap(end, scale, step) : end; + } + } + } else { + // drag both start and end + if (itemData.start != undefined) { + initialStart = availableUtils.convert(props.data.start, 'Date').valueOf(); + start = new Date(initialStart + offset); + if (itemData.end != undefined) { + initialEnd = availableUtils.convert(props.data.end, 'Date'); + var duration = initialEnd.valueOf() - initialStart.valueOf(); + + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + itemData.end = new Date(itemData.start.valueOf() + duration); + } else { + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } + } + } + } + if (updateGroupAllowed && !props.dragLeft && !props.dragRight && newGroupBase != null) { + if (itemData.group != undefined) { + var newOffset = newGroupBase - props.groupOffset; + + //make sure we stay in bounds + newOffset = Math.max(0, newOffset); + newOffset = Math.min(me.groupIds.length - 1, newOffset); + itemData.group = me.groupIds[newOffset]; + } + } + + // confirm moving the item + itemData = _this9._cloneItemData(itemData); // convert start and end to the correct type + me.options.onMoving(itemData, function (itemData) { + if (itemData) { + props.item.setData(_this9._cloneItemData(itemData, 'Date')); + } + }); + }); + this.body.emitter.emit('_change'); + } + } + + /** + * Move an item to another group + * @param {Item} item + * @param {string | number} groupId + * @private + */ + }, { + key: "_moveToGroup", + value: function _moveToGroup(item, groupId) { + var group = this.groups[groupId]; + if (group && group.groupId != item.data.group) { + var oldGroup = item.parent; + oldGroup.remove(item); + oldGroup.order(); + item.data.group = group.groupId; + group.add(item); + group.order(); + } + } + + /** + * End of dragging selected items + * @param {Event} event + * @private + */ + }, { + key: "_onDragEnd", + value: function _onDragEnd(event) { + var _this10 = this; + this.touchParams.itemIsDragging = false; + if (this.touchParams.itemProps) { + event.stopPropagation(); + var me = this; + var itemProps = this.touchParams.itemProps; + this.touchParams.itemProps = null; + _forEachInstanceProperty(itemProps).call(itemProps, function (props) { + var id = props.item.id; + var exists = me.itemsData.get(id) != null; + if (!exists) { + // add a new item + me.options.onAdd(props.item.data, function (itemData) { + me._removeItem(props.item); // remove temporary item + if (itemData) { + me.itemsData.add(itemData); + } + + // force re-stacking of all items next redraw + me.body.emitter.emit('_change'); + }); + } else { + // update existing item + var itemData = _this10._cloneItemData(props.item.data); // convert start and end to the correct type + me.options.onMove(itemData, function (itemData) { + if (itemData) { + // apply changes + itemData[_this10.itemsData.idProp] = id; // ensure the item contains its id (can be undefined) + _this10.itemsData.update(itemData); + } else { + // restore original values + props.item.setData(props.data); + me.body.emitter.emit('_change'); + } + }); + } + }); + } + } + + /** + * On group click + * @param {Event} event + * @private + */ + }, { + key: "_onGroupClick", + value: function _onGroupClick(event) { + var _this11 = this; + var group = this.groupFromTarget(event); + _setTimeout(function () { + _this11.toggleGroupShowNested(group); + }, 1); + } + + /** + * Toggle show nested + * @param {object} group + * @param {boolean} force + */ + }, { + key: "toggleGroupShowNested", + value: function toggleGroupShowNested(group) { + var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + if (!group || !group.nestedGroups) return; + var groupsData = this.groupsData.getDataSet(); + if (force != undefined) { + group.showNested = !!force; + } else { + group.showNested = !group.showNested; + } + var nestingGroup = groupsData.get(group.groupId); + nestingGroup.showNested = group.showNested; + var fullNestedGroups = group.nestedGroups; + var nextLevel = fullNestedGroups; + while (nextLevel.length > 0) { + var current = nextLevel; + nextLevel = []; + for (var i = 0; i < current.length; i++) { + var node = groupsData.get(current[i]); + if (node.nestedGroups) { + nextLevel = _concatInstanceProperty(nextLevel).call(nextLevel, node.nestedGroups); + } + } + if (nextLevel.length > 0) { + fullNestedGroups = _concatInstanceProperty(fullNestedGroups).call(fullNestedGroups, nextLevel); + } + } + var nestedGroups; + if (nestingGroup.showNested) { + var showNestedGroups = groupsData.get(nestingGroup.nestedGroups); + for (var _i = 0; _i < showNestedGroups.length; _i++) { + var _group = showNestedGroups[_i]; + if (_group.nestedGroups && _group.nestedGroups.length > 0 && (_group.showNested == undefined || _group.showNested == true)) { + showNestedGroups.push.apply(showNestedGroups, _toConsumableArray(groupsData.get(_group.nestedGroups))); + } + } + nestedGroups = _mapInstanceProperty(showNestedGroups).call(showNestedGroups, function (nestedGroup) { + if (nestedGroup.visible == undefined) { + nestedGroup.visible = true; + } + nestedGroup.visible = !!nestingGroup.showNested; + return nestedGroup; + }); + } else { + var _context30; + nestedGroups = _mapInstanceProperty(_context30 = groupsData.get(fullNestedGroups)).call(_context30, function (nestedGroup) { + if (nestedGroup.visible == undefined) { + nestedGroup.visible = true; + } + nestedGroup.visible = !!nestingGroup.showNested; + return nestedGroup; + }); + } + groupsData.update(_concatInstanceProperty(nestedGroups).call(nestedGroups, nestingGroup)); + if (nestingGroup.showNested) { + availableUtils.removeClassName(group.dom.label, 'collapsed'); + availableUtils.addClassName(group.dom.label, 'expanded'); + } else { + availableUtils.removeClassName(group.dom.label, 'expanded'); + availableUtils.addClassName(group.dom.label, 'collapsed'); + } + } + + /** + * Toggle group drag classname + * @param {object} group + */ + }, { + key: "toggleGroupDragClassName", + value: function toggleGroupDragClassName(group) { + group.dom.label.classList.toggle('vis-group-is-dragging'); + group.dom.foreground.classList.toggle('vis-group-is-dragging'); + } + + /** + * on drag start + * @param {Event} event + * @return {void} + * @private + */ + }, { + key: "_onGroupDragStart", + value: function _onGroupDragStart(event) { + if (this.groupTouchParams.isDragging) return; + if (this.options.groupEditable.order) { + this.groupTouchParams.group = this.groupFromTarget(event); + if (this.groupTouchParams.group) { + event.stopPropagation(); + this.groupTouchParams.isDragging = true; + this.toggleGroupDragClassName(this.groupTouchParams.group); + this.groupTouchParams.originalOrder = this.groupsData.getIds({ + order: this.options.groupOrder + }); + } + } + } + + /** + * on drag + * @param {Event} event + * @return {void} + * @private + */ + }, { + key: "_onGroupDrag", + value: function _onGroupDrag(event) { + if (this.options.groupEditable.order && this.groupTouchParams.group) { + event.stopPropagation(); + var groupsData = this.groupsData.getDataSet(); + // drag from one group to another + var group = this.groupFromTarget(event); + + // try to avoid toggling when groups differ in height + if (group && group.height != this.groupTouchParams.group.height) { + var movingUp = group.top < this.groupTouchParams.group.top; + var clientY = event.center ? event.center.y : event.clientY; + var targetGroup = group.dom.foreground.getBoundingClientRect(); + var draggedGroupHeight = this.groupTouchParams.group.height; + if (movingUp) { + // skip swapping the groups when the dragged group is not below clientY afterwards + if (targetGroup.top + draggedGroupHeight < clientY) { + return; + } + } else { + var targetGroupHeight = group.height; + // skip swapping the groups when the dragged group is not below clientY afterwards + if (targetGroup.top + targetGroupHeight - draggedGroupHeight > clientY) { + return; + } + } + } + if (group && group != this.groupTouchParams.group) { + var _targetGroup = groupsData.get(group.groupId); + var draggedGroup = groupsData.get(this.groupTouchParams.group.groupId); + + // switch groups + if (draggedGroup && _targetGroup) { + this.options.groupOrderSwap(draggedGroup, _targetGroup, groupsData); + groupsData.update(draggedGroup); + groupsData.update(_targetGroup); + } + + // fetch current order of groups + var newOrder = groupsData.getIds({ + order: this.options.groupOrder + }); + + // in case of changes since _onGroupDragStart + if (!availableUtils.equalArray(newOrder, this.groupTouchParams.originalOrder)) { + var origOrder = this.groupTouchParams.originalOrder; + var draggedId = this.groupTouchParams.group.groupId; + var numGroups = Math.min(origOrder.length, newOrder.length); + var curPos = 0; + var newOffset = 0; + var orgOffset = 0; + while (curPos < numGroups) { + // as long as the groups are where they should be step down along the groups order + while (curPos + newOffset < numGroups && curPos + orgOffset < numGroups && newOrder[curPos + newOffset] == origOrder[curPos + orgOffset]) { + curPos++; + } + + // all ok + if (curPos + newOffset >= numGroups) { + break; + } + + // not all ok + // if dragged group was move upwards everything below should have an offset + if (newOrder[curPos + newOffset] == draggedId) { + newOffset = 1; + } + // if dragged group was move downwards everything above should have an offset + else if (origOrder[curPos + orgOffset] == draggedId) { + orgOffset = 1; + } + // found a group (apart from dragged group) that has the wrong position -> switch with the + // group at the position where other one should be, fix index arrays and continue + else { + var slippedPosition = _indexOfInstanceProperty(newOrder).call(newOrder, origOrder[curPos + orgOffset]); + var switchGroup = groupsData.get(newOrder[curPos + newOffset]); + var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]); + this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData); + groupsData.update(switchGroup); + groupsData.update(shouldBeGroup); + var switchGroupId = newOrder[curPos + newOffset]; + newOrder[curPos + newOffset] = origOrder[curPos + orgOffset]; + newOrder[slippedPosition] = switchGroupId; + curPos++; + } + } + } + } + } + } + + /** + * on drag end + * @param {Event} event + * @return {void} + * @private + */ + }, { + key: "_onGroupDragEnd", + value: function _onGroupDragEnd(event) { + this.groupTouchParams.isDragging = false; + if (this.options.groupEditable.order && this.groupTouchParams.group) { + event.stopPropagation(); + + // update existing group + var me = this; + var id = me.groupTouchParams.group.groupId; + var dataset = me.groupsData.getDataSet(); + var groupData = availableUtils.extend({}, dataset.get(id)); // clone the data + me.options.onMoveGroup(groupData, function (groupData) { + if (groupData) { + // apply changes + groupData[dataset._idProp] = id; // ensure the group contains its id (can be undefined) + dataset.update(groupData); + } else { + // fetch current order of groups + var newOrder = dataset.getIds({ + order: me.options.groupOrder + }); + + // restore original order + if (!availableUtils.equalArray(newOrder, me.groupTouchParams.originalOrder)) { + var origOrder = me.groupTouchParams.originalOrder; + var numGroups = Math.min(origOrder.length, newOrder.length); + var curPos = 0; + while (curPos < numGroups) { + // as long as the groups are where they should be step down along the groups order + while (curPos < numGroups && newOrder[curPos] == origOrder[curPos]) { + curPos++; + } + + // all ok + if (curPos >= numGroups) { + break; + } + + // found a group that has the wrong position -> switch with the + // group at the position where other one should be, fix index arrays and continue + var slippedPosition = _indexOfInstanceProperty(newOrder).call(newOrder, origOrder[curPos]); + var switchGroup = dataset.get(newOrder[curPos]); + var shouldBeGroup = dataset.get(origOrder[curPos]); + me.options.groupOrderSwap(switchGroup, shouldBeGroup, dataset); + dataset.update(switchGroup); + dataset.update(shouldBeGroup); + var switchGroupId = newOrder[curPos]; + newOrder[curPos] = origOrder[curPos]; + newOrder[slippedPosition] = switchGroupId; + curPos++; + } + } + } + }); + me.body.emitter.emit('groupDragged', { + groupId: id + }); + this.toggleGroupDragClassName(this.groupTouchParams.group); + this.groupTouchParams.group = null; + } + } + + /** + * Handle selecting/deselecting an item when tapping it + * @param {Event} event + * @private + */ + }, { + key: "_onSelectItem", + value: function _onSelectItem(event) { + if (!this.options.selectable) return; + var ctrlKey = event.srcEvent && (event.srcEvent.ctrlKey || event.srcEvent.metaKey); + var shiftKey = event.srcEvent && event.srcEvent.shiftKey; + if (ctrlKey || shiftKey) { + this._onMultiSelectItem(event); + return; + } + var oldSelection = this.getSelection(); + var item = this.itemFromTarget(event); + var selection = item && item.selectable ? [item.id] : []; + this.setSelection(selection); + var newSelection = this.getSelection(); + + // emit a select event, + // except when old selection is empty and new selection is still empty + if (newSelection.length > 0 || oldSelection.length > 0) { + this.body.emitter.emit('select', { + items: newSelection, + event: event + }); + } + } + + /** + * Handle hovering an item + * @param {Event} event + * @private + */ + }, { + key: "_onMouseOver", + value: function _onMouseOver(event) { + var item = this.itemFromTarget(event); + if (!item) return; + + // Item we just left + var related = this.itemFromRelatedTarget(event); + if (item === related) { + // We haven't changed item, just element in the item + return; + } + var title = item.getTitle(); + if (this.options.showTooltips && title) { + if (this.popup == null) { + this.popup = new Popup(this.body.dom.root, this.options.tooltip.overflowMethod || 'flip'); + } + this.popup.setText(title); + var container = this.body.dom.centerContainer; + var containerRect = container.getBoundingClientRect(); + this.popup.setPosition(event.clientX - containerRect.left + container.offsetLeft, event.clientY - containerRect.top + container.offsetTop); + this.setPopupTimer(this.popup); + } else { + // Hovering over item without a title, hide popup + // Needed instead of _just_ in _onMouseOut due to #2572 + this.clearPopupTimer(); + if (this.popup != null) { + this.popup.hide(); + } + } + this.body.emitter.emit('itemover', { + item: item.id, + event: event + }); + } + + /** + * on mouse start + * @param {Event} event + * @return {void} + * @private + */ + }, { + key: "_onMouseOut", + value: function _onMouseOut(event) { + var item = this.itemFromTarget(event); + if (!item) return; + + // Item we are going to + var related = this.itemFromRelatedTarget(event); + if (item === related) { + // We aren't changing item, just element in the item + return; + } + this.clearPopupTimer(); + if (this.popup != null) { + this.popup.hide(); + } + this.body.emitter.emit('itemout', { + item: item.id, + event: event + }); + } + + /** + * on mouse move + * @param {Event} event + * @return {void} + * @private + */ + }, { + key: "_onMouseMove", + value: function _onMouseMove(event) { + var item = this.itemFromTarget(event); + if (!item) return; + if (this.popupTimer != null) { + // restart timer + this.setPopupTimer(this.popup); + } + if (this.options.showTooltips && this.options.tooltip.followMouse && this.popup && !this.popup.hidden) { + var container = this.body.dom.centerContainer; + var containerRect = container.getBoundingClientRect(); + this.popup.setPosition(event.clientX - containerRect.left + container.offsetLeft, event.clientY - containerRect.top + container.offsetTop); + this.popup.show(); // Redraw + } + } + + /** + * Handle mousewheel + * @param {Event} event The event + * @private + */ + }, { + key: "_onMouseWheel", + value: function _onMouseWheel(event) { + if (this.touchParams.itemIsDragging) { + this._onDragEnd(event); + } + } + + /** + * Handle updates of an item on double tap + * @param {timeline.Item} item The item + * @private + */ + }, { + key: "_onUpdateItem", + value: function _onUpdateItem(item) { + if (!this.options.selectable) return; + if (!this.options.editable.updateTime && !this.options.editable.updateGroup) return; + var me = this; + if (item) { + // execute async handler to update the item (or cancel it) + var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset + this.options.onUpdate(itemData, function (itemData) { + if (itemData) { + me.itemsData.update(itemData); + } + }); + } + } + + /** + * Handle drop event of data on item + * Only called when `objectData.target === 'item'. + * @param {Event} event The event + * @private + */ + }, { + key: "_onDropObjectOnItem", + value: function _onDropObjectOnItem(event) { + var item = this.itemFromTarget(event); + var objectData = JSON.parse(event.dataTransfer.getData("text")); + this.options.onDropObjectOnItem(objectData, item); + } + + /** + * Handle creation of an item on double tap or drop of a drag event + * @param {Event} event The event + * @private + */ + }, { + key: "_onAddItem", + value: function _onAddItem(event) { + if (!this.options.selectable) return; + if (!this.options.editable.add) return; + var me = this; + var snap = this.options.snap || null; + + // add item + var frameRect = this.dom.frame.getBoundingClientRect(); + var x = this.options.rtl ? frameRect.right - event.center.x : event.center.x - frameRect.left; + var start = this.body.util.toTime(x); + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var end; + var newItemData; + if (event.type == 'drop') { + newItemData = JSON.parse(event.dataTransfer.getData("text")); + newItemData.content = newItemData.content ? newItemData.content : 'new item'; + newItemData.start = newItemData.start ? newItemData.start : snap ? snap(start, scale, step) : start; + newItemData.type = newItemData.type || 'box'; + newItemData[this.itemsData.idProp] = newItemData.id || v4(); + if (newItemData.type == 'range' && !newItemData.end) { + end = this.body.util.toTime(x + this.props.width / 5); + newItemData.end = snap ? snap(end, scale, step) : end; + } + } else { + newItemData = { + start: snap ? snap(start, scale, step) : start, + content: 'new item' + }; + newItemData[this.itemsData.idProp] = v4(); + + // when default type is a range, add a default end date to the new item + if (this.options.type === 'range') { + end = this.body.util.toTime(x + this.props.width / 5); + newItemData.end = snap ? snap(end, scale, step) : end; + } + } + var group = this.groupFromTarget(event); + if (group) { + newItemData.group = group.groupId; + } + + // execute async handler to customize (or cancel) adding an item + newItemData = this._cloneItemData(newItemData); // convert start and end to the correct type + this.options.onAdd(newItemData, function (item) { + if (item) { + me.itemsData.add(item); + if (event.type == 'drop') { + me.setSelection([item.id]); + } + // TODO: need to trigger a redraw? + } + }); + } + + /** + * Handle selecting/deselecting multiple items when holding an item + * @param {Event} event + * @private + */ + }, { + key: "_onMultiSelectItem", + value: function _onMultiSelectItem(event) { + var _this12 = this; + if (!this.options.selectable) return; + var item = this.itemFromTarget(event); + if (item) { + // multi select items (if allowed) + + var selection = this.options.multiselect ? this.getSelection() // take current selection + : []; // deselect current selection + + var shiftKey = event.srcEvent && event.srcEvent.shiftKey || false; + if ((shiftKey || this.options.sequentialSelection) && this.options.multiselect) { + // select all items between the old selection and the tapped item + var itemGroup = this.itemsData.get(item.id).group; + + // when filtering get the group of the last selected item + var lastSelectedGroup = undefined; + if (this.options.multiselectPerGroup) { + if (selection.length > 0) { + lastSelectedGroup = this.itemsData.get(selection[0]).group; + } + } + + // determine the selection range + if (!this.options.multiselectPerGroup || lastSelectedGroup == undefined || lastSelectedGroup == itemGroup) { + selection.push(item.id); + } + var range = ItemSet._getItemRange(this.itemsData.get(selection)); + if (!this.options.multiselectPerGroup || lastSelectedGroup == itemGroup) { + // select all items within the selection range + selection = []; + for (var id in this.items) { + if (this.items.hasOwnProperty(id)) { + var _item = this.items[id]; + var start = _item.data.start; + var end = _item.data.end !== undefined ? _item.data.end : start; + if (start >= range.min && end <= range.max && (!this.options.multiselectPerGroup || lastSelectedGroup == this.itemsData.get(_item.id).group) && !(_item instanceof BackgroundItem)) { + selection.push(_item.id); // do not use id but item.id, id itself is stringified + } + } + } + } + } else { + // add/remove this item from the current selection + var index = _indexOfInstanceProperty(selection).call(selection, item.id); + if (index == -1) { + // item is not yet selected -> select it + selection.push(item.id); + } else { + // item is already selected -> deselect it + _spliceInstanceProperty(selection).call(selection, index, 1); + } + } + var filteredSelection = _filterInstanceProperty(selection).call(selection, function (item) { + return _this12.getItemById(item).selectable; + }); + this.setSelection(filteredSelection); + this.body.emitter.emit('select', { + items: this.getSelection(), + event: event + }); + } + } + + /** + * Calculate the time range of a list of items + * @param {Array.} itemsData + * @return {{min: Date, max: Date}} Returns the range of the provided items + * @private + */ + }, { + key: "itemFromElement", + value: + /** + * Find an item from an element: + * searches for the attribute 'vis-item' in the element's tree + * @param {HTMLElement} element + * @return {Item | null} item + */ + function itemFromElement(element) { + var cur = element; + while (cur) { + if (cur.hasOwnProperty('vis-item')) { + return cur['vis-item']; + } + cur = cur.parentNode; + } + return null; + } + + /** + * Find an item from an event target: + * searches for the attribute 'vis-item' in the event target's element tree + * @param {Event} event + * @return {Item | null} item + */ + }, { + key: "itemFromTarget", + value: function itemFromTarget(event) { + return this.itemFromElement(event.target); + } + + /** + * Find an item from an event's related target: + * searches for the attribute 'vis-item' in the related target's element tree + * @param {Event} event + * @return {Item | null} item + */ + }, { + key: "itemFromRelatedTarget", + value: function itemFromRelatedTarget(event) { + return this.itemFromElement(event.relatedTarget); + } + + /** + * Find the Group from an event target: + * searches for the attribute 'vis-group' in the event target's element tree + * @param {Event} event + * @return {Group | null} group + */ + }, { + key: "groupFromTarget", + value: function groupFromTarget(event) { + var clientY = event.center ? event.center.y : event.clientY; + var groupIds = this.groupIds; + if (groupIds.length <= 0 && this.groupsData) { + groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); + } + for (var i = 0; i < groupIds.length; i++) { + var groupId = groupIds[i]; + var group = this.groups[groupId]; + var foreground = group.dom.foreground; + var foregroundRect = foreground.getBoundingClientRect(); + if (clientY >= foregroundRect.top && clientY < foregroundRect.top + foreground.offsetHeight) { + return group; + } + if (this.options.orientation.item === 'top') { + if (i === this.groupIds.length - 1 && clientY > foregroundRect.top) { + return group; + } + } else { + if (i === 0 && clientY < foregroundRect.top + foreground.offset) { + return group; + } + } + } + return null; + } + + /** + * Find the ItemSet from an event target: + * searches for the attribute 'vis-itemset' in the event target's element tree + * @param {Event} event + * @return {ItemSet | null} item + */ + }, { + key: "_cloneItemData", + value: + /** + * Clone the data of an item, and "normalize" it: convert the start and end date + * to the type (Date, Moment, ...) configured in the DataSet. If not configured, + * start and end are converted to Date. + * @param {Object} itemData, typically `item.data` + * @param {string} [type] Optional Date type. If not provided, the type from the DataSet is taken + * @return {Object} The cloned object + * @private + */ + function _cloneItemData(itemData, type) { + var clone = availableUtils.extend({}, itemData); + if (!type) { + // convert start and end date to the type (Date, Moment, ...) configured in the DataSet + type = this.itemsData.type; + } + if (clone.start != undefined) { + clone.start = availableUtils.convert(clone.start, type && type.start || 'Date'); + } + if (clone.end != undefined) { + clone.end = availableUtils.convert(clone.end, type && type.end || 'Date'); + } + return clone; + } + + /** + * cluster items + * @return {void} + * @private + */ + }, { + key: "_clusterItems", + value: function _clusterItems() { + if (!this.options.cluster) { + return; + } + var _this$body$range$conv = this.body.range.conversion(this.body.domProps.center.width), + scale = _this$body$range$conv.scale; + var clusters = this.clusterGenerator.getClusters(this.clusters, scale, this.options.cluster); + if (this.clusters != clusters) { + this._detachAllClusters(); + if (clusters) { + var _iterator5 = _createForOfIteratorHelper$1(clusters), + _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { + var cluster = _step5.value; + cluster.attach(); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + this.clusters = clusters; + } + this._updateClusters(clusters); + } + } + + /** + * detach all cluster items + * @private + */ + }, { + key: "_detachAllClusters", + value: function _detachAllClusters() { + if (this.options.cluster) { + if (this.clusters && this.clusters.length) { + var _iterator6 = _createForOfIteratorHelper$1(this.clusters), + _step6; + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { + var cluster = _step6.value; + cluster.detach(); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + } + } + } + + /** + * update clusters + * @param {array} clusters + * @private + */ + }, { + key: "_updateClusters", + value: function _updateClusters(clusters) { + if (this.clusters && this.clusters.length) { + var _context31; + var newClustersIds = new _Set(_mapInstanceProperty(clusters).call(clusters, function (cluster) { + return cluster.id; + })); + var clustersToUnselect = _filterInstanceProperty(_context31 = this.clusters).call(_context31, function (cluster) { + return !newClustersIds.has(cluster.id); + }); + var selectionChanged = false; + var _iterator7 = _createForOfIteratorHelper$1(clustersToUnselect), + _step7; + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { + var _context32; + var cluster = _step7.value; + var selectedIdx = _indexOfInstanceProperty(_context32 = this.selection).call(_context32, cluster.id); + if (selectedIdx !== -1) { + var _context33; + cluster.unselect(); + _spliceInstanceProperty(_context33 = this.selection).call(_context33, selectedIdx, 1); + selectionChanged = true; + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); + } + if (selectionChanged) { + var newSelection = this.getSelection(); + this.body.emitter.emit('select', { + items: newSelection, + event: event + }); + } + } + this.clusters = clusters || []; + } + }], [{ + key: "_getItemRange", + value: function _getItemRange(itemsData) { + var max = null; + var min = null; + _forEachInstanceProperty(itemsData).call(itemsData, function (data) { + if (min == null || data.start < min) { + min = data.start; + } + if (data.end != undefined) { + if (max == null || data.end > max) { + max = data.end; + } + } else { + if (max == null || data.start > max) { + max = data.start; + } + } + }); + return { + min: min, + max: max + }; + } + }, { + key: "itemSetFromTarget", + value: function itemSetFromTarget(event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('vis-itemset')) { + return target['vis-itemset']; + } + target = target.parentNode; + } + return null; + } + }]); + return ItemSet; + }(Component); // available item types will be registered here + ItemSet.types = { + background: BackgroundItem, + box: BoxItem, + range: RangeItem, + point: PointItem + }; + + /** + * Handle added items + * @param {number[]} ids + * @protected + */ + ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; + + var errorFound = false; + var allOptions$2; + var printStyle = 'background: #FFeeee; color: #dd0000'; + /** + * Used to validate options. + */ + var Validator = /*#__PURE__*/function () { + /** + * @ignore + */ + function Validator() { + _classCallCheck(this, Validator); + } + + /** + * Main function to be called + * @param {Object} options + * @param {Object} referenceOptions + * @param {Object} subObject + * @returns {boolean} + * @static + */ + _createClass(Validator, null, [{ + key: "validate", + value: function validate(options, referenceOptions, subObject) { + errorFound = false; + allOptions$2 = referenceOptions; + var usedOptions = referenceOptions; + if (subObject !== undefined) { + usedOptions = referenceOptions[subObject]; + } + Validator.parse(options, usedOptions, []); + return errorFound; + } + + /** + * Will traverse an object recursively and check every value + * @param {Object} options + * @param {Object} referenceOptions + * @param {array} path | where to look for the actual option + * @static + */ + }, { + key: "parse", + value: function parse(options, referenceOptions, path) { + for (var option in options) { + if (options.hasOwnProperty(option)) { + Validator.check(option, options, referenceOptions, path); + } + } + } + + /** + * Check every value. If the value is an object, call the parse function on that object. + * @param {string} option + * @param {Object} options + * @param {Object} referenceOptions + * @param {array} path | where to look for the actual option + * @static + */ + }, { + key: "check", + value: function check(option, options, referenceOptions, path) { + if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) { + Validator.getSuggestion(option, referenceOptions, path); + return; + } + var referenceOption = option; + var is_object = true; + if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { + // NOTE: This only triggers if the __any__ is in the top level of the options object. + // THAT'S A REALLY BAD PLACE TO ALLOW IT!!!! + // TODO: Examine if needed, remove if possible + + // __any__ is a wildcard. Any value is accepted and will be further analysed by reference. + referenceOption = '__any__'; + + // if the any-subgroup is not a predefined object in the configurator, + // we do not look deeper into the object. + is_object = Validator.getType(options[option]) === 'object'; + } + var refOptionObj = referenceOptions[referenceOption]; + if (is_object && refOptionObj.__type__ !== undefined) { + refOptionObj = refOptionObj.__type__; + } + Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path); + } + + /** + * + * @param {string} option | the option property + * @param {Object} options | The supplied options object + * @param {Object} referenceOptions | The reference options containing all options and their allowed formats + * @param {string} referenceOption | Usually this is the same as option, except when handling an __any__ tag. + * @param {string} refOptionObj | This is the type object from the reference options + * @param {Array} path | where in the object is the option + * @static + */ + }, { + key: "checkFields", + value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) { + var log = function log(message) { + console.log('%c' + message + Validator.printLocation(path, option), printStyle); + }; + var optionType = Validator.getType(options[option]); + var refOptionType = refOptionObj[optionType]; + if (refOptionType !== undefined) { + // if the type is correct, we check if it is supposed to be one of a few select values + if (Validator.getType(refOptionType) === 'array' && _indexOfInstanceProperty(refOptionType).call(refOptionType, options[option]) === -1) { + log('Invalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". '); + errorFound = true; + } else if (optionType === 'object' && referenceOption !== "__any__") { + path = availableUtils.copyAndExtendArray(path, option); + Validator.parse(options[option], referenceOptions[referenceOption], path); + } + } else if (refOptionObj['any'] === undefined) { + // type of the field is incorrect and the field cannot be any + log('Invalid type received for "' + option + '". Expected: ' + Validator.print(_Object$keys(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"'); + errorFound = true; + } + } + + /** + * + * @param {Object|boolean|number|string|Array.|Date|Node|Moment|undefined|null} object + * @returns {string} + * @static + */ + }, { + key: "getType", + value: function getType(object) { + var type = _typeof$1(object); + if (type === 'object') { + if (object === null) { + return 'null'; + } + if (object instanceof Boolean) { + return 'boolean'; + } + if (object instanceof Number) { + return 'number'; + } + if (object instanceof String) { + return 'string'; + } + if (_Array$isArray(object)) { + return 'array'; + } + if (object instanceof Date) { + return 'date'; + } + if (object.nodeType !== undefined) { + return 'dom'; + } + if (object._isAMomentObject === true) { + return 'moment'; + } + return 'object'; + } else if (type === 'number') { + return 'number'; + } else if (type === 'boolean') { + return 'boolean'; + } else if (type === 'string') { + return 'string'; + } else if (type === undefined) { + return 'undefined'; + } + return type; + } + + /** + * @param {string} option + * @param {Object} options + * @param {Array.} path + * @static + */ + }, { + key: "getSuggestion", + value: function getSuggestion(option, options, path) { + var localSearch = Validator.findInOptions(option, options, path, false); + var globalSearch = Validator.findInOptions(option, allOptions$2, [], true); + var localSearchThreshold = 8; + var globalSearchThreshold = 4; + var msg; + if (localSearch.indexMatch !== undefined) { + msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n'; + } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) { + msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, ''); + } else if (localSearch.distance <= localSearchThreshold) { + msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option); + } else { + msg = '. Did you mean one of these: ' + Validator.print(_Object$keys(options)) + Validator.printLocation(path, option); + } + console.log('%cUnknown option detected: "' + option + '"' + msg, printStyle); + errorFound = true; + } + + /** + * traverse the options in search for a match. + * @param {string} option + * @param {Object} options + * @param {Array} path | where to look for the actual option + * @param {boolean} [recursive=false] + * @returns {{closestMatch: string, path: Array, distance: number}} + * @static + */ + }, { + key: "findInOptions", + value: function findInOptions(option, options, path) { + var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + var min = 1e9; + var closestMatch = ''; + var closestMatchPath = []; + var lowerCaseOption = option.toLowerCase(); + var indexMatch = undefined; + for (var op in options) { + // eslint-disable-line guard-for-in + var distance = void 0; + if (options[op].__type__ !== undefined && recursive === true) { + var result = Validator.findInOptions(option, options[op], availableUtils.copyAndExtendArray(path, op)); + if (min > result.distance) { + closestMatch = result.closestMatch; + closestMatchPath = result.path; + min = result.distance; + indexMatch = result.indexMatch; + } + } else { + var _context; + if (_indexOfInstanceProperty(_context = op.toLowerCase()).call(_context, lowerCaseOption) !== -1) { + indexMatch = op; + } + distance = Validator.levenshteinDistance(option, op); + if (min > distance) { + closestMatch = op; + closestMatchPath = availableUtils.copyArray(path); + min = distance; + } + } + } + return { + closestMatch: closestMatch, + path: closestMatchPath, + distance: min, + indexMatch: indexMatch + }; + } + + /** + * @param {Array.} path + * @param {Object} option + * @param {string} prefix + * @returns {String} + * @static + */ + }, { + key: "printLocation", + value: function printLocation(path, option) { + var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n'; + var str = '\n\n' + prefix + 'options = {\n'; + for (var i = 0; i < path.length; i++) { + for (var j = 0; j < i + 1; j++) { + str += ' '; + } + str += path[i] + ': {\n'; + } + for (var _j = 0; _j < path.length + 1; _j++) { + str += ' '; + } + str += option + '\n'; + for (var _i = 0; _i < path.length + 1; _i++) { + for (var _j2 = 0; _j2 < path.length - _i; _j2++) { + str += ' '; + } + str += '}\n'; + } + return str + '\n\n'; + } + + /** + * @param {Object} options + * @returns {String} + * @static + */ + }, { + key: "print", + value: function print(options) { + return _JSON$stringify(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', '); + } + + /** + * Compute the edit distance between the two given strings + * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript + * + * Copyright (c) 2011 Andrei Mackenzie + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @param {string} a + * @param {string} b + * @returns {Array.>}} + * @static + */ + }, { + key: "levenshteinDistance", + value: function levenshteinDistance(a, b) { + if (a.length === 0) return b.length; + if (b.length === 0) return a.length; + var matrix = []; + + // increment along the first column of each row + var i; + for (i = 0; i <= b.length; i++) { + matrix[i] = [i]; + } + + // increment each column in the first row + var j; + for (j = 0; j <= a.length; j++) { + matrix[0][j] = j; + } + + // Fill in the rest of the matrix + for (i = 1; i <= b.length; i++) { + for (j = 1; j <= a.length; j++) { + if (b.charAt(i - 1) == a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, + // substitution + Math.min(matrix[i][j - 1] + 1, + // insertion + matrix[i - 1][j] + 1)); // deletion + } + } + } + + return matrix[b.length][a.length]; + } + }]); + return Validator; + }(); + + /** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ + var string$1 = 'string'; + var bool$1 = 'boolean'; + var number$1 = 'number'; + var array$1 = 'array'; + var date$1 = 'date'; + var object$1 = 'object'; // should only be in a __type__ property + var dom$1 = 'dom'; + var moment$1 = 'moment'; + var any$1 = 'any'; + var allOptions$1 = { + configure: { + enabled: { + 'boolean': bool$1 + }, + filter: { + 'boolean': bool$1, + 'function': 'function' + }, + container: { + dom: dom$1 + }, + __type__: { + object: object$1, + 'boolean': bool$1, + 'function': 'function' + } + }, + //globals : + align: { + string: string$1 + }, + alignCurrentTime: { + string: string$1, + 'undefined': 'undefined' + }, + rtl: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + rollingMode: { + follow: { + 'boolean': bool$1 + }, + offset: { + number: number$1, + 'undefined': 'undefined' + }, + __type__: { + object: object$1 + } + }, + onTimeout: { + timeoutMs: { + number: number$1 + }, + callback: { + 'function': 'function' + }, + __type__: { + object: object$1 + } + }, + verticalScroll: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + horizontalScroll: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + autoResize: { + 'boolean': bool$1 + }, + throttleRedraw: { + number: number$1 + }, + // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 + clickToUse: { + 'boolean': bool$1 + }, + dataAttributes: { + string: string$1, + array: array$1 + }, + editable: { + add: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + remove: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + updateGroup: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + updateTime: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + overrideItems: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + __type__: { + 'boolean': bool$1, + object: object$1 + } + }, + end: { + number: number$1, + date: date$1, + string: string$1, + moment: moment$1 + }, + format: { + minorLabels: { + millisecond: { + string: string$1, + 'undefined': 'undefined' + }, + second: { + string: string$1, + 'undefined': 'undefined' + }, + minute: { + string: string$1, + 'undefined': 'undefined' + }, + hour: { + string: string$1, + 'undefined': 'undefined' + }, + weekday: { + string: string$1, + 'undefined': 'undefined' + }, + day: { + string: string$1, + 'undefined': 'undefined' + }, + week: { + string: string$1, + 'undefined': 'undefined' + }, + month: { + string: string$1, + 'undefined': 'undefined' + }, + year: { + string: string$1, + 'undefined': 'undefined' + }, + __type__: { + object: object$1, + 'function': 'function' + } + }, + majorLabels: { + millisecond: { + string: string$1, + 'undefined': 'undefined' + }, + second: { + string: string$1, + 'undefined': 'undefined' + }, + minute: { + string: string$1, + 'undefined': 'undefined' + }, + hour: { + string: string$1, + 'undefined': 'undefined' + }, + weekday: { + string: string$1, + 'undefined': 'undefined' + }, + day: { + string: string$1, + 'undefined': 'undefined' + }, + week: { + string: string$1, + 'undefined': 'undefined' + }, + month: { + string: string$1, + 'undefined': 'undefined' + }, + year: { + string: string$1, + 'undefined': 'undefined' + }, + __type__: { + object: object$1, + 'function': 'function' + } + }, + __type__: { + object: object$1 + } + }, + moment: { + 'function': 'function' + }, + groupHeightMode: { + string: string$1 + }, + groupOrder: { + string: string$1, + 'function': 'function' + }, + groupEditable: { + add: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + remove: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + order: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + __type__: { + 'boolean': bool$1, + object: object$1 + } + }, + groupOrderSwap: { + 'function': 'function' + }, + height: { + string: string$1, + number: number$1 + }, + hiddenDates: { + start: { + date: date$1, + number: number$1, + string: string$1, + moment: moment$1 + }, + end: { + date: date$1, + number: number$1, + string: string$1, + moment: moment$1 + }, + repeat: { + string: string$1 + }, + __type__: { + object: object$1, + array: array$1 + } + }, + itemsAlwaysDraggable: { + item: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + range: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + __type__: { + 'boolean': bool$1, + object: object$1 + } + }, + limitSize: { + 'boolean': bool$1 + }, + locale: { + string: string$1 + }, + locales: { + __any__: { + any: any$1 + }, + __type__: { + object: object$1 + } + }, + longSelectPressTime: { + number: number$1 + }, + margin: { + axis: { + number: number$1 + }, + item: { + horizontal: { + number: number$1, + 'undefined': 'undefined' + }, + vertical: { + number: number$1, + 'undefined': 'undefined' + }, + __type__: { + object: object$1, + number: number$1 + } + }, + __type__: { + object: object$1, + number: number$1 + } + }, + max: { + date: date$1, + number: number$1, + string: string$1, + moment: moment$1 + }, + maxHeight: { + number: number$1, + string: string$1 + }, + maxMinorChars: { + number: number$1 + }, + min: { + date: date$1, + number: number$1, + string: string$1, + moment: moment$1 + }, + minHeight: { + number: number$1, + string: string$1 + }, + moveable: { + 'boolean': bool$1 + }, + multiselect: { + 'boolean': bool$1 + }, + multiselectPerGroup: { + 'boolean': bool$1 + }, + onAdd: { + 'function': 'function' + }, + onDropObjectOnItem: { + 'function': 'function' + }, + onUpdate: { + 'function': 'function' + }, + onMove: { + 'function': 'function' + }, + onMoving: { + 'function': 'function' + }, + onRemove: { + 'function': 'function' + }, + onAddGroup: { + 'function': 'function' + }, + onMoveGroup: { + 'function': 'function' + }, + onRemoveGroup: { + 'function': 'function' + }, + onInitialDrawComplete: { + 'function': 'function' + }, + order: { + 'function': 'function' + }, + orientation: { + axis: { + string: string$1, + 'undefined': 'undefined' + }, + item: { + string: string$1, + 'undefined': 'undefined' + }, + __type__: { + string: string$1, + object: object$1 + } + }, + selectable: { + 'boolean': bool$1 + }, + sequentialSelection: { + 'boolean': bool$1 + }, + showCurrentTime: { + 'boolean': bool$1 + }, + showMajorLabels: { + 'boolean': bool$1 + }, + showMinorLabels: { + 'boolean': bool$1 + }, + showWeekScale: { + 'boolean': bool$1 + }, + stack: { + 'boolean': bool$1 + }, + stackSubgroups: { + 'boolean': bool$1 + }, + cluster: { + maxItems: { + 'number': number$1, + 'undefined': 'undefined' + }, + titleTemplate: { + 'string': string$1, + 'undefined': 'undefined' + }, + clusterCriteria: { + 'function': 'function', + 'undefined': 'undefined' + }, + showStipes: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + fitOnDoubleClick: { + 'boolean': bool$1, + 'undefined': 'undefined' + }, + __type__: { + 'boolean': bool$1, + object: object$1 + } + }, + snap: { + 'function': 'function', + 'null': 'null' + }, + start: { + date: date$1, + number: number$1, + string: string$1, + moment: moment$1 + }, + template: { + 'function': 'function' + }, + loadingScreenTemplate: { + 'function': 'function' + }, + groupTemplate: { + 'function': 'function' + }, + visibleFrameTemplate: { + string: string$1, + 'function': 'function' + }, + showTooltips: { + 'boolean': bool$1 + }, + tooltip: { + followMouse: { + 'boolean': bool$1 + }, + overflowMethod: { + 'string': ['cap', 'flip', 'none'] + }, + delay: { + number: number$1 + }, + template: { + 'function': 'function' + }, + __type__: { + object: object$1 + } + }, + tooltipOnItemUpdateTime: { + template: { + 'function': 'function' + }, + __type__: { + 'boolean': bool$1, + object: object$1 + } + }, + timeAxis: { + scale: { + string: string$1, + 'undefined': 'undefined' + }, + step: { + number: number$1, + 'undefined': 'undefined' + }, + __type__: { + object: object$1 + } + }, + type: { + string: string$1 + }, + width: { + string: string$1, + number: number$1 + }, + preferZoom: { + 'boolean': bool$1 + }, + zoomable: { + 'boolean': bool$1 + }, + zoomKey: { + string: ['ctrlKey', 'altKey', 'shiftKey', 'metaKey', ''] + }, + zoomFriction: { + number: number$1 + }, + zoomMax: { + number: number$1 + }, + zoomMin: { + number: number$1 + }, + xss: { + disabled: { + boolean: bool$1 + }, + filterOptions: { + __any__: { + any: any$1 + }, + __type__: { + object: object$1 + } + }, + __type__: { + object: object$1 + } + }, + __type__: { + object: object$1 + } + }; + var configureOptions$1 = { + global: { + align: ['center', 'left', 'right'], + alignCurrentTime: ['none', 'year', 'month', 'quarter', 'week', 'isoWeek', 'day', 'date', 'hour', 'minute', 'second'], + direction: false, + autoResize: true, + clickToUse: false, + // dataAttributes: ['all'], // FIXME: can be 'all' or string[] + editable: { + add: false, + remove: false, + updateGroup: false, + updateTime: false + }, + end: '', + format: { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + week: 'w', + month: 'MMM', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + week: 'MMMM YYYY', + month: 'YYYY', + year: '' + } + }, + groupHeightMode: ['auto', 'fixed', 'fitItems'], + //groupOrder: {string, 'function': 'function'}, + groupsDraggable: false, + height: '', + //hiddenDates: {object, array}, + locale: '', + longSelectPressTime: 251, + margin: { + axis: [20, 0, 100, 1], + item: { + horizontal: [10, 0, 100, 1], + vertical: [10, 0, 100, 1] + } + }, + max: '', + maxHeight: '', + maxMinorChars: [7, 0, 20, 1], + min: '', + minHeight: '', + moveable: false, + multiselect: false, + multiselectPerGroup: false, + //onAdd: {'function': 'function'}, + //onUpdate: {'function': 'function'}, + //onMove: {'function': 'function'}, + //onMoving: {'function': 'function'}, + //onRename: {'function': 'function'}, + //order: {'function': 'function'}, + orientation: { + axis: ['both', 'bottom', 'top'], + item: ['bottom', 'top'] + }, + preferZoom: false, + selectable: true, + showCurrentTime: false, + showMajorLabels: true, + showMinorLabels: true, + stack: true, + stackSubgroups: true, + cluster: false, + //snap: {'function': 'function', nada}, + start: '', + //template: {'function': 'function'}, + //timeAxis: { + // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'], + // step: [1, 1, 10, 1] + //}, + showTooltips: true, + tooltip: { + followMouse: false, + overflowMethod: 'flip', + delay: [500, 0, 99999, 100] + }, + tooltipOnItemUpdateTime: false, + type: ['box', 'point', 'range', 'background'], + width: '100%', + zoomable: true, + zoomKey: ['ctrlKey', 'altKey', 'shiftKey', 'metaKey', ''], + zoomMax: [315360000000000, 10, 315360000000000, 1], + zoomMin: [10, 10, 315360000000000, 1], + xss: { + disabled: false + } + } + }; + + var htmlColors = { + black: '#000000', + navy: '#000080', + darkblue: '#00008B', + mediumblue: '#0000CD', + blue: '#0000FF', + darkgreen: '#006400', + green: '#008000', + teal: '#008080', + darkcyan: '#008B8B', + deepskyblue: '#00BFFF', + darkturquoise: '#00CED1', + mediumspringgreen: '#00FA9A', + lime: '#00FF00', + springgreen: '#00FF7F', + aqua: '#00FFFF', + cyan: '#00FFFF', + midnightblue: '#191970', + dodgerblue: '#1E90FF', + lightseagreen: '#20B2AA', + forestgreen: '#228B22', + seagreen: '#2E8B57', + darkslategray: '#2F4F4F', + limegreen: '#32CD32', + mediumseagreen: '#3CB371', + turquoise: '#40E0D0', + royalblue: '#4169E1', + steelblue: '#4682B4', + darkslateblue: '#483D8B', + mediumturquoise: '#48D1CC', + indigo: '#4B0082', + darkolivegreen: '#556B2F', + cadetblue: '#5F9EA0', + cornflowerblue: '#6495ED', + mediumaquamarine: '#66CDAA', + dimgray: '#696969', + slateblue: '#6A5ACD', + olivedrab: '#6B8E23', + slategray: '#708090', + lightslategray: '#778899', + mediumslateblue: '#7B68EE', + lawngreen: '#7CFC00', + chartreuse: '#7FFF00', + aquamarine: '#7FFFD4', + maroon: '#800000', + purple: '#800080', + olive: '#808000', + gray: '#808080', + skyblue: '#87CEEB', + lightskyblue: '#87CEFA', + blueviolet: '#8A2BE2', + darkred: '#8B0000', + darkmagenta: '#8B008B', + saddlebrown: '#8B4513', + darkseagreen: '#8FBC8F', + lightgreen: '#90EE90', + mediumpurple: '#9370D8', + darkviolet: '#9400D3', + palegreen: '#98FB98', + darkorchid: '#9932CC', + yellowgreen: '#9ACD32', + sienna: '#A0522D', + brown: '#A52A2A', + darkgray: '#A9A9A9', + lightblue: '#ADD8E6', + greenyellow: '#ADFF2F', + paleturquoise: '#AFEEEE', + lightsteelblue: '#B0C4DE', + powderblue: '#B0E0E6', + firebrick: '#B22222', + darkgoldenrod: '#B8860B', + mediumorchid: '#BA55D3', + rosybrown: '#BC8F8F', + darkkhaki: '#BDB76B', + silver: '#C0C0C0', + mediumvioletred: '#C71585', + indianred: '#CD5C5C', + peru: '#CD853F', + chocolate: '#D2691E', + tan: '#D2B48C', + lightgrey: '#D3D3D3', + palevioletred: '#D87093', + thistle: '#D8BFD8', + orchid: '#DA70D6', + goldenrod: '#DAA520', + crimson: '#DC143C', + gainsboro: '#DCDCDC', + plum: '#DDA0DD', + burlywood: '#DEB887', + lightcyan: '#E0FFFF', + lavender: '#E6E6FA', + darksalmon: '#E9967A', + violet: '#EE82EE', + palegoldenrod: '#EEE8AA', + lightcoral: '#F08080', + khaki: '#F0E68C', + aliceblue: '#F0F8FF', + honeydew: '#F0FFF0', + azure: '#F0FFFF', + sandybrown: '#F4A460', + wheat: '#F5DEB3', + beige: '#F5F5DC', + whitesmoke: '#F5F5F5', + mintcream: '#F5FFFA', + ghostwhite: '#F8F8FF', + salmon: '#FA8072', + antiquewhite: '#FAEBD7', + linen: '#FAF0E6', + lightgoldenrodyellow: '#FAFAD2', + oldlace: '#FDF5E6', + red: '#FF0000', + fuchsia: '#FF00FF', + magenta: '#FF00FF', + deeppink: '#FF1493', + orangered: '#FF4500', + tomato: '#FF6347', + hotpink: '#FF69B4', + coral: '#FF7F50', + darkorange: '#FF8C00', + lightsalmon: '#FFA07A', + orange: '#FFA500', + lightpink: '#FFB6C1', + pink: '#FFC0CB', + gold: '#FFD700', + peachpuff: '#FFDAB9', + navajowhite: '#FFDEAD', + moccasin: '#FFE4B5', + bisque: '#FFE4C4', + mistyrose: '#FFE4E1', + blanchedalmond: '#FFEBCD', + papayawhip: '#FFEFD5', + lavenderblush: '#FFF0F5', + seashell: '#FFF5EE', + cornsilk: '#FFF8DC', + lemonchiffon: '#FFFACD', + floralwhite: '#FFFAF0', + snow: '#FFFAFA', + yellow: '#FFFF00', + lightyellow: '#FFFFE0', + ivory: '#FFFFF0', + white: '#FFFFFF' + }; + + /** + * @param {number} [pixelRatio=1] + */ + var ColorPicker = /*#__PURE__*/function () { + /** + * @param {number} [pixelRatio=1] + */ + function ColorPicker() { + var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + _classCallCheck(this, ColorPicker); + this.pixelRatio = pixelRatio; + this.generated = false; + this.centerCoordinates = { + x: 289 / 2, + y: 289 / 2 + }; + this.r = 289 * 0.49; + this.color = { + r: 255, + g: 255, + b: 255, + a: 1.0 + }; + this.hueCircle = undefined; + this.initialColor = { + r: 255, + g: 255, + b: 255, + a: 1.0 + }; + this.previousColor = undefined; + this.applied = false; + + // bound by + this.updateCallback = function () {}; + this.closeCallback = function () {}; + + // create all DOM elements + this._create(); + } + + /** + * this inserts the colorPicker into a div from the DOM + * @param {Element} container + */ + _createClass(ColorPicker, [{ + key: "insertTo", + value: function insertTo(container) { + if (this.hammer !== undefined) { + this.hammer.destroy(); + this.hammer = undefined; + } + this.container = container; + this.container.appendChild(this.frame); + this._bindHammer(); + this._setSize(); + } + + /** + * the callback is executed on apply and save. Bind it to the application + * @param {function} callback + */ + }, { + key: "setUpdateCallback", + value: function setUpdateCallback(callback) { + if (typeof callback === 'function') { + this.updateCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker update callback is not a function."); + } + } + + /** + * the callback is executed on apply and save. Bind it to the application + * @param {function} callback + */ + }, { + key: "setCloseCallback", + value: function setCloseCallback(callback) { + if (typeof callback === 'function') { + this.closeCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker closing callback is not a function."); + } + } + + /** + * + * @param {string} color + * @returns {String} + * @private + */ + }, { + key: "_isColorString", + value: function _isColorString(color) { + if (typeof color === 'string') { + return htmlColors[color]; + } + } + + /** + * Set the color of the colorPicker + * Supported formats: + * 'red' --> HTML color string + * '#ffffff' --> hex string + * 'rgb(255,255,255)' --> rgb string + * 'rgba(255,255,255,1.0)' --> rgba string + * {r:255,g:255,b:255} --> rgb object + * {r:255,g:255,b:255,a:1.0} --> rgba object + * @param {string|Object} color + * @param {boolean} [setInitial=true] + */ + }, { + key: "setColor", + value: function setColor(color) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + if (color === 'none') { + return; + } + var rgba; + + // if a html color shorthand is used, convert to hex + var htmlColor = this._isColorString(color); + if (htmlColor !== undefined) { + color = htmlColor; + } + + // check format + if (availableUtils.isString(color) === true) { + if (availableUtils.isValidRGB(color) === true) { + var rgbaArray = color.substr(4).substr(0, color.length - 5).split(','); + rgba = { + r: rgbaArray[0], + g: rgbaArray[1], + b: rgbaArray[2], + a: 1.0 + }; + } else if (availableUtils.isValidRGBA(color) === true) { + var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(','); + rgba = { + r: _rgbaArray[0], + g: _rgbaArray[1], + b: _rgbaArray[2], + a: _rgbaArray[3] + }; + } else if (availableUtils.isValidHex(color) === true) { + var rgbObj = availableUtils.hexToRGB(color); + rgba = { + r: rgbObj.r, + g: rgbObj.g, + b: rgbObj.b, + a: 1.0 + }; + } + } else { + if (color instanceof Object) { + if (color.r !== undefined && color.g !== undefined && color.b !== undefined) { + var alpha = color.a !== undefined ? color.a : '1.0'; + rgba = { + r: color.r, + g: color.g, + b: color.b, + a: alpha + }; + } + } + } + + // set color + if (rgba === undefined) { + throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + _JSON$stringify(color)); + } else { + this._setColor(rgba, setInitial); + } + } + + /** + * this shows the color picker. + * The hue circle is constructed once and stored. + */ + }, { + key: "show", + value: function show() { + if (this.closeCallback !== undefined) { + this.closeCallback(); + this.closeCallback = undefined; + } + this.applied = false; + this.frame.style.display = 'block'; + this._generateHueCircle(); + } + + // ------------------------------------------ PRIVATE ----------------------------- // + + /** + * Hide the picker. Is called by the cancel button. + * Optional boolean to store the previous color for easy access later on. + * @param {boolean} [storePrevious=true] + * @private + */ + }, { + key: "_hide", + value: function _hide() { + var _this = this; + var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + // store the previous color for next time; + if (storePrevious === true) { + this.previousColor = availableUtils.extend({}, this.color); + } + if (this.applied === true) { + this.updateCallback(this.initialColor); + } + this.frame.style.display = 'none'; + + // call the closing callback, restoring the onclick method. + // this is in a setTimeout because it will trigger the show again before the click is done. + _setTimeout(function () { + if (_this.closeCallback !== undefined) { + _this.closeCallback(); + _this.closeCallback = undefined; + } + }, 0); + } + + /** + * bound to the save button. Saves and hides. + * @private + */ + }, { + key: "_save", + value: function _save() { + this.updateCallback(this.color); + this.applied = false; + this._hide(); + } + + /** + * Bound to apply button. Saves but does not close. Is undone by the cancel button. + * @private + */ + }, { + key: "_apply", + value: function _apply() { + this.applied = true; + this.updateCallback(this.color); + this._updatePicker(this.color); + } + + /** + * load the color from the previous session. + * @private + */ + }, { + key: "_loadLast", + value: function _loadLast() { + if (this.previousColor !== undefined) { + this.setColor(this.previousColor, false); + } else { + alert("There is no last color to load..."); + } + } + + /** + * set the color, place the picker + * @param {Object} rgba + * @param {boolean} [setInitial=true] + * @private + */ + }, { + key: "_setColor", + value: function _setColor(rgba) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + // store the initial color + if (setInitial === true) { + this.initialColor = availableUtils.extend({}, rgba); + } + this.color = rgba; + var hsv = availableUtils.RGBToHSV(rgba.r, rgba.g, rgba.b); + var angleConvert = 2 * Math.PI; + var radius = this.r * hsv.s; + var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h); + var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h); + this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + 'px'; + this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + 'px'; + this._updatePicker(rgba); + } + + /** + * bound to opacity control + * @param {number} value + * @private + */ + }, { + key: "_setOpacity", + value: function _setOpacity(value) { + this.color.a = value / 100; + this._updatePicker(this.color); + } + + /** + * bound to brightness control + * @param {number} value + * @private + */ + }, { + key: "_setBrightness", + value: function _setBrightness(value) { + var hsv = availableUtils.RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.v = value / 100; + var rgba = availableUtils.HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba['a'] = this.color.a; + this.color = rgba; + this._updatePicker(); + } + + /** + * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing. + * @param {Object} rgba + * @private + */ + }, { + key: "_updatePicker", + value: function _updatePicker() { + var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color; + var hsv = availableUtils.RGBToHSV(rgba.r, rgba.g, rgba.b); + var ctx = this.colorPickerCanvas.getContext('2d'); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + } + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); + ctx.putImageData(this.hueCircle, 0, 0); + ctx.fillStyle = 'rgba(0,0,0,' + (1 - hsv.v) + ')'; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + _fillInstanceProperty(ctx).call(ctx); + this.brightnessRange.value = 100 * hsv.v; + this.opacityRange.value = 100 * rgba.a; + this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; + this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; + } + + /** + * used by create to set the size of the canvas. + * @private + */ + }, { + key: "_setSize", + value: function _setSize() { + this.colorPickerCanvas.style.width = '100%'; + this.colorPickerCanvas.style.height = '100%'; + this.colorPickerCanvas.width = 289 * this.pixelRatio; + this.colorPickerCanvas.height = 289 * this.pixelRatio; + } + + /** + * create all dom elements + * TODO: cleanup, lots of similar dom elements + * @private + */ + }, { + key: "_create", + value: function _create() { + var _context, _context2, _context3, _context4; + this.frame = document.createElement('div'); + this.frame.className = 'vis-color-picker'; + this.colorPickerDiv = document.createElement('div'); + this.colorPickerSelector = document.createElement('div'); + this.colorPickerSelector.className = 'vis-selector'; + this.colorPickerDiv.appendChild(this.colorPickerSelector); + this.colorPickerCanvas = document.createElement('canvas'); + this.colorPickerDiv.appendChild(this.colorPickerCanvas); + if (!this.colorPickerCanvas.getContext) { + var noCanvas = document.createElement('DIV'); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold'; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.colorPickerCanvas.appendChild(noCanvas); + } else { + var ctx = this.colorPickerCanvas.getContext("2d"); + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + } + this.colorPickerDiv.className = 'vis-color'; + this.opacityDiv = document.createElement('div'); + this.opacityDiv.className = 'vis-opacity'; + this.brightnessDiv = document.createElement('div'); + this.brightnessDiv.className = 'vis-brightness'; + this.arrowDiv = document.createElement('div'); + this.arrowDiv.className = 'vis-arrow'; + this.opacityRange = document.createElement('input'); + try { + this.opacityRange.type = 'range'; // Not supported on IE9 + this.opacityRange.min = '0'; + this.opacityRange.max = '100'; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + this.opacityRange.value = '100'; + this.opacityRange.className = 'vis-range'; + this.brightnessRange = document.createElement('input'); + try { + this.brightnessRange.type = 'range'; // Not supported on IE9 + this.brightnessRange.min = '0'; + this.brightnessRange.max = '100'; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + this.brightnessRange.value = '100'; + this.brightnessRange.className = 'vis-range'; + this.opacityDiv.appendChild(this.opacityRange); + this.brightnessDiv.appendChild(this.brightnessRange); + var me = this; + this.opacityRange.onchange = function () { + me._setOpacity(this.value); + }; + this.opacityRange.oninput = function () { + me._setOpacity(this.value); + }; + this.brightnessRange.onchange = function () { + me._setBrightness(this.value); + }; + this.brightnessRange.oninput = function () { + me._setBrightness(this.value); + }; + this.brightnessLabel = document.createElement("div"); + this.brightnessLabel.className = "vis-label vis-brightness"; + this.brightnessLabel.innerHTML = 'brightness:'; + this.opacityLabel = document.createElement("div"); + this.opacityLabel.className = "vis-label vis-opacity"; + this.opacityLabel.innerHTML = 'opacity:'; + this.newColorDiv = document.createElement("div"); + this.newColorDiv.className = "vis-new-color"; + this.newColorDiv.innerHTML = 'new'; + this.initialColorDiv = document.createElement("div"); + this.initialColorDiv.className = "vis-initial-color"; + this.initialColorDiv.innerHTML = 'initial'; + this.cancelButton = document.createElement("div"); + this.cancelButton.className = "vis-button vis-cancel"; + this.cancelButton.innerHTML = 'cancel'; + this.cancelButton.onclick = _bindInstanceProperty$1(_context = this._hide).call(_context, this, false); + this.applyButton = document.createElement("div"); + this.applyButton.className = "vis-button vis-apply"; + this.applyButton.innerHTML = 'apply'; + this.applyButton.onclick = _bindInstanceProperty$1(_context2 = this._apply).call(_context2, this); + this.saveButton = document.createElement("div"); + this.saveButton.className = "vis-button vis-save"; + this.saveButton.innerHTML = 'save'; + this.saveButton.onclick = _bindInstanceProperty$1(_context3 = this._save).call(_context3, this); + this.loadButton = document.createElement("div"); + this.loadButton.className = "vis-button vis-load"; + this.loadButton.innerHTML = 'load last'; + this.loadButton.onclick = _bindInstanceProperty$1(_context4 = this._loadLast).call(_context4, this); + this.frame.appendChild(this.colorPickerDiv); + this.frame.appendChild(this.arrowDiv); + this.frame.appendChild(this.brightnessLabel); + this.frame.appendChild(this.brightnessDiv); + this.frame.appendChild(this.opacityLabel); + this.frame.appendChild(this.opacityDiv); + this.frame.appendChild(this.newColorDiv); + this.frame.appendChild(this.initialColorDiv); + this.frame.appendChild(this.cancelButton); + this.frame.appendChild(this.applyButton); + this.frame.appendChild(this.saveButton); + this.frame.appendChild(this.loadButton); + } + + /** + * bind hammer to the color picker + * @private + */ + }, { + key: "_bindHammer", + value: function _bindHammer() { + var _this2 = this; + this.drag = {}; + this.pinch = {}; + this.hammer = new Hammer(this.colorPickerCanvas); + this.hammer.get('pinch').set({ + enable: true + }); + onTouch(this.hammer, function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('tap', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panstart', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panmove', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panend', function (event) { + _this2._moveSelector(event); + }); + } + + /** + * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. + * @private + */ + }, { + key: "_generateHueCircle", + value: function _generateHueCircle() { + if (this.generated === false) { + var ctx = this.colorPickerCanvas.getContext('2d'); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + } + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); + + // draw hue circle + var x, y, hue, sat; + this.centerCoordinates = { + x: w * 0.5, + y: h * 0.5 + }; + this.r = 0.49 * w; + var angleConvert = 2 * Math.PI / 360; + var hfac = 1 / 360; + var sfac = 1 / this.r; + var rgb; + for (hue = 0; hue < 360; hue++) { + for (sat = 0; sat < this.r; sat++) { + x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue); + y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue); + rgb = availableUtils.HSVToRGB(hue * hfac, sat * sfac, 1); + ctx.fillStyle = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')'; + ctx.fillRect(x - 0.5, y - 0.5, 2, 2); + } + } + ctx.strokeStyle = 'rgba(0,0,0,1)'; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + ctx.stroke(); + this.hueCircle = ctx.getImageData(0, 0, w, h); + } + this.generated = true; + } + + /** + * move the selector. This is called by hammer functions. + * + * @param {Event} event The event + * @private + */ + }, { + key: "_moveSelector", + value: function _moveSelector(event) { + var rect = this.colorPickerDiv.getBoundingClientRect(); + var left = event.center.x - rect.left; + var top = event.center.y - rect.top; + var centerY = 0.5 * this.colorPickerDiv.clientHeight; + var centerX = 0.5 * this.colorPickerDiv.clientWidth; + var x = left - centerX; + var y = top - centerY; + var angle = Math.atan2(x, y); + var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX); + var newTop = Math.cos(angle) * radius + centerY; + var newLeft = Math.sin(angle) * radius + centerX; + this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + 'px'; + this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + 'px'; + + // set color + var h = angle / (2 * Math.PI); + h = h < 0 ? h + 1 : h; + var s = radius / this.r; + var hsv = availableUtils.RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.h = h; + hsv.s = s; + var rgba = availableUtils.HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba['a'] = this.color.a; + this.color = rgba; + + // update previews + this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; + this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; + } + }]); + return ColorPicker; + }(); + + var css_248z$1 = "div.vis-configuration {\n position:relative;\n display:block;\n float:left;\n font-size:12px;\n}\n\ndiv.vis-configuration-wrapper {\n display:block;\n width:700px;\n}\n\ndiv.vis-configuration-wrapper::after {\n clear: both;\n content: \"\";\n display: block;\n}\n\ndiv.vis-configuration.vis-config-option-container{\n display:block;\n width:495px;\n background-color: #ffffff;\n border:2px solid #f7f8fa;\n border-radius:4px;\n margin-top:20px;\n left:10px;\n padding-left:5px;\n}\n\ndiv.vis-configuration.vis-config-button{\n display:block;\n width:495px;\n height:25px;\n vertical-align: middle;\n line-height:25px;\n background-color: #f7f8fa;\n border:2px solid #ceced0;\n border-radius:4px;\n margin-top:20px;\n left:10px;\n padding-left:5px;\n cursor: pointer;\n margin-bottom:30px;\n}\n\ndiv.vis-configuration.vis-config-button.hover{\n background-color: #4588e6;\n border:2px solid #214373;\n color:#ffffff;\n}\n\ndiv.vis-configuration.vis-config-item{\n display:block;\n float:left;\n width:495px;\n height:25px;\n vertical-align: middle;\n line-height:25px;\n}\n\n\ndiv.vis-configuration.vis-config-item.vis-config-s2{\n left:10px;\n background-color: #f7f8fa;\n padding-left:5px;\n border-radius:3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s3{\n left:20px;\n background-color: #e4e9f0;\n padding-left:5px;\n border-radius:3px;\n}\ndiv.vis-configuration.vis-config-item.vis-config-s4{\n left:30px;\n background-color: #cfd8e6;\n padding-left:5px;\n border-radius:3px;\n}\n\ndiv.vis-configuration.vis-config-header{\n font-size:18px;\n font-weight: bold;\n}\n\ndiv.vis-configuration.vis-config-label{\n width:120px;\n height:25px;\n line-height: 25px;\n}\n\ndiv.vis-configuration.vis-config-label.vis-config-s3{\n width:110px;\n}\ndiv.vis-configuration.vis-config-label.vis-config-s4{\n width:100px;\n}\n\ndiv.vis-configuration.vis-config-colorBlock{\n top:1px;\n width:30px;\n height:19px;\n border:1px solid #444444;\n border-radius:2px;\n padding:0px;\n margin:0px;\n cursor:pointer;\n}\n\ninput.vis-configuration.vis-config-checkbox {\n left:-5px;\n}\n\n\ninput.vis-configuration.vis-config-rangeinput{\n position:relative;\n top:-5px;\n width:60px;\n /*height:13px;*/\n padding:1px;\n margin:0;\n pointer-events:none;\n}\n\ninput.vis-configuration.vis-config-range{\n /*removes default webkit styles*/\n -webkit-appearance: none;\n\n /*fix for FF unable to apply focus style bug */\n border: 0px solid white;\n background-color:rgba(0,0,0,0);\n\n /*required for proper track sizing in FF*/\n width: 300px;\n height:20px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-runnable-track {\n width: 300px;\n height: 5px;\n background: #dedede; /* Old browsers */\n background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n background: -webkit-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */\n background: -ms-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* IE10+ */\n background: linear-gradient(to bottom, #dedede 0%,#c8c8c8 99%); /* W3C */\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n border: 1px solid #999999;\n box-shadow: #aaaaaa 0px 0px 3px 0px;\n border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: 1px solid #14334b;\n height: 17px;\n width: 17px;\n border-radius: 50%;\n background: #3876c2; /* Old browsers */\n background: -moz-linear-gradient(top, #3876c2 0%, #385380 100%); /* FF3.6+ */\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3876c2), color-stop(100%,#385380)); /* Chrome,Safari4+ */\n background: -webkit-linear-gradient(top, #3876c2 0%,#385380 100%); /* Chrome10+,Safari5.1+ */\n background: -o-linear-gradient(top, #3876c2 0%,#385380 100%); /* Opera 11.10+ */\n background: -ms-linear-gradient(top, #3876c2 0%,#385380 100%); /* IE10+ */\n background: linear-gradient(to bottom, #3876c2 0%,#385380 100%); /* W3C */\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3876c2', endColorstr='#385380',GradientType=0 ); /* IE6-9 */\n box-shadow: #111927 0px 0px 1px 0px;\n margin-top: -7px;\n}\ninput.vis-configuration.vis-config-range:focus {\n outline: none;\n}\ninput.vis-configuration.vis-config-range:focus::-webkit-slider-runnable-track {\n background: #9d9d9d; /* Old browsers */\n background: -moz-linear-gradient(top, #9d9d9d 0%, #c8c8c8 99%); /* FF3.6+ */\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9d9d9d), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n background: -webkit-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n background: -o-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* Opera 11.10+ */\n background: -ms-linear-gradient(top, #9d9d9d 0%,#c8c8c8 99%); /* IE10+ */\n background: linear-gradient(to bottom, #9d9d9d 0%,#c8c8c8 99%); /* W3C */\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9d9d9d', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n}\n\ninput.vis-configuration.vis-config-range::-moz-range-track {\n width: 300px;\n height: 10px;\n background: #dedede; /* Old browsers */\n background: -moz-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* FF3.6+ */\n background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dedede), color-stop(99%,#c8c8c8)); /* Chrome,Safari4+ */\n background: -webkit-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* Chrome10+,Safari5.1+ */\n background: -o-linear-gradient(top, #dedede 0%, #c8c8c8 99%); /* Opera 11.10+ */\n background: -ms-linear-gradient(top, #dedede 0%,#c8c8c8 99%); /* IE10+ */\n background: linear-gradient(to bottom, #dedede 0%,#c8c8c8 99%); /* W3C */\n filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dedede', endColorstr='#c8c8c8',GradientType=0 ); /* IE6-9 */\n\n border: 1px solid #999999;\n box-shadow: #aaaaaa 0px 0px 3px 0px;\n border-radius: 3px;\n}\ninput.vis-configuration.vis-config-range::-moz-range-thumb {\n border: none;\n height: 16px;\n width: 16px;\n\n border-radius: 50%;\n background: #385380;\n}\n\n/*hide the outline behind the border*/\ninput.vis-configuration.vis-config-range:-moz-focusring{\n outline: 1px solid white;\n outline-offset: -1px;\n}\n\ninput.vis-configuration.vis-config-range::-ms-track {\n width: 300px;\n height: 5px;\n\n /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */\n background: transparent;\n\n /*leave room for the larger thumb to overflow with a transparent border */\n border-color: transparent;\n border-width: 6px 0;\n\n /*remove default tick marks*/\n color: transparent;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-lower {\n background: #777;\n border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-fill-upper {\n background: #ddd;\n border-radius: 10px;\n}\ninput.vis-configuration.vis-config-range::-ms-thumb {\n border: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: #385380;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-lower {\n background: #888;\n}\ninput.vis-configuration.vis-config-range:focus::-ms-fill-upper {\n background: #ccc;\n}\n\n.vis-configuration-popup {\n position: absolute;\n background: rgba(57, 76, 89, 0.85);\n border: 2px solid #f2faff;\n line-height:30px;\n height:30px;\n width:150px;\n text-align:center;\n color: #ffffff;\n font-size:14px;\n border-radius:4px;\n -webkit-transition: opacity 0.3s ease-in-out;\n -moz-transition: opacity 0.3s ease-in-out;\n transition: opacity 0.3s ease-in-out;\n}\n.vis-configuration-popup:after, .vis-configuration-popup:before {\n left: 100%;\n top: 50%;\n border: solid transparent;\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n\n.vis-configuration-popup:after {\n border-color: rgba(136, 183, 213, 0);\n border-left-color: rgba(57, 76, 89, 0.85);\n border-width: 8px;\n margin-top: -8px;\n}\n.vis-configuration-popup:before {\n border-color: rgba(194, 225, 245, 0);\n border-left-color: #f2faff;\n border-width: 12px;\n margin-top: -12px;\n}"; + styleInject(css_248z$1); + + /** + * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. + * Boolean options are recognised as Boolean + * Number options should be written as array: [default value, min value, max value, stepsize] + * Colors should be written as array: ['color', '#ffffff'] + * Strings with should be written as array: [option1, option2, option3, ..] + * + * The options are matched with their counterparts in each of the modules and the values used in the configuration are + */ + var Configurator = /*#__PURE__*/function () { + /** + * @param {Object} parentModule | the location where parentModule.setOptions() can be called + * @param {Object} defaultContainer | the default container of the module + * @param {Object} configureOptions | the fully configured and predefined options set found in allOptions.js + * @param {number} pixelRatio | canvas pixel ratio + */ + function Configurator(parentModule, defaultContainer, configureOptions) { + var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + _classCallCheck(this, Configurator); + this.parent = parentModule; + this.changedOptions = []; + this.container = defaultContainer; + this.allowCreation = false; + this.options = {}; + this.initialized = false; + this.popupCounter = 0; + this.defaultOptions = { + enabled: false, + filter: true, + container: undefined, + showButton: true + }; + availableUtils.extend(this.options, this.defaultOptions); + this.configureOptions = configureOptions; + this.moduleOptions = {}; + this.domElements = []; + this.popupDiv = {}; + this.popupLimit = 5; + this.popupHistory = {}; + this.colorPicker = new ColorPicker(pixelRatio); + this.wrapper = undefined; + } + + /** + * refresh all options. + * Because all modules parse their options by themselves, we just use their options. We copy them here. + * + * @param {Object} options + */ + _createClass(Configurator, [{ + key: "setOptions", + value: function setOptions(options) { + if (options !== undefined) { + // reset the popup history because the indices may have been changed. + this.popupHistory = {}; + this._removePopup(); + var enabled = true; + if (typeof options === 'string') { + this.options.filter = options; + } else if (_Array$isArray(options)) { + this.options.filter = options.join(); + } else if (_typeof$1(options) === 'object') { + if (options == null) { + throw new TypeError('options cannot be null'); + } + if (options.container !== undefined) { + this.options.container = options.container; + } + if (_filterInstanceProperty(options) !== undefined) { + this.options.filter = _filterInstanceProperty(options); + } + if (options.showButton !== undefined) { + this.options.showButton = options.showButton; + } + if (options.enabled !== undefined) { + enabled = options.enabled; + } + } else if (typeof options === 'boolean') { + this.options.filter = true; + enabled = options; + } else if (typeof options === 'function') { + this.options.filter = options; + enabled = true; + } + if (_filterInstanceProperty(this.options) === false) { + enabled = false; + } + this.options.enabled = enabled; + } + this._clean(); + } + + /** + * + * @param {Object} moduleOptions + */ + }, { + key: "setModuleOptions", + value: function setModuleOptions(moduleOptions) { + this.moduleOptions = moduleOptions; + if (this.options.enabled === true) { + this._clean(); + if (this.options.container !== undefined) { + this.container = this.options.container; + } + this._create(); + } + } + + /** + * Create all DOM elements + * @private + */ + }, { + key: "_create", + value: function _create() { + this._clean(); + this.changedOptions = []; + var filter = _filterInstanceProperty(this.options); + var counter = 0; + var show = false; + for (var option in this.configureOptions) { + if (this.configureOptions.hasOwnProperty(option)) { + this.allowCreation = false; + show = false; + if (typeof filter === 'function') { + show = filter(option, []); + show = show || this._handleObject(this.configureOptions[option], [option], true); + } else if (filter === true || _indexOfInstanceProperty(filter).call(filter, option) !== -1) { + show = true; + } + if (show !== false) { + this.allowCreation = true; + + // linebreak between categories + if (counter > 0) { + this._makeItem([]); + } + // a header for the category + this._makeHeader(option); + + // get the sub options + this._handleObject(this.configureOptions[option], [option]); + } + counter++; + } + } + this._makeButton(); + this._push(); + //~ this.colorPicker.insertTo(this.container); + } + + /** + * draw all DOM elements on the screen + * @private + */ + }, { + key: "_push", + value: function _push() { + this.wrapper = document.createElement('div'); + this.wrapper.className = 'vis-configuration-wrapper'; + this.container.appendChild(this.wrapper); + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.appendChild(this.domElements[i]); + } + this._showPopupIfNeeded(); + } + + /** + * delete all DOM elements + * @private + */ + }, { + key: "_clean", + value: function _clean() { + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.removeChild(this.domElements[i]); + } + if (this.wrapper !== undefined) { + this.container.removeChild(this.wrapper); + this.wrapper = undefined; + } + this.domElements = []; + this._removePopup(); + } + + /** + * get the value from the actualOptions if it exists + * @param {array} path | where to look for the actual option + * @returns {*} + * @private + */ + }, { + key: "_getValue", + value: function _getValue(path) { + var base = this.moduleOptions; + for (var i = 0; i < path.length; i++) { + if (base[path[i]] !== undefined) { + base = base[path[i]]; + } else { + base = undefined; + break; + } + } + return base; + } + + /** + * all option elements are wrapped in an item + * @param {Array} path | where to look for the actual option + * @param {Array.} domElements + * @returns {number} + * @private + */ + }, { + key: "_makeItem", + value: function _makeItem(path) { + if (this.allowCreation === true) { + var item = document.createElement('div'); + item.className = 'vis-configuration vis-config-item vis-config-s' + path.length; + for (var _len = arguments.length, domElements = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + domElements[_key - 1] = arguments[_key]; + } + _forEachInstanceProperty(domElements).call(domElements, function (element) { + item.appendChild(element); + }); + this.domElements.push(item); + return this.domElements.length; + } + return 0; + } + + /** + * header for major subjects + * @param {string} name + * @private + */ + }, { + key: "_makeHeader", + value: function _makeHeader(name) { + var div = document.createElement('div'); + div.className = 'vis-configuration vis-config-header'; + div.innerHTML = availableUtils.xss(name); + this._makeItem([], div); + } + + /** + * make a label, if it is an object label, it gets different styling. + * @param {string} name + * @param {array} path | where to look for the actual option + * @param {string} objectLabel + * @returns {HTMLElement} + * @private + */ + }, { + key: "_makeLabel", + value: function _makeLabel(name, path) { + var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var div = document.createElement('div'); + div.className = 'vis-configuration vis-config-label vis-config-s' + path.length; + if (objectLabel === true) { + div.innerHTML = availableUtils.xss('' + name + ':'); + } else { + div.innerHTML = availableUtils.xss(name + ':'); + } + return div; + } + + /** + * make a dropdown list for multiple possible string optoins + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeDropdown", + value: function _makeDropdown(arr, value, path) { + var select = document.createElement('select'); + select.className = 'vis-configuration vis-config-select'; + var selectedValue = 0; + if (value !== undefined) { + if (_indexOfInstanceProperty(arr).call(arr, value) !== -1) { + selectedValue = _indexOfInstanceProperty(arr).call(arr, value); + } + } + for (var i = 0; i < arr.length; i++) { + var option = document.createElement('option'); + option.value = arr[i]; + if (i === selectedValue) { + option.selected = 'selected'; + } + option.innerHTML = arr[i]; + select.appendChild(option); + } + var me = this; + select.onchange = function () { + me._update(this.value, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, select); + } + + /** + * make a range object for numeric options + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeRange", + value: function _makeRange(arr, value, path) { + var defaultValue = arr[0]; + var min = arr[1]; + var max = arr[2]; + var step = arr[3]; + var range = document.createElement('input'); + range.className = 'vis-configuration vis-config-range'; + try { + range.type = 'range'; // not supported on IE9 + range.min = min; + range.max = max; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + range.step = step; + + // set up the popup settings in case they are needed. + var popupString = ''; + var popupValue = 0; + if (value !== undefined) { + var factor = 1.20; + if (value < 0 && value * factor < min) { + range.min = Math.ceil(value * factor); + popupValue = range.min; + popupString = 'range increased'; + } else if (value / factor < min) { + range.min = Math.ceil(value / factor); + popupValue = range.min; + popupString = 'range increased'; + } + if (value * factor > max && max !== 1) { + range.max = Math.ceil(value * factor); + popupValue = range.max; + popupString = 'range increased'; + } + range.value = value; + } else { + range.value = defaultValue; + } + var input = document.createElement('input'); + input.className = 'vis-configuration vis-config-rangeinput'; + input.value = Number(range.value); + var me = this; + range.onchange = function () { + input.value = this.value; + me._update(Number(this.value), path); + }; + range.oninput = function () { + input.value = this.value; + }; + var label = this._makeLabel(path[path.length - 1], path); + var itemIndex = this._makeItem(path, label, range, input); + + // if a popup is needed AND it has not been shown for this value, show it. + if (popupString !== '' && this.popupHistory[itemIndex] !== popupValue) { + this.popupHistory[itemIndex] = popupValue; + this._setupPopup(popupString, itemIndex); + } + } + + /** + * make a button object + * @private + */ + }, { + key: "_makeButton", + value: function _makeButton() { + var _this = this; + if (this.options.showButton === true) { + var generateButton = document.createElement('div'); + generateButton.className = 'vis-configuration vis-config-button'; + generateButton.innerHTML = 'generate options'; + generateButton.onclick = function () { + _this._printOptions(); + }; + generateButton.onmouseover = function () { + generateButton.className = 'vis-configuration vis-config-button hover'; + }; + generateButton.onmouseout = function () { + generateButton.className = 'vis-configuration vis-config-button'; + }; + this.optionsContainer = document.createElement('div'); + this.optionsContainer.className = 'vis-configuration vis-config-option-container'; + this.domElements.push(this.optionsContainer); + this.domElements.push(generateButton); + } + } + + /** + * prepare the popup + * @param {string} string + * @param {number} index + * @private + */ + }, { + key: "_setupPopup", + value: function _setupPopup(string, index) { + var _this2 = this; + if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) { + var div = document.createElement("div"); + div.id = "vis-configuration-popup"; + div.className = "vis-configuration-popup"; + div.innerHTML = availableUtils.xss(string); + div.onclick = function () { + _this2._removePopup(); + }; + this.popupCounter += 1; + this.popupDiv = { + html: div, + index: index + }; + } + } + + /** + * remove the popup from the dom + * @private + */ + }, { + key: "_removePopup", + value: function _removePopup() { + if (this.popupDiv.html !== undefined) { + this.popupDiv.html.parentNode.removeChild(this.popupDiv.html); + clearTimeout(this.popupDiv.hideTimeout); + clearTimeout(this.popupDiv.deleteTimeout); + this.popupDiv = {}; + } + } + + /** + * Show the popup if it is needed. + * @private + */ + }, { + key: "_showPopupIfNeeded", + value: function _showPopupIfNeeded() { + var _this3 = this; + if (this.popupDiv.html !== undefined) { + var correspondingElement = this.domElements[this.popupDiv.index]; + var rect = correspondingElement.getBoundingClientRect(); + this.popupDiv.html.style.left = rect.left + "px"; + this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height; + document.body.appendChild(this.popupDiv.html); + this.popupDiv.hideTimeout = _setTimeout(function () { + _this3.popupDiv.html.style.opacity = 0; + }, 1500); + this.popupDiv.deleteTimeout = _setTimeout(function () { + _this3._removePopup(); + }, 1800); + } + } + + /** + * make a checkbox for boolean options. + * @param {number} defaultValue + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeCheckbox", + value: function _makeCheckbox(defaultValue, value, path) { + var checkbox = document.createElement('input'); + checkbox.type = 'checkbox'; + checkbox.className = 'vis-configuration vis-config-checkbox'; + checkbox.checked = defaultValue; + if (value !== undefined) { + checkbox.checked = value; + if (value !== defaultValue) { + if (_typeof$1(defaultValue) === 'object') { + if (value !== defaultValue.enabled) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else { + this.changedOptions.push({ + path: path, + value: value + }); + } + } + } + var me = this; + checkbox.onchange = function () { + me._update(this.checked, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); + } + + /** + * make a text input field for string options. + * @param {number} defaultValue + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeTextInput", + value: function _makeTextInput(defaultValue, value, path) { + var checkbox = document.createElement('input'); + checkbox.type = 'text'; + checkbox.className = 'vis-configuration vis-config-text'; + checkbox.value = value; + if (value !== defaultValue) { + this.changedOptions.push({ + path: path, + value: value + }); + } + var me = this; + checkbox.onchange = function () { + me._update(this.value, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); + } + + /** + * make a color field with a color picker for color fields + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_makeColorField", + value: function _makeColorField(arr, value, path) { + var _this4 = this; + var defaultColor = arr[1]; + var div = document.createElement('div'); + value = value === undefined ? defaultColor : value; + if (value !== 'none') { + div.className = 'vis-configuration vis-config-colorBlock'; + div.style.backgroundColor = value; + } else { + div.className = 'vis-configuration vis-config-colorBlock none'; + } + value = value === undefined ? defaultColor : value; + div.onclick = function () { + _this4._showColorPicker(value, div, path); + }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, div); + } + + /** + * used by the color buttons to call the color picker. + * @param {number} value + * @param {HTMLElement} div + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_showColorPicker", + value: function _showColorPicker(value, div, path) { + var _this5 = this; + // clear the callback from this div + div.onclick = function () {}; + this.colorPicker.insertTo(div); + this.colorPicker.show(); + this.colorPicker.setColor(value); + this.colorPicker.setUpdateCallback(function (color) { + var colorString = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')'; + div.style.backgroundColor = colorString; + _this5._update(colorString, path); + }); + + // on close of the colorpicker, restore the callback. + this.colorPicker.setCloseCallback(function () { + div.onclick = function () { + _this5._showColorPicker(value, div, path); + }; + }); + } + + /** + * parse an object and draw the correct items + * @param {Object} obj + * @param {array} [path=[]] | where to look for the actual option + * @param {boolean} [checkOnly=false] + * @returns {boolean} + * @private + */ + }, { + key: "_handleObject", + value: function _handleObject(obj) { + var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var show = false; + var filter = _filterInstanceProperty(this.options); + var visibleInSet = false; + for (var subObj in obj) { + if (obj.hasOwnProperty(subObj)) { + show = true; + var item = obj[subObj]; + var newPath = availableUtils.copyAndExtendArray(path, subObj); + if (typeof filter === 'function') { + show = filter(subObj, path); + + // if needed we must go deeper into the object. + if (show === false) { + if (!_Array$isArray(item) && typeof item !== 'string' && typeof item !== 'boolean' && item instanceof Object) { + this.allowCreation = false; + show = this._handleObject(item, newPath, true); + this.allowCreation = checkOnly === false; + } + } + } + if (show !== false) { + visibleInSet = true; + var value = this._getValue(newPath); + if (_Array$isArray(item)) { + this._handleArray(item, value, newPath); + } else if (typeof item === 'string') { + this._makeTextInput(item, value, newPath); + } else if (typeof item === 'boolean') { + this._makeCheckbox(item, value, newPath); + } else if (item instanceof Object) { + // collapse the physics options that are not enabled + var draw = true; + if (_indexOfInstanceProperty(path).call(path, 'physics') !== -1) { + if (this.moduleOptions.physics.solver !== subObj) { + draw = false; + } + } + if (draw === true) { + // initially collapse options with an disabled enabled option. + if (item.enabled !== undefined) { + var enabledPath = availableUtils.copyAndExtendArray(newPath, 'enabled'); + var enabledValue = this._getValue(enabledPath); + if (enabledValue === true) { + var label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } else { + this._makeCheckbox(item, enabledValue, newPath); + } + } else { + var _label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, _label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } + } + } else { + console.error('dont know how to handle', item, subObj, newPath); + } + } + } + } + return visibleInSet; + } + + /** + * handle the array type of option + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_handleArray", + value: function _handleArray(arr, value, path) { + if (typeof arr[0] === 'string' && arr[0] === 'color') { + this._makeColorField(arr, value, path); + if (arr[1] !== value) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else if (typeof arr[0] === 'string') { + this._makeDropdown(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ + path: path, + value: value + }); + } + } else if (typeof arr[0] === 'number') { + this._makeRange(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ + path: path, + value: Number(value) + }); + } + } + } + + /** + * called to update the network with the new settings. + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + }, { + key: "_update", + value: function _update(value, path) { + var options = this._constructOptions(value, path); + if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) { + this.parent.body.emitter.emit("configChange", options); + } + this.initialized = true; + this.parent.setOptions(options); + } + + /** + * + * @param {string|Boolean} value + * @param {Array.} path + * @param {{}} optionsObj + * @returns {{}} + * @private + */ + }, { + key: "_constructOptions", + value: function _constructOptions(value, path) { + var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var pointer = optionsObj; + + // when dropdown boxes can be string or boolean, we typecast it into correct types + value = value === 'true' ? true : value; + value = value === 'false' ? false : value; + for (var i = 0; i < path.length; i++) { + if (path[i] !== 'global') { + if (pointer[path[i]] === undefined) { + pointer[path[i]] = {}; + } + if (i !== path.length - 1) { + pointer = pointer[path[i]]; + } else { + pointer[path[i]] = value; + } + } + } + return optionsObj; + } + + /** + * @private + */ + }, { + key: "_printOptions", + value: function _printOptions() { + var options = this.getOptions(); + this.optionsContainer.innerHTML = '
var options = ' + _JSON$stringify(options, null, 2) + '
'; + } + + /** + * + * @returns {{}} options + */ + }, { + key: "getOptions", + value: function getOptions() { + var options = {}; + for (var i = 0; i < this.changedOptions.length; i++) { + this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options); + } + return options; + } + }]); + return Configurator; + }(); + + function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** + * Create a timeline visualization + * @extends Core + */ + var Timeline = /*#__PURE__*/function (_Core) { + _inherits(Timeline, _Core); + var _super = _createSuper$1(Timeline); + /** + * @param {HTMLElement} container + * @param {vis.DataSet | vis.DataView | Array} [items] + * @param {vis.DataSet | vis.DataView | Array} [groups] + * @param {Object} [options] See Timeline.setOptions for the available options. + * @constructor Timeline + */ + function Timeline(container, items, groups, options) { + var _context2, _context3, _context4, _context5, _context6, _context7, _context8; + var _this; + _classCallCheck(this, Timeline); + _this = _super.call(this); + _this.initTime = new Date(); + _this.itemsDone = false; + if (!(_assertThisInitialized(_this) instanceof Timeline)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + // if the third element is options, the forth is groups (optionally); + if (!(_Array$isArray(groups) || isDataViewLike(groups)) && groups instanceof Object) { + var forthArgument = options; + options = groups; + groups = forthArgument; + } + + // TODO: REMOVE THIS in the next MAJOR release + // see https://github.com/almende/vis/issues/2511 + if (options && options.throttleRedraw) { + console.warn("Timeline option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); + } + var me = _assertThisInitialized(_this); + _this.defaultOptions = { + autoResize: true, + longSelectPressTime: 251, + orientation: { + axis: 'bottom', + // axis orientation: 'bottom', 'top', or 'both' + item: 'bottom' // not relevant + }, + + moment: moment$4 + }; + _this.options = availableUtils.deepExtend({}, _this.defaultOptions); + options && availableUtils.setupXSSProtection(options.xss); + + // Create the DOM, props, and emitter + _this._create(container); + if (!options || options && typeof options.rtl == "undefined") { + _this.dom.root.style.visibility = 'hidden'; + var directionFromDom; + var domNode = _this.dom.root; + while (!directionFromDom && domNode) { + directionFromDom = window.getComputedStyle(domNode, null).direction; + domNode = domNode.parentElement; + } + _this.options.rtl = directionFromDom && directionFromDom.toLowerCase() == "rtl"; + } else { + _this.options.rtl = options.rtl; + } + if (options) { + if (options.rollingMode) { + _this.options.rollingMode = options.rollingMode; + } + if (options.onInitialDrawComplete) { + _this.options.onInitialDrawComplete = options.onInitialDrawComplete; + } + if (options.onTimeout) { + _this.options.onTimeout = options.onTimeout; + } + if (options.loadingScreenTemplate) { + _this.options.loadingScreenTemplate = options.loadingScreenTemplate; + } + } + + // Prepare loading screen + var loadingScreenFragment = document.createElement('div'); + if (_this.options.loadingScreenTemplate) { + var _context; + var templateFunction = _bindInstanceProperty$1(_context = _this.options.loadingScreenTemplate).call(_context, _assertThisInitialized(_this)); + var loadingScreen = templateFunction(_this.dom.loadingScreen); + if (loadingScreen instanceof Object && !(loadingScreen instanceof Element)) { + templateFunction(loadingScreenFragment); + } else { + if (loadingScreen instanceof Element) { + loadingScreenFragment.innerHTML = ''; + loadingScreenFragment.appendChild(loadingScreen); + } else if (loadingScreen != undefined) { + loadingScreenFragment.innerHTML = availableUtils.xss(loadingScreen); + } + } + } + _this.dom.loadingScreen.appendChild(loadingScreenFragment); + + // all components listed here will be repainted automatically + _this.components = []; + _this.body = { + dom: _this.dom, + domProps: _this.props, + emitter: { + on: _bindInstanceProperty$1(_context2 = _this.on).call(_context2, _assertThisInitialized(_this)), + off: _bindInstanceProperty$1(_context3 = _this.off).call(_context3, _assertThisInitialized(_this)), + emit: _bindInstanceProperty$1(_context4 = _this.emit).call(_context4, _assertThisInitialized(_this)) + }, + hiddenDates: [], + util: { + getScale: function getScale() { + return me.timeAxis.step.scale; + }, + getStep: function getStep() { + return me.timeAxis.step.step; + }, + toScreen: _bindInstanceProperty$1(_context5 = me._toScreen).call(_context5, me), + toGlobalScreen: _bindInstanceProperty$1(_context6 = me._toGlobalScreen).call(_context6, me), + // this refers to the root.width + toTime: _bindInstanceProperty$1(_context7 = me._toTime).call(_context7, me), + toGlobalTime: _bindInstanceProperty$1(_context8 = me._toGlobalTime).call(_context8, me) + } + }; + + // range + _this.range = new Range(_this.body, _this.options); + _this.components.push(_this.range); + _this.body.range = _this.range; + + // time axis + _this.timeAxis = new TimeAxis(_this.body, _this.options); + _this.timeAxis2 = null; // used in case of orientation option 'both' + _this.components.push(_this.timeAxis); + + // current time bar + _this.currentTime = new CurrentTime(_this.body, _this.options); + _this.components.push(_this.currentTime); + + // item set + _this.itemSet = new ItemSet(_this.body, _this.options); + _this.components.push(_this.itemSet); + _this.itemsData = null; // DataSet + _this.groupsData = null; // DataSet + + function emit(eventName, event) { + if (!me.hasListeners(eventName)) { + return; + } + me.emit(eventName, me.getEventProperties(event)); + } + _this.dom.root.onclick = function (event) { + emit('click', event); + }; + _this.dom.root.ondblclick = function (event) { + emit('doubleClick', event); + }; + _this.dom.root.oncontextmenu = function (event) { + emit('contextmenu', event); + }; + _this.dom.root.onmouseover = function (event) { + emit('mouseOver', event); + }; + if (window.PointerEvent) { + _this.dom.root.onpointerdown = function (event) { + emit('mouseDown', event); + }; + _this.dom.root.onpointermove = function (event) { + emit('mouseMove', event); + }; + _this.dom.root.onpointerup = function (event) { + emit('mouseUp', event); + }; + } else { + _this.dom.root.onmousemove = function (event) { + emit('mouseMove', event); + }; + _this.dom.root.onmousedown = function (event) { + emit('mouseDown', event); + }; + _this.dom.root.onmouseup = function (event) { + emit('mouseUp', event); + }; + } + + //Single time autoscale/fit + _this.initialFitDone = false; + _this.on('changed', function () { + if (me.itemsData == null) return; + if (!me.initialFitDone && !me.options.rollingMode) { + me.initialFitDone = true; + if (me.options.start != undefined || me.options.end != undefined) { + if (me.options.start == undefined || me.options.end == undefined) { + var range = me.getItemRange(); + } + var start = me.options.start != undefined ? me.options.start : range.min; + var end = me.options.end != undefined ? me.options.end : range.max; + me.setWindow(start, end, { + animation: false + }); + } else { + me.fit({ + animation: false + }); + } + } + if (!me.initialDrawDone && (me.initialRangeChangeDone || !me.options.start && !me.options.end || me.options.rollingMode)) { + me.initialDrawDone = true; + me.itemSet.initialDrawDone = true; + me.dom.root.style.visibility = 'visible'; + me.dom.loadingScreen.parentNode.removeChild(me.dom.loadingScreen); + if (me.options.onInitialDrawComplete) { + _setTimeout(function () { + return me.options.onInitialDrawComplete(); + }, 0); + } + } + }); + _this.on('destroyTimeline', function () { + me.destroy(); + }); + + // apply options + if (options) { + _this.setOptions(options); + } + _this.body.emitter.on('fit', function (args) { + _this._onFit(args); + _this.redraw(); + }); + + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + _this.setGroups(groups); + } + + // create itemset + if (items) { + _this.setItems(items); + } + + // draw for the first time + _this._redraw(); + return _this; + } + + /** + * Load a configurator + * @return {Object} + * @private + */ + _createClass(Timeline, [{ + key: "_createConfigurator", + value: function _createConfigurator() { + return new Configurator(this, this.dom.container, configureOptions$1); + } + + /** + * Force a redraw. The size of all items will be recalculated. + * Can be useful to manually redraw when option autoResize=false and the window + * has been resized, or when the items CSS has been changed. + * + * Note: this function will be overridden on construction with a trottled version + */ + }, { + key: "redraw", + value: function redraw() { + this.itemSet && this.itemSet.markDirty({ + refreshItems: true + }); + this._redraw(); + } + + /** + * Remove an item from the group + * @param {object} options + */ + }, { + key: "setOptions", + value: function setOptions(options) { + // validate options + var errorFound = Validator.validate(options, allOptions$1); + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); + } + Core.prototype.setOptions.call(this, options); + if ('type' in options) { + if (options.type !== this.options.type) { + this.options.type = options.type; + + // force recreation of all items + var itemsData = this.itemsData; + if (itemsData) { + var selection = this.getSelection(); + this.setItems(null); // remove all + this.setItems(itemsData.rawDS); // add all + this.setSelection(selection); // restore selection + } + } + } + } + + /** + * Set items + * @param {vis.DataSet | Array | null} items + */ + }, { + key: "setItems", + value: function setItems(items) { + this.itemsDone = false; + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } else if (isDataViewLike(items)) { + newDataSet = typeCoerceDataSet(items); + } else { + // turn an array into a dataset + newDataSet = typeCoerceDataSet(new DataSet(items)); + } + + // set items + if (this.itemsData) { + // stop maintaining a coerced version of the old data set + this.itemsData.dispose(); + } + this.itemsData = newDataSet; + this.itemSet && this.itemSet.setItems(newDataSet != null ? newDataSet.rawDS : null); + } + + /** + * Set groups + * @param {vis.DataSet | Array} groups + */ + }, { + key: "setGroups", + value: function setGroups(groups) { + // convert to type DataSet when needed + var newDataSet; + var filter = function filter(group) { + return group.visible !== false; + }; + if (!groups) { + newDataSet = null; + } else { + // If groups is array, turn to DataSet & build dataview from that + if (_Array$isArray(groups)) groups = new DataSet(groups); + newDataSet = new DataView(groups, { + filter: filter + }); + } + + // This looks weird but it's necessary to prevent memory leaks. + // + // The problem is that the DataView will exist as long as the DataSet it's + // connected to. This will force it to swap the groups DataSet for it's own + // DataSet. In this arrangement it will become unreferenced from the outside + // and garbage collected. + // + // IMPORTANT NOTE: If `this.groupsData` is a DataView was created in this + // method. Even if the original is a DataView already a new one has been + // created and assigned to `this.groupsData`. In case this changes in the + // future it will be necessary to rework this!!!! + if (this.groupsData != null && typeof this.groupsData.setData === "function") { + this.groupsData.setData(null); + } + this.groupsData = newDataSet; + this.itemSet.setGroups(newDataSet); + } + + /** + * Set both items and groups in one go + * @param {{items: (Array | vis.DataSet), groups: (Array | vis.DataSet)}} data + */ + }, { + key: "setData", + value: function setData(data) { + if (data && data.groups) { + this.setGroups(data.groups); + } + if (data && data.items) { + this.setItems(data.items); + } + } + + /** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {string[] | string} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + * @param {Object} [options] Available options: + * `focus: boolean` + * If true, focus will be set to the selected item(s) + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * Only applicable when option focus is true. + */ + }, { + key: "setSelection", + value: function setSelection(ids, options) { + this.itemSet && this.itemSet.setSelection(ids); + if (options && options.focus) { + this.focus(ids, options); + } + } + + /** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ + }, { + key: "getSelection", + value: function getSelection() { + return this.itemSet && this.itemSet.getSelection() || []; + } + + /** + * Adjust the visible window such that the selected item (or multiple items) + * are centered on screen. + * @param {string | String[]} id An item id or array with item ids + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * `zoom: boolean` + * If true (default), the timeline will + * zoom on the element after focus it. + */ + }, { + key: "focus", + value: function focus(id, options) { + if (!this.itemsData || id == undefined) return; + var ids = _Array$isArray(id) ? id : [id]; + + // get the specified item(s) + var itemsData = this.itemsData.get(ids); + + // calculate minimum start and maximum end of specified items + var start = null; + var end = null; + _forEachInstanceProperty(itemsData).call(itemsData, function (itemData) { + var s = itemData.start.valueOf(); + var e = 'end' in itemData ? itemData.end.valueOf() : itemData.start.valueOf(); + if (start === null || s < start) { + start = s; + } + if (end === null || e > end) { + end = e; + } + }); + if (start !== null && end !== null) { + var me = this; + // Use the first item for the vertical focus + var item = this.itemSet.items[ids[0]]; + var startPos = this._getScrollTop() * -1; + var initialVerticalScroll = null; + + // Setup a handler for each frame of the vertical scroll + var verticalAnimationFrame = function verticalAnimationFrame(ease, willDraw, done) { + var verticalScroll = getItemVerticalScroll(me, item); + if (verticalScroll === false) { + return; // We don't need to scroll, so do nothing + } + + if (!initialVerticalScroll) { + initialVerticalScroll = verticalScroll; + } + if (initialVerticalScroll.itemTop == verticalScroll.itemTop && !initialVerticalScroll.shouldScroll) { + return; // We don't need to scroll, so do nothing + } else if (initialVerticalScroll.itemTop != verticalScroll.itemTop && verticalScroll.shouldScroll) { + // The redraw shifted elements, so reset the animation to correct + initialVerticalScroll = verticalScroll; + startPos = me._getScrollTop() * -1; + } + var from = startPos; + var to = initialVerticalScroll.scrollOffset; + var scrollTop = done ? to : from + (to - from) * ease; + me._setScrollTop(-scrollTop); + if (!willDraw) { + me._redraw(); + } + }; + + // Enforces the final vertical scroll position + var setFinalVerticalPosition = function setFinalVerticalPosition() { + var finalVerticalScroll = getItemVerticalScroll(me, item); + if (finalVerticalScroll.shouldScroll && finalVerticalScroll.itemTop != initialVerticalScroll.itemTop) { + me._setScrollTop(-finalVerticalScroll.scrollOffset); + me._redraw(); + } + }; + + // Perform one last check at the end to make sure the final vertical + // position is correct + var finalVerticalCallback = function finalVerticalCallback() { + // Double check we ended at the proper scroll position + setFinalVerticalPosition(); + + // Let the redraw settle and finalize the position. + _setTimeout(setFinalVerticalPosition, 100); + }; + + // calculate the new middle and interval for the window + var zoom = options && options.zoom !== undefined ? options.zoom : true; + var middle = (start + end) / 2; + var interval = zoom ? (end - start) * 1.1 : Math.max(this.range.end - this.range.start, (end - start) * 1.1); + var animation = options && options.animation !== undefined ? options.animation : true; + if (!animation) { + // We aren't animating so set a default so that the final callback forces the vertical location + initialVerticalScroll = { + shouldScroll: false, + scrollOffset: -1, + itemTop: -1 + }; + } + this.range.setRange(middle - interval / 2, middle + interval / 2, { + animation: animation + }, finalVerticalCallback, verticalAnimationFrame); + } + } + + /** + * Set Timeline window such that it fits all items + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] + */ + }, { + key: "fit", + value: function fit(options, callback) { + var animation = options && options.animation !== undefined ? options.animation : true; + var range; + if (this.itemsData.length === 1 && this.itemsData.get()[0].end === undefined) { + // a single item -> don't fit, just show a range around the item from -4 to +3 days + range = this.getDataRange(); + this.moveTo(range.min.valueOf(), { + animation: animation + }, callback); + } else { + // exactly fit the items (plus a small margin) + range = this.getItemRange(); + this.range.setRange(range.min, range.max, { + animation: animation + }, callback); + } + } + + /** + * Determine the range of the items, taking into account their actual width + * and a margin of 10 pixels on both sides. + * + * @returns {{min: Date, max: Date}} + */ + }, { + key: "getItemRange", + value: function getItemRange() { + var _this2 = this; + // get a rough approximation for the range based on the items start and end dates + var range = this.getDataRange(); + var min = range.min !== null ? range.min.valueOf() : null; + var max = range.max !== null ? range.max.valueOf() : null; + var minItem = null; + var maxItem = null; + if (min != null && max != null) { + var interval = max - min; // ms + if (interval <= 0) { + interval = 10; + } + var factor = interval / this.props.center.width; + var redrawQueue = {}; + var redrawQueueLength = 0; + + // collect redraw functions + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemSet.items, function (item, key) { + if (item.groupShowing) { + var returnQueue = true; + redrawQueue[key] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[key].length; + } + }); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + var _loop = function _loop(i) { + _forEachInstanceProperty(availableUtils).call(availableUtils, redrawQueue, function (fns) { + fns[i](); + }); + }; + // redraw all regular items + for (var i = 0; i < redrawQueueLength; i++) { + _loop(i); + } + } + + // calculate the date of the left side and right side of the items given + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemSet.items, function (item) { + var start = getStart(item); + var end = getEnd(item); + var startSide; + var endSide; + if (_this2.options.rtl) { + startSide = start - (item.getWidthRight() + 10) * factor; + endSide = end + (item.getWidthLeft() + 10) * factor; + } else { + startSide = start - (item.getWidthLeft() + 10) * factor; + endSide = end + (item.getWidthRight() + 10) * factor; + } + if (startSide < min) { + min = startSide; + minItem = item; + } + if (endSide > max) { + max = endSide; + maxItem = item; + } + }); + if (minItem && maxItem) { + var lhs = minItem.getWidthLeft() + 10; + var rhs = maxItem.getWidthRight() + 10; + var delta = this.props.center.width - lhs - rhs; // px + + if (delta > 0) { + if (this.options.rtl) { + min = getStart(minItem) - rhs * interval / delta; // ms + max = getEnd(maxItem) + lhs * interval / delta; // ms + } else { + min = getStart(minItem) - lhs * interval / delta; // ms + max = getEnd(maxItem) + rhs * interval / delta; // ms + } + } + } + } + + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; + } + + /** + * Calculate the data range of the items start and end dates + * @returns {{min: Date, max: Date}} + */ + }, { + key: "getDataRange", + value: function getDataRange() { + var min = null; + var max = null; + if (this.itemsData) { + var _context9; + _forEachInstanceProperty(_context9 = this.itemsData).call(_context9, function (item) { + var start = availableUtils.convert(item.start, 'Date').valueOf(); + var end = availableUtils.convert(item.end != undefined ? item.end : item.start, 'Date').valueOf(); + if (min === null || start < min) { + min = start; + } + if (max === null || end > max) { + max = end; + } + }); + } + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; + } + + /** + * Generate Timeline related information from an event + * @param {Event} event + * @return {Object} An object with related information, like on which area + * The event happened, whether clicked on an item, etc. + */ + }, { + key: "getEventProperties", + value: function getEventProperties(event) { + var clientX = event.center ? event.center.x : event.clientX; + var clientY = event.center ? event.center.y : event.clientY; + var centerContainerRect = this.dom.centerContainer.getBoundingClientRect(); + var x = this.options.rtl ? centerContainerRect.right - clientX : clientX - centerContainerRect.left; + var y = clientY - centerContainerRect.top; + var item = this.itemSet.itemFromTarget(event); + var group = this.itemSet.groupFromTarget(event); + var customTime = CustomTime.customTimeFromTarget(event); + var snap = this.itemSet.options.snap || null; + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var time = this._toTime(x); + var snappedTime = snap ? snap(time, scale, step) : time; + var element = availableUtils.getTarget(event); + var what = null; + if (item != null) { + what = 'item'; + } else if (customTime != null) { + what = 'custom-time'; + } else if (availableUtils.hasParent(element, this.timeAxis.dom.foreground)) { + what = 'axis'; + } else if (this.timeAxis2 && availableUtils.hasParent(element, this.timeAxis2.dom.foreground)) { + what = 'axis'; + } else if (availableUtils.hasParent(element, this.itemSet.dom.labelSet)) { + what = 'group-label'; + } else if (availableUtils.hasParent(element, this.currentTime.bar)) { + what = 'current-time'; + } else if (availableUtils.hasParent(element, this.dom.center)) { + what = 'background'; + } + return { + event: event, + item: item ? item.id : null, + isCluster: item ? !!item.isCluster : false, + items: item ? item.items || [] : null, + group: group ? group.groupId : null, + customTime: customTime ? customTime.options.id : null, + what: what, + pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, + pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, + x: x, + y: y, + time: time, + snappedTime: snappedTime + }; + } + + /** + * Toggle Timeline rolling mode + */ + }, { + key: "toggleRollingMode", + value: function toggleRollingMode() { + if (this.range.rolling) { + this.range.stopRolling(); + } else { + if (this.options.rollingMode == undefined) { + this.setOptions(this.options); + } + this.range.startRolling(); + } + } + + /** + * redraw + * @private + */ + }, { + key: "_redraw", + value: function _redraw() { + Core.prototype._redraw.call(this); + } + + /** + * on fit callback + * @param {object} args + * @private + */ + }, { + key: "_onFit", + value: function _onFit(args) { + var start = args.start, + end = args.end, + animation = args.animation; + if (!end) { + this.moveTo(start.valueOf(), { + animation: animation + }); + } else { + this.range.setRange(start, end, { + animation: animation + }); + } + } + }]); + return Timeline; + }(Core); + function getStart(item) { + return availableUtils.convert(item.data.start, 'Date').valueOf(); + } + + /** + * + * @param {timeline.Item} item + * @returns {number} + */ + function getEnd(item) { + var end = item.data.end != undefined ? item.data.end : item.data.start; + return availableUtils.convert(end, 'Date').valueOf(); + } + + /** + * @param {vis.Timeline} timeline + * @param {timeline.Item} item + * @return {{shouldScroll: bool, scrollOffset: number, itemTop: number}} + */ + function getItemVerticalScroll(timeline, item) { + if (!item.parent) { + // The item no longer exists, so ignore this focus. + return false; + } + var itemsetHeight = timeline.options.rtl ? timeline.props.rightContainer.height : timeline.props.leftContainer.height; + var contentHeight = timeline.props.center.height; + var group = item.parent; + var offset = group.top; + var shouldScroll = true; + var orientation = timeline.timeAxis.options.orientation.axis; + var itemTop = function itemTop() { + if (orientation == "bottom") { + return group.height - item.top - item.height; + } else { + return item.top; + } + }; + var currentScrollHeight = timeline._getScrollTop() * -1; + var targetOffset = offset + itemTop(); + var height = item.height; + if (targetOffset < currentScrollHeight) { + if (offset + itemsetHeight <= offset + itemTop() + height) { + offset += itemTop() - timeline.itemSet.options.margin.item.vertical; + } + } else if (targetOffset + height > currentScrollHeight + itemsetHeight) { + offset += itemTop() + height - itemsetHeight + timeline.itemSet.options.margin.item.vertical; + } else { + shouldScroll = false; + } + offset = Math.min(offset, contentHeight - itemsetHeight); + return { + shouldScroll: shouldScroll, + scrollOffset: offset, + itemTop: targetOffset + }; + } + + /** DataScale */ + var DataScale = /*#__PURE__*/function () { + /** + * + * @param {number} start + * @param {number} end + * @param {boolean} autoScaleStart + * @param {boolean} autoScaleEnd + * @param {number} containerHeight + * @param {number} majorCharHeight + * @param {boolean} zeroAlign + * @param {function} formattingFunction + * @constructor DataScale + */ + function DataScale(start, end, autoScaleStart, autoScaleEnd, containerHeight, majorCharHeight) { + var zeroAlign = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; + var formattingFunction = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false; + _classCallCheck(this, DataScale); + this.majorSteps = [1, 2, 5, 10]; + this.minorSteps = [0.25, 0.5, 1, 2]; + this.customLines = null; + this.containerHeight = containerHeight; + this.majorCharHeight = majorCharHeight; + this._start = start; + this._end = end; + this.scale = 1; + this.minorStepIdx = -1; + this.magnitudefactor = 1; + this.determineScale(); + this.zeroAlign = zeroAlign; + this.autoScaleStart = autoScaleStart; + this.autoScaleEnd = autoScaleEnd; + this.formattingFunction = formattingFunction; + if (autoScaleStart || autoScaleEnd) { + var me = this; + var roundToMinor = function roundToMinor(value) { + var rounded = value - value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]); + if (value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]) > 0.5 * (me.magnitudefactor * me.minorSteps[me.minorStepIdx])) { + return rounded + me.magnitudefactor * me.minorSteps[me.minorStepIdx]; + } else { + return rounded; + } + }; + if (autoScaleStart) { + this._start -= this.magnitudefactor * 2 * this.minorSteps[this.minorStepIdx]; + this._start = roundToMinor(this._start); + } + if (autoScaleEnd) { + this._end += this.magnitudefactor * this.minorSteps[this.minorStepIdx]; + this._end = roundToMinor(this._end); + } + this.determineScale(); + } + } + + /** + * set chart height + * @param {number} majorCharHeight + */ + _createClass(DataScale, [{ + key: "setCharHeight", + value: function setCharHeight(majorCharHeight) { + this.majorCharHeight = majorCharHeight; + } + + /** + * set height + * @param {number} containerHeight + */ + }, { + key: "setHeight", + value: function setHeight(containerHeight) { + this.containerHeight = containerHeight; + } + + /** + * determine scale + */ + }, { + key: "determineScale", + value: function determineScale() { + var range = this._end - this._start; + this.scale = this.containerHeight / range; + var minimumStepValue = this.majorCharHeight / this.scale; + var orderOfMagnitude = range > 0 ? Math.round(Math.log(range) / Math.LN10) : 0; + this.minorStepIdx = -1; + this.magnitudefactor = Math.pow(10, orderOfMagnitude); + var start = 0; + if (orderOfMagnitude < 0) { + start = orderOfMagnitude; + } + var solutionFound = false; + for (var l = start; Math.abs(l) <= Math.abs(orderOfMagnitude); l++) { + this.magnitudefactor = Math.pow(10, l); + for (var j = 0; j < this.minorSteps.length; j++) { + var stepSize = this.magnitudefactor * this.minorSteps[j]; + if (stepSize >= minimumStepValue) { + solutionFound = true; + this.minorStepIdx = j; + break; + } + } + if (solutionFound === true) { + break; + } + } + } + + /** + * returns if value is major + * @param {number} value + * @returns {boolean} + */ + }, { + key: "is_major", + value: function is_major(value) { + return value % (this.magnitudefactor * this.majorSteps[this.minorStepIdx]) === 0; + } + + /** + * returns step size + * @returns {number} + */ + }, { + key: "getStep", + value: function getStep() { + return this.magnitudefactor * this.minorSteps[this.minorStepIdx]; + } + + /** + * returns first major + * @returns {number} + */ + }, { + key: "getFirstMajor", + value: function getFirstMajor() { + var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; + return this.convertValue(this._start + (majorStep - this._start % majorStep) % majorStep); + } + + /** + * returns first major + * @param {date} current + * @returns {date} formatted date + */ + }, { + key: "formatValue", + value: function formatValue(current) { + var returnValue = current.toPrecision(5); + if (typeof this.formattingFunction === 'function') { + returnValue = this.formattingFunction(current); + } + if (typeof returnValue === 'number') { + return "".concat(returnValue); + } else if (typeof returnValue === 'string') { + return returnValue; + } else { + return current.toPrecision(5); + } + } + + /** + * returns lines + * @returns {object} lines + */ + }, { + key: "getLines", + value: function getLines() { + var lines = []; + var step = this.getStep(); + var bottomOffset = (step - this._start % step) % step; + for (var i = this._start + bottomOffset; this._end - i > 0.00001; i += step) { + if (i != this._start) { + //Skip the bottom line + lines.push({ + major: this.is_major(i), + y: this.convertValue(i), + val: this.formatValue(i) + }); + } + } + return lines; + } + + /** + * follow scale + * @param {object} other + */ + }, { + key: "followScale", + value: function followScale(other) { + var oldStepIdx = this.minorStepIdx; + var oldStart = this._start; + var oldEnd = this._end; + var me = this; + var increaseMagnitude = function increaseMagnitude() { + me.magnitudefactor *= 2; + }; + var decreaseMagnitude = function decreaseMagnitude() { + me.magnitudefactor /= 2; + }; + if (other.minorStepIdx <= 1 && this.minorStepIdx <= 1 || other.minorStepIdx > 1 && this.minorStepIdx > 1) ; else if (other.minorStepIdx < this.minorStepIdx) { + //I'm 5, they are 4 per major. + this.minorStepIdx = 1; + if (oldStepIdx == 2) { + increaseMagnitude(); + } else { + increaseMagnitude(); + increaseMagnitude(); + } + } else { + //I'm 4, they are 5 per major + this.minorStepIdx = 2; + if (oldStepIdx == 1) { + decreaseMagnitude(); + } else { + decreaseMagnitude(); + decreaseMagnitude(); + } + } + + //Get masters stats: + var otherZero = other.convertValue(0); + var otherStep = other.getStep() * other.scale; + var done = false; + var count = 0; + //Loop until magnitude is correct for given constrains. + while (!done && count++ < 5) { + //Get my stats: + this.scale = otherStep / (this.minorSteps[this.minorStepIdx] * this.magnitudefactor); + var newRange = this.containerHeight / this.scale; + + //For the case the magnitudefactor has changed: + this._start = oldStart; + this._end = this._start + newRange; + var myOriginalZero = this._end * this.scale; + var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; + var majorOffset = this.getFirstMajor() - other.getFirstMajor(); + if (this.zeroAlign) { + var zeroOffset = otherZero - myOriginalZero; + this._end += zeroOffset / this.scale; + this._start = this._end - newRange; + } else { + if (!this.autoScaleStart) { + this._start += majorStep - majorOffset / this.scale; + this._end = this._start + newRange; + } else { + this._start -= majorOffset / this.scale; + this._end = this._start + newRange; + } + } + if (!this.autoScaleEnd && this._end > oldEnd + 0.00001) { + //Need to decrease magnitude to prevent scale overshoot! (end) + decreaseMagnitude(); + done = false; + continue; + } + if (!this.autoScaleStart && this._start < oldStart - 0.00001) { + if (this.zeroAlign && oldStart >= 0) { + console.warn("Can't adhere to given 'min' range, due to zeroalign"); + } else { + //Need to decrease magnitude to prevent scale overshoot! (start) + decreaseMagnitude(); + done = false; + continue; + } + } + if (this.autoScaleStart && this.autoScaleEnd && newRange < oldEnd - oldStart) { + increaseMagnitude(); + done = false; + continue; + } + done = true; + } + } + + /** + * convert value + * @param {number} value + * @returns {number} + */ + }, { + key: "convertValue", + value: function convertValue(value) { + return this.containerHeight - (value - this._start) * this.scale; + } + + /** + * returns screen to value + * @param {number} pixels + * @returns {number} + */ + }, { + key: "screenToValue", + value: function screenToValue(pixels) { + return (this.containerHeight - pixels) / this.scale + this._start; + } + }]); + return DataScale; + }(); + + var css_248z = "\n.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal {\n position: absolute;\n width: 100%;\n height: 0;\n border-bottom: 1px solid;\n}\n\n.vis-panel.vis-background.vis-horizontal .vis-grid.vis-minor {\n border-color: #e5e5e5;\n}\n\n.vis-panel.vis-background.vis-horizontal .vis-grid.vis-major {\n border-color: #bfbfbf;\n}\n\n\n.vis-data-axis .vis-y-axis.vis-major {\n width: 100%;\n position: absolute;\n color: #4d4d4d;\n white-space: nowrap;\n}\n\n.vis-data-axis .vis-y-axis.vis-major.vis-measure {\n padding: 0;\n margin: 0;\n border: 0;\n visibility: hidden;\n width: auto;\n}\n\n\n.vis-data-axis .vis-y-axis.vis-minor {\n position: absolute;\n width: 100%;\n color: #bebebe;\n white-space: nowrap;\n}\n\n.vis-data-axis .vis-y-axis.vis-minor.vis-measure {\n padding: 0;\n margin: 0;\n border: 0;\n visibility: hidden;\n width: auto;\n}\n\n.vis-data-axis .vis-y-axis.vis-title {\n position: absolute;\n color: #4d4d4d;\n white-space: nowrap;\n bottom: 20px;\n text-align: center;\n}\n\n.vis-data-axis .vis-y-axis.vis-title.vis-measure {\n padding: 0;\n margin: 0;\n visibility: hidden;\n width: auto;\n}\n\n.vis-data-axis .vis-y-axis.vis-title.vis-left {\n bottom: 0;\n -webkit-transform-origin: left top;\n -moz-transform-origin: left top;\n -ms-transform-origin: left top;\n -o-transform-origin: left top;\n transform-origin: left bottom;\n -webkit-transform: rotate(-90deg);\n -moz-transform: rotate(-90deg);\n -ms-transform: rotate(-90deg);\n -o-transform: rotate(-90deg);\n transform: rotate(-90deg);\n}\n\n.vis-data-axis .vis-y-axis.vis-title.vis-right {\n bottom: 0;\n -webkit-transform-origin: right bottom;\n -moz-transform-origin: right bottom;\n -ms-transform-origin: right bottom;\n -o-transform-origin: right bottom;\n transform-origin: right bottom;\n -webkit-transform: rotate(90deg);\n -moz-transform: rotate(90deg);\n -ms-transform: rotate(90deg);\n -o-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.vis-legend {\n background-color: rgba(247, 252, 255, 0.65);\n padding: 5px;\n border: 1px solid #b3b3b3;\n box-shadow: 2px 2px 10px rgba(154, 154, 154, 0.55);\n}\n\n.vis-legend-text {\n /*font-size: 10px;*/\n white-space: nowrap;\n display: inline-block\n}"; + styleInject(css_248z); + + function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from$1(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } + function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + + /** A horizontal time axis */ + var DataAxis = /*#__PURE__*/function (_Component) { + _inherits(DataAxis, _Component); + var _super = _createSuper(DataAxis); + /** + * @param {Object} body + * @param {Object} [options] See DataAxis.setOptions for the available + * options. + * @param {SVGElement} svg + * @param {timeline.LineGraph.options} linegraphOptions + * @constructor DataAxis + * @extends Component + */ + function DataAxis(body, options, svg, linegraphOptions) { + var _this; + _classCallCheck(this, DataAxis); + _this = _super.call(this); + _this.id = v4(); + _this.body = body; + _this.defaultOptions = { + orientation: 'left', + // supported: 'left', 'right' + showMinorLabels: true, + showMajorLabels: true, + showWeekScale: false, + icons: false, + majorLinesOffset: 7, + minorLinesOffset: 4, + labelOffsetX: 10, + labelOffsetY: 2, + iconWidth: 20, + width: '40px', + visible: true, + alignZeros: true, + left: { + range: { + min: undefined, + max: undefined + }, + format: function format(value) { + return "".concat(_parseFloat$1(value.toPrecision(3))); + }, + title: { + text: undefined, + style: undefined + } + }, + right: { + range: { + min: undefined, + max: undefined + }, + format: function format(value) { + return "".concat(_parseFloat$1(value.toPrecision(3))); + }, + title: { + text: undefined, + style: undefined + } + } + }; + _this.linegraphOptions = linegraphOptions; + _this.linegraphSVG = svg; + _this.props = {}; + _this.DOMelements = { + // dynamic elements + lines: {}, + labels: {}, + title: {} + }; + _this.dom = {}; + _this.scale = undefined; + _this.range = { + start: 0, + end: 0 + }; + _this.options = availableUtils.extend({}, _this.defaultOptions); + _this.conversionFactor = 1; + _this.setOptions(options); + _this.width = Number("".concat(_this.options.width).replace("px", "")); + _this.minWidth = _this.width; + _this.height = _this.linegraphSVG.getBoundingClientRect().height; + _this.hidden = false; + _this.stepPixels = 25; + _this.zeroCrossing = -1; + _this.amountOfSteps = -1; + _this.lineOffset = 0; + _this.master = true; + _this.masterAxis = null; + _this.svgElements = {}; + _this.iconsRemoved = false; + _this.groups = {}; + _this.amountOfGroups = 0; + + // create the HTML DOM + _this._create(); + if (_this.scale == undefined) { + _this._redrawLabels(); + } + _this.framework = { + svg: _this.svg, + svgElements: _this.svgElements, + options: _this.options, + groups: _this.groups + }; + var me = _assertThisInitialized(_this); + _this.body.emitter.on("verticalDrag", function () { + me.dom.lineContainer.style.top = "".concat(me.body.domProps.scrollTop, "px"); + }); + return _this; + } + + /** + * Adds group to data axis + * @param {string} label + * @param {object} graphOptions + */ + _createClass(DataAxis, [{ + key: "addGroup", + value: function addGroup(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + } + + /** + * updates group of data axis + * @param {string} label + * @param {object} graphOptions + */ + }, { + key: "updateGroup", + value: function updateGroup(label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.amountOfGroups += 1; + } + this.groups[label] = graphOptions; + } + + /** + * removes group of data axis + * @param {string} label + */ + }, { + key: "removeGroup", + value: function removeGroup(label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + } + + /** + * sets options + * @param {object} options + */ + }, { + key: "setOptions", + value: function setOptions(options) { + if (options) { + var redraw = false; + if (this.options.orientation != options.orientation && options.orientation !== undefined) { + redraw = true; + } + var fields = ['orientation', 'showMinorLabels', 'showMajorLabels', 'icons', 'majorLinesOffset', 'minorLinesOffset', 'labelOffsetX', 'labelOffsetY', 'iconWidth', 'width', 'visible', 'left', 'right', 'alignZeros']; + availableUtils.selectiveDeepExtend(fields, this.options, options); + this.minWidth = Number("".concat(this.options.width).replace("px", "")); + if (redraw === true && this.dom.frame) { + this.hide(); + this.show(); + } + } + } + + /** + * Create the HTML DOM for the DataAxis + */ + }, { + key: "_create", + value: function _create() { + this.dom.frame = document.createElement('div'); + this.dom.frame.style.width = this.options.width; + this.dom.frame.style.height = this.height; + this.dom.lineContainer = document.createElement('div'); + this.dom.lineContainer.style.width = '100%'; + this.dom.lineContainer.style.height = this.height; + this.dom.lineContainer.style.position = 'relative'; + this.dom.lineContainer.style.visibility = 'visible'; + this.dom.lineContainer.style.display = 'block'; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + this.svg.style.position = "absolute"; + this.svg.style.top = '0px'; + this.svg.style.height = '100%'; + this.svg.style.width = '100%'; + this.svg.style.display = "block"; + this.dom.frame.appendChild(this.svg); + } + + /** + * redraws groups icons + */ + }, { + key: "_redrawGroupIcons", + value: function _redrawGroupIcons() { + prepareElements(this.svgElements); + var x; + var iconWidth = this.options.iconWidth; + var iconHeight = 15; + var iconOffset = 4; + var y = iconOffset + 0.5 * iconHeight; + if (this.options.orientation === 'left') { + x = iconOffset; + } else { + x = this.width - iconWidth - iconOffset; + } + var groupArray = _Object$keys(this.groups); + _sortInstanceProperty(groupArray).call(groupArray, function (a, b) { + return a < b ? -1 : 1; + }); + var _iterator = _createForOfIteratorHelper(groupArray), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var groupId = _step.value; + if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { + this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); + y += iconHeight + iconOffset; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + cleanupElements(this.svgElements); + this.iconsRemoved = false; + } + + /** + * Cleans up icons + */ + }, { + key: "_cleanupIcons", + value: function _cleanupIcons() { + if (this.iconsRemoved === false) { + prepareElements(this.svgElements); + cleanupElements(this.svgElements); + this.iconsRemoved = true; + } + } + + /** + * Create the HTML DOM for the DataAxis + */ + }, { + key: "show", + value: function show() { + this.hidden = false; + if (!this.dom.frame.parentNode) { + if (this.options.orientation === 'left') { + this.body.dom.left.appendChild(this.dom.frame); + } else { + this.body.dom.right.appendChild(this.dom.frame); + } + } + if (!this.dom.lineContainer.parentNode) { + this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); + } + this.dom.lineContainer.style.display = 'block'; + } + + /** + * Create the HTML DOM for the DataAxis + */ + }, { + key: "hide", + value: function hide() { + this.hidden = true; + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + this.dom.lineContainer.style.display = 'none'; + } + + /** + * Set a range (start and end) + * @param {number} start + * @param {number} end + */ + }, { + key: "setRange", + value: function setRange(start, end) { + this.range.start = start; + this.range.end = end; + } + + /** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ + }, { + key: "redraw", + value: function redraw() { + var resized = false; + var activeGroups = 0; + + // Make sure the line container adheres to the vertical scrolling. + this.dom.lineContainer.style.top = "".concat(this.body.domProps.scrollTop, "px"); + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { + activeGroups++; + } + } + } + if (this.amountOfGroups === 0 || activeGroups === 0) { + this.hide(); + } else { + this.show(); + this.height = Number(this.linegraphSVG.style.height.replace("px", "")); + + // svg offsetheight did not work in firefox and explorer... + this.dom.lineContainer.style.height = "".concat(this.height, "px"); + this.width = this.options.visible === true ? Number("".concat(this.options.width).replace("px", "")) : 0; + var props = this.props; + var frame = this.dom.frame; + + // update classname + frame.className = 'vis-data-axis'; + + // calculate character width and height + this._calculateCharSize(); + var orientation = this.options.orientation; + var showMinorLabels = this.options.showMinorLabels; + var showMajorLabels = this.options.showMajorLabels; + var backgroundHorizontalOffsetWidth = this.body.dom.backgroundHorizontal.offsetWidth; + + // determine the width and height of the elements for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + props.minorLineWidth = backgroundHorizontalOffsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; + props.minorLineHeight = 1; + props.majorLineWidth = backgroundHorizontalOffsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; + props.majorLineHeight = 1; + + // take frame offline while updating (is almost twice as fast) + if (orientation === 'left') { + frame.style.top = '0'; + frame.style.left = '0'; + frame.style.bottom = ''; + frame.style.width = "".concat(this.width, "px"); + frame.style.height = "".concat(this.height, "px"); + this.props.width = this.body.domProps.left.width; + this.props.height = this.body.domProps.left.height; + } else { + // right + frame.style.top = ''; + frame.style.bottom = '0'; + frame.style.left = '0'; + frame.style.width = "".concat(this.width, "px"); + frame.style.height = "".concat(this.height, "px"); + this.props.width = this.body.domProps.right.width; + this.props.height = this.body.domProps.right.height; + } + resized = this._redrawLabels(); + resized = this._isResized() || resized; + if (this.options.icons === true) { + this._redrawGroupIcons(); + } else { + this._cleanupIcons(); + } + this._redrawTitle(orientation); + } + return resized; + } + + /** + * Repaint major and minor text labels and vertical grid lines + * + * @returns {boolean} + * @private + */ + }, { + key: "_redrawLabels", + value: function _redrawLabels() { + var _this2 = this; + var resized = false; + prepareElements(this.DOMelements.lines); + prepareElements(this.DOMelements.labels); + var orientation = this.options['orientation']; + var customRange = this.options[orientation].range != undefined ? this.options[orientation].range : {}; + + //Override range with manual options: + var autoScaleEnd = true; + if (customRange.max != undefined) { + this.range.end = customRange.max; + autoScaleEnd = false; + } + var autoScaleStart = true; + if (customRange.min != undefined) { + this.range.start = customRange.min; + autoScaleStart = false; + } + this.scale = new DataScale(this.range.start, this.range.end, autoScaleStart, autoScaleEnd, this.dom.frame.offsetHeight, this.props.majorCharHeight, this.options.alignZeros, this.options[orientation].format); + if (this.master === false && this.masterAxis != undefined) { + this.scale.followScale(this.masterAxis.scale); + this.dom.lineContainer.style.display = 'none'; + } else { + this.dom.lineContainer.style.display = 'block'; + } + + //Is updated in side-effect of _redrawLabel(): + this.maxLabelSize = 0; + var lines = this.scale.getLines(); + _forEachInstanceProperty(lines).call(lines, function (line) { + var y = line.y; + var isMajor = line.major; + if (_this2.options['showMinorLabels'] && isMajor === false) { + _this2._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-minor', _this2.props.minorCharHeight); + } + if (isMajor) { + if (y >= 0) { + _this2._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-major', _this2.props.majorCharHeight); + } + } + if (_this2.master === true) { + if (isMajor) { + _this2._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', _this2.options.majorLinesOffset, _this2.props.majorLineWidth); + } else { + _this2._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', _this2.options.minorLinesOffset, _this2.props.minorLineWidth); + } + } + }); + + // Note that title is rotated, so we're using the height, not width! + var titleWidth = 0; + if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { + titleWidth = this.props.titleCharHeight; + } + var offset = this.options.icons === true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15; + + // this will resize the yAxis to accommodate the labels. + if (this.maxLabelSize > this.width - offset && this.options.visible === true) { + this.width = this.maxLabelSize + offset; + this.options.width = "".concat(this.width, "px"); + cleanupElements(this.DOMelements.lines); + cleanupElements(this.DOMelements.labels); + this.redraw(); + resized = true; + } + // this will resize the yAxis if it is too big for the labels. + else if (this.maxLabelSize < this.width - offset && this.options.visible === true && this.width > this.minWidth) { + this.width = Math.max(this.minWidth, this.maxLabelSize + offset); + this.options.width = "".concat(this.width, "px"); + cleanupElements(this.DOMelements.lines); + cleanupElements(this.DOMelements.labels); + this.redraw(); + resized = true; + } else { + cleanupElements(this.DOMelements.lines); + cleanupElements(this.DOMelements.labels); + resized = false; + } + return resized; + } + + /** + * converts value + * @param {number} value + * @returns {number} converted number + */ + }, { + key: "convertValue", + value: function convertValue(value) { + return this.scale.convertValue(value); + } + + /** + * converts value + * @param {number} x + * @returns {number} screen value + */ + }, { + key: "screenToValue", + value: function screenToValue(x) { + return this.scale.screenToValue(x); + } + + /** + * Create a label for the axis at position x + * + * @param {number} y + * @param {string} text + * @param {'top'|'right'|'bottom'|'left'} orientation + * @param {string} className + * @param {number} characterHeight + * @private + */ + }, { + key: "_redrawLabel", + value: function _redrawLabel(y, text, orientation, className, characterHeight) { + // reuse redundant label + var label = getDOMElement('div', this.DOMelements.labels, this.dom.frame); //this.dom.redundant.labels.shift(); + label.className = className; + label.innerHTML = availableUtils.xss(text); + if (orientation === 'left') { + label.style.left = "-".concat(this.options.labelOffsetX, "px"); + label.style.textAlign = "right"; + } else { + label.style.right = "-".concat(this.options.labelOffsetX, "px"); + label.style.textAlign = "left"; + } + label.style.top = "".concat(y - 0.5 * characterHeight + this.options.labelOffsetY, "px"); + text += ''; + var largestWidth = Math.max(this.props.majorCharWidth, this.props.minorCharWidth); + if (this.maxLabelSize < text.length * largestWidth) { + this.maxLabelSize = text.length * largestWidth; + } + } + + /** + * Create a minor line for the axis at position y + * @param {number} y + * @param {'top'|'right'|'bottom'|'left'} orientation + * @param {string} className + * @param {number} offset + * @param {number} width + */ + }, { + key: "_redrawLine", + value: function _redrawLine(y, orientation, className, offset, width) { + if (this.master === true) { + var line = getDOMElement('div', this.DOMelements.lines, this.dom.lineContainer); //this.dom.redundant.lines.shift(); + line.className = className; + line.innerHTML = ''; + if (orientation === 'left') { + line.style.left = "".concat(this.width - offset, "px"); + } else { + line.style.right = "".concat(this.width - offset, "px"); + } + line.style.width = "".concat(width, "px"); + line.style.top = "".concat(y, "px"); + } + } + + /** + * Create a title for the axis + * @private + * @param {'top'|'right'|'bottom'|'left'} orientation + */ + }, { + key: "_redrawTitle", + value: function _redrawTitle(orientation) { + prepareElements(this.DOMelements.title); + + // Check if the title is defined for this axes + if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { + var title = getDOMElement('div', this.DOMelements.title, this.dom.frame); + title.className = "vis-y-axis vis-title vis-".concat(orientation); + title.innerHTML = availableUtils.xss(this.options[orientation].title.text); + + // Add style - if provided + if (this.options[orientation].title.style !== undefined) { + availableUtils.addCssText(title, this.options[orientation].title.style); + } + if (orientation === 'left') { + title.style.left = "".concat(this.props.titleCharHeight, "px"); + } else { + title.style.right = "".concat(this.props.titleCharHeight, "px"); + } + title.style.width = "".concat(this.height, "px"); + } + + // we need to clean up in case we did not use all elements. + cleanupElements(this.DOMelements.title); + } + + /** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ + }, { + key: "_calculateCharSize", + value: function _calculateCharSize() { + // determine the char width and height on the minor axis + if (!('minorCharHeight' in this.props)) { + var textMinor = document.createTextNode('0'); + var measureCharMinor = document.createElement('div'); + measureCharMinor.className = 'vis-y-axis vis-minor vis-measure'; + measureCharMinor.appendChild(textMinor); + this.dom.frame.appendChild(measureCharMinor); + this.props.minorCharHeight = measureCharMinor.clientHeight; + this.props.minorCharWidth = measureCharMinor.clientWidth; + this.dom.frame.removeChild(measureCharMinor); + } + if (!('majorCharHeight' in this.props)) { + var textMajor = document.createTextNode('0'); + var measureCharMajor = document.createElement('div'); + measureCharMajor.className = 'vis-y-axis vis-major vis-measure'; + measureCharMajor.appendChild(textMajor); + this.dom.frame.appendChild(measureCharMajor); + this.props.majorCharHeight = measureCharMajor.clientHeight; + this.props.majorCharWidth = measureCharMajor.clientWidth; + this.dom.frame.removeChild(measureCharMajor); + } + if (!('titleCharHeight' in this.props)) { + var textTitle = document.createTextNode('0'); + var measureCharTitle = document.createElement('div'); + measureCharTitle.className = 'vis-y-axis vis-title vis-measure'; + measureCharTitle.appendChild(textTitle); + this.dom.frame.appendChild(measureCharTitle); + this.props.titleCharHeight = measureCharTitle.clientHeight; + this.props.titleCharWidth = measureCharTitle.clientWidth; + this.dom.frame.removeChild(measureCharTitle); + } + } + }]); + return DataAxis; + }(Component); + + /** + * + * @param {number | string} groupId + * @param {Object} options // TODO: Describe options + * + * @constructor Points + */ + function Points(groupId, options) {// eslint-disable-line no-unused-vars + } + + /** + * draw the data points + * + * @param {Array} dataset + * @param {GraphGroup} group + * @param {Object} framework | SVG DOM element + * @param {number} [offset] + */ + Points.draw = function (dataset, group, framework, offset) { + offset = offset || 0; + var callback = getCallback(framework, group); + for (var i = 0; i < dataset.length; i++) { + if (!callback) { + // draw the point the simple way. + drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group), framework.svgElements, framework.svg, dataset[i].label); + } else { + var callbackResult = callback(dataset[i], group); // result might be true, false or an object + if (callbackResult === true || _typeof$1(callbackResult) === 'object') { + drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group, callbackResult), framework.svgElements, framework.svg, dataset[i].label); + } + } + } + }; + Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; + var outline = getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); + + //Don't call callback on icon + drawPoint(x + 0.5 * iconWidth, y, getGroupTemplate(group), framework.svgElements, framework.svg); + }; + + /** + * + * @param {vis.Group} group + * @param {any} callbackResult + * @returns {{style: *, styles: (*|string), size: *, className: *}} + */ + function getGroupTemplate(group, callbackResult) { + callbackResult = typeof callbackResult === 'undefined' ? {} : callbackResult; + return { + style: callbackResult.style || group.options.drawPoints.style, + styles: callbackResult.styles || group.options.drawPoints.styles, + size: callbackResult.size || group.options.drawPoints.size, + className: callbackResult.className || group.className + }; + } + + /** + * + * @param {Object} framework | SVG DOM element + * @param {vis.Group} group + * @returns {function} + */ + function getCallback(framework, group) { + var callback = undefined; + // check for the graph2d onRender + if (framework.options && framework.options.drawPoints && framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') { + callback = framework.options.drawPoints.onRender; + } + + // override it with the group onRender if defined + if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') { + callback = group.group.options.drawPoints.onRender; + } + return callback; + } + + /** + * + * @param {vis.GraphGroup.id} groupId + * @param {Object} options // TODO: Describe options + * @constructor Bargraph + */ + function Bargraph(groupId, options) {// eslint-disable-line no-unused-vars + } + Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; + var outline = getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); + var barWidth = Math.round(0.3 * iconWidth); + var originalWidth = group.options.barChart.width; + var scale = originalWidth / barWidth; + var bar1Height = Math.round(0.4 * iconHeight); + var bar2Height = Math.round(0.75 * iconHeight); + var offset = Math.round((iconWidth - 2 * barWidth) / 3); + drawBar(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, barWidth, bar1Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + drawBar(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + if (group.options.drawPoints.enabled == true) { + var groupTemplate = { + style: group.options.drawPoints.style, + styles: group.options.drawPoints.styles, + size: group.options.drawPoints.size / scale, + className: group.className + }; + drawPoint(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, groupTemplate, framework.svgElements, framework.svg); + drawPoint(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, groupTemplate, framework.svgElements, framework.svg); + } + }; + + /** + * draw a bar graph + * + * @param {Array.} groupIds + * @param {Object} processedGroupData + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + */ + Bargraph.draw = function (groupIds, processedGroupData, framework) { + var combinedData = []; + var intersections = {}; + var coreDistance; + var key, drawData; + var group; + var i, j; + var barPoints = 0; + + // combine all barchart data + for (i = 0; i < groupIds.length; i++) { + group = framework.groups[groupIds[i]]; + if (group.options.style === 'bar') { + if (group.visible === true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] === true)) { + for (j = 0; j < processedGroupData[groupIds[i]].length; j++) { + combinedData.push({ + screen_x: processedGroupData[groupIds[i]][j].screen_x, + screen_end: processedGroupData[groupIds[i]][j].screen_end, + screen_y: processedGroupData[groupIds[i]][j].screen_y, + x: processedGroupData[groupIds[i]][j].x, + end: processedGroupData[groupIds[i]][j].end, + y: processedGroupData[groupIds[i]][j].y, + groupId: groupIds[i], + label: processedGroupData[groupIds[i]][j].label + }); + barPoints += 1; + } + } + } + } + if (barPoints === 0) { + return; + } + + // sort by time and by group + _sortInstanceProperty(combinedData).call(combinedData, function (a, b) { + if (a.screen_x === b.screen_x) { + return a.groupId < b.groupId ? -1 : 1; + } else { + return a.screen_x - b.screen_x; + } + }); + + // get intersections + Bargraph._getDataIntersections(intersections, combinedData); + + // plot barchart + for (i = 0; i < combinedData.length; i++) { + group = framework.groups[combinedData[i].groupId]; + var minWidth = group.options.barChart.minWidth != undefined ? group.options.barChart.minWidth : 0.1 * group.options.barChart.width; + key = combinedData[i].screen_x; + var heightOffset = 0; + if (intersections[key] === undefined) { + if (i + 1 < combinedData.length) { + coreDistance = Math.abs(combinedData[i + 1].screen_x - key); + } + drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); + } else { + var nextKey = i + (intersections[key].amount - intersections[key].resolved); + if (nextKey < combinedData.length) { + coreDistance = Math.abs(combinedData[nextKey].screen_x - key); + } + drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); + intersections[key].resolved += 1; + if (group.options.stack === true && group.options.excludeFromStacking !== true) { + if (combinedData[i].screen_y < group.zeroPosition) { + heightOffset = intersections[key].accumulatedNegative; + intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y; + } else { + heightOffset = intersections[key].accumulatedPositive; + intersections[key].accumulatedPositive += group.zeroPosition - combinedData[i].screen_y; + } + } else if (group.options.barChart.sideBySide === true) { + drawData.width = drawData.width / intersections[key].amount; + drawData.offset += intersections[key].resolved * drawData.width - 0.5 * drawData.width * (intersections[key].amount + 1); + } + } + var dataWidth = drawData.width; + var start = combinedData[i].screen_x; + + // are we drawing explicit boxes? (we supplied an end value) + if (combinedData[i].screen_end != undefined) { + dataWidth = combinedData[i].screen_end - combinedData[i].screen_x; + start += dataWidth * 0.5; + } else { + start += drawData.offset; + } + drawBar(start, combinedData[i].screen_y - heightOffset, dataWidth, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + + // draw points + if (group.options.drawPoints.enabled === true) { + var pointData = { + screen_x: combinedData[i].screen_x, + screen_y: combinedData[i].screen_y - heightOffset, + x: combinedData[i].x, + y: combinedData[i].y, + groupId: combinedData[i].groupId, + label: combinedData[i].label + }; + Points.draw([pointData], group, framework, drawData.offset); + //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); + } + } + }; + + /** + * Fill the intersections object with counters of how many datapoints share the same x coordinates + * @param {Object} intersections + * @param {Array.} combinedData + * @private + */ + Bargraph._getDataIntersections = function (intersections, combinedData) { + // get intersections + var coreDistance; + for (var i = 0; i < combinedData.length; i++) { + if (i + 1 < combinedData.length) { + coreDistance = Math.abs(combinedData[i + 1].screen_x - combinedData[i].screen_x); + } + if (i > 0) { + coreDistance = Math.min(coreDistance, Math.abs(combinedData[i - 1].screen_x - combinedData[i].screen_x)); + } + if (coreDistance === 0) { + if (intersections[combinedData[i].screen_x] === undefined) { + intersections[combinedData[i].screen_x] = { + amount: 0, + resolved: 0, + accumulatedPositive: 0, + accumulatedNegative: 0 + }; + } + intersections[combinedData[i].screen_x].amount += 1; + } + } + }; + + /** + * Get the width and offset for bargraphs based on the coredistance between datapoints + * + * @param {number} coreDistance + * @param {vis.Group} group + * @param {number} minWidth + * @returns {{width: number, offset: number}} + * @private + */ + Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) { + var width, offset; + if (coreDistance < group.options.barChart.width && coreDistance > 0) { + width = coreDistance < minWidth ? minWidth : coreDistance; + offset = 0; // recalculate offset with the new width; + if (group.options.barChart.align === 'left') { + offset -= 0.5 * coreDistance; + } else if (group.options.barChart.align === 'right') { + offset += 0.5 * coreDistance; + } + } else { + // default settings + width = group.options.barChart.width; + offset = 0; + if (group.options.barChart.align === 'left') { + offset -= 0.5 * group.options.barChart.width; + } else if (group.options.barChart.align === 'right') { + offset += 0.5 * group.options.barChart.width; + } + } + return { + width: width, + offset: offset + }; + }; + Bargraph.getStackedYRange = function (combinedData, groupRanges, groupIds, groupLabel, orientation) { + if (combinedData.length > 0) { + // sort by time and by group + _sortInstanceProperty(combinedData).call(combinedData, function (a, b) { + if (a.screen_x === b.screen_x) { + return a.groupId < b.groupId ? -1 : 1; + } else { + return a.screen_x - b.screen_x; + } + }); + var intersections = {}; + Bargraph._getDataIntersections(intersections, combinedData); + groupRanges[groupLabel] = Bargraph._getStackedYRange(intersections, combinedData); + groupRanges[groupLabel].yAxisOrientation = orientation; + groupIds.push(groupLabel); + } + }; + Bargraph._getStackedYRange = function (intersections, combinedData) { + var key; + var yMin = combinedData[0].screen_y; + var yMax = combinedData[0].screen_y; + for (var i = 0; i < combinedData.length; i++) { + key = combinedData[i].screen_x; + if (intersections[key] === undefined) { + yMin = yMin > combinedData[i].screen_y ? combinedData[i].screen_y : yMin; + yMax = yMax < combinedData[i].screen_y ? combinedData[i].screen_y : yMax; + } else { + if (combinedData[i].screen_y < 0) { + intersections[key].accumulatedNegative += combinedData[i].screen_y; + } else { + intersections[key].accumulatedPositive += combinedData[i].screen_y; + } + } + } + for (var xpos in intersections) { + if (intersections.hasOwnProperty(xpos)) { + yMin = yMin > intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMin; + yMin = yMin > intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMin; + yMax = yMax < intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMax; + yMax = yMax < intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMax; + } + } + return { + min: yMin, + max: yMax + }; + }; + + /** + * + * @param {vis.GraphGroup.id} groupId + * @param {Object} options // TODO: Describe options + * @constructor Line + */ + function Line(groupId, options) {// eslint-disable-line no-unused-vars + } + Line.calcPath = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var d = []; + + // construct path from dataset + if (group.options.interpolation.enabled == true) { + d = Line._catmullRom(dataset, group); + } else { + d = Line._linear(dataset); + } + return d; + } + } + }; + Line.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; + var path, fillPath; + var outline = getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); + path = getSVGElement("path", framework.svgElements, framework.svg); + path.setAttributeNS(null, "class", group.className); + if (group.style !== undefined) { + path.setAttributeNS(null, "style", group.style); + } + path.setAttributeNS(null, "d", "M" + x + "," + y + " L" + (x + iconWidth) + "," + y + ""); + if (group.options.shaded.enabled == true) { + fillPath = getSVGElement("path", framework.svgElements, framework.svg); + if (group.options.shaded.orientation == 'top') { + fillPath.setAttributeNS(null, "d", "M" + x + ", " + (y - fillHeight) + "L" + x + "," + y + " L" + (x + iconWidth) + "," + y + " L" + (x + iconWidth) + "," + (y - fillHeight)); + } else { + fillPath.setAttributeNS(null, "d", "M" + x + "," + y + " " + "L" + x + "," + (y + fillHeight) + " " + "L" + (x + iconWidth) + "," + (y + fillHeight) + "L" + (x + iconWidth) + "," + y); + } + fillPath.setAttributeNS(null, "class", group.className + " vis-icon-fill"); + if (group.options.shaded.style !== undefined && group.options.shaded.style !== "") { + fillPath.setAttributeNS(null, "style", group.options.shaded.style); + } + } + if (group.options.drawPoints.enabled == true) { + var groupTemplate = { + style: group.options.drawPoints.style, + styles: group.options.drawPoints.styles, + size: group.options.drawPoints.size, + className: group.className + }; + drawPoint(x + 0.5 * iconWidth, y, groupTemplate, framework.svgElements, framework.svg); + } + }; + Line.drawShading = function (pathArray, group, subPathArray, framework) { + // append shading to the path + if (group.options.shaded.enabled == true) { + var svgHeight = Number(framework.svg.style.height.replace('px', '')); + var fillPath = getSVGElement('path', framework.svgElements, framework.svg); + var type = "L"; + if (group.options.interpolation.enabled == true) { + type = "C"; + } + var dFill; + var zero = 0; + if (group.options.shaded.orientation == 'top') { + zero = 0; + } else if (group.options.shaded.orientation == 'bottom') { + zero = svgHeight; + } else { + zero = Math.min(Math.max(0, group.zeroPosition), svgHeight); + } + if (group.options.shaded.orientation == 'group' && subPathArray != null && subPathArray != undefined) { + dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' L' + subPathArray[subPathArray.length - 1][0] + "," + subPathArray[subPathArray.length - 1][1] + " " + this.serializePath(subPathArray, type, true) + subPathArray[0][0] + "," + subPathArray[0][1] + " Z"; + } else { + dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' V' + zero + ' H' + pathArray[0][0] + " Z"; + } + fillPath.setAttributeNS(null, 'class', group.className + ' vis-fill'); + if (group.options.shaded.style !== undefined) { + fillPath.setAttributeNS(null, 'style', group.options.shaded.style); + } + fillPath.setAttributeNS(null, 'd', dFill); + } + }; + + /** + * draw a line graph + * + * @param {Array.} pathArray + * @param {vis.Group} group + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + */ + Line.draw = function (pathArray, group, framework) { + if (pathArray != null && pathArray != undefined) { + var path = getSVGElement('path', framework.svgElements, framework.svg); + path.setAttributeNS(null, "class", group.className); + if (group.style !== undefined) { + path.setAttributeNS(null, "style", group.style); + } + var type = "L"; + if (group.options.interpolation.enabled == true) { + type = "C"; + } + // copy properties to path for drawing. + path.setAttributeNS(null, 'd', 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false)); + } + }; + Line.serializePath = function (pathArray, type, inverse) { + if (pathArray.length < 2) { + //Too little data to create a path. + return ""; + } + var d = type; + var i; + if (inverse) { + for (i = pathArray.length - 2; i > 0; i--) { + d += pathArray[i][0] + "," + pathArray[i][1] + " "; + } + } else { + for (i = 1; i < pathArray.length; i++) { + d += pathArray[i][0] + "," + pathArray[i][1] + " "; + } + } + return d; + }; + + /** + * This uses an uniform parametrization of the interpolation algorithm: + * 'On the Parameterization of Catmull-Rom Curves' by Cem Yuksel et al. + * @param {Array.} data + * @returns {string} + * @private + */ + Line._catmullRomUniform = function (data) { + // catmull rom + var p0, p1, p2, p3, bp1, bp2; + var d = []; + d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); + var normalization = 1 / 6; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + p0 = i == 0 ? data[0] : data[i - 1]; + p1 = data[i]; + p2 = data[i + 1]; + p3 = i + 2 < length ? data[i + 2] : p2; + + // Catmull-Rom to Cubic Bezier conversion matrix + // 0 1 0 0 + // -1/6 1 1/6 0 + // 0 1/6 1 -1/6 + // 0 0 1 0 + + // bp0 = { x: p1.x, y: p1.y }; + bp1 = { + screen_x: (-p0.screen_x + 6 * p1.screen_x + p2.screen_x) * normalization, + screen_y: (-p0.screen_y + 6 * p1.screen_y + p2.screen_y) * normalization + }; + bp2 = { + screen_x: (p1.screen_x + 6 * p2.screen_x - p3.screen_x) * normalization, + screen_y: (p1.screen_y + 6 * p2.screen_y - p3.screen_y) * normalization + }; + // bp0 = { x: p2.x, y: p2.y }; + + d.push([bp1.screen_x, bp1.screen_y]); + d.push([bp2.screen_x, bp2.screen_y]); + d.push([p2.screen_x, p2.screen_y]); + } + return d; + }; + + /** + * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. + * By default, the centripetal parameterization is used because this gives the nicest results. + * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. + * + * One optimization can be used to reuse distances since this is a sliding window approach. + * @param {Array.} data + * @param {vis.GraphGroup} group + * @returns {string} + * @private + */ + Line._catmullRom = function (data, group) { + var alpha = group.options.interpolation.alpha; + if (alpha == 0 || alpha === undefined) { + return this._catmullRomUniform(data); + } else { + var p0, p1, p2, p3, bp1, bp2, d1, d2, d3, A, B, N, M; + var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; + var d = []; + d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); + var length = data.length; + for (var i = 0; i < length - 1; i++) { + p0 = i == 0 ? data[0] : data[i - 1]; + p1 = data[i]; + p2 = data[i + 1]; + p3 = i + 2 < length ? data[i + 2] : p2; + d1 = Math.sqrt(Math.pow(p0.screen_x - p1.screen_x, 2) + Math.pow(p0.screen_y - p1.screen_y, 2)); + d2 = Math.sqrt(Math.pow(p1.screen_x - p2.screen_x, 2) + Math.pow(p1.screen_y - p2.screen_y, 2)); + d3 = Math.sqrt(Math.pow(p2.screen_x - p3.screen_x, 2) + Math.pow(p2.screen_y - p3.screen_y, 2)); + + // Catmull-Rom to Cubic Bezier conversion matrix + + // A = 2d1^2a + 3d1^a * d2^a + d3^2a + // B = 2d3^2a + 3d3^a * d2^a + d2^2a + + // [ 0 1 0 0 ] + // [ -d2^2a /N A/N d1^2a /N 0 ] + // [ 0 d3^2a /M B/M -d2^2a /M ] + // [ 0 0 1 0 ] + + d3powA = Math.pow(d3, alpha); + d3pow2A = Math.pow(d3, 2 * alpha); + d2powA = Math.pow(d2, alpha); + d2pow2A = Math.pow(d2, 2 * alpha); + d1powA = Math.pow(d1, alpha); + d1pow2A = Math.pow(d1, 2 * alpha); + A = 2 * d1pow2A + 3 * d1powA * d2powA + d2pow2A; + B = 2 * d3pow2A + 3 * d3powA * d2powA + d2pow2A; + N = 3 * d1powA * (d1powA + d2powA); + if (N > 0) { + N = 1 / N; + } + M = 3 * d3powA * (d3powA + d2powA); + if (M > 0) { + M = 1 / M; + } + bp1 = { + screen_x: (-d2pow2A * p0.screen_x + A * p1.screen_x + d1pow2A * p2.screen_x) * N, + screen_y: (-d2pow2A * p0.screen_y + A * p1.screen_y + d1pow2A * p2.screen_y) * N + }; + bp2 = { + screen_x: (d3pow2A * p1.screen_x + B * p2.screen_x - d2pow2A * p3.screen_x) * M, + screen_y: (d3pow2A * p1.screen_y + B * p2.screen_y - d2pow2A * p3.screen_y) * M + }; + if (bp1.screen_x == 0 && bp1.screen_y == 0) { + bp1 = p1; + } + if (bp2.screen_x == 0 && bp2.screen_y == 0) { + bp2 = p2; + } + d.push([bp1.screen_x, bp1.screen_y]); + d.push([bp2.screen_x, bp2.screen_y]); + d.push([p2.screen_x, p2.screen_y]); + } + return d; + } + }; + + /** + * this generates the SVG path for a linear drawing between datapoints. + * @param {Array.} data + * @returns {string} + * @private + */ + Line._linear = function (data) { + // linear + var d = []; + for (var i = 0; i < data.length; i++) { + d.push([data[i].screen_x, data[i].screen_y]); + } + return d; + }; + + /** + * /** + * @param {object} group | the object of the group from the dataset + * @param {string} groupId | ID of the group + * @param {object} options | the default options + * @param {array} groupsUsingDefaultStyles | this array has one entree. + * It is passed as an array so it is passed by reference. + * It enumerates through the default styles + * @constructor GraphGroup + */ + function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { + this.id = groupId; + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; + this.options = availableUtils.selectiveBridgeObject(fields, options); + this.usingDefaultStyle = group.className === undefined; + this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; + this.zeroPosition = 0; + this.update(group); + if (this.usingDefaultStyle == true) { + this.groupsUsingDefaultStyles[0] += 1; + } + this.itemsData = []; + this.visible = group.visible === undefined ? true : group.visible; + } + + /** + * this loads a reference to all items in this group into this group. + * @param {array} items + */ + GraphGroup.prototype.setItems = function (items) { + if (items != null) { + this.itemsData = items; + if (_sortInstanceProperty(this.options) == true) { + availableUtils.insertSort(this.itemsData, function (a, b) { + return a.x > b.x ? 1 : -1; + }); + } + } else { + this.itemsData = []; + } + }; + GraphGroup.prototype.getItems = function () { + return this.itemsData; + }; + + /** + * this is used for barcharts and shading, this way, we only have to calculate it once. + * @param {number} pos + */ + GraphGroup.prototype.setZeroPosition = function (pos) { + this.zeroPosition = pos; + }; + + /** + * set the options of the graph group over the default options. + * @param {Object} options + */ + GraphGroup.prototype.setOptions = function (options) { + if (options !== undefined) { + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; + availableUtils.selectiveDeepExtend(fields, this.options, options); + + // if the group's drawPoints is a function delegate the callback to the onRender property + if (typeof options.drawPoints == 'function') { + options.drawPoints = { + onRender: options.drawPoints + }; + } + availableUtils.mergeOptions(this.options, options, 'interpolation'); + availableUtils.mergeOptions(this.options, options, 'drawPoints'); + availableUtils.mergeOptions(this.options, options, 'shaded'); + if (options.interpolation) { + if (_typeof$1(options.interpolation) == 'object') { + if (options.interpolation.parametrization) { + if (options.interpolation.parametrization == 'uniform') { + this.options.interpolation.alpha = 0; + } else if (options.interpolation.parametrization == 'chordal') { + this.options.interpolation.alpha = 1.0; + } else { + this.options.interpolation.parametrization = 'centripetal'; + this.options.interpolation.alpha = 0.5; + } + } + } + } + } + }; + + /** + * this updates the current group class with the latest group dataset entree, used in _updateGroup in linegraph + * @param {vis.Group} group + */ + GraphGroup.prototype.update = function (group) { + this.group = group; + this.content = group.content || 'graph'; + this.className = group.className || this.className || 'vis-graph-group' + this.groupsUsingDefaultStyles[0] % 10; + this.visible = group.visible === undefined ? true : group.visible; + this.style = group.style; + this.setOptions(group.options); + }; + + /** + * return the legend entree for this group. + * + * @param {number} iconWidth + * @param {number} iconHeight + * @param {{svg: (*|Element), svgElements: Object, options: Object, groups: Array.}} framework + * @param {number} x + * @param {number} y + * @returns {{icon: (*|Element), label: (*|string), orientation: *}} + */ + GraphGroup.prototype.getLegend = function (iconWidth, iconHeight, framework, x, y) { + if (framework == undefined || framework == null) { + var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + framework = { + svg: svg, + svgElements: {}, + options: this.options, + groups: [this] + }; + } + if (x == undefined || x == null) { + x = 0; + } + if (y == undefined || y == null) { + y = 0.5 * iconHeight; + } + switch (this.options.style) { + case "line": + Line.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + case "points": //explicit no break + case "point": + Points.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + case "bar": + Bargraph.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + } + return { + icon: framework.svg, + label: this.content, + orientation: this.options.yAxisOrientation + }; + }; + GraphGroup.prototype.getYRange = function (groupData) { + var yMin = groupData[0].y; + var yMax = groupData[0].y; + for (var j = 0; j < groupData.length; j++) { + yMin = yMin > groupData[j].y ? groupData[j].y : yMin; + yMax = yMax < groupData[j].y ? groupData[j].y : yMax; + } + return { + min: yMin, + max: yMax, + yAxisOrientation: this.options.yAxisOrientation + }; + }; + + /** + * Legend for Graph2d + * + * @param {vis.Graph2d.body} body + * @param {vis.Graph2d.options} options + * @param {number} side + * @param {vis.LineGraph.options} linegraphOptions + * @constructor Legend + * @extends Component + */ + function Legend(body, options, side, linegraphOptions) { + this.body = body; + this.defaultOptions = { + enabled: false, + icons: true, + iconSize: 20, + iconSpacing: 6, + left: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + }, + + right: { + visible: true, + position: 'top-right' // top/bottom - left,center,right + } + }; + + this.side = side; + this.options = availableUtils.extend({}, this.defaultOptions); + this.linegraphOptions = linegraphOptions; + this.svgElements = {}; + this.dom = {}; + this.groups = {}; + this.amountOfGroups = 0; + this._create(); + this.framework = { + svg: this.svg, + svgElements: this.svgElements, + options: this.options, + groups: this.groups + }; + this.setOptions(options); + } + Legend.prototype = new Component(); + Legend.prototype.clear = function () { + this.groups = {}; + this.amountOfGroups = 0; + }; + Legend.prototype.addGroup = function (label, graphOptions) { + // Include a group only if the group option 'excludeFromLegend: false' is not set. + if (graphOptions.options.excludeFromLegend != true) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + } + }; + Legend.prototype.updateGroup = function (label, graphOptions) { + this.groups[label] = graphOptions; + }; + Legend.prototype.removeGroup = function (label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } + }; + Legend.prototype._create = function () { + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-legend'; + this.dom.frame.style.position = "absolute"; + this.dom.frame.style.top = "10px"; + this.dom.frame.style.display = "block"; + this.dom.textArea = document.createElement('div'); + this.dom.textArea.className = 'vis-legend-text'; + this.dom.textArea.style.position = "relative"; + this.dom.textArea.style.top = "0px"; + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + this.svg.style.position = 'absolute'; + this.svg.style.top = 0 + 'px'; + this.svg.style.width = this.options.iconSize + 5 + 'px'; + this.svg.style.height = '100%'; + this.dom.frame.appendChild(this.svg); + this.dom.frame.appendChild(this.dom.textArea); + }; + + /** + * Hide the component from the DOM + */ + Legend.prototype.hide = function () { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; + + /** + * Show the component in the DOM (when not already visible). + */ + Legend.prototype.show = function () { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; + Legend.prototype.setOptions = function (options) { + var fields = ['enabled', 'orientation', 'icons', 'left', 'right']; + availableUtils.selectiveDeepExtend(fields, this.options, options); + }; + Legend.prototype.redraw = function () { + var activeGroups = 0; + var groupArray = _Object$keys(this.groups); + _sortInstanceProperty(groupArray).call(groupArray, function (a, b) { + return a < b ? -1 : 1; + }); + for (var i = 0; i < groupArray.length; i++) { + var groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + activeGroups++; + } + } + if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false || activeGroups == 0) { + this.hide(); + } else { + this.show(); + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { + this.dom.frame.style.left = '4px'; + this.dom.frame.style.textAlign = "left"; + this.dom.textArea.style.textAlign = "left"; + this.dom.textArea.style.left = this.options.iconSize + 15 + 'px'; + this.dom.textArea.style.right = ''; + this.svg.style.left = 0 + 'px'; + this.svg.style.right = ''; + } else { + this.dom.frame.style.right = '4px'; + this.dom.frame.style.textAlign = "right"; + this.dom.textArea.style.textAlign = "right"; + this.dom.textArea.style.right = this.options.iconSize + 15 + 'px'; + this.dom.textArea.style.left = ''; + this.svg.style.right = 0 + 'px'; + this.svg.style.left = ''; + } + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { + this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; + this.dom.frame.style.bottom = ''; + } else { + var scrollableHeight = this.body.domProps.center.height - this.body.domProps.centerContainer.height; + this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; + this.dom.frame.style.top = ''; + } + if (this.options.icons == false) { + this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; + this.dom.textArea.style.right = ''; + this.dom.textArea.style.left = ''; + this.svg.style.width = '0px'; + } else { + this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px'; + this.drawLegendIcons(); + } + var content = ''; + for (i = 0; i < groupArray.length; i++) { + groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + content += this.groups[groupId].content + '
'; + } + } + this.dom.textArea.innerHTML = availableUtils.xss(content); + this.dom.textArea.style.lineHeight = 0.75 * this.options.iconSize + this.options.iconSpacing + 'px'; + } + }; + Legend.prototype.drawLegendIcons = function () { + if (this.dom.frame.parentNode) { + var groupArray = _Object$keys(this.groups); + _sortInstanceProperty(groupArray).call(groupArray, function (a, b) { + return a < b ? -1 : 1; + }); + + // this resets the elements so the order is maintained + resetElements(this.svgElements); + var padding = window.getComputedStyle(this.dom.frame).paddingTop; + var iconOffset = Number(padding.replace('px', '')); + var x = iconOffset; + var iconWidth = this.options.iconSize; + var iconHeight = 0.75 * this.options.iconSize; + var y = iconOffset + 0.5 * iconHeight + 3; + this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; + for (var i = 0; i < groupArray.length; i++) { + var groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); + y += iconHeight + this.options.iconSpacing; + } + } + } + }; + + var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items + + /** + * This is the constructor of the LineGraph. It requires a Timeline body and options. + * + * @param {vis.Timeline.body} body + * @param {Object} options + * @constructor LineGraph + * @extends Component + */ + function LineGraph(body, options) { + this.id = v4(); + this.body = body; + this.defaultOptions = { + yAxisOrientation: 'left', + defaultGroup: 'default', + sort: true, + sampling: true, + stack: false, + graphHeight: '400px', + shaded: { + enabled: false, + orientation: 'bottom' // top, bottom, zero + }, + + style: 'line', + // line, bar + barChart: { + width: 50, + sideBySide: false, + align: 'center' // left, center, right + }, + + interpolation: { + enabled: true, + parametrization: 'centripetal', + // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: 0.5 + }, + drawPoints: { + enabled: true, + size: 6, + style: 'square' // square, circle + }, + + dataAxis: {}, + //Defaults are done on DataAxis level + legend: {}, + //Defaults are done on Legend level + groups: { + visibility: {} + } + }; + + // options is shared by this lineGraph and all its items + this.options = availableUtils.extend({}, this.defaultOptions); + this.dom = {}; + this.props = {}; + this.hammer = null; + this.groups = {}; + this.abortedGraphUpdate = false; + this.updateSVGheight = false; + this.updateSVGheightOnResize = false; + this.forceGraphUpdate = true; + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAdd(params.items); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdate(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemove(params.items); + } + }; + + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAddGroups(params.items); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdateGroups(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemoveGroups(params.items); + } + }; + this.items = {}; // object with an Item for every data item + this.selection = []; // list with the ids of all selected nodes + this.lastStart = this.body.range.start; + this.touchParams = {}; // stores properties while dragging + + this.svgElements = {}; + this.setOptions(options); + this.groupsUsingDefaultStyles = [0]; + this.body.emitter.on('rangechanged', function () { + me.svg.style.left = availableUtils.option.asSize(-me.props.width); + me.forceGraphUpdate = true; + //Is this local redraw necessary? (Core also does a change event!) + me.redraw.call(me); + }); + + // create the HTML DOM + this._create(); + this.framework = { + svg: this.svg, + svgElements: this.svgElements, + options: this.options, + groups: this.groups + }; + } + LineGraph.prototype = new Component(); + + /** + * Create the HTML DOM for the ItemSet + */ + LineGraph.prototype._create = function () { + var frame = document.createElement('div'); + frame.className = 'vis-line-graph'; + this.dom.frame = frame; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + this.svg.style.position = 'relative'; + this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; + this.svg.style.display = 'block'; + frame.appendChild(this.svg); + + // data axis + this.options.dataAxis.orientation = 'left'; + this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); + this.options.dataAxis.orientation = 'right'; + this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); + delete this.options.dataAxis.orientation; + + // legends + this.legendLeft = new Legend(this.body, this.options.legend, 'left', this.options.groups); + this.legendRight = new Legend(this.body, this.options.legend, 'right', this.options.groups); + this.show(); + }; + + /** + * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. + * @param {object} options + */ + LineGraph.prototype.setOptions = function (options) { + if (options) { + var fields = ['sampling', 'defaultGroup', 'stack', 'height', 'graphHeight', 'yAxisOrientation', 'style', 'barChart', 'dataAxis', 'sort', 'groups']; + if (options.graphHeight === undefined && options.height !== undefined) { + this.updateSVGheight = true; + this.updateSVGheightOnResize = true; + } else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) { + if (_parseInt$1((options.graphHeight + '').replace("px", '')) < this.body.domProps.centerContainer.height) { + this.updateSVGheight = true; + } + } + availableUtils.selectiveDeepExtend(fields, this.options, options); + availableUtils.mergeOptions(this.options, options, 'interpolation'); + availableUtils.mergeOptions(this.options, options, 'drawPoints'); + availableUtils.mergeOptions(this.options, options, 'shaded'); + availableUtils.mergeOptions(this.options, options, 'legend'); + if (options.interpolation) { + if (_typeof$1(options.interpolation) == 'object') { + if (options.interpolation.parametrization) { + if (options.interpolation.parametrization == 'uniform') { + this.options.interpolation.alpha = 0; + } else if (options.interpolation.parametrization == 'chordal') { + this.options.interpolation.alpha = 1.0; + } else { + this.options.interpolation.parametrization = 'centripetal'; + this.options.interpolation.alpha = 0.5; + } + } + } + } + if (this.yAxisLeft) { + if (options.dataAxis !== undefined) { + this.yAxisLeft.setOptions(this.options.dataAxis); + this.yAxisRight.setOptions(this.options.dataAxis); + } + } + if (this.legendLeft) { + if (options.legend !== undefined) { + this.legendLeft.setOptions(this.options.legend); + this.legendRight.setOptions(this.options.legend); + } + } + if (this.groups.hasOwnProperty(UNGROUPED)) { + this.groups[UNGROUPED].setOptions(options); + } + } + + // this is used to redraw the graph if the visibility of the groups is changed. + if (this.dom.frame) { + //not on initial run? + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { + queue: true + }); + } + }; + + /** + * Hide the component from the DOM + */ + LineGraph.prototype.hide = function () { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } + }; + + /** + * Show the component in the DOM (when not already visible). + */ + LineGraph.prototype.show = function () { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } + }; + + /** + * Set items + * @param {vis.DataSet | null} items + */ + LineGraph.prototype.setItems = function (items) { + var me = this, + ids, + oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } else if (isDataViewLike(items)) { + this.itemsData = typeCoerceDataSet(items); + } else { + throw new TypeError('Data must implement the interface of DataSet or DataView'); + } + if (oldItemsData) { + // unsubscribe from old dataset + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); + + // stop maintaining a coerced version of the old data set + oldItemsData.dispose(); + + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + _forEachInstanceProperty(availableUtils).call(availableUtils, this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + } + }; + + /** + * Set groups + * @param {vis.DataSet} groups + */ + LineGraph.prototype.setGroups = function (groups) { + var me = this; + var ids; + + // unsubscribe from current dataset + if (this.groupsData) { + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groupListeners, function (callback, event) { + me.groupsData.off(event, callback); + }); + + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + for (var i = 0; i < ids.length; i++) { + this._removeGroup(ids[i]); + } + } + + // replace the dataset + if (!groups) { + this.groupsData = null; + } else if (isDataViewLike(groups)) { + this.groupsData = groups; + } else { + throw new TypeError('Data must implement the interface of DataSet or DataView'); + } + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + _forEachInstanceProperty(availableUtils).call(availableUtils, this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); + + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } + }; + LineGraph.prototype._onUpdate = function (ids) { + this._updateAllGroupData(ids); + }; + LineGraph.prototype._onAdd = function (ids) { + this._onUpdate(ids); + }; + LineGraph.prototype._onRemove = function (ids) { + this._onUpdate(ids); + }; + LineGraph.prototype._onUpdateGroups = function (groupIds) { + this._updateAllGroupData(null, groupIds); + }; + LineGraph.prototype._onAddGroups = function (groupIds) { + this._onUpdateGroups(groupIds); + }; + + /** + * this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph + * @param {Array} groupIds + * @private + */ + LineGraph.prototype._onRemoveGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + this._removeGroup(groupIds[i]); + } + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { + queue: true + }); + }; + + /** + * this cleans the group out off the legends and the dataaxis + * @param {vis.GraphGroup.id} groupId + * @private + */ + LineGraph.prototype._removeGroup = function (groupId) { + if (this.groups.hasOwnProperty(groupId)) { + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.removeGroup(groupId); + this.legendRight.removeGroup(groupId); + this.legendRight.redraw(); + } else { + this.yAxisLeft.removeGroup(groupId); + this.legendLeft.removeGroup(groupId); + this.legendLeft.redraw(); + } + delete this.groups[groupId]; + } + }; + + /** + * update a group object with the group dataset entree + * + * @param {vis.GraphGroup} group + * @param {vis.GraphGroup.id} groupId + * @private + */ + LineGraph.prototype._updateGroup = function (group, groupId) { + if (!this.groups.hasOwnProperty(groupId)) { + this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.addGroup(groupId, this.groups[groupId]); + this.legendRight.addGroup(groupId, this.groups[groupId]); + } else { + this.yAxisLeft.addGroup(groupId, this.groups[groupId]); + this.legendLeft.addGroup(groupId, this.groups[groupId]); + } + } else { + this.groups[groupId].update(group); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.updateGroup(groupId, this.groups[groupId]); + this.legendRight.updateGroup(groupId, this.groups[groupId]); + //If yAxisOrientation changed, clean out the group from the other axis. + this.yAxisLeft.removeGroup(groupId); + this.legendLeft.removeGroup(groupId); + } else { + this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); + this.legendLeft.updateGroup(groupId, this.groups[groupId]); + //If yAxisOrientation changed, clean out the group from the other axis. + this.yAxisRight.removeGroup(groupId); + this.legendRight.removeGroup(groupId); + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); + }; + + /** + * this updates all groups, it is used when there is an update the the itemset. + * + * @param {Array} ids + * @param {Array} groupIds + * @private + */ + LineGraph.prototype._updateAllGroupData = function (ids, groupIds) { + if (this.itemsData != null) { + var groupsContent = {}; + var items = this.itemsData.get(); + var fieldId = this.itemsData.idProp; + var idMap = {}; + if (ids) { + _mapInstanceProperty(ids).call(ids, function (id) { + idMap[id] = id; + }); + } + + //pre-Determine array sizes, for more efficient memory claim + var groupCounts = {}; + for (var i = 0; i < items.length; i++) { + var item = items[i]; + var groupId = item.group; + if (groupId === null || groupId === undefined) { + groupId = UNGROUPED; + } + groupCounts.hasOwnProperty(groupId) ? groupCounts[groupId]++ : groupCounts[groupId] = 1; + } + + //Pre-load arrays from existing groups if items are not changed (not in ids) + var existingItemsMap = {}; + if (!groupIds && ids) { + for (groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + group = this.groups[groupId]; + var existing_items = group.getItems(); + groupsContent[groupId] = _filterInstanceProperty(existing_items).call(existing_items, function (item) { + existingItemsMap[item[fieldId]] = item[fieldId]; + return item[fieldId] !== idMap[item[fieldId]]; + }); + var newLength = groupCounts[groupId]; + groupCounts[groupId] -= groupsContent[groupId].length; + if (groupsContent[groupId].length < newLength) { + groupsContent[groupId][newLength - 1] = {}; + } + } + } + } + + //Now insert data into the arrays. + for (i = 0; i < items.length; i++) { + item = items[i]; + groupId = item.group; + if (groupId === null || groupId === undefined) { + groupId = UNGROUPED; + } + if (!groupIds && ids && item[fieldId] !== idMap[item[fieldId]] && existingItemsMap.hasOwnProperty(item[fieldId])) { + continue; + } + if (!groupsContent.hasOwnProperty(groupId)) { + groupsContent[groupId] = new Array(groupCounts[groupId]); + } + //Copy data (because of unmodifiable DataView input. + var extended = availableUtils.bridgeObject(item); + extended.x = availableUtils.convert(item.x, 'Date'); + extended.end = availableUtils.convert(item.end, 'Date'); + extended.orginalY = item.y; //real Y + extended.y = Number(item.y); + extended[fieldId] = item[fieldId]; + var index = groupsContent[groupId].length - groupCounts[groupId]--; + groupsContent[groupId][index] = extended; + } + + //Make sure all groups are present, to allow removal of old groups + for (groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + if (!groupsContent.hasOwnProperty(groupId)) { + groupsContent[groupId] = new Array(0); + } + } + } + + //Update legendas, style and axis + for (groupId in groupsContent) { + if (groupsContent.hasOwnProperty(groupId)) { + if (groupsContent[groupId].length == 0) { + if (this.groups.hasOwnProperty(groupId)) { + this._removeGroup(groupId); + } + } else { + var group = undefined; + if (this.groupsData != undefined) { + group = this.groupsData.get(groupId); + } + if (group == undefined) { + group = { + id: groupId, + content: this.options.defaultGroup + groupId + }; + } + this._updateGroup(group, groupId); + this.groups[groupId].setItems(groupsContent[groupId]); + } + } + } + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { + queue: true + }); + } + }; + + /** + * Redraw the component, mandatory function + * @return {boolean} Returns true if the component is resized + */ + LineGraph.prototype.redraw = function () { + var resized = false; + + // calculate actual size and position + this.props.width = this.dom.frame.offsetWidth; + this.props.height = this.body.domProps.centerContainer.height - this.body.domProps.border.top - this.body.domProps.border.bottom; + + // check if this component is resized + resized = this._isResized() || resized; + + // check whether zoomed (in that case we need to re-stack everything) + var visibleInterval = this.body.range.end - this.body.range.start; + var zoomed = visibleInterval != this.lastVisibleInterval; + this.lastVisibleInterval = visibleInterval; + + // the svg element is three times as big as the width, this allows for fully dragging left and right + // without reloading the graph. the controls for this are bound to events in the constructor + if (resized == true) { + var _context; + this.svg.style.width = availableUtils.option.asSize(3 * this.props.width); + this.svg.style.left = availableUtils.option.asSize(-this.props.width); + + // if the height of the graph is set as proportional, change the height of the svg + if (_indexOfInstanceProperty(_context = this.options.height + '').call(_context, "%") != -1 || this.updateSVGheightOnResize == true) { + this.updateSVGheight = true; + } + } + + // update the height of the graph on each redraw of the graph. + if (this.updateSVGheight == true) { + if (this.options.graphHeight != this.props.height + 'px') { + this.options.graphHeight = this.props.height + 'px'; + this.svg.style.height = this.props.height + 'px'; + } + this.updateSVGheight = false; + } else { + this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; + } + + // zoomed is here to ensure that animations are shown correctly. + if (resized == true || zoomed == true || this.abortedGraphUpdate == true || this.forceGraphUpdate == true) { + resized = this._updateGraph() || resized; + this.forceGraphUpdate = false; + this.lastStart = this.body.range.start; + this.svg.style.left = -this.props.width + 'px'; + } else { + // move the whole svg while dragging + if (this.lastStart != 0) { + var offset = this.body.range.start - this.lastStart; + var range = this.body.range.end - this.body.range.start; + if (this.props.width != 0) { + var rangePerPixelInv = this.props.width / range; + var xOffset = offset * rangePerPixelInv; + this.svg.style.left = -this.props.width - xOffset + 'px'; + } + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); + return resized; + }; + LineGraph.prototype._getSortedGroupIds = function () { + // getting group Ids + var grouplist = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + if (group.visible == true && (this.options.groups.visibility[groupId] === undefined || this.options.groups.visibility[groupId] == true)) { + grouplist.push({ + id: groupId, + zIndex: group.options.zIndex + }); + } + } + } + availableUtils.insertSort(grouplist, function (a, b) { + var az = a.zIndex; + var bz = b.zIndex; + if (az === undefined) az = 0; + if (bz === undefined) bz = 0; + return az == bz ? 0 : az < bz ? -1 : 1; + }); + var groupIds = new Array(grouplist.length); + for (var i = 0; i < grouplist.length; i++) { + groupIds[i] = grouplist[i].id; + } + return groupIds; + }; + + /** + * Update and redraw the graph. + * + * @returns {boolean} + * @private + */ + LineGraph.prototype._updateGraph = function () { + // reset the svg elements + prepareElements(this.svgElements); + if (this.props.width != 0 && this.itemsData != null) { + var group, i; + var groupRanges = {}; + var changeCalled = false; + // this is the range of the SVG canvas + var minDate = this.body.util.toGlobalTime(-this.body.domProps.root.width); + var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); + + // getting group Ids + var groupIds = this._getSortedGroupIds(); + if (groupIds.length > 0) { + var groupsData = {}; + + // fill groups data, this only loads the data we require based on the timewindow + this._getRelevantData(groupIds, groupsData, minDate, maxDate); + + // apply sampling, if disabled, it will pass through this function. + this._applySampling(groupIds, groupsData); + + // we transform the X coordinates to detect collisions + for (i = 0; i < groupIds.length; i++) { + this._convertXcoordinates(groupsData[groupIds[i]]); + } + + // now all needed data has been collected we start the processing. + this._getYRanges(groupIds, groupsData, groupRanges); + + // update the Y axis first, we use this data to draw at the correct Y points + changeCalled = this._updateYAxis(groupIds, groupRanges); + + // at changeCalled, abort this update cycle as the graph needs another update with new Width input from the Redraw container. + // Cleanup SVG elements on abort. + if (changeCalled == true) { + cleanupElements(this.svgElements); + this.abortedGraphUpdate = true; + return true; + } + this.abortedGraphUpdate = false; + + // With the yAxis scaled correctly, use this to get the Y values of the points. + var below = undefined; + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (this.options.stack === true && this.options.style === 'line') { + if (group.options.excludeFromStacking == undefined || !group.options.excludeFromStacking) { + if (below != undefined) { + this._stack(groupsData[group.id], groupsData[below.id]); + if (group.options.shaded.enabled == true && group.options.shaded.orientation !== "group") { + if (group.options.shaded.orientation == "top" && below.options.shaded.orientation !== "group") { + below.options.shaded.orientation = "group"; + below.options.shaded.groupId = group.id; + } else { + group.options.shaded.orientation = "group"; + group.options.shaded.groupId = below.id; + } + } + } + below = group; + } + } + this._convertYcoordinates(groupsData[groupIds[i]], group); + } + + //Precalculate paths and draw shading if appropriate. This will make sure the shading is always behind any lines. + var paths = {}; + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.style === 'line' && group.options.shaded.enabled == true) { + var dataset = groupsData[groupIds[i]]; + if (dataset == null || dataset.length == 0) { + continue; + } + if (!paths.hasOwnProperty(groupIds[i])) { + paths[groupIds[i]] = Line.calcPath(dataset, group); + } + if (group.options.shaded.orientation === "group") { + var subGroupId = group.options.shaded.groupId; + if (_indexOfInstanceProperty(groupIds).call(groupIds, subGroupId) === -1) { + console.log(group.id + ": Unknown shading group target given:" + subGroupId); + continue; + } + if (!paths.hasOwnProperty(subGroupId)) { + paths[subGroupId] = Line.calcPath(groupsData[subGroupId], this.groups[subGroupId]); + } + Line.drawShading(paths[groupIds[i]], group, paths[subGroupId], this.framework); + } else { + Line.drawShading(paths[groupIds[i]], group, undefined, this.framework); + } + } + } + + // draw the groups, calculating paths if still necessary. + Bargraph.draw(groupIds, groupsData, this.framework); + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (groupsData[groupIds[i]].length > 0) { + switch (group.options.style) { + case "line": + if (!paths.hasOwnProperty(groupIds[i])) { + paths[groupIds[i]] = Line.calcPath(groupsData[groupIds[i]], group); + } + Line.draw(paths[groupIds[i]], group, this.framework); + // eslint-disable-line no-fallthrough + case "point": + // eslint-disable-line no-fallthrough + case "points": + if (group.options.style == "point" || group.options.style == "points" || group.options.drawPoints.enabled == true) { + Points.draw(groupsData[groupIds[i]], group, this.framework); + } + break; + //do nothing... + } + } + } + } + } + + // cleanup unused svg elements + cleanupElements(this.svgElements); + return false; + }; + LineGraph.prototype._stack = function (data, subData) { + var index, dx, dy, subPrevPoint, subNextPoint; + index = 0; + // for each data point we look for a matching on in the set below + for (var j = 0; j < data.length; j++) { + subPrevPoint = undefined; + subNextPoint = undefined; + // we look for time matches or a before-after point + for (var k = index; k < subData.length; k++) { + // if times match exactly + if (subData[k].x === data[j].x) { + subPrevPoint = subData[k]; + subNextPoint = subData[k]; + index = k; + break; + } else if (subData[k].x > data[j].x) { + // overshoot + subNextPoint = subData[k]; + if (k == 0) { + subPrevPoint = subNextPoint; + } else { + subPrevPoint = subData[k - 1]; + } + index = k; + break; + } + } + // in case the last data point has been used, we assume it stays like this. + if (subNextPoint === undefined) { + subPrevPoint = subData[subData.length - 1]; + subNextPoint = subData[subData.length - 1]; + } + // linear interpolation + dx = subNextPoint.x - subPrevPoint.x; + dy = subNextPoint.y - subPrevPoint.y; + if (dx == 0) { + data[j].y = data[j].orginalY + subNextPoint.y; + } else { + data[j].y = data[j].orginalY + dy / dx * (data[j].x - subPrevPoint.x) + subPrevPoint.y; // ax + b where b is data[j].y + } + } + }; + + /** + * first select and preprocess the data from the datasets. + * the groups have their preselection of data, we now loop over this data to see + * what data we need to draw. Sorted data is much faster. + * more optimization is possible by doing the sampling before and using the binary search + * to find the end date to determine the increment. + * + * @param {array} groupIds + * @param {object} groupsData + * @param {date} minDate + * @param {date} maxDate + * @private + */ + LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, maxDate) { + var group, i, j, item; + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + var itemsData = group.getItems(); + // optimization for sorted data + if (_sortInstanceProperty(group.options) == true) { + var dateComparator = function dateComparator(a, b) { + return a.getTime() == b.getTime() ? 0 : a < b ? -1 : 1; + }; + var first = Math.max(0, availableUtils.binarySearchValue(itemsData, minDate, 'x', 'before', dateComparator)); + var last = Math.min(itemsData.length, availableUtils.binarySearchValue(itemsData, maxDate, 'x', 'after', dateComparator) + 1); + if (last <= 0) { + last = itemsData.length; + } + var dataContainer = new Array(last - first); + for (j = first; j < last; j++) { + item = group.itemsData[j]; + dataContainer[j - first] = item; + } + groupsData[groupIds[i]] = dataContainer; + } else { + // If unsorted data, all data is relevant, just returning entire structure + groupsData[groupIds[i]] = group.itemsData; + } + } + } + }; + + /** + * + * @param {Array.} groupIds + * @param {vis.DataSet} groupsData + * @private + */ + LineGraph.prototype._applySampling = function (groupIds, groupsData) { + var group; + if (groupIds.length > 0) { + for (var i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.sampling == true) { + var dataContainer = groupsData[groupIds[i]]; + if (dataContainer.length > 0) { + var increment = 1; + var amountOfPoints = dataContainer.length; + + // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop + // of width changing of the yAxis. + //TODO: This assumes sorted data, but that's not guaranteed! + var xDistance = this.body.util.toGlobalScreen(dataContainer[dataContainer.length - 1].x) - this.body.util.toGlobalScreen(dataContainer[0].x); + var pointsPerPixel = amountOfPoints / xDistance; + increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1, Math.round(pointsPerPixel))); + var sampledData = new Array(amountOfPoints); + for (var j = 0; j < amountOfPoints; j += increment) { + var idx = Math.round(j / increment); + sampledData[idx] = dataContainer[j]; + } + groupsData[groupIds[i]] = _spliceInstanceProperty(sampledData).call(sampledData, 0, Math.round(amountOfPoints / increment)); + } + } + } + } + }; + + /** + * + * @param {Array.} groupIds + * @param {vis.DataSet} groupsData + * @param {object} groupRanges | this is being filled here + * @private + */ + LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { + var groupData, group, i; + var combinedDataLeft = []; + var combinedDataRight = []; + var options; + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + groupData = groupsData[groupIds[i]]; + options = this.groups[groupIds[i]].options; + if (groupData.length > 0) { + group = this.groups[groupIds[i]]; + // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. + if (options.stack === true && options.style === 'bar') { + if (options.yAxisOrientation === 'left') { + combinedDataLeft = _concatInstanceProperty(combinedDataLeft).call(combinedDataLeft, groupData); + } else { + combinedDataRight = _concatInstanceProperty(combinedDataRight).call(combinedDataRight, groupData); + } + } else { + groupRanges[groupIds[i]] = group.getYRange(groupData, groupIds[i]); + } + } + } + + // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. + Bargraph.getStackedYRange(combinedDataLeft, groupRanges, groupIds, '__barStackLeft', 'left'); + Bargraph.getStackedYRange(combinedDataRight, groupRanges, groupIds, '__barStackRight', 'right'); + } + }; + + /** + * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. + * @param {Array.} groupIds + * @param {Object} groupRanges + * @returns {boolean} resized + * @private + */ + LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { + var resized = false; + var yAxisLeftUsed = false; + var yAxisRightUsed = false; + var minLeft = 1e9, + minRight = 1e9, + maxLeft = -1e9, + maxRight = -1e9, + minVal, + maxVal; + // if groups are present + if (groupIds.length > 0) { + // this is here to make sure that if there are no items in the axis but there are groups, that there is no infinite draw/redraw loop. + for (var i = 0; i < groupIds.length; i++) { + var group = this.groups[groupIds[i]]; + if (group && group.options.yAxisOrientation != 'right') { + yAxisLeftUsed = true; + minLeft = 1e9; + maxLeft = -1e9; + } else if (group && group.options.yAxisOrientation) { + yAxisRightUsed = true; + minRight = 1e9; + maxRight = -1e9; + } + } + + // if there are items: + for (i = 0; i < groupIds.length; i++) { + if (groupRanges.hasOwnProperty(groupIds[i])) { + if (groupRanges[groupIds[i]].ignore !== true) { + minVal = groupRanges[groupIds[i]].min; + maxVal = groupRanges[groupIds[i]].max; + if (groupRanges[groupIds[i]].yAxisOrientation != 'right') { + yAxisLeftUsed = true; + minLeft = minLeft > minVal ? minVal : minLeft; + maxLeft = maxLeft < maxVal ? maxVal : maxLeft; + } else { + yAxisRightUsed = true; + minRight = minRight > minVal ? minVal : minRight; + maxRight = maxRight < maxVal ? maxVal : maxRight; + } + } + } + } + if (yAxisLeftUsed == true) { + this.yAxisLeft.setRange(minLeft, maxLeft); + } + if (yAxisRightUsed == true) { + this.yAxisRight.setRange(minRight, maxRight); + } + } + resized = this._toggleAxisVisiblity(yAxisLeftUsed, this.yAxisLeft) || resized; + resized = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || resized; + if (yAxisRightUsed == true && yAxisLeftUsed == true) { + this.yAxisLeft.drawIcons = true; + this.yAxisRight.drawIcons = true; + } else { + this.yAxisLeft.drawIcons = false; + this.yAxisRight.drawIcons = false; + } + this.yAxisRight.master = !yAxisLeftUsed; + this.yAxisRight.masterAxis = this.yAxisLeft; + if (this.yAxisRight.master == false) { + if (yAxisRightUsed == true) { + this.yAxisLeft.lineOffset = this.yAxisRight.width; + } else { + this.yAxisLeft.lineOffset = 0; + } + resized = this.yAxisLeft.redraw() || resized; + resized = this.yAxisRight.redraw() || resized; + } else { + resized = this.yAxisRight.redraw() || resized; + } + + // clean the accumulated lists + var tempGroups = ['__barStackLeft', '__barStackRight', '__lineStackLeft', '__lineStackRight']; + for (i = 0; i < tempGroups.length; i++) { + if (_indexOfInstanceProperty(groupIds).call(groupIds, tempGroups[i]) != -1) { + _spliceInstanceProperty(groupIds).call(groupIds, _indexOfInstanceProperty(groupIds).call(groupIds, tempGroups[i]), 1); + } + } + return resized; + }; + + /** + * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function + * + * @param {boolean} axisUsed + * @param {vis.DataAxis} axis + * @returns {boolean} + * @private + */ + LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { + var changed = false; + if (axisUsed == false) { + if (axis.dom.frame.parentNode && axis.hidden == false) { + axis.hide(); + changed = true; + } + } else { + if (!axis.dom.frame.parentNode && axis.hidden == true) { + axis.show(); + changed = true; + } + } + return changed; + }; + + /** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param {Array.} datapoints + * @private + */ + LineGraph.prototype._convertXcoordinates = function (datapoints) { + var toScreen = this.body.util.toScreen; + for (var i = 0; i < datapoints.length; i++) { + datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width; + datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations + if (datapoints[i].end != undefined) { + datapoints[i].screen_end = toScreen(datapoints[i].end) + this.props.width; + } else { + datapoints[i].screen_end = undefined; + } + } + }; + + /** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param {Array.} datapoints + * @param {vis.GraphGroup} group + * @private + */ + LineGraph.prototype._convertYcoordinates = function (datapoints, group) { + var axis = this.yAxisLeft; + var svgHeight = Number(this.svg.style.height.replace('px', '')); + if (group.options.yAxisOrientation == 'right') { + axis = this.yAxisRight; + } + for (var i = 0; i < datapoints.length; i++) { + datapoints[i].screen_y = Math.round(axis.convertValue(datapoints[i].y)); + } + group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); + }; + + /** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ + var string = 'string'; + var bool = 'boolean'; + var number = 'number'; + var array = 'array'; + var date = 'date'; + var object = 'object'; // should only be in a __type__ property + var dom = 'dom'; + var moment = 'moment'; + var any = 'any'; + var allOptions = { + configure: { + enabled: { + 'boolean': bool + }, + filter: { + 'boolean': bool, + 'function': 'function' + }, + container: { + dom: dom + }, + __type__: { + object: object, + 'boolean': bool, + 'function': 'function' + } + }, + //globals : + alignCurrentTime: { + string: string, + 'undefined': 'undefined' + }, + yAxisOrientation: { + string: ['left', 'right'] + }, + defaultGroup: { + string: string + }, + sort: { + 'boolean': bool + }, + sampling: { + 'boolean': bool + }, + stack: { + 'boolean': bool + }, + graphHeight: { + string: string, + number: number + }, + shaded: { + enabled: { + 'boolean': bool + }, + orientation: { + string: ['bottom', 'top', 'zero', 'group'] + }, + // top, bottom, zero, group + groupId: { + object: object + }, + __type__: { + 'boolean': bool, + object: object + } + }, + style: { + string: ['line', 'bar', 'points'] + }, + // line, bar + barChart: { + width: { + number: number + }, + minWidth: { + number: number + }, + sideBySide: { + 'boolean': bool + }, + align: { + string: ['left', 'center', 'right'] + }, + __type__: { + object: object + } + }, + interpolation: { + enabled: { + 'boolean': bool + }, + parametrization: { + string: ['centripetal', 'chordal', 'uniform'] + }, + // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: { + number: number + }, + __type__: { + object: object, + 'boolean': bool + } + }, + drawPoints: { + enabled: { + 'boolean': bool + }, + onRender: { + 'function': 'function' + }, + size: { + number: number + }, + style: { + string: ['square', 'circle'] + }, + // square, circle + __type__: { + object: object, + 'boolean': bool, + 'function': 'function' + } + }, + dataAxis: { + showMinorLabels: { + 'boolean': bool + }, + showMajorLabels: { + 'boolean': bool + }, + showWeekScale: { + 'boolean': bool + }, + icons: { + 'boolean': bool + }, + width: { + string: string, + number: number + }, + visible: { + 'boolean': bool + }, + alignZeros: { + 'boolean': bool + }, + left: { + range: { + min: { + number: number, + 'undefined': 'undefined' + }, + max: { + number: number, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + format: { + 'function': 'function' + }, + title: { + text: { + string: string, + number: number, + 'undefined': 'undefined' + }, + style: { + string: string, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + __type__: { + object: object + } + }, + right: { + range: { + min: { + number: number, + 'undefined': 'undefined' + }, + max: { + number: number, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + format: { + 'function': 'function' + }, + title: { + text: { + string: string, + number: number, + 'undefined': 'undefined' + }, + style: { + string: string, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + __type__: { + object: object + } + }, + __type__: { + object: object + } + }, + legend: { + enabled: { + 'boolean': bool + }, + icons: { + 'boolean': bool + }, + left: { + visible: { + 'boolean': bool + }, + position: { + string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] + }, + __type__: { + object: object + } + }, + right: { + visible: { + 'boolean': bool + }, + position: { + string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] + }, + __type__: { + object: object + } + }, + __type__: { + object: object, + 'boolean': bool + } + }, + groups: { + visibility: { + any: any + }, + __type__: { + object: object + } + }, + autoResize: { + 'boolean': bool + }, + throttleRedraw: { + number: number + }, + // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 + clickToUse: { + 'boolean': bool + }, + end: { + number: number, + date: date, + string: string, + moment: moment + }, + format: { + minorLabels: { + millisecond: { + string: string, + 'undefined': 'undefined' + }, + second: { + string: string, + 'undefined': 'undefined' + }, + minute: { + string: string, + 'undefined': 'undefined' + }, + hour: { + string: string, + 'undefined': 'undefined' + }, + weekday: { + string: string, + 'undefined': 'undefined' + }, + day: { + string: string, + 'undefined': 'undefined' + }, + week: { + string: string, + 'undefined': 'undefined' + }, + month: { + string: string, + 'undefined': 'undefined' + }, + quarter: { + string: string, + 'undefined': 'undefined' + }, + year: { + string: string, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + majorLabels: { + millisecond: { + string: string, + 'undefined': 'undefined' + }, + second: { + string: string, + 'undefined': 'undefined' + }, + minute: { + string: string, + 'undefined': 'undefined' + }, + hour: { + string: string, + 'undefined': 'undefined' + }, + weekday: { + string: string, + 'undefined': 'undefined' + }, + day: { + string: string, + 'undefined': 'undefined' + }, + week: { + string: string, + 'undefined': 'undefined' + }, + month: { + string: string, + 'undefined': 'undefined' + }, + quarter: { + string: string, + 'undefined': 'undefined' + }, + year: { + string: string, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + __type__: { + object: object + } + }, + moment: { + 'function': 'function' + }, + height: { + string: string, + number: number + }, + hiddenDates: { + start: { + date: date, + number: number, + string: string, + moment: moment + }, + end: { + date: date, + number: number, + string: string, + moment: moment + }, + repeat: { + string: string + }, + __type__: { + object: object, + array: array + } + }, + locale: { + string: string + }, + locales: { + __any__: { + any: any + }, + __type__: { + object: object + } + }, + max: { + date: date, + number: number, + string: string, + moment: moment + }, + maxHeight: { + number: number, + string: string + }, + maxMinorChars: { + number: number + }, + min: { + date: date, + number: number, + string: string, + moment: moment + }, + minHeight: { + number: number, + string: string + }, + moveable: { + 'boolean': bool + }, + multiselect: { + 'boolean': bool + }, + orientation: { + string: string + }, + showCurrentTime: { + 'boolean': bool + }, + showMajorLabels: { + 'boolean': bool + }, + showMinorLabels: { + 'boolean': bool + }, + showWeekScale: { + 'boolean': bool + }, + snap: { + 'function': 'function', + 'null': 'null' + }, + start: { + date: date, + number: number, + string: string, + moment: moment + }, + timeAxis: { + scale: { + string: string, + 'undefined': 'undefined' + }, + step: { + number: number, + 'undefined': 'undefined' + }, + __type__: { + object: object + } + }, + width: { + string: string, + number: number + }, + zoomable: { + 'boolean': bool + }, + zoomKey: { + string: ['ctrlKey', 'altKey', 'metaKey', ''] + }, + zoomMax: { + number: number + }, + zoomMin: { + number: number + }, + zIndex: { + number: number + }, + __type__: { + object: object + } + }; + var configureOptions = { + global: { + alignCurrentTime: ['none', 'year', 'month', 'quarter', 'week', 'isoWeek', 'day', 'date', 'hour', 'minute', 'second'], + //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly + sort: true, + sampling: true, + stack: false, + shaded: { + enabled: false, + orientation: ['zero', 'top', 'bottom', 'group'] // zero, top, bottom + }, + + style: ['line', 'bar', 'points'], + // line, bar + barChart: { + width: [50, 5, 100, 5], + minWidth: [50, 5, 100, 5], + sideBySide: false, + align: ['left', 'center', 'right'] // left, center, right + }, + + interpolation: { + enabled: true, + parametrization: ['centripetal', 'chordal', 'uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + }, + + drawPoints: { + enabled: true, + size: [6, 2, 30, 1], + style: ['square', 'circle'] // square, circle + }, + + dataAxis: { + showMinorLabels: true, + showMajorLabels: true, + showWeekScale: false, + icons: false, + width: [40, 0, 200, 1], + visible: true, + alignZeros: true, + left: { + //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, + //format: function (value) {return value;}, + title: { + text: '', + style: '' + } + }, + right: { + //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, + //format: function (value) {return value;}, + title: { + text: '', + style: '' + } + } + }, + legend: { + enabled: false, + icons: true, + left: { + visible: true, + position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right + }, + + right: { + visible: true, + position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right + } + }, + + autoResize: true, + clickToUse: false, + end: '', + format: { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + week: 'w', + month: 'MMM', + quarter: '[Q]Q', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + week: 'MMMM YYYY', + month: 'YYYY', + quarter: 'YYYY', + year: '' + } + }, + height: '', + locale: '', + max: '', + maxHeight: '', + maxMinorChars: [7, 0, 20, 1], + min: '', + minHeight: '', + moveable: true, + orientation: ['both', 'bottom', 'top'], + showCurrentTime: false, + showMajorLabels: true, + showMinorLabels: true, + showWeekScale: false, + start: '', + width: '100%', + zoomable: true, + zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''], + zoomMax: [315360000000000, 10, 315360000000000, 1], + zoomMin: [10, 10, 315360000000000, 1], + zIndex: 0 + } + }; + + /** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array} [items] + * @param {vis.DataSet | Array | vis.DataView | Object} [groups] + * @param {Object} [options] See Graph2d.setOptions for the available options. + * @constructor Graph2d + * @extends Core + */ + function Graph2d(container, items, groups, options) { + var _context, _context2, _context3, _context4, _context5, _context6, _context7; + // if the third element is options, the forth is groups (optionally); + if (!(_Array$isArray(groups) || isDataViewLike(groups)) && groups instanceof Object) { + var forthArgument = options; + options = groups; + groups = forthArgument; + } + + // TODO: REMOVE THIS in the next MAJOR release + // see https://github.com/almende/vis/issues/2511 + if (options && options.throttleRedraw) { + console.warn("Graph2d option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); + } + var me = this; + this.defaultOptions = { + start: null, + end: null, + autoResize: true, + orientation: { + axis: 'bottom', + // axis orientation: 'bottom', 'top', or 'both' + item: 'bottom' // not relevant for Graph2d + }, + + moment: moment$4, + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = availableUtils.deepExtend({}, this.defaultOptions); + + // Create the DOM, props, and emitter + this._create(container); + + // all components listed here will be repainted automatically + this.components = []; + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: _bindInstanceProperty$1(_context = this.on).call(_context, this), + off: _bindInstanceProperty$1(_context2 = this.off).call(_context2, this), + emit: _bindInstanceProperty$1(_context3 = this.emit).call(_context3, this) + }, + hiddenDates: [], + util: { + getScale: function getScale() { + return me.timeAxis.step.scale; + }, + getStep: function getStep() { + return me.timeAxis.step.step; + }, + toScreen: _bindInstanceProperty$1(_context4 = me._toScreen).call(_context4, me), + toGlobalScreen: _bindInstanceProperty$1(_context5 = me._toGlobalScreen).call(_context5, me), + // this refers to the root.width + toTime: _bindInstanceProperty$1(_context6 = me._toTime).call(_context6, me), + toGlobalTime: _bindInstanceProperty$1(_context7 = me._toGlobalTime).call(_context7, me) + } + }; + + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; + + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + //this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); + + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); + + // item set + this.linegraph = new LineGraph(this.body); + this.components.push(this.linegraph); + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + this.on('tap', function (event) { + me.emit('click', me.getEventProperties(event)); + }); + this.on('doubletap', function (event) { + me.emit('doubleClick', me.getEventProperties(event)); + }); + this.dom.root.oncontextmenu = function (event) { + me.emit('contextmenu', me.getEventProperties(event)); + }; + + //Single time autoscale/fit + this.initialFitDone = false; + this.on('changed', function () { + if (me.itemsData == null) return; + if (!me.initialFitDone && !me.options.rollingMode) { + me.initialFitDone = true; + if (me.options.start != undefined || me.options.end != undefined) { + if (me.options.start == undefined || me.options.end == undefined) { + var range = me.getItemRange(); + } + var start = me.options.start != undefined ? me.options.start : range.min; + var end = me.options.end != undefined ? me.options.end : range.max; + me.setWindow(start, end, { + animation: false + }); + } else { + me.fit({ + animation: false + }); + } + } + if (!me.initialDrawDone && (me.initialRangeChangeDone || !me.options.start && !me.options.end || me.options.rollingMode)) { + me.initialDrawDone = true; + me.dom.root.style.visibility = 'visible'; + me.dom.loadingScreen.parentNode.removeChild(me.dom.loadingScreen); + if (me.options.onInitialDrawComplete) { + _setTimeout(function () { + return me.options.onInitialDrawComplete(); + }, 0); + } + } + }); + + // apply options + if (options) { + this.setOptions(options); + } + + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + this.setGroups(groups); + } + + // create itemset + if (items) { + this.setItems(items); + } + + // draw for the first time + this._redraw(); + } + + // Extend the functionality from Core + Graph2d.prototype = new Core(); + Graph2d.prototype.setOptions = function (options) { + // validate options + var errorFound = Validator.validate(options, allOptions); + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); + } + Core.prototype.setOptions.call(this, options); + }; + + /** + * Set items + * @param {vis.DataSet | Array | null} items + */ + Graph2d.prototype.setItems = function (items) { + var initialLoad = this.itemsData == null; + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } else if (isDataViewLike(items)) { + newDataSet = typeCoerceDataSet(items); + } else { + // turn an array into a dataset + newDataSet = typeCoerceDataSet(new DataSet(items)); + } + + // set items + if (this.itemsData) { + // stop maintaining a coerced version of the old data set + this.itemsData.dispose(); + } + this.itemsData = newDataSet; + this.linegraph && this.linegraph.setItems(newDataSet != null ? newDataSet.rawDS : null); + if (initialLoad) { + if (this.options.start != undefined || this.options.end != undefined) { + var start = this.options.start != undefined ? this.options.start : null; + var end = this.options.end != undefined ? this.options.end : null; + this.setWindow(start, end, { + animation: false + }); + } else { + this.fit({ + animation: false + }); + } + } + }; + + /** + * Set groups + * @param {vis.DataSet | Array} groups + */ + Graph2d.prototype.setGroups = function (groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } else if (isDataViewLike(groups)) { + newDataSet = groups; + } else { + // turn an array into a dataset + newDataSet = new DataSet(groups); + } + this.groupsData = newDataSet; + this.linegraph.setGroups(newDataSet); + }; + + /** + * Returns an object containing an SVG element with the icon of the group (size determined by iconWidth and iconHeight), the label of the group (content) and the yAxisOrientation of the group (left or right). + * @param {vis.GraphGroup.id} groupId + * @param {number} width + * @param {number} height + * @returns {{icon: SVGElement, label: string, orientation: string}|string} + */ + Graph2d.prototype.getLegend = function (groupId, width, height) { + if (width === undefined) { + width = 15; + } + if (height === undefined) { + height = 15; + } + if (this.linegraph.groups[groupId] !== undefined) { + return this.linegraph.groups[groupId].getLegend(width, height); + } else { + return "cannot find group:'" + groupId + "'"; + } + }; + + /** + * This checks if the visible option of the supplied group (by ID) is true or false. + * @param {vis.GraphGroup.id} groupId + * @returns {boolean} + */ + Graph2d.prototype.isGroupVisible = function (groupId) { + if (this.linegraph.groups[groupId] !== undefined) { + return this.linegraph.groups[groupId].visible && (this.linegraph.options.groups.visibility[groupId] === undefined || this.linegraph.options.groups.visibility[groupId] == true); + } else { + return false; + } + }; + + /** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ + Graph2d.prototype.getDataRange = function () { + var min = null; + var max = null; + + // calculate min from start filed + for (var groupId in this.linegraph.groups) { + if (this.linegraph.groups.hasOwnProperty(groupId)) { + if (this.linegraph.groups[groupId].visible == true) { + for (var i = 0; i < this.linegraph.groups[groupId].itemsData.length; i++) { + var item = this.linegraph.groups[groupId].itemsData[i]; + var value = availableUtils.convert(item.x, 'Date').valueOf(); + min = min == null ? value : min > value ? value : min; + max = max == null ? value : max < value ? value : max; + } + } + } + } + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; + }; + + /** + * Generate Timeline related information from an event + * @param {Event} event + * @return {Object} An object with related information, like on which area + * The event happened, whether clicked on an item, etc. + */ + Graph2d.prototype.getEventProperties = function (event) { + var clientX = event.center ? event.center.x : event.clientX; + var clientY = event.center ? event.center.y : event.clientY; + var x = clientX - availableUtils.getAbsoluteLeft(this.dom.centerContainer); + var y = clientY - availableUtils.getAbsoluteTop(this.dom.centerContainer); + var time = this._toTime(x); + var customTime = CustomTime.customTimeFromTarget(event); + var element = availableUtils.getTarget(event); + var what = null; + if (availableUtils.hasParent(element, this.timeAxis.dom.foreground)) { + what = 'axis'; + } else if (this.timeAxis2 && availableUtils.hasParent(element, this.timeAxis2.dom.foreground)) { + what = 'axis'; + } else if (availableUtils.hasParent(element, this.linegraph.yAxisLeft.dom.frame)) { + what = 'data-axis'; + } else if (availableUtils.hasParent(element, this.linegraph.yAxisRight.dom.frame)) { + what = 'data-axis'; + } else if (availableUtils.hasParent(element, this.linegraph.legendLeft.dom.frame)) { + what = 'legend'; + } else if (availableUtils.hasParent(element, this.linegraph.legendRight.dom.frame)) { + what = 'legend'; + } else if (customTime != null) { + what = 'custom-time'; + } else if (availableUtils.hasParent(element, this.currentTime.bar)) { + what = 'current-time'; + } else if (availableUtils.hasParent(element, this.dom.center)) { + what = 'background'; + } + var value = []; + var yAxisLeft = this.linegraph.yAxisLeft; + var yAxisRight = this.linegraph.yAxisRight; + if (!yAxisLeft.hidden && this.itemsData.length > 0) { + value.push(yAxisLeft.screenToValue(y)); + } + if (!yAxisRight.hidden && this.itemsData.length > 0) { + value.push(yAxisRight.screenToValue(y)); + } + return { + event: event, + customTime: customTime ? customTime.options.id : null, + what: what, + pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, + pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, + x: x, + y: y, + time: time, + value: value + }; + }; + + /** + * Load a configurator + * @return {Object} + * @private + */ + Graph2d.prototype._createConfigurator = function () { + return new Configurator(this, this.dom.container, configureOptions); + }; + + // locales + + // TODO: This should probably be moved somewhere else to ensure that both builds + // behave the same way. + var defaultLanguage = getNavigatorLanguage(); + moment$4.locale(defaultLanguage); + var timeline = { + Core: Core, + DateUtil: DateUtil, + Range: Range, + stack: stack$1, + TimeStep: TimeStep, + components: { + items: { + Item: Item, + BackgroundItem: BackgroundItem, + BoxItem: BoxItem, + ClusterItem: ClusterItem, + PointItem: PointItem, + RangeItem: RangeItem + }, + BackgroundGroup: BackgroundGroup, + Component: Component, + CurrentTime: CurrentTime, + CustomTime: CustomTime, + DataAxis: DataAxis, + DataScale: DataScale, + GraphGroup: GraphGroup, + Group: Group, + ItemSet: ItemSet, + Legend: Legend, + LineGraph: LineGraph, + TimeAxis: TimeAxis + } + }; + + exports.DOMutil = DOMutil; + exports.DataSet = DataSet; + exports.DataView = DataView; + exports.Graph2d = Graph2d; + exports.Hammer = Hammer; + exports.Queue = Queue; + exports.Timeline = Timeline; + exports.keycharm = keycharm; + exports.moment = moment$4; + exports.timeline = timeline; + exports.util = util$2; + +})); +//# sourceMappingURL=vis-timeline-graph2d.js.map diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.css b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.css new file mode 100644 index 000000000000..ca2b51c551fb --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.css @@ -0,0 +1 @@ +div.network-manipulation-closeDiv,div.network-manipulationUI,div.network-navigation{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;-khtml-user-select:none}div.network-manipulation-closeDiv,div.network-manipulationUI{background-repeat:no-repeat;cursor:pointer;-webkit-touch-callout:none}.vis .overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10}.vis-active{box-shadow:0 0 10px #86d5f8}.vis [class*=span]{min-height:0;width:auto}.vis.timeline.root{position:relative;border:1px solid #bfbfbf;overflow:hidden;padding:0;margin:0;box-sizing:border-box}.vis.timeline .vispanel{position:absolute;padding:0;margin:0;box-sizing:border-box}.vis.timeline .vispanel.bottom,.vis.timeline .vispanel.center,.vis.timeline .vispanel.left,.vis.timeline .vispanel.right,.vis.timeline .vispanel.top{border:1px #bfbfbf}.vis.timeline .vispanel.center,.vis.timeline .vispanel.left,.vis.timeline .vispanel.right{border-top-style:solid;border-bottom-style:solid;overflow:hidden}.vis.timeline .vispanel.bottom,.vis.timeline .vispanel.center,.vis.timeline .vispanel.top{border-left-style:solid;border-right-style:solid}.vis.timeline .background{overflow:hidden}.vis.timeline .vispanel>.content{position:relative}.vis.timeline .vispanel .shadow{position:absolute;width:100%;height:1px;box-shadow:0 0 10px rgba(0,0,0,.8)}.vis.timeline .vispanel .shadow.top{top:-1px;left:0}.vis.timeline .vispanel .shadow.bottom{bottom:-1px;left:0}.vis.timeline .labelset{position:relative;overflow:hidden;box-sizing:border-box}.vis.timeline .labelset .vlabel{position:relative;left:0;top:0;width:100%;color:#4d4d4d;box-sizing:border-box;border-bottom:1px solid #bfbfbf}.vis.timeline .labelset .vlabel:last-child{border-bottom:none}.vis.timeline .labelset .vlabel .inner{display:inline-block;padding:5px}.vis.timeline .labelset .vlabel .inner.hidden{padding:0}.vis.timeline .itemset{position:relative;padding:0;margin:0;box-sizing:border-box}.vis.timeline .itemset .background,.vis.timeline .itemset .foreground{position:absolute;width:100%;height:100%;overflow:visible}.vis.timeline .axis{position:absolute;width:100%;height:0;left:0;z-index:1}.vis.timeline .foreground .group{position:relative;box-sizing:border-box;border-bottom:1px solid #bfbfbf}.vis.timeline .foreground .group:last-child{border-bottom:none}.vis.timeline .item{position:absolute;color:#1A1A1A;border-color:#97B0F8;border-width:1px;background-color:#D5DDF6;display:inline-block;padding:5px}.vis.timeline .item.selected{border-color:#FFC200;background-color:#FFF785;z-index:2}.vis.timeline .editable .item.selected{cursor:move}.vis.timeline .item.point.selected{background-color:#FFF785}.vis.timeline .item.box{text-align:center;border-style:solid;border-radius:2px}.vis.timeline .item.point{background:0 0}.vis.timeline .item.dot{position:absolute;padding:0;border-width:4px;border-style:solid;border-radius:4px}.vis.timeline .item.range{border-style:solid;border-radius:2px;box-sizing:border-box}.vis.timeline .item.background{overflow:hidden;border:none;background-color:rgba(213,221,246,.4);box-sizing:border-box;padding:0;margin:0}.vis.timeline .item.range .content{position:relative;display:inline-block;max-width:100%;overflow:hidden}.vis.timeline .item.background .content{position:absolute;display:inline-block;overflow:hidden;max-width:100%;margin:5px}.vis.timeline .item.line{padding:0;position:absolute;width:0;border-left-width:1px;border-left-style:solid}.vis.timeline .item .content{white-space:nowrap;overflow:hidden}.vis.timeline .item .delete{background:url(dist/img/timeline/delete.png)top center no-repeat;position:absolute;width:24px;height:24px;top:0;right:-24px;cursor:pointer}.vis.timeline .item.range .drag-left{position:absolute;width:24px;max-width:20%;height:100%;top:0;left:-4px;cursor:w-resize}.vis.timeline .item.range .drag-right{position:absolute;width:24px;max-width:20%;height:100%;top:0;right:-4px;cursor:e-resize}.vis.timeline .timeaxis{position:relative;overflow:hidden}.vis.timeline .timeaxis.foreground{top:0;left:0;width:100%}.vis.timeline .timeaxis.background{position:absolute;top:0;left:0;width:100%;height:100%}.vis.timeline .timeaxis .text{position:absolute;color:#4d4d4d;padding:3px;white-space:nowrap}.vis.timeline .timeaxis .text.measure{position:absolute;padding-left:0;padding-right:0;margin-left:0;margin-right:0;visibility:hidden}.vis.timeline .timeaxis .grid.vertical{position:absolute;border-left:1px solid}.vis.timeline .timeaxis .grid.minor{border-color:#e5e5e5}.vis.timeline .timeaxis .grid.major{border-color:#bfbfbf}.vis.timeline .currenttime{background-color:#FF7F6E;width:2px;z-index:1}.vis.timeline .customtime{background-color:#6E94FF;width:2px;cursor:move;z-index:1}.vis.timeline .vispanel.background.horizontal .grid.horizontal{position:absolute;width:100%;height:0;border-bottom:1px solid}.vis.timeline .vispanel.background.horizontal .grid.minor{border-color:#e5e5e5}.vis.timeline .vispanel.background.horizontal .grid.major{border-color:#bfbfbf}.vis.timeline .dataaxis .yAxis.major{width:100%;position:absolute;color:#4d4d4d;white-space:nowrap}.vis.timeline .dataaxis .yAxis.major.measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis.timeline .dataaxis .yAxis.minor{position:absolute;width:100%;color:#bebebe;white-space:nowrap}.vis.timeline .dataaxis .yAxis.minor.measure{padding:0;margin:0;border:0;visibility:hidden;width:auto}.vis.timeline .dataaxis .yAxis.title{position:absolute;color:#4d4d4d;white-space:nowrap;bottom:20px;text-align:center}.vis.timeline .dataaxis .yAxis.title.measure{padding:0;margin:0;visibility:hidden;width:auto}.vis.timeline .dataaxis .yAxis.title.left{bottom:0;-webkit-transform-origin:left top;-moz-transform-origin:left top;-ms-transform-origin:left top;-o-transform-origin:left top;transform-origin:left bottom;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)}.vis.timeline .dataaxis .yAxis.title.right{bottom:0;-webkit-transform-origin:right bottom;-moz-transform-origin:right bottom;-ms-transform-origin:right bottom;-o-transform-origin:right bottom;transform-origin:right bottom;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.vis.timeline .legend{background-color:rgba(247,252,255,.65);padding:5px;border-color:#b3b3b3;border-style:solid;border-width:1px;box-shadow:2px 2px 10px rgba(154,154,154,.55)}.vis.timeline .legendText{white-space:nowrap;display:inline-block}.vis.timeline .graphGroup0{fill:#4f81bd;fill-opacity:0;stroke-width:2px;stroke:#4f81bd}.vis.timeline .graphGroup1{fill:#f79646;fill-opacity:0;stroke-width:2px;stroke:#f79646}.vis.timeline .graphGroup2{fill:#8c51cf;fill-opacity:0;stroke-width:2px;stroke:#8c51cf}.vis.timeline .graphGroup3{fill:#75c841;fill-opacity:0;stroke-width:2px;stroke:#75c841}.vis.timeline .graphGroup4{fill:#ff0100;fill-opacity:0;stroke-width:2px;stroke:#ff0100}.vis.timeline .graphGroup5{fill:#37d8e6;fill-opacity:0;stroke-width:2px;stroke:#37d8e6}.vis.timeline .graphGroup6{fill:#042662;fill-opacity:0;stroke-width:2px;stroke:#042662}.vis.timeline .graphGroup7{fill:#00ff26;fill-opacity:0;stroke-width:2px;stroke:#00ff26}.vis.timeline .graphGroup8{fill:#f0f;fill-opacity:0;stroke-width:2px;stroke:#f0f}.vis.timeline .graphGroup9{fill:#8f3938;fill-opacity:0;stroke-width:2px;stroke:#8f3938}.vis.timeline .fill{fill-opacity:.1;stroke:none}.vis.timeline .bar{fill-opacity:.5;stroke-width:1px}.vis.timeline .point{stroke-width:2px;fill-opacity:1}.vis.timeline .legendBackground{stroke-width:1px;fill-opacity:.9;fill:#fff;stroke:#c2c2c2}.vis.timeline .outline{stroke-width:1px;fill-opacity:1;fill:#fff;stroke:#e5e5e5}.vis.timeline .iconFill{fill-opacity:.3;stroke:none}div.network-manipulationDiv{border-width:0;border-bottom:1px;border-style:solid;border-color:#d6d9d8;background:#fff;background:-moz-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(48%,#fcfcfc),color-stop(50%,#fafafa),color-stop(100%,#fcfcfc));background:-webkit-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-o-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:-ms-linear-gradient(top,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);background:linear-gradient(to bottom,#fff 0,#fcfcfc 48%,#fafafa 50%,#fcfcfc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#fcfcfc', GradientType=0);position:absolute;left:0;top:0;width:100%;height:30px}div.network-manipulation-editMode{position:absolute;left:0;top:15px;height:30px}div.network-manipulation-closeDiv{position:absolute;right:0;top:0;width:30px;height:30px;background-position:20px 3px;background-image:url(dist/img/network/cross.png);user-select:none}div.network-manipulation-closeDiv:hover{opacity:.6}div.network-manipulationUI{position:relative;top:-7px;font-family:verdana;font-size:12px;-moz-border-radius:15px;border-radius:15px;display:inline-block;background-position:0 0;height:24px;margin:0 0 0 10px;vertical-align:middle;padding:0 8px;user-select:none}div.network-manipulationUI:hover{box-shadow:1px 1px 8px rgba(0,0,0,.2)}div.network-manipulationUI:active{box-shadow:1px 1px 8px rgba(0,0,0,.5)}div.network-manipulationUI.back{background-image:url(dist/img/network/backIcon.png)}div.network-manipulationUI.none:hover{box-shadow:1px 1px 8px transparent;cursor:default}div.network-manipulationUI.none:active{box-shadow:1px 1px 8px transparent}div.network-manipulationUI.none{padding:0}div.network-manipulationUI.notification{margin:2px;font-weight:700}div.network-manipulationUI.add{background-image:url(dist/img/network/addNodeIcon.png)}div.network-manipulationUI.edit{background-image:url(dist/img/network/editIcon.png)}div.network-manipulationUI.edit.editmode{background-color:#fcfcfc;border-style:solid;border-width:1px;border-color:#ccc}div.network-manipulationUI.connect{background-image:url(dist/img/network/connectIcon.png)}div.network-manipulationUI.delete{background-image:url(dist/img/network/deleteIcon.png)}div.network-manipulationLabel{margin:0 0 0 23px;line-height:25px}div.network-seperatorLine{display:inline-block;width:1px;height:20px;background-color:#bdbdbd;margin:5px 7px 0 15px}div.network-navigation_wrapper{position:absolute;left:0;top:0;width:100%;height:100%}div.network-navigation{width:34px;height:34px;-moz-border-radius:17px;border-radius:17px;position:absolute;display:inline-block;background-position:2px 2px;background-repeat:no-repeat;cursor:pointer;-webkit-touch-callout:none;user-select:none}div.network-navigation:hover{box-shadow:0 0 3px 3px rgba(56,207,21,.3)}div.network-navigation:active{box-shadow:0 0 1px 3px rgba(56,207,21,.95)}div.network-navigation.up{background-image:url(dist/img/network/upArrow.png);bottom:50px;left:55px}div.network-navigation.down{background-image:url(dist/img/network/downArrow.png);bottom:10px;left:55px}div.network-navigation.left{background-image:url(dist/img/network/leftArrow.png);bottom:10px;left:15px}div.network-navigation.right{background-image:url(dist/img/network/rightArrow.png);bottom:10px;left:95px}div.network-navigation.zoomIn{background-image:url(dist/img/network/plus.png);bottom:10px;right:15px}div.network-navigation.zoomOut{background-image:url(dist/img/network/minus.png);bottom:10px;right:55px}div.network-navigation.zoomExtends{background-image:url(dist/img/network/zoomExtends.png);bottom:50px;right:15px}div.network-tooltip{position:absolute;visibility:hidden;padding:5px;white-space:nowrap;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;border:1px solid;box-shadow:3px 3px 10px rgba(128,128,128,.5)} diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.js b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.js new file mode 100644 index 000000000000..6cb78c1ff46e --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/vis/vis.min.js @@ -0,0 +1,48 @@ +/** + * vis-timeline and vis-graph2d + * https://visjs.github.io/vis-timeline/ + * + * Create a fully customizable, interactive timeline with items and ranges. + * + * @version 7.7.3 + * @date 2023-10-27T17:57:57.604Z + * + * @copyright (c) 2011-2017 Almende B.V, http://almende.com + * @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs + * + * @license + * vis.js is dual licensed under both + * + * 1. The Apache 2.0 License + * http://www.apache.org/licenses/LICENSE-2.0 + * + * and + * + * 2. The MIT License + * http://opensource.org/licenses/MIT + * + * vis.js may be distributed under either license. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vis=t.vis||{})}(this,(function(t){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o,s,a={exports:{}};function l(){return o||(o=1,function(t,e){t.exports=function(){var e,i;function n(){return e.apply(null,arguments)}function o(t){e=t}function s(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function a(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function l(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function h(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(l(t,e))return!1;return!0}function u(t){return void 0===t}function d(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function c(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function p(t,e){var i,n=[],r=t.length;for(i=0;i>>0;for(e=0;e0)for(i=0;i=0?i?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+n}var F=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,j=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Y={},H={};function z(t,e,i,n){var r=n;"string"==typeof n&&(r=function(){return this[n]()}),t&&(H[t]=r),e&&(H[e[0]]=function(){return R(r.apply(this,arguments),e[1],e[2])}),i&&(H[i]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function B(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function G(t){var e,i,n=t.match(F);for(e=0,i=n.length;e=0&&j.test(t);)t=t.replace(j,n),j.lastIndex=0,i-=1;return t}var U={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function X(t){var e=this._longDateFormat[t],i=this._longDateFormat[t.toUpperCase()];return e||!i?e:(this._longDateFormat[t]=i.match(F).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])}var q="Invalid date";function $(){return this._invalidDate}var Z="%d",K=/\d{1,2}/;function J(t){return this._ordinal.replace("%d",t)}var Q={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function tt(t,e,i,n){var r=this._relativeTime[i];return E(r)?r(t,e,i,n):r.replace(/%d/i,t)}function et(t,e){var i=this._relativeTime[t>0?"future":"past"];return E(i)?i(e):i.replace(/%s/i,e)}var it={};function nt(t,e){var i=t.toLowerCase();it[i]=it[i+"s"]=it[e]=t}function rt(t){return"string"==typeof t?it[t]||it[t.toLowerCase()]:void 0}function ot(t){var e,i,n={};for(i in t)l(t,i)&&(e=rt(i))&&(n[e]=t[i]);return n}var st={};function at(t,e){st[t]=e}function lt(t){var e,i=[];for(e in t)l(t,e)&&i.push({unit:e,priority:st[e]});return i.sort((function(t,e){return t.priority-e.priority})),i}function ht(t){return t%4==0&&t%100!=0||t%400==0}function ut(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function dt(t){var e=+t,i=0;return 0!==e&&isFinite(e)&&(i=ut(e)),i}function ct(t,e){return function(i){return null!=i?(ft(this,t,i),n.updateOffset(this,e),this):pt(this,t)}}function pt(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function ft(t,e,i){t.isValid()&&!isNaN(i)&&("FullYear"===e&&ht(t.year())&&1===t.month()&&29===t.date()?(i=dt(i),t._d["set"+(t._isUTC?"UTC":"")+e](i,t.month(),te(i,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](i))}function mt(t){return E(this[t=rt(t)])?this[t]():this}function vt(t,e){if("object"==typeof t){var i,n=lt(t=ot(t)),r=n.length;for(i=0;i68?1900:2e3)};var ge=ct("FullYear",!0);function ye(){return ht(this.year())}function be(t,e,i,n,r,o,s){var a;return t<100&&t>=0?(a=new Date(t+400,e,i,n,r,o,s),isFinite(a.getFullYear())&&a.setFullYear(t)):a=new Date(t,e,i,n,r,o,s),a}function _e(t){var e,i;return t<100&&t>=0?((i=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,i)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function we(t,e,i){var n=7+e-i;return-(7+_e(t,0,n).getUTCDay()-e)%7+n-1}function ke(t,e,i,n,r){var o,s,a=1+7*(e-1)+(7+i-n)%7+we(t,n,r);return a<=0?s=ve(o=t-1)+a:a>ve(t)?(o=t+1,s=a-ve(t)):(o=t,s=a),{year:o,dayOfYear:s}}function xe(t,e,i){var n,r,o=we(t.year(),e,i),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?n=s+De(r=t.year()-1,e,i):s>De(t.year(),e,i)?(n=s-De(t.year(),e,i),r=t.year()+1):(r=t.year(),n=s),{week:n,year:r}}function De(t,e,i){var n=we(t,e,i),r=we(t+1,e,i);return(ve(t)-n+r)/7}function Se(t){return xe(t,this._week.dow,this._week.doy).week}z("w",["ww",2],"wo","week"),z("W",["WW",2],"Wo","isoWeek"),nt("week","w"),nt("isoWeek","W"),at("week",5),at("isoWeek",5),Nt("w",xt),Nt("ww",xt,bt),Nt("W",xt),Nt("WW",xt,bt),zt(["w","ww","W","WW"],(function(t,e,i,n){e[n.substr(0,1)]=dt(t)}));var Ce={dow:0,doy:6};function Te(){return this._week.dow}function Me(){return this._week.doy}function Oe(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ee(t){var e=xe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Pe(t,e){return"string"!=typeof t?t:isNaN(t)?"number"==typeof(t=e.weekdaysParse(t))?t:null:parseInt(t,10)}function Ae(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Ie(t,e){return t.slice(e,7).concat(t.slice(0,e))}z("d",0,"do","day"),z("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),z("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),z("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),z("e",0,0,"weekday"),z("E",0,0,"isoWeekday"),nt("day","d"),nt("weekday","e"),nt("isoWeekday","E"),at("day",11),at("weekday",11),at("isoWeekday",11),Nt("d",xt),Nt("e",xt),Nt("E",xt),Nt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),Nt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),Nt("dddd",(function(t,e){return e.weekdaysRegex(t)})),zt(["dd","ddd","dddd"],(function(t,e,i,n){var r=i._locale.weekdaysParse(t,n,i._strict);null!=r?e.d=r:g(i).invalidWeekday=t})),zt(["d","e","E"],(function(t,e,i,n){e[n]=dt(t)}));var Le="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ne="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Re="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Fe=Lt,je=Lt,Ye=Lt;function He(t,e){var i=s(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Ie(i,this._week.dow):t?i[t.day()]:i}function ze(t){return!0===t?Ie(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Be(t){return!0===t?Ie(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Ge(t,e,i){var n,r,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=m([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return i?"dddd"===e?-1!==(r=Gt.call(this._weekdaysParse,s))?r:null:"ddd"===e?-1!==(r=Gt.call(this._shortWeekdaysParse,s))?r:null:-1!==(r=Gt.call(this._minWeekdaysParse,s))?r:null:"dddd"===e?-1!==(r=Gt.call(this._weekdaysParse,s))||-1!==(r=Gt.call(this._shortWeekdaysParse,s))||-1!==(r=Gt.call(this._minWeekdaysParse,s))?r:null:"ddd"===e?-1!==(r=Gt.call(this._shortWeekdaysParse,s))||-1!==(r=Gt.call(this._weekdaysParse,s))||-1!==(r=Gt.call(this._minWeekdaysParse,s))?r:null:-1!==(r=Gt.call(this._minWeekdaysParse,s))||-1!==(r=Gt.call(this._weekdaysParse,s))||-1!==(r=Gt.call(this._shortWeekdaysParse,s))?r:null}function We(t,e,i){var n,r,o;if(this._weekdaysParseExact)return Ge.call(this,t,e,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(r=m([2e3,1]).day(n),i&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),i&&"dddd"===e&&this._fullWeekdaysParse[n].test(t))return n;if(i&&"ddd"===e&&this._shortWeekdaysParse[n].test(t))return n;if(i&&"dd"===e&&this._minWeekdaysParse[n].test(t))return n;if(!i&&this._weekdaysParse[n].test(t))return n}}function Ve(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Pe(t,this.localeData()),this.add(t-e,"d")):e}function Ue(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Xe(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Ae(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function qe(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Fe),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function $e(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=je),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Ze(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ke.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ye),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ke(){function t(t,e){return e.length-t.length}var e,i,n,r,o,s=[],a=[],l=[],h=[];for(e=0;e<7;e++)i=m([2e3,1]).day(e),n=jt(this.weekdaysMin(i,"")),r=jt(this.weekdaysShort(i,"")),o=jt(this.weekdays(i,"")),s.push(n),a.push(r),l.push(o),h.push(n),h.push(r),h.push(o);s.sort(t),a.sort(t),l.sort(t),h.sort(t),this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Je(){return this.hours()%12||12}function Qe(){return this.hours()||24}function ti(t,e){z(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function ei(t,e){return e._meridiemParse}function ii(t){return"p"===(t+"").toLowerCase().charAt(0)}z("H",["HH",2],0,"hour"),z("h",["hh",2],0,Je),z("k",["kk",2],0,Qe),z("hmm",0,0,(function(){return""+Je.apply(this)+R(this.minutes(),2)})),z("hmmss",0,0,(function(){return""+Je.apply(this)+R(this.minutes(),2)+R(this.seconds(),2)})),z("Hmm",0,0,(function(){return""+this.hours()+R(this.minutes(),2)})),z("Hmmss",0,0,(function(){return""+this.hours()+R(this.minutes(),2)+R(this.seconds(),2)})),ti("a",!0),ti("A",!1),nt("hour","h"),at("hour",13),Nt("a",ei),Nt("A",ei),Nt("H",xt),Nt("h",xt),Nt("k",xt),Nt("HH",xt,bt),Nt("hh",xt,bt),Nt("kk",xt,bt),Nt("hmm",Dt),Nt("hmmss",St),Nt("Hmm",Dt),Nt("Hmmss",St),Ht(["H","HH"],Xt),Ht(["k","kk"],(function(t,e,i){var n=dt(t);e[Xt]=24===n?0:n})),Ht(["a","A"],(function(t,e,i){i._isPm=i._locale.isPM(t),i._meridiem=t})),Ht(["h","hh"],(function(t,e,i){e[Xt]=dt(t),g(i).bigHour=!0})),Ht("hmm",(function(t,e,i){var n=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n)),g(i).bigHour=!0})),Ht("hmmss",(function(t,e,i){var n=t.length-4,r=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n,2)),e[$t]=dt(t.substr(r)),g(i).bigHour=!0})),Ht("Hmm",(function(t,e,i){var n=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n))})),Ht("Hmmss",(function(t,e,i){var n=t.length-4,r=t.length-2;e[Xt]=dt(t.substr(0,n)),e[qt]=dt(t.substr(n,2)),e[$t]=dt(t.substr(r))}));var ni=/[ap]\.?m?\.?/i,ri=ct("Hours",!0);function oi(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"}var si,ai={calendar:L,longDateFormat:U,invalidDate:q,ordinal:Z,dayOfMonthOrdinalParse:K,relativeTime:Q,months:ee,monthsShort:ie,week:Ce,weekdays:Le,weekdaysMin:Re,weekdaysShort:Ne,meridiemParse:ni},li={},hi={};function ui(t,e){var i,n=Math.min(t.length,e.length);for(i=0;i0;){if(n=fi(r.slice(0,e).join("-")))return n;if(i&&i.length>=e&&ui(r,i)>=e-1)break;e--}o++}return si}function pi(t){return null!=t.match("^[^/\\\\]*$")}function fi(e){var i=null;if(void 0===li[e]&&t&&t.exports&&pi(e))try{i=si._abbr,r("./locale/"+e),mi(i)}catch(t){li[e]=null}return li[e]}function mi(t,e){var i;return t&&((i=u(e)?yi(t):vi(t,e))?si=i:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),si._abbr}function vi(t,e){if(null!==e){var i,n=ai;if(e.abbr=t,null!=li[t])O("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=li[t]._config;else if(null!=e.parentLocale)if(null!=li[e.parentLocale])n=li[e.parentLocale]._config;else{if(null==(i=fi(e.parentLocale)))return hi[e.parentLocale]||(hi[e.parentLocale]=[]),hi[e.parentLocale].push({name:t,config:e}),null;n=i._config}return li[t]=new I(A(n,e)),hi[t]&&hi[t].forEach((function(t){vi(t.name,t.config)})),mi(t),li[t]}return delete li[t],null}function gi(t,e){if(null!=e){var i,n,r=ai;null!=li[t]&&null!=li[t].parentLocale?li[t].set(A(li[t]._config,e)):(null!=(n=fi(t))&&(r=n._config),e=A(r,e),null==n&&(e.abbr=t),(i=new I(e)).parentLocale=li[t],li[t]=i),mi(t)}else null!=li[t]&&(null!=li[t].parentLocale?(li[t]=li[t].parentLocale,t===mi()&&mi(t)):null!=li[t]&&delete li[t]);return li[t]}function yi(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return si;if(!s(t)){if(e=fi(t))return e;t=[t]}return ci(t)}function bi(){return T(li)}function _i(t){var e,i=t._a;return i&&-2===g(t).overflow&&(e=i[Vt]<0||i[Vt]>11?Vt:i[Ut]<1||i[Ut]>te(i[Wt],i[Vt])?Ut:i[Xt]<0||i[Xt]>24||24===i[Xt]&&(0!==i[qt]||0!==i[$t]||0!==i[Zt])?Xt:i[qt]<0||i[qt]>59?qt:i[$t]<0||i[$t]>59?$t:i[Zt]<0||i[Zt]>999?Zt:-1,g(t)._overflowDayOfYear&&(eUt)&&(e=Ut),g(t)._overflowWeeks&&-1===e&&(e=Kt),g(t)._overflowWeekday&&-1===e&&(e=Jt),g(t).overflow=e),t}var wi=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ki=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,xi=/Z|[+-]\d\d(?::?\d\d)?/,Di=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Si=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ci=/^\/?Date\((-?\d+)/i,Ti=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Mi={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Oi(t){var e,i,n,r,o,s,a=t._i,l=wi.exec(a)||ki.exec(a),h=Di.length,u=Si.length;if(l){for(g(t).iso=!0,e=0,i=h;eve(o)||0===t._dayOfYear)&&(g(t)._overflowDayOfYear=!0),i=_e(o,0,t._dayOfYear),t._a[Vt]=i.getUTCMonth(),t._a[Ut]=i.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=n[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[Xt]&&0===t._a[qt]&&0===t._a[$t]&&0===t._a[Zt]&&(t._nextDay=!0,t._a[Xt]=0),t._d=(t._useUTC?_e:be).apply(null,s),r=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Xt]=24),t._w&&void 0!==t._w.d&&t._w.d!==r&&(g(t).weekdayMismatch=!0)}}function Hi(t){var e,i,n,r,o,s,a,l,h;null!=(e=t._w).GG||null!=e.W||null!=e.E?(o=1,s=4,i=Fi(e.GG,t._a[Wt],xe($i(),1,4).year),n=Fi(e.W,1),((r=Fi(e.E,1))<1||r>7)&&(l=!0)):(o=t._locale._week.dow,s=t._locale._week.doy,h=xe($i(),o,s),i=Fi(e.gg,t._a[Wt],h.year),n=Fi(e.w,h.week),null!=e.d?((r=e.d)<0||r>6)&&(l=!0):null!=e.e?(r=e.e+o,(e.e<0||e.e>6)&&(l=!0)):r=o),n<1||n>De(i,o,s)?g(t)._overflowWeeks=!0:null!=l?g(t)._overflowWeekday=!0:(a=ke(i,n,r,o,s),t._a[Wt]=a.year,t._dayOfYear=a.dayOfYear)}function zi(t){if(t._f!==n.ISO_8601)if(t._f!==n.RFC_2822){t._a=[],g(t).empty=!0;var e,i,r,o,s,a,l,h=""+t._i,u=h.length,d=0;for(l=(r=V(t._f,t._locale).match(F)||[]).length,e=0;e0&&g(t).unusedInput.push(s),h=h.slice(h.indexOf(i)+i.length),d+=i.length),H[o]?(i?g(t).empty=!1:g(t).unusedTokens.push(o),Bt(o,i,t)):t._strict&&!i&&g(t).unusedTokens.push(o);g(t).charsLeftOver=u-d,h.length>0&&g(t).unusedInput.push(h),t._a[Xt]<=12&&!0===g(t).bigHour&&t._a[Xt]>0&&(g(t).bigHour=void 0),g(t).parsedDateParts=t._a.slice(0),g(t).meridiem=t._meridiem,t._a[Xt]=Bi(t._locale,t._a[Xt],t._meridiem),null!==(a=g(t).era)&&(t._a[Wt]=t._locale.erasConvertYear(a,t._a[Wt])),Yi(t),_i(t)}else Ni(t);else Oi(t)}function Bi(t,e,i){var n;return null==i?e:null!=t.meridiemHour?t.meridiemHour(e,i):null!=t.isPM?((n=t.isPM(i))&&e<12&&(e+=12),n||12!==e||(e=0),e):e}function Gi(t){var e,i,n,r,o,s,a=!1,l=t._f.length;if(0===l)return g(t).invalidFormat=!0,void(t._d=new Date(NaN));for(r=0;rthis?this:t:b()}));function Ji(t,e){var i,n;if(1===e.length&&s(e[0])&&(e=e[0]),!e.length)return $i();for(i=e[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function xn(){if(!u(this._isDSTShifted))return this._isDSTShifted;var t,e={};return k(e,this),(e=Ui(e))._a?(t=e._isUTC?m(e._a):$i(e._a),this._isDSTShifted=this.isValid()&&un(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Dn(){return!!this.isValid()&&!this._isUTC}function Sn(){return!!this.isValid()&&this._isUTC}function Cn(){return!!this.isValid()&&this._isUTC&&0===this._offset}n.updateOffset=function(){};var Tn=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Mn=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function On(t,e){var i,n,r,o=t,s=null;return ln(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:d(t)||!isNaN(+t)?(o={},e?o[e]=+t:o.milliseconds=+t):(s=Tn.exec(t))?(i="-"===s[1]?-1:1,o={y:0,d:dt(s[Ut])*i,h:dt(s[Xt])*i,m:dt(s[qt])*i,s:dt(s[$t])*i,ms:dt(hn(1e3*s[Zt]))*i}):(s=Mn.exec(t))?(i="-"===s[1]?-1:1,o={y:En(s[2],i),M:En(s[3],i),w:En(s[4],i),d:En(s[5],i),h:En(s[6],i),m:En(s[7],i),s:En(s[8],i)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=An($i(o.from),$i(o.to)),(o={}).ms=r.milliseconds,o.M=r.months),n=new an(o),ln(t)&&l(t,"_locale")&&(n._locale=t._locale),ln(t)&&l(t,"_isValid")&&(n._isValid=t._isValid),n}function En(t,e){var i=t&&parseFloat(t.replace(",","."));return(isNaN(i)?0:i)*e}function Pn(t,e){var i={};return i.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(i.months,"M").isAfter(e)&&--i.months,i.milliseconds=+e-+t.clone().add(i.months,"M"),i}function An(t,e){var i;return t.isValid()&&e.isValid()?(e=fn(e,t),t.isBefore(e)?i=Pn(t,e):((i=Pn(e,t)).milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function In(t,e){return function(i,n){var r;return null===n||isNaN(+n)||(O(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=i,i=n,n=r),Ln(this,On(i,n),t),this}}function Ln(t,e,i,r){var o=e._milliseconds,s=hn(e._days),a=hn(e._months);t.isValid()&&(r=null==r||r,a&&ue(t,pt(t,"Month")+a*i),s&&ft(t,"Date",pt(t,"Date")+s*i),o&&t._d.setTime(t._d.valueOf()+o*i),r&&n.updateOffset(t,s||a))}On.fn=an.prototype,On.invalid=sn;var Nn=In(1,"add"),Rn=In(-1,"subtract");function Fn(t){return"string"==typeof t||t instanceof String}function jn(t){return D(t)||c(t)||Fn(t)||d(t)||Hn(t)||Yn(t)||null==t}function Yn(t){var e,i,n=a(t)&&!h(t),r=!1,o=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s=o.length;for(e=0;ei.valueOf():i.valueOf()9999?W(i,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):E(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",W(i,"Z")):W(i,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function er(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,i,n,r="moment",o="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",o="Z"),t="["+r+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i="-MM-DD[T]HH:mm:ss.SSS",n=o+'[")]',this.format(t+e+i+n)}function ir(t){t||(t=this.isUtc()?n.defaultFormatUtc:n.defaultFormat);var e=W(this,t);return this.localeData().postformat(e)}function nr(t,e){return this.isValid()&&(D(t)&&t.isValid()||$i(t).isValid())?On({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function rr(t){return this.from($i(),t)}function or(t,e){return this.isValid()&&(D(t)&&t.isValid()||$i(t).isValid())?On({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function sr(t){return this.to($i(),t)}function ar(t){var e;return void 0===t?this._locale._abbr:(null!=(e=yi(t))&&(this._locale=e),this)}n.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",n.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var lr=C("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(t){return void 0===t?this.localeData():this.locale(t)}));function hr(){return this._locale}var ur=1e3,dr=60*ur,cr=60*dr,pr=3506328*cr;function fr(t,e){return(t%e+e)%e}function mr(t,e,i){return t<100&&t>=0?new Date(t+400,e,i)-pr:new Date(t,e,i).valueOf()}function vr(t,e,i){return t<100&&t>=0?Date.UTC(t+400,e,i)-pr:Date.UTC(t,e,i)}function gr(t){var e,i;if(void 0===(t=rt(t))||"millisecond"===t||!this.isValid())return this;switch(i=this._isUTC?vr:mr,t){case"year":e=i(this.year(),0,1);break;case"quarter":e=i(this.year(),this.month()-this.month()%3,1);break;case"month":e=i(this.year(),this.month(),1);break;case"week":e=i(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=i(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=fr(e+(this._isUTC?0:this.utcOffset()*dr),cr);break;case"minute":e=this._d.valueOf(),e-=fr(e,dr);break;case"second":e=this._d.valueOf(),e-=fr(e,ur)}return this._d.setTime(e),n.updateOffset(this,!0),this}function yr(t){var e,i;if(void 0===(t=rt(t))||"millisecond"===t||!this.isValid())return this;switch(i=this._isUTC?vr:mr,t){case"year":e=i(this.year()+1,0,1)-1;break;case"quarter":e=i(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=i(this.year(),this.month()+1,1)-1;break;case"week":e=i(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=i(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=cr-fr(e+(this._isUTC?0:this.utcOffset()*dr),cr)-1;break;case"minute":e=this._d.valueOf(),e+=dr-fr(e,dr)-1;break;case"second":e=this._d.valueOf(),e+=ur-fr(e,ur)-1}return this._d.setTime(e),n.updateOffset(this,!0),this}function br(){return this._d.valueOf()-6e4*(this._offset||0)}function _r(){return Math.floor(this.valueOf()/1e3)}function wr(){return new Date(this.valueOf())}function kr(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function xr(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Dr(){return this.isValid()?this.toISOString():null}function Sr(){return y(this)}function Cr(){return f({},g(this))}function Tr(){return g(this).overflow}function Mr(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Or(t,e){var i,r,o,s=this._eras||yi("en")._eras;for(i=0,r=s.length;i=0)return l[n]}function Pr(t,e){var i=t.since<=t.until?1:-1;return void 0===e?n(t.since).year():n(t.since).year()+(e-t.offset)*i}function Ar(){var t,e,i,n=this.localeData().eras();for(t=0,e=n.length;t(o=De(t,n,r))&&(e=o),Jr.call(this,t,e,i,n,r))}function Jr(t,e,i,n,r){var o=ke(t,e,i,n,r),s=_e(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Qr(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}z("N",0,0,"eraAbbr"),z("NN",0,0,"eraAbbr"),z("NNN",0,0,"eraAbbr"),z("NNNN",0,0,"eraName"),z("NNNNN",0,0,"eraNarrow"),z("y",["y",1],"yo","eraYear"),z("y",["yy",2],0,"eraYear"),z("y",["yyy",3],0,"eraYear"),z("y",["yyyy",4],0,"eraYear"),Nt("N",Yr),Nt("NN",Yr),Nt("NNN",Yr),Nt("NNNN",Hr),Nt("NNNNN",zr),Ht(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,i,n){var r=i._locale.erasParse(t,n,i._strict);r?g(i).era=r:g(i).invalidEra=t})),Nt("y",Ot),Nt("yy",Ot),Nt("yyy",Ot),Nt("yyyy",Ot),Nt("yo",Br),Ht(["y","yy","yyy","yyyy"],Wt),Ht(["yo"],(function(t,e,i,n){var r;i._locale._eraYearOrdinalRegex&&(r=t.match(i._locale._eraYearOrdinalRegex)),i._locale.eraYearOrdinalParse?e[Wt]=i._locale.eraYearOrdinalParse(t,r):e[Wt]=parseInt(t,10)})),z(0,["gg",2],0,(function(){return this.weekYear()%100})),z(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Wr("gggg","weekYear"),Wr("ggggg","weekYear"),Wr("GGGG","isoWeekYear"),Wr("GGGGG","isoWeekYear"),nt("weekYear","gg"),nt("isoWeekYear","GG"),at("weekYear",1),at("isoWeekYear",1),Nt("G",Et),Nt("g",Et),Nt("GG",xt,bt),Nt("gg",xt,bt),Nt("GGGG",Tt,wt),Nt("gggg",Tt,wt),Nt("GGGGG",Mt,kt),Nt("ggggg",Mt,kt),zt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,i,n){e[n.substr(0,2)]=dt(t)})),zt(["gg","GG"],(function(t,e,i,r){e[r]=n.parseTwoDigitYear(t)})),z("Q",0,"Qo","quarter"),nt("quarter","Q"),at("quarter",7),Nt("Q",yt),Ht("Q",(function(t,e){e[Vt]=3*(dt(t)-1)})),z("D",["DD",2],"Do","date"),nt("date","D"),at("date",9),Nt("D",xt),Nt("DD",xt,bt),Nt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),Ht(["D","DD"],Ut),Ht("Do",(function(t,e){e[Ut]=dt(t.match(xt)[0])}));var to=ct("Date",!0);function eo(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}z("DDD",["DDDD",3],"DDDo","dayOfYear"),nt("dayOfYear","DDD"),at("dayOfYear",4),Nt("DDD",Ct),Nt("DDDD",_t),Ht(["DDD","DDDD"],(function(t,e,i){i._dayOfYear=dt(t)})),z("m",["mm",2],0,"minute"),nt("minute","m"),at("minute",14),Nt("m",xt),Nt("mm",xt,bt),Ht(["m","mm"],qt);var io=ct("Minutes",!1);z("s",["ss",2],0,"second"),nt("second","s"),at("second",15),Nt("s",xt),Nt("ss",xt,bt),Ht(["s","ss"],$t);var no,ro,oo=ct("Seconds",!1);for(z("S",0,0,(function(){return~~(this.millisecond()/100)})),z(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),z(0,["SSS",3],0,"millisecond"),z(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),z(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),z(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),z(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),z(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),z(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),nt("millisecond","ms"),at("millisecond",16),Nt("S",Ct,yt),Nt("SS",Ct,bt),Nt("SSS",Ct,_t),no="SSSS";no.length<=9;no+="S")Nt(no,Ot);function so(t,e){e[Zt]=dt(1e3*("0."+t))}for(no="S";no.length<=9;no+="S")Ht(no,so);function ao(){return this._isUTC?"UTC":""}function lo(){return this._isUTC?"Coordinated Universal Time":""}ro=ct("Milliseconds",!1),z("z",0,0,"zoneAbbr"),z("zz",0,0,"zoneName");var ho=x.prototype;function uo(t){return $i(1e3*t)}function co(){return $i.apply(null,arguments).parseZone()}function po(t){return t}ho.add=Nn,ho.calendar=Gn,ho.clone=Wn,ho.diff=Kn,ho.endOf=yr,ho.format=ir,ho.from=nr,ho.fromNow=rr,ho.to=or,ho.toNow=sr,ho.get=mt,ho.invalidAt=Tr,ho.isAfter=Vn,ho.isBefore=Un,ho.isBetween=Xn,ho.isSame=qn,ho.isSameOrAfter=$n,ho.isSameOrBefore=Zn,ho.isValid=Sr,ho.lang=lr,ho.locale=ar,ho.localeData=hr,ho.max=Ki,ho.min=Zi,ho.parsingFlags=Cr,ho.set=vt,ho.startOf=gr,ho.subtract=Rn,ho.toArray=kr,ho.toObject=xr,ho.toDate=wr,ho.toISOString=tr,ho.inspect=er,"undefined"!=typeof Symbol&&null!=Symbol.for&&(ho[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ho.toJSON=Dr,ho.toString=Qn,ho.unix=_r,ho.valueOf=br,ho.creationData=Mr,ho.eraName=Ar,ho.eraNarrow=Ir,ho.eraAbbr=Lr,ho.eraYear=Nr,ho.year=ge,ho.isLeapYear=ye,ho.weekYear=Vr,ho.isoWeekYear=Ur,ho.quarter=ho.quarters=Qr,ho.month=de,ho.daysInMonth=ce,ho.week=ho.weeks=Oe,ho.isoWeek=ho.isoWeeks=Ee,ho.weeksInYear=$r,ho.weeksInWeekYear=Zr,ho.isoWeeksInYear=Xr,ho.isoWeeksInISOWeekYear=qr,ho.date=to,ho.day=ho.days=Ve,ho.weekday=Ue,ho.isoWeekday=Xe,ho.dayOfYear=eo,ho.hour=ho.hours=ri,ho.minute=ho.minutes=io,ho.second=ho.seconds=oo,ho.millisecond=ho.milliseconds=ro,ho.utcOffset=vn,ho.utc=yn,ho.local=bn,ho.parseZone=_n,ho.hasAlignedHourOffset=wn,ho.isDST=kn,ho.isLocal=Dn,ho.isUtcOffset=Sn,ho.isUtc=Cn,ho.isUTC=Cn,ho.zoneAbbr=ao,ho.zoneName=lo,ho.dates=C("dates accessor is deprecated. Use date instead.",to),ho.months=C("months accessor is deprecated. Use month instead",de),ho.years=C("years accessor is deprecated. Use year instead",ge),ho.zone=C("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gn),ho.isDSTShifted=C("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",xn);var fo=I.prototype;function mo(t,e,i,n){var r=yi(),o=m().set(n,e);return r[i](o,t)}function vo(t,e,i){if(d(t)&&(e=t,t=void 0),t=t||"",null!=e)return mo(t,e,i,"month");var n,r=[];for(n=0;n<12;n++)r[n]=mo(t,n,i,"month");return r}function go(t,e,i,n){"boolean"==typeof t?(d(e)&&(i=e,e=void 0),e=e||""):(i=e=t,t=!1,d(e)&&(i=e,e=void 0),e=e||"");var r,o=yi(),s=t?o._week.dow:0,a=[];if(null!=i)return mo(e,(i+s)%7,n,"day");for(r=0;r<7;r++)a[r]=mo(e,(r+s)%7,n,"day");return a}function yo(t,e){return vo(t,e,"months")}function bo(t,e){return vo(t,e,"monthsShort")}function _o(t,e,i){return go(t,e,i,"weekdays")}function wo(t,e,i){return go(t,e,i,"weekdaysShort")}function ko(t,e,i){return go(t,e,i,"weekdaysMin")}fo.calendar=N,fo.longDateFormat=X,fo.invalidDate=$,fo.ordinal=J,fo.preparse=po,fo.postformat=po,fo.relativeTime=tt,fo.pastFuture=et,fo.set=P,fo.eras=Or,fo.erasParse=Er,fo.erasConvertYear=Pr,fo.erasAbbrRegex=Fr,fo.erasNameRegex=Rr,fo.erasNarrowRegex=jr,fo.months=se,fo.monthsShort=ae,fo.monthsParse=he,fo.monthsRegex=fe,fo.monthsShortRegex=pe,fo.week=Se,fo.firstDayOfYear=Me,fo.firstDayOfWeek=Te,fo.weekdays=He,fo.weekdaysMin=Be,fo.weekdaysShort=ze,fo.weekdaysParse=We,fo.weekdaysRegex=qe,fo.weekdaysShortRegex=$e,fo.weekdaysMinRegex=Ze,fo.isPM=ii,fo.meridiem=oi,mi("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===dt(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),n.lang=C("moment.lang is deprecated. Use moment.locale instead.",mi),n.langData=C("moment.langData is deprecated. Use moment.localeData instead.",yi);var xo=Math.abs;function Do(){var t=this._data;return this._milliseconds=xo(this._milliseconds),this._days=xo(this._days),this._months=xo(this._months),t.milliseconds=xo(t.milliseconds),t.seconds=xo(t.seconds),t.minutes=xo(t.minutes),t.hours=xo(t.hours),t.months=xo(t.months),t.years=xo(t.years),this}function So(t,e,i,n){var r=On(e,i);return t._milliseconds+=n*r._milliseconds,t._days+=n*r._days,t._months+=n*r._months,t._bubble()}function Co(t,e){return So(this,t,e,1)}function To(t,e){return So(this,t,e,-1)}function Mo(t){return t<0?Math.floor(t):Math.ceil(t)}function Oo(){var t,e,i,n,r,o=this._milliseconds,s=this._days,a=this._months,l=this._data;return o>=0&&s>=0&&a>=0||o<=0&&s<=0&&a<=0||(o+=864e5*Mo(Po(a)+s),s=0,a=0),l.milliseconds=o%1e3,t=ut(o/1e3),l.seconds=t%60,e=ut(t/60),l.minutes=e%60,i=ut(e/60),l.hours=i%24,s+=ut(i/24),a+=r=ut(Eo(s)),s-=Mo(Po(r)),n=ut(a/12),a%=12,l.days=s,l.months=a,l.years=n,this}function Eo(t){return 4800*t/146097}function Po(t){return 146097*t/4800}function Ao(t){if(!this.isValid())return NaN;var e,i,n=this._milliseconds;if("month"===(t=rt(t))||"quarter"===t||"year"===t)switch(e=this._days+n/864e5,i=this._months+Eo(e),t){case"month":return i;case"quarter":return i/3;case"year":return i/12}else switch(e=this._days+Math.round(Po(this._months)),t){case"week":return e/7+n/6048e5;case"day":return e+n/864e5;case"hour":return 24*e+n/36e5;case"minute":return 1440*e+n/6e4;case"second":return 86400*e+n/1e3;case"millisecond":return Math.floor(864e5*e)+n;default:throw new Error("Unknown unit "+t)}}function Io(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*dt(this._months/12):NaN}function Lo(t){return function(){return this.as(t)}}var No=Lo("ms"),Ro=Lo("s"),Fo=Lo("m"),jo=Lo("h"),Yo=Lo("d"),Ho=Lo("w"),zo=Lo("M"),Bo=Lo("Q"),Go=Lo("y");function Wo(){return On(this)}function Vo(t){return t=rt(t),this.isValid()?this[t+"s"]():NaN}function Uo(t){return function(){return this.isValid()?this._data[t]:NaN}}var Xo=Uo("milliseconds"),qo=Uo("seconds"),$o=Uo("minutes"),Zo=Uo("hours"),Ko=Uo("days"),Jo=Uo("months"),Qo=Uo("years");function ts(){return ut(this.days()/7)}var es=Math.round,is={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ns(t,e,i,n,r){return r.relativeTime(e||1,!!i,t,n)}function rs(t,e,i,n){var r=On(t).abs(),o=es(r.as("s")),s=es(r.as("m")),a=es(r.as("h")),l=es(r.as("d")),h=es(r.as("M")),u=es(r.as("w")),d=es(r.as("y")),c=o<=i.ss&&["s",o]||o0,c[4]=n,ns.apply(null,c)}function os(t){return void 0===t?es:"function"==typeof t&&(es=t,!0)}function ss(t,e){return void 0!==is[t]&&(void 0===e?is[t]:(is[t]=e,"s"===t&&(is.ss=e-1),!0))}function as(t,e){if(!this.isValid())return this.localeData().invalidDate();var i,n,r=!1,o=is;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(r=t),"object"==typeof e&&(o=Object.assign({},is,e),null!=e.s&&null==e.ss&&(o.ss=e.s-1)),n=rs(this,!r,o,i=this.localeData()),r&&(n=i.pastFuture(+this,n)),i.postformat(n)}var ls=Math.abs;function hs(t){return(t>0)-(t<0)||+t}function us(){if(!this.isValid())return this.localeData().invalidDate();var t,e,i,n,r,o,s,a,l=ls(this._milliseconds)/1e3,h=ls(this._days),u=ls(this._months),d=this.asSeconds();return d?(t=ut(l/60),e=ut(t/60),l%=60,t%=60,i=ut(u/12),u%=12,n=l?l.toFixed(3).replace(/\.?0+$/,""):"",r=d<0?"-":"",o=hs(this._months)!==hs(d)?"-":"",s=hs(this._days)!==hs(d)?"-":"",a=hs(this._milliseconds)!==hs(d)?"-":"",r+"P"+(i?o+i+"Y":"")+(u?o+u+"M":"")+(h?s+h+"D":"")+(e||t||l?"T":"")+(e?a+e+"H":"")+(t?a+t+"M":"")+(l?a+n+"S":"")):"P0D"}var ds=an.prototype;return ds.isValid=on,ds.abs=Do,ds.add=Co,ds.subtract=To,ds.as=Ao,ds.asMilliseconds=No,ds.asSeconds=Ro,ds.asMinutes=Fo,ds.asHours=jo,ds.asDays=Yo,ds.asWeeks=Ho,ds.asMonths=zo,ds.asQuarters=Bo,ds.asYears=Go,ds.valueOf=Io,ds._bubble=Oo,ds.clone=Wo,ds.get=Vo,ds.milliseconds=Xo,ds.seconds=qo,ds.minutes=$o,ds.hours=Zo,ds.days=Ko,ds.weeks=ts,ds.months=Jo,ds.years=Qo,ds.humanize=as,ds.toISOString=us,ds.toString=us,ds.toJSON=us,ds.locale=ar,ds.localeData=hr,ds.toIsoString=C("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",us),ds.lang=lr,z("X",0,0,"unix"),z("x",0,0,"valueOf"),Nt("x",Et),Nt("X",It),Ht("X",(function(t,e,i){i._d=new Date(1e3*parseFloat(t))})),Ht("x",(function(t,e,i){i._d=new Date(dt(t))})), +//! moment.js + n.version="2.29.4",o($i),n.fn=ho,n.min=Qi,n.max=tn,n.now=en,n.utc=m,n.unix=uo,n.months=yo,n.isDate=c,n.locale=mi,n.invalid=b,n.duration=On,n.isMoment=D,n.weekdays=_o,n.parseZone=co,n.localeData=yi,n.isDuration=ln,n.monthsShort=bo,n.weekdaysMin=ko,n.defineLocale=vi,n.updateLocale=gi,n.locales=bi,n.weekdaysShort=wo,n.normalizeUnits=rt,n.relativeTimeRounding=os,n.relativeTimeThreshold=ss,n.calendarFormat=Bn,n.prototype=ho,n.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},n}()}(a)),a.exports}s=function(t){ +//! moment.js locale configuration + function e(t,e,i,n){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[t+" Tage",t+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[t+" Monate",t+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[t+" Jahre",t+" Jahren"]};return e?r[i][0]:r[i][1]}return t.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:e,mm:"%d Minuten",h:e,hh:"%d Stunden",d:e,dd:e,w:e,ww:"%d Wochen",M:e,MM:e,y:e,yy:e},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})},s(l()),function(t,e){e(l())}(0,(function(t){ +//! moment.js locale configuration + var e="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),i="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),n=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;return t.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(t,n){return t?/-MMM-/.test(n)?i[t.month()]:e[t.month()]:e},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})})),function(t,e){e(l())}(0,(function(t){ +//! moment.js locale configuration + var e=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,i=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i],n=t.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:e,monthsShortRegex:e,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:i,longMonthsParse:i,shortMonthsParse:i,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(t,e){switch(e){case"D":return t+(1===t?"er":"");default:case"M":case"Q":case"DDD":case"d":return t+(1===t?"er":"e");case"w":case"W":return t+(1===t?"re":"e")}},week:{dow:1,doy:4}});return n})),function(t,e){e(l())}(0,(function(t){return t.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){return 0===this.day()?"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT":"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})})),function(t,e){e(l())}(0,(function(t){ +//! moment.js locale configuration + var e=t.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(t,e){return"元"===e[1]?1:parseInt(e[1]||t,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(t){return"午後"===t},meridiem:function(t,e,i){return t<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(t){return t.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(t){return this.week()!==t.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(t,e){switch(e){case"y":return 1===t?"元年":t+"年";case"d":case"D":case"DDD":return t+"日";default:return t}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}});return e})),function(t,e){e(l())}(0,(function(t){ +//! moment.js locale configuration + var e="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),i="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),n=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,o=t.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(t,n){return t?/-MMM-/.test(n)?i[t.month()]:e[t.month()]:e},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(t){return t+(1===t||8===t||t>=20?"ste":"de")},week:{dow:1,doy:4}});return o})),function(t,e){e(l())}(0,(function(t){ +//! moment.js locale configuration + var e="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),i="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),n=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function r(t){return t%10<5&&t%10>1&&~~(t/10)%10!=1}function o(t,e,i){var n=t+" ";switch(i){case"ss":return n+(r(t)?"sekundy":"sekund");case"m":return e?"minuta":"minutę";case"mm":return n+(r(t)?"minuty":"minut");case"h":return e?"godzina":"godzinę";case"hh":return n+(r(t)?"godziny":"godzin");case"ww":return n+(r(t)?"tygodnie":"tygodni");case"MM":return n+(r(t)?"miesiące":"miesięcy");case"yy":return n+(r(t)?"lata":"lat")}}return t.defineLocale("pl",{months:function(t,n){return t?/D MMMM/.test(n)?i[t.month()]:e[t.month()]:e},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:o,m:o,mm:o,h:o,hh:o,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:o,M:"miesiąc",MM:o,y:"rok",yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})})),function(t,e){e(l())}(0,(function(t){function e(t,e,i){var n,r;return"m"===i?e?"минута":"минуту":t+" "+(n=+t,r={ss:e?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:e?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[i].split("_"),n%10==1&&n%100!=11?r[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?r[1]:r[2])}var i=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i],n=t.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:i,longMonthsParse:i,shortMonthsParse:i,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(t){if(t.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:e,m:e,mm:e,h:"час",hh:e,d:"день",dd:e,w:"неделя",ww:e,M:"месяц",MM:e,y:"год",yy:e},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(t){return/^(дня|вечера)$/.test(t)},meridiem:function(t,e,i){return t<4?"ночи":t<12?"утра":t<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":return t+"-й";case"D":return t+"-го";case"w":case"W":return t+"-я";default:return t}},week:{dow:1,doy:4}});return n})),function(t,e){e(l())}(0,(function(t){function e(t,e,i){var n,r;return"m"===i?e?"хвилина":"хвилину":"h"===i?e?"година":"годину":t+" "+(n=+t,r={ss:e?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:e?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:e?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[i].split("_"),n%10==1&&n%100!=11?r[0]:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?r[1]:r[2])}function i(t){return function(){return t+"о"+(11===this.hours()?"б":"")+"] LT"}}var n=t.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(t,e){var i={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===t?i.nominative.slice(1,7).concat(i.nominative.slice(0,1)):t?i[/(\[[ВвУу]\]) ?dddd/.test(e)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(e)?"genitive":"nominative"][t.day()]:i.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:i("[Сьогодні "),nextDay:i("[Завтра "),lastDay:i("[Вчора "),nextWeek:i("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return i("[Минулої] dddd [").call(this);case 1:case 2:case 4:return i("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:e,m:e,mm:e,h:"годину",hh:e,d:"день",dd:e,M:"місяць",MM:e,y:"рік",yy:e},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(t){return/^(дня|вечора)$/.test(t)},meridiem:function(t,e,i){return t<4?"ночі":t<12?"ранку":t<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(t,e){switch(e){case"M":case"d":case"DDD":case"w":case"W":return t+"-й";case"D":return t+"-го";default:return t}},week:{dow:1,doy:7}});return n}));var h=function(t){try{return!!t()}catch(t){return!0}},u=!h((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),d=u,c=Function.prototype,p=c.call,f=d&&c.bind.bind(p,p),m=d?f:function(t){return function(){return p.apply(t,arguments)}},v=Math.ceil,g=Math.floor,y=Math.trunc||function(t){var e=+t;return(e>0?g:v)(e)},b=function(t){var e=+t;return e!=e||0===e?0:y(e)},_=function(t){return t&&t.Math===Math&&t},w=_("object"==typeof globalThis&&globalThis)||_("object"==typeof window&&window)||_("object"==typeof self&&self)||_("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),k={exports:{}},x=w,D=Object.defineProperty,S=function(t,e){try{D(x,t,{value:e,configurable:!0,writable:!0})}catch(i){x[t]=e}return e},C="__core-js_shared__",T=w[C]||S(C,{}),M=T;(k.exports=function(t,e){return M[t]||(M[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var O,E,P=k.exports,A=function(t){return null==t},I=A,L=TypeError,N=function(t){if(I(t))throw new L("Can't call method on "+t);return t},R=N,F=Object,j=function(t){return F(R(t))},Y=j,H=m({}.hasOwnProperty),z=Object.hasOwn||function(t,e){return H(Y(t),e)},B=m,G=0,W=Math.random(),V=B(1..toString),U=function(t){return"Symbol("+(void 0===t?"":t)+")_"+V(++G+W,36)},X="undefined"!=typeof navigator&&String(navigator.userAgent)||"",q=w,$=X,Z=q.process,K=q.Deno,J=Z&&Z.versions||K&&K.version,Q=J&&J.v8;Q&&(E=(O=Q.split("."))[0]>0&&O[0]<4?1:+(O[0]+O[1])),!E&&$&&(!(O=$.match(/Edge\/(\d+)/))||O[1]>=74)&&(O=$.match(/Chrome\/(\d+)/))&&(E=+O[1]);var tt=E,et=tt,it=h,nt=w.String,rt=!!Object.getOwnPropertySymbols&&!it((function(){var t=Symbol("symbol detection");return!nt(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&et&&et<41})),ot=rt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,st=P,at=z,lt=U,ht=rt,ut=ot,dt=w.Symbol,ct=st("wks"),pt=ut?dt.for||dt:dt&&dt.withoutSetter||lt,ft=function(t){return at(ct,t)||(ct[t]=ht&&at(dt,t)?dt[t]:pt("Symbol."+t)),ct[t]},mt={};mt[ft("toStringTag")]="z";var vt="[object z]"===String(mt),gt="object"==typeof document&&document.all,yt={all:gt,IS_HTMLDDA:void 0===gt&&void 0!==gt},bt=yt.all,_t=yt.IS_HTMLDDA?function(t){return"function"==typeof t||t===bt}:function(t){return"function"==typeof t},wt=m,kt=wt({}.toString),xt=wt("".slice),Dt=function(t){return xt(kt(t),8,-1)},St=vt,Ct=_t,Tt=Dt,Mt=ft("toStringTag"),Ot=Object,Et="Arguments"===Tt(function(){return arguments}()),Pt=St?Tt:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Ot(t),Mt))?i:Et?Tt(e):"Object"===(n=Tt(e))&&Ct(e.callee)?"Arguments":n},At=Pt,It=String,Lt=function(t){if("Symbol"===At(t))throw new TypeError("Cannot convert a Symbol value to a string");return It(t)},Nt=m,Rt=b,Ft=Lt,jt=N,Yt=Nt("".charAt),Ht=Nt("".charCodeAt),zt=Nt("".slice),Bt=function(t){return function(e,i){var n,r,o=Ft(jt(e)),s=Rt(i),a=o.length;return s<0||s>=a?t?"":void 0:(n=Ht(o,s))<55296||n>56319||s+1===a||(r=Ht(o,s+1))<56320||r>57343?t?Yt(o,s):n:t?zt(o,s,s+2):r-56320+(n-55296<<10)+65536}},Gt={codeAt:Bt(!1),charAt:Bt(!0)},Wt=_t,Vt=w.WeakMap,Ut=Wt(Vt)&&/native code/.test(String(Vt)),Xt=_t,qt=yt.all,$t=yt.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Xt(t)||t===qt}:function(t){return"object"==typeof t?null!==t:Xt(t)},Zt=!h((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Kt={},Jt=$t,Qt=w.document,te=Jt(Qt)&&Jt(Qt.createElement),ee=function(t){return te?Qt.createElement(t):{}},ie=ee,ne=!Zt&&!h((function(){return 7!==Object.defineProperty(ie("div"),"a",{get:function(){return 7}}).a})),re=Zt&&h((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),oe=$t,se=String,ae=TypeError,le=function(t){if(oe(t))return t;throw new ae(se(t)+" is not an object")},he=u,ue=Function.prototype.call,de=he?ue.bind(ue):function(){return ue.apply(ue,arguments)},ce={},pe=ce,fe=w,me=_t,ve=function(t){return me(t)?t:void 0},ge=function(t,e){return arguments.length<2?ve(pe[t])||ve(fe[t]):pe[t]&&pe[t][e]||fe[t]&&fe[t][e]},ye=m({}.isPrototypeOf),be=ge,_e=_t,we=ye,ke=Object,xe=ot?function(t){return"symbol"==typeof t}:function(t){var e=be("Symbol");return _e(e)&&we(e.prototype,ke(t))},De=String,Se=function(t){try{return De(t)}catch(t){return"Object"}},Ce=_t,Te=Se,Me=TypeError,Oe=function(t){if(Ce(t))return t;throw new Me(Te(t)+" is not a function")},Ee=Oe,Pe=A,Ae=function(t,e){var i=t[e];return Pe(i)?void 0:Ee(i)},Ie=de,Le=_t,Ne=$t,Re=TypeError,Fe=de,je=$t,Ye=xe,He=Ae,ze=function(t,e){var i,n;if("string"===e&&Le(i=t.toString)&&!Ne(n=Ie(i,t)))return n;if(Le(i=t.valueOf)&&!Ne(n=Ie(i,t)))return n;if("string"!==e&&Le(i=t.toString)&&!Ne(n=Ie(i,t)))return n;throw new Re("Can't convert object to primitive value")},Be=TypeError,Ge=ft("toPrimitive"),We=function(t,e){if(!je(t)||Ye(t))return t;var i,n=He(t,Ge);if(n){if(void 0===e&&(e="default"),i=Fe(n,t,e),!je(i)||Ye(i))return i;throw new Be("Can't convert object to primitive value")}return void 0===e&&(e="number"),ze(t,e)},Ve=xe,Ue=function(t){var e=We(t,"string");return Ve(e)?e:e+""},Xe=Zt,qe=ne,$e=re,Ze=le,Ke=Ue,Je=TypeError,Qe=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ei="enumerable",ii="configurable",ni="writable";Kt.f=Xe?$e?function(t,e,i){if(Ze(t),e=Ke(e),Ze(i),"function"==typeof t&&"prototype"===e&&"value"in i&&ni in i&&!i[ni]){var n=ti(t,e);n&&n[ni]&&(t[e]=i.value,i={configurable:ii in i?i[ii]:n[ii],enumerable:ei in i?i[ei]:n[ei],writable:!1})}return Qe(t,e,i)}:Qe:function(t,e,i){if(Ze(t),e=Ke(e),Ze(i),qe)try{return Qe(t,e,i)}catch(t){}if("get"in i||"set"in i)throw new Je("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ri,oi,si,ai=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},li=Kt,hi=ai,ui=Zt?function(t,e,i){return li.f(t,e,hi(1,i))}:function(t,e,i){return t[e]=i,t},di=U,ci=P("keys"),pi=function(t){return ci[t]||(ci[t]=di(t))},fi={},mi=Ut,vi=w,gi=$t,yi=ui,bi=z,_i=T,wi=pi,ki=fi,xi="Object already initialized",Di=vi.TypeError,Si=vi.WeakMap;if(mi||_i.state){var Ci=_i.state||(_i.state=new Si);Ci.get=Ci.get,Ci.has=Ci.has,Ci.set=Ci.set,ri=function(t,e){if(Ci.has(t))throw new Di(xi);return e.facade=t,Ci.set(t,e),e},oi=function(t){return Ci.get(t)||{}},si=function(t){return Ci.has(t)}}else{var Ti=wi("state");ki[Ti]=!0,ri=function(t,e){if(bi(t,Ti))throw new Di(xi);return e.facade=t,yi(t,Ti,e),e},oi=function(t){return bi(t,Ti)?t[Ti]:{}},si=function(t){return bi(t,Ti)}}var Mi={set:ri,get:oi,has:si,enforce:function(t){return si(t)?oi(t):ri(t,{})},getterFor:function(t){return function(e){var i;if(!gi(e)||(i=oi(e)).type!==t)throw new Di("Incompatible receiver, "+t+" required");return i}}},Oi=u,Ei=Function.prototype,Pi=Ei.apply,Ai=Ei.call,Ii="object"==typeof Reflect&&Reflect.apply||(Oi?Ai.bind(Pi):function(){return Ai.apply(Pi,arguments)}),Li=Dt,Ni=m,Ri=function(t){if("Function"===Li(t))return Ni(t)},Fi={},ji={},Yi={}.propertyIsEnumerable,Hi=Object.getOwnPropertyDescriptor,zi=Hi&&!Yi.call({1:2},1);ji.f=zi?function(t){var e=Hi(this,t);return!!e&&e.enumerable}:Yi;var Bi=h,Gi=Dt,Wi=Object,Vi=m("".split),Ui=Bi((function(){return!Wi("z").propertyIsEnumerable(0)}))?function(t){return"String"===Gi(t)?Vi(t,""):Wi(t)}:Wi,Xi=Ui,qi=N,$i=function(t){return Xi(qi(t))},Zi=Zt,Ki=de,Ji=ji,Qi=ai,tn=$i,en=Ue,nn=z,rn=ne,on=Object.getOwnPropertyDescriptor;Fi.f=Zi?on:function(t,e){if(t=tn(t),e=en(e),rn)try{return on(t,e)}catch(t){}if(nn(t,e))return Qi(!Ki(Ji.f,t,e),t[e])};var sn=h,an=_t,ln=/#|\.prototype\./,hn=function(t,e){var i=dn[un(t)];return i===pn||i!==cn&&(an(e)?sn(e):!!e)},un=hn.normalize=function(t){return String(t).replace(ln,".").toLowerCase()},dn=hn.data={},cn=hn.NATIVE="N",pn=hn.POLYFILL="P",fn=hn,mn=Oe,vn=u,gn=Ri(Ri.bind),yn=function(t,e){return mn(t),void 0===e?t:vn?gn(t,e):function(){return t.apply(e,arguments)}},bn=w,_n=Ii,wn=Ri,kn=_t,xn=Fi.f,Dn=fn,Sn=ce,Cn=yn,Tn=ui,Mn=z,On=function(t){var e=function(i,n,r){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(i);case 2:return new t(i,n)}return new t(i,n,r)}return _n(t,this,arguments)};return e.prototype=t.prototype,e},En=function(t,e){var i,n,r,o,s,a,l,h,u,d=t.target,c=t.global,p=t.stat,f=t.proto,m=c?bn:p?bn[d]:(bn[d]||{}).prototype,v=c?Sn:Sn[d]||Tn(Sn,d,{})[d],g=v.prototype;for(o in e)n=!(i=Dn(c?o:d+(p?".":"#")+o,t.forced))&&m&&Mn(m,o),a=v[o],n&&(l=t.dontCallGetSet?(u=xn(m,o))&&u.value:m[o]),s=n&&l?l:e[o],n&&typeof a==typeof s||(h=t.bind&&n?Cn(s,bn):t.wrap&&n?On(s):f&&kn(s)?wn(s):s,(t.sham||s&&s.sham||a&&a.sham)&&Tn(h,"sham",!0),Tn(v,o,h),f&&(Mn(Sn,r=d+"Prototype")||Tn(Sn,r,{}),Tn(Sn[r],o,s),t.real&&g&&(i||!g[o])&&Tn(g,o,s)))},Pn=Zt,An=z,In=Function.prototype,Ln=Pn&&Object.getOwnPropertyDescriptor,Nn=An(In,"name"),Rn={EXISTS:Nn,PROPER:Nn&&"something"===function(){}.name,CONFIGURABLE:Nn&&(!Pn||Pn&&Ln(In,"name").configurable)},Fn={},jn=b,Yn=Math.max,Hn=Math.min,zn=function(t,e){var i=jn(t);return i<0?Yn(i+e,0):Hn(i,e)},Bn=b,Gn=Math.min,Wn=function(t){return t>0?Gn(Bn(t),9007199254740991):0},Vn=function(t){return Wn(t.length)},Un=$i,Xn=zn,qn=Vn,$n=function(t){return function(e,i,n){var r,o=Un(e),s=qn(o),a=Xn(n,s);if(t&&i!=i){for(;s>a;)if((r=o[a++])!=r)return!0}else for(;s>a;a++)if((t||a in o)&&o[a]===i)return t||a||0;return!t&&-1}},Zn={includes:$n(!0),indexOf:$n(!1)},Kn=z,Jn=$i,Qn=Zn.indexOf,tr=fi,er=m([].push),ir=function(t,e){var i,n=Jn(t),r=0,o=[];for(i in n)!Kn(tr,i)&&Kn(n,i)&&er(o,i);for(;e.length>r;)Kn(n,i=e[r++])&&(~Qn(o,i)||er(o,i));return o},nr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rr=ir,or=nr,sr=Object.keys||function(t){return rr(t,or)},ar=Zt,lr=re,hr=Kt,ur=le,dr=$i,cr=sr;Fn.f=ar&&!lr?Object.defineProperties:function(t,e){ur(t);for(var i,n=dr(e),r=cr(e),o=r.length,s=0;o>s;)hr.f(t,i=r[s++],n[i]);return t};var pr,fr=ge("document","documentElement"),mr=le,vr=Fn,gr=nr,yr=fi,br=fr,_r=ee,wr="prototype",kr="script",xr=pi("IE_PROTO"),Dr=function(){},Sr=function(t){return"<"+kr+">"+t+""},Cr=function(t){t.write(Sr("")),t.close();var e=t.parentWindow.Object;return t=null,e},Tr=function(){try{pr=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Tr="undefined"!=typeof document?document.domain&&pr?Cr(pr):(e=_r("iframe"),i="java"+kr+":",e.style.display="none",br.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Sr("document.F=Object")),t.close(),t.F):Cr(pr);for(var n=gr.length;n--;)delete Tr[wr][gr[n]];return Tr()};yr[xr]=!0;var Mr,Or,Er,Pr=Object.create||function(t,e){var i;return null!==t?(Dr[wr]=mr(t),i=new Dr,Dr[wr]=null,i[xr]=t):i=Tr(),void 0===e?i:vr.f(i,e)},Ar=!h((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Ir=z,Lr=_t,Nr=j,Rr=Ar,Fr=pi("IE_PROTO"),jr=Object,Yr=jr.prototype,Hr=Rr?jr.getPrototypeOf:function(t){var e=Nr(t);if(Ir(e,Fr))return e[Fr];var i=e.constructor;return Lr(i)&&e instanceof i?i.prototype:e instanceof jr?Yr:null},zr=ui,Br=function(t,e,i,n){return n&&n.enumerable?t[e]=i:zr(t,e,i),t},Gr=h,Wr=_t,Vr=$t,Ur=Pr,Xr=Hr,qr=Br,$r=ft("iterator"),Zr=!1;[].keys&&("next"in(Er=[].keys())?(Or=Xr(Xr(Er)))!==Object.prototype&&(Mr=Or):Zr=!0);var Kr=!Vr(Mr)||Gr((function(){var t={};return Mr[$r].call(t)!==t}));Wr((Mr=Kr?{}:Ur(Mr))[$r])||qr(Mr,$r,(function(){return this}));var Jr={IteratorPrototype:Mr,BUGGY_SAFARI_ITERATORS:Zr},Qr=Pt,to=vt?{}.toString:function(){return"[object "+Qr(this)+"]"},eo=vt,io=Kt.f,no=ui,ro=z,oo=to,so=ft("toStringTag"),ao=function(t,e,i,n){if(t){var r=i?t:t.prototype;ro(r,so)||io(r,so,{configurable:!0,value:e}),n&&!eo&&no(r,"toString",oo)}},lo={},ho=Jr.IteratorPrototype,uo=Pr,co=ai,po=ao,fo=lo,mo=function(){return this},vo=m,go=Oe,yo=_t,bo=String,_o=TypeError,wo=function(t,e,i){try{return vo(go(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},ko=le,xo=function(t){if("object"==typeof t||yo(t))return t;throw new _o("Can't set "+bo(t)+" as a prototype")},Do=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=wo(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return ko(i),xo(n),e?t(i,n):i.__proto__=n,i}}():void 0),So=En,Co=de,To=Rn,Mo=function(t,e,i,n){var r=e+" Iterator";return t.prototype=uo(ho,{next:co(+!n,i)}),po(t,r,!1,!0),fo[r]=mo,t},Oo=Hr,Eo=ao,Po=Br,Ao=lo,Io=Jr,Lo=To.PROPER,No=Io.BUGGY_SAFARI_ITERATORS,Ro=ft("iterator"),Fo="keys",jo="values",Yo="entries",Ho=function(){return this},zo=function(t,e,i,n,r,o,s){Mo(i,e,n);var a,l,h,u=function(t){if(t===r&&m)return m;if(!No&&t&&t in p)return p[t];switch(t){case Fo:case jo:case Yo:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",c=!1,p=t.prototype,f=p[Ro]||p["@@iterator"]||r&&p[r],m=!No&&f||u(r),v="Array"===e&&p.entries||f;if(v&&(a=Oo(v.call(new t)))!==Object.prototype&&a.next&&(Eo(a,d,!0,!0),Ao[d]=Ho),Lo&&r===jo&&f&&f.name!==jo&&(c=!0,m=function(){return Co(f,this)}),r)if(l={values:u(jo),keys:o?m:u(Fo),entries:u(Yo)},s)for(h in l)(No||c||!(h in p))&&Po(p,h,l[h]);else So({target:e,proto:!0,forced:No||c},l);return s&&p[Ro]!==m&&Po(p,Ro,m,{name:r}),Ao[e]=m,l},Bo=function(t,e){return{value:t,done:e}},Go=Gt.charAt,Wo=Lt,Vo=Mi,Uo=zo,Xo=Bo,qo="String Iterator",$o=Vo.set,Zo=Vo.getterFor(qo);Uo(String,"String",(function(t){$o(this,{type:qo,string:Wo(t),index:0})}),(function(){var t,e=Zo(this),i=e.string,n=e.index;return n>=i.length?Xo(void 0,!0):(t=Go(i,n),e.index+=t.length,Xo(t,!1))}));var Ko=de,Jo=le,Qo=Ae,ts=function(t,e,i){var n,r;Jo(t);try{if(!(n=Qo(t,"return"))){if("throw"===e)throw i;return i}n=Ko(n,t)}catch(t){r=!0,n=t}if("throw"===e)throw i;if(r)throw n;return Jo(n),i},es=le,is=ts,ns=lo,rs=ft("iterator"),os=Array.prototype,ss=function(t){return void 0!==t&&(ns.Array===t||os[rs]===t)},as=_t,ls=T,hs=m(Function.toString);as(ls.inspectSource)||(ls.inspectSource=function(t){return hs(t)});var us=ls.inspectSource,ds=m,cs=h,ps=_t,fs=Pt,ms=us,vs=function(){},gs=[],ys=ge("Reflect","construct"),bs=/^\s*(?:class|function)\b/,_s=ds(bs.exec),ws=!bs.test(vs),ks=function(t){if(!ps(t))return!1;try{return ys(vs,gs,t),!0}catch(t){return!1}},xs=function(t){if(!ps(t))return!1;switch(fs(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ws||!!_s(bs,ms(t))}catch(t){return!0}};xs.sham=!0;var Ds=!ys||cs((function(){var t;return ks(ks.call)||!ks(Object)||!ks((function(){t=!0}))||t}))?xs:ks,Ss=Ue,Cs=Kt,Ts=ai,Ms=function(t,e,i){var n=Ss(e);n in t?Cs.f(t,n,Ts(0,i)):t[n]=i},Os=Pt,Es=Ae,Ps=A,As=lo,Is=ft("iterator"),Ls=function(t){if(!Ps(t))return Es(t,Is)||Es(t,"@@iterator")||As[Os(t)]},Ns=de,Rs=Oe,Fs=le,js=Se,Ys=Ls,Hs=TypeError,zs=function(t,e){var i=arguments.length<2?Ys(t):e;if(Rs(i))return Fs(Ns(i,t));throw new Hs(js(t)+" is not iterable")},Bs=yn,Gs=de,Ws=j,Vs=function(t,e,i,n){try{return n?e(es(i)[0],i[1]):e(i)}catch(e){is(t,"throw",e)}},Us=ss,Xs=Ds,qs=Vn,$s=Ms,Zs=zs,Ks=Ls,Js=Array,Qs=ft("iterator"),ta=!1;try{var ea=0,ia={next:function(){return{done:!!ea++}},return:function(){ta=!0}};ia[Qs]=function(){return this},Array.from(ia,(function(){throw 2}))}catch(t){}var na=function(t,e){try{if(!e&&!ta)return!1}catch(t){return!1}var i=!1;try{var n={};n[Qs]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},ra=function(t){var e=Ws(t),i=Xs(this),n=arguments.length,r=n>1?arguments[1]:void 0,o=void 0!==r;o&&(r=Bs(r,n>2?arguments[2]:void 0));var s,a,l,h,u,d,c=Ks(e),p=0;if(!c||this===Js&&Us(c))for(s=qs(e),a=i?new this(s):Js(s);s>p;p++)d=o?r(e[p],p):e[p],$s(a,p,d);else for(u=(h=Zs(e,c)).next,a=i?new this:[];!(l=Gs(u,h)).done;p++)d=o?Vs(h,r,[l.value,p],!0):l.value,$s(a,p,d);return a.length=p,a};En({target:"Array",stat:!0,forced:!na((function(t){Array.from(t)}))},{from:ra});var oa=ce.Array.from,sa=n(oa),aa=$i,la=lo,ha=Mi;Kt.f;var ua=zo,da=Bo,ca="Array Iterator",pa=ha.set,fa=ha.getterFor(ca);ua(Array,"Array",(function(t,e){pa(this,{type:ca,target:aa(t),index:0,kind:e})}),(function(){var t=fa(this),e=t.target,i=t.kind,n=t.index++;if(!e||n>=e.length)return t.target=void 0,da(void 0,!0);switch(i){case"keys":return da(n,!1);case"values":return da(e[n],!1)}return da([n,e[n]],!1)}),"values"),la.Arguments=la.Array;var ma=Ls,va={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ga=w,ya=Pt,ba=ui,_a=lo,wa=ft("toStringTag");for(var ka in va){var xa=ga[ka],Da=xa&&xa.prototype;Da&&ya(Da)!==wa&&ba(Da,wa,ka),_a[ka]=_a.Array}var Sa=ma,Ca=n(Sa),Ta=n(Sa);function Ma(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Oa={exports:{}},Ea=En,Pa=Zt,Aa=Kt.f;Ea({target:"Object",stat:!0,forced:Object.defineProperty!==Aa,sham:!Pa},{defineProperty:Aa});var Ia=ce.Object,La=Oa.exports=function(t,e,i){return Ia.defineProperty(t,e,i)};Ia.defineProperty.sham&&(La.sham=!0);var Na=Oa.exports,Ra=Na,Fa=n(Ra),ja=Dt,Ya=Array.isArray||function(t){return"Array"===ja(t)},Ha=TypeError,za=function(t){if(t>9007199254740991)throw Ha("Maximum allowed index exceeded");return t},Ba=Ya,Ga=Ds,Wa=$t,Va=ft("species"),Ua=Array,Xa=function(t){var e;return Ba(t)&&(e=t.constructor,(Ga(e)&&(e===Ua||Ba(e.prototype))||Wa(e)&&null===(e=e[Va]))&&(e=void 0)),void 0===e?Ua:e},qa=function(t,e){return new(Xa(t))(0===e?0:e)},$a=h,Za=tt,Ka=ft("species"),Ja=function(t){return Za>=51||!$a((function(){var e=[];return(e.constructor={})[Ka]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Qa=En,tl=h,el=Ya,il=$t,nl=j,rl=Vn,ol=za,sl=Ms,al=qa,ll=Ja,hl=tt,ul=ft("isConcatSpreadable"),dl=hl>=51||!tl((function(){var t=[];return t[ul]=!1,t.concat()[0]!==t})),cl=function(t){if(!il(t))return!1;var e=t[ul];return void 0!==e?!!e:el(t)};Qa({target:"Array",proto:!0,arity:1,forced:!dl||!ll("concat")},{concat:function(t){var e,i,n,r,o,s=nl(this),a=al(s,0),l=0;for(e=-1,n=arguments.length;ey;y++)if((a||y in m)&&(p=v(c=m[y],y,f),t))if(e)_[y]=p;else if(p)switch(t){case 3:return!0;case 5:return c;case 6:return y;case 2:ql(_,c)}else switch(t){case 4:return!1;case 7:ql(_,c)}return o?-1:n||r?r:_}},Zl={forEach:$l(0),map:$l(1),filter:$l(2),some:$l(3),every:$l(4),find:$l(5),findIndex:$l(6),filterReject:$l(7)},Kl=En,Jl=w,Ql=de,th=m,eh=Zt,ih=rt,nh=h,rh=z,oh=ye,sh=le,ah=$i,lh=Ue,hh=Lt,uh=ai,dh=Pr,ch=sr,ph=pl,fh=vl,mh=Ml,vh=Fi,gh=Kt,yh=Fn,bh=ji,_h=Br,wh=El,kh=P,xh=fi,Dh=U,Sh=ft,Ch=Pl,Th=Fl,Mh=Bl,Oh=ao,Eh=Mi,Ph=Zl.forEach,Ah=pi("hidden"),Ih="Symbol",Lh="prototype",Nh=Eh.set,Rh=Eh.getterFor(Ih),Fh=Object[Lh],jh=Jl.Symbol,Yh=jh&&jh[Lh],Hh=Jl.RangeError,zh=Jl.TypeError,Bh=Jl.QObject,Gh=vh.f,Wh=gh.f,Vh=fh.f,Uh=bh.f,Xh=th([].push),qh=kh("symbols"),$h=kh("op-symbols"),Zh=kh("wks"),Kh=!Bh||!Bh[Lh]||!Bh[Lh].findChild,Jh=function(t,e,i){var n=Gh(Fh,e);n&&delete Fh[e],Wh(t,e,i),n&&t!==Fh&&Wh(Fh,e,n)},Qh=eh&&nh((function(){return 7!==dh(Wh({},"a",{get:function(){return Wh(this,"a",{value:7}).a}})).a}))?Jh:Wh,tu=function(t,e){var i=qh[t]=dh(Yh);return Nh(i,{type:Ih,tag:t,description:e}),eh||(i.description=e),i},eu=function(t,e,i){t===Fh&&eu($h,e,i),sh(t);var n=lh(e);return sh(i),rh(qh,n)?(i.enumerable?(rh(t,Ah)&&t[Ah][n]&&(t[Ah][n]=!1),i=dh(i,{enumerable:uh(0,!1)})):(rh(t,Ah)||Wh(t,Ah,uh(1,{})),t[Ah][n]=!0),Qh(t,n,i)):Wh(t,n,i)},iu=function(t,e){sh(t);var i=ah(e),n=ch(i).concat(su(i));return Ph(n,(function(e){eh&&!Ql(nu,i,e)||eu(t,e,i[e])})),t},nu=function(t){var e=lh(t),i=Ql(Uh,this,e);return!(this===Fh&&rh(qh,e)&&!rh($h,e))&&(!(i||!rh(this,e)||!rh(qh,e)||rh(this,Ah)&&this[Ah][e])||i)},ru=function(t,e){var i=ah(t),n=lh(e);if(i!==Fh||!rh(qh,n)||rh($h,n)){var r=Gh(i,n);return!r||!rh(qh,n)||rh(i,Ah)&&i[Ah][n]||(r.enumerable=!0),r}},ou=function(t){var e=Vh(ah(t)),i=[];return Ph(e,(function(t){rh(qh,t)||rh(xh,t)||Xh(i,t)})),i},su=function(t){var e=t===Fh,i=Vh(e?$h:ah(t)),n=[];return Ph(i,(function(t){!rh(qh,t)||e&&!rh(Fh,t)||Xh(n,qh[t])})),n};ih||(jh=function(){if(oh(Yh,this))throw new zh("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?hh(arguments[0]):void 0,e=Dh(t),i=function(t){this===Fh&&Ql(i,$h,t),rh(this,Ah)&&rh(this[Ah],e)&&(this[Ah][e]=!1);var n=uh(1,t);try{Qh(this,e,n)}catch(t){if(!(t instanceof Hh))throw t;Jh(this,e,n)}};return eh&&Kh&&Qh(Fh,e,{configurable:!0,set:i}),tu(e,t)},_h(Yh=jh[Lh],"toString",(function(){return Rh(this).tag})),_h(jh,"withoutSetter",(function(t){return tu(Dh(t),t)})),bh.f=nu,gh.f=eu,yh.f=iu,vh.f=ru,ph.f=fh.f=ou,mh.f=su,Ch.f=function(t){return tu(Sh(t),t)},eh&&wh(Yh,"description",{configurable:!0,get:function(){return Rh(this).description}})),Kl({global:!0,constructor:!0,wrap:!0,forced:!ih,sham:!ih},{Symbol:jh}),Ph(ch(Zh),(function(t){Th(t)})),Kl({target:Ih,stat:!0,forced:!ih},{useSetter:function(){Kh=!0},useSimple:function(){Kh=!1}}),Kl({target:"Object",stat:!0,forced:!ih,sham:!eh},{create:function(t,e){return void 0===e?dh(t):iu(dh(t),e)},defineProperty:eu,defineProperties:iu,getOwnPropertyDescriptor:ru}),Kl({target:"Object",stat:!0,forced:!ih},{getOwnPropertyNames:ou}),Mh(),Oh(jh,Ih),xh[Ah]=!0;var au=rt&&!!Symbol.for&&!!Symbol.keyFor,lu=En,hu=ge,uu=z,du=Lt,cu=P,pu=au,fu=cu("string-to-symbol-registry"),mu=cu("symbol-to-string-registry");lu({target:"Symbol",stat:!0,forced:!pu},{for:function(t){var e=du(t);if(uu(fu,e))return fu[e];var i=hu("Symbol")(e);return fu[e]=i,mu[i]=e,i}});var vu=En,gu=z,yu=xe,bu=Se,_u=au,wu=P("symbol-to-string-registry");vu({target:"Symbol",stat:!0,forced:!_u},{keyFor:function(t){if(!yu(t))throw new TypeError(bu(t)+" is not a symbol");if(gu(wu,t))return wu[t]}});var ku=m([].slice),xu=Ya,Du=_t,Su=Dt,Cu=Lt,Tu=m([].push),Mu=En,Ou=ge,Eu=Ii,Pu=de,Au=m,Iu=h,Lu=_t,Nu=xe,Ru=ku,Fu=function(t){if(Du(t))return t;if(xu(t)){for(var e=t.length,i=[],n=0;nt.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?arguments[1]:void 0)}});var Zc=Jd("Array").map,Kc=ye,Jc=Zc,Qc=Array.prototype,tp=function(t){var e=t.map;return t===Qc||Kc(Qc,t)&&e===Qc.map?Jc:e},ep=n(tp),ip=j,np=sr;En({target:"Object",stat:!0,forced:h((function(){np(1)}))},{keys:function(t){return np(ip(t))}});var rp=n(ce.Object.keys),op=En,sp=Date,ap=m(sp.prototype.getTime);op({target:"Date",stat:!0},{now:function(){return ap(new sp)}});var lp=n(ce.Date.now),hp=m,up=Oe,dp=$t,cp=z,pp=ku,fp=u,mp=Function,vp=hp([].concat),gp=hp([].join),yp={},bp=fp?mp.bind:function(t){var e=up(this),i=e.prototype,n=pp(arguments,1),r=function(){var i=vp(n,pp(arguments));return this instanceof r?function(t,e,i){if(!cp(yp,e)){for(var n=[],r=0;r1?arguments[1]:void 0)};En({target:"Array",proto:!0,forced:[].forEach!==Pp},{forEach:Pp});var Ap=Jd("Array").forEach,Ip=Pt,Lp=z,Np=ye,Rp=Ap,Fp=Array.prototype,jp={DOMTokenList:!0,NodeList:!0},Yp=function(t){var e=t.forEach;return t===Fp||Np(Fp,t)&&e===Fp.forEach||Lp(jp,Ip(t))?Rp:e},Hp=n(Yp),zp=En,Bp=Ya,Gp=m([].reverse),Wp=[1,2];zp({target:"Array",proto:!0,forced:String(Wp)===String(Wp.reverse())},{reverse:function(){return Bp(this)&&(this.length=this.length),Gp(this)}});var Vp=Jd("Array").reverse,Up=ye,Xp=Vp,qp=Array.prototype,$p=function(t){var e=t.reverse;return t===qp||Up(qp,t)&&e===qp.reverse?Xp:e},Zp=$p,Kp=n(Zp),Jp=Se,Qp=TypeError,tf=function(t,e){if(!delete t[e])throw new Qp("Cannot delete property "+Jp(e)+" of "+Jp(t))},ef=En,nf=j,rf=zn,of=b,sf=Vn,af=Ud,lf=za,hf=qa,uf=Ms,df=tf,cf=Ja("splice"),pf=Math.max,ff=Math.min;ef({target:"Array",proto:!0,forced:!cf},{splice:function(t,e){var i,n,r,o,s,a,l=nf(this),h=sf(l),u=rf(t,h),d=arguments.length;for(0===d?i=n=0:1===d?(i=0,n=h-u):(i=d-2,n=ff(pf(of(e),0),h-u)),lf(h+i-n),r=hf(l,n),o=0;oh-n+i;o--)df(l,o-1)}else if(i>n)for(o=h-n;o>u;o--)a=o+i-1,(s=o+n-1)in l?l[a]=l[s]:df(l,a);for(o=0;or;)for(var a,l=Of(arguments[r++]),h=o?Af(Sf(l),o(l)):Sf(l),u=h.length,d=0;u>d;)a=h[d++],wf&&!xf(s,l,a)||(i[a]=l[a]);return i}:Ef,Lf=If;En({target:"Object",stat:!0,arity:2,forced:Object.assign!==Lf},{assign:Lf});var Nf=n(ce.Object.assign),Rf=Zn.includes;En({target:"Array",proto:!0,forced:h((function(){return!Array(1).includes()}))},{includes:function(t){return Rf(this,t,arguments.length>1?arguments[1]:void 0)}});var Ff=Jd("Array").includes,jf=$t,Yf=Dt,Hf=ft("match"),zf=function(t){var e;return jf(t)&&(void 0!==(e=t[Hf])?!!e:"RegExp"===Yf(t))},Bf=TypeError,Gf=ft("match"),Wf=En,Vf=function(t){if(zf(t))throw new Bf("The method doesn't accept regular expressions");return t},Uf=N,Xf=Lt,qf=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[Gf]=!1,"/./"[t](e)}catch(t){}}return!1},$f=m("".indexOf);Wf({target:"String",proto:!0,forced:!qf("includes")},{includes:function(t){return!!~$f(Xf(Uf(this)),Xf(Vf(t)),arguments.length>1?arguments[1]:void 0)}});var Zf=Jd("String").includes,Kf=ye,Jf=Ff,Qf=Zf,tm=Array.prototype,em=String.prototype,im=function(t){var e=t.includes;return t===tm||Kf(tm,t)&&e===tm.includes?Jf:"string"==typeof t||t===em||Kf(em,t)&&e===em.includes?Qf:e},nm=n(im),rm=j,om=Hr,sm=Ar;En({target:"Object",stat:!0,forced:h((function(){om(1)})),sham:!sm},{getPrototypeOf:function(t){return om(rm(t))}});var am=ce.Object.getPrototypeOf,lm=n(am),hm=Zl.filter;En({target:"Array",proto:!0,forced:!Ja("filter")},{filter:function(t){return hm(this,t,arguments.length>1?arguments[1]:void 0)}});var um=Jd("Array").filter,dm=ye,cm=um,pm=Array.prototype,fm=function(t){var e=t.filter;return t===pm||dm(pm,t)&&e===pm.filter?cm:e},mm=n(fm),vm=Zt,gm=h,ym=m,bm=Hr,_m=sr,wm=$i,km=ym(ji.f),xm=ym([].push),Dm=vm&&gm((function(){var t=Object.create(null);return t[2]=2,!km(t,2)})),Sm=function(t){return function(e){for(var i,n=wm(e),r=_m(n),o=Dm&&null===bm(n),s=r.length,a=0,l=[];s>a;)i=r[a++],vm&&!(o?i in n:km(n,i))||xm(l,t?[i,n[i]]:n[i]);return l}},Cm={entries:Sm(!0),values:Sm(!1)},Tm=Cm.values;En({target:"Object",stat:!0},{values:function(t){return Tm(t)}});var Mm=n(ce.Object.values),Om="\t\n\v\f\r                \u2028\u2029\ufeff",Em=N,Pm=Lt,Am=Om,Im=m("".replace),Lm=RegExp("^["+Am+"]+"),Nm=RegExp("(^|[^"+Am+"])["+Am+"]+$"),Rm=function(t){return function(e){var i=Pm(Em(e));return 1&t&&(i=Im(i,Lm,"")),2&t&&(i=Im(i,Nm,"$1")),i}},Fm={start:Rm(1),end:Rm(2),trim:Rm(3)},jm=w,Ym=h,Hm=m,zm=Lt,Bm=Fm.trim,Gm=Om,Wm=jm.parseInt,Vm=jm.Symbol,Um=Vm&&Vm.iterator,Xm=/^[+-]?0x/i,qm=Hm(Xm.exec),$m=8!==Wm(Gm+"08")||22!==Wm(Gm+"0x16")||Um&&!Ym((function(){Wm(Object(Um))}))?function(t,e){var i=Bm(zm(t));return Wm(i,e>>>0||(qm(Xm,i)?16:10))}:Wm;En({global:!0,forced:parseInt!==$m},{parseInt:$m});var Zm=n(ce.parseInt),Km=En,Jm=Zn.indexOf,Qm=Op,tv=Ri([].indexOf),ev=!!tv&&1/tv([1],1,-0)<0;Km({target:"Array",proto:!0,forced:ev||!Qm("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return ev?tv(this,t,e)||0:Jm(this,t,e)}});var iv=Jd("Array").indexOf,nv=ye,rv=iv,ov=Array.prototype,sv=function(t){var e=t.indexOf;return t===ov||nv(ov,t)&&e===ov.indexOf?rv:e},av=n(sv),lv=Cm.entries;En({target:"Object",stat:!0},{entries:function(t){return lv(t)}});var hv=n(ce.Object.entries);En({target:"Object",stat:!0,sham:!Zt},{create:Pr});var uv=ce.Object,dv=function(t,e){return uv.create(t,e)},cv=n(dv),pv=ce,fv=Ii;pv.JSON||(pv.JSON={stringify:JSON.stringify});var mv=function(t,e,i){return fv(pv.JSON.stringify,null,arguments)},vv=n(mv),gv="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,yv=TypeError,bv=function(t,e){if(ti,s=kv(n)?n:Tv(n),a=o?Sv(arguments,i):[],l=o?function(){wv(s,this,a)}:s;return e?t(l,r):t(l)}:t},Ev=En,Pv=w,Av=Ov(Pv.setInterval,!0);Ev({global:!0,bind:!0,forced:Pv.setInterval!==Av},{setInterval:Av});var Iv=En,Lv=w,Nv=Ov(Lv.setTimeout,!0);Iv({global:!0,bind:!0,forced:Lv.setTimeout!==Nv},{setTimeout:Nv});var Rv=n(ce.setTimeout),Fv=j,jv=zn,Yv=Vn,Hv=function(t){for(var e=Fv(this),i=Yv(e),n=arguments.length,r=jv(n>1?arguments[1]:void 0,i),o=n>2?arguments[2]:void 0,s=void 0===o?i:jv(o,i);s>r;)e[r++]=t;return e};En({target:"Array",proto:!0},{fill:Hv});var zv=Jd("Array").fill,Bv=ye,Gv=zv,Wv=Array.prototype,Vv=function(t){var e=t.fill;return t===Wv||Bv(Wv,t)&&e===Wv.fill?Gv:e},Uv=n(Vv),Xv={exports:{}};!function(t){function e(t){if(t)return function(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r=0;r-1}var jg=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===hg&&(t=this.compute()),lg&&this.manager.element.style&&mg[t]&&(this.manager.element.style[ag]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var t=[];return Ng(this.manager.recognizers,(function(e){Rg(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(Fg(t,cg))return cg;var e=Fg(t,pg),i=Fg(t,fg);return e&&i?cg:e||i?e?pg:fg:Fg(t,dg)?dg:ug}(t.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,r=Fg(n,cg)&&!mg[cg],o=Fg(n,fg)&&!mg[fg],s=Fg(n,pg)&&!mg[pg];if(r){var a=1===t.pointers.length,l=t.distance<2,h=t.deltaTime<250;if(a&&l&&h)return}if(!s||!o)return r||o&&i&Eg||s&&i&Pg?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function Yg(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function Hg(t){var e=t.length;if(1===e)return{x:ng(t[0].clientX),y:ng(t[0].clientY)};for(var i=0,n=0,r=0;r=rg(e)?t<0?Cg:Tg:e<0?Mg:Og}function Vg(t,e,i){return{x:e/t||0,y:i/t||0}}function Ug(t,e){var i=t.session,n=e.pointers,r=n.length;i.firstInput||(i.firstInput=zg(e)),r>1&&!i.firstMultiple?i.firstMultiple=zg(e):1===r&&(i.firstMultiple=!1);var o=i.firstInput,s=i.firstMultiple,a=s?s.center:o.center,l=e.center=Hg(n);e.timeStamp=og(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=Gg(a,l),e.distance=Bg(a,l),function(t,e){var i=e.center,n=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==kg&&o.eventType!==xg||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=r.x+(i.x-n.x),e.deltaY=r.y+(i.y-n.y)}(i,e),e.offsetDirection=Wg(e.deltaX,e.deltaY);var h,u,d=Vg(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=rg(d.x)>rg(d.y)?d.x:d.y,e.scale=s?(h=s.pointers,Bg((u=n)[0],u[1],Lg)/Bg(h[0],h[1],Lg)):1,e.rotation=s?function(t,e){return Gg(e[1],e[0],Lg)+Gg(t[1],t[0],Lg)}(s.pointers,n):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==Dg&&(a>wg||void 0===s.velocity)){var l=e.deltaX-s.deltaX,h=e.deltaY-s.deltaY,u=Vg(a,l,h);n=u.x,r=u.y,i=rg(u.x)>rg(u.y)?u.x:u.y,o=Wg(l,h),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=o}(i,e);var c,p=t.element,f=e.srcEvent;Yg(c=f.composedPath?f.composedPath()[0]:f.path?f.path[0]:f.target,p)&&(p=c),e.target=p}function Xg(t,e,i){var n=i.pointers.length,r=i.changedPointers.length,o=e&kg&&n-r==0,s=e&(xg|Dg)&&n-r==0;i.isFirst=!!o,i.isFinal=!!s,o&&(t.session={}),i.eventType=e,Ug(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function qg(t){return t.trim().split(/\s+/g)}function $g(t,e,i){Ng(qg(e),(function(e){t.addEventListener(e,i,!1)}))}function Zg(t,e,i){Ng(qg(e),(function(e){t.removeEventListener(e,i,!1)}))}function Kg(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Jg=function(){function t(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){Rg(t.options.enable,[t])&&i.handler(e)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&$g(this.element,this.evEl,this.domHandler),this.evTarget&&$g(this.target,this.evTarget,this.domHandler),this.evWin&&$g(Kg(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&Zg(this.element,this.evEl,this.domHandler),this.evTarget&&Zg(this.target,this.evTarget,this.domHandler),this.evWin&&Zg(Kg(this.element),this.evWin,this.domHandler)},t}();function Qg(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;ni[e]})):n.sort()),n}var ay={touchstart:kg,touchmove:2,touchend:xg,touchcancel:Dg},ly=function(t){function e(){var i;return e.prototype.evTarget="touchstart touchmove touchend touchcancel",(i=t.apply(this,arguments)||this).targetIds={},i}return Kv(e,t),e.prototype.handler=function(t){var e=ay[t.type],i=hy.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:bg,srcEvent:t})},e}(Jg);function hy(t,e){var i,n,r=oy(t.touches),o=this.targetIds;if(e&(2|kg)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=oy(t.changedTouches),a=[],l=this.target;if(n=r.filter((function(t){return Yg(t.target,l)})),e===kg)for(i=0;i-1&&n.splice(t,1)}),cy)}}function fy(t,e){t&kg?(this.primaryTouch=e.changedPointers[0].identifier,py.call(this,e)):t&(xg|Dg)&&py.call(this,e)}function my(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n-1&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return this.requireFail.length>0},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(t){var e=this,i=this.state;function n(i){e.manager.emit(i,t)}i<8&&n(e.options.event+wy(i)),n(e.options.event),t.additionalEvent&&n(t.additionalEvent),i>=8&&n(e.options.event+wy(i))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=yy},e.canEmit=function(){for(var t=0;te.threshold&&r&e.direction},i.attrTest=function(t){return Dy.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},i.emit=function(e){this.pX=e.deltaX,this.pY=e.deltaY;var i=Sy(e.direction);i&&(e.additionalEvent=this.options.event+i),t.prototype.emit.call(this,e)},e}(Dy),Ty=function(t){function e(e){return void 0===e&&(e={}),t.call(this,Zv({event:"swipe",threshold:10,velocity:.3,direction:Eg|Pg,pointers:1},e))||this}Kv(e,t);var i=e.prototype;return i.getTouchAction=function(){return Cy.prototype.getTouchAction.call(this)},i.attrTest=function(e){var i,n=this.options.direction;return n&(Eg|Pg)?i=e.overallVelocity:n&Eg?i=e.overallVelocityX:n&Pg&&(i=e.overallVelocityY),t.prototype.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers===this.options.pointers&&rg(i)>this.options.velocity&&e.eventType&xg},i.emit=function(t){var e=Sy(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)},e}(Dy),My=function(t){function e(e){return void 0===e&&(e={}),t.call(this,Zv({event:"pinch",threshold:0,pointers:2},e))||this}Kv(e,t);var i=e.prototype;return i.getTouchAction=function(){return[cg]},i.attrTest=function(e){return t.prototype.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},i.emit=function(e){if(1!==e.scale){var i=e.scale<1?"in":"out";e.additionalEvent=this.options.event+i}t.prototype.emit.call(this,e)},e}(Dy),Oy=function(t){function e(e){return void 0===e&&(e={}),t.call(this,Zv({event:"rotate",threshold:0,pointers:2},e))||this}Kv(e,t);var i=e.prototype;return i.getTouchAction=function(){return[cg]},i.attrTest=function(e){return t.prototype.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)},e}(Dy),Ey=function(t){function e(e){var i;return void 0===e&&(e={}),(i=t.call(this,Zv({event:"press",pointers:1,time:251,threshold:9},e))||this)._timer=null,i._input=null,i}Kv(e,t);var i=e.prototype;return i.getTouchAction=function(){return[ug]},i.process=function(t){var e=this,i=this.options,n=t.pointers.length===i.pointers,r=t.distancei.time;if(this._input=t,!r||!n||t.eventType&(xg|Dg)&&!o)this.reset();else if(t.eventType&kg)this.reset(),this._timer=setTimeout((function(){e.state=8,e.tryEmit()}),i.time);else if(t.eventType&xg)return 8;return yy},i.reset=function(){clearTimeout(this._timer)},i.emit=function(t){8===this.state&&(t&&t.eventType&xg?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=og(),this.manager.emit(this.options.event,this._input)))},e}(ky),Py={domEvents:!1,touchAction:hg,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Ay=[[Oy,{enable:!1}],[My,{enable:!1},["rotate"]],[Ty,{direction:Eg}],[Cy,{direction:Eg},["swipe"]],[xy],[xy,{event:"doubletap",taps:2},["tap"]],[Ey]];function Iy(t,e){var i,n=t.element;n.style&&(Ng(t.options.cssProps,(function(r,o){i=sg(n.style,o),e?(t.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=t.oldCssProps[i]||""})),e||(t.oldCssProps={}))}var Ly=function(){function t(t,e){var i,n=this;this.options=tg({},Py,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(gg?ry:yg?ly:vg?vy:dy))(i,Xg),this.touchAction=new jg(this,this.options.touchAction),Iy(this,!0),Ng(this.options.recognizers,(function(t){var e=n.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}var e=t.prototype;return e.set=function(t){return tg(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(e.curRecognizer=null,r=null);for(var o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=window.console&&(window.console.warn||window.console.log);return r&&r.call(window.console,n,i),t.apply(this,arguments)}}var Yy=jy((function(t,e,i){for(var n=Object.keys(e),r=0;r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function Uy(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?i-1:0),r=1;r2)return Zy.apply(void 0,Yc(n=[$y(e[0],e[1])]).call(n,Ac(Hc(e).call(e,2))));var r=e[0],o=e[1];if(r instanceof Date&&o instanceof Date)return r.setTime(o.getTime()),r;var s,a=Vy(Xc(o));try{for(a.s();!(s=a.n()).done;){var l=s.value;Object.prototype.propertyIsEnumerable.call(o,l)&&(o[l]===Xy?delete r[l]:null===r[l]||null===o[l]||"object"!==Nd(r[l])||"object"!==Nd(o[l])||qc(r[l])||qc(o[l])?r[l]=Ky(o[l]):r[l]=Zy(r[l],o[l]))}}catch(t){a.e(t)}finally{a.f()}return r}function Ky(t){return qc(t)?ep(t).call(t,(function(t){return Ky(t)})):"object"===Nd(t)&&null!==t?t instanceof Date?new Date(t.getTime()):Zy({},t):t}function Jy(t){for(var e=0,i=rp(t);e2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)||!0===i)if("object"===Nd(e[r])&&null!==e[r]&&lm(e[r])===Object.prototype)void 0===t[r]?t[r]=db({},e[r],i):"object"===Nd(t[r])&&null!==t[r]&&lm(t[r])===Object.prototype?db(t[r],e[r],i):hb(t,e,r,n);else if(qc(e[r])){var o;t[r]=Hc(o=e[r]).call(o)}else hb(t,e,r,n);return t}function cb(t){var e=Nd(t);return"object"===e?null===t?"null":t instanceof Boolean?"Boolean":t instanceof Number?"Number":t instanceof String?"String":qc(t)?"Array":t instanceof Date?"Date":"Object":"number"===e?"Number":"boolean"===e?"Boolean":"string"===e?"String":void 0===e?"undefined":e}function pb(t,e){var i;return Yc(i=[]).call(i,Ac(t),[e])}function fb(t){return Hc(t).call(t)}var mb=Mm;var vb={asBoolean:function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},asNumber:function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},asString:function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},asSize:function(t,e){return"function"==typeof t&&(t=t()),ab(t)?t:sb(t)?t+"px":e||null},asElement:function(t,e){return"function"==typeof t&&(t=t()),t||e||null}};function gb(t){var e;switch(t.length){case 3:case 4:return(e=nb.exec(t))?{r:Zm(e[1]+e[1],16),g:Zm(e[2]+e[2],16),b:Zm(e[3]+e[3],16)}:null;case 6:case 7:return(e=ib.exec(t))?{r:Zm(e[1],16),g:Zm(e[2],16),b:Zm(e[3],16)}:null;default:return null}}function yb(t,e,i){var n;return"#"+Hc(n=((1<<24)+(t<<16)+(e<<8)+i).toString(16)).call(n,1)}function bb(t,e,i){t/=255,e/=255,i/=255;var n=Math.min(t,Math.min(e,i)),r=Math.max(t,Math.max(e,i));return n===r?{h:0,s:0,v:n}:{h:60*((t===n?3:i===n?1:5)-(t===n?e-i:i===n?t-e:i-t)/(r-n))/360,s:(r-n)/r,v:r}}function _b(t){var e=document.createElement("div"),i={};e.style.cssText=t;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:1;Ma(this,t),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return Yd(t,[{key:"insertTo",value:function(t){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=t,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=t}},{key:"setCloseCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=t}},{key:"_isColorString",value:function(t){if("string"==typeof t)return Mb[t]}},{key:"setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==t){var i,n=this._isColorString(t);if(void 0!==n&&(t=n),!0===ab(t)){if(!0===Sb(t)){var r=t.substr(4).substr(0,t.length-5).split(",");i={r:r[0],g:r[1],b:r[2],a:1}}else if(!0===Cb(t)){var o=t.substr(5).substr(0,t.length-6).split(",");i={r:o[0],g:o[1],b:o[2],a:o[3]}}else if(!0===Db(t)){var s=gb(t);i={r:s.r,g:s.g,b:s.b,a:1}}}else if(t instanceof Object&&void 0!==t.r&&void 0!==t.g&&void 0!==t.b){var a=void 0!==t.a?t.a:"1.0";i={r:t.r,g:t.g,b:t.b,a:a}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+vv(t));this._setColor(i,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var t=this;!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.previousColor=Nf({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",Rv((function(){void 0!==t.closeCallback&&(t.closeCallback(),t.closeCallback=void 0)}),0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(t){!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.initialColor=Nf({},t)),this.color=t;var e=bb(t.r,t.g,t.b),i=2*Math.PI,n=this.r*e.s,r=this.centerCoordinates.x+n*Math.sin(i*e.h),o=this.centerCoordinates.y+n*Math.cos(i*e.h);this.colorPickerSelector.style.left=r-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=o-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(t)}},{key:"_setOpacity",value:function(t){this.color.a=t/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(t){var e=bb(this.color.r,this.color.g,this.color.b);e.v=t/100;var i=wb(e.h,e.s,e.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=bb(t.r,t.g,t.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var n=this.colorPickerCanvas.clientWidth,r=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,n,r),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-e.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),Uv(i).call(i),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*t.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var t,e,i,n;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var r=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerText="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(t){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(t){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var s=this;this.opacityRange.onchange=function(){s._setOpacity(this.value)},this.opacityRange.oninput=function(){s._setOpacity(this.value)},this.brightnessRange.onchange=function(){s._setBrightness(this.value)},this.brightnessRange.oninput=function(){s._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerText="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerText="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerText="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerText="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerText="cancel",this.cancelButton.onclick=Tp(t=this._hide).call(t,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerText="apply",this.applyButton.onclick=Tp(e=this._apply).call(e,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerText="save",this.saveButton.onclick=Tp(i=this._save).call(i,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerText="load last",this.loadButton.onclick=Tp(n=this._loadLast).call(n,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var t=this;this.drag={},this.pinch={},this.hammer=new Qy(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("hammer.input",(function(e){e.isFirst&&t._moveSelector(e)})),this.hammer.on("tap",(function(e){t._moveSelector(e)})),this.hammer.on("panstart",(function(e){t._moveSelector(e)})),this.hammer.on("panmove",(function(e){t._moveSelector(e)})),this.hammer.on("panend",(function(e){t._moveSelector(e)}))}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e,i,n,r,o=this.colorPickerCanvas.clientWidth,s=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,o,s),this.centerCoordinates={x:.5*o,y:.5*s},this.r=.49*o;var a,l=2*Math.PI/360,h=1/this.r;for(n=0;n<360;n++)for(r=0;r3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return!1};Ma(this,t),this.parent=e,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.hideOption=o,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},Nf(this.options,this.defaultOptions),this.configureOptions=n,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new Ob(r),this.wrapper=void 0}return Yd(t,[{key:"setOptions",value:function(t){if(void 0!==t){this.popupHistory={},this._removePopup();var e=!0;if("string"==typeof t)this.options.filter=t;else if(qc(t))this.options.filter=t.join();else if("object"===Nd(t)){if(null==t)throw new TypeError("options cannot be null");void 0!==t.container&&(this.options.container=t.container),void 0!==mm(t)&&(this.options.filter=mm(t)),void 0!==t.showButton&&(this.options.showButton=t.showButton),void 0!==t.enabled&&(e=t.enabled)}else"boolean"==typeof t?(this.options.filter=!0,e=t):"function"==typeof t&&(this.options.filter=t,e=!0);!1===mm(this.options)&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(t){this.moduleOptions=t,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var t=mm(this.options),e=0,i=!1;for(var n in this.configureOptions)Object.prototype.hasOwnProperty.call(this.configureOptions,n)&&(this.allowCreation=!1,i=!1,"function"==typeof t?i=(i=t(n,[]))||this._handleObject(this.configureOptions[n],[n],!0):!0!==t&&-1===av(t).call(t,n)||(i=!0),!1!==i&&(this.allowCreation=!0,e>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),e++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var t=0;t1?i-1:0),r=1;r2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");if(n.className="vis-configuration vis-config-label vis-config-s"+e.length,!0===i){for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(Eb("i","b",t))}else n.innerText=t+":";return n}},{key:"_makeDropdown",value:function(t,e,i){var n=document.createElement("select");n.className="vis-configuration vis-config-select";var r=0;void 0!==e&&-1!==av(t).call(t,e)&&(r=av(t).call(t,e));for(var o=0;oo&&1!==o&&(a.max=Math.ceil(e*u),h=a.max,l="range increased"),a.value=e}else a.value=n;var d=document.createElement("input");d.className="vis-configuration vis-config-rangeinput",d.value=a.value;var c=this;a.onchange=function(){d.value=this.value,c._update(Number(this.value),i)},a.oninput=function(){d.value=this.value};var p=this._makeLabel(i[i.length-1],i),f=this._makeItem(i,p,a,d);""!==l&&this.popupHistory[f]!==h&&(this.popupHistory[f]=h,this._setupPopup(l,f))}},{key:"_makeButton",value:function(){var t=this;if(!0===this.options.showButton){var e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerText="generate options",e.onclick=function(){t._printOptions()},e.onmouseover=function(){e.className="vis-configuration vis-config-button hover"},e.onmouseout=function(){e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}},{key:"_setupPopup",value:function(t,e){var i=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1,r=mm(this.options),o=!1;for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){n=!0;var a=t[s],l=pb(e,s);if("function"==typeof r&&!1===(n=r(s,e))&&!qc(a)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,n=this._handleObject(a,l,!0),this.allowCreation=!1===i),!1!==n){o=!0;var h=this._getValue(l);if(qc(a))this._handleArray(a,h,l);else if("string"==typeof a)this._makeTextInput(a,h,l);else if("boolean"==typeof a)this._makeCheckbox(a,h,l);else if(a instanceof Object){if(!this.hideOption(e,s,this.moduleOptions))if(void 0!==a.enabled){var u=pb(l,"enabled"),d=this._getValue(u);if(!0===d){var c=this._makeLabel(s,l,!0);this._makeItem(l,c),o=this._handleObject(a,l)||o}else this._makeCheckbox(a,d,l)}else{var p=this._makeLabel(s,l,!0);this._makeItem(l,p),o=this._handleObject(a,l)||o}}else console.error("dont know how to handle",a,s,l)}}return o}},{key:"_handleArray",value:function(t,e,i){"string"==typeof t[0]&&"color"===t[0]?(this._makeColorField(t,e,i),t[1]!==e&&this.changedOptions.push({path:i,value:e})):"string"==typeof t[0]?(this._makeDropdown(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:e})):"number"==typeof t[0]&&(this._makeRange(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:Number(e)}))}},{key:"_update",value:function(t,e){var i=this._constructOptions(t,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i;t="false"!==(t="true"===t||t)&&t;for(var r=0;rr-this.padding&&(a=!0),o=a?this.x-i:this.x,s=l?this.y-e:this.y}else(s=this.y-e)+e+this.padding>n&&(s=n-e-this.padding),sr&&(o=r-i-this.padding),os.distance?" in "+t.printLocation(o.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(s.path,s.closestMatch,""):o.distance<=8?'. Did you mean "'+o.closestMatch+'"?'+t.printLocation(o.path,e):". Did you mean one of these: "+t.print(rp(i))+t.printLocation(n,e),console.error('%cUnknown option detected: "'+e+'"'+r,Nb),Lb=!0}},{key:"findInOptions",value:function(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=1e9,s="",a=[],l=e.toLowerCase(),h=void 0;for(var u in i){var d=void 0;if(void 0!==i[u].__type__&&!0===r){var c=t.findInOptions(e,i[u],pb(n,u));o>c.distance&&(s=c.closestMatch,a=c.path,o=c.distance,h=c.indexMatch)}else{var p;-1!==av(p=u.toLowerCase()).call(p,l)&&(h=u),o>(d=t.levenshteinDistance(e,u))&&(s=u,a=fb(n),o=d)}}return{closestMatch:s,path:a,distance:o,indexMatch:h}}},{key:"printLocation",value:function(t,e){for(var i="\n\n"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n")+"options = {\n",n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)}}(),e=t(" "),i=t(" "),n=t(" "),r=0;r0)return"before"==n?Math.max(0,l-1):l;if(r(s,e)<0&&r(a,e)>0)return"before"==n?l:Math.min(t.length-1,l+1);r(s,e)<0?u=l+1:d=l-1,h++}return-1},bridgeObject:Tb,copyAndExtendArray:pb,copyArray:fb,deepExtend:db,deepObjectAssign:$y,easingFunctions:{linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},equalArray:function(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i2&&void 0!==arguments[2]&&arguments[2];for(var r in e)if(void 0!==i[r])if(null===i[r]||"object"!==Nd(i[r]))hb(e,i,r,n);else{var o=e[r],s=i[r];lb(o)&&lb(s)&&t(o,s,n)}},forEach:function(t,e){if(qc(t))for(var i=t.length,n=0;n0&&void 0!==arguments[0]?arguments[0]:window.event,e=null;return t&&(t.target?e=t.target:t.srcElement&&(e=t.srcElement)),e instanceof Element&&(null==e.nodeType||3!=e.nodeType||(e=e.parentNode)instanceof Element)?e:null},getType:cb,hasParent:function(t,e){for(var i=t;i;){if(i===e)return!0;if(!i.parentNode)return!1;i=i.parentNode}return!1},hexToHSV:xb,hexToRGB:gb,insertSort:function(t,e){for(var i=0;i0&&e(n,t[r-1])<0;r--)t[r]=t[r-1];t[r]=n}return t},isDate:function(t){if(t instanceof Date)return!0;if(ab(t)){if(eb.exec(t))return!0;if(!isNaN(Date.parse(t)))return!0}return!1},isNumber:sb,isObject:lb,isString:ab,isValidHex:Db,isValidRGB:Sb,isValidRGBA:Cb,mergeOptions:function(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=function(t){return null!=t},o=function(t){return null!==t&&"object"===Nd(t)};if(!o(t))throw new Error("Parameter mergeTarget must be an object");if(!o(e))throw new Error("Parameter options must be an object");if(!r(i))throw new Error("Parameter option must have a value");if(!o(n))throw new Error("Parameter globalOptions must be an object");var s=e[i],a=o(n)&&!function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(n)?n[i]:void 0,l=a?a.enabled:void 0;if(void 0!==s){if("boolean"==typeof s)return o(t[i])||(t[i]={}),void(t[i].enabled=s);if(null===s&&!o(t[i])){if(!r(a))return;t[i]=cv(a)}if(o(s)){var h=!0;void 0!==s.enabled?h=s.enabled:void 0!==l&&(h=a.enabled),function(t,e,i){o(t[i])||(t[i]={});var n=e[i],r=t[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}(t,e,i),t[i].enabled=h}}},option:vb,overrideOpacity:function(t,e){if(nm(t).call(t,"rgba"))return t;if(nm(t).call(t,"rgb")){var i=t.substr(av(t).call(t,"(")+1).replace(")","").split(",");return"rgba("+i[0]+","+i[1]+","+i[2]+","+e+")"}var n=gb(t);return null==n?t:"rgba("+n.r+","+n.g+","+n.b+","+e+")"},parseColor:function(t,e){if(ab(t)){var i=t;if(Sb(i)){var n,r=ep(n=i.substr(4).substr(0,i.length-5).split(",")).call(n,(function(t){return Zm(t)}));i=yb(r[0],r[1],r[2])}if(!0===Db(i)){var o=xb(i),s={h:o.h,s:.8*o.s,v:Math.min(1,1.02*o.v)},a={h:o.h,s:Math.min(1,1.25*o.s),v:.8*o.v},l=kb(a.h,a.s,a.v),h=kb(s.h,s.s,s.v);return{background:i,border:l,highlight:{background:h,border:l},hover:{background:h,border:l}}}return{background:i,border:i,highlight:{background:i,border:i},hover:{background:i,border:i}}}return e?{background:t.background||e.background,border:t.border||e.border,highlight:ab(t.highlight)?{border:t.highlight,background:t.highlight}:{background:t.highlight&&t.highlight.background||e.highlight.background,border:t.highlight&&t.highlight.border||e.highlight.border},hover:ab(t.hover)?{border:t.hover,background:t.hover}:{border:t.hover&&t.hover.border||e.hover.border,background:t.hover&&t.hover.background||e.hover.background}}:{background:t.background||void 0,border:t.border||void 0,highlight:ab(t.highlight)?{border:t.highlight,background:t.highlight}:{background:t.highlight&&t.highlight.background||void 0,border:t.highlight&&t.highlight.border||void 0},hover:ab(t.hover)?{border:t.hover,background:t.hover}:{border:t.hover&&t.hover.border||void 0,background:t.hover&&t.hover.background||void 0}}},preventDefault:function(t){t||(t=window.event),t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)},pureDeepObjectAssign:qy,recursiveDOMDelete:function t(e){if(e)for(;!0===e.hasChildNodes();){var i=e.firstChild;i&&(t(i),e.removeChild(i))}},removeClassName:function(t,e){var i=t.className.split(" "),n=e.split(" ");i=mm(i).call(i,(function(t){return!nm(n).call(n,t)})),t.className=i.join(" ")},removeCssText:function(t,e){for(var i=_b(e),n=0,r=rp(i);n3&&void 0!==arguments[3]&&arguments[3];if(qc(i))throw new TypeError("Arrays are not supported by deepExtend");for(var r=0;r2?i-2:0),r=2;r3&&void 0!==arguments[3]&&arguments[3];if(qc(i))throw new TypeError("Arrays are not supported by deepExtend");for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&!nm(t).call(t,r))if(i[r]&&i[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r].constructor===Object?db(e[r],i[r]):hb(e,i,r,n);else if(qc(i[r])){e[r]=[];for(var o=0;o0?(n=e[t].redundant[0],e[t].redundant.shift()):(n=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(n)):(n=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(n)),e[t].used.push(n),n}function $b(t,e,i,n){var r;return e.hasOwnProperty(t)?e[t].redundant.length>0?(r=e[t].redundant[0],e[t].redundant.shift()):(r=document.createElement(t),void 0!==n?i.insertBefore(r,n):i.appendChild(r)):(r=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==n?i.insertBefore(r,n):i.appendChild(r)),e[t].used.push(r),r}function Zb(t,e,i,n,r,o){var s;if("circle"==i.style?((s=qb("circle",n,r)).setAttributeNS(null,"cx",t),s.setAttributeNS(null,"cy",e),s.setAttributeNS(null,"r",.5*i.size)):((s=qb("rect",n,r)).setAttributeNS(null,"x",t-.5*i.size),s.setAttributeNS(null,"y",e-.5*i.size),s.setAttributeNS(null,"width",i.size),s.setAttributeNS(null,"height",i.size)),void 0!==i.styles&&s.setAttributeNS(null,"style",i.styles),s.setAttributeNS(null,"class",i.className+" vis-point"),o){var a=qb("text",n,r);o.xOffset&&(t+=o.xOffset),o.yOffset&&(e+=o.yOffset),o.content&&(a.textContent=o.content),o.className&&a.setAttributeNS(null,"class",o.className+" vis-label"),a.setAttributeNS(null,"x",t),a.setAttributeNS(null,"y",e)}return s}function Kb(t,e,i,n,r,o,s,a){if(0!=n){n<0&&(e-=n*=-1);var l=qb("rect",o,s);l.setAttributeNS(null,"x",t-.5*i),l.setAttributeNS(null,"y",e),l.setAttributeNS(null,"width",i),l.setAttributeNS(null,"height",n),l.setAttributeNS(null,"class",r),a&&l.setAttributeNS(null,"style",a)}}function Jb(){try{return navigator?navigator.languages&&navigator.languages.length?navigator.languages:navigator.userLanguage||navigator.language||navigator.browserLanguage||"en":"en"}catch(t){return"en"}}var Qb=Object.freeze({__proto__:null,cleanupElements:Ub,drawBar:Kb,drawPoint:Zb,getDOMElement:$b,getNavigatorLanguage:Jb,getSVGElement:qb,prepareElements:Vb,resetElements:Xb});function t_(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var e_=dv,i_=n(e_);En({target:"Object",stat:!0},{setPrototypeOf:Do});var n_=ce.Object.setPrototypeOf,r_=n(n_),o_=n(Cp);function s_(t,e){var i;return s_=r_?o_(i=r_).call(i):function(t,e){return t.__proto__=e,t},s_(t,e)}function a_(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=i_(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Fa(t,"prototype",{writable:!1}),e&&s_(t,e)}function l_(t,e){if(e&&("object"===Nd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return t_(t)}var h_=am,u_=n(h_);function d_(t){var e;return d_=r_?o_(e=u_).call(e):function(t){return t.__proto__||u_(t)},d_(t)}function c_(t,e,i){return(e=Fd(e))in t?Fa(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var p_={exports:{}},f_={exports:{}};!function(t){var e=Ed,i=Id;function n(r){return t.exports=n="function"==typeof e&&"symbol"==typeof i?function(t){return typeof t}:function(t){return t&&"function"==typeof e&&t.constructor===e&&t!==e.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(f_);var m_=f_.exports,v_=Yp,g_=z,y_=Uc,b_=Fi,__=Kt,w_=$t,k_=ui,x_=Error,D_=m("".replace),S_=String(new x_("zxcasd").stack),C_=/\n\s*at [^:]*:[^\n]*/,T_=C_.test(S_),M_=ai,O_=!h((function(){var t=new Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",M_(1,7)),7!==t.stack)})),E_=ui,P_=function(t,e){if(T_&&"string"==typeof t&&!x_.prepareStackTrace)for(;e--;)t=D_(t,C_,"");return t},A_=O_,I_=Error.captureStackTrace,L_=yn,N_=de,R_=le,F_=Se,j_=ss,Y_=Vn,H_=ye,z_=zs,B_=Ls,G_=ts,W_=TypeError,V_=function(t,e){this.stopped=t,this.result=e},U_=V_.prototype,X_=function(t,e,i){var n,r,o,s,a,l,h,u=i&&i.that,d=!(!i||!i.AS_ENTRIES),c=!(!i||!i.IS_RECORD),p=!(!i||!i.IS_ITERATOR),f=!(!i||!i.INTERRUPTED),m=L_(e,u),v=function(t){return n&&G_(n,"normal",t),new V_(!0,t)},g=function(t){return d?(R_(t),f?m(t[0],t[1],v):m(t[0],t[1])):f?m(t,v):m(t)};if(c)n=t.iterator;else if(p)n=t;else{if(!(r=B_(t)))throw new W_(F_(t)+" is not iterable");if(j_(r)){for(o=0,s=Y_(t);s>o;o++)if((a=g(t[o]))&&H_(U_,a))return a;return new V_(!1)}n=z_(t,r)}for(l=c?t.next:n.next;!(h=N_(l,n)).done;){try{a=g(h.value)}catch(t){G_(n,"throw",t)}if("object"==typeof a&&a&&H_(U_,a))return a}return new V_(!1)},q_=Lt,$_=En,Z_=ye,K_=Hr,J_=Do,Q_=function(t,e,i){for(var n=y_(e),r=__.f,o=b_.f,s=0;s2&&nw(i,arguments[2]);var r=[];return ow(t,hw,{that:r}),ew(i,"errors",r),i};J_?J_(uw,lw):Q_(uw,lw,{name:!0});var dw=uw.prototype=tw(lw.prototype,{constructor:iw(1,uw),message:iw(1,""),name:iw(1,"AggregateError")});$_({global:!0,constructor:!0,arity:2},{AggregateError:uw});var cw,pw,fw,mw,vw="process"===Dt(w.process),gw=ge,yw=El,bw=Zt,_w=ft("species"),ww=function(t){var e=gw(t);bw&&e&&!e[_w]&&yw(e,_w,{configurable:!0,get:function(){return this}})},kw=ye,xw=TypeError,Dw=function(t,e){if(kw(e,t))return t;throw new xw("Incorrect invocation")},Sw=Ds,Cw=Se,Tw=TypeError,Mw=function(t){if(Sw(t))return t;throw new Tw(Cw(t)+" is not a constructor")},Ow=le,Ew=Mw,Pw=A,Aw=ft("species"),Iw=function(t,e){var i,n=Ow(t).constructor;return void 0===n||Pw(i=Ow(n)[Aw])?e:Ew(i)},Lw=/(?:ipad|iphone|ipod).*applewebkit/i.test(X),Nw=w,Rw=Ii,Fw=yn,jw=_t,Yw=z,Hw=h,zw=fr,Bw=ku,Gw=ee,Ww=bv,Vw=Lw,Uw=vw,Xw=Nw.setImmediate,qw=Nw.clearImmediate,$w=Nw.process,Zw=Nw.Dispatch,Kw=Nw.Function,Jw=Nw.MessageChannel,Qw=Nw.String,tk=0,ek={},ik="onreadystatechange";Hw((function(){cw=Nw.location}));var nk=function(t){if(Yw(ek,t)){var e=ek[t];delete ek[t],e()}},rk=function(t){return function(){nk(t)}},ok=function(t){nk(t.data)},sk=function(t){Nw.postMessage(Qw(t),cw.protocol+"//"+cw.host)};Xw&&qw||(Xw=function(t){Ww(arguments.length,1);var e=jw(t)?t:Kw(t),i=Bw(arguments,1);return ek[++tk]=function(){Rw(e,void 0,i)},pw(tk),tk},qw=function(t){delete ek[t]},Uw?pw=function(t){$w.nextTick(rk(t))}:Zw&&Zw.now?pw=function(t){Zw.now(rk(t))}:Jw&&!Vw?(mw=(fw=new Jw).port2,fw.port1.onmessage=ok,pw=Fw(mw.postMessage,mw)):Nw.addEventListener&&jw(Nw.postMessage)&&!Nw.importScripts&&cw&&"file:"!==cw.protocol&&!Hw(sk)?(pw=sk,Nw.addEventListener("message",ok,!1)):pw=ik in Gw("script")?function(t){zw.appendChild(Gw("script"))[ik]=function(){zw.removeChild(this),nk(t)}}:function(t){setTimeout(rk(t),0)});var ak={set:Xw,clear:qw},lk=function(){this.head=null,this.tail=null};lk.prototype={add:function(t){var e={item:t,next:null},i=this.tail;i?i.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var hk,uk,dk,ck,pk,fk=lk,mk=/ipad|iphone|ipod/i.test(X)&&"undefined"!=typeof Pebble,vk=/web0s(?!.*chrome)/i.test(X),gk=w,yk=yn,bk=Fi.f,_k=ak.set,wk=fk,kk=Lw,xk=mk,Dk=vk,Sk=vw,Ck=gk.MutationObserver||gk.WebKitMutationObserver,Tk=gk.document,Mk=gk.process,Ok=gk.Promise,Ek=bk(gk,"queueMicrotask"),Pk=Ek&&Ek.value;if(!Pk){var Ak=new wk,Ik=function(){var t,e;for(Sk&&(t=Mk.domain)&&t.exit();e=Ak.get();)try{e()}catch(t){throw Ak.head&&hk(),t}t&&t.enter()};kk||Sk||Dk||!Ck||!Tk?!xk&&Ok&&Ok.resolve?((ck=Ok.resolve(void 0)).constructor=Ok,pk=yk(ck.then,ck),hk=function(){pk(Ik)}):Sk?hk=function(){Mk.nextTick(Ik)}:(_k=yk(_k,gk),hk=function(){_k(Ik)}):(uk=!0,dk=Tk.createTextNode(""),new Ck(Ik).observe(dk,{characterData:!0}),hk=function(){dk.data=uk=!uk}),Pk=function(t){Ak.head||hk(),Ak.add(t)}}var Lk=Pk,Nk=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},Rk=w.Promise,Fk="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,jk=!Fk&&!vw&&"object"==typeof window&&"object"==typeof document,Yk=w,Hk=Rk,zk=_t,Bk=fn,Gk=us,Wk=ft,Vk=jk,Uk=Fk,Xk=tt,qk=Hk&&Hk.prototype,$k=Wk("species"),Zk=!1,Kk=zk(Yk.PromiseRejectionEvent),Jk=Bk("Promise",(function(){var t=Gk(Hk),e=t!==String(Hk);if(!e&&66===Xk)return!0;if(!qk.catch||!qk.finally)return!0;if(!Xk||Xk<51||!/native code/.test(t)){var i=new Hk((function(t){t(1)})),n=function(t){t((function(){}),(function(){}))};if((i.constructor={})[$k]=n,!(Zk=i.then((function(){}))instanceof n))return!0}return!e&&(Vk||Uk)&&!Kk})),Qk={CONSTRUCTOR:Jk,REJECTION_EVENT:Kk,SUBCLASSING:Zk},tx={},ex=Oe,ix=TypeError,nx=function(t){var e,i;this.promise=new t((function(t,n){if(void 0!==e||void 0!==i)throw new ix("Bad Promise constructor");e=t,i=n})),this.resolve=ex(e),this.reject=ex(i)};tx.f=function(t){return new nx(t)};var rx,ox,sx=En,ax=vw,lx=w,hx=de,ux=Br,dx=ao,cx=ww,px=Oe,fx=_t,mx=$t,vx=Dw,gx=Iw,yx=ak.set,bx=Lk,_x=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},wx=Nk,kx=fk,xx=Mi,Dx=Rk,Sx=Qk,Cx=tx,Tx="Promise",Mx=Sx.CONSTRUCTOR,Ox=Sx.REJECTION_EVENT,Ex=xx.getterFor(Tx),Px=xx.set,Ax=Dx&&Dx.prototype,Ix=Dx,Lx=Ax,Nx=lx.TypeError,Rx=lx.document,Fx=lx.process,jx=Cx.f,Yx=jx,Hx=!!(Rx&&Rx.createEvent&&lx.dispatchEvent),zx="unhandledrejection",Bx=function(t){var e;return!(!mx(t)||!fx(e=t.then))&&e},Gx=function(t,e){var i,n,r,o=e.value,s=1===e.state,a=s?t.ok:t.fail,l=t.resolve,h=t.reject,u=t.domain;try{a?(s||(2===e.rejection&&qx(e),e.rejection=1),!0===a?i=o:(u&&u.enter(),i=a(o),u&&(u.exit(),r=!0)),i===t.promise?h(new Nx("Promise-chain cycle")):(n=Bx(i))?hx(n,i,l,h):l(i)):h(o)}catch(t){u&&!r&&u.exit(),h(t)}},Wx=function(t,e){t.notified||(t.notified=!0,bx((function(){for(var i,n=t.reactions;i=n.get();)Gx(i,t);t.notified=!1,e&&!t.rejection&&Ux(t)})))},Vx=function(t,e,i){var n,r;Hx?((n=Rx.createEvent("Event")).promise=e,n.reason=i,n.initEvent(t,!1,!0),lx.dispatchEvent(n)):n={promise:e,reason:i},!Ox&&(r=lx["on"+t])?r(n):t===zx&&_x("Unhandled promise rejection",i)},Ux=function(t){hx(yx,lx,(function(){var e,i=t.facade,n=t.value;if(Xx(t)&&(e=wx((function(){ax?Fx.emit("unhandledRejection",n,i):Vx(zx,i,n)})),t.rejection=ax||Xx(t)?2:1,e.error))throw e.value}))},Xx=function(t){return 1!==t.rejection&&!t.parent},qx=function(t){hx(yx,lx,(function(){var e=t.facade;ax?Fx.emit("rejectionHandled",e):Vx("rejectionhandled",e,t.value)}))},$x=function(t,e,i){return function(n){t(e,n,i)}},Zx=function(t,e,i){t.done||(t.done=!0,i&&(t=i),t.value=e,t.state=2,Wx(t,!0))},Kx=function(t,e,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===e)throw new Nx("Promise can't be resolved itself");var n=Bx(e);n?bx((function(){var i={done:!1};try{hx(n,e,$x(Kx,i,t),$x(Zx,i,t))}catch(e){Zx(i,e,t)}})):(t.value=e,t.state=1,Wx(t,!1))}catch(e){Zx({done:!1},e,t)}}};Mx&&(Lx=(Ix=function(t){vx(this,Lx),px(t),hx(rx,this);var e=Ex(this);try{t($x(Kx,e),$x(Zx,e))}catch(t){Zx(e,t)}}).prototype,(rx=function(t){Px(this,{type:Tx,done:!1,notified:!1,parent:!1,reactions:new kx,rejection:!1,state:0,value:void 0})}).prototype=ux(Lx,"then",(function(t,e){var i=Ex(this),n=jx(gx(this,Ix));return i.parent=!0,n.ok=!fx(t)||t,n.fail=fx(e)&&e,n.domain=ax?Fx.domain:void 0,0===i.state?i.reactions.add(n):bx((function(){Gx(n,i)})),n.promise})),ox=function(){var t=new rx,e=Ex(t);this.promise=t,this.resolve=$x(Kx,e),this.reject=$x(Zx,e)},Cx.f=jx=function(t){return t===Ix||undefined===t?new ox(t):Yx(t)}),sx({global:!0,constructor:!0,wrap:!0,forced:Mx},{Promise:Ix}),dx(Ix,Tx,!1,!0),cx(Tx);var Jx=Rk,Qx=Qk.CONSTRUCTOR||!na((function(t){Jx.all(t).then(void 0,(function(){}))})),tD=de,eD=Oe,iD=tx,nD=Nk,rD=X_;En({target:"Promise",stat:!0,forced:Qx},{all:function(t){var e=this,i=iD.f(e),n=i.resolve,r=i.reject,o=nD((function(){var i=eD(e.resolve),o=[],s=0,a=1;rD(t,(function(t){var l=s++,h=!1;a++,tD(i,e,t).then((function(t){h||(h=!0,o[l]=t,--a||n(o))}),r)})),--a||n(o)}));return o.error&&r(o.value),i.promise}});var oD=En,sD=Qk.CONSTRUCTOR;Rk&&Rk.prototype,oD({target:"Promise",proto:!0,forced:sD,real:!0},{catch:function(t){return this.then(void 0,t)}});var aD=de,lD=Oe,hD=tx,uD=Nk,dD=X_;En({target:"Promise",stat:!0,forced:Qx},{race:function(t){var e=this,i=hD.f(e),n=i.reject,r=uD((function(){var r=lD(e.resolve);dD(t,(function(t){aD(r,e,t).then(i.resolve,n)}))}));return r.error&&n(r.value),i.promise}});var cD=de,pD=tx;En({target:"Promise",stat:!0,forced:Qk.CONSTRUCTOR},{reject:function(t){var e=pD.f(this);return cD(e.reject,void 0,t),e.promise}});var fD=le,mD=$t,vD=tx,gD=function(t,e){if(fD(t),mD(e)&&e.constructor===t)return e;var i=vD.f(t);return(0,i.resolve)(e),i.promise},yD=En,bD=Rk,_D=Qk.CONSTRUCTOR,wD=gD,kD=ge("Promise"),xD=!_D;yD({target:"Promise",stat:!0,forced:true},{resolve:function(t){return wD(xD&&this===kD?bD:this,t)}});var DD=de,SD=Oe,CD=tx,TD=Nk,MD=X_;En({target:"Promise",stat:!0,forced:Qx},{allSettled:function(t){var e=this,i=CD.f(e),n=i.resolve,r=i.reject,o=TD((function(){var i=SD(e.resolve),r=[],o=0,s=1;MD(t,(function(t){var a=o++,l=!1;s++,DD(i,e,t).then((function(t){l||(l=!0,r[a]={status:"fulfilled",value:t},--s||n(r))}),(function(t){l||(l=!0,r[a]={status:"rejected",reason:t},--s||n(r))}))})),--s||n(r)}));return o.error&&r(o.value),i.promise}});var OD=de,ED=Oe,PD=ge,AD=tx,ID=Nk,LD=X_,ND="No one promise resolved";En({target:"Promise",stat:!0,forced:Qx},{any:function(t){var e=this,i=PD("AggregateError"),n=AD.f(e),r=n.resolve,o=n.reject,s=ID((function(){var n=ED(e.resolve),s=[],a=0,l=1,h=!1;LD(t,(function(t){var u=a++,d=!1;l++,OD(n,e,t).then((function(t){d||h||(h=!0,r(t))}),(function(t){d||h||(d=!0,s[u]=t,--l||o(new i(s,ND)))}))})),--l||o(new i(s,ND))}));return s.error&&o(s.value),n.promise}});var RD=En,FD=Rk,jD=h,YD=ge,HD=_t,zD=Iw,BD=gD,GD=FD&&FD.prototype;RD({target:"Promise",proto:!0,real:!0,forced:!!FD&&jD((function(){GD.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var e=zD(this,YD("Promise")),i=HD(t);return this.then(i?function(i){return BD(e,t()).then((function(){return i}))}:t,i?function(i){return BD(e,t()).then((function(){throw i}))}:t)}});var WD=ce.Promise,VD=tx;En({target:"Promise",stat:!0},{withResolvers:function(){var t=VD.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}});var UD=WD,XD=tx,qD=Nk;En({target:"Promise",stat:!0,forced:!0},{try:function(t){var e=XD.f(this),i=qD(t);return(i.error?e.reject:e.resolve)(i.value),e.promise}});var $D=UD,ZD=Zp;!function(t){var e=m_.default,i=Ra,n=Ed,r=e_,o=h_,s=v_,a=rc,l=n_,h=$D,u=ZD,d=Cc;function c(){t.exports=c=function(){return f},t.exports.__esModule=!0,t.exports.default=t.exports;var p,f={},m=Object.prototype,v=m.hasOwnProperty,g=i||function(t,e,i){t[e]=i.value},y="function"==typeof n?n:{},b=y.iterator||"@@iterator",_=y.asyncIterator||"@@asyncIterator",w=y.toStringTag||"@@toStringTag";function k(t,e,n){return i(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{k({},"")}catch(p){k=function(t,e,i){return t[e]=i}}function x(t,e,i,n){var o=e&&e.prototype instanceof E?e:E,s=r(o.prototype),a=new B(n||[]);return g(s,"_invoke",{value:j(t,i,a)}),s}function D(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}f.wrap=x;var S="suspendedStart",C="suspendedYield",T="executing",M="completed",O={};function E(){}function P(){}function A(){}var I={};k(I,b,(function(){return this}));var L=o&&o(o(G([])));L&&L!==m&&v.call(L,b)&&(I=L);var N=A.prototype=E.prototype=r(I);function R(t){var e;s(e=["next","throw","return"]).call(e,(function(e){k(t,e,(function(t){return this._invoke(e,t)}))}))}function F(t,i){function n(r,o,s,a){var l=D(t[r],t,o);if("throw"!==l.type){var h=l.arg,u=h.value;return u&&"object"==e(u)&&v.call(u,"__await")?i.resolve(u.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):i.resolve(u).then((function(t){h.value=t,s(h)}),(function(t){return n("throw",t,s,a)}))}a(l.arg)}var r;g(this,"_invoke",{value:function(t,e){function o(){return new i((function(i,r){n(t,e,i,r)}))}return r=r?r.then(o,o):o()}})}function j(t,e,i){var n=S;return function(r,o){if(n===T)throw new Error("Generator is already running");if(n===M){if("throw"===r)throw o;return{value:p,done:!0}}for(i.method=r,i.arg=o;;){var s=i.delegate;if(s){var a=Y(s,i);if(a){if(a===O)continue;return a}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(n===S)throw n=M,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n=T;var l=D(t,e,i);if("normal"===l.type){if(n=i.done?M:C,l.arg===O)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(n=M,i.method="throw",i.arg=l.arg)}}}function Y(t,e){var i=e.method,n=t.iterator[i];if(n===p)return e.delegate=null,"throw"===i&&t.iterator.return&&(e.method="return",e.arg=p,Y(t,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),O;var r=D(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,O;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=p),e.delegate=null,O):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,O)}function H(t){var e,i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),a(e=this.tryEntries).call(e,i)}function z(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],s(t).call(t,H,this),this.reset(!0)}function G(t){if(t||""===t){var i=t[b];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n=0;--n){var r=this.tryEntries[n],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var s=v.call(r,"catchLoc"),a=v.call(r,"finallyLoc");if(s&&a){if(this.prev=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),z(i),O}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;z(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:G(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=p),O}},f}t.exports=c,t.exports.__esModule=!0,t.exports.default=t.exports}(p_);var KD=(0,p_.exports)(),JD=KD;try{regeneratorRuntime=KD}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=KD:Function("r","regeneratorRuntime = r")(KD)}var QD=n(JD),tS=Oe,eS=j,iS=Ui,nS=Vn,rS=TypeError,oS=function(t){return function(e,i,n,r){tS(i);var o=eS(e),s=iS(o),a=nS(o),l=t?a-1:0,h=t?-1:1;if(n<2)for(;;){if(l in s){r=s[l],l+=h;break}if(l+=h,t?l<0:a<=l)throw new rS("Reduce of empty array with no initial value")}for(;t?l>=0:a>l;l+=h)l in s&&(r=i(r,s[l],l,o));return r}},sS={left:oS(!1),right:oS(!0)}.left;En({target:"Array",proto:!0,forced:!vw&&tt>79&&tt<83||!Op("reduce")},{reduce:function(t){var e=arguments.length;return sS(this,t,e,e>1?arguments[1]:void 0)}});var aS=Jd("Array").reduce,lS=ye,hS=aS,uS=Array.prototype,dS=function(t){var e=t.reduce;return t===uS||lS(uS,t)&&e===uS.reduce?hS:e},cS=n(dS),pS=Ya,fS=Vn,mS=za,vS=yn,gS=function(t,e,i,n,r,o,s,a){for(var l,h,u=r,d=0,c=!!s&&vS(s,a);d0&&pS(l)?(h=fS(l),u=gS(t,e,l,h,u,o-1)-1):(mS(u+1),t[u]=l),u++),d++;return u},yS=gS,bS=Oe,_S=j,wS=Vn,kS=qa;En({target:"Array",proto:!0},{flatMap:function(t){var e,i=_S(this),n=wS(i);return bS(t),(e=kS(i,0)).length=yS(e,i,i,n,0,1,t,arguments.length>1?arguments[1]:void 0),e}});var xS=Jd("Array").flatMap,DS=ye,SS=xS,CS=Array.prototype,TS=function(t){var e=t.flatMap;return t===CS||DS(CS,t)&&e===CS.flatMap?SS:e},MS=n(TS),OS={exports:{}},ES=h((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),PS=h,AS=$t,IS=Dt,LS=ES,NS=Object.isExtensible,RS=PS((function(){NS(1)}))||LS?function(t){return!!AS(t)&&((!LS||"ArrayBuffer"!==IS(t))&&(!NS||NS(t)))}:NS,FS=!h((function(){return Object.isExtensible(Object.preventExtensions({}))})),jS=En,YS=m,HS=fi,zS=$t,BS=z,GS=Kt.f,WS=pl,VS=vl,US=RS,XS=FS,qS=!1,$S=U("meta"),ZS=0,KS=function(t){GS(t,$S,{value:{objectID:"O"+ZS++,weakData:{}}})},JS=OS.exports={enable:function(){JS.enable=function(){},qS=!0;var t=WS.f,e=YS([].splice),i={};i[$S]=1,t(i).length&&(WS.f=function(i){for(var n=t(i),r=0,o=n.length;r1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),_C(o,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return a(this,0===t?0:t,e)}}:{add:function(t){return a(this,t=0===t?0:t,t)}}),MC&&bC(o,"size",{configurable:!0,get:function(){return s(this).size}}),r},setStrong:function(t,e,i){var n=e+" Iterator",r=PC(e),o=PC(n);SC(t,e,(function(t,e){EC(this,{type:n,target:t,state:r(t),kind:e,last:void 0})}),(function(){for(var t=o(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?CC("keys"===e?i.key:"values"===e?i.value:[i.key,i.value],!1):(t.target=void 0,CC(void 0,!0))}),i?"entries":"values",!i,!0),TC(e)}};vC("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),AC);var IC=n(ce.Map);vC("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),AC);var LC=n(ce.Set),NC=n(Ad),RC=n(zs),FC=kl,jC=Math.floor,YC=function(t,e){var i=t.length,n=jC(i/2);return i<8?HC(t,e):zC(t,YC(FC(t,0,n),e),YC(FC(t,n),e),e)},HC=function(t,e){for(var i,n,r=t.length,o=1;o0;)t[n]=t[--n];n!==o++&&(t[n]=i)}return t},zC=function(t,e,i,n){for(var r=e.length,o=i.length,s=0,a=0;s3)){if(oT)return!0;if(aT)return aT<603;var t,e,i,n,r="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(n=0;n<47;n++)lT.push({k:e+n,v:i})}for(lT.sort((function(t,e){return e.v-t.v})),n=0;ntT(i)?1:-1}}(t)),i=JC(r),n=0;n1?arguments[1]:void 0)}});var kT=Jd("Array").some,xT=ye,DT=kT,ST=Array.prototype,CT=function(t){var e=t.some;return t===ST||xT(ST,t)&&e===ST.some?DT:e},TT=n(CT),MT=Jd("Array").keys,OT=Pt,ET=z,PT=ye,AT=MT,IT=Array.prototype,LT={DOMTokenList:!0,NodeList:!0},NT=function(t){var e=t.keys;return t===IT||PT(IT,t)&&e===IT.keys||ET(LT,OT(t))?AT:e},RT=n(NT),FT=Jd("Array").values,jT=Pt,YT=z,HT=ye,zT=FT,BT=Array.prototype,GT={DOMTokenList:!0,NodeList:!0},WT=function(t){var e=t.values;return t===BT||HT(BT,t)&&e===BT.values||YT(GT,jT(t))?zT:e},VT=n(WT),UT=Jd("Array").entries,XT=Pt,qT=z,$T=ye,ZT=UT,KT=Array.prototype,JT={DOMTokenList:!0,NodeList:!0},QT=function(t){var e=t.entries;return t===KT||$T(KT,t)&&e===KT.entries||qT(JT,XT(t))?ZT:e},tM=n(QT),eM=n(Na),iM=En,nM=Ii,rM=bp,oM=Mw,sM=le,aM=$t,lM=Pr,hM=h,uM=ge("Reflect","construct"),dM=Object.prototype,cM=[].push,pM=hM((function(){function t(){}return!(uM((function(){}),[],t)instanceof t)})),fM=!hM((function(){uM((function(){}))})),mM=pM||fM;iM({target:"Reflect",stat:!0,forced:mM,sham:mM},{construct:function(t,e){oM(t),sM(e);var i=arguments.length<3?t:oM(arguments[2]);if(fM&&!pM)return uM(t,e,i);if(t===i){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return nM(cM,n,e),new(nM(rM,t,n))}var r=i.prototype,o=lM(aM(r)?r:dM),s=nM(t,o,e);return aM(s)?s:o}});var vM=n(ce.Reflect.construct),gM=n(ce.Object.getOwnPropertySymbols),yM={exports:{}},bM=En,_M=h,wM=$i,kM=Fi.f,xM=Zt;bM({target:"Object",stat:!0,forced:!xM||_M((function(){kM(1)})),sham:!xM},{getOwnPropertyDescriptor:function(t,e){return kM(wM(t),e)}});var DM=ce.Object,SM=yM.exports=function(t,e){return DM.getOwnPropertyDescriptor(t,e)};DM.getOwnPropertyDescriptor.sham&&(SM.sham=!0);var CM=n(yM.exports),TM=Uc,MM=$i,OM=Fi,EM=Ms;En({target:"Object",stat:!0,sham:!Zt},{getOwnPropertyDescriptors:function(t){for(var e,i,n=MM(t),r=OM.f,o=TM(n),s={},a=0;o.length>a;)void 0!==(i=r(n,e=o[a++]))&&EM(s,e,i);return s}});var PM=n(ce.Object.getOwnPropertyDescriptors),AM={exports:{}},IM=En,LM=Zt,NM=Fn.f;IM({target:"Object",stat:!0,forced:Object.defineProperties!==NM,sham:!LM},{defineProperties:NM});var RM=ce.Object,FM=AM.exports=function(t,e){return RM.defineProperties(t,e)};RM.defineProperties.sham&&(FM.sham=!0);var jM=n(AM.exports);let YM;const HM=new Uint8Array(16);function zM(){if(!YM&&(YM="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!YM))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return YM(HM)}const BM=[];for(let t=0;t<256;++t)BM.push((t+256).toString(16).slice(1));var GM,WM={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function VM(t,e,i){if(WM.randomUUID&&!e&&!t)return WM.randomUUID();const n=(t=t||{}).random||(t.rng||zM)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){i=i||0;for(let t=0;t<16;++t)e[i+t]=n[t];return e}return function(t,e=0){return BM[t[e+0]]+BM[t[e+1]]+BM[t[e+2]]+BM[t[e+3]]+"-"+BM[t[e+4]]+BM[t[e+5]]+"-"+BM[t[e+6]]+BM[t[e+7]]+"-"+BM[t[e+8]]+BM[t[e+9]]+"-"+BM[t[e+10]]+BM[t[e+11]]+BM[t[e+12]]+BM[t[e+13]]+BM[t[e+14]]+BM[t[e+15]]}(n)}function UM(t,e){var i=rp(t);if(gM){var n=gM(t);e&&(n=mm(n).call(n,(function(e){return CM(t,e).enumerable}))),i.push.apply(i,n)}return i}function XM(t){for(var e=1;e=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function ZM(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);ithis.max&&this.flush(),null!=this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&"number"==typeof this.delay&&(this._timeout=Rv((function(){t.flush()}),this.delay))}},{key:"flush",value:function(){var t,e;Hp(t=_f(e=this._queue).call(e,0)).call(t,(function(t){t.fn.apply(t.context||t.fn,t.args||[])}))}}],[{key:"extend",value:function(e,i){var n=new t(i);if(void 0!==e.flush)throw new Error("Target object already has a property flush");e.flush=function(){n.flush()};var r=[{name:"flush",original:void 0}];if(i&&i.replace)for(var o=0;or&&(r=l,n=a)}return n}},{key:"min",value:function(t){var e=RC(this._pairs),i=e.next();if(i.done)return null;for(var n=i.value[1],r=t(i.value[1],i.value[0]);!(i=e.next()).done;){var o=Pc(i.value,2),s=o[0],a=o[1],l=t(a,s);lr?1:nr)&&(n=s,r=a)}}catch(t){o.e(t)}finally{o.f()}return n||null}},{key:"min",value:function(t){var e,i,n=null,r=null,o=$M(VT(e=this._data).call(e));try{for(o.s();!(i=o.n()).done;){var s=i.value,a=s[t];"number"==typeof a&&(null==r||a/g,PO=/"/g,AO=/"/g,IO=/&#([a-zA-Z0-9]*);?/gim,LO=/:?/gim,NO=/&newline;?/gim,RO=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,FO=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,jO=/u\s*r\s*l\s*\(.*/gi;function YO(t){return t.replace(PO,""")}function HO(t){return t.replace(AO,'"')}function zO(t){return t.replace(IO,(function(t,e){return"x"===e[0]||"X"===e[0]?String.fromCharCode(parseInt(e.substr(1),16)):String.fromCharCode(parseInt(e,10))}))}function BO(t){return t.replace(LO,":").replace(NO," ")}function GO(t){for(var e="",i=0,n=t.length;i0;e--){var i=t[e];if(" "!==i)return"="===i?e:-1}}function tE(t){return function(t){return'"'===t[0]&&'"'===t[t.length-1]||"'"===t[0]&&"'"===t[t.length-1]}(t)?t.substr(1,t.length-2):t}UO.parseTag=function(t,e,i){var n="",r=0,o=!1,s=!1,a=0,l=t.length,h="",u="";t:for(a=0;a"===d||a===l-1){n+=i(t.slice(r,o)),h=qO(u=t.slice(o,a+1)),n+=e(o,n.length,h,u,$O(u)),r=a+1,o=!1;continue}if('"'===d||"'"===d)for(var c=1,p=t.charAt(a-c);""===p.trim()||"="===p;){if("="===p){s=d;continue t}p=t.charAt(a-++c)}}else if(d===s){s=!1;continue}}return r";var m=function(t){var e=sE.spaceIndex(t);if(-1===e)return{html:"",closing:"/"===t[t.length-2]};var i="/"===(t=sE.trim(t.slice(e+1,-1)))[t.length-1];return i&&(t=sE.trim(t.slice(0,-1))),{html:t,closing:i}}(d),v=i[u],g=oE(m.html,(function(t,e){var i=-1!==sE.indexOf(v,t),n=o(u,t,e,i);return aE(n)?i?(e=a(u,t,e,h))?t+'="'+e+'"':t:aE(n=s(u,t,e,i))?void 0:n:n}));return d="<"+u,g&&(d+=" "+g),m.closing&&(d+=" /"),d+=">"}return aE(f=r(u,d,p))?l(d):f}),l);return u&&(d=u.remove(d)),d};var hE=lE;!function(t,e){var i=hO,n=UO,r=hE;function o(t,e){return new r(e).process(t)}(e=t.exports=o).filterXSS=o,e.FilterXSS=r,function(){for(var t in i)e[t]=i[t];for(var r in n)e[r]=n[r]}(),"undefined"!=typeof window&&(window.filterXSS=t.exports),"undefined"!=typeof self&&"undefined"!=typeof DedicatedWorkerGlobalScope&&self instanceof DedicatedWorkerGlobalScope&&(self.filterXSS=t.exports)}(lO,lO.exports);var uE=n(lO.exports);function dE(t,e){var i=rp(t);if(gM){var n=gM(t);e&&(n=mm(n).call(n,(function(e){return CM(t,e).enumerable}))),i.push.apply(i,n)}return i}function cE(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{start:"Date",end:"Date"},l=t._idProp,h=new nO({fieldId:l}),u=ep(e=function(t){return new JM(t)}(t)).call(e,(function(t){var e;return cS(e=rp(t)).call(e,(function(e,i){return e[i]=vE(t[i],a[i]),e}),{})})).to(h);return u.all().start(),{add:function(){var e;return(e=t.getDataSet()).add.apply(e,arguments)},remove:function(){var e;return(e=t.getDataSet()).remove.apply(e,arguments)},update:function(){var e;return(e=t.getDataSet()).update.apply(e,arguments)},updateOnly:function(){var e;return(e=t.getDataSet()).updateOnly.apply(e,arguments)},clear:function(){var e;return(e=t.getDataSet()).clear.apply(e,arguments)},forEach:Tp(i=Hp(h)).call(i,h),get:Tp(n=h.get).call(n,h),getIds:Tp(r=h.getIds).call(r,h),off:Tp(o=h.off).call(o,h),on:Tp(s=h.on).call(s,h),get length(){return h.length},idProp:l,type:a,rawDS:t,coercedDS:h,dispose:function(){return u.stop()}}}var yE=function(t){var e=new uE.FilterXSS(t);return function(t){return e.process(t)}},bE=function(t){return t},_E=yE(),wE=cE(cE({},Wb),{},{convert:vE,setupXSSProtection:function(t){t&&(!0===t.disabled?(_E=bE,console.warn("You disabled XSS protection for vis-Timeline. I sure hope you know what you're doing!")):t.filterOptions&&(_E=yE(t.filterOptions)))}});eM(wE,"xss",{get:function(){return _E}});var kE=w,xE=h,DE=Lt,SE=Fm.trim,CE=Om,TE=m("".charAt),ME=kE.parseFloat,OE=kE.Symbol,EE=OE&&OE.iterator,PE=1/ME(CE+"-0")!=-1/0||EE&&!xE((function(){ME(Object(EE))}))?function(t){var e=SE(DE(t)),i=ME(e);return 0===i&&"-"===TE(e,0)?-0:i}:ME;En({global:!0,forced:parseFloat!==PE},{parseFloat:PE});var AE=n(ce.parseFloat),IE=function(){function t(e,i){Ma(this,t),this.options=null,this.props=null}return Yd(t,[{key:"setOptions",value:function(t){t&&wE.extend(this.options,t)}},{key:"redraw",value:function(){return!1}},{key:"destroy",value:function(){}},{key:"_isResized",value:function(){var t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height;return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t}}]),t}(),LE=b,NE=Lt,RE=N,FE=RangeError;En({target:"String",proto:!0},{repeat:function(t){var e=NE(RE(this)),i="",n=LE(t);if(n<0||n===1/0)throw new FE("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(e+=e))1&n&&(i+=e);return i}});var jE=Jd("String").repeat,YE=ye,HE=jE,zE=String.prototype,BE=function(t){var e=t.repeat;return"string"==typeof t||t===zE||YE(zE,t)&&e===zE.repeat?HE:e},GE=n(BE);function WE(t,e,i){if(i&&!qc(i))return WE(t,e,[i]);if(e.hiddenDates=[],i&&1==qc(i)){for(var n,r=0;r=4*o){var h=0,u=r.clone();switch(GE(i[s])){case"daily":a.day()!=l.day()&&(h=1),a.dayOfYear(n.dayOfYear()),a.year(n.year()),a.subtract(7,"days"),l.dayOfYear(n.dayOfYear()),l.year(n.year()),l.subtract(7-h,"days"),u.add(1,"weeks");break;case"weekly":var d=l.diff(a,"days"),c=a.day();a.date(n.date()),a.month(n.month()),a.year(n.year()),l=a.clone(),a.day(c),l.day(c),l.add(d,"days"),a.subtract(1,"weeks"),l.subtract(1,"weeks"),u.add(1,"weeks");break;case"monthly":a.month()!=l.month()&&(h=1),a.month(n.month()),a.year(n.year()),a.subtract(1,"months"),l.month(n.month()),l.year(n.year()),l.subtract(1,"months"),l.add(h,"months"),u.add(1,"months");break;case"yearly":a.year()!=l.year()&&(h=1),a.year(n.year()),a.subtract(1,"years"),l.year(n.year()),l.subtract(1,"years"),l.add(h,"years"),u.add(1,"years");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",GE(i[s]))}for(;a=i[r].start&&i[o].end<=i[r].end?i[o].remove=!0:i[o].start>=i[r].start&&i[o].start<=i[r].end?(i[r].end=i[o].end,i[o].remove=!0):i[o].end>=i[r].start&&i[o].end<=i[r].end&&(i[r].start=i[o].start,i[o].remove=!0));for(r=0;r=s&&rt.range.end){var a={start:t.range.start,end:e};return e=JE(t.options.moment,t.body.hiddenDates,a,e),n=t.range.conversion(i,o),(e.valueOf()-n.offset)*n.scale}return e=JE(t.options.moment,t.body.hiddenDates,t.range,e),n=t.range.conversion(i,o),(e.valueOf()-n.offset)*n.scale}function $E(t,e,i){if(0==t.body.hiddenDates.length){var n=t.range.conversion(i);return new Date(e/n.scale+n.offset)}var r=ZE(t.body.hiddenDates,t.range.start,t.range.end),o=(t.range.end-t.range.start-r)*e/i,s=tP(t.body.hiddenDates,t.range,o);return new Date(s+o+t.range.start)}function ZE(t,e,i){for(var n=0,r=0;r=e&&s=e&&s<=i&&(n+=s-o)}return n}function JE(t,e,i,n){return n=t(n).toDate().valueOf(),n-=QE(t,e,i,n)}function QE(t,e,i,n){var r=0;n=t(n).toDate().valueOf();for(var o=0;o=i.start&&a=a&&(r+=a-s)}return r}function tP(t,e,i){for(var n=0,r=0,o=e.start,s=0;s=e.start&&l=i)break;n+=l-a}}return n}function eP(t,e,i,n){var r=iP(e,t);return 1==r.hidden?i<0?1==n?r.startDate-(r.endDate-e)-1:r.startDate-1:1==n?r.endDate+(e-r.startDate)+1:r.endDate+1:e}function iP(t,e){for(var i=0;i=n&&t1e3&&(i=1e3),t.body.dom.rollingModeBtn.style.visibility="hidden",t.currentTimeTimer=Rv(e,i)}()}},{key:"stopRolling",value:function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),this.rolling=!1,this.body.dom.rollingModeBtn.style.visibility="visible")}},{key:"setRange",value:function(t,e,i,n,r){i||(i={}),!0!==i.byUser&&(i.byUser=!1);var o=this,s=null!=t?wE.convert(t,"Date").valueOf():null,a=null!=e?wE.convert(e,"Date").valueOf():null;if(this._cancelAnimation(),this.millisecondsPerPixelCache=void 0,i.animation){var l,h=this.start,u=this.end,d="object"===Nd(i.animation)&&"duration"in i.animation?i.animation.duration:500,c="object"===Nd(i.animation)&&"easingFunction"in i.animation?i.animation.easingFunction:"easeInOutQuad",p=wE.easingFunctions[c];if(!p)throw new Error(Yc(l="Unknown easing function ".concat(vv(c),". Choose from: ")).call(l,rp(wE.easingFunctions).join(", ")));var f=lp(),m=!1;return function t(){if(!o.props.touch.dragging){var e=lp()-f,l=p(e/d),c=e>d,g=c||null===s?s:h+(s-h)*l,y=c||null===a?a:u+(a-u)*l;v=o._applyRange(g,y),VE(o.options.moment,o.body,o.options.hiddenDates),m=m||v;var b={start:new Date(o.start),end:new Date(o.end),byUser:i.byUser,event:i.event};if(r&&r(l,v,c),v&&o.body.emitter.emit("rangechange",b),c){if(m&&(o.body.emitter.emit("rangechanged",b),n))return n()}else o.animationTimer=Rv(t,20)}}()}var v=this._applyRange(s,a);if(VE(this.options.moment,this.body,this.options.hiddenDates),v){var g={start:new Date(this.start),end:new Date(this.end),byUser:i.byUser,event:i.event};if(this.body.emitter.emit("rangechange",g),clearTimeout(o.timeoutID),o.timeoutID=Rv((function(){o.body.emitter.emit("rangechanged",g)}),200),n)return n()}}},{key:"getMillisecondsPerPixel",value:function(){return void 0===this.millisecondsPerPixelCache&&(this.millisecondsPerPixelCache=(this.end-this.start)/this.body.dom.center.clientWidth),this.millisecondsPerPixelCache}},{key:"_cancelAnimation",value:function(){this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=null)}},{key:"_applyRange",value:function(t,e){var i,n=null!=t?wE.convert(t,"Date").valueOf():this.start,r=null!=e?wE.convert(e,"Date").valueOf():this.end,o=null!=this.options.max?wE.convert(this.options.max,"Date").valueOf():null,s=null!=this.options.min?wE.convert(this.options.min,"Date").valueOf():null;if(isNaN(n)||null===n)throw new Error('Invalid start "'.concat(t,'"'));if(isNaN(r)||null===r)throw new Error('Invalid end "'.concat(e,'"'));if(ro&&(r=o)),null!==o&&r>o&&(n-=i=r-o,r-=i,null!=s&&n=this.start-.5&&r<=this.end?(n=this.start,r=this.end):(n-=(i=a-(r-n))/2,r+=i/2)}}if(null!==this.options.zoomMax){var l=AE(this.options.zoomMax);l<0&&(l=0),r-n>l&&(this.end-this.start===l&&nthis.end?(n=this.start,r=this.end):(n+=(i=r-n-l)/2,r-=i/2))}var h=this.start!=n||this.end!=r;return n>=this.start&&n<=this.end||r>=this.start&&r<=this.end||this.start>=n&&this.start<=r||this.end>=n&&this.end<=r||this.body.emitter.emit("checkRangedItems"),this.start=n,this.end=r,h}},{key:"getRange",value:function(){return{start:this.start,end:this.end}}},{key:"conversion",value:function(t,e){return i.conversion(this.start,this.end,t,e)}},{key:"_onDragStart",value:function(t){this.deltaDifference=0,this.previousDelta=0,this.options.moveable&&this._isInsideRange(t)&&this.props.touch.allowDragging&&(this.stopRolling(),this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.dragging=!0,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))}},{key:"_onDrag",value:function(t){if(t&&this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging){var e=this.options.direction;sP(e);var i="horizontal"==e?t.deltaX:t.deltaY;i-=this.deltaDifference;var n=this.props.touch.end-this.props.touch.start;n-=ZE(this.body.hiddenDates,this.start,this.end);var r,o="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height;r=this.options.rtl?i/o*n:-i/o*n;var s=this.props.touch.start+r,a=this.props.touch.end+r,l=eP(this.body.hiddenDates,s,this.previousDelta-i,!0),h=eP(this.body.hiddenDates,a,this.previousDelta-i,!0);if(l!=s||h!=a)return this.deltaDifference+=i,this.props.touch.start=l,this.props.touch.end=h,void this._onDrag(t);this.previousDelta=i,this._applyRange(s,a);var u=new Date(this.start),d=new Date(this.end);this.body.emitter.emit("rangechange",{start:u,end:d,byUser:!0,event:t}),this.body.emitter.emit("panmove")}}},{key:"_onDragEnd",value:function(t){this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.dragging=!1,this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end),byUser:!0,event:t}))}},{key:"_onMouseWheel",value:function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail?e=-t.detail/3:t.deltaY&&(e=-t.deltaY/3),!(this.options.zoomKey&&!t[this.options.zoomKey]&&this.options.zoomable||!this.options.zoomable&&this.options.moveable)&&this.options.zoomable&&this.options.moveable&&this._isInsideRange(t)&&e){var i,n,r=this.options.zoomFriction||5;if(i=e<0?1-e/r:1/(1+e/r),this.rolling){var o=this.options.rollingMode&&this.options.rollingMode.offset||.5;n=this.start+(this.end-this.start)*o}else{var s=this.getPointer({x:t.clientX,y:t.clientY},this.body.dom.center);n=this._pointerToDate(s)}this.zoom(i,n,e,t),t.preventDefault()}}},{key:"_onTouch",value:function(t){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null,this.props.touch.centerDate=null,this.scaleOffset=0,this.deltaDifference=0,wE.preventDefault(t)}},{key:"_onPinch",value:function(t){if(this.options.zoomable&&this.options.moveable){wE.preventDefault(t),this.props.touch.allowDragging=!1,this.props.touch.center||(this.props.touch.center=this.getPointer(t.center,this.body.dom.center),this.props.touch.centerDate=this._pointerToDate(this.props.touch.center)),this.stopRolling();var e=1/(t.scale+this.scaleOffset),i=this.props.touch.centerDate,n=ZE(this.body.hiddenDates,this.start,this.end),r=QE(this.options.moment,this.body.hiddenDates,this,i),o=n-r,s=i-r+(this.props.touch.start-(i-r))*e,a=i+o+(this.props.touch.end-(i+o))*e;this.startToFront=1-e<=0,this.endToFront=e-1<=0;var l=eP(this.body.hiddenDates,s,1-e,!0),h=eP(this.body.hiddenDates,a,e-1,!0);l==s&&h==a||(this.props.touch.start=l,this.props.touch.end=h,this.scaleOffset=1-t.scale,s=l,a=h);var u={animation:!1,byUser:!0,event:t};this.setRange(s,a,u),this.startToFront=!1,this.endToFront=!0}}},{key:"_isInsideRange",value:function(t){var e=t.center?t.center.x:t.clientX,i=this.body.dom.centerContainer.getBoundingClientRect(),n=this.options.rtl?e-i.left:i.right-e,r=this.body.util.toTime(n);return r>=this.start&&r<=this.end}},{key:"_pointerToDate",value:function(t){var e,i=this.options.direction;if(sP(i),"horizontal"==i)return this.body.util.toTime(t.x).valueOf();var n=this.body.domProps.center.height;return e=this.conversion(n),t.y/e.scale+e.offset}},{key:"getPointer",value:function(t,e){var i=e.getBoundingClientRect();return this.options.rtl?{x:i.right-t.x,y:t.y-i.top}:{x:t.x-i.left,y:t.y-i.top}}},{key:"zoom",value:function(t,e,i,n){null==e&&(e=(this.start+this.end)/2);var r=ZE(this.body.hiddenDates,this.start,this.end),o=QE(this.options.moment,this.body.hiddenDates,this,e),s=r-o,a=e-o+(this.start-(e-o))*t,l=e+s+(this.end-(e+s))*t;this.startToFront=!(i>0),this.endToFront=!(-i>0);var h=eP(this.body.hiddenDates,a,i,!0),u=eP(this.body.hiddenDates,l,-i,!0);h==a&&u==l||(a=h,l=u);var d={animation:!1,byUser:!0,event:n};this.setRange(a,l,d),this.startToFront=!1,this.endToFront=!0}},{key:"move",value:function(t){var e=this.end-this.start,i=this.start+e*t,n=this.end+e*t;this.start=i,this.end=n}},{key:"moveTo",value:function(t){var e=(this.start+this.end)/2-t,i=this.start-e,n=this.end-e;this.setRange(i,n,{animation:!1,byUser:!0,event:null})}},{key:"destroy",value:function(){this.stopRolling()}}],[{key:"conversion",value:function(t,e,i,n){return void 0===n&&(n=0),0!=i&&e-t!=0?{offset:t,scale:i/(e-t-n)}:{offset:0,scale:1}}}]),i}(IE);function sP(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError('Unknown direction "'.concat(t,'". Choose "horizontal" or "vertical".'))}var aP,lP=n(ce.setInterval),hP=null;"undefined"!=typeof window?aP=function t(e,i){var n=i||{preventDefault:!1};if(e.Manager){var r=e,o=function(e,i){var o=Object.create(n);return i&&r.assign(o,i),t(new r(e,o),o)};return r.assign(o,r),o.Manager=function(e,i){var o=Object.create(n);return i&&r.assign(o,i),t(new r.Manager(e,o),o)},o}var s=Object.create(e),a=e.element;function l(t){return t.match(/[^ ]+/g)}function h(t){if("hammer.input"!==t.type){if(t.srcEvent._handled||(t.srcEvent._handled={}),t.srcEvent._handled[t.type])return;t.srcEvent._handled[t.type]=!0}var e=!1;t.stopPropagation=function(){e=!0};var i=t.srcEvent.stopPropagation.bind(t.srcEvent);"function"==typeof i&&(t.srcEvent.stopPropagation=function(){i(),t.stopPropagation()}),t.firstTarget=hP;for(var n=hP;n&&!e;){var r=n.hammer;if(r)for(var o,s=0;s0?s._handlers[t]=n:(e.off(t,h),delete s._handlers[t]))})),s},s.emit=function(t,i){hP=i.target,e.emit(t,i)},s.destroy=function(){var t=e.element.hammer,i=t.indexOf(s);-1!==i&&t.splice(i,1),t.length||delete e.element.hammer,s._handlers={},e.destroy()},s}(window.Hammer||Wy,{preventDefault:"mouse"}):aP=function(){return function(){var t=function(){};return{on:t,off:t,destroy:t,emit:t,get:function(e){return{set:t}}}}()};var uP=aP;function dP(t,e){e.inputHandler=function(t){t.isFirst&&e(t)},t.on("hammer.input",e.inputHandler)}var cP=function(){function t(e,i,n,r,o){Ma(this,t),this.moment=o&&o.moment||sO,this.options=o||{},this.current=this.moment(),this._start=this.moment(),this._end=this.moment(),this.autoScale=!0,this.scale="day",this.step=1,this.setRange(e,i,n),this.switchedDay=!1,this.switchedMonth=!1,this.switchedYear=!1,qc(r)?this.hiddenDates=r:this.hiddenDates=null!=r?[r]:[],this.format=t.FORMAT}return Yd(t,[{key:"setMoment",value:function(t){this.moment=t,this.current=this.moment(this.current.valueOf()),this._start=this.moment(this._start.valueOf()),this._end=this.moment(this._end.valueOf())}},{key:"setFormat",value:function(e){var i=wE.deepExtend({},t.FORMAT);this.format=wE.deepExtend(i,e)}},{key:"setRange",value:function(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=null!=t?this.moment(t.valueOf()):lp(),this._end=null!=e?this.moment(e.valueOf()):lp(),this.autoScale&&this.setMinimumStep(i)}},{key:"start",value:function(){this.current=this._start.clone(),this.roundToMinor()}},{key:"roundToMinor",value:function(){switch("week"==this.scale&&this.current.weekday(0),this.scale){case"year":this.current.year(this.step*Math.floor(this.current.year()/this.step)),this.current.month(0);case"month":this.current.date(1);case"week":case"day":case"weekday":this.current.hours(0);case"hour":this.current.minutes(0);case"minute":this.current.seconds(0);case"second":this.current.milliseconds(0)}if(1!=this.step){var t=this.current.clone();switch(this.scale){case"millisecond":this.current.subtract(this.current.milliseconds()%this.step,"milliseconds");break;case"second":this.current.subtract(this.current.seconds()%this.step,"seconds");break;case"minute":this.current.subtract(this.current.minutes()%this.step,"minutes");break;case"hour":this.current.subtract(this.current.hours()%this.step,"hours");break;case"weekday":case"day":this.current.subtract((this.current.date()-1)%this.step,"day");break;case"week":this.current.subtract(this.current.week()%this.step,"week");break;case"month":this.current.subtract(this.current.month()%this.step,"month");break;case"year":this.current.subtract(this.current.year()%this.step,"year")}t.isSame(this.current)||(this.current=this.moment(eP(this.hiddenDates,this.current.valueOf(),-1,!0)))}}},{key:"hasNext",value:function(){return this.current.valueOf()<=this._end.valueOf()}},{key:"next",value:function(){var t=this.current.valueOf();switch(this.scale){case"millisecond":this.current.add(this.step,"millisecond");break;case"second":this.current.add(this.step,"second");break;case"minute":this.current.add(this.step,"minute");break;case"hour":this.current.add(this.step,"hour"),this.current.month()<6?this.current.subtract(this.current.hours()%this.step,"hour"):this.current.hours()%this.step!=0&&this.current.add(this.step-this.current.hours()%this.step,"hour");break;case"weekday":case"day":this.current.add(this.step,"day");break;case"week":if(0!==this.current.weekday())this.current.weekday(0),this.current.add(this.step,"week");else if(!1===this.options.showMajorLabels)this.current.add(this.step,"week");else{var e=this.current.clone();e.add(1,"week"),e.isSame(this.current,"month")?this.current.add(this.step,"week"):(this.current.add(this.step,"week"),this.current.date(1))}break;case"month":this.current.add(this.step,"month");break;case"year":this.current.add(this.step,"year")}if(1!=this.step)switch(this.scale){case"millisecond":this.current.milliseconds()>0&&this.current.milliseconds()0&&this.current.seconds()0&&this.current.minutes()0&&this.current.hours()0?t.step:1,this.autoScale=!1)}},{key:"setAutoScale",value:function(t){this.autoScale=t}},{key:"setMinimumStep",value:function(t){if(null!=t){var e=31104e6,i=2592e6,n=864e5,r=36e5,o=6e4,s=1e3;1e3*e>t&&(this.scale="year",this.step=1e3),500*e>t&&(this.scale="year",this.step=500),100*e>t&&(this.scale="year",this.step=100),50*e>t&&(this.scale="year",this.step=50),10*e>t&&(this.scale="year",this.step=10),5*e>t&&(this.scale="year",this.step=5),e>t&&(this.scale="year",this.step=1),7776e6>t&&(this.scale="month",this.step=3),i>t&&(this.scale="month",this.step=1),6048e5>t&&this.options.showWeekScale&&(this.scale="week",this.step=1),1728e5>t&&(this.scale="day",this.step=2),n>t&&(this.scale="day",this.step=1),432e5>t&&(this.scale="weekday",this.step=1),144e5>t&&(this.scale="hour",this.step=4),r>t&&(this.scale="hour",this.step=1),9e5>t&&(this.scale="minute",this.step=15),6e5>t&&(this.scale="minute",this.step=10),3e5>t&&(this.scale="minute",this.step=5),o>t&&(this.scale="minute",this.step=1),15e3>t&&(this.scale="second",this.step=15),1e4>t&&(this.scale="second",this.step=10),5e3>t&&(this.scale="second",this.step=5),s>t&&(this.scale="second",this.step=1),200>t&&(this.scale="millisecond",this.step=200),100>t&&(this.scale="millisecond",this.step=100),50>t&&(this.scale="millisecond",this.step=50),10>t&&(this.scale="millisecond",this.step=10),5>t&&(this.scale="millisecond",this.step=5),1>t&&(this.scale="millisecond",this.step=1)}}},{key:"isMajor",value:function(){if(1==this.switchedYear)switch(this.scale){case"year":case"month":case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedMonth)switch(this.scale){case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedDay)switch(this.scale){case"millisecond":case"second":case"minute":case"hour":return!0;default:return!1}var t=this.moment(this.current);switch(this.scale){case"millisecond":return 0==t.milliseconds();case"second":return 0==t.seconds();case"minute":return 0==t.hours()&&0==t.minutes();case"hour":return 0==t.hours();case"weekday":case"day":return this.options.showWeekScale?1==t.isoWeekday():1==t.date();case"week":return 1==t.date();case"month":return 0==t.month();default:return!1}}},{key:"getLabelMinor",value:function(t){if(null==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.minorLabels)return this.format.minorLabels(t,this.scale,this.step);var e=this.format.minorLabels[this.scale];return"week"===this.scale&&1===t.date()&&0!==t.weekday()?"":e&&e.length>0?this.moment(t).format(e):""}},{key:"getLabelMajor",value:function(t){if(null==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.majorLabels)return this.format.majorLabels(t,this.scale,this.step);var e=this.format.majorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""}},{key:"getClassName",value:function(){var t,e=this.moment,i=this.moment(this.current),n=i.locale?i.locale("en"):i.lang("en"),r=this.step,o=[];function s(t){return t/r%2==0?" vis-even":" vis-odd"}function a(t){return t.isSame(lp(),"day")?" vis-today":t.isSame(e().add(1,"day"),"day")?" vis-tomorrow":t.isSame(e().add(-1,"day"),"day")?" vis-yesterday":""}function l(t){return t.isSame(lp(),"week")?" vis-current-week":""}function h(t){return t.isSame(lp(),"month")?" vis-current-month":""}switch(this.scale){case"millisecond":o.push(a(n)),o.push(s(n.milliseconds()));break;case"second":o.push(a(n)),o.push(s(n.seconds()));break;case"minute":o.push(a(n)),o.push(s(n.minutes()));break;case"hour":o.push(Yc(t="vis-h".concat(n.hours())).call(t,4==this.step?"-h"+(n.hours()+4):"")),o.push(a(n)),o.push(s(n.hours()));break;case"weekday":o.push("vis-".concat(n.format("dddd").toLowerCase())),o.push(a(n)),o.push(l(n)),o.push(s(n.date()));break;case"day":o.push("vis-day".concat(n.date())),o.push("vis-".concat(n.format("MMMM").toLowerCase())),o.push(a(n)),o.push(h(n)),o.push(this.step<=2?a(n):""),o.push(this.step<=2?"vis-".concat(n.format("dddd").toLowerCase()):""),o.push(s(n.date()-1));break;case"week":o.push("vis-week".concat(n.format("w"))),o.push(l(n)),o.push(s(n.week()));break;case"month":o.push("vis-".concat(n.format("MMMM").toLowerCase())),o.push(h(n)),o.push(s(n.month()));break;case"year":o.push("vis-year".concat(n.year())),o.push(function(t){return t.isSame(lp(),"year")?" vis-current-year":""}(n)),o.push(s(n.year()))}return mm(o).call(o,String).join(" ")}}],[{key:"snap",value:function(t,e,i){var n=sO(t);if("year"==e){var r=n.year()+Math.round(n.month()/12);n.year(Math.round(r/i)*i),n.month(0),n.date(0),n.hours(0),n.minutes(0),n.seconds(0),n.milliseconds(0)}else if("month"==e)n.date()>15?(n.date(1),n.add(1,"month")):n.date(1),n.hours(0),n.minutes(0),n.seconds(0),n.milliseconds(0);else if("week"==e)n.weekday()>2?(n.weekday(0),n.add(1,"week")):n.weekday(0),n.hours(0),n.minutes(0),n.seconds(0),n.milliseconds(0);else if("day"==e){switch(i){case 5:case 2:n.hours(24*Math.round(n.hours()/24));break;default:n.hours(12*Math.round(n.hours()/12))}n.minutes(0),n.seconds(0),n.milliseconds(0)}else if("weekday"==e){switch(i){case 5:case 2:n.hours(12*Math.round(n.hours()/12));break;default:n.hours(6*Math.round(n.hours()/6))}n.minutes(0),n.seconds(0),n.milliseconds(0)}else if("hour"==e){if(4===i)n.minutes(60*Math.round(n.minutes()/60));else n.minutes(30*Math.round(n.minutes()/30));n.seconds(0),n.milliseconds(0)}else if("minute"==e){switch(i){case 15:case 10:n.minutes(5*Math.round(n.minutes()/5)),n.seconds(0);break;case 5:n.seconds(60*Math.round(n.seconds()/60));break;default:n.seconds(30*Math.round(n.seconds()/30))}n.milliseconds(0)}else if("second"==e)switch(i){case 15:case 10:n.seconds(5*Math.round(n.seconds()/5)),n.milliseconds(0);break;case 5:n.milliseconds(1e3*Math.round(n.milliseconds()/1e3));break;default:n.milliseconds(500*Math.round(n.milliseconds()/500))}else if("millisecond"==e){var o=i>5?i/2:1;n.milliseconds(Math.round(n.milliseconds()/o)*o)}return n}}]),t}();function pP(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}cP.FORMAT={minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",week:"w",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",week:"MMMM YYYY",month:"YYYY",year:""}};function fP(t){var e=function(){if("undefined"==typeof Reflect||!vM)return!1;if(vM.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(vM(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=d_(t);if(e){var r=d_(this).constructor;i=vM(n,arguments,r)}else i=n.apply(this,arguments);return l_(this,i)}}pP(".vis-time-axis{overflow:hidden;position:relative}.vis-time-axis.vis-foreground{left:0;top:0;width:100%}.vis-time-axis.vis-background{height:100%;left:0;position:absolute;top:0;width:100%}.vis-time-axis .vis-text{box-sizing:border-box;color:#4d4d4d;overflow:hidden;padding:3px;position:absolute;white-space:nowrap}.vis-time-axis .vis-text.vis-measure{margin-left:0;margin-right:0;padding-left:0;padding-right:0;position:absolute;visibility:hidden}.vis-time-axis .vis-grid.vis-vertical{border-left:1px solid;position:absolute}.vis-time-axis .vis-grid.vis-vertical-rtl{border-right:1px solid;position:absolute}.vis-time-axis .vis-grid.vis-minor{border-color:#e5e5e5}.vis-time-axis .vis-grid.vis-major{border-color:#bfbfbf}");var mP=function(t){a_(i,t);var e=fP(i);function i(t,n){var r;return Ma(this,i),(r=e.call(this)).dom={foreground:null,lines:[],majorTexts:[],minorTexts:[],redundant:{lines:[],majorTexts:[],minorTexts:[]}},r.props={range:{start:0,end:0,minimumStep:0},lineTop:0},r.defaultOptions={orientation:{axis:"bottom"},showMinorLabels:!0,showMajorLabels:!0,showWeekScale:!1,maxMinorChars:7,format:wE.extend({},cP.FORMAT),moment:sO,timeAxis:null},r.options=wE.extend({},r.defaultOptions),r.body=t,r._create(),r.setOptions(n),r}return Yd(i,[{key:"setOptions",value:function(t){t&&(wE.selectiveExtend(["showMinorLabels","showMajorLabels","showWeekScale","maxMinorChars","hiddenDates","timeAxis","moment","rtl"],this.options,t),wE.selectiveDeepExtend(["format"],this.options,t),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.axis=t.orientation:"object"===Nd(t.orientation)&&"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis)),"locale"in t&&("function"==typeof sO.locale?sO.locale(t.locale):sO.lang(t.locale)))}},{key:"_create",value:function(){this.dom.foreground=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.foreground.className="vis-time-axis vis-foreground",this.dom.background.className="vis-time-axis vis-background"}},{key:"destroy",value:function(){this.dom.foreground.parentNode&&this.dom.foreground.parentNode.removeChild(this.dom.foreground),this.dom.background.parentNode&&this.dom.background.parentNode.removeChild(this.dom.background),this.body=null}},{key:"redraw",value:function(){var t=this.props,e=this.dom.foreground,i=this.dom.background,n="top"==this.options.orientation.axis?this.body.dom.top:this.body.dom.bottom,r=e.parentNode!==n;this._calculateCharSize();var o=this.options.showMinorLabels&&"none"!==this.options.orientation.axis,s=this.options.showMajorLabels&&"none"!==this.options.orientation.axis;t.minorLabelHeight=o?t.minorCharHeight:0,t.majorLabelHeight=s?t.majorCharHeight:0,t.height=t.minorLabelHeight+t.majorLabelHeight,t.width=e.offsetWidth,t.minorLineHeight=this.body.domProps.root.height-t.majorLabelHeight-("top"==this.options.orientation.axis?this.body.domProps.bottom.height:this.body.domProps.top.height),t.minorLineWidth=1,t.majorLineHeight=t.minorLineHeight+t.majorLabelHeight,t.majorLineWidth=1;var a=e.nextSibling,l=i.nextSibling;return e.parentNode&&e.parentNode.removeChild(e),i.parentNode&&i.parentNode.removeChild(i),e.style.height="".concat(this.props.height,"px"),this._repaintLabels(),a?n.insertBefore(e,a):n.appendChild(e),l?this.body.dom.backgroundVertical.insertBefore(i,l):this.body.dom.backgroundVertical.appendChild(i),this._isResized()||r}},{key:"_repaintLabels",value:function(){var t=this.options.orientation.axis,e=wE.convert(this.body.range.start,"Number"),i=wE.convert(this.body.range.end,"Number"),n=this.body.util.toTime((this.props.minorCharWidth||10)*this.options.maxMinorChars).valueOf(),r=n-QE(this.options.moment,this.body.hiddenDates,this.body.range,n);r-=this.body.util.toTime(0).valueOf();var o=new cP(new Date(e),new Date(i),r,this.body.hiddenDates,this.options);o.setMoment(this.options.moment),this.options.format&&o.setFormat(this.options.format),this.options.timeAxis&&o.setScale(this.options.timeAxis),this.step=o;var s,a,l,h,u,d,c=this.dom;c.redundant.lines=c.lines,c.redundant.majorTexts=c.majorTexts,c.redundant.minorTexts=c.minorTexts,c.lines=[],c.majorTexts=[],c.minorTexts=[];var p,f,m,v=0,g=void 0,y=0,b=1e3;for(o.start(),a=o.getCurrent(),h=this.body.util.toScreen(a);o.hasNext()&&y=.4*p;if(this.options.showMinorLabels&&d){var _=this._repaintMinorText(l,o.getLabelMinor(s),t,m);_.style.width="".concat(v,"px")}u&&this.options.showMajorLabels?(l>0&&(null==g&&(g=l),_=this._repaintMajorText(l,o.getLabelMajor(s),t,m)),f=this._repaintMajorLine(l,v,t,m)):d?f=this._repaintMinorLine(l,v,t,m):f&&(f.style.width="".concat(Zm(f.style.width)+v,"px"))}if(y!==b||vP||(console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to ".concat(b," lines.")),vP=!0),this.options.showMajorLabels){var w=this.body.util.toTime(0),k=o.getLabelMajor(w),x=k.length*(this.props.majorCharWidth||10)+10;(null==g||x.vis-custom-time-marker{background-color:inherit;color:#fff;cursor:auto;font-size:12px;padding:3px 5px;top:0;white-space:nowrap;z-index:inherit}");var NP=function(t){a_(i,t);var e=LP(i);function i(t,n){var r,o;Ma(this,i),(o=e.call(this)).body=t,o.defaultOptions={moment:sO,locales:IP,locale:"en",id:void 0,title:void 0},o.options=wE.extend({},o.defaultOptions),o.setOptions(n),o.options.locales=wE.extend({},IP,o.options.locales);var s=o.defaultOptions.locales[o.defaultOptions.locale];return Hp(r=rp(o.options.locales)).call(r,(function(t){o.options.locales[t]=wE.extend({},s,o.options.locales[t])})),n&&null!=n.time?o.customTime=n.time:o.customTime=new Date,o.eventParams={},o._create(),o}return Yd(i,[{key:"setOptions",value:function(t){t&&wE.selectiveExtend(["moment","locale","locales","id","title","rtl","snap"],this.options,t)}},{key:"_create",value:function(){var t,e,i,n=document.createElement("div");n["custom-time"]=this,n.className="vis-custom-time ".concat(this.options.id||""),n.style.position="absolute",n.style.top="0px",n.style.height="100%",this.bar=n;var r=document.createElement("div");function o(t){this.body.range._onMouseWheel(t)}r.style.position="relative",r.style.top="0px",this.options.rtl?r.style.right="-10px":r.style.left="-10px",r.style.height="100%",r.style.width="20px",r.addEventListener?(r.addEventListener("mousewheel",Tp(o).call(o,this),!1),r.addEventListener("DOMMouseScroll",Tp(o).call(o,this),!1)):r.attachEvent("onmousewheel",Tp(o).call(o,this)),n.appendChild(r),this.hammer=new uP(r),this.hammer.on("panstart",Tp(t=this._onDragStart).call(t,this)),this.hammer.on("panmove",Tp(e=this._onDrag).call(e,this)),this.hammer.on("panend",Tp(i=this._onDragEnd).call(i,this)),this.hammer.get("pan").set({threshold:5,direction:uP.DIRECTION_ALL}),this.hammer.get("press").set({time:1e4})}},{key:"destroy",value:function(){this.hide(),this.hammer.destroy(),this.hammer=null,this.body=null}},{key:"redraw",value:function(){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar));var e=this.body.util.toScreen(this.customTime),i=this.options.locales[this.options.locale];i||(this.warned||(console.warn("WARNING: options.locales['".concat(this.options.locale,"'] not found. See https://visjs.github.io/vis-timeline/docs/timeline/#Localization")),this.warned=!0),i=this.options.locales.en);var n,r=this.options.title;void 0===r?r=(r=Yc(n="".concat(i.time,": ")).call(n,this.options.moment(this.customTime).format("dddd, MMMM Do YYYY, H:mm:ss"))).charAt(0).toUpperCase()+r.substring(1):"function"==typeof r&&(r=r.call(this,this.customTime));return this.options.rtl?this.bar.style.right="".concat(e,"px"):this.bar.style.left="".concat(e,"px"),this.bar.title=r,!1}},{key:"hide",value:function(){this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar)}},{key:"setCustomTime",value:function(t){this.customTime=wE.convert(t,"Date"),this.redraw()}},{key:"getCustomTime",value:function(){return new Date(this.customTime.valueOf())}},{key:"setCustomMarker",value:function(t,e){var i,n;(this.marker&&this.bar.removeChild(this.marker),this.marker=document.createElement("div"),this.marker.className="vis-custom-time-marker",this.marker.innerHTML=wE.xss(t),this.marker.style.position="absolute",e)&&(this.marker.setAttribute("contenteditable","true"),this.marker.addEventListener("pointerdown",(function(){this.marker.focus()})),this.marker.addEventListener("input",Tp(i=this._onMarkerChange).call(i,this)),this.marker.title=t,this.marker.addEventListener("blur",Tp(n=function(t){this.title!=t.target.innerHTML&&(this._onMarkerChanged(t),this.title=t.target.innerHTML)}).call(n,this)));this.bar.appendChild(this.marker)}},{key:"setCustomTitle",value:function(t){this.options.title=t}},{key:"_onDragStart",value:function(t){this.eventParams.dragging=!0,this.eventParams.customTime=this.customTime,t.stopPropagation()}},{key:"_onDrag",value:function(t){if(this.eventParams.dragging){var e=this.options.rtl?-1*t.deltaX:t.deltaX,i=this.body.util.toScreen(this.eventParams.customTime)+e,n=this.body.util.toTime(i),r=this.body.util.getScale(),o=this.body.util.getStep(),s=this.options.snap,a=s?s(n,r,o):n;this.setCustomTime(a),this.body.emitter.emit("timechange",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:t}),t.stopPropagation()}}},{key:"_onDragEnd",value:function(t){this.eventParams.dragging&&(this.body.emitter.emit("timechanged",{id:this.options.id,time:new Date(this.customTime.valueOf()),event:t}),t.stopPropagation())}},{key:"_onMarkerChange",value:function(t){this.body.emitter.emit("markerchange",{id:this.options.id,title:t.target.innerHTML,event:t}),t.stopPropagation()}},{key:"_onMarkerChanged",value:function(t){this.body.emitter.emit("markerchanged",{id:this.options.id,title:t.target.innerHTML,event:t}),t.stopPropagation()}}],[{key:"customTimeFromTarget",value:function(t){for(var e=t.target;e;){if(e.hasOwnProperty("custom-time"))return e["custom-time"];e=e.parentNode}return null}}]),i}(IE);pP("");pP('.vis-current-time{background-color:#ff7f6e;pointer-events:none;width:2px;z-index:1}.vis-rolling-mode-btn{background:#3876c2;border-radius:50%;color:#fff;cursor:pointer;font-size:28px;font-weight:700;height:40px;opacity:.8;position:absolute;right:20px;text-align:center;top:7px;width:40px}.vis-rolling-mode-btn:before{content:"\\26F6"}.vis-rolling-mode-btn:hover{opacity:1}');pP(".vis-panel{box-sizing:border-box;margin:0;padding:0;position:absolute}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right,.vis-panel.vis-top{border:1px #bfbfbf}.vis-panel.vis-center,.vis-panel.vis-left,.vis-panel.vis-right{border-bottom-style:solid;border-top-style:solid;overflow:hidden}.vis-left.vis-panel.vis-vertical-scroll,.vis-right.vis-panel.vis-vertical-scroll{height:100%;overflow-x:hidden;overflow-y:scroll}.vis-left.vis-panel.vis-vertical-scroll{direction:rtl}.vis-left.vis-panel.vis-vertical-scroll .vis-content,.vis-right.vis-panel.vis-vertical-scroll{direction:ltr}.vis-right.vis-panel.vis-vertical-scroll .vis-content{direction:rtl}.vis-panel.vis-bottom,.vis-panel.vis-center,.vis-panel.vis-top{border-left-style:solid;border-right-style:solid}.vis-background{overflow:hidden}.vis-panel>.vis-content{position:relative}.vis-panel .vis-shadow{box-shadow:0 0 10px rgba(0,0,0,.8);height:1px;position:absolute;width:100%}.vis-panel .vis-shadow.vis-top{left:0;top:-1px}.vis-panel .vis-shadow.vis-bottom{bottom:-1px;left:0}");pP(".vis-graph-group0{fill:#4f81bd;fill-opacity:0;stroke-width:2px;stroke:#4f81bd}.vis-graph-group1{fill:#f79646;fill-opacity:0;stroke-width:2px;stroke:#f79646}.vis-graph-group2{fill:#8c51cf;fill-opacity:0;stroke-width:2px;stroke:#8c51cf}.vis-graph-group3{fill:#75c841;fill-opacity:0;stroke-width:2px;stroke:#75c841}.vis-graph-group4{fill:#ff0100;fill-opacity:0;stroke-width:2px;stroke:#ff0100}.vis-graph-group5{fill:#37d8e6;fill-opacity:0;stroke-width:2px;stroke:#37d8e6}.vis-graph-group6{fill:#042662;fill-opacity:0;stroke-width:2px;stroke:#042662}.vis-graph-group7{fill:#00ff26;fill-opacity:0;stroke-width:2px;stroke:#00ff26}.vis-graph-group8{fill:#f0f;fill-opacity:0;stroke-width:2px;stroke:#f0f}.vis-graph-group9{fill:#8f3938;fill-opacity:0;stroke-width:2px;stroke:#8f3938}.vis-timeline .vis-fill{fill-opacity:.1;stroke:none}.vis-timeline .vis-bar{fill-opacity:.5;stroke-width:1px}.vis-timeline .vis-point{stroke-width:2px;fill-opacity:1}.vis-timeline .vis-legend-background{stroke-width:1px;fill-opacity:.9;fill:#fff;stroke:#c2c2c2}.vis-timeline .vis-outline{stroke-width:1px;fill-opacity:1;fill:#fff;stroke:#e5e5e5}.vis-timeline .vis-icon-fill{fill-opacity:.3;stroke:none}");pP(".vis-timeline{border:1px solid #bfbfbf;box-sizing:border-box;margin:0;overflow:hidden;padding:0;position:relative}.vis-loading-screen{height:100%;left:0;position:absolute;top:0;width:100%}");pP(".vis [class*=span]{min-height:0;width:auto}");var RP=function(){function t(){Ma(this,t)}return Yd(t,[{key:"_create",value:function(t){var e,i,n,r=this;this.dom={},this.dom.container=t,this.dom.container.style.position="relative",this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.rollingModeBtn=document.createElement("div"),this.dom.loadingScreen=document.createElement("div"),this.dom.root.className="vis-timeline",this.dom.background.className="vis-panel vis-background",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical",this.dom.backgroundHorizontal.className="vis-panel vis-background vis-horizontal",this.dom.centerContainer.className="vis-panel vis-center",this.dom.leftContainer.className="vis-panel vis-left",this.dom.rightContainer.className="vis-panel vis-right",this.dom.top.className="vis-panel vis-top",this.dom.bottom.className="vis-panel vis-bottom",this.dom.left.className="vis-content",this.dom.center.className="vis-content",this.dom.right.className="vis-content",this.dom.shadowTop.className="vis-shadow vis-top",this.dom.shadowBottom.className="vis-shadow vis-bottom",this.dom.shadowTopLeft.className="vis-shadow vis-top",this.dom.shadowBottomLeft.className="vis-shadow vis-bottom",this.dom.shadowTopRight.className="vis-shadow vis-top",this.dom.shadowBottomRight.className="vis-shadow vis-bottom",this.dom.rollingModeBtn.className="vis-rolling-mode-btn",this.dom.loadingScreen.className="vis-loading-screen",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.rollingModeBtn),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.on("rangechange",(function(){!0===r.initialDrawDone&&r._redraw()})),this.on("rangechanged",(function(){r.initialRangeChangeDone||(r.initialRangeChangeDone=!0)})),this.on("touch",Tp(e=this._onTouch).call(e,this)),this.on("panmove",Tp(i=this._onDrag).call(i,this));var o=this;this._origRedraw=Tp(n=this._redraw).call(n,this),this._redraw=wE.throttle(this._origRedraw),this.on("_change",(function(t){o.itemSet&&o.itemSet.initialItemSetDrawn&&t&&1==t.queue?o._redraw():o._origRedraw()})),this.hammer=new uP(this.dom.root);var s=this.hammer.get("pinch").set({enable:!0});s&&function(t){t.getTouchAction=function(){return["pan-y"]}}(s),this.hammer.get("pan").set({threshold:5,direction:uP.DIRECTION_ALL}),this.timelineListeners={};var a,l,h=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];function u(t){this.isActive()&&this.emit("mousewheel",t);var e=0,i=0;if("detail"in t&&(i=-1*t.detail),"wheelDelta"in t&&(i=t.wheelDelta),"wheelDeltaY"in t&&(i=t.wheelDeltaY),"wheelDeltaX"in t&&(e=-1*t.wheelDeltaX),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=-1*i,i=0),"deltaY"in t&&(i=-1*t.deltaY),"deltaX"in t&&(e=t.deltaX),t.deltaMode&&(1===t.deltaMode?(e*=40,i*=40):(e*=40,i*=800)),this.options.preferZoom){if(!this.options.zoomKey||t[this.options.zoomKey])return}else if(this.options.zoomKey&&t[this.options.zoomKey])return;if(this.options.verticalScroll||this.options.horizontalScroll)if(this.options.verticalScroll&&Math.abs(i)>=Math.abs(e)){var n=this.props.scrollTop,r=n+i;if(this.isActive())this._setScrollTop(r)!==n&&(this._redraw(),this.emit("scroll",t),t.preventDefault())}else if(this.options.horizontalScroll){var o=(Math.abs(e)>=Math.abs(i)?e:i)/120*(this.range.end-this.range.start)/20,s=this.range.start+o,a=this.range.end+o,l={animation:!1,byUser:!0,event:t};this.range.setRange(s,a,l),t.preventDefault()}}Hp(h).call(h,(function(t){var e=function(e){o.isActive()&&o.emit(t,e)};o.hammer.on(t,e),o.timelineListeners[t]=e})),dP(this.hammer,(function(t){o.emit("touch",t)})),a=this.hammer,(l=function(t){o.emit("release",t)}).inputHandler=function(t){t.isFinal&&l(t)},a.on("hammer.input",l.inputHandler);var d="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":this.dom.centerContainer.addEventListener?"DOMMouseScroll":"onmousewheel";function c(t){if(o.options.verticalScroll&&(t.preventDefault(),o.isActive())){var e=-t.target.scrollTop;o._setScrollTop(e),o._redraw(),o.emit("scrollSide",t)}}this.dom.top.addEventListener,this.dom.bottom.addEventListener,this.dom.centerContainer.addEventListener(d,Tp(u).call(u,this),!1),this.dom.top.addEventListener(d,Tp(u).call(u,this),!1),this.dom.bottom.addEventListener(d,Tp(u).call(u,this),!1),this.dom.left.parentNode.addEventListener("scroll",Tp(c).call(c,this)),this.dom.right.parentNode.addEventListener("scroll",Tp(c).call(c,this));var p=!1;function f(t){var e;if(t.preventDefault&&(o.emit("dragover",o.getEventProperties(t)),t.preventDefault()),av(e=t.target.className).call(e,"timeline")>-1&&!p)return t.dataTransfer.dropEffect="move",p=!0,!1}function m(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation();try{var e=JSON.parse(t.dataTransfer.getData("text"));if(!e||!e.content)return}catch(t){return!1}return p=!1,t.center={x:t.clientX,y:t.clientY},"item"!==e.target?o.itemSet._onAddItem(t):o.itemSet._onDropObjectOnItem(t),o.emit("drop",o.getEventProperties(t)),!1}if(this.dom.center.addEventListener("dragover",Tp(f).call(f,this),!1),this.dom.center.addEventListener("drop",Tp(m).call(m,this),!1),this.customTimes=[],this.touch={},this.redrawCount=0,this.initialDrawDone=!1,this.initialRangeChangeDone=!1,!t)throw new Error("No container provided");t.appendChild(this.dom.root),t.appendChild(this.dom.loadingScreen)}},{key:"setOptions",value:function(t){var e;if(t){if(wE.selectiveExtend(["width","height","minHeight","maxHeight","autoResize","start","end","clickToUse","dataAttributes","hiddenDates","locale","locales","moment","preferZoom","rtl","zoomKey","horizontalScroll","verticalScroll","longSelectPressTime","snap"],this.options,t),this.dom.rollingModeBtn.style.visibility="hidden",this.options.rtl&&(this.dom.container.style.direction="rtl",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical-rtl"),this.options.verticalScroll&&(this.options.rtl?this.dom.rightContainer.className="vis-panel vis-right vis-vertical-scroll":this.dom.leftContainer.className="vis-panel vis-left vis-vertical-scroll"),"object"!==Nd(this.options.orientation)&&(this.options.orientation={item:void 0,axis:void 0}),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation={item:t.orientation,axis:t.orientation}:"object"===Nd(t.orientation)&&("item"in t.orientation&&(this.options.orientation.item=t.orientation.item),"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis))),"both"===this.options.orientation.axis){if(!this.timeAxis2){var i=this.timeAxis2=new mP(this.body,this.options);i.setOptions=function(t){var e=t?wE.extend({},t):{};e.orientation="top",mP.prototype.setOptions.call(i,e)},this.components.push(i)}}else if(this.timeAxis2){var n,r,o=av(n=this.components).call(n,this.timeAxis2);if(-1!==o)_f(r=this.components).call(r,o,1);this.timeAxis2.destroy(),this.timeAxis2=null}"function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),"hiddenDates"in this.options&&WE(this.options.moment,this.body,this.options.hiddenDates),"clickToUse"in t&&(t.clickToUse?this.activator||(this.activator=new yP(this.dom.root)):this.activator&&(this.activator.destroy(),delete this.activator)),this._initAutoResize()}if(Hp(e=this.components).call(e,(function(e){return e.setOptions(t)})),"configure"in t){var s;this.configurator||(this.configurator=this._createConfigurator()),this.configurator.setOptions(t.configure);var a=wE.deepExtend({},this.options);Hp(s=this.components).call(s,(function(t){wE.deepExtend(a,t.options)})),this.configurator.setModuleOptions({global:a})}this._redraw()}},{key:"isActive",value:function(){return!this.activator||this.activator.active}},{key:"destroy",value:function(){var t;for(var e in this.setItems(null),this.setGroups(null),this.off(),this._stopAutoResize(),this.dom.root.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.dom=null,this.activator&&(this.activator.destroy(),delete this.activator),this.timelineListeners)this.timelineListeners.hasOwnProperty(e)&&delete this.timelineListeners[e];this.timelineListeners=null,this.hammer&&this.hammer.destroy(),this.hammer=null,Hp(t=this.components).call(t,(function(t){return t.destroy()})),this.body=null}},{key:"setCustomTime",value:function(t,e){var i,n=mm(i=this.customTimes).call(i,(function(t){return e===t.options.id}));if(0===n.length)throw new Error("No custom time bar found with id ".concat(vv(e)));n.length>0&&n[0].setCustomTime(t)}},{key:"getCustomTime",value:function(t){var e,i=mm(e=this.customTimes).call(e,(function(e){return e.options.id===t}));if(0===i.length)throw new Error("No custom time bar found with id ".concat(vv(t)));return i[0].getCustomTime()}},{key:"setCustomTimeMarker",value:function(t,e,i){var n,r=mm(n=this.customTimes).call(n,(function(t){return t.options.id===e}));if(0===r.length)throw new Error("No custom time bar found with id ".concat(vv(e)));r.length>0&&r[0].setCustomMarker(t,i)}},{key:"setCustomTimeTitle",value:function(t,e){var i,n=mm(i=this.customTimes).call(i,(function(t){return t.options.id===e}));if(0===n.length)throw new Error("No custom time bar found with id ".concat(vv(e)));if(n.length>0)return n[0].setCustomTitle(t)}},{key:"getEventProperties",value:function(t){return{event:t}}},{key:"addCustomTime",value:function(t,e){var i,n=void 0!==t?wE.convert(t,"Date"):new Date,r=TT(i=this.customTimes).call(i,(function(t){return t.options.id===e}));if(r)throw new Error("A custom time with id ".concat(vv(e)," already exists"));var o=new NP(this.body,wE.extend({},this.options,{time:n,id:e,snap:this.itemSet?this.itemSet.options.snap:this.options.snap}));return this.customTimes.push(o),this.components.push(o),this._redraw(),e}},{key:"removeCustomTime",value:function(t){var e,i=this,n=mm(e=this.customTimes).call(e,(function(e){return e.options.id===t}));if(0===n.length)throw new Error("No custom time bar found with id ".concat(vv(t)));Hp(n).call(n,(function(t){var e,n,r,o;_f(e=i.customTimes).call(e,av(n=i.customTimes).call(n,t),1),_f(r=i.components).call(r,av(o=i.components).call(o,t),1),t.destroy()}))}},{key:"getVisibleItems",value:function(){return this.itemSet&&this.itemSet.getVisibleItems()||[]}},{key:"getItemsAtCurrentTime",value:function(t){return this.time=t,this.itemSet&&this.itemSet.getItemsAtCurrentTime(this.time)||[]}},{key:"getVisibleGroups",value:function(){return this.itemSet&&this.itemSet.getVisibleGroups()||[]}},{key:"fit",value:function(t,e){var i=this.getDataRange();if(null!==i.min||null!==i.max){var n=i.max-i.min,r=new Date(i.min.valueOf()-.01*n),o=new Date(i.max.valueOf()+.01*n),s=!t||void 0===t.animation||t.animation;this.range.setRange(r,o,{animation:s},e)}}},{key:"getDataRange",value:function(){throw new Error("Cannot invoke abstract method getDataRange")}},{key:"setWindow",value:function(t,e,i,n){var r,o;"function"==typeof arguments[2]&&(n=arguments[2],i={}),1==arguments.length?(r=void 0===(o=arguments[0]).animation||o.animation,this.range.setRange(o.start,o.end,{animation:r})):2==arguments.length&&"function"==typeof arguments[1]?(n=arguments[1],r=void 0===(o=arguments[0]).animation||o.animation,this.range.setRange(o.start,o.end,{animation:r},n)):(r=!i||void 0===i.animation||i.animation,this.range.setRange(t,e,{animation:r},n))}},{key:"moveTo",value:function(t,e,i){"function"==typeof arguments[1]&&(i=arguments[1],e={});var n=this.range.end-this.range.start,r=wE.convert(t,"Date").valueOf(),o=r-n/2,s=r+n/2,a=!e||void 0===e.animation||e.animation;this.range.setRange(o,s,{animation:a},i)}},{key:"getWindow",value:function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}}},{key:"zoomIn",value:function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var n=this.getWindow(),r=n.start.valueOf(),o=n.end.valueOf(),s=o-r,a=(s-s/(1+t))/2,l=r+a,h=o-a;this.setWindow(l,h,e,i)}}},{key:"zoomOut",value:function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var n=this.getWindow(),r=n.start.valueOf(),o=n.end.valueOf(),s=o-r,a=r-s*t/2,l=o+s*t/2;this.setWindow(a,l,e,i)}}},{key:"redraw",value:function(){this._redraw()}},{key:"_redraw",value:function(){var t;this.redrawCount++;var e=this.dom;if(e&&e.container&&0!=e.root.offsetWidth){var i=!1,n=this.options,r=this.props;VE(this.options.moment,this.body,this.options.hiddenDates),"top"==n.orientation?(wE.addClassName(e.root,"vis-top"),wE.removeClassName(e.root,"vis-bottom")):(wE.removeClassName(e.root,"vis-top"),wE.addClassName(e.root,"vis-bottom")),n.rtl?(wE.addClassName(e.root,"vis-rtl"),wE.removeClassName(e.root,"vis-ltr")):(wE.addClassName(e.root,"vis-ltr"),wE.removeClassName(e.root,"vis-rtl")),e.root.style.maxHeight=wE.option.asSize(n.maxHeight,""),e.root.style.minHeight=wE.option.asSize(n.minHeight,""),e.root.style.width=wE.option.asSize(n.width,"");var o=e.root.offsetWidth;r.border.left=1,r.border.right=1,r.border.top=1,r.border.bottom=1,r.center.height=e.center.offsetHeight,r.left.height=e.left.offsetHeight,r.right.height=e.right.offsetHeight,r.top.height=e.top.clientHeight||-r.border.top,r.bottom.height=Math.round(e.bottom.getBoundingClientRect().height)||e.bottom.clientHeight||-r.border.bottom;var s=Math.max(r.left.height,r.center.height,r.right.height),a=r.top.height+s+r.bottom.height+r.border.top+r.border.bottom;e.root.style.height=wE.option.asSize(n.height,"".concat(a,"px")),r.root.height=e.root.offsetHeight,r.background.height=r.root.height;var l=r.root.height-r.top.height-r.bottom.height;r.centerContainer.height=l,r.leftContainer.height=l,r.rightContainer.height=r.leftContainer.height,r.root.width=o,r.background.width=r.root.width,this.initialDrawDone||(r.scrollbarWidth=wE.getScrollBarWidth());var h=e.leftContainer.clientWidth,u=e.rightContainer.clientWidth;n.verticalScroll?n.rtl?(r.left.width=h||-r.border.left,r.right.width=u+r.scrollbarWidth||-r.border.right):(r.left.width=h+r.scrollbarWidth||-r.border.left,r.right.width=u||-r.border.right):(r.left.width=h||-r.border.left,r.right.width=u||-r.border.right),this._setDOM();var d=this._updateScrollTop();"top"!=n.orientation.item&&(d+=Math.max(r.centerContainer.height-r.center.height-r.border.top-r.border.bottom,0)),e.center.style.transform="translateY(".concat(d,"px)");var c=0==r.scrollTop?"hidden":"",p=r.scrollTop==r.scrollTopMin?"hidden":"";e.shadowTop.style.visibility=c,e.shadowBottom.style.visibility=p,e.shadowTopLeft.style.visibility=c,e.shadowBottomLeft.style.visibility=p,e.shadowTopRight.style.visibility=c,e.shadowBottomRight.style.visibility=p,n.verticalScroll&&(e.rightContainer.className="vis-panel vis-right vis-vertical-scroll",e.leftContainer.className="vis-panel vis-left vis-vertical-scroll",e.shadowTopRight.style.visibility="hidden",e.shadowBottomRight.style.visibility="hidden",e.shadowTopLeft.style.visibility="hidden",e.shadowBottomLeft.style.visibility="hidden",e.left.style.top="0px",e.right.style.top="0px"),(!n.verticalScroll||r.center.heightr.centerContainer.height;this.hammer.get("pan").set({direction:f?uP.DIRECTION_ALL:uP.DIRECTION_HORIZONTAL}),this.hammer.get("press").set({time:this.options.longSelectPressTime}),Hp(t=this.components).call(t,(function(t){i=t.redraw()||i}));if(i){if(this.redrawCount<5)return void this.body.emitter.emit("_change");console.log("WARNING: infinite loop in redraw?")}else this.redrawCount=0;this.body.emitter.emit("changed")}}},{key:"_setDOM",value:function(){var t=this.props,e=this.dom;t.leftContainer.width=t.left.width,t.rightContainer.width=t.right.width;var i=t.root.width-t.left.width-t.right.width;t.center.width=i,t.centerContainer.width=i,t.top.width=i,t.bottom.width=i,e.background.style.height="".concat(t.background.height,"px"),e.backgroundVertical.style.height="".concat(t.background.height,"px"),e.backgroundHorizontal.style.height="".concat(t.centerContainer.height,"px"),e.centerContainer.style.height="".concat(t.centerContainer.height,"px"),e.leftContainer.style.height="".concat(t.leftContainer.height,"px"),e.rightContainer.style.height="".concat(t.rightContainer.height,"px"),e.background.style.width="".concat(t.background.width,"px"),e.backgroundVertical.style.width="".concat(t.centerContainer.width,"px"),e.backgroundHorizontal.style.width="".concat(t.background.width,"px"),e.centerContainer.style.width="".concat(t.center.width,"px"),e.top.style.width="".concat(t.top.width,"px"),e.bottom.style.width="".concat(t.bottom.width,"px"),e.background.style.left="0",e.background.style.top="0",e.backgroundVertical.style.left="".concat(t.left.width+t.border.left,"px"),e.backgroundVertical.style.top="0",e.backgroundHorizontal.style.left="0",e.backgroundHorizontal.style.top="".concat(t.top.height,"px"),e.centerContainer.style.left="".concat(t.left.width,"px"),e.centerContainer.style.top="".concat(t.top.height,"px"),e.leftContainer.style.left="0",e.leftContainer.style.top="".concat(t.top.height,"px"),e.rightContainer.style.left="".concat(t.left.width+t.center.width,"px"),e.rightContainer.style.top="".concat(t.top.height,"px"),e.top.style.left="".concat(t.left.width,"px"),e.top.style.top="0",e.bottom.style.left="".concat(t.left.width,"px"),e.bottom.style.top="".concat(t.top.height+t.centerContainer.height,"px"),e.center.style.left="0",e.left.style.left="0",e.right.style.left="0"}},{key:"setCurrentTime",value:function(t){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");this.currentTime.setCurrentTime(t)}},{key:"getCurrentTime",value:function(){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");return this.currentTime.getCurrentTime()}},{key:"_toTime",value:function(t){return $E(this,t,this.props.center.width)}},{key:"_toGlobalTime",value:function(t){return $E(this,t,this.props.root.width)}},{key:"_toScreen",value:function(t){return qE(this,t,this.props.center.width)}},{key:"_toGlobalScreen",value:function(t){return qE(this,t,this.props.root.width)}},{key:"_initAutoResize",value:function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()}},{key:"_startAutoResize",value:function(){var t=this;this._stopAutoResize(),this._onResize=function(){if(1==t.options.autoResize){if(t.dom.root){var e=t.dom.root.offsetHeight,i=t.dom.root.offsetWidth;i==t.props.lastWidth&&e==t.props.lastHeight||(t.props.lastWidth=i,t.props.lastHeight=e,t.props.scrollbarWidth=wE.getScrollBarWidth(),t.body.emitter.emit("_change"))}}else t._stopAutoResize()},window.addEventListener("resize",this._onResize),t.dom.root&&(t.props.lastWidth=t.dom.root.offsetWidth,t.props.lastHeight=t.dom.root.offsetHeight),this.watchTimer=lP(this._onResize,1e3)}},{key:"_stopAutoResize",value:function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),this._onResize&&(window.removeEventListener("resize",this._onResize),this._onResize=null)}},{key:"_onTouch",value:function(t){this.touch.allowDragging=!0,this.touch.initialScrollTop=this.props.scrollTop}},{key:"_onPinch",value:function(t){this.touch.allowDragging=!1}},{key:"_onDrag",value:function(t){if(t&&this.touch.allowDragging){var e=t.deltaY,i=this._getScrollTop(),n=this._setScrollTop(this.touch.initialScrollTop+e);this.options.verticalScroll&&(this.dom.left.parentNode.scrollTop=-this.props.scrollTop,this.dom.right.parentNode.scrollTop=-this.props.scrollTop),n!=i&&this.emit("verticalDrag")}}},{key:"_setScrollTop",value:function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop}},{key:"_updateScrollTop",value:function(){var t=Math.min(this.props.centerContainer.height-this.props.border.top-this.props.border.bottom-this.props.center.height,0);return t!=this.props.scrollTopMin&&("top"!=this.options.orientation.item&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTop1e3&&(i=1e3),t.redraw(),t.body.emitter.emit("currentTimeTick"),t.currentTimeTimer=Rv(e,i)}()}},{key:"stop",value:function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)}},{key:"setCurrentTime",value:function(t){var e=wE.convert(t,"Date").valueOf(),i=lp();this.offset=e-i,this.redraw()}},{key:"getCurrentTime",value:function(){return new Date(lp()+this.offset)}}]),i}(IE),YP=En,HP=Zl.find,zP="find",BP=!0;zP in[]&&Array(1)[zP]((function(){BP=!1})),YP({target:"Array",proto:!0,forced:BP},{find:function(t){return HP(this,t,arguments.length>1?arguments[1]:void 0)}});var GP=Jd("Array").find,WP=ye,VP=GP,UP=Array.prototype,XP=function(t){var e=t.find;return t===UP||WP(UP,t)&&e===UP.find?VP:e},qP=n(XP),$P=En,ZP=Zl.findIndex,KP="findIndex",JP=!0;KP in[]&&Array(1)[KP]((function(){JP=!1})),$P({target:"Array",proto:!0,forced:JP},{findIndex:function(t){return ZP(this,t,arguments.length>1?arguments[1]:void 0)}});var QP=Jd("Array").findIndex,tA=ye,eA=QP,iA=Array.prototype,nA=function(t){var e=t.findIndex;return t===iA||tA(iA,t)&&e===iA.findIndex?eA:e},rA=n(nA);function oA(t,e){var i=void 0!==Ic&&Ta(t)||t["@@iterator"];if(!i){if(qc(t)||(i=function(t,e){var i;if(!t)return;if("string"==typeof t)return sA(t,e);var n=Hc(i=Object.prototype.toString.call(t)).call(i,8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return sa(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sA(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function sA(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);ie.index?1:t.indexi[a].index&&(i[o].top+=i[a].height);for(var l=t[o],h=0;he}),m),_f(p).call(p,m,0,t),m++}};for(v.s();!(d=v.n()).done;)g()}catch(t){v.e(t)}finally{v.f()}f=null;var y=null;m=0;for(var b,_=0,w=0,k=0,x=function(){var t,n,r=c.shift();r.top=s(r);var u=l(r),d=h(r);null!==f&&ud&&(w=function(t,e,n,r){n||(n=0);r||(r=t.length);for(i=r-1;i>=n;i--)if(e(t[i]))return i;return n-1}(p,(function(t){return d+aA>=l(t)}),_,w)+1);for(var v,g,b,x=_T(t=mm(n=Hc(p).call(p,_,w)).call(n,(function(t){return ul(t)}))).call(t,(function(t,e){return t.top-e.top})),D=0;Dg.top&&(r.top=S.top+S.height+e.vertical)}o(r)&&(m=vA(p,(function(t){return l(t)-aA>u}),m),_f(p).call(p,m,0,r),m++);var C=r.top+r.height;if(C>k&&(k=C),a&&a())return{v:null}};c.length>0;)if(b=x())return b.v;return k}function vA(t,e,i){var n;i||(i=0);var r=rA(n=Hc(t).call(t,i)).call(n,e);return-1===r?t.length:r+i}var gA=Object.freeze({__proto__:null,nostack:cA,orderByEnd:hA,orderByStart:lA,stack:uA,stackSubgroups:pA,stackSubgroupsWithInnerStack:fA,substack:dA}),yA="__background__",bA=function(){function t(e,i,n){var r=this;if(Ma(this,t),this.groupId=e,this.subgroups={},this.subgroupStack={},this.subgroupStackAll=!1,this.subgroupVisibility={},this.doInnerStack=!1,this.shouldBailStackItems=!1,this.subgroupIndex=0,this.subgroupOrderer=i&&i.subgroupOrder,this.itemSet=n,this.isVisible=null,this.stackDirty=!0,this._disposeCallbacks=[],i&&i.nestedGroups&&(this.nestedGroups=i.nestedGroups,0==i.showNested?this.showNested=!1:this.showNested=!0),i&&i.subgroupStack)if("boolean"==typeof i.subgroupStack)this.doInnerStack=i.subgroupStack,this.subgroupStackAll=i.subgroupStack;else for(var o in i.subgroupStack)this.subgroupStack[o]=i.subgroupStack[o],this.doInnerStack=this.doInnerStack||i.subgroupStack[o];i&&i.heightMode?this.heightMode=i.heightMode:this.heightMode=n.options.groupHeightMode,this.nestedInGroup=null,this.dom={},this.props={label:{width:0,height:0}},this.className=null,this.items={},this.visibleItems=[],this.itemsInRange=[],this.orderedItems={byStart:[],byEnd:[]},this.checkRangedItems=!1;var s=function(){r.checkRangedItems=!0};this.itemSet.body.emitter.on("checkRangedItems",s),this._disposeCallbacks.push((function(){r.itemSet.body.emitter.off("checkRangedItems",s)})),this._create(),this.setData(i)}return Yd(t,[{key:"_create",value:function(){var t=document.createElement("div");this.itemSet.options.groupEditable.order?t.className="vis-label draggable":t.className="vis-label",this.dom.label=t;var e=document.createElement("div");e.className="vis-inner",t.appendChild(e),this.dom.inner=e;var i=document.createElement("div");i.className="vis-group",i["vis-group"]=this,this.dom.foreground=i,this.dom.background=document.createElement("div"),this.dom.background.className="vis-group",this.dom.axis=document.createElement("div"),this.dom.axis.className="vis-group",this.dom.marker=document.createElement("div"),this.dom.marker.style.visibility="hidden",this.dom.marker.style.position="absolute",this.dom.marker.innerHTML="",this.dom.background.appendChild(this.dom.marker)}},{key:"setData",value:function(t){if(!this.itemSet.groupTouchParams.isDragging){var e,i,n;if(t&&t.subgroupVisibility)for(var r in t.subgroupVisibility)this.subgroupVisibility[r]=t.subgroupVisibility[r];if(this.itemSet.options&&this.itemSet.options.groupTemplate)e=(i=Tp(n=this.itemSet.options.groupTemplate).call(n,this))(t,this.dom.inner);else e=t&&t.content;if(e instanceof Element){for(;this.dom.inner.firstChild;)this.dom.inner.removeChild(this.dom.inner.firstChild);this.dom.inner.appendChild(e)}else e instanceof Object&&e.isReactComponent||(e instanceof Object?i(t,this.dom.inner):this.dom.inner.innerHTML=null!=e?wE.xss(e):wE.xss(this.groupId||""));this.dom.label.title=t&&t.title||"",this.dom.inner.firstChild?wE.removeClassName(this.dom.inner,"vis-hidden"):wE.addClassName(this.dom.inner,"vis-hidden"),t&&t.nestedGroups?(this.nestedGroups&&this.nestedGroups==t.nestedGroups||(this.nestedGroups=t.nestedGroups),void 0===t.showNested&&void 0!==this.showNested||(0==t.showNested?this.showNested=!1:this.showNested=!0),wE.addClassName(this.dom.label,"vis-nesting-group"),this.showNested?(wE.removeClassName(this.dom.label,"collapsed"),wE.addClassName(this.dom.label,"expanded")):(wE.removeClassName(this.dom.label,"expanded"),wE.addClassName(this.dom.label,"collapsed"))):this.nestedGroups&&(this.nestedGroups=null,wE.removeClassName(this.dom.label,"collapsed"),wE.removeClassName(this.dom.label,"expanded"),wE.removeClassName(this.dom.label,"vis-nesting-group")),t&&(t.treeLevel||t.nestedInGroup)?(wE.addClassName(this.dom.label,"vis-nested-group"),t.treeLevel?wE.addClassName(this.dom.label,"vis-group-level-"+t.treeLevel):wE.addClassName(this.dom.label,"vis-group-level-unknown-but-gte1")):wE.addClassName(this.dom.label,"vis-group-level-0");var o=t&&t.className||null;o!=this.className&&(this.className&&(wE.removeClassName(this.dom.label,this.className),wE.removeClassName(this.dom.foreground,this.className),wE.removeClassName(this.dom.background,this.className),wE.removeClassName(this.dom.axis,this.className)),wE.addClassName(this.dom.label,o),wE.addClassName(this.dom.foreground,o),wE.addClassName(this.dom.background,o),wE.addClassName(this.dom.axis,o),this.className=o),this.style&&(wE.removeCssText(this.dom.label,this.style),this.style=null),t&&t.style&&(wE.addCssText(this.dom.label,t.style),this.style=t.style)}}},{key:"getLabelWidth",value:function(){return this.props.label.width}},{key:"_didMarkerHeightChange",value:function(){var t=this.dom.marker.clientHeight;if(t!=this.lastMarkerHeight){this.lastMarkerHeight=t;var e={},i=0;if(Hp(wE).call(wE,this.items,(function(t,n){if(t.dirty=!0,t.displayed){e[n]=t.redraw(!0),i=e[n].length}})),i>0)for(var n=function(t){Hp(wE).call(wE,e,(function(e){e[t]()}))},r=0;ri.bailTimeMs&&(i.userBailFunction&&null==this.itemSet.userContinueNotBail?i.userBailFunction((function(e){t.itemSet.userContinueNotBail=e,n=!e})):n=0==t.itemSet.userContinueNotBail)}return n}},{key:"_redrawItems",value:function(t,e,i,n){var r=this;if(t||this.stackDirty||this.isVisible&&!e){var o,s,a,l,h,u,d={byEnd:mm(o=this.orderedItems.byEnd).call(o,(function(t){return!t.isCluster})),byStart:mm(s=this.orderedItems.byStart).call(s,(function(t){return!t.isCluster}))},c={byEnd:Ac(new LC(mm(a=ep(l=this.orderedItems.byEnd).call(l,(function(t){return t.cluster}))).call(a,(function(t){return!!t})))),byStart:Ac(new LC(mm(h=ep(u=this.orderedItems.byStart).call(u,(function(t){return t.cluster}))).call(h,(function(t){return!!t}))))},p=function(){var t,e,i,o=r._updateItemsInRange(d,mm(t=r.visibleItems).call(t,(function(t){return!t.isCluster})),n),s=r._updateClustersInRange(c,mm(e=r.visibleItems).call(e,(function(t){return t.isCluster})),n);return Yc(i=[]).call(i,Ac(o),Ac(s))},f=function(t){var e={},i=function(i){var n,o=mm(n=r.visibleItems).call(n,(function(t){return t.data.subgroup===i}));e[i]=t?_T(o).call(o,(function(e,i){return t(e.data,i.data)})):o};for(var n in r.subgroups)i(n);return e};if("function"==typeof this.itemSet.options.order){var m=this;if(this.doInnerStack&&this.itemSet.options.stackSubgroups){fA(f(this.itemSet.options.order),i,this.subgroups),this.visibleItems=p(),this._updateSubGroupHeights(i)}else{var v,g,y,b;this.visibleItems=p(),this._updateSubGroupHeights(i);var _=_T(v=mm(g=Hc(y=this.visibleItems).call(y)).call(g,(function(t){return t.isCluster||!t.isCluster&&!t.cluster}))).call(v,(function(t,e){return m.itemSet.options.order(t.data,e.data)}));this.shouldBailStackItems=uA(_,i,!0,Tp(b=this._shouldBailItemsRedraw).call(b,this))}}else{var w;if(this.visibleItems=p(),this._updateSubGroupHeights(i),this.itemSet.options.stack)if(this.doInnerStack&&this.itemSet.options.stackSubgroups)fA(f(),i,this.subgroups);else this.shouldBailStackItems=uA(this.visibleItems,i,!0,Tp(w=this._shouldBailItemsRedraw).call(w,this));else cA(this.visibleItems,i,this.subgroups,this.itemSet.options.stackSubgroups)}for(var k=0;k0){var i=this;this._resetSubgroups(),Hp(wE).call(wE,this.visibleItems,(function(n){void 0!==n.data.subgroup&&(i.subgroups[n.data.subgroup].height=Math.max(i.subgroups[n.data.subgroup].height,n.height+t.item.vertical),i.subgroups[n.data.subgroup].visible=void 0===e.subgroupVisibility[n.data.subgroup]||Boolean(e.subgroupVisibility[n.data.subgroup]))}))}}},{key:"_isGroupVisible",value:function(t,e){return this.top<=t.body.domProps.centerContainer.height-t.body.domProps.scrollTop+e.axis&&this.top+this.height+e.axis>=-t.body.domProps.scrollTop}},{key:"_calculateHeight",value:function(t){var e,i;if((i="fixed"===this.heightMode?wE.toArray(this.items):this.visibleItems).length>0){var n=i[0].top,r=i[0].top+i[0].height;if(Hp(wE).call(wE,i,(function(t){n=Math.min(n,t.top),r=Math.max(r,t.top+t.height)})),n>t.axis){var o=n-t.axis;r-=o,Hp(wE).call(wE,i,(function(t){t.top-=o}))}e=Math.ceil(r+t.item.vertical/2),"fitItems"!==this.heightMode&&(e=Math.max(e,this.props.label.height))}else e=this.props.label.height;return e}},{key:"show",value:function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)}},{key:"hide",value:function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var n=this.dom.axis;n.parentNode&&n.parentNode.removeChild(n)}},{key:"add",value:function(t){var e;if(this.items[t.id]=t,t.setParent(this),this.stackDirty=!0,void 0!==t.data.subgroup&&(this._addToSubgroup(t),this.orderSubgroups()),!nm(e=this.visibleItems).call(e,t)){var i=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,i)}}},{key:"_addToSubgroup",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.data.subgroup;null!=e&&void 0===this.subgroups[e]&&(this.subgroups[e]={height:0,top:0,start:t.data.start,end:t.data.end||t.data.start,visible:!1,index:this.subgroupIndex,items:[],stack:this.subgroupStackAll||this.subgroupStack[e]||!1},this.subgroupIndex++),new Date(t.data.start)new Date(this.subgroups[e].end)&&(this.subgroups[e].end=i),this.subgroups[e].items.push(t)}},{key:"_updateSubgroupsSizes",value:function(){var t=this;if(t.subgroups){var e=function(){var e,n=t.subgroups[i].items[0].data.end||t.subgroups[i].items[0].data.start,r=t.subgroups[i].items[0].data.start,o=n-1;Hp(e=t.subgroups[i].items).call(e,(function(t){new Date(t.data.start)new Date(o)&&(o=e)})),t.subgroups[i].start=r,t.subgroups[i].end=new Date(o-1)};for(var i in t.subgroups)e()}}},{key:"orderSubgroups",value:function(){if(void 0!==this.subgroupOrderer){var t=[];if("string"==typeof this.subgroupOrderer){for(var e in this.subgroups)t.push({subgroup:e,sortField:this.subgroups[e].items[0].data[this.subgroupOrderer]});_T(t).call(t,(function(t,e){return t.sortField-e.sortField}))}else if("function"==typeof this.subgroupOrderer){for(var i in this.subgroups)t.push(this.subgroups[i].items[0].data);_T(t).call(t,this.subgroupOrderer)}if(t.length>0)for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:t.data.subgroup;if(null!=e){var i=this.subgroups[e];if(i){var n,r,o=av(n=i.items).call(n,t);if(o>=0)_f(r=i.items).call(r,o,1),i.items.length?this._updateSubgroupsSizes():delete this.subgroups[e]}}}},{key:"removeFromDataSet",value:function(t){this.itemSet.removeItem(t.id)}},{key:"order",value:function(){for(var t=wE.toArray(this.items),e=[],i=[],n=0;n0)for(var u=0;uh})),1==this.checkRangedItems){this.checkRangedItems=!1;for(var c=0;ch}))}for(var f={},m=0,v=0;v0)for(var y=function(t){Hp(wE).call(wE,f,(function(e){e[t]()}))},b=0;b=0;o--){var s=e[o];if(r(s))break;s.isCluster&&!s.hasItems()||s.cluster||void 0===n[s.id]&&(n[s.id]=!0,i.push(s))}for(var a=t+1;a0)for(var o=0;o0)for(var c=0;c=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function xA(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0){var e=[];if(qc(this.options.dataAttributes))e=this.options.dataAttributes;else{if("all"!=this.options.dataAttributes)return;e=rp(this.data)}var i,n=kA(e);try{for(n.s();!(i=n.n()).done;){var r=i.value,o=this.data[r];null!=o?t.setAttribute("data-".concat(r),o):t.removeAttribute("data-".concat(r))}}catch(t){n.e(t)}finally{n.f()}}}},{key:"_updateStyle",value:function(t){this.style&&(wE.removeCssText(t,this.style),this.style=null),this.data.style&&(wE.addCssText(t,this.data.style),this.style=this.data.style)}},{key:"_contentToString",value:function(t){return"string"==typeof t?t:t&&"outerHTML"in t?t.outerHTML:t}},{key:"_updateEditStatus",value:function(){this.options&&("boolean"==typeof this.options.editable?this.editable={updateTime:this.options.editable,updateGroup:this.options.editable,remove:this.options.editable}:"object"===Nd(this.options.editable)&&(this.editable={},wE.selectiveExtend(["updateTime","updateGroup","remove"],this.editable,this.options.editable))),this.options&&this.options.editable&&!0===this.options.editable.overrideItems||this.data&&("boolean"==typeof this.data.editable?this.editable={updateTime:this.data.editable,updateGroup:this.data.editable,remove:this.data.editable}:"object"===Nd(this.data.editable)&&(this.editable={},wE.selectiveExtend(["updateTime","updateGroup","remove"],this.editable,this.data.editable)))}},{key:"getWidthLeft",value:function(){return 0}},{key:"getWidthRight",value:function(){return 0}},{key:"getTitle",value:function(){var t;return this.options.tooltip&&this.options.tooltip.template?Tp(t=this.options.tooltip.template).call(t,this)(this._getItemData(),this.data):this.data.title}}]),t}();function SA(t){var e=function(){if("undefined"==typeof Reflect||!vM)return!1;if(vM.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(vM(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=d_(t);if(e){var r=d_(this).constructor;i=vM(n,arguments,r)}else i=n.apply(this,arguments);return l_(this,i)}}DA.prototype.stack=!0;var CA=function(t){a_(i,t);var e=SA(i);function i(t,n,r){var o;if(Ma(this,i),(o=e.call(this,t,n,r)).props={dot:{width:0,height:0},line:{width:0,height:0}},t&&null==t.start)throw new Error('Property "start" missing in item '.concat(t));return o}return Yd(i,[{key:"isVisible",value:function(t){if(this.cluster)return!1;var e,i=this.data.align||this.options.align,n=this.width*t.getMillisecondsPerPixel();return e="right"==i?this.data.start.getTime()>t.start&&this.data.start.getTime()-nt.start&&this.data.start.getTime()t.start&&this.data.start.getTime()-n/23&&void 0!==arguments[3]&&arguments[3]?-1*e:e;t.style.transform=void 0!==i?void 0!==e?Yc(n="translate(".concat(r,"px, ")).call(n,i,"px)"):"translateY(".concat(i,"px)"):"translateX(".concat(r,"px)")}};e(this.dom.box,this.boxX,this.boxY,t),e(this.dom.dot,this.dotX,this.dotY,t),e(this.dom.line,this.lineX,this.lineY,t)}},{key:"repositionX",value:function(){var t=this.conversion.toScreen(this.data.start),e=void 0===this.data.align?this.options.align:this.data.align,i=this.props.line.width,n=this.props.dot.width;"right"==e?(this.boxX=t-this.width,this.lineX=t-i,this.dotX=t-i/2-n/2):"left"==e?(this.boxX=t,this.lineX=t,this.dotX=t+i/2-n/2):(this.boxX=t-this.width/2,this.lineX=this.options.rtl?t-i:t-i/2,this.dotX=t-n/2),this.options.rtl?this.right=this.boxX:this.left=this.boxX,this.repositionXY()}},{key:"repositionY",value:function(){var t=this.options.orientation.item,e=this.dom.line.style;if("top"==t){var i=this.parent.top+this.top+1;this.boxY=this.top||0,e.height="".concat(i,"px"),e.bottom="",e.top="0"}else{var n=this.parent.itemSet.props.height-this.parent.top-this.parent.height+this.top;this.boxY=this.parent.height-this.top-(this.height||0),e.height="".concat(n,"px"),e.top="",e.bottom="0"}this.dotY=-this.props.dot.height/2,this.repositionXY()}},{key:"getWidthLeft",value:function(){return this.width/2}},{key:"getWidthRight",value:function(){return this.width/2}}]),i}(DA);function TA(t){var e=function(){if("undefined"==typeof Reflect||!vM)return!1;if(vM.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(vM(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=d_(t);if(e){var r=d_(this).constructor;i=vM(n,arguments,r)}else i=n.apply(this,arguments);return l_(this,i)}}var MA=function(t){a_(i,t);var e=TA(i);function i(t,n,r){var o;if(Ma(this,i),(o=e.call(this,t,n,r)).props={dot:{top:0,width:0,height:0},content:{height:0,marginLeft:0,marginRight:0}},t&&null==t.start)throw new Error('Property "start" missing in item '.concat(t));return o}return Yd(i,[{key:"isVisible",value:function(t){if(this.cluster)return!1;var e=this.width*t.getMillisecondsPerPixel();return this.data.start.getTime()+e>t.start&&this.data.start3&&void 0!==arguments[3]&&arguments[3]?-1*e:e;t.style.transform=void 0!==i?void 0!==e?Yc(n="translate(".concat(r,"px, ")).call(n,i,"px)"):"translateY(".concat(i,"px)"):"translateX(".concat(r,"px)")}};e(this.dom.point,this.pointX,this.pointY,t)}},{key:"show",value:function(t){if(!this.displayed)return this.redraw(t)}},{key:"hide",value:function(){this.displayed&&(this.dom.point.parentNode&&this.dom.point.parentNode.removeChild(this.dom.point),this.displayed=!1)}},{key:"repositionX",value:function(){var t=this.conversion.toScreen(this.data.start);this.pointX=t,this.options.rtl?this.right=t-this.props.dot.width:this.left=t-this.props.dot.width,this.repositionXY()}},{key:"repositionY",value:function(){var t=this.options.orientation.item;this.pointY="top"==t?this.top:this.parent.height-this.top-this.height,this.repositionXY()}},{key:"getWidthLeft",value:function(){return this.props.dot.width}},{key:"getWidthRight",value:function(){return this.props.dot.width}}]),i}(DA);function OA(t){var e=function(){if("undefined"==typeof Reflect||!vM)return!1;if(vM.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(vM(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=d_(t);if(e){var r=d_(this).constructor;i=vM(n,arguments,r)}else i=n.apply(this,arguments);return l_(this,i)}}var EA=function(t){a_(i,t);var e=OA(i);function i(t,n,r){var o;if(Ma(this,i),(o=e.call(this,t,n,r)).props={content:{width:0}},o.overflow=!1,t){if(null==t.start)throw new Error('Property "start" missing in item '.concat(t.id));if(null==t.end)throw new Error('Property "end" missing in item '.concat(t.id))}return o}return Yd(i,[{key:"isVisible",value:function(t){return!this.cluster&&(this.data.startt.start)}},{key:"_createDomElement",value:function(){this.dom||(this.dom={},this.dom.box=document.createElement("div"),this.dom.frame=document.createElement("div"),this.dom.frame.className="vis-item-overflow",this.dom.box.appendChild(this.dom.frame),this.dom.visibleFrame=document.createElement("div"),this.dom.visibleFrame.className="vis-item-visible-frame",this.dom.box.appendChild(this.dom.visibleFrame),this.dom.content=document.createElement("div"),this.dom.content.className="vis-item-content",this.dom.frame.appendChild(this.dom.content),this.dom.box["vis-item"]=this,this.dirty=!0)}},{key:"_appendDomElement",value:function(){if(!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!this.dom.box.parentNode){var t=this.parent.dom.foreground;if(!t)throw new Error("Cannot redraw item: parent has no foreground container element");t.appendChild(this.dom.box)}this.displayed=!0}},{key:"_updateDirtyDomComponents",value:function(){if(this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var t=this.editable.updateTime||this.editable.updateGroup,e=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(t?" vis-editable":" vis-readonly");this.dom.box.className=this.baseClassName+e,this.dom.content.style.maxWidth="none"}}},{key:"_getDomComponentsSizes",value:function(){return this.overflow="hidden"!==window.getComputedStyle(this.dom.frame).overflow,this.whiteSpace="nowrap"!==window.getComputedStyle(this.dom.content).whiteSpace,{content:{width:this.dom.content.offsetWidth},box:{height:this.dom.box.offsetHeight}}}},{key:"_updateDomComponentsSizes",value:function(t){this.props.content.width=t.content.width,this.height=t.box.height,this.dom.content.style.maxWidth="",this.dirty=!1}},{key:"_repaintDomAdditionals",value:function(){this._repaintOnItemUpdateTimeTooltip(this.dom.box),this._repaintDeleteButton(this.dom.box),this._repaintDragCenter(),this._repaintDragLeft(),this._repaintDragRight()}},{key:"redraw",value:function(t){var e,i,n,r,o,s,a=this,l=[Tp(e=this._createDomElement).call(e,this),Tp(i=this._appendDomElement).call(i,this),Tp(n=this._updateDirtyDomComponents).call(n,this),function(){var t;a.dirty&&(o=Tp(t=a._getDomComponentsSizes).call(t,a)())},function(){var t;a.dirty&&Tp(t=a._updateDomComponentsSizes).call(t,a)(o)},Tp(r=this._repaintDomAdditionals).call(r,this)];return t?l:(Hp(l).call(l,(function(t){s=t()})),s)}},{key:"show",value:function(t){if(!this.displayed)return this.redraw(t)}},{key:"hide",value:function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.displayed=!1}}},{key:"repositionX",value:function(t){var e,i,n=this.parent.width,r=this.conversion.toScreen(this.data.start),o=this.conversion.toScreen(this.data.end),s=void 0===this.data.align?this.options.align:this.data.align;!1===this.data.limitSize||void 0!==t&&!0!==t||(r<-n&&(r=-n),o>2*n&&(o=2*n));var a=Math.max(Math.round(1e3*(o-r))/1e3,1);switch(this.overflow?(this.options.rtl?this.right=r:this.left=r,this.width=a+this.props.content.width,i=this.props.content.width):(this.options.rtl?this.right=r:this.left=r,this.width=a,i=Math.min(o-r,this.props.content.width)),this.options.rtl?this.dom.box.style.transform="translateX(".concat(-1*this.right,"px)"):this.dom.box.style.transform="translateX(".concat(this.left,"px)"),this.dom.box.style.width="".concat(a,"px"),this.whiteSpace&&(this.height=this.dom.box.offsetHeight),s){case"left":this.dom.content.style.transform="translateX(0)";break;case"right":if(this.options.rtl){var l=-1*Math.max(a-i,0);this.dom.content.style.transform="translateX(".concat(l,"px)")}else this.dom.content.style.transform="translateX(".concat(Math.max(a-i,0),"px)");break;case"center":if(this.options.rtl){var h=-1*Math.max((a-i)/2,0);this.dom.content.style.transform="translateX(".concat(h,"px)")}else this.dom.content.style.transform="translateX(".concat(Math.max((a-i)/2,0),"px)");break;default:if(e=this.overflow?o>0?Math.max(-r,0):-i:r<0?-r:0,this.options.rtl){var u=-1*e;this.dom.content.style.transform="translateX(".concat(u,"px)")}else this.dom.content.style.transform="translateX(".concat(e,"px)")}}},{key:"repositionY",value:function(){var t=this.options.orientation.item,e=this.dom.box;e.style.top="".concat("top"==t?this.top:this.parent.height-this.top-this.height,"px")}},{key:"_repaintDragLeft",value:function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="vis-drag-left",t.dragLeftItem=this,this.dom.box.appendChild(t),this.dom.dragLeft=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragLeft||(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)}},{key:"_repaintDragRight",value:function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="vis-drag-right",t.dragRightItem=this,this.dom.box.appendChild(t),this.dom.dragRight=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragRight||(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)}}]),i}(DA);function PA(t){var e=function(){if("undefined"==typeof Reflect||!vM)return!1;if(vM.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(vM(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=d_(t);if(e){var r=d_(this).constructor;i=vM(n,arguments,r)}else i=n.apply(this,arguments);return l_(this,i)}}EA.prototype.baseClassName="vis-item vis-range";var AA=function(t){a_(i,t);var e=PA(i);function i(t,n,r){var o;if(Ma(this,i),(o=e.call(this,t,n,r)).props={content:{width:0}},o.overflow=!1,t){if(null==t.start)throw new Error('Property "start" missing in item '.concat(t.id));if(null==t.end)throw new Error('Property "end" missing in item '.concat(t.id))}return o}return Yd(i,[{key:"isVisible",value:function(t){return this.data.startt.start}},{key:"_createDomElement",value:function(){this.dom||(this.dom={},this.dom.box=document.createElement("div"),this.dom.frame=document.createElement("div"),this.dom.frame.className="vis-item-overflow",this.dom.box.appendChild(this.dom.frame),this.dom.content=document.createElement("div"),this.dom.content.className="vis-item-content",this.dom.frame.appendChild(this.dom.content),this.dirty=!0)}},{key:"_appendDomElement",value:function(){if(!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!this.dom.box.parentNode){var t=this.parent.dom.background;if(!t)throw new Error("Cannot redraw item: parent has no background container element");t.appendChild(this.dom.box)}this.displayed=!0}},{key:"_updateDirtyDomComponents",value:function(){if(this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.content),this._updateStyle(this.dom.box);var t=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"");this.dom.box.className=this.baseClassName+t}}},{key:"_getDomComponentsSizes",value:function(){return this.overflow="hidden"!==window.getComputedStyle(this.dom.content).overflow,{content:{width:this.dom.content.offsetWidth}}}},{key:"_updateDomComponentsSizes",value:function(t){this.props.content.width=t.content.width,this.height=0,this.dirty=!1}},{key:"_repaintDomAdditionals",value:function(){}},{key:"redraw",value:function(t){var e,i,n,r,o,s,a=this,l=[Tp(e=this._createDomElement).call(e,this),Tp(i=this._appendDomElement).call(i,this),Tp(n=this._updateDirtyDomComponents).call(n,this),function(){var t;a.dirty&&(o=Tp(t=a._getDomComponentsSizes).call(t,a)())},function(){var t;a.dirty&&Tp(t=a._updateDomComponentsSizes).call(t,a)(o)},Tp(r=this._repaintDomAdditionals).call(r,this)];return t?l:(Hp(l).call(l,(function(t){s=t()})),s)}},{key:"repositionY",value:function(t){var e,i=this.options.orientation.item;if(void 0!==this.data.subgroup){var n=this.data.subgroup;this.dom.box.style.height="".concat(this.parent.subgroups[n].height,"px"),this.dom.box.style.top="".concat("top"==i?this.parent.top+this.parent.subgroups[n].top:this.parent.top+this.parent.height-this.parent.subgroups[n].top-this.parent.subgroups[n].height,"px"),this.dom.box.style.bottom=""}else this.parent instanceof wA?(e=Math.max(this.parent.height,this.parent.itemSet.body.domProps.center.height,this.parent.itemSet.body.domProps.centerContainer.height),this.dom.box.style.bottom="bottom"==i?"0":"",this.dom.box.style.top="top"==i?"0":""):(e=this.parent.height,this.dom.box.style.top="".concat(this.parent.top,"px"),this.dom.box.style.bottom="");this.dom.box.style.height="".concat(e,"px")}}]),i}(DA);AA.prototype.baseClassName="vis-item vis-background",AA.prototype.stack=!1,AA.prototype.show=EA.prototype.show,AA.prototype.hide=EA.prototype.hide,AA.prototype.repositionX=EA.prototype.repositionX;pP("div.vis-tooltip{background-color:#f5f4ed;border:1px solid #808074;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;box-shadow:3px 3px 10px rgba(0,0,0,.2);color:#000;font-family:verdana;font-size:14px;padding:5px;pointer-events:none;position:absolute;visibility:hidden;white-space:nowrap;z-index:5}");var IA=function(){function t(e,i){Ma(this,t),this.container=e,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return Yd(t,[{key:"setPosition",value:function(t,e){this.x=Zm(t),this.y=Zm(e)}},{key:"setText",value:function(t){t instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(t)):this.frame.innerHTML=wE.xss(t)}},{key:"show",value:function(t){if(void 0===t&&(t=!0),!0===t){var e=this.frame.clientHeight,i=this.frame.clientWidth,n=this.frame.parentNode.clientHeight,r=this.frame.parentNode.clientWidth,o=0,s=0;if("flip"==this.overflowMethod||"none"==this.overflowMethod){var a=!1,l=!0;"flip"==this.overflowMethod&&(this.y-er-this.padding&&(a=!0)),o=a?this.x-i:this.x,s=l?this.y-e:this.y}else(s=this.y-e)+e+this.padding>n&&(s=n-e-this.padding),sr&&(o=r-i-this.padding),o1?arguments[1]:void 0)}});var NA=Jd("Array").every,RA=ye,FA=NA,jA=Array.prototype,YA=function(t){var e=t.every;return t===jA||RA(jA,t)&&e===jA.every?FA:e},HA=n(YA);function zA(t,e){var i=void 0!==Ic&&Ta(t)||t["@@iterator"];if(!i){if(qc(t)||(i=function(t,e){var i;if(!t)return;if("string"==typeof t)return BA(t,e);var n=Hc(i=Object.prototype.toString.call(t)).call(i,8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return sa(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return BA(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function BA(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);it.start&&this.hasItems()}},{key:"getData",value:function(){return{isCluster:!0,id:this.id,items:this.data.items||[],data:this.data}}},{key:"redraw",value:function(t){var e,i,n,r,o,s,a,l,h=[Tp(e=this._createDomElement).call(e,this),Tp(i=this._appendDomElement).call(i,this),Tp(n=this._updateDirtyDomComponents).call(n,this),Tp(r=function(){this.dirty&&(a=this._getDomComponentsSizes())}).call(r,this),Tp(o=function(){var t;this.dirty&&Tp(t=this._updateDomComponentsSizes).call(t,this)(a)}).call(o,this),Tp(s=this._repaintDomAdditionals).call(s,this)];return t?h:(Hp(h).call(h,(function(t){l=t()})),l)}},{key:"show",value:function(){this.displayed||this.redraw()}},{key:"hide",value:function(){if(this.displayed){var t=this.dom;t.box.parentNode&&t.box.parentNode.removeChild(t.box),this.options.showStipes&&(t.line.parentNode&&t.line.parentNode.removeChild(t.line),t.dot.parentNode&&t.dot.parentNode.removeChild(t.dot)),this.displayed=!1}}},{key:"repositionX",value:function(){var t=this.conversion.toScreen(this.data.start),e=this.data.end?this.conversion.toScreen(this.data.end):0;if(e)this.repositionXWithRanges(t,e);else{var i=void 0===this.data.align?this.options.align:this.data.align;this.repositionXWithoutRanges(t,i)}this.options.showStipes&&(this.dom.line.style.display=this._isStipeVisible()?"block":"none",this.dom.dot.style.display=this._isStipeVisible()?"block":"none",this._isStipeVisible()&&this.repositionStype(t,e))}},{key:"repositionStype",value:function(t,e){this.dom.line.style.display="block",this.dom.dot.style.display="block";var i=this.dom.line.offsetWidth,n=this.dom.dot.offsetWidth;if(e){var r=i+t+(e-t)/2,o=r-n/2,s=this.options.rtl?-1*r:r,a=this.options.rtl?-1*o:o;this.dom.line.style.transform="translateX(".concat(s,"px)"),this.dom.dot.style.transform="translateX(".concat(a,"px)")}else{var l=this.options.rtl?-1*t:t,h=this.options.rtl?-1*(t-n/2):t-n/2;this.dom.line.style.transform="translateX(".concat(l,"px)"),this.dom.dot.style.transform="translateX(".concat(h,"px)")}}},{key:"repositionXWithoutRanges",value:function(t,e){"right"==e?this.options.rtl?(this.right=t-this.width,this.dom.box.style.right=this.right+"px"):(this.left=t-this.width,this.dom.box.style.left=this.left+"px"):"left"==e?this.options.rtl?(this.right=t,this.dom.box.style.right=this.right+"px"):(this.left=t,this.dom.box.style.left=this.left+"px"):this.options.rtl?(this.right=t-this.width/2,this.dom.box.style.right=this.right+"px"):(this.left=t-this.width/2,this.dom.box.style.left=this.left+"px")}},{key:"repositionXWithRanges",value:function(t,e){var i=Math.round(Math.max(e-t+.5,1));this.options.rtl?this.right=t:this.left=t,this.width=Math.max(i,this.minWidth||0),this.options.rtl?this.dom.box.style.right=this.right+"px":this.dom.box.style.left=this.left+"px",this.dom.box.style.width=i+"px"}},{key:"repositionY",value:function(){var t=this.options.orientation.item,e=this.dom.box;if(e.style.top="top"==t?(this.top||0)+"px":(this.parent.height-this.top-this.height||0)+"px",this.options.showStipes){if("top"==t)this.dom.line.style.top="0",this.dom.line.style.height=this.parent.top+this.top+1+"px",this.dom.line.style.bottom="";else{var i=this.parent.itemSet.props.height,n=i-this.parent.top-this.parent.height+this.top;this.dom.line.style.top=i-n+"px",this.dom.line.style.bottom="0"}this.dom.dot.style.top=-this.dom.dot.offsetHeight/2+"px"}}},{key:"getWidthLeft",value:function(){return this.width/2}},{key:"getWidthRight",value:function(){return this.width/2}},{key:"move",value:function(){this.repositionX(),this.repositionY()}},{key:"attach",value:function(){var t,e,i=zA(this.data.uiItems);try{for(i.s();!(e=i.n()).done;){e.value.cluster=this}}catch(t){i.e(t)}finally{i.f()}this.data.items=ep(t=this.data.uiItems).call(t,(function(t){return t.data})),this.attached=!0,this.dirty=!0}},{key:"detach",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.hasItems()){var e,i=zA(this.data.uiItems);try{for(i.s();!(e=i.n()).done;){delete e.value.cluster}}catch(t){i.e(t)}finally{i.f()}this.attached=!1,t&&this.group&&(this.group.remove(this),this.group=null),this.data.items=[],this.dirty=!0}}},{key:"_onDoubleClick",value:function(){this._fit()}},{key:"_setupRange",value:function(){var t,e,i,n=ep(t=this.data.uiItems).call(t,(function(t){return{start:t.data.start.valueOf(),end:t.data.end?t.data.end.valueOf():t.data.start.valueOf()}}));this.data.min=Math.min.apply(Math,Ac(ep(n).call(n,(function(t){return Math.min(t.start,t.end||t.start)})))),this.data.max=Math.max.apply(Math,Ac(ep(n).call(n,(function(t){return Math.max(t.start,t.end||t.start)}))));var r=ep(e=this.data.uiItems).call(e,(function(t){return t.center})),o=cS(r).call(r,(function(t,e){return t+e}),0)/this.data.uiItems.length;TT(i=this.data.uiItems).call(i,(function(t){return t.data.end}))?(this.data.start=new Date(this.data.min),this.data.end=new Date(this.data.max)):(this.data.start=new Date(o),this.data.end=null)}},{key:"_getUiItems",value:function(){var t,e=this;return this.data.uiItems&&this.data.uiItems.length?mm(t=this.data.uiItems).call(t,(function(t){return t.cluster===e})):[]}},{key:"_createDomElement",value:function(){if(!this.dom){var t;if(this.dom={},this.dom.box=document.createElement("DIV"),this.dom.content=document.createElement("DIV"),this.dom.content.className="vis-item-content",this.dom.box.appendChild(this.dom.content),this.options.showStipes&&(this.dom.line=document.createElement("DIV"),this.dom.line.className="vis-cluster-line",this.dom.line.style.display="none",this.dom.dot=document.createElement("DIV"),this.dom.dot.className="vis-cluster-dot",this.dom.dot.style.display="none"),this.options.fitOnDoubleClick)this.dom.box.ondblclick=Tp(t=i.prototype._onDoubleClick).call(t,this);this.dom.box["vis-item"]=this,this.dirty=!0}}},{key:"_appendDomElement",value:function(){if(!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!this.dom.box.parentNode){var t=this.parent.dom.foreground;if(!t)throw new Error("Cannot redraw item: parent has no foreground container element");t.appendChild(this.dom.box)}var e=this.parent.dom.background;if(this.options.showStipes){if(!this.dom.line.parentNode){if(!e)throw new Error("Cannot redraw item: parent has no background container element");e.appendChild(this.dom.line)}if(!this.dom.dot.parentNode){var i=this.parent.dom.axis;if(!e)throw new Error("Cannot redraw item: parent has no axis container element");i.appendChild(this.dom.dot)}}this.displayed=!0}},{key:"_updateDirtyDomComponents",value:function(){if(this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var t=this.baseClassName+" "+(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+" vis-readonly";this.dom.box.className="vis-item "+t,this.options.showStipes&&(this.dom.line.className="vis-item vis-cluster-line "+(this.selected?" vis-selected":""),this.dom.dot.className="vis-item vis-cluster-dot "+(this.selected?" vis-selected":"")),this.data.end&&(this.dom.content.style.maxWidth="none")}}},{key:"_getDomComponentsSizes",value:function(){var t={previous:{right:this.dom.box.style.right,left:this.dom.box.style.left},box:{width:this.dom.box.offsetWidth,height:this.dom.box.offsetHeight}};return this.options.showStipes&&(t.dot={height:this.dom.dot.offsetHeight,width:this.dom.dot.offsetWidth},t.line={width:this.dom.line.offsetWidth}),t}},{key:"_updateDomComponentsSizes",value:function(t){this.options.rtl?this.dom.box.style.right="0px":this.dom.box.style.left="0px",this.data.end?this.minWidth=t.box.width:this.width=t.box.width,this.height=t.box.height,this.options.rtl?this.dom.box.style.right=t.previous.right:this.dom.box.style.left=t.previous.left,this.dirty=!1}},{key:"_repaintDomAdditionals",value:function(){this._repaintOnItemUpdateTimeTooltip(this.dom.box)}},{key:"_isStipeVisible",value:function(){return this.minWidth>=this.width||!this.data.end}},{key:"_getFitRange",value:function(){var t=.05*(this.data.max-this.data.min)/2;return{fitStart:this.data.min-t,fitEnd:this.data.max+t}}},{key:"_fit",value:function(){if(this.emitter){var t=this._getFitRange(),e=t.fitStart,i=t.fitEnd,n={start:new Date(e),end:new Date(i),animation:!0};this.emitter.emit("fit",n)}}},{key:"_getItemData",value:function(){return this.data}}]),i}(DA);function VA(t,e){var i=void 0!==Ic&&Ta(t)||t["@@iterator"];if(!i){if(qc(t)||(i=function(t,e){var i;if(!t)return;if("string"==typeof t)return UA(t,e);var n=Hc(i=Object.prototype.toString.call(t)).call(i,8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return sa(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return UA(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function UA(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0){if(e>=1)return[];s=Math.abs(Math.round(Math.log(100/e)/Math.log(2))),a=Math.abs(Math.pow(2,s))}if(this.dataChanged){var l=s!=this.cacheLevel;(!this.applyOnChangedLevel||l)&&(this._dropLevelsCache(),this._filterData())}this.cacheLevel=s;var h=this.cache[s];if(!h){for(var u in h=[],this.groups)if(this.groups.hasOwnProperty(u))for(var d=this.groups[u],c=d.length,p=0;p=0&&f.center-d[v].center=0&&f.center-h[y].centerr){for(var b=m-r+1,_=[],w=p;_.length'+t.length+"",f=Nf({},n,this.itemSet.options),m={content:p,title:c,group:e,uiItems:t,eventEmitter:this.itemSet.body.emitter,range:this.itemSet.body.range};return o=this.createClusterItem(m,d,f),e&&(e.add(o),o.group=e),o.attach(),o}},{key:"_dropLevelsCache",value:function(){this.cache={},this.cacheLevel=-1,this.cache[this.cacheLevel]=[]}}]),t}();pP('.vis-itemset{box-sizing:border-box;margin:0;padding:0;position:relative}.vis-itemset .vis-background,.vis-itemset .vis-foreground{height:100%;overflow:visible;position:absolute;width:100%}.vis-axis{height:0;left:0;position:absolute;width:100%;z-index:1}.vis-foreground .vis-group{border-bottom:1px solid #bfbfbf;box-sizing:border-box;position:relative}.vis-foreground .vis-group:last-child{border-bottom:none}.vis-nesting-group{cursor:pointer}.vis-label.vis-nested-group.vis-group-level-unknown-but-gte1{background:#f5f5f5}.vis-label.vis-nested-group.vis-group-level-0{background-color:#fff}.vis-ltr .vis-label.vis-nested-group.vis-group-level-0 .vis-inner{padding-left:0}.vis-rtl .vis-label.vis-nested-group.vis-group-level-0 .vis-inner{padding-right:0}.vis-label.vis-nested-group.vis-group-level-1{background-color:rgba(0,0,0,.05)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-1 .vis-inner{padding-left:15px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-1 .vis-inner{padding-right:15px}.vis-label.vis-nested-group.vis-group-level-2{background-color:rgba(0,0,0,.1)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-2 .vis-inner{padding-left:30px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-2 .vis-inner{padding-right:30px}.vis-label.vis-nested-group.vis-group-level-3{background-color:rgba(0,0,0,.15)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-3 .vis-inner{padding-left:45px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-3 .vis-inner{padding-right:45px}.vis-label.vis-nested-group.vis-group-level-4{background-color:rgba(0,0,0,.2)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-4 .vis-inner{padding-left:60px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-4 .vis-inner{padding-right:60px}.vis-label.vis-nested-group.vis-group-level-5{background-color:rgba(0,0,0,.25)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-5 .vis-inner{padding-left:75px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-5 .vis-inner{padding-right:75px}.vis-label.vis-nested-group.vis-group-level-6{background-color:rgba(0,0,0,.3)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-6 .vis-inner{padding-left:90px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-6 .vis-inner{padding-right:90px}.vis-label.vis-nested-group.vis-group-level-7{background-color:rgba(0,0,0,.35)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-7 .vis-inner{padding-left:105px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-7 .vis-inner{padding-right:105px}.vis-label.vis-nested-group.vis-group-level-8{background-color:rgba(0,0,0,.4)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-8 .vis-inner{padding-left:120px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-8 .vis-inner{padding-right:120px}.vis-label.vis-nested-group.vis-group-level-9{background-color:rgba(0,0,0,.45)}.vis-ltr .vis-label.vis-nested-group.vis-group-level-9 .vis-inner{padding-left:135px}.vis-rtl .vis-label.vis-nested-group.vis-group-level-9 .vis-inner{padding-right:135px}.vis-label.vis-nested-group{background-color:rgba(0,0,0,.5)}.vis-ltr .vis-label.vis-nested-group .vis-inner{padding-left:150px}.vis-rtl .vis-label.vis-nested-group .vis-inner{padding-right:150px}.vis-group-level-unknown-but-gte1{border:1px solid red}.vis-label.vis-nesting-group:before{display:inline-block;width:15px}.vis-label.vis-nesting-group.expanded:before{content:"\\25BC"}.vis-label.vis-nesting-group.collapsed:before{content:"\\25B6"}.vis-rtl .vis-label.vis-nesting-group.collapsed:before{content:"\\25C0"}.vis-ltr .vis-label:not(.vis-nesting-group):not(.vis-group-level-0){padding-left:15px}.vis-rtl .vis-label:not(.vis-nesting-group):not(.vis-group-level-0){padding-right:15px}.vis-overlay{height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}');function $A(t,e){var i=void 0!==Ic&&Ta(t)||t["@@iterator"];if(!i){if(qc(t)||(i=function(t,e){var i;if(!t)return;if("string"==typeof t)return ZA(t,e);var n=Hc(i=Object.prototype.toString.call(t)).call(i,8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return sa(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ZA(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function ZA(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0){var n,r=o.groupsData.getDataSet();Hp(n=r.get()).call(n,(function(t){if(t.nestedGroups){var e;0!=t.showNested&&(t.showNested=!0);var n=[];Hp(e=t.nestedGroups).call(e,(function(e){var i=r.get(e);i&&(i.nestedInGroup=t.id,0==t.showNested&&(i.visible=!1),n=Yc(n).call(n,i))})),r.update(n,i)}}))}},update:function(t,e,i){o._onUpdateGroups(e.items)},remove:function(t,e,i){o._onRemoveGroups(e.items)}},r.items={},r.groups={},r.groupIds=[],r.selection=[],r.popup=null,r.popupTimer=null,r.touchParams={},r.groupTouchParams={group:null,isDragging:!1},r._create(),r.setOptions(n),r.clusters=[],r}return Yd(i,[{key:"_create",value:function(){var t,e,i,n,r,o,s,a,l,h,u,d,c,p,f,m=this,v=document.createElement("div");v.className="vis-itemset",v["vis-itemset"]=this,this.dom.frame=v;var g=document.createElement("div");g.className="vis-background",v.appendChild(g),this.dom.background=g;var y=document.createElement("div");y.className="vis-foreground",v.appendChild(y),this.dom.foreground=y;var b=document.createElement("div");b.className="vis-axis",this.dom.axis=b;var _=document.createElement("div");_.className="vis-labelset",this.dom.labelSet=_,this._updateUngrouped();var w=new wA(QA,null,this);w.show(),this.groups[QA]=w,this.hammer=new uP(this.body.dom.centerContainer),this.hammer.on("hammer.input",(function(t){t.isFirst&&m._onTouch(t)})),this.hammer.on("panstart",Tp(t=this._onDragStart).call(t,this)),this.hammer.on("panmove",Tp(e=this._onDrag).call(e,this)),this.hammer.on("panend",Tp(i=this._onDragEnd).call(i,this)),this.hammer.get("pan").set({threshold:5,direction:uP.ALL}),this.hammer.get("press").set({time:1e4}),this.hammer.on("tap",Tp(n=this._onSelectItem).call(n,this)),this.hammer.on("press",Tp(r=this._onMultiSelectItem).call(r,this)),this.hammer.get("press").set({time:1e4}),this.hammer.on("doubletap",Tp(o=this._onAddItem).call(o,this)),this.options.rtl?this.groupHammer=new uP(this.body.dom.rightContainer):this.groupHammer=new uP(this.body.dom.leftContainer),this.groupHammer.on("tap",Tp(s=this._onGroupClick).call(s,this)),this.groupHammer.on("panstart",Tp(a=this._onGroupDragStart).call(a,this)),this.groupHammer.on("panmove",Tp(l=this._onGroupDrag).call(l,this)),this.groupHammer.on("panend",Tp(h=this._onGroupDragEnd).call(h,this)),this.groupHammer.get("pan").set({threshold:5,direction:uP.DIRECTION_VERTICAL}),this.body.dom.centerContainer.addEventListener("mouseover",Tp(u=this._onMouseOver).call(u,this)),this.body.dom.centerContainer.addEventListener("mouseout",Tp(d=this._onMouseOut).call(d,this)),this.body.dom.centerContainer.addEventListener("mousemove",Tp(c=this._onMouseMove).call(c,this)),this.body.dom.centerContainer.addEventListener("contextmenu",Tp(p=this._onDragEnd).call(p,this)),this.body.dom.centerContainer.addEventListener("mousewheel",Tp(f=this._onMouseWheel).call(f,this)),this.show()}},{key:"setOptions",value:function(t){var e=this;if(t){var i,n;wE.selectiveExtend(["type","rtl","align","order","stack","stackSubgroups","selectable","multiselect","sequentialSelection","multiselectPerGroup","longSelectPressTime","groupOrder","dataAttributes","template","groupTemplate","visibleFrameTemplate","hide","snap","groupOrderSwap","showTooltips","tooltip","tooltipOnItemUpdateTime","groupHeightMode","onTimeout"],this.options,t),"itemsAlwaysDraggable"in t&&("boolean"==typeof t.itemsAlwaysDraggable?(this.options.itemsAlwaysDraggable.item=t.itemsAlwaysDraggable,this.options.itemsAlwaysDraggable.range=!1):"object"===Nd(t.itemsAlwaysDraggable)&&(wE.selectiveExtend(["item","range"],this.options.itemsAlwaysDraggable,t.itemsAlwaysDraggable),this.options.itemsAlwaysDraggable.item||(this.options.itemsAlwaysDraggable.range=!1))),"sequentialSelection"in t&&"boolean"==typeof t.sequentialSelection&&(this.options.sequentialSelection=t.sequentialSelection),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.item="top"===t.orientation?"top":"bottom":"object"===Nd(t.orientation)&&"item"in t.orientation&&(this.options.orientation.item=t.orientation.item)),"margin"in t&&("number"==typeof t.margin?(this.options.margin.axis=t.margin,this.options.margin.item.horizontal=t.margin,this.options.margin.item.vertical=t.margin):"object"===Nd(t.margin)&&(wE.selectiveExtend(["axis"],this.options.margin,t.margin),"item"in t.margin&&("number"==typeof t.margin.item?(this.options.margin.item.horizontal=t.margin.item,this.options.margin.item.vertical=t.margin.item):"object"===Nd(t.margin.item)&&wE.selectiveExtend(["horizontal","vertical"],this.options.margin.item,t.margin.item)))),Hp(i=["locale","locales"]).call(i,(function(i){i in t&&(e.options[i]=t[i])})),"editable"in t&&("boolean"==typeof t.editable?(this.options.editable.updateTime=t.editable,this.options.editable.updateGroup=t.editable,this.options.editable.add=t.editable,this.options.editable.remove=t.editable,this.options.editable.overrideItems=!1):"object"===Nd(t.editable)&&wE.selectiveExtend(["updateTime","updateGroup","add","remove","overrideItems"],this.options.editable,t.editable)),"groupEditable"in t&&("boolean"==typeof t.groupEditable?(this.options.groupEditable.order=t.groupEditable,this.options.groupEditable.add=t.groupEditable,this.options.groupEditable.remove=t.groupEditable):"object"===Nd(t.groupEditable)&&wE.selectiveExtend(["order","add","remove"],this.options.groupEditable,t.groupEditable));Hp(n=["onDropObjectOnItem","onAdd","onUpdate","onRemove","onMove","onMoving","onAddGroup","onMoveGroup","onRemoveGroup"]).call(n,(function(i){var n=t[i];if(n){var r;if("function"!=typeof n)throw new Error(Yc(r="option ".concat(i," must be a function ")).call(r,i,"(item, callback)"));e.options[i]=n}})),t.cluster?(Nf(this.options,{cluster:t.cluster}),this.clusterGenerator||(this.clusterGenerator=new qA(this)),this.clusterGenerator.setItems(this.items,{applyOnChangedLevel:!1}),this.markDirty({refreshItems:!0,restackGroups:!0}),this.redraw()):this.clusterGenerator?(this._detachAllClusters(),this.clusters=[],this.clusterGenerator=null,this.options.cluster=void 0,this.markDirty({refreshItems:!0,restackGroups:!0}),this.redraw()):this.markDirty()}}},{key:"markDirty",value:function(t){this.groupIds=[],t&&(t.refreshItems&&Hp(wE).call(wE,this.items,(function(t){t.dirty=!0,t.displayed&&t.redraw()})),t.restackGroups&&Hp(wE).call(wE,this.groups,(function(t,e){e!==QA&&(t.stackDirty=!0)})))}},{key:"destroy",value:function(){this.clearPopupTimer(),this.hide(),this.setItems(null),this.setGroups(null),this.hammer&&this.hammer.destroy(),this.groupHammer&&this.groupHammer.destroy(),this.hammer=null,this.body=null,this.conversion=null}},{key:"hide",value:function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.axis.parentNode&&this.dom.axis.parentNode.removeChild(this.dom.axis),this.dom.labelSet.parentNode&&this.dom.labelSet.parentNode.removeChild(this.dom.labelSet)}},{key:"show",value:function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame),this.dom.axis.parentNode||this.body.dom.backgroundVertical.appendChild(this.dom.axis),this.dom.labelSet.parentNode||(this.options.rtl?this.body.dom.right.appendChild(this.dom.labelSet):this.body.dom.left.appendChild(this.dom.labelSet))}},{key:"setPopupTimer",value:function(t){if(this.clearPopupTimer(),t){var e=this.options.tooltip.delay||"number"==typeof this.options.tooltip.delay?this.options.tooltip.delay:500;this.popupTimer=Rv((function(){t.show()}),e)}}},{key:"clearPopupTimer",value:function(){null!=this.popupTimer&&(clearTimeout(this.popupTimer),this.popupTimer=null)}},{key:"setSelection",value:function(t){var e;null==t&&(t=[]),qc(t)||(t=[t]);var i,n=mm(e=this.selection).call(e,(function(e){return-1===av(t).call(t,e)})),r=$A(n);try{for(r.s();!(i=r.n()).done;){var o=i.value,s=this.getItemById(o);s&&s.unselect()}}catch(t){r.e(t)}finally{r.f()}this.selection=Ac(t);var a,l=$A(t);try{for(l.s();!(a=l.n()).done;){var h=a.value,u=this.getItemById(h);u&&u.select()}}catch(t){l.e(t)}finally{l.f()}}},{key:"getSelection",value:function(){var t;return Yc(t=this.selection).call(t,[])}},{key:"getVisibleItems",value:function(){var t,e,i=this.body.range.getRange();this.options.rtl?(t=this.body.util.toScreen(i.start),e=this.body.util.toScreen(i.end)):(e=this.body.util.toScreen(i.start),t=this.body.util.toScreen(i.end));var n=[];for(var r in this.groups)if(this.groups.hasOwnProperty(r)){var o,s=this.groups[r],a=$A(s.isVisible?s.visibleItems:[]);try{for(a.s();!(o=a.n()).done;){var l=o.value;this.options.rtl?l.rightt&&n.push(l.id):l.lefte&&n.push(l.id)}}catch(t){a.e(t)}finally{a.f()}}return n}},{key:"getItemsAtCurrentTime",value:function(t){var e,i;this.options.rtl?(e=this.body.util.toScreen(t),i=this.body.util.toScreen(t)):(i=this.body.util.toScreen(t),e=this.body.util.toScreen(t));var n=[];for(var r in this.groups)if(this.groups.hasOwnProperty(r)){var o,s=this.groups[r],a=$A(s.isVisible?s.visibleItems:[]);try{for(a.s();!(o=a.n()).done;){var l=o.value;this.options.rtl?l.righte&&n.push(l.id):l.lefti&&n.push(l.id)}}catch(t){a.e(t)}finally{a.f()}}return n}},{key:"getVisibleGroups",value:function(){var t=[];for(var e in this.groups){if(this.groups.hasOwnProperty(e))this.groups[e].isVisible&&t.push(e)}return t}},{key:"getItemById",value:function(t){var e;return this.items[t]||qP(e=this.clusters).call(e,(function(e){return e.id===t}))}},{key:"_deselect",value:function(t){for(var e=this.selection,i=0,n=e.length;i0){for(var _={},w=function(t){Hp(wE).call(wE,y,(function(e,i){_[i]=e[t]()}))},k=0;k1&&void 0!==arguments[1]?arguments[1]:void 0;if(t&&t.nestedGroups){var i=this.groupsData.getDataSet();t.showNested=null!=e?!!e:!t.showNested;var n=i.get(t.groupId);n.showNested=t.showNested;for(var r,o=t.nestedGroups,s=o;s.length>0;){var a=s;s=[];for(var l=0;l0&&(o=Yc(o).call(o,s))}if(n.showNested){for(var u=i.get(n.nestedGroups),d=0;d0&&(null==c.showNested||1==c.showNested)&&u.push.apply(u,Ac(i.get(c.nestedGroups)))}r=ep(u).call(u,(function(t){return null==t.visible&&(t.visible=!0),t.visible=!!n.showNested,t}))}else{var p;r=ep(p=i.get(o)).call(p,(function(t){return null==t.visible&&(t.visible=!0),t.visible=!!n.showNested,t}))}i.update(Yc(r).call(r,n)),n.showNested?(wE.removeClassName(t.dom.label,"collapsed"),wE.addClassName(t.dom.label,"expanded")):(wE.removeClassName(t.dom.label,"expanded"),wE.addClassName(t.dom.label,"collapsed"))}}},{key:"toggleGroupDragClassName",value:function(t){t.dom.label.classList.toggle("vis-group-is-dragging"),t.dom.foreground.classList.toggle("vis-group-is-dragging")}},{key:"_onGroupDragStart",value:function(t){this.groupTouchParams.isDragging||this.options.groupEditable.order&&(this.groupTouchParams.group=this.groupFromTarget(t),this.groupTouchParams.group&&(t.stopPropagation(),this.groupTouchParams.isDragging=!0,this.toggleGroupDragClassName(this.groupTouchParams.group),this.groupTouchParams.originalOrder=this.groupsData.getIds({order:this.options.groupOrder})))}},{key:"_onGroupDrag",value:function(t){if(this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this.groupsData.getDataSet(),i=this.groupFromTarget(t);if(i&&i.height!=this.groupTouchParams.group.height){var n=i.topr)return}}if(i&&i!=this.groupTouchParams.group){var l=e.get(i.groupId),h=e.get(this.groupTouchParams.group.groupId);h&&l&&(this.options.groupOrderSwap(h,l,e),e.update(h),e.update(l));var u=e.getIds({order:this.options.groupOrder});if(!wE.equalArray(u,this.groupTouchParams.originalOrder))for(var d=this.groupTouchParams.originalOrder,c=this.groupTouchParams.group.groupId,p=Math.min(d.length,u.length),f=0,m=0,v=0;f=p)break;if(u[f+m]==c)m=1;else if(d[f+v]==c)v=1;else{var g=av(u).call(u,d[f+v]),y=e.get(u[f+m]),b=e.get(d[f+v]);this.options.groupOrderSwap(y,b,e),e.update(y),e.update(b);var _=u[f+m];u[f+m]=d[f+v],u[g]=_,f++}}}}}},{key:"_onGroupDragEnd",value:function(t){if(this.groupTouchParams.isDragging=!1,this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this,i=e.groupTouchParams.group.groupId,n=e.groupsData.getDataSet(),r=wE.extend({},n.get(i));e.options.onMoveGroup(r,(function(t){if(t)t[n._idProp]=i,n.update(t);else{var r=n.getIds({order:e.options.groupOrder});if(!wE.equalArray(r,e.groupTouchParams.originalOrder))for(var o=e.groupTouchParams.originalOrder,s=Math.min(o.length,r.length),a=0;a=s)break;var l=av(r).call(r,o[a]),h=n.get(r[a]),u=n.get(o[a]);e.options.groupOrderSwap(h,u,n),n.update(h),n.update(u);var d=r[a];r[a]=o[a],r[l]=d,a++}}})),e.body.emitter.emit("groupDragged",{groupId:i}),this.toggleGroupDragClassName(this.groupTouchParams.group),this.groupTouchParams.group=null}}},{key:"_onSelectItem",value:function(t){if(this.options.selectable){var e=t.srcEvent&&(t.srcEvent.ctrlKey||t.srcEvent.metaKey),i=t.srcEvent&&t.srcEvent.shiftKey;if(e||i)this._onMultiSelectItem(t);else{var n=this.getSelection(),r=this.itemFromTarget(t),o=r&&r.selectable?[r.id]:[];this.setSelection(o);var s=this.getSelection();(s.length>0||n.length>0)&&this.body.emitter.emit("select",{items:s,event:t})}}}},{key:"_onMouseOver",value:function(t){var e=this.itemFromTarget(t);if(e&&e!==this.itemFromRelatedTarget(t)){var i=e.getTitle();if(this.options.showTooltips&&i){null==this.popup&&(this.popup=new IA(this.body.dom.root,this.options.tooltip.overflowMethod||"flip")),this.popup.setText(i);var n=this.body.dom.centerContainer,r=n.getBoundingClientRect();this.popup.setPosition(t.clientX-r.left+n.offsetLeft,t.clientY-r.top+n.offsetTop),this.setPopupTimer(this.popup)}else this.clearPopupTimer(),null!=this.popup&&this.popup.hide();this.body.emitter.emit("itemover",{item:e.id,event:t})}}},{key:"_onMouseOut",value:function(t){var e=this.itemFromTarget(t);e&&(e!==this.itemFromRelatedTarget(t)&&(this.clearPopupTimer(),null!=this.popup&&this.popup.hide(),this.body.emitter.emit("itemout",{item:e.id,event:t})))}},{key:"_onMouseMove",value:function(t){if(this.itemFromTarget(t)&&(null!=this.popupTimer&&this.setPopupTimer(this.popup),this.options.showTooltips&&this.options.tooltip.followMouse&&this.popup&&!this.popup.hidden)){var e=this.body.dom.centerContainer,i=e.getBoundingClientRect();this.popup.setPosition(t.clientX-i.left+e.offsetLeft,t.clientY-i.top+e.offsetTop),this.popup.show()}}},{key:"_onMouseWheel",value:function(t){this.touchParams.itemIsDragging&&this._onDragEnd(t)}},{key:"_onUpdateItem",value:function(t){if(this.options.selectable&&(this.options.editable.updateTime||this.options.editable.updateGroup)){var e=this;if(t){var i=e.itemsData.get(t.id);this.options.onUpdate(i,(function(t){t&&e.itemsData.update(t)}))}}}},{key:"_onDropObjectOnItem",value:function(t){var e=this.itemFromTarget(t),i=JSON.parse(t.dataTransfer.getData("text"));this.options.onDropObjectOnItem(i,e)}},{key:"_onAddItem",value:function(t){if(this.options.selectable&&this.options.editable.add){var e,i,n=this,r=this.options.snap||null,o=this.dom.frame.getBoundingClientRect(),s=this.options.rtl?o.right-t.center.x:t.center.x-o.left,a=this.body.util.toTime(s),l=this.body.util.getScale(),h=this.body.util.getStep();"drop"==t.type?((i=JSON.parse(t.dataTransfer.getData("text"))).content=i.content?i.content:"new item",i.start=i.start?i.start:r?r(a,l,h):a,i.type=i.type||"box",i[this.itemsData.idProp]=i.id||VM(),"range"!=i.type||i.end||(e=this.body.util.toTime(s+this.props.width/5),i.end=r?r(e,l,h):e)):((i={start:r?r(a,l,h):a,content:"new item"})[this.itemsData.idProp]=VM(),"range"===this.options.type&&(e=this.body.util.toTime(s+this.props.width/5),i.end=r?r(e,l,h):e));var u=this.groupFromTarget(t);u&&(i.group=u.groupId),i=this._cloneItemData(i),this.options.onAdd(i,(function(e){e&&(n.itemsData.add(e),"drop"==t.type&&n.setSelection([e.id]))}))}}},{key:"_onMultiSelectItem",value:function(t){var e=this;if(this.options.selectable){var n=this.itemFromTarget(t);if(n){var r=this.options.multiselect?this.getSelection():[];if((t.srcEvent&&t.srcEvent.shiftKey||!1||this.options.sequentialSelection)&&this.options.multiselect){var o=this.itemsData.get(n.id).group,s=void 0;this.options.multiselectPerGroup&&r.length>0&&(s=this.itemsData.get(r[0]).group),this.options.multiselectPerGroup&&null!=s&&s!=o||r.push(n.id);var a=i._getItemRange(this.itemsData.get(r));if(!this.options.multiselectPerGroup||s==o)for(var l in r=[],this.items)if(this.items.hasOwnProperty(l)){var h=this.items[l],u=h.data.start,d=void 0!==h.data.end?h.data.end:u;!(u>=a.min&&d<=a.max)||this.options.multiselectPerGroup&&s!=this.itemsData.get(h.id).group||h instanceof AA||r.push(h.id)}}else{var c=av(r).call(r,n.id);-1==c?r.push(n.id):_f(r).call(r,c,1)}var p=mm(r).call(r,(function(t){return e.getItemById(t).selectable}));this.setSelection(p),this.body.emitter.emit("select",{items:this.getSelection(),event:t})}}}},{key:"itemFromElement",value:function(t){for(var e=t;e;){if(e.hasOwnProperty("vis-item"))return e["vis-item"];e=e.parentNode}return null}},{key:"itemFromTarget",value:function(t){return this.itemFromElement(t.target)}},{key:"itemFromRelatedTarget",value:function(t){return this.itemFromElement(t.relatedTarget)}},{key:"groupFromTarget",value:function(t){var e=t.center?t.center.y:t.clientY,i=this.groupIds;i.length<=0&&this.groupsData&&(i=this.groupsData.getIds({order:this.options.groupOrder}));for(var n=0;n=a.top&&ea.top)return o}else if(0===n&&ee)&&(e=t.end):(null==e||t.start>e)&&(e=t.start)})),{min:i,max:e}}},{key:"itemSetFromTarget",value:function(t){for(var e=t.target;e;){if(e.hasOwnProperty("vis-itemset"))return e["vis-itemset"];e=e.parentNode}return null}}]),i}(IE);tI.types={background:AA,box:CA,range:EA,point:MA},tI.prototype._onAdd=tI.prototype._onUpdate;var eI,iI=!1,nI="background: #FFeeee; color: #dd0000",rI=function(){function t(){Ma(this,t)}return Yd(t,null,[{key:"validate",value:function(e,i,n){iI=!1,eI=i;var r=i;return void 0!==n&&(r=i[n]),t.parse(e,r,[]),iI}},{key:"parse",value:function(e,i,n){for(var r in e)e.hasOwnProperty(r)&&t.check(r,e,i,n)}},{key:"check",value:function(e,i,n,r){if(void 0!==n[e]||void 0!==n.__any__){var o=e,s=!0;void 0===n[e]&&void 0!==n.__any__&&(o="__any__",s="object"===t.getType(i[e]));var a=n[o];s&&void 0!==a.__type__&&(a=a.__type__),t.checkFields(e,i,n,o,a,r)}else t.getSuggestion(e,n,r)}},{key:"checkFields",value:function(e,i,n,r,o,s){var a=function(i){console.log("%c"+i+t.printLocation(s,e),nI)},l=t.getType(i[e]),h=o[l];void 0!==h?"array"===t.getType(h)&&-1===av(h).call(h,i[e])?(a('Invalid option detected in "'+e+'". Allowed values are:'+t.print(h)+' not "'+i[e]+'". '),iI=!0):"object"===l&&"__any__"!==r&&(s=wE.copyAndExtendArray(s,e),t.parse(i[e],n[r],s)):void 0===o.any&&(a('Invalid type received for "'+e+'". Expected: '+t.print(rp(o))+". Received ["+l+'] "'+i[e]+'"'),iI=!0)}},{key:"getType",value:function(t){var e=Nd(t);return"object"===e?null===t?"null":t instanceof Boolean?"boolean":t instanceof Number?"number":t instanceof String?"string":qc(t)?"array":t instanceof Date?"date":void 0!==t.nodeType?"dom":!0===t._isAMomentObject?"moment":"object":"number"===e?"number":"boolean"===e?"boolean":"string"===e?"string":void 0===e?"undefined":e}},{key:"getSuggestion",value:function(e,i,n){var r,o=t.findInOptions(e,i,n,!1),s=t.findInOptions(e,eI,[],!0);r=void 0!==o.indexMatch?" in "+t.printLocation(o.path,e,"")+'Perhaps it was incomplete? Did you mean: "'+o.indexMatch+'"?\n\n':s.distance<=4&&o.distance>s.distance?" in "+t.printLocation(o.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(s.path,s.closestMatch,""):o.distance<=8?'. Did you mean "'+o.closestMatch+'"?'+t.printLocation(o.path,e):". Did you mean one of these: "+t.print(rp(i))+t.printLocation(n,e),console.log('%cUnknown option detected: "'+e+'"'+r,nI),iI=!0}},{key:"findInOptions",value:function(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=1e9,s="",a=[],l=e.toLowerCase(),h=void 0;for(var u in i){var d=void 0;if(void 0!==i[u].__type__&&!0===r){var c=t.findInOptions(e,i[u],wE.copyAndExtendArray(n,u));o>c.distance&&(s=c.closestMatch,a=c.path,o=c.distance,h=c.indexMatch)}else{var p;-1!==av(p=u.toLowerCase()).call(p,l)&&(h=u),o>(d=t.levenshteinDistance(e,u))&&(s=u,a=wE.copyArray(n),o=d)}}return{closestMatch:s,path:a,distance:o,indexMatch:h}}},{key:"printLocation",value:function(t,e){for(var i="\n\n"+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n")+"options = {\n",n=0;n0&&void 0!==arguments[0]?arguments[0]:1;Ma(this,t),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return Yd(t,[{key:"insertTo",value:function(t){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=t,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=t}},{key:"setCloseCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=t}},{key:"_isColorString",value:function(t){if("string"==typeof t)return fI[t]}},{key:"setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==t){var i,n=this._isColorString(t);if(void 0!==n&&(t=n),!0===wE.isString(t)){if(!0===wE.isValidRGB(t)){var r=t.substr(4).substr(0,t.length-5).split(",");i={r:r[0],g:r[1],b:r[2],a:1}}else if(!0===wE.isValidRGBA(t)){var o=t.substr(5).substr(0,t.length-6).split(",");i={r:o[0],g:o[1],b:o[2],a:o[3]}}else if(!0===wE.isValidHex(t)){var s=wE.hexToRGB(t);i={r:s.r,g:s.g,b:s.b,a:1}}}else if(t instanceof Object&&void 0!==t.r&&void 0!==t.g&&void 0!==t.b){var a=void 0!==t.a?t.a:"1.0";i={r:t.r,g:t.g,b:t.b,a:a}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+vv(t));this._setColor(i,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var t=this;!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.previousColor=wE.extend({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",Rv((function(){void 0!==t.closeCallback&&(t.closeCallback(),t.closeCallback=void 0)}),0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(t){!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.initialColor=wE.extend({},t)),this.color=t;var e=wE.RGBToHSV(t.r,t.g,t.b),i=2*Math.PI,n=this.r*e.s,r=this.centerCoordinates.x+n*Math.sin(i*e.h),o=this.centerCoordinates.y+n*Math.cos(i*e.h);this.colorPickerSelector.style.left=r-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=o-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(t)}},{key:"_setOpacity",value:function(t){this.color.a=t/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(t){var e=wE.RGBToHSV(this.color.r,this.color.g,this.color.b);e.v=t/100;var i=wE.HSVToRGB(e.h,e.s,e.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=wE.RGBToHSV(t.r,t.g,t.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var n=this.colorPickerCanvas.clientWidth,r=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,n,r),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-e.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),Uv(i).call(i),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*t.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){var t,e,i,n;if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var r=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var o=document.createElement("DIV");o.style.color="red",o.style.fontWeight="bold",o.style.padding="10px",o.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(o)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(t){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(t){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var s=this;this.opacityRange.onchange=function(){s._setOpacity(this.value)},this.opacityRange.oninput=function(){s._setOpacity(this.value)},this.brightnessRange.onchange=function(){s._setBrightness(this.value)},this.brightnessRange.oninput=function(){s._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=Tp(t=this._hide).call(t,this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=Tp(e=this._apply).call(e,this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=Tp(i=this._save).call(i,this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=Tp(n=this._loadLast).call(n,this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var t=this;this.drag={},this.pinch={},this.hammer=new uP(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),dP(this.hammer,(function(e){t._moveSelector(e)})),this.hammer.on("tap",(function(e){t._moveSelector(e)})),this.hammer.on("panstart",(function(e){t._moveSelector(e)})),this.hammer.on("panmove",(function(e){t._moveSelector(e)})),this.hammer.on("panend",(function(e){t._moveSelector(e)}))}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e,i,n,r,o=this.colorPickerCanvas.clientWidth,s=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,o,s),this.centerCoordinates={x:.5*o,y:.5*s},this.r=.49*o;var a,l=2*Math.PI/360,h=1/this.r;for(n=0;n<360;n++)for(r=0;r3&&void 0!==arguments[3]?arguments[3]:1;Ma(this,t),this.parent=e,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},wE.extend(this.options,this.defaultOptions),this.configureOptions=n,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new mI(r),this.wrapper=void 0}return Yd(t,[{key:"setOptions",value:function(t){if(void 0!==t){this.popupHistory={},this._removePopup();var e=!0;if("string"==typeof t)this.options.filter=t;else if(qc(t))this.options.filter=t.join();else if("object"===Nd(t)){if(null==t)throw new TypeError("options cannot be null");void 0!==t.container&&(this.options.container=t.container),void 0!==mm(t)&&(this.options.filter=mm(t)),void 0!==t.showButton&&(this.options.showButton=t.showButton),void 0!==t.enabled&&(e=t.enabled)}else"boolean"==typeof t?(this.options.filter=!0,e=t):"function"==typeof t&&(this.options.filter=t,e=!0);!1===mm(this.options)&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(t){this.moduleOptions=t,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){this._clean(),this.changedOptions=[];var t=mm(this.options),e=0,i=!1;for(var n in this.configureOptions)this.configureOptions.hasOwnProperty(n)&&(this.allowCreation=!1,i=!1,"function"==typeof t?i=(i=t(n,[]))||this._handleObject(this.configureOptions[n],[n],!0):!0!==t&&-1===av(t).call(t,n)||(i=!0),!1!==i&&(this.allowCreation=!0,e>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),e++);this._makeButton(),this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var t=0;t1?i-1:0),r=1;r2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");return n.className="vis-configuration vis-config-label vis-config-s"+e.length,n.innerHTML=!0===i?wE.xss(""+t+":"):wE.xss(t+":"),n}},{key:"_makeDropdown",value:function(t,e,i){var n=document.createElement("select");n.className="vis-configuration vis-config-select";var r=0;void 0!==e&&-1!==av(t).call(t,e)&&(r=av(t).call(t,e));for(var o=0;oo&&1!==o&&(a.max=Math.ceil(e*u),h=a.max,l="range increased"),a.value=e}else a.value=n;var d=document.createElement("input");d.className="vis-configuration vis-config-rangeinput",d.value=Number(a.value);var c=this;a.onchange=function(){d.value=this.value,c._update(Number(this.value),i)},a.oninput=function(){d.value=this.value};var p=this._makeLabel(i[i.length-1],i),f=this._makeItem(i,p,a,d);""!==l&&this.popupHistory[f]!==h&&(this.popupHistory[f]=h,this._setupPopup(l,f))}},{key:"_makeButton",value:function(){var t=this;if(!0===this.options.showButton){var e=document.createElement("div");e.className="vis-configuration vis-config-button",e.innerHTML="generate options",e.onclick=function(){t._printOptions()},e.onmouseover=function(){e.className="vis-configuration vis-config-button hover"},e.onmouseout=function(){e.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(e)}}},{key:"_setupPopup",value:function(t,e){var i=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1,r=mm(this.options),o=!1;for(var s in t)if(t.hasOwnProperty(s)){n=!0;var a=t[s],l=wE.copyAndExtendArray(e,s);if("function"==typeof r&&!1===(n=r(s,e))&&!qc(a)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,n=this._handleObject(a,l,!0),this.allowCreation=!1===i),!1!==n){o=!0;var h=this._getValue(l);if(qc(a))this._handleArray(a,h,l);else if("string"==typeof a)this._makeTextInput(a,h,l);else if("boolean"==typeof a)this._makeCheckbox(a,h,l);else if(a instanceof Object){var u=!0;if(-1!==av(e).call(e,"physics")&&this.moduleOptions.physics.solver!==s&&(u=!1),!0===u)if(void 0!==a.enabled){var d=wE.copyAndExtendArray(l,"enabled"),c=this._getValue(d);if(!0===c){var p=this._makeLabel(s,l,!0);this._makeItem(l,p),o=this._handleObject(a,l)||o}else this._makeCheckbox(a,c,l)}else{var f=this._makeLabel(s,l,!0);this._makeItem(l,f),o=this._handleObject(a,l)||o}}else console.error("dont know how to handle",a,s,l)}}return o}},{key:"_handleArray",value:function(t,e,i){"string"==typeof t[0]&&"color"===t[0]?(this._makeColorField(t,e,i),t[1]!==e&&this.changedOptions.push({path:i,value:e})):"string"==typeof t[0]?(this._makeDropdown(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:e})):"number"==typeof t[0]&&(this._makeRange(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:Number(e)}))}},{key:"_update",value:function(t,e){var i=this._constructOptions(t,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i;t="false"!==(t="true"===t||t)&&t;for(var r=0;rvar options = "+vv(t,null,2)+""}},{key:"getOptions",value:function(){for(var t={},e=0;eo)&&(o=i)})),null!==r&&null!==o){var s=this,a=this.itemSet.items[i[0]],l=-1*this._getScrollTop(),h=null,u=function(){var t=wI(s,a);t.shouldScroll&&t.itemTop!=h.itemTop&&(s._setScrollTop(-t.scrollOffset),s._redraw())},d=!e||void 0===e.zoom||e.zoom,c=(r+o)/2,p=d?1.1*(o-r):Math.max(this.range.end-this.range.start,1.1*(o-r)),f=!e||void 0===e.animation||e.animation;f||(h={shouldScroll:!1,scrollOffset:-1,itemTop:-1}),this.range.setRange(c-p/2,c+p/2,{animation:f},(function(){u(),Rv(u,100)}),(function(t,e,i){var n=wI(s,a);if(!1!==n&&(h||(h=n),h.itemTop!=n.itemTop||h.shouldScroll)){h.itemTop!=n.itemTop&&n.shouldScroll&&(h=n,l=-1*s._getScrollTop());var r=l,o=h.scrollOffset,u=i?o:r+(o-r)*t;s._setScrollTop(-u),e||s._redraw()}}))}}}},{key:"fit",value:function(t,e){var i,n=!t||void 0===t.animation||t.animation;1===this.itemsData.length&&void 0===this.itemsData.get()[0].end?(i=this.getDataRange(),this.moveTo(i.min.valueOf(),{animation:n},e)):(i=this.getItemRange(),this.range.setRange(i.min,i.max,{animation:n},e))}},{key:"getItemRange",value:function(){var t=this,e=this.getDataRange(),i=null!==e.min?e.min.valueOf():null,n=null!==e.max?e.max.valueOf():null,r=null,o=null;if(null!=i&&null!=n){var s=n-i;s<=0&&(s=10);var a=s/this.props.center.width,l={},h=0;if(Hp(wE).call(wE,this.itemSet.items,(function(t,e){if(t.groupShowing){l[e]=t.redraw(!0),h=l[e].length}})),h>0)for(var u=function(t){Hp(wE).call(wE,l,(function(e){e[t]()}))},d=0;dn&&(n=l,o=e)})),r&&o){var c=r.getWidthLeft()+10,p=o.getWidthRight()+10,f=this.props.center.width-c-p;f>0&&(this.options.rtl?(i=bI(r)-p*s/f,n=_I(o)+c*s/f):(i=bI(r)-c*s/f,n=_I(o)+p*s/f))}}return{min:null!=i?new Date(i):null,max:null!=n?new Date(n):null}}},{key:"getDataRange",value:function(){var t,e=null,i=null;this.itemsData&&Hp(t=this.itemsData).call(t,(function(t){var n=wE.convert(t.start,"Date").valueOf(),r=wE.convert(null!=t.end?t.end:t.start,"Date").valueOf();(null===e||ni)&&(i=r)}));return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}}},{key:"getEventProperties",value:function(t){var e=t.center?t.center.x:t.clientX,i=t.center?t.center.y:t.clientY,n=this.dom.centerContainer.getBoundingClientRect(),r=this.options.rtl?n.right-e:e-n.left,o=i-n.top,s=this.itemSet.itemFromTarget(t),a=this.itemSet.groupFromTarget(t),l=NP.customTimeFromTarget(t),h=this.itemSet.options.snap||null,u=this.body.util.getScale(),d=this.body.util.getStep(),c=this._toTime(r),p=h?h(c,u,d):c,f=wE.getTarget(t),m=null;return null!=s?m="item":null!=l?m="custom-time":wE.hasParent(f,this.timeAxis.dom.foreground)||this.timeAxis2&&wE.hasParent(f,this.timeAxis2.dom.foreground)?m="axis":wE.hasParent(f,this.itemSet.dom.labelSet)?m="group-label":wE.hasParent(f,this.currentTime.bar)?m="current-time":wE.hasParent(f,this.dom.center)&&(m="background"),{event:t,item:s?s.id:null,isCluster:!!s&&!!s.isCluster,items:s?s.items||[]:null,group:a?a.groupId:null,customTime:l?l.options.id:null,what:m,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:r,y:o,time:c,snappedTime:p}}},{key:"toggleRollingMode",value:function(){this.range.rolling?this.range.stopRolling():(null==this.options.rollingMode&&this.setOptions(this.options),this.range.startRolling())}},{key:"_redraw",value:function(){RP.prototype._redraw.call(this)}},{key:"_onFit",value:function(t){var e=t.start,i=t.end,n=t.animation;i?this.range.setRange(e,i,{animation:n}):this.moveTo(e.valueOf(),{animation:n})}}]),i}(RP);function bI(t){return wE.convert(t.data.start,"Date").valueOf()}function _I(t){var e=null!=t.data.end?t.data.end:t.data.start;return wE.convert(e,"Date").valueOf()}function wI(t,e){if(!e.parent)return!1;var i=t.options.rtl?t.props.rightContainer.height:t.props.leftContainer.height,n=t.props.center.height,r=e.parent,o=r.top,s=!0,a=t.timeAxis.options.orientation.axis,l=function(){return"bottom"==a?r.height-e.top-e.height:e.top},h=-1*t._getScrollTop(),u=o+l(),d=e.height;return uh+i?o+=l()+d-i+t.itemSet.options.margin.item.vertical:s=!1,{shouldScroll:s,scrollOffset:o=Math.min(o,n-i),itemTop:u}}var kI=function(){function t(e,i,n,r,o,s){var a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],l=arguments.length>7&&void 0!==arguments[7]&&arguments[7];if(Ma(this,t),this.majorSteps=[1,2,5,10],this.minorSteps=[.25,.5,1,2],this.customLines=null,this.containerHeight=o,this.majorCharHeight=s,this._start=e,this._end=i,this.scale=1,this.minorStepIdx=-1,this.magnitudefactor=1,this.determineScale(),this.zeroAlign=a,this.autoScaleStart=n,this.autoScaleEnd=r,this.formattingFunction=l,n||r){var h=this,u=function(t){var e=t-t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx]);return t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx])>h.magnitudefactor*h.minorSteps[h.minorStepIdx]*.5?e+h.magnitudefactor*h.minorSteps[h.minorStepIdx]:e};n&&(this._start-=2*this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._start=u(this._start)),r&&(this._end+=this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._end=u(this._end)),this.determineScale()}}return Yd(t,[{key:"setCharHeight",value:function(t){this.majorCharHeight=t}},{key:"setHeight",value:function(t){this.containerHeight=t}},{key:"determineScale",value:function(){var t=this._end-this._start;this.scale=this.containerHeight/t;var e=this.majorCharHeight/this.scale,i=t>0?Math.round(Math.log(t)/Math.LN10):0;this.minorStepIdx=-1,this.magnitudefactor=Math.pow(10,i);var n=0;i<0&&(n=i);for(var r=!1,o=n;Math.abs(o)<=Math.abs(i);o++){this.magnitudefactor=Math.pow(10,o);for(var s=0;s=e){r=!0,this.minorStepIdx=s;break}}if(!0===r)break}}},{key:"is_major",value:function(t){return t%(this.magnitudefactor*this.majorSteps[this.minorStepIdx])==0}},{key:"getStep",value:function(){return this.magnitudefactor*this.minorSteps[this.minorStepIdx]}},{key:"getFirstMajor",value:function(){var t=this.magnitudefactor*this.majorSteps[this.minorStepIdx];return this.convertValue(this._start+(t-this._start%t)%t)}},{key:"formatValue",value:function(t){var e=t.toPrecision(5);return"function"==typeof this.formattingFunction&&(e=this.formattingFunction(t)),"number"==typeof e?"".concat(e):"string"==typeof e?e:t.toPrecision(5)}},{key:"getLines",value:function(){for(var t=[],e=this.getStep(),i=(e-this._start%e)%e,n=this._start+i;this._end-n>1e-5;n+=e)n!=this._start&&t.push({major:this.is_major(n),y:this.convertValue(n),val:this.formatValue(n)});return t}},{key:"followScale",value:function(t){var e=this.minorStepIdx,i=this._start,n=this._end,r=this,o=function(){r.magnitudefactor*=2},s=function(){r.magnitudefactor/=2};t.minorStepIdx<=1&&this.minorStepIdx<=1||t.minorStepIdx>1&&this.minorStepIdx>1||(t.minorStepIdxn+1e-5)s(),h=!1;else{if(!this.autoScaleStart&&this._start=0)){s(),h=!1;continue}console.warn("Can't adhere to given 'min' range, due to zeroalign")}this.autoScaleStart&&this.autoScaleEnd&&d=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==i.return||i.return()}finally{if(a)throw o}}}}function DI(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0&&t._redrawLabel(n-2,e.val,i,"vis-y-axis vis-major",t.props.majorCharHeight),!0===t.master&&(r?t._redrawLine(n,i,"vis-grid vis-horizontal vis-major",t.options.majorLinesOffset,t.props.majorLineWidth):t._redrawLine(n,i,"vis-grid vis-horizontal vis-minor",t.options.minorLinesOffset,t.props.minorLineWidth))}));var a=0;void 0!==this.options[i].title&&void 0!==this.options[i].title.text&&(a=this.props.titleCharHeight);var l=!0===this.options.icons?Math.max(this.options.iconWidth,a)+this.options.labelOffsetX+15:a+this.options.labelOffsetX+15;return this.maxLabelSize>this.width-l&&!0===this.options.visible?(this.width=this.maxLabelSize+l,this.options.width="".concat(this.width,"px"),Ub(this.DOMelements.lines),Ub(this.DOMelements.labels),this.redraw(),e=!0):this.maxLabelSizethis.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+l),this.options.width="".concat(this.width,"px"),Ub(this.DOMelements.lines),Ub(this.DOMelements.labels),this.redraw(),e=!0):(Ub(this.DOMelements.lines),Ub(this.DOMelements.labels),e=!1),e}},{key:"convertValue",value:function(t){return this.scale.convertValue(t)}},{key:"screenToValue",value:function(t){return this.scale.screenToValue(t)}},{key:"_redrawLabel",value:function(t,e,i,n,r){var o=$b("div",this.DOMelements.labels,this.dom.frame);o.className=n,o.innerHTML=wE.xss(e),"left"===i?(o.style.left="-".concat(this.options.labelOffsetX,"px"),o.style.textAlign="right"):(o.style.right="-".concat(this.options.labelOffsetX,"px"),o.style.textAlign="left"),o.style.top="".concat(t-.5*r+this.options.labelOffsetY,"px"),e+="";var s=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSize0&&(i=Math.min(i,Math.abs(e[n-1].screen_x-e[n].screen_x))),0===i&&(void 0===t[e[n].screen_x]&&(t[e[n].screen_x]={amount:0,resolved:0,accumulatedPositive:0,accumulatedNegative:0}),t[e[n].screen_x].amount+=1)},OI._getSafeDrawData=function(t,e,i){var n,r;return t0?(n=t0){_T(t).call(t,(function(t,e){return t.screen_x===e.screen_x?t.groupIde[o].screen_y?e[o].screen_y:n,r=rt[s].accumulatedNegative?t[s].accumulatedNegative:n)>t[s].accumulatedPositive?t[s].accumulatedPositive:n,r=(r=r0){return 1==e.options.interpolation.enabled?EI._catmullRom(t,e):EI._linear(t)}},EI.drawIcon=function(t,e,i,n,r,o){var s,a,l=.5*r,h=qb("rect",o.svgElements,o.svg);(h.setAttributeNS(null,"x",e),h.setAttributeNS(null,"y",i-l),h.setAttributeNS(null,"width",n),h.setAttributeNS(null,"height",2*l),h.setAttributeNS(null,"class","vis-outline"),(s=qb("path",o.svgElements,o.svg)).setAttributeNS(null,"class",t.className),void 0!==t.style&&s.setAttributeNS(null,"style",t.style),s.setAttributeNS(null,"d","M"+e+","+i+" L"+(e+n)+","+i),1==t.options.shaded.enabled&&(a=qb("path",o.svgElements,o.svg),"top"==t.options.shaded.orientation?a.setAttributeNS(null,"d","M"+e+", "+(i-l)+"L"+e+","+i+" L"+(e+n)+","+i+" L"+(e+n)+","+(i-l)):a.setAttributeNS(null,"d","M"+e+","+i+" L"+e+","+(i+l)+" L"+(e+n)+","+(i+l)+"L"+(e+n)+","+i),a.setAttributeNS(null,"class",t.className+" vis-icon-fill"),void 0!==t.options.shaded.style&&""!==t.options.shaded.style&&a.setAttributeNS(null,"style",t.options.shaded.style)),1==t.options.drawPoints.enabled)&&Zb(e+.5*n,i,{style:t.options.drawPoints.style,styles:t.options.drawPoints.styles,size:t.options.drawPoints.size,className:t.className},o.svgElements,o.svg)},EI.drawShading=function(t,e,i,n){if(1==e.options.shaded.enabled){var r,o=Number(n.svg.style.height.replace("px","")),s=qb("path",n.svgElements,n.svg),a="L";1==e.options.interpolation.enabled&&(a="C");var l=0;l="top"==e.options.shaded.orientation?0:"bottom"==e.options.shaded.orientation?o:Math.min(Math.max(0,e.zeroPosition),o),r="group"==e.options.shaded.orientation&&null!=i&&null!=i?"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" L"+i[i.length-1][0]+","+i[i.length-1][1]+" "+this.serializePath(i,a,!0)+i[0][0]+","+i[0][1]+" Z":"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" V"+l+" H"+t[0][0]+" Z",s.setAttributeNS(null,"class",e.className+" vis-fill"),void 0!==e.options.shaded.style&&s.setAttributeNS(null,"style",e.options.shaded.style),s.setAttributeNS(null,"d",r)}},EI.draw=function(t,e,i){if(null!=t&&null!=t){var n=qb("path",i.svgElements,i.svg);n.setAttributeNS(null,"class",e.className),void 0!==e.style&&n.setAttributeNS(null,"style",e.style);var r="L";1==e.options.interpolation.enabled&&(r="C"),n.setAttributeNS(null,"d","M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,r,!1))}},EI.serializePath=function(t,e,i){if(t.length<2)return"";var n,r=e;if(i)for(n=t.length-2;n>0;n--)r+=t[n][0]+","+t[n][1]+" ";else for(n=1;n0&&(f=1/f),(m=3*v*(v+g))>0&&(m=1/m),a={screen_x:(-b*n.screen_x+c*r.screen_x+_*o.screen_x)*f,screen_y:(-b*n.screen_y+c*r.screen_y+_*o.screen_y)*f},l={screen_x:(y*r.screen_x+p*o.screen_x-b*s.screen_x)*m,screen_y:(y*r.screen_y+p*o.screen_y-b*s.screen_y)*m},0==a.screen_x&&0==a.screen_y&&(a=r),0==l.screen_x&&0==l.screen_y&&(l=o),k.push([a.screen_x,a.screen_y]),k.push([l.screen_x,l.screen_y]),k.push([o.screen_x,o.screen_y]);return k},EI._linear=function(t){for(var e=[],i=0;ie.x?1:-1}))):this.itemsData=[]},PI.prototype.getItems=function(){return this.itemsData},PI.prototype.setZeroPosition=function(t){this.zeroPosition=t},PI.prototype.setOptions=function(t){if(void 0!==t){wE.selectiveDeepExtend(["sampling","style","sort","yAxisOrientation","barChart","zIndex","excludeFromStacking","excludeFromLegend"],this.options,t),"function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),wE.mergeOptions(this.options,t,"interpolation"),wE.mergeOptions(this.options,t,"drawPoints"),wE.mergeOptions(this.options,t,"shaded"),t.interpolation&&"object"==Nd(t.interpolation)&&t.interpolation.parametrization&&("uniform"==t.interpolation.parametrization?this.options.interpolation.alpha=0:"chordal"==t.interpolation.parametrization?this.options.interpolation.alpha=1:(this.options.interpolation.parametrization="centripetal",this.options.interpolation.alpha=.5))}},PI.prototype.update=function(t){this.group=t,this.content=t.content||"graph",this.className=t.className||this.className||"vis-graph-group"+this.groupsUsingDefaultStyles[0]%10,this.visible=void 0===t.visible||t.visible,this.style=t.style,this.setOptions(t.options)},PI.prototype.getLegend=function(t,e,i,n,r){null!=i&&null!=i||(i={svg:document.createElementNS("http://www.w3.org/2000/svg","svg"),svgElements:{},options:this.options,groups:[this]});switch(null!=n&&null!=n||(n=0),null!=r&&null!=r||(r=.5*e),this.options.style){case"line":EI.drawIcon(this,n,r,t,e,i);break;case"points":case"point":TI.drawIcon(this,n,r,t,e,i);break;case"bar":OI.drawIcon(this,n,r,t,e,i)}return{icon:i.svg,label:this.content,orientation:this.options.yAxisOrientation}},PI.prototype.getYRange=function(t){for(var e=t[0].y,i=t[0].y,n=0;nt[n].y?t[n].y:e,i=i");this.dom.textArea.innerHTML=wE.xss(o),this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},AI.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){var t=rp(this.groups);_T(t).call(t,(function(t,e){return t0){var s={};for(this._getRelevantData(o,s,n,r),this._applySampling(o,s),e=0;e0)switch(t.options.style){case"line":l.hasOwnProperty(o[e])||(l[o[e]]=EI.calcPath(s[o[e]],t)),EI.draw(l[o[e]],t,this.framework);case"point":case"points":"point"!=t.options.style&&"points"!=t.options.style&&1!=t.options.drawPoints.enabled||TI.draw(s[o[e]],t,this.framework)}}}return Ub(this.svgElements),!1},LI.prototype._stack=function(t,e){var i,n,r,o,s;i=0;for(var a=0;at[a].x){s=e[l],o=0==l?s:e[l-1],i=l;break}}void 0===s&&(o=e[e.length-1],s=e[e.length-1]),n=s.x-o.x,r=s.y-o.y,t[a].y=0==n?t[a].orginalY+s.y:t[a].orginalY+r/n*(t[a].x-o.x)+o.y}},LI.prototype._getRelevantData=function(t,e,i,n){var r,o,s,a;if(t.length>0)for(o=0;o0)for(var i=0;i0){var r,o=n.length,s=o/(this.body.util.toGlobalScreen(n[n.length-1].x)-this.body.util.toGlobalScreen(n[0].x));r=Math.min(Math.ceil(.2*o),Math.max(1,Math.round(s)));for(var a=new Array(o),l=0;l0){for(o=0;o0&&(r=this.groups[t[o]],!0===s.stack&&"bar"===s.style?"left"===s.yAxisOrientation?a=Yc(a).call(a,n):l=Yc(l).call(l,n):i[t[o]]=r.getYRange(n,t[o]));OI.getStackedYRange(a,i,t,"__barStackLeft","left"),OI.getStackedYRange(l,i,t,"__barStackRight","right")}},LI.prototype._updateYAxis=function(t,e){var i,n,r=!1,o=!1,s=!1,a=1e9,l=1e9,h=-1e9,u=-1e9;if(t.length>0){for(var d=0;di?i:a,h=hi?i:l,u=uo?o:t,e=null==e||e0&&h.push(u.screenToValue(r)),!d.hidden&&this.itemsData.length>0&&h.push(d.screenToValue(r)),{event:t,customTime:s?s.options.id:null,what:l,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:n,y:r,time:o,value:h}},GI.prototype._createConfigurator=function(){return new vI(this,this.dom.container,BI)};var WI=Jb();sO.locale(WI);var VI={Core:RP,DateUtil:nP,Range:oP,stack:gA,TimeStep:cP,components:{items:{Item:DA,BackgroundItem:AA,BoxItem:CA,ClusterItem:WA,PointItem:MA,RangeItem:EA},BackgroundGroup:wA,Component:IE,CurrentTime:jP,CustomTime:NP,DataAxis:CI,DataScale:kI,GraphGroup:PI,Group:bA,ItemSet:tI,Legend:AI,LineGraph:LI,TimeAxis:mP}};t.DOMutil=Qb,t.DataSet=nO,t.DataView=rO,t.Graph2d=GI,t.Hammer=uP,t.Queue=tO,t.Timeline=yI,t.keycharm=gP,t.moment=sO,t.timeline=VI,t.util=Wb})); +//# sourceMappingURL=vis-timeline-graph2d.min.js.map From 2e1cb4a42cbb02834d588de754f7f6e2cf21785b Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 15:25:55 +0200 Subject: [PATCH 2/9] Remove HTML5 shims It's 2024, these browsers are dead already --- core/trino-web-ui/src/main/resources/oauth2/failure.html | 6 ------ core/trino-web-ui/src/main/resources/oauth2/logout.html | 6 ------ core/trino-web-ui/src/main/resources/oauth2/success.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/disabled.html | 6 ------ .../src/main/resources/webapp/embedded_plan.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/index.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/login.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/plan.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/query.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/stage.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/timeline.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/worker.html | 6 ------ core/trino-web-ui/src/main/resources/webapp/workers.html | 6 ------ 13 files changed, 78 deletions(-) diff --git a/core/trino-web-ui/src/main/resources/oauth2/failure.html b/core/trino-web-ui/src/main/resources/oauth2/failure.html index bb703172ed74..cf51bce9f7b3 100644 --- a/core/trino-web-ui/src/main/resources/oauth2/failure.html +++ b/core/trino-web-ui/src/main/resources/oauth2/failure.html @@ -25,12 +25,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/oauth2/logout.html b/core/trino-web-ui/src/main/resources/oauth2/logout.html index 433483b3e4d9..665f00210d49 100644 --- a/core/trino-web-ui/src/main/resources/oauth2/logout.html +++ b/core/trino-web-ui/src/main/resources/oauth2/logout.html @@ -25,12 +25,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/oauth2/success.html b/core/trino-web-ui/src/main/resources/oauth2/success.html index c419ec5c9f2a..e76e40ef0656 100644 --- a/core/trino-web-ui/src/main/resources/oauth2/success.html +++ b/core/trino-web-ui/src/main/resources/oauth2/success.html @@ -25,12 +25,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/disabled.html b/core/trino-web-ui/src/main/resources/webapp/disabled.html index 0a0af9b96e3d..c4f7c651d402 100644 --- a/core/trino-web-ui/src/main/resources/webapp/disabled.html +++ b/core/trino-web-ui/src/main/resources/webapp/disabled.html @@ -25,12 +25,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html index 6139bcc9b10e..304142c33bdc 100644 --- a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/index.html b/core/trino-web-ui/src/main/resources/webapp/index.html index 1d6f44d82edd..246407c352a6 100644 --- a/core/trino-web-ui/src/main/resources/webapp/index.html +++ b/core/trino-web-ui/src/main/resources/webapp/index.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/login.html b/core/trino-web-ui/src/main/resources/webapp/login.html index 13dfaef92b51..e51f6b0ea3aa 100644 --- a/core/trino-web-ui/src/main/resources/webapp/login.html +++ b/core/trino-web-ui/src/main/resources/webapp/login.html @@ -25,12 +25,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/plan.html b/core/trino-web-ui/src/main/resources/webapp/plan.html index 21076251ed29..ef019c849ac4 100644 --- a/core/trino-web-ui/src/main/resources/webapp/plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/plan.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/query.html b/core/trino-web-ui/src/main/resources/webapp/query.html index ed8d7fa0c8cd..83a06f7ae886 100644 --- a/core/trino-web-ui/src/main/resources/webapp/query.html +++ b/core/trino-web-ui/src/main/resources/webapp/query.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/stage.html b/core/trino-web-ui/src/main/resources/webapp/stage.html index a324d4246946..c7deaa91e2c7 100644 --- a/core/trino-web-ui/src/main/resources/webapp/stage.html +++ b/core/trino-web-ui/src/main/resources/webapp/stage.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/timeline.html b/core/trino-web-ui/src/main/resources/webapp/timeline.html index 6c0319c251a0..c9f2d60eb9c4 100644 --- a/core/trino-web-ui/src/main/resources/webapp/timeline.html +++ b/core/trino-web-ui/src/main/resources/webapp/timeline.html @@ -15,12 +15,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/worker.html b/core/trino-web-ui/src/main/resources/webapp/worker.html index e2c24fece274..7f843e6f9ab9 100644 --- a/core/trino-web-ui/src/main/resources/webapp/worker.html +++ b/core/trino-web-ui/src/main/resources/webapp/worker.html @@ -12,12 +12,6 @@ - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/workers.html b/core/trino-web-ui/src/main/resources/webapp/workers.html index 75b23aa83ca2..7da20e9b7563 100644 --- a/core/trino-web-ui/src/main/resources/webapp/workers.html +++ b/core/trino-web-ui/src/main/resources/webapp/workers.html @@ -12,12 +12,6 @@ - - - From 77e2dccd0a64b454c0cb411528b7fe19fae68451 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 15:28:22 +0200 Subject: [PATCH 3/9] Update JQuery to 3.7.1 --- .../src/main/resources/webapp/disabled.html | 2 +- .../main/resources/webapp/embedded_plan.html | 2 +- .../src/main/resources/webapp/index.html | 2 +- .../src/main/resources/webapp/login.html | 2 +- .../src/main/resources/webapp/plan.html | 2 +- .../src/main/resources/webapp/query.html | 2 +- .../src/main/resources/webapp/references.html | 2 +- .../src/main/resources/webapp/stage.html | 2 +- .../src/main/resources/webapp/timeline.html | 2 +- .../webapp/vendor/jquery/jquery-3.5.1.js | 10872 ---------------- .../webapp/vendor/jquery/jquery-3.5.1.min.js | 2 - .../webapp/vendor/jquery/jquery-3.7.1.js | 10716 +++++++++++++++ .../webapp/vendor/jquery/jquery-3.7.1.min.js | 2 + .../src/main/resources/webapp/worker.html | 2 +- .../src/main/resources/webapp/workers.html | 2 +- 15 files changed, 10729 insertions(+), 10885 deletions(-) delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.5.1.js delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.5.1.min.js create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.7.1.js create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.7.1.min.js diff --git a/core/trino-web-ui/src/main/resources/webapp/disabled.html b/core/trino-web-ui/src/main/resources/webapp/disabled.html index c4f7c651d402..722aca23e80b 100644 --- a/core/trino-web-ui/src/main/resources/webapp/disabled.html +++ b/core/trino-web-ui/src/main/resources/webapp/disabled.html @@ -26,7 +26,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html index 304142c33bdc..45a2a7b0bcc9 100644 --- a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/index.html b/core/trino-web-ui/src/main/resources/webapp/index.html index 246407c352a6..d8f54393a45d 100644 --- a/core/trino-web-ui/src/main/resources/webapp/index.html +++ b/core/trino-web-ui/src/main/resources/webapp/index.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/login.html b/core/trino-web-ui/src/main/resources/webapp/login.html index e51f6b0ea3aa..8df0f925a38f 100644 --- a/core/trino-web-ui/src/main/resources/webapp/login.html +++ b/core/trino-web-ui/src/main/resources/webapp/login.html @@ -26,7 +26,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/plan.html b/core/trino-web-ui/src/main/resources/webapp/plan.html index ef019c849ac4..ff053ea57822 100644 --- a/core/trino-web-ui/src/main/resources/webapp/plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/plan.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/query.html b/core/trino-web-ui/src/main/resources/webapp/query.html index 83a06f7ae886..fc9e76979e3e 100644 --- a/core/trino-web-ui/src/main/resources/webapp/query.html +++ b/core/trino-web-ui/src/main/resources/webapp/query.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/references.html b/core/trino-web-ui/src/main/resources/webapp/references.html index 7a68329a986b..cb8c383e5e0e 100644 --- a/core/trino-web-ui/src/main/resources/webapp/references.html +++ b/core/trino-web-ui/src/main/resources/webapp/references.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/stage.html b/core/trino-web-ui/src/main/resources/webapp/stage.html index c7deaa91e2c7..686bc31bfb27 100644 --- a/core/trino-web-ui/src/main/resources/webapp/stage.html +++ b/core/trino-web-ui/src/main/resources/webapp/stage.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/timeline.html b/core/trino-web-ui/src/main/resources/webapp/timeline.html index c9f2d60eb9c4..4cda965201ae 100644 --- a/core/trino-web-ui/src/main/resources/webapp/timeline.html +++ b/core/trino-web-ui/src/main/resources/webapp/timeline.html @@ -16,7 +16,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.5.1.js b/core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.5.1.js deleted file mode 100644 index 50937333b99a..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/jquery/jquery-3.5.1.js +++ /dev/null @@ -1,10872 +0,0 @@ -/*! - * jQuery JavaScript Library v3.5.1 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2020-05-04T22:49Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.5.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.5 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2020-03-14 - */ -( function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rhtml = /HTML$/i, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - return nonHex ? - - // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android<4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem.namespaceURI, - docElem = ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; - } ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); - } ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; - } ); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } - - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { - - assert( function( el ) { - - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( support.matchesSelector && documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ - - }; - }, - - "CHILD": function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - "not": markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element (issue #299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - "has": markFunction( function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - } ), - - "contains": markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); - }, - - "selected": function( elem ) { - - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo( function() { - return [ 0 ]; - } ), - - "last": createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - "even": createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "odd": createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the master Deferred - master = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); - } - - return master.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - return result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px"; - tr.style.height = "1px"; - trChild.style.height = "9px"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( " + diff --git a/core/trino-web-ui/src/main/resources/webapp/workers.html b/core/trino-web-ui/src/main/resources/webapp/workers.html index 7da20e9b7563..d5a30b70189b 100644 --- a/core/trino-web-ui/src/main/resources/webapp/workers.html +++ b/core/trino-web-ui/src/main/resources/webapp/workers.html @@ -13,7 +13,7 @@ - + From 231668da288e31000b3b389013d2d26718fd3b23 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 15:30:01 +0200 Subject: [PATCH 4/9] Update ClipboardJS to 2.0.11 --- .../resources/webapp/vendor/clipboardjs/clipboard.min.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/clipboardjs/clipboard.min.js b/core/trino-web-ui/src/main/resources/webapp/vendor/clipboardjs/clipboard.min.js index 02c549e35c86..98d959b3c71c 100644 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/clipboardjs/clipboard.min.js +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/clipboardjs/clipboard.min.js @@ -1,7 +1,7 @@ /*! - * clipboard.js v2.0.4 - * https://zenorocha.github.io/clipboard.js - * + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * * Licensed MIT © Zeno Rocha */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n Date: Fri, 26 Jul 2024 15:40:38 +0200 Subject: [PATCH 5/9] Update highlightjs to 11.10.0 and use it as react component This also now highlights SQL on the main page --- .../main/resources/webapp/embedded_plan.html | 3 +-- .../src/main/resources/webapp/index.html | 3 +++ .../src/main/resources/webapp/plan.html | 3 +-- .../src/main/resources/webapp/query.html | 3 +-- .../src/main/resources/webapp/references.html | 4 ---- .../webapp/src/components/QueryDetail.jsx | 20 +++------------- .../webapp/src/components/QueryList.jsx | 6 ++--- .../webapp/src/components/SqlBlock.jsx | 19 +++++++++++++++ .../resources/webapp/src/package-lock.json | 10 ++++++++ .../main/resources/webapp/src/package.json | 1 + .../src/main/resources/webapp/src/yarn.lock | 5 ++++ .../src/main/resources/webapp/stage.html | 3 +-- .../webapp/vendor/highlightjs/9.3/LICENSE.txt | 24 ------------------- .../vendor/highlightjs/9.3/highlight.pack.js | 2 -- .../{9.3 => }/styles/solarized-dark.css | 0 15 files changed, 48 insertions(+), 58 deletions(-) create mode 100644 core/trino-web-ui/src/main/resources/webapp/src/components/SqlBlock.jsx delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/LICENSE.txt delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/highlight.pack.js rename core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/{9.3 => }/styles/solarized-dark.css (100%) diff --git a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html index 45a2a7b0bcc9..fa3bb4c3fa7f 100644 --- a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html @@ -22,8 +22,7 @@ - - + diff --git a/core/trino-web-ui/src/main/resources/webapp/index.html b/core/trino-web-ui/src/main/resources/webapp/index.html index d8f54393a45d..e6ad16e8f75b 100644 --- a/core/trino-web-ui/src/main/resources/webapp/index.html +++ b/core/trino-web-ui/src/main/resources/webapp/index.html @@ -12,6 +12,9 @@ + + + diff --git a/core/trino-web-ui/src/main/resources/webapp/plan.html b/core/trino-web-ui/src/main/resources/webapp/plan.html index ff053ea57822..5b5fa0e1db56 100644 --- a/core/trino-web-ui/src/main/resources/webapp/plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/plan.html @@ -22,8 +22,7 @@ - - + diff --git a/core/trino-web-ui/src/main/resources/webapp/query.html b/core/trino-web-ui/src/main/resources/webapp/query.html index fc9e76979e3e..f436f9a3a0ae 100644 --- a/core/trino-web-ui/src/main/resources/webapp/query.html +++ b/core/trino-web-ui/src/main/resources/webapp/query.html @@ -22,8 +22,7 @@ - - + diff --git a/core/trino-web-ui/src/main/resources/webapp/references.html b/core/trino-web-ui/src/main/resources/webapp/references.html index cb8c383e5e0e..18fc47cdf2bb 100644 --- a/core/trino-web-ui/src/main/resources/webapp/references.html +++ b/core/trino-web-ui/src/main/resources/webapp/references.html @@ -21,10 +21,6 @@ - - - - diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx index 3a5e624a0a49..8ab4ada7deec 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx @@ -14,6 +14,7 @@ import React from 'react' import Reactable from 'reactable' +import { SqlBlock } from './SqlBlock' import { addToHistory, @@ -1098,17 +1099,6 @@ export class QueryDetail extends React.Component { numberFormatter: formatDataSize, }) ) - - if (this.state.lastRender === null) { - $('#query').each((i, block) => { - hljs.highlightBlock(block) - }) - - $('#prepared-query').each((i, block) => { - hljs.highlightBlock(block) - }) - } - this.setState({ renderingEnded: this.state.ended, lastRender: renderTimestamp, @@ -1174,9 +1164,7 @@ export class QueryDetail extends React.Component {
-                    
-                        {query.preparedQuery}
-                    
+                    
                 
) @@ -1788,9 +1776,7 @@ export class QueryDetail extends React.Component {
-                            
-                                {query.query}
-                            
+                            
                         
{this.renderPreparedQuery()} diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx index 131e467f3a52..ffdf2905c5ed 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx @@ -29,6 +29,8 @@ import { truncateString, } from '../utils' +import { SqlBlock } from './SqlBlock' + export class QueryListItem extends React.Component { static stripQueryTextWhitespace(queryText) { const maxLines = 6 @@ -260,9 +262,7 @@ export class QueryListItem extends React.Component {
-                                    
-                                        {QueryListItem.stripQueryTextWhitespace(query.queryTextPreview)}
-                                    
+                                    
                                 
diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/SqlBlock.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/SqlBlock.jsx new file mode 100644 index 000000000000..5e519b10f4cd --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/SqlBlock.jsx @@ -0,0 +1,19 @@ +import React, { useEffect, useRef } from 'react' +import hljs from 'highlight.js/lib/core' +import sql from 'highlight.js/lib/languages/sql' +hljs.registerLanguage('sql', sql) + +export const SqlBlock = ({ language, code }) => { + const codeRef = useRef() + useEffect(() => { + if (codeRef && codeRef.current) { + hljs.highlightElement(codeRef.current) + } + }, [code]) + + return ( + + {code} + + ) +} diff --git a/core/trino-web-ui/src/main/resources/webapp/src/package-lock.json b/core/trino-web-ui/src/main/resources/webapp/src/package-lock.json index 3206bab8fdca..f00c7f9b2997 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/package-lock.json +++ b/core/trino-web-ui/src/main/resources/webapp/src/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "d3": "^5.7.0", "dagre-d3": "^0.6.1", + "highlight.js": "^11.10.0", "react": "^16.4.2", "react-dom": "^16.4.2", "reactable": "^1.0.2" @@ -3635,6 +3636,15 @@ "node": ">= 0.4" } }, + "node_modules/highlight.js": { + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", + "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/core/trino-web-ui/src/main/resources/webapp/src/package.json b/core/trino-web-ui/src/main/resources/webapp/src/package.json index 66548889a91c..4079fda61213 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/package.json +++ b/core/trino-web-ui/src/main/resources/webapp/src/package.json @@ -18,6 +18,7 @@ "dependencies": { "d3": "^5.7.0", "dagre-d3": "^0.6.1", + "highlight.js": "^11.10.0", "react": "^16.4.2", "react-dom": "^16.4.2", "reactable": "^1.0.2" diff --git a/core/trino-web-ui/src/main/resources/webapp/src/yarn.lock b/core/trino-web-ui/src/main/resources/webapp/src/yarn.lock index 8f272a6bd19e..e16c5d5a68b8 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/yarn.lock +++ b/core/trino-web-ui/src/main/resources/webapp/src/yarn.lock @@ -2130,6 +2130,11 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" +highlight.js@^11.10.0: + version "11.10.0" + resolved "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz" + integrity sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ== + iconv-lite@0.4: version "0.4.24" resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" diff --git a/core/trino-web-ui/src/main/resources/webapp/stage.html b/core/trino-web-ui/src/main/resources/webapp/stage.html index 686bc31bfb27..d14576f40364 100644 --- a/core/trino-web-ui/src/main/resources/webapp/stage.html +++ b/core/trino-web-ui/src/main/resources/webapp/stage.html @@ -22,8 +22,7 @@ - - + diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/LICENSE.txt b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/LICENSE.txt deleted file mode 100644 index 422deb7350fe..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/LICENSE.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2006, Ivan Sagalaev -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of highlight.js nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/highlight.pack.js b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/highlight.pack.js deleted file mode 100644 index 9cf40f3330ba..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/highlight.pack.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! highlight.js v9.3.0 | BSD3 License | git.io/hljslicense */ -!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(//gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return w(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(w(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset"}function u(e){f+=""}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,f="",l=[];e.length||r.length;){var g=i();if(f+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){l.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);l.reverse().forEach(o)}else"start"==g[0].event?l.push(g[0].node):l.pop(),c(g.splice(0,1)[0])}return f+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var f=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=f.length?t(f.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){for(var t=0;t";return i+=e+'">',i+n+o}function h(){if(!k.k)return n(M);var e="",t=0;k.lR.lastIndex=0;for(var r=k.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(k,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=k.lR.lastIndex,r=k.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof k.sL;if(e&&!R[k.sL])return n(M);var t=e?f(k.sL,M,!0,y[k.sL]):l(M,k.sL.length?k.sL:void 0);return k.r>0&&(B+=t.r),e&&(y[k.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=void 0!==k.sL?d():h(),M=""}function v(e,n){L+=e.cN?p(e.cN,"",!0):"",k=Object.create(e,{parent:{value:k}})}function m(e,n){if(M+=e,void 0===n)return b(),0;var t=o(n,k);if(t)return t.skip?M+=n:(t.eB&&(M+=n),b(),t.rB||t.eB||(M=n)),v(t,n),t.rB?0:n.length;var r=u(k,n);if(r){var a=k;a.skip?M+=n:(a.rE||a.eE||(M+=n),b(),a.eE&&(M=n));do k.cN&&(L+=""),k.skip||(B+=k.r),k=k.parent;while(k!=r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,k))throw new Error('Illegal lexeme "'+n+'" for mode "'+(k.cN||"")+'"');return M+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var x,k=i||N,y={},L="";for(x=k;x!=N;x=x.parent)x.cN&&(L=p(x.cN,"",!0)+L);var M="",B=0;try{for(var C,j,I=0;;){if(k.t.lastIndex=I,C=k.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),x=k;x.parent;x=x.parent)x.cN&&(L+="");return{r:B,value:L,language:e,top:k}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function l(e,t){t=t||E.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function g(e){return E.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,E.tabReplace)})),E.useBR&&(e=e.replace(/\n/g,"
")),e}function p(e,n,t){var r=n?x[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n=i(e);if(!a(n)){var t;E.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e;var r=t.textContent,o=n?f(n,r,!0):l(r),s=u(t);if(s.length){var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");h.innerHTML=o.value,o.value=c(s,u(h),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=p(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){E=o(E,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,h)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){x[e]=n})}function N(){return Object.keys(R)}function w(e){return e=(e||"").toLowerCase(),R[e]||R[x[e]]}var E={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},x={};return e.highlight=f,e.highlightAuto=l,e.fixMarkup=g,e.highlightBlock=h,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}}); \ No newline at end of file diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/styles/solarized-dark.css b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css similarity index 100% rename from core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/9.3/styles/solarized-dark.css rename to core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css From 5ed2b48462b118725353f821411b3bae5ad1938e Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 16:50:02 +0200 Subject: [PATCH 6/9] Change highlightjs theme to stackoverflow-dark --- .../main/resources/webapp/embedded_plan.html | 2 +- .../src/main/resources/webapp/index.html | 2 +- .../src/main/resources/webapp/plan.html | 2 +- .../src/main/resources/webapp/query.html | 2 +- .../src/main/resources/webapp/stage.html | 2 +- .../highlightjs/styles/solarized-dark.css | 84 ------------ .../highlightjs/styles/stackoverflow-dark.css | 126 ++++++++++++++++++ 7 files changed, 131 insertions(+), 89 deletions(-) delete mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css create mode 100644 core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css diff --git a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html index fa3bb4c3fa7f..ed043d7929c0 100644 --- a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/index.html b/core/trino-web-ui/src/main/resources/webapp/index.html index e6ad16e8f75b..d228a3d9cb15 100644 --- a/core/trino-web-ui/src/main/resources/webapp/index.html +++ b/core/trino-web-ui/src/main/resources/webapp/index.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/plan.html b/core/trino-web-ui/src/main/resources/webapp/plan.html index 5b5fa0e1db56..be10cc55d922 100644 --- a/core/trino-web-ui/src/main/resources/webapp/plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/plan.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/query.html b/core/trino-web-ui/src/main/resources/webapp/query.html index f436f9a3a0ae..662e016a27b2 100644 --- a/core/trino-web-ui/src/main/resources/webapp/query.html +++ b/core/trino-web-ui/src/main/resources/webapp/query.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/stage.html b/core/trino-web-ui/src/main/resources/webapp/stage.html index d14576f40364..b8616d4e24a5 100644 --- a/core/trino-web-ui/src/main/resources/webapp/stage.html +++ b/core/trino-web-ui/src/main/resources/webapp/stage.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css deleted file mode 100644 index b4c0da1f786b..000000000000 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/solarized-dark.css +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0.5em; - background: #002b36; - color: #839496; -} - -.hljs-comment, -.hljs-quote { - color: #586e75; -} - -/* Solarized Green */ -.hljs-keyword, -.hljs-selector-tag, -.hljs-addition { - color: #859900; -} - -/* Solarized Cyan */ -.hljs-number, -.hljs-string, -.hljs-meta .hljs-meta-string, -.hljs-literal, -.hljs-doctag, -.hljs-regexp { - color: #2aa198; -} - -/* Solarized Blue */ -.hljs-title, -.hljs-section, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #268bd2; -} - -/* Solarized Yellow */ -.hljs-attribute, -.hljs-attr, -.hljs-variable, -.hljs-template-variable, -.hljs-class .hljs-title, -.hljs-type { - color: #b58900; -} - -/* Solarized Orange */ -.hljs-symbol, -.hljs-bullet, -.hljs-subst, -.hljs-meta, -.hljs-meta .hljs-keyword, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-link { - color: #cb4b16; -} - -/* Solarized Red */ -.hljs-built_in, -.hljs-deletion { - color: #dc322f; -} - -.hljs-formula { - background: #073642; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css new file mode 100644 index 000000000000..f097db705e0a --- /dev/null +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css @@ -0,0 +1,126 @@ +/*! + Theme: StackOverflow Dark + Description: Dark theme as used on stackoverflow.com + Author: stackoverflow.com + Maintainer: @Hirse + Website: https://github.com/StackExchange/Stacks + License: MIT + Updated: 2021-05-15 + + Updated for @stackoverflow/stacks v0.64.0 + Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less + Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less +*/ + +.hljs { + /* var(--highlight-color) */ + color: #ffffff; + /* var(--highlight-bg) */ + background: #1c1b1b; +} + +.hljs-subst { + /* var(--highlight-color) */ + color: #ffffff; +} + +.hljs-comment { + /* var(--highlight-comment) */ + color: #999999; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-meta .hljs-keyword, +.hljs-doctag, +.hljs-section { + /* var(--highlight-keyword) */ + color: #88aece; +} + +.hljs-attr { + /* var(--highlight-attribute); */ + color: #88aece; +} + +.hljs-attribute { + /* var(--highlight-symbol) */ + color: #c59bc1; +} + +.hljs-name, +.hljs-type, +.hljs-number, +.hljs-selector-id, +.hljs-quote, +.hljs-template-tag { + /* var(--highlight-namespace) */ + color: #f08d49; +} + +.hljs-selector-class { + /* var(--highlight-keyword) */ + color: #88aece; +} + +.hljs-string, +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr { + /* var(--highlight-variable) */ + color: #b5bd68; +} + +.hljs-meta, +.hljs-selector-pseudo { + /* var(--highlight-keyword) */ + color: #88aece; +} + +.hljs-built_in, +.hljs-title, +.hljs-literal { + /* var(--highlight-literal) */ + color: #f08d49; +} + +.hljs-bullet, +.hljs-code { + /* var(--highlight-punctuation) */ + color: #cccccc; +} + +.hljs-meta .hljs-string { + /* var(--highlight-variable) */ + color: #b5bd68; +} + +.hljs-deletion { + /* var(--highlight-deletion) */ + color: #de7176; +} + +.hljs-addition { + /* var(--highlight-addition) */ + color: #76c490; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-formula, +.hljs-operator, +.hljs-params, +.hljs-property, +.hljs-punctuation, +.hljs-tag { + /* purposely ignored */ +} From 3562171a1197b34f0eb1b35cf2477701cddcd9bb Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 16:51:35 +0200 Subject: [PATCH 7/9] Remove background color from highlighted blocks --- .../webapp/vendor/highlightjs/styles/stackoverflow-dark.css | 1 - 1 file changed, 1 deletion(-) diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css index f097db705e0a..ef2e7e686f80 100644 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css @@ -16,7 +16,6 @@ /* var(--highlight-color) */ color: #ffffff; /* var(--highlight-bg) */ - background: #1c1b1b; } .hljs-subst { From 4d36e5c459d15d97670a6867236c4712064672fa Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 26 Jul 2024 17:48:47 +0200 Subject: [PATCH 8/9] Add links to query details from list --- .../webapp/src/components/QueryList.jsx | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx index ffdf2905c5ed..415490512d99 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx @@ -176,7 +176,7 @@ export class QueryListItem extends React.Component {
+
+ + + +   + + + +   + + + +   + + + +
Date: Wed, 9 Oct 2024 19:01:28 +0200 Subject: [PATCH 9/9] Use trino color palette --- .../resources/webapp/assets/css/timeline.css | 42 ++++++++++--------- .../resources/webapp/assets/js/timeline.js | 4 +- .../main/resources/webapp/assets/trino.css | 4 +- .../main/resources/webapp/embedded_plan.html | 2 +- .../src/main/resources/webapp/index.html | 2 +- .../src/main/resources/webapp/plan.html | 2 +- .../src/main/resources/webapp/query.html | 2 +- .../src/main/resources/webapp/stage.html | 2 +- .../src/main/resources/webapp/timeline.html | 4 +- .../{stackoverflow-dark.css => trino.css} | 26 +++--------- 10 files changed, 40 insertions(+), 50 deletions(-) rename core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/{stackoverflow-dark.css => trino.css} (74%) diff --git a/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css b/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css index 3f205d0c1548..195c85a16199 100644 --- a/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css +++ b/core/trino-web-ui/src/main/resources/webapp/assets/css/timeline.css @@ -19,23 +19,23 @@ padding: 0px; } .vis-timeline .vis-item.vis-range { - height: 0.6em; + height: 0.8em; } .vis-timeline .red { - background-color: #F2DEDE; - border-color: #F2AEAE; + background-color: #DD00A1; + border-color: #252830; } -.vis-timeline .green { - background-color: #DFF0DB; - border-color: #B8F0AA; +.vis-timeline .gray { + background-color: #9E9E9E; + border-color: #252830; } .vis-timeline .blue { - background-color: #E3E9FC; - border-color: #B0C3FC; + background-color: #001C93; + border-color: #252830; } .vis-timeline .orange { - background-color: #FFA500; - border-color: #B0C3FC; + background-color: #F88600; + border-color: #252830; } #legend { padding: 10px 40px @@ -50,20 +50,20 @@ margin-left: -20px; } #legend .red { - background-color: #F2DEDE; - border-color: #F2AEAE; + background-color: #DD00A1; + border-color: #252830; } -#legend .green { - background-color: #DFF0DB; - border-color: #B8F0AA; +#legend .gray { + background-color: #9E9E9E; + border-color: #252830; } #legend .blue { - background-color: #E3E9FC; - border-color: #B0C3FC; + background-color: #001C93; + border-color: #252830; } #legend .orange { - background-color: #FFA500; - border-color: #B0C3FC; + background-color: #F88600; + border-color: #252830; } #legend .empty { border-style: none; @@ -71,3 +71,7 @@ #legend>div { display: inline-block; } + +.vis-text { + color: white !important; +} diff --git a/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js b/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js index 84fbb9c2ae04..9f5340eca210 100644 --- a/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js +++ b/core/trino-web-ui/src/main/resources/webapp/assets/js/timeline.js @@ -59,7 +59,7 @@ $(document).ready(function () { group: stageId, start: task.time.create, end: task.time.firstStart, - className: 'red', + className: 'gray', subgroup: taskNumber, sort: -taskNumber, }); @@ -67,7 +67,7 @@ $(document).ready(function () { group: stageId, start: task.time.firstStart, end: task.time.lastStart, - className: 'green', + className: 'red', subgroup: taskNumber, sort: -taskNumber, }); diff --git a/core/trino-web-ui/src/main/resources/webapp/assets/trino.css b/core/trino-web-ui/src/main/resources/webapp/assets/trino.css index 55dce3a0e7aa..308958be4ee9 100644 --- a/core/trino-web-ui/src/main/resources/webapp/assets/trino.css +++ b/core/trino-web-ui/src/main/resources/webapp/assets/trino.css @@ -35,8 +35,8 @@ h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { pre { margin: 0; padding: 5px; - color: #999; - background-color: #2C2F38; + color: #9e9e9e; + background-color: #212121; border: none; } diff --git a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html index ed043d7929c0..bb7852bd5286 100644 --- a/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/embedded_plan.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/index.html b/core/trino-web-ui/src/main/resources/webapp/index.html index d228a3d9cb15..9275eb1a5ce5 100644 --- a/core/trino-web-ui/src/main/resources/webapp/index.html +++ b/core/trino-web-ui/src/main/resources/webapp/index.html @@ -13,7 +13,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/plan.html b/core/trino-web-ui/src/main/resources/webapp/plan.html index be10cc55d922..a90b28dc71ef 100644 --- a/core/trino-web-ui/src/main/resources/webapp/plan.html +++ b/core/trino-web-ui/src/main/resources/webapp/plan.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/query.html b/core/trino-web-ui/src/main/resources/webapp/query.html index 662e016a27b2..2d18de6a630e 100644 --- a/core/trino-web-ui/src/main/resources/webapp/query.html +++ b/core/trino-web-ui/src/main/resources/webapp/query.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/stage.html b/core/trino-web-ui/src/main/resources/webapp/stage.html index b8616d4e24a5..bc4f26f9ae3a 100644 --- a/core/trino-web-ui/src/main/resources/webapp/stage.html +++ b/core/trino-web-ui/src/main/resources/webapp/stage.html @@ -22,7 +22,7 @@ - + diff --git a/core/trino-web-ui/src/main/resources/webapp/timeline.html b/core/trino-web-ui/src/main/resources/webapp/timeline.html index 4cda965201ae..90407c52a982 100644 --- a/core/trino-web-ui/src/main/resources/webapp/timeline.html +++ b/core/trino-web-ui/src/main/resources/webapp/timeline.html @@ -48,10 +48,10 @@

Timeline

-
+
Created
-
+
First split started
diff --git a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/trino.css similarity index 74% rename from core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css rename to core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/trino.css index ef2e7e686f80..8fe005ee4774 100644 --- a/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/stackoverflow-dark.css +++ b/core/trino-web-ui/src/main/resources/webapp/vendor/highlightjs/styles/trino.css @@ -1,20 +1,6 @@ -/*! - Theme: StackOverflow Dark - Description: Dark theme as used on stackoverflow.com - Author: stackoverflow.com - Maintainer: @Hirse - Website: https://github.com/StackExchange/Stacks - License: MIT - Updated: 2021-05-15 - - Updated for @stackoverflow/stacks v0.64.0 - Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less - Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less -*/ - -.hljs { +hljs { /* var(--highlight-color) */ - color: #ffffff; + color: #9e9e9e; /* var(--highlight-bg) */ } @@ -25,7 +11,7 @@ .hljs-comment { /* var(--highlight-comment) */ - color: #999999; + color: #DD00A1; } .hljs-keyword, @@ -34,17 +20,17 @@ .hljs-doctag, .hljs-section { /* var(--highlight-keyword) */ - color: #88aece; + color: #F8B600; } .hljs-attr { /* var(--highlight-attribute); */ - color: #88aece; + color: #F88600; } .hljs-attribute { /* var(--highlight-symbol) */ - color: #c59bc1; + color: #DD00A1; } .hljs-name,