import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBaseVNode, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, getCurrentInstance, getCurrentScope, inject, isRef, markRaw, mergeProps, nextTick, normalizeClass, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, onMounted, onScopeDispose, onUnmounted, onUpdated, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, unref, useSlots, vModelText, vShow, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "./chunk-HM42ZP2D.js"; import { __commonJS, __esm, __export, __toCommonJS, __toESM } from "./chunk-EWTE5DHJ.js"; // node_modules/plotly.js/src/version.js var require_version = __commonJS({ "node_modules/plotly.js/src/version.js"(exports2) { "use strict"; exports2.version = "2.35.3"; } }); // node_modules/native-promise-only/lib/npo.src.js var require_npo_src = __commonJS({ "node_modules/native-promise-only/lib/npo.src.js"(exports2, module2) { (function UMD(name, context, definition) { context[name] = context[name] || definition(); if (typeof module2 != "undefined" && module2.exports) { module2.exports = context[name]; } else if (typeof define == "function" && define.amd) { define(function $AMD$() { return context[name]; }); } })("Promise", typeof global != "undefined" ? global : exports2, function DEF() { "use strict"; var builtInProp, cycle, scheduling_queue, ToString = Object.prototype.toString, timer = typeof setImmediate != "undefined" ? function timer2(fn) { return setImmediate(fn); } : setTimeout; try { Object.defineProperty({}, "x", {}); builtInProp = function builtInProp2(obj, name, val, config) { return Object.defineProperty(obj, name, { value: val, writable: true, configurable: config !== false }); }; } catch (err) { builtInProp = function builtInProp2(obj, name, val) { obj[name] = val; return obj; }; } scheduling_queue = /* @__PURE__ */ function Queue() { var first, last, item; function Item(fn, self2) { this.fn = fn; this.self = self2; this.next = void 0; } return { add: function add(fn, self2) { item = new Item(fn, self2); if (last) { last.next = item; } else { first = item; } last = item; item = void 0; }, drain: function drain() { var f = first; first = last = cycle = void 0; while (f) { f.fn.call(f.self); f = f.next; } } }; }(); function schedule(fn, self2) { scheduling_queue.add(fn, self2); if (!cycle) { cycle = timer(scheduling_queue.drain); } } function isThenable(o) { var _then, o_type = typeof o; if (o != null && (o_type == "object" || o_type == "function")) { _then = o.then; } return typeof _then == "function" ? _then : false; } function notify() { for (var i = 0; i < this.chain.length; i++) { notifyIsolated( this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i] ); } this.chain.length = 0; } function notifyIsolated(self2, cb, chain) { var ret, _then; try { if (cb === false) { chain.reject(self2.msg); } else { if (cb === true) { ret = self2.msg; } else { ret = cb.call(void 0, self2.msg); } if (ret === chain.promise) { chain.reject(TypeError("Promise-chain cycle")); } else if (_then = isThenable(ret)) { _then.call(ret, chain.resolve, chain.reject); } else { chain.resolve(ret); } } } catch (err) { chain.reject(err); } } function resolve(msg) { var _then, self2 = this; if (self2.triggered) { return; } self2.triggered = true; if (self2.def) { self2 = self2.def; } try { if (_then = isThenable(msg)) { schedule(function() { var def_wrapper = new MakeDefWrapper(self2); try { _then.call( msg, function $resolve$() { resolve.apply(def_wrapper, arguments); }, function $reject$() { reject.apply(def_wrapper, arguments); } ); } catch (err) { reject.call(def_wrapper, err); } }); } else { self2.msg = msg; self2.state = 1; if (self2.chain.length > 0) { schedule(notify, self2); } } } catch (err) { reject.call(new MakeDefWrapper(self2), err); } } function reject(msg) { var self2 = this; if (self2.triggered) { return; } self2.triggered = true; if (self2.def) { self2 = self2.def; } self2.msg = msg; self2.state = 2; if (self2.chain.length > 0) { schedule(notify, self2); } } function iteratePromises(Constructor, arr, resolver, rejecter) { for (var idx = 0; idx < arr.length; idx++) { (function IIFE(idx2) { Constructor.resolve(arr[idx2]).then( function $resolver$(msg) { resolver(idx2, msg); }, rejecter ); })(idx); } } function MakeDefWrapper(self2) { this.def = self2; this.triggered = false; } function MakeDef(self2) { this.promise = self2; this.state = 0; this.triggered = false; this.chain = []; this.msg = void 0; } function Promise2(executor) { if (typeof executor != "function") { throw TypeError("Not a function"); } if (this.__NPO__ !== 0) { throw TypeError("Not a promise"); } this.__NPO__ = 1; var def = new MakeDef(this); this["then"] = function then(success, failure) { var o = { success: typeof success == "function" ? success : true, failure: typeof failure == "function" ? failure : false }; o.promise = new this.constructor(function extractChain(resolve2, reject2) { if (typeof resolve2 != "function" || typeof reject2 != "function") { throw TypeError("Not a function"); } o.resolve = resolve2; o.reject = reject2; }); def.chain.push(o); if (def.state !== 0) { schedule(notify, def); } return o.promise; }; this["catch"] = function $catch$(failure) { return this.then(void 0, failure); }; try { executor.call( void 0, function publicResolve(msg) { resolve.call(def, msg); }, function publicReject(msg) { reject.call(def, msg); } ); } catch (err) { reject.call(def, err); } } var PromisePrototype = builtInProp( {}, "constructor", Promise2, /*configurable=*/ false ); Promise2.prototype = PromisePrototype; builtInProp( PromisePrototype, "__NPO__", 0, /*configurable=*/ false ); builtInProp(Promise2, "resolve", function Promise$resolve(msg) { var Constructor = this; if (msg && typeof msg == "object" && msg.__NPO__ === 1) { return msg; } return new Constructor(function executor(resolve2, reject2) { if (typeof resolve2 != "function" || typeof reject2 != "function") { throw TypeError("Not a function"); } resolve2(msg); }); }); builtInProp(Promise2, "reject", function Promise$reject(msg) { return new this(function executor(resolve2, reject2) { if (typeof resolve2 != "function" || typeof reject2 != "function") { throw TypeError("Not a function"); } reject2(msg); }); }); builtInProp(Promise2, "all", function Promise$all(arr) { var Constructor = this; if (ToString.call(arr) != "[object Array]") { return Constructor.reject(TypeError("Not an array")); } if (arr.length === 0) { return Constructor.resolve([]); } return new Constructor(function executor(resolve2, reject2) { if (typeof resolve2 != "function" || typeof reject2 != "function") { throw TypeError("Not a function"); } var len = arr.length, msgs = Array(len), count = 0; iteratePromises(Constructor, arr, function resolver(idx, msg) { msgs[idx] = msg; if (++count === len) { resolve2(msgs); } }, reject2); }); }); builtInProp(Promise2, "race", function Promise$race(arr) { var Constructor = this; if (ToString.call(arr) != "[object Array]") { return Constructor.reject(TypeError("Not an array")); } return new Constructor(function executor(resolve2, reject2) { if (typeof resolve2 != "function" || typeof reject2 != "function") { throw TypeError("Not a function"); } iteratePromises(Constructor, arr, function resolver(idx, msg) { resolve2(msg); }, reject2); }); }); return Promise2; }); } }); // node_modules/@plotly/d3/d3.js var require_d3 = __commonJS({ "node_modules/@plotly/d3/d3.js"(exports2, module2) { !(function() { var d3 = { version: "3.8.2" }; var d3_arraySlice = [].slice, d3_array = function(list) { return d3_arraySlice.call(list); }; var d3_document = self.document; function d3_documentElement(node) { return node && (node.ownerDocument || node.document || node).documentElement; } function d3_window(node) { return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView); } if (d3_document) { try { d3_array(d3_document.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; }; } } if (!Date.now) Date.now = function() { return +/* @__PURE__ */ new Date(); }; if (d3_document) { try { d3_document.createElement("DIV").style.setProperty("opacity", 0, ""); } catch (error) { var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.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) if ((b = array[i]) != null && b >= b) { a = b; break; } while (++i < n) if ((b = array[i]) != null && a > b) a = b; } else { while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; } 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) if ((b = array[i]) != null && b >= b) { a = b; break; } while (++i < n) if ((b = array[i]) != null && b > a) a = b; } else { while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; } 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) if ((b = array[i]) != null && b >= b) { a = c = b; break; } while (++i < n) if ((b = array[i]) != null) { if (a > b) a = b; if (c < b) c = b; } } else { while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; } 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]; }; function d3_number(x) { return x === null ? NaN : +x; } function d3_numeric(x) { return !isNaN(x); } d3.sum = function(array, f) { var s = 0, n = array.length, a, i = -1; if (arguments.length === 1) { while (++i < n) if (d3_numeric(a = +array[i])) s += a; } else { while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a; } return s; }; d3.mean = function(array, f) { var s = 0, n = array.length, a, i = -1, j = n; if (arguments.length === 1) { while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j; } else { while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j; } if (j) return s / j; }; 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) { var numbers = [], n = array.length, a, i = -1; if (arguments.length === 1) { while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a); } else { while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a); } if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), 0.5); }; d3.variance = function(array, f) { var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0; if (arguments.length === 1) { while (++i < n) { if (d3_numeric(a = d3_number(array[i]))) { d = a - m; m += d / ++j; s += d * (a - m); } } } else { while (++i < n) { if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) { d = a - m; m += d / ++j; s += d * (a - m); } } } if (j > 1) return s / (j - 1); }; d3.deviation = function() { var v = d3.variance.apply(this, arguments); return v ? Math.sqrt(v) : v; }; function d3_bisector(compare) { return { left: function(a, x, lo2, hi2) { if (arguments.length < 3) lo2 = 0; if (arguments.length < 4) hi2 = a.length; while (lo2 < hi2) { var mid = lo2 + hi2 >>> 1; if (compare(a[mid], x) < 0) lo2 = mid + 1; else hi2 = mid; } return lo2; }, right: function(a, x, lo2, hi2) { if (arguments.length < 3) lo2 = 0; if (arguments.length < 4) hi2 = a.length; while (lo2 < hi2) { var mid = lo2 + hi2 >>> 1; if (compare(a[mid], x) > 0) hi2 = mid; else lo2 = mid + 1; } return lo2; } }; } 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, i02, i12) { if ((m = arguments.length) < 3) { i12 = array.length; if (m < 2) i02 = 0; } var m = i12 - i02, t, i; while (m) { i = Math.random() * m-- | 0; t = array[m + i02], array[m + i02] = array[i + i02], array[i + i02] = 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, p02, p12 = array[0], pairs = new Array(n < 0 ? 0 : n); while (i < n) pairs[i] = [p02 = p12, p12 = array[++i]]; return pairs; }; d3.transpose = function(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) { for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) { row[j] = matrix[j][i]; } } return transpose; }; function d3_transposeLength(d) { return d.length; } d3.zip = function() { return d3.transpose(arguments); }; d3.keys = function(map2) { var keys = []; for (var key in map2) keys.push(key); return keys; }; d3.values = function(map2) { var values = []; for (var key in map2) values.push(map2[key]); return values; }; d3.entries = function(map2) { var entries = []; for (var key in map2) entries.push({ key, value: map2[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) { for (var key in properties) { Object.defineProperty(ctor.prototype, key, { value: properties[key], enumerable: false }); } } d3.map = function(object, f) { var map2 = new d3_Map(); if (object instanceof d3_Map) { object.forEach(function(key2, value) { map2.set(key2, value); }); } else if (Array.isArray(object)) { var i = -1, n = object.length, o; if (arguments.length === 1) while (++i < n) map2.set(i, object[i]); else while (++i < n) map2.set(f.call(object, o = object[i], i), o); } else { for (var key in object) map2.set(key, object[key]); } return map2; }; function d3_Map() { this._ = /* @__PURE__ */ Object.create(null); } var d3_map_proto = "__proto__", d3_map_zero = "\0"; d3_class(d3_Map, { has: d3_map_has, get: function(key) { return this._[d3_map_escape(key)]; }, set: function(key, value) { return this._[d3_map_escape(key)] = value; }, remove: d3_map_remove, keys: d3_map_keys, values: function() { var values = []; for (var key in this._) values.push(this._[key]); return values; }, entries: function() { var entries = []; for (var key in this._) entries.push({ key: d3_map_unescape(key), value: this._[key] }); return entries; }, size: d3_map_size, empty: d3_map_empty, forEach: function(f) { for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]); } }); function d3_map_escape(key) { return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key; } function d3_map_unescape(key) { return (key += "")[0] === d3_map_zero ? key.slice(1) : key; } function d3_map_has(key) { return d3_map_escape(key) in this._; } function d3_map_remove(key) { return (key = d3_map_escape(key)) in this._ && delete this._[key]; } function d3_map_keys() { var keys = []; for (var key in this._) keys.push(d3_map_unescape(key)); return keys; } function d3_map_size() { var size = 0; for (var key in this._) ++size; return size; } function d3_map_empty() { for (var key in this._) return false; return true; } d3.nest = function() { var nest = {}, keys = [], sortKeys = [], sortValues, rollup; function map2(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(keyValue2, values2) { object.set(keyValue2, map2(mapType, values2, depth)); }; } else { object = {}; setter = function(keyValue2, values2) { object[keyValue2] = map2(mapType, values2, depth); }; } valuesByKey.forEach(setter); return object; } function entries(map3, depth) { if (depth >= keys.length) return map3; var array = [], sortKey = sortKeys[depth++]; map3.forEach(function(key, keyMap) { array.push({ 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 map2(mapType, array, 0); }; nest.entries = function(array) { return entries(map2(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() { this._ = /* @__PURE__ */ Object.create(null); } d3_class(d3_Set, { has: d3_map_has, add: function(key) { this._[d3_map_escape(key += "")] = true; return key; }, remove: d3_map_remove, values: d3_map_keys, size: d3_map_size, empty: d3_map_empty, forEach: function(f) { for (var key in this._) f.call(this, d3_map_unescape(key)); } }); d3.behavior = {}; function d3_identity(d) { return d; } 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.slice(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.slice(i + 1); type = type.slice(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(e12) { try { var e02 = e12.sourceEvent = d3.event; e12.target = target; d3.event = e12; dispatch[e12.type].apply(thiz, argumentz); } finally { d3.event = e02; } }; }; 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_selectMatches = function(n, s) { var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")]; d3_selectMatches = function(n2, s2) { return d3_selectMatcher.call(n2, s2); }; return d3_selectMatches(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.select(d3_document.documentElement); }; 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_nsXhtml = "http://www.w3.org/1999/xhtml"; var d3_nsPrefix = { svg: "http://www.w3.org/2000/svg", xhtml: d3_nsXhtml, 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.slice(0, i)) !== "xmlns") name = name.slice(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 re2 = 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) { re2.lastIndex = 0; if (!re2.test(c)) node.setAttribute("class", d3_collapse(c + " " + name)); } else { node.setAttribute("class", d3_collapse(c.replace(re2, " "))); } }; } 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) { var node = this.node(); return d3_window(node).getComputedStyle(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) { function create() { var document2 = this.ownerDocument, namespace = this.namespaceURI; return namespace === d3_nsXhtml && document2.documentElement.namespaceURI === d3_nsXhtml ? document2.createElement(name) : document2.createElementNS(namespace, name); } function createNS() { return this.ownerDocument.createElementNS(name.space, name.local); } return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? createNS : create; } 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(d3_selectionRemove); }; function d3_selectionRemove() { 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(group2, groupData) { var i2, n2 = group2.length, m = groupData.length, n02 = Math.min(n2, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n2), node2, nodeData; if (key) { var nodeByKeyValue = new d3_Map(), keyValues = new Array(n2), keyValue; for (i2 = -1; ++i2 < n2; ) { if (node2 = group2[i2]) { if (nodeByKeyValue.has(keyValue = key.call(node2, node2.__data__, i2))) { exitNodes[i2] = node2; } else { nodeByKeyValue.set(keyValue, node2); } keyValues[i2] = keyValue; } } for (i2 = -1; ++i2 < m; ) { if (!(node2 = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i2], i2)))) { enterNodes[i2] = d3_selection_dataNode(nodeData); } else if (node2 !== true) { updateNodes[i2] = node2; node2.__data__ = nodeData; } nodeByKeyValue.set(keyValue, true); } for (i2 = -1; ++i2 < n2; ) { if (i2 in keyValues && nodeByKeyValue.get(keyValues[i2]) !== true) { exitNodes[i2] = group2[i2]; } } } else { for (i2 = -1; ++i2 < n02; ) { node2 = group2[i2]; nodeData = groupData[i2]; if (node2) { node2.__data__ = nodeData; updateNodes[i2] = node2; } else { enterNodes[i2] = d3_selection_dataNode(nodeData); } } for (; i2 < m; ++i2) { enterNodes[i2] = d3_selection_dataNode(groupData[i2]); } for (; i2 < n2; ++i2) { exitNodes[i2] = group2[i2]; } } enterNodes.update = updateNodes; enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group2.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; d3_selection_each(this, 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 i02, j02; return function(d, i, j) { var group = enter[j].update, n = group.length, node; if (j != j02) j02 = j, i02 = 0; if (i >= i02) i02 = i + 1; while (!(node = group[i02]) && ++i02 < n) ; return node; }; } d3.select = function(node) { var group; if (typeof node === "string") { group = [d3_select(node, d3_document)]; group.parentNode = d3_document.documentElement; } else { group = [node]; group.parentNode = d3_documentElement(node); } return d3_selection([group]); }; d3.selectAll = function(nodes) { var group; if (typeof nodes === "string") { group = d3_array(d3_selectAll(nodes, d3_document)); group.parentNode = d3_document.documentElement; } else { group = d3_array(nodes); group.parentNode = null; } return d3_selection([group]); }; 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.slice(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 re2 = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match; for (var name2 in this) { if (match = name2.match(re2)) { var l = this[name2]; this.removeEventListener(match[1], l, l.$); delete this[name2]; } } } return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll; } var d3_selection_onFilters = d3.map({ mouseenter: "mouseover", mouseleave: "mouseout" }); if (d3_document) { 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, d3_event_dragId = 0; function d3_event_dragSuppress(node) { var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window(node)).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault); if (d3_event_dragSelect == null) { d3_event_dragSelect = "onselectstart" in node ? false : d3_vendorSymbol(node.style, "userSelect"); } if (d3_event_dragSelect) { var style = d3_documentElement(node).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) { var off = function() { 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()); }; var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0; function d3_mousePoint(container, e) { if (e.changedTouches) e = e.changedTouches[0]; var svg = container.ownerSVGElement || container; if (svg.createSVGPoint) { var point = svg.createSVGPoint(); if (d3_mouse_bug44083 < 0) { var window2 = d3_window(container); if (window2.scrollX || window2.scrollY) { svg = d3.select("body").append("svg").style({ position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none" }, "important"); var ctm = svg[0][0].getScreenCTM(); d3_mouse_bug44083 = !(ctm.f || ctm.e); svg.remove(); } } if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else 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.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); } } }; d3.behavior.drag = function() { var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend"); function drag() { this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart); } function dragstart(id2, position, subject, move, end) { return function() { var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id2(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), 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, dy }); } function ended() { if (!position(parent, dragId)) return; dragSubject.on(move + dragName, null).on(end + dragName, null); dragRestore(dragged); 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; } 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; }) : []; }; var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 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(p02, p12) { var ux0 = p02[0], uy0 = p02[1], w02 = p02[2], ux1 = p12[0], uy1 = p12[1], w12 = p12[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; if (d2 < ε2) { S = Math.log(w12 / w02) / ρ; i = function(t) { return [ux0 + t * dx, uy0 + t * dy, w02 * Math.exp(ρ * t * S)]; }; } else { var d12 = Math.sqrt(d2), b02 = (w12 * w12 - w02 * w02 + ρ4 * d2) / (2 * w02 * ρ2 * d12), b12 = (w12 * w12 - w02 * w02 - ρ4 * d2) / (2 * w12 * ρ2 * d12), r02 = Math.log(Math.sqrt(b02 * b02 + 1) - b02), r12 = Math.log(Math.sqrt(b12 * b12 + 1) - b12); S = (r12 - r02) / ρ; i = function(t) { var s = t * S, coshr0 = d3_cosh(r02), u = w02 / (ρ2 * d12) * (coshr0 * d3_tanh(ρ * s + r02) - d3_sinh(r02)); return [ux0 + u * dx, uy0 + u * dy, w02 * coshr0 / d3_cosh(ρ * s + r02)]; }; } i.duration = S * 1e3; return i; }; d3.behavior.zoom = function() { var view = { x: 0, y: 0, k: 1 }, translate0, center0, center, size = [960, 500], scaleExtent = d3_behavior_zoomInfinity, duration = 250, zooming = 0, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x02, x12, y02, y12; if (!d3_behavior_zoomWheel) { 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 zoom(g) { g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).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 = center0 ? center0[0] : dx / 2, cy = center0 ? center0[1] : 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 }; zoomed(dispatch); }; }).each("interrupt.zoom", function() { zoomended(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: null }; scaleTo(+_); 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.duration = function(_) { if (!arguments.length) return duration; duration = +_; return zoom; }; zoom.x = function(z) { if (!arguments.length) return x12; x12 = z; x02 = z.copy(); view = { x: 0, y: 0, k: 1 }; return zoom; }; zoom.y = function(z) { if (!arguments.length) return y12; y12 = z; y02 = 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 zoomTo(that, p, l, k) { that.__chart__ = { x: view.x, y: view.y, k: view.k }; scaleTo(Math.pow(2, k)); translateTo(center0 = p, l); that = d3.select(that); if (duration > 0) that = that.transition().duration(duration); that.call(zoom.event); } function rescale() { if (x12) x12.domain(x02.range().map(function(x) { return (x - view.x) / view.k; }).map(x02.invert)); if (y12) y12.domain(y02.range().map(function(y) { return (y - view.y) / view.k; }).map(y02.invert)); } function zoomstarted(dispatch) { if (!zooming++) dispatch({ type: "zoomstart" }); } function zoomed(dispatch) { rescale(); dispatch({ type: "zoom", scale: view.k, translate: [view.x, view.y] }); } function zoomended(dispatch) { if (!--zooming) dispatch({ type: "zoomend" }), center0 = null; } function mousedowned() { var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that); d3_selection_interrupt.call(that); zoomstarted(dispatch); function moved() { dragged = 1; translateTo(d3.mouse(that), location0); zoomed(dispatch); } function ended() { subject.on(mousemove, null).on(mouseup, null); dragRestore(dragged); 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, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress(that); started(); zoomstarted(dispatch); subject.on(mousedown, null).on(touchstart, started); 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 target = d3.event.target; d3.select(target).on(touchmove, moved).on(touchend, ended); targets.push(target); 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]; zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1); d3_eventPreventDefault(); } 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), p02, l02, p12, l12; d3_selection_interrupt.call(that); for (var i = 0, n = touches.length; i < n; ++i, l12 = null) { p12 = touches[i]; if (l12 = locations0[p12.identifier]) { if (l02) break; p02 = p12, l02 = l12; } } if (l12) { var distance1 = (distance1 = p12[0] - p02[0]) * distance1 + (distance1 = p12[1] - p02[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0); p02 = [(p02[0] + p12[0]) / 2, (p02[1] + p12[1]) / 2]; l02 = [(l02[0] + l12[0]) / 2, (l02[1] + l12[1]) / 2]; scaleTo(scale1 * scale0); } touchtime = null; translateTo(p02, l02); 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(); } } d3.selectAll(targets).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), translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch); mousewheelTimer = setTimeout(function() { mousewheelTimer = null; zoomended(dispatch); }, 50); d3_eventPreventDefault(); scaleTo(Math.pow(2, d3_behavior_zoomDelta() * 2e-3) * view.k); translateTo(center0, translate0); zoomed(dispatch); } function dblclicked() { var p = d3.mouse(this), k = Math.log(view.k) / Math.LN2; zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1); } return d3.rebind(zoom, event, "on"); }; var d3_behavior_zoomInfinity = [0, Infinity], d3_behavior_zoomDelta, d3_behavior_zoomWheel; d3.color = d3_color; function d3_color() { } d3_color.prototype.toString = function() { return this.rgb() + ""; }; d3.hsl = d3_hsl; function d3_hsl(h, s, l) { return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l) : arguments.length < 2 ? h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : new d3_hsl(h, s, l); } var d3_hslPrototype = d3_hsl.prototype = new d3_color(); d3_hslPrototype.brighter = function(k) { k = Math.pow(0.7, arguments.length ? k : 1); return new d3_hsl(this.h, this.s, this.l / k); }; d3_hslPrototype.darker = function(k) { k = Math.pow(0.7, arguments.length ? k : 1); return new 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 m12, 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 <= 0.5 ? l * (1 + s) : l + s - l * s; m12 = 2 * l - m2; function v(h2) { if (h2 > 360) h2 -= 360; else if (h2 < 0) h2 += 360; if (h2 < 60) return m12 + (m2 - m12) * h2 / 60; if (h2 < 180) return m2; if (h2 < 240) return m12 + (m2 - m12) * (240 - h2) / 60; return m12; } function vv2(h2) { return Math.round(v(h2) * 255); } return new d3_rgb(vv2(h + 120), vv2(h), vv2(h - 120)); } d3.hcl = d3_hcl; function d3_hcl(h, c, l) { return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l) : arguments.length < 2 ? h instanceof d3_hcl ? new 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) : new d3_hcl(h, c, l); } var d3_hclPrototype = d3_hcl.prototype = new d3_color(); d3_hclPrototype.brighter = function(k) { return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1))); }; d3_hclPrototype.darker = function(k) { return new 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 new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c); } d3.lab = d3_lab; function d3_lab(l, a, b) { return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b); } var d3_lab_K = 18; var d3_lab_X = 0.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 new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b); }; d3_labPrototype.darker = function(k) { return new 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 new d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), d3_xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), d3_xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z)); } function d3_lab_hcl(l, a, b) { return l > 0 ? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : new d3_hcl(NaN, NaN, l); } function d3_lab_xyz(x) { return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037; } function d3_xyz_lab(x) { return x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29; } function d3_xyz_rgb(r) { return Math.round(255 * (r <= 304e-5 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055)); } d3.rgb = d3_rgb; function d3_rgb(r, g, b) { return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b) : arguments.length < 2 ? r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : new d3_rgb(r, g, b); } function d3_rgbNumber(value) { return new d3_rgb(value >> 16, value >> 8 & 255, value & 255); } function d3_rgbString(value) { return d3_rgbNumber(value) + ""; } var d3_rgbPrototype = d3_rgb.prototype = new d3_color(); d3_rgbPrototype.brighter = function(k) { k = Math.pow(0.7, arguments.length ? k : 1); var r = this.r, g = this.g, b = this.b, i = 30; if (!r && !g && !b) return new d3_rgb(i, i, i); if (r && r < i) r = i; if (g && g < i) g = i; if (b && b < i) b = i; return new 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(0.7, arguments.length ? k : 1); return new 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(format2, rgb, hsl) { var r = 0, g = 0, b = 0, m12, m2, color; m12 = /([a-z]+)\((.*)\)/.exec(format2 = format2.toLowerCase()); if (m12) { m2 = m12[2].split(","); switch (m12[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(format2)) { return rgb(color.r, color.g, color.b); } if (format2 != null && format2.charAt(0) === "#" && !isNaN(color = parseInt(format2.slice(1), 16))) { if (format2.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 (format2.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 < 0.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 new 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((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / d3_lab_X), y = d3_xyz_lab((0.2126729 * r + 0.7151522 * g + 0.072175 * b) / d3_lab_Y), z = d3_xyz_lab((0.0193339 * r + 0.119192 * g + 0.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) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.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, rebeccapurple: 6697881, 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; 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 (self.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 && d3_xhrHasResponse(request) || 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, callback2) { if (arguments.length === 2 && typeof data === "function") callback2 = 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 (callback2 != null) xhr.on("error", callback2).on("load", function(request2) { callback2(null, request2); }); 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; } function d3_xhrHasResponse(request) { var type = request.responseType; return type && type !== "text" ? request.response : request.responseText; } 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 = function(d) { var obj = {}; var len = row.length; for (var k = 0; k < len; ++k) { obj[row[k]] = d[k]; } return obj; }; o = f ? function(row2, i2) { return f(a(row2), i2); } : 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.slice(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.slice(j, I - k); } return text.slice(j); } while ((t = token()) !== EOF) { var a = []; while (t !== EOL && t !== EOF) { a.push(t); t = token(); } if (f && (a = f(a, n++)) == null) 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"); var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); }; d3.timer = function() { d3_timer.apply(this, arguments); }; function d3_timer(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, 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); } return timer; } 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(), timer = d3_timer_queueHead; while (timer) { if (now >= timer.t && timer.c(now - timer.t)) timer.c = null; timer = timer.n; } return now; } function d3_timer_sweep() { var t03, t13 = d3_timer_queueHead, time = Infinity; while (t13) { if (t13.c) { if (t13.t < time) time = t13.t; t13 = (t03 = t13).n; } else { t13 = t03 ? t03.n = t13.n : d3_timer_queueHead = t13.n; } } d3_timer_queueTail = t03; return time; } d3.round = function(x, n) { return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x); }; 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], hs2 = 2; for (var i = 2; i < n; i++) { while (hs2 > 1 && d3_cross2d(points[hull[hs2 - 2]], points[hull[hs2 - 1]], points[i]) <= 0) --hs2; hull[hs2++] = i; } return hull.slice(0, hs2); } 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 * 0.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 x12 = c[0], x3 = a[0], x21 = d[0] - x12, x43 = b[0] - x3, y12 = c[1], y3 = a[1], y21 = d[1] - y12, y43 = b[1] - y3, ua2 = (x43 * (y12 - y3) - y43 * (x12 - x3)) / (y43 * x21 - x43 * y21); return [x12 + ua2 * x21, y12 + ua2 * 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, 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, hc2 = cx * cx + cy * cy, vertex = { x: (cy * hb - by * hc2) / d + ax, y: (bx * hc2 - 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 x02 = extent[0][0], x12 = extent[1][0], y02 = extent[0][1], y12 = 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 - x02) < ε && y12 - y3 > ε ? { x: x02, y: abs(x2 - x02) < ε ? y2 : y12 } : abs(y3 - y12) < ε && x12 - x3 > ε ? { x: abs(y2 - y12) < ε ? x2 : x12, y: y12 } : abs(x3 - x12) < ε && y3 - y02 > ε ? { x: x12, y: abs(x2 - x12) < ε ? y2 : y02 } : abs(y3 - y02) < ε && x3 - x02 > ε ? { x: abs(y2 - y02) < ε ? x2 : x02, y: y02 } : 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 ha2 = ax * ax + ay * ay, hc2 = cx * cx + cy * cy, x = (cy * ha2 - ay * hc2) / d, y = (ax * hc2 - cx * ha2) / 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_clipLine(x02, y02, x12, y12) { return function(line) { var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t03 = 0, t13 = 1, dx = bx - ax, dy = by - ay, r; r = x02 - ax; if (!dx && r > 0) return; r /= dx; if (dx < 0) { if (r < t03) return; if (r < t13) t13 = r; } else if (dx > 0) { if (r > t13) return; if (r > t03) t03 = r; } r = x12 - ax; if (!dx && r < 0) return; r /= dx; if (dx < 0) { if (r > t13) return; if (r > t03) t03 = r; } else if (dx > 0) { if (r < t03) return; if (r < t13) t13 = r; } r = y02 - ay; if (!dy && r > 0) return; r /= dy; if (dy < 0) { if (r < t03) return; if (r < t13) t13 = r; } else if (dy > 0) { if (r > t13) return; if (r > t03) t03 = r; } r = y12 - ay; if (!dy && r < 0) return; r /= dy; if (dy < 0) { if (r > t13) return; if (r > t03) t03 = r; } else if (dy > 0) { if (r < t03) return; if (r < t13) t13 = r; } if (t03 > 0) line.a = { x: ax + t03 * dx, y: ay + t03 * dy }; if (t13 < 1) line.b = { x: ax + t13 * dx, y: ay + t13 * dy }; return line; }; } 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 va2 = edge.a, x02 = extent[0][0], x12 = extent[1][0], y02 = extent[0][1], y12 = 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 < x02 || fx >= x12) return; if (lx > rx) { if (!va2) va2 = { x: fx, y: y02 }; else if (va2.y >= y12) return; vb = { x: fx, y: y12 }; } else { if (!va2) va2 = { x: fx, y: y12 }; else if (va2.y < y02) return; vb = { x: fx, y: y02 }; } } else { fm = (lx - rx) / (ry - ly); fb = fy - fm * fx; if (fm < -1 || fm > 1) { if (lx > rx) { if (!va2) va2 = { x: (y02 - fb) / fm, y: y02 }; else if (va2.y >= y12) return; vb = { x: (y12 - fb) / fm, y: y12 }; } else { if (!va2) va2 = { x: (y12 - fb) / fm, y: y12 }; else if (va2.y < y02) return; vb = { x: (y02 - fb) / fm, y: y02 }; } } else { if (ly < ry) { if (!va2) va2 = { x: x02, y: fm * x02 + fb }; else if (va2.x >= x12) return; vb = { x: x12, y: fm * x12 + fb }; } else { if (!va2) va2 = { x: x12, y: fm * x12 + fb }; else if (va2.x < x02) return; vb = { x: x02, y: fm * x02 + fb }; } } } edge.a = va2; 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, va2, vb) { var edge = new d3_geom_voronoiEdge(lSite, rSite); d3_geom_voronoiEdges.push(edge); if (va2) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va2); 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, va2, vb) { var edge = new d3_geom_voronoiEdge(lSite, null); edge.a = va2; 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 va2 = 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 - va2.x, va2.y - vb.y) : Math.atan2(va2.x - vb.x, vb.y - va2.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(), x02, y02, 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 !== x02 || site.y !== y02) { d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site); d3_geom_voronoiAddBeach(site); x02 = site.x, y02 = 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), x02 = clipExtent[0][0], y02 = clipExtent[0][1], x12 = clipExtent[1][0], y12 = 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 >= x02 && site.x <= x12 && site.y >= y02 && site.y <= y12 ? [[x02, y12], [x12, y12], [x12, y02], [x02, y02]] : []; 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 }; }); } 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, e02, s02, e12 = edges[m - 1].edge, s12 = e12.l === site ? e12.r : e12.l; while (++j < m) { e02 = e12; s02 = s12; e12 = edges[j].edge; s12 = e12.l === site ? e12.r : e12.l; if (i < s02.i && i < s12.i && d3_geom_voronoiTriangleArea(site, s02, s12) < 0) { triangles.push([data[i], data[s02.i], data[s12.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, x12, y12, 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 = y12; x2 = x12; y12 = x12 = 0; } return quadtree(points); } function quadtree(data) { var d, fx = d3_functor(x), fy = d3_functor(y), xs2, ys2, i, n, x1_, y1_, x2_, y2_; if (x12 != null) { x1_ = x12, y1_ = y12, x2_ = x2, y2_ = y2; } else { x2_ = y2_ = -(x1_ = y1_ = Infinity); xs2 = [], ys2 = []; 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; xs2.push(d.x); ys2.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_; xs2.push(x_); ys2.push(y_); } } var dx = x2_ - x1_, dy = y2_ - y1_; if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy; function insert(n2, d2, x3, y3, x13, y13, x22, y22) { if (isNaN(x3) || isNaN(y3)) return; if (n2.leaf) { var nx = n2.x, ny = n2.y; if (nx != null) { if (abs(nx - x3) + abs(ny - y3) < 0.01) { insertChild(n2, d2, x3, y3, x13, y13, x22, y22); } else { var nPoint = n2.point; n2.x = n2.y = n2.point = null; insertChild(n2, nPoint, nx, ny, x13, y13, x22, y22); insertChild(n2, d2, x3, y3, x13, y13, x22, y22); } } else { n2.x = x3, n2.y = y3, n2.point = d2; } } else { insertChild(n2, d2, x3, y3, x13, y13, x22, y22); } } function insertChild(n2, d2, x3, y3, x13, y13, x22, y22) { var xm = (x13 + x22) * 0.5, ym = (y13 + y22) * 0.5, right = x3 >= xm, below = y3 >= ym, i2 = below << 1 | right; n2.leaf = false; n2 = n2.nodes[i2] || (n2.nodes[i2] = d3_geom_quadtreeNode()); if (right) x13 = xm; else x22 = xm; if (below) y13 = ym; else y22 = ym; insert(n2, d2, x3, y3, x13, y13, x22, y22); } var root = d3_geom_quadtreeNode(); root.add = function(d2) { insert(root, d2, +fx(d2, ++i), +fy(d2, i), x1_, y1_, x2_, y2_); }; root.visit = function(f) { d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_); }; root.find = function(point) { return d3_geom_quadtreeFind(root, point[0], point[1], x1_, y1_, x2_, y2_); }; i = -1; if (x12 == null) { while (++i < n) { insert(root, data[i], xs2[i], ys2[i], x1_, y1_, x2_, y2_); } --i; } else data.forEach(root.add); xs2 = ys2 = 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 x12 == null ? null : [[x12, y12], [x2, y2]]; if (_ == null) x12 = y12 = x2 = y2 = null; else x12 = +_[0][0], y12 = +_[0][1], x2 = +_[1][0], y2 = +_[1][1]; return quadtree; }; quadtree.size = function(_) { if (!arguments.length) return x12 == null ? null : [x2 - x12, y2 - y12]; if (_ == null) x12 = y12 = x2 = y2 = null; else x12 = y12 = 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, x12, y12, x2, y2) { if (!f(node, x12, y12, x2, y2)) { var sx = (x12 + x2) * 0.5, sy = (y12 + y2) * 0.5, children = node.nodes; if (children[0]) d3_geom_quadtreeVisit(f, children[0], x12, y12, sx, sy); if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y12, x2, sy); if (children[2]) d3_geom_quadtreeVisit(f, children[2], x12, sy, sx, y2); if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2); } } function d3_geom_quadtreeFind(root, x, y, x02, y02, x3, y3) { var minDistance2 = Infinity, closestPoint; (function find(node, x12, y12, x2, y2) { if (x12 > x3 || y12 > y3 || x2 < x02 || y2 < y02) return; if (point = node.point) { var point, dx = x - node.x, dy = y - node.y, distance2 = dx * dx + dy * dy; if (distance2 < minDistance2) { var distance = Math.sqrt(minDistance2 = distance2); x02 = x - distance, y02 = y - distance; x3 = x + distance, y3 = y + distance; closestPoint = point; } } var children = node.nodes, xm = (x12 + x2) * 0.5, ym = (y12 + y2) * 0.5, right = x >= xm, below = y >= ym; for (var i = below << 1 | right, j = i + 4; i < j; ++i) { if (node = children[i & 3]) switch (i & 3) { case 0: find(node, x12, y12, xm, ym); break; case 1: find(node, xm, y12, x2, ym); break; case 2: find(node, x12, ym, xm, y2); break; case 3: find(node, xm, ym, x2, y2); break; } } })(root, x02, y02, x3, y3); return closestPoint; } d3.interpolateRgb = d3_interpolateRgb; function d3_interpolateRgb(a, b) { a = d3.rgb(a); b = d3.rgb(b); var ar2 = a.r, ag2 = a.g, ab = a.b, br2 = b.r - ar2, bg2 = b.g - ag2, bb = b.b - ab; return function(t) { return "#" + d3_rgb_hex(Math.round(ar2 + br2 * t)) + d3_rgb_hex(Math.round(ag2 + bg2 * 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) { a = +a, b = +b; return function(t) { return a * (1 - t) + b * t; }; } d3.interpolateString = d3_interpolateString; function d3_interpolateString(a, b) { var bi2 = d3_interpolate_numberA.lastIndex = d3_interpolate_numberB.lastIndex = 0, am, bm, bs2, i = -1, s = [], q = []; a = a + "", b = b + ""; while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) { if ((bs2 = bm.index) > bi2) { bs2 = b.slice(bi2, bs2); if (s[i]) s[i] += bs2; else s[++i] = bs2; } if ((am = am[0]) === (bm = bm[0])) { if (s[i]) s[i] += bm; else s[++i] = bm; } else { s[++i] = null; q.push({ i, x: d3_interpolateNumber(am, bm) }); } bi2 = d3_interpolate_numberB.lastIndex; } if (bi2 < b.length) { bs2 = b.slice(bi2); if (s[i]) s[i] += bs2; else s[++i] = bs2; } return s.length < 2 ? q[0] ? (b = q[0].x, function(t) { return b(t) + ""; }) : function() { return b; } : (b = q.length, function(t) { for (var i2 = 0, o; i2 < b; ++i2) s[(o = q[i2]).i] = o.x(t); return s.join(""); }); } var d3_interpolate_numberA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, d3_interpolate_numberB = new RegExp(d3_interpolate_numberA.source, "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.toLowerCase()) || /^(#|rgb\(|hsl\()/i.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 = [], na2 = a.length, nb = b.length, n02 = Math.min(a.length, b.length), i; for (i = 0; i < n02; ++i) x.push(d3_interpolate(a[i], b[i])); for (; i < na2; ++i) c[i] = a[i]; for (; i < nb; ++i) c[i] = b[i]; return function(t) { for (i = 0; i < n02; ++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.slice(0, i) : name, m = i >= 0 ? name.slice(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 0.5 * (t < 0.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 < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.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 = 0.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 + 0.75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375 : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375; } d3.interpolateHcl = d3_interpolateHcl; function d3_interpolateHcl(a, b) { a = d3.hcl(a); b = d3.hcl(b); var ah2 = a.h, ac2 = a.c, al = a.l, bh2 = b.h - ah2, bc2 = b.c - ac2, bl = b.l - al; if (isNaN(bc2)) bc2 = 0, ac2 = isNaN(ac2) ? b.c : ac2; if (isNaN(bh2)) bh2 = 0, ah2 = isNaN(ah2) ? b.h : ah2; else if (bh2 > 180) bh2 -= 360; else if (bh2 < -180) bh2 += 360; return function(t) { return d3_hcl_lab(ah2 + bh2 * t, ac2 + bc2 * t, al + bl * t) + ""; }; } d3.interpolateHsl = d3_interpolateHsl; function d3_interpolateHsl(a, b) { a = d3.hsl(a); b = d3.hsl(b); var ah2 = a.h, as2 = a.s, al = a.l, bh2 = b.h - ah2, bs2 = b.s - as2, bl = b.l - al; if (isNaN(bs2)) bs2 = 0, as2 = isNaN(as2) ? b.s : as2; if (isNaN(bh2)) bh2 = 0, ah2 = isNaN(ah2) ? b.h : ah2; else if (bh2 > 180) bh2 -= 360; else if (bh2 < -180) bh2 += 360; return function(t) { return d3_hsl_rgb(ah2 + bh2 * t, as2 + bs2 * 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, aa2 = a.a, ab = a.b, bl = b.l - al, ba2 = b.a - aa2, bb = b.b - ab; return function(t) { return d3_lab_rgb(al + bl * t, aa2 + ba2 * 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(string2) { if (string2 != null) { g.setAttribute("transform", string2); var t = g.transform.baseVal.consolidate(); } return new d3_transform(t ? t.matrix : d3_transformIdentity); })(string); }; function d3_transform(m) { var r02 = [m.a, m.b], r12 = [m.c, m.d], kx = d3_transformNormalize(r02), kz = d3_transformDot(r02, r12), ky = d3_transformNormalize(d3_transformCombine(r12, r02, -kz)) || 0; if (r02[0] * r12[1] < r12[0] * r02[1]) { r02[0] *= -1; r02[1] *= -1; kx *= -1; kz *= -1; } this.rotate = (kx ? Math.atan2(r02[1], r02[0]) : Math.atan2(-r12[0], r12[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_interpolateTransformPop(s) { return s.length ? s.pop() + "," : ""; } function d3_interpolateTranslate(ta2, tb, s, q) { if (ta2[0] !== tb[0] || ta2[1] !== tb[1]) { var i = s.push("translate(", null, ",", null, ")"); q.push({ i: i - 4, x: d3_interpolateNumber(ta2[0], tb[0]) }, { i: i - 2, x: d3_interpolateNumber(ta2[1], tb[1]) }); } else if (tb[0] || tb[1]) { s.push("translate(" + tb + ")"); } } function d3_interpolateRotate(ra2, rb, s, q) { if (ra2 !== rb) { if (ra2 - rb > 180) rb += 360; else if (rb - ra2 > 180) ra2 += 360; q.push({ i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2, x: d3_interpolateNumber(ra2, rb) }); } else if (rb) { s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")"); } } function d3_interpolateSkew(wa2, wb, s, q) { if (wa2 !== wb) { q.push({ i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2, x: d3_interpolateNumber(wa2, wb) }); } else if (wb) { s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")"); } } function d3_interpolateScale(ka2, kb, s, q) { if (ka2[0] !== kb[0] || ka2[1] !== kb[1]) { var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")"); q.push({ i: i - 4, x: d3_interpolateNumber(ka2[0], kb[0]) }, { i: i - 2, x: d3_interpolateNumber(ka2[1], kb[1]) }); } else if (kb[0] !== 1 || kb[1] !== 1) { s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")"); } } function d3_interpolateTransform(a, b) { var s = [], q = []; a = d3.transform(a), b = d3.transform(b); d3_interpolateTranslate(a.translate, b.translate, s, q); d3_interpolateRotate(a.rotate, b.rotate, s, q); d3_interpolateSkew(a.skew, b.skew, s, q); d3_interpolateScale(a.scale, b.scale, s, q); a = b = null; return function(t) { var i = -1, n = q.length, 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; return function(x) { return (x - a) / b; }; } function d3_uninterpolateClamp(a, b) { b = (b -= a = +a) || 1 / b; 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, x02, 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, i2) { d.sort(function(a, b) { return sortSubgroups(matrix[i2][a], matrix[i2][b]); }); }); } k = (τ - padding * n) / k; x = 0, i = -1; while (++i < n) { x02 = x, j = -1; while (++j < n) { var di2 = groupIndex[i], dj = subgroupIndex[di2][j], v = matrix[di2][dj], a02 = x, a12 = x += v * k; subgroups[di2 + "-" + dj] = { index: di2, subindex: dj, startAngle: a02, endAngle: a12, value: v }; } groups[di2] = { index: di2, startAngle: x02, endAngle: x, value: groupSums[di2] }; 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, 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"), timer, size = [1, 1], drag, alpha, friction = 0.9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = 0.1, theta2 = 0.64, nodes = [], links = [], distances, strengths, charges; function repulse(node) { return function(quad, x12, _, x2) { if (quad.point !== node) { var dx = quad.cx - node.x, dy = quad.cy - node.y, dw = x2 - x12, 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 *= 0.99) < 5e-3) { timer = null; 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 / (s.weight + t.weight) : 0.5); 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 }); }; 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 { timer.c = null, timer.t = NaN, timer = null; event.end({ type: "end", alpha: alpha = 0 }); } } else if (x > 0) { event.start({ type: "start", alpha: alpha = x }); timer = 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, size2) { if (!neighbors) { neighbors = new Array(n); for (j = 0; j < n; ++j) { neighbors[j] = []; } for (j = 0; j < m; ++j) { var o2 = links[j]; neighbors[o2.source.index].push(o2.target); neighbors[o2.target.index].push(o2.source); } } var candidates = neighbors[i], j = -1, l = candidates.length, x; while (++j < l) if (!isNaN(x = candidates[j][dimension])) return x; return Math.random() * size2; } return force.resume(); }; force.resume = function() { return force.alpha(0.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() - 0.5; quad.point.y += Math.random() - 0.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 hierarchy(root) { var stack = [root], nodes = [], node; root.depth = 0; while ((node = stack.pop()) != null) { nodes.push(node); if ((childs = children.call(hierarchy, node, node.depth)) && (n = childs.length)) { var n, childs, child; while (--n >= 0) { stack.push(child = childs[n]); child.parent = node; child.depth = node.depth + 1; } if (value) node.value = 0; node.children = childs; } else { if (value) node.value = +value.call(hierarchy, node, node.depth) || 0; delete node.children; } } d3_layout_hierarchyVisitAfter(root, function(node2) { var childs2, parent; if (sort && (childs2 = node2.children)) childs2.sort(sort); if (value && (parent = node2.parent)) parent.value += node2.value; }); 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) { if (value) { d3_layout_hierarchyVisitBefore(root, function(node) { if (node.children) node.value = 0; }); d3_layout_hierarchyVisitAfter(root, function(node) { var parent; if (!node.children) node.value = +value.call(hierarchy, node, node.depth) || 0; if (parent = node.parent) parent.value += node.value; }); } 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_hierarchyVisitBefore(node, callback) { var nodes = [node]; while ((node = nodes.pop()) != null) { callback(node); if ((children = node.children) && (n = children.length)) { var n, children; while (--n >= 0) nodes.push(children[n]); } } } function d3_layout_hierarchyVisitAfter(node, callback) { var nodes = [node], nodes2 = []; while ((node = nodes.pop()) != null) { nodes2.push(node); if ((children = node.children) && (n = children.length)) { var i = -1, n, children; while (++i < n) nodes.push(children[i]); } } while ((node = nodes2.pop()) != null) { callback(node); } } 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 = τ, padAngle = 0; function pie(data) { var n = data.length, values = data.map(function(d, i) { return +value.call(pie, d, i); }), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da2 = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da2) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa2 = p * (da2 < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da2 - n * pa2) / sum : 0, index = d3.range(n), arcs = [], v; 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]); }); index.forEach(function(i) { arcs[i] = { data: data[i], value: v = values[i], startAngle: a, endAngle: a += v * k + pa2, padAngle: p }; }); return arcs; } pie.value = function(_) { if (!arguments.length) return value; value = _; return pie; }; pie.sort = function(_) { if (!arguments.length) return sort; sort = _; return pie; }; pie.startAngle = function(_) { if (!arguments.length) return startAngle; startAngle = _; return pie; }; pie.endAngle = function(_) { if (!arguments.length) return endAngle; endAngle = _; return pie; }; pie.padAngle = function(_) { if (!arguments.length) return padAngle; padAngle = _; 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) { if (!(n = data.length)) return data; var series = data.map(function(d, i2) { return values.call(stack, d, i2); }); var points = series.map(function(d) { return d.map(function(v, i2) { return [x.call(stack, v, i2), y.call(stack, v, i2)]; }); }); 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 m = series[0].length, n, 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(x2) { if (!arguments.length) return values; values = x2; return stack; }; stack.order = function(x2) { if (!arguments.length) return order; order = typeof x2 === "function" ? x2 : d3_layout_stackOrders.get(x2) || d3_layout_stackOrderDefault; return stack; }; stack.offset = function(x2) { if (!arguments.length) return offset; offset = typeof x2 === "function" ? x2 : d3_layout_stackOffsets.get(x2) || 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, y02, y) { d.y0 = y02; 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, y02 = []; 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) { y02[j] = (max - sums[j]) / 2; } return y02; }, wiggle: function(data) { var n = data.length, x = data[0], m = x.length, i, j, k, s12, s2, s3, dx, o, o02, y02 = []; y02[0] = o = o02 = 0; for (j = 1; j < m; ++j) { for (i = 0, s12 = 0; i < n; ++i) s12 += 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]; } y02[j] = o -= s12 ? s2 / s12 * dx : 0; if (o < o02) o02 = o; } for (j = 0; j < m; ++j) y02[j] -= o02; return y02; }, expand: function(data) { var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y02 = []; 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) y02[j] = 0; return y02; }, 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, y02 = []; while (++j < m) y02[j] = 0; return y02; } 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.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_hierarchyVisitAfter(root, function(d2) { d2.r = +r(d2.value); }); d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); if (padding) { var dr2 = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2; d3_layout_hierarchyVisitAfter(root, function(d2) { d2.r += dr2; }); d3_layout_hierarchyVisitAfter(root, d3_layout_packSiblings); d3_layout_hierarchyVisitAfter(root, function(d2) { d2.r -= dr2; }); } 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, dr2 = a.r + b.r; return 0.999 * dr2 * dr2 > 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(node2) { xMin = Math.min(node2.x - node2.r, xMin); xMax = Math.max(node2.x + node2.r, xMax); yMin = Math.min(node2.y - node2.r, yMin); yMax = Math.max(node2.y + node2.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, s12 = 1, s2 = 1; for (j = b._pack_next; j !== b; j = j._pack_next, s12++) { 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 (s12 < s2 || s12 == 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, cr2 = 0; for (i = 0; i < n; i++) { c = nodes[i]; c.x -= cx; c.y -= cy; cr2 = Math.max(cr2, c.r + Math.sqrt(c.x * c.x + c.y * c.y)); } node.r = cr2; 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 da2 = b.r + c.r, dc2 = dx * dx + dy * dy; da2 *= da2; db *= db; var x = 0.5 + (db - da2) / (2 * dc2), y = Math.sqrt(Math.max(0, 2 * da2 * (db + dc2) - (db -= dc2) * db - da2 * da2)) / (2 * dc2); 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.tree = function() { var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [1, 1], nodeSize = null; function tree(d, i) { var nodes = hierarchy.call(this, d, i), root0 = nodes[0], root1 = wrapTree(root0); d3_layout_hierarchyVisitAfter(root1, firstWalk), root1.parent.m = -root1.z; d3_layout_hierarchyVisitBefore(root1, secondWalk); if (nodeSize) d3_layout_hierarchyVisitBefore(root0, sizeNode); else { var left = root0, right = root0, bottom = root0; d3_layout_hierarchyVisitBefore(root0, function(node) { if (node.x < left.x) left = node; if (node.x > right.x) right = node; if (node.depth > bottom.depth) bottom = node; }); var tx = separation(left, right) / 2 - left.x, kx = size[0] / (right.x + separation(right, left) / 2 + tx), ky = size[1] / (bottom.depth || 1); d3_layout_hierarchyVisitBefore(root0, function(node) { node.x = (node.x + tx) * kx; node.y = node.depth * ky; }); } return nodes; } function wrapTree(root0) { var root1 = { A: null, children: [root0] }, queue = [root1], node1; while ((node1 = queue.pop()) != null) { for (var children = node1.children, child, i = 0, n = children.length; i < n; ++i) { queue.push((children[i] = child = { _: children[i], parent: node1, children: (child = children[i].children) && child.slice() || [], A: null, a: null, z: 0, m: 0, c: 0, s: 0, t: null, i }).a = child); } } return root1.children[0]; } function firstWalk(v) { var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; if (children.length) { d3_layout_treeShift(v); var midpoint = (children[0].z + children[children.length - 1].z) / 2; if (w) { v.z = w.z + separation(v._, w._); v.m = v.z - midpoint; } else { v.z = midpoint; } } else if (w) { v.z = w.z + separation(v._, w._); } v.parent.A = apportion(v, w, v.parent.A || siblings[0]); } function secondWalk(v) { v._.x = v.z + v.parent.m; v.m += v.parent.m; } function apportion(v, w, ancestor) { if (w) { var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, 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.a = v; shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); if (shift > 0) { d3_layout_treeMove(d3_layout_treeAncestor(vim, v, ancestor), v, shift); sip += shift; sop += shift; } sim += vim.m; sip += vip.m; som += vom.m; sop += vop.m; } if (vim && !d3_layout_treeRight(vop)) { vop.t = vim; vop.m += sim - sop; } if (vip && !d3_layout_treeLeft(vom)) { vom.t = vip; vom.m += sip - som; ancestor = v; } } return ancestor; } function sizeNode(node) { node.x *= size[0]; node.y = node.depth * size[1]; } 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 ? sizeNode : null; return tree; }; tree.nodeSize = function(x) { if (!arguments.length) return nodeSize ? size : null; nodeSize = (size = x) == null ? null : sizeNode; 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(v) { var children = v.children; return children.length ? children[0] : v.t; } function d3_layout_treeRight(v) { var children = v.children, n; return (n = children.length) ? children[n - 1] : v.t; } function d3_layout_treeMove(wm, wp2, shift) { var change = shift / (wp2.i - wm.i); wp2.c -= change; wp2.s += shift; wm.c += change; wp2.z += shift; wp2.m += shift; } function d3_layout_treeShift(v) { var shift = 0, change = 0, children = v.children, i = children.length, w; while (--i >= 0) { w = children[i]; w.z += shift; w.m += shift; shift += w.s + (change += w.c); } } function d3_layout_treeAncestor(vim, v, ancestor) { return vim.a.parent === v.parent ? vim.a : ancestor; } 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_hierarchyVisitAfter(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), x02 = left.x - separation(left, right) / 2, x12 = right.x + separation(right, left) / 2; d3_layout_hierarchyVisitAfter(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 - x02) / (x12 - x02) * 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, pad2 = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = 0.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 = pad2(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 = pad2(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 = root.y = 0; if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0; 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; pad2 = (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, y, dx, dy }; } d3.random = { normal: function(mu2, sigma) { var n = arguments.length; if (n < 2) sigma = 1; if (n < 1) mu2 = 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 mu2 + sigma * 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 i02 = 0, i12 = domain.length - 1, x02 = domain[i02], x12 = domain[i12], dx; if (x12 < x02) { dx = i02, i02 = i12, i12 = dx; dx = x02, x02 = x12, x12 = dx; } domain[i02] = nice.floor(x02); domain[i12] = nice.ceil(x12); 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 j2 = d3.bisect(domain, x, 1, k) - 1; return i[j2](u[j2](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, format2) { return d3_scale_linearTickFormat(domain, m, format2); }; 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) { d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2])); return domain; } 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 <= 0.15) step *= 10; else if (err <= 0.35) step *= 5; else if (err <= 0.75) step *= 2; extent[0] = Math.ceil(extent[0] / step) * step; extent[1] = Math.floor(extent[1] / step) * step + step * 0.5; extent[2] = step; return extent; } function d3_scale_linearTicks(domain, m) { return d3.range.apply(d3, d3_scale_linearTickRange(domain, m)); } 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 + 0.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.copy = function() { return d3_scale_log(linear.copy(), base, positive, domain); }; return d3_scale_linearRebind(scale, linear); } var 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, format2) { return d3_scale_linearTickFormat(domain, m, format2); }; 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(0.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, xi2; while (++i < n) if (!index.has(xi2 = x[i])) index.set(xi2, domain.push(xi2)); 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 = domain.length < 2 ? (start = (start + stop) / 2, 0) : (stop - start) / (domain.length - 1 + padding); range = steps(start + step * padding / 2, step); rangeBand = 0; ranger = { t: "rangePoints", a: arguments }; return scale; }; scale.rangeRoundPoints = function(x, padding) { if (arguments.length < 2) padding = 0; var start = x[0], stop = x[1], step = domain.length < 2 ? (start = stop = Math.round((start + stop) / 2), 0) : (stop - start) / (domain.length - 1 + padding) | 0; range = steps(start + Math.round(step * padding / 2 + (stop - start - (domain.length - 1 + padding) * step) / 2), step); rangeBand = 0; ranger = { t: "rangeRoundPoints", 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)); range = steps(start + Math.round((stop - start - (domain.length - padding) * step) / 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.map(d3_number).filter(d3_numeric).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(x02, x12, range) { var kx, i; function scale(x) { return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x02))))]; } function rescale() { kx = range.length / (x12 - x02); i = range.length - 1; return scale; } scale.domain = function(x) { if (!arguments.length) return [x02, x12]; x02 = +x[0]; x12 = +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 + x02; return [y, y + 1 / kx]; }; scale.copy = function() { return d3_scale_quantize(x02, x12, range); }; return rescale(); } d3.scale.threshold = function() { return d3_scale_threshold([0.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, format2) { return d3_scale_linearTickFormat(domain, m, format2); }; identity.copy = function() { return d3_scale_identity(domain); }; return identity; } d3.svg = {}; function d3_zero() { return 0; } d3.svg.arc = function() { var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, cornerRadius = d3_zero, padRadius = d3_svg_arcAuto, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle, padAngle = d3_svg_arcPadAngle; function arc() { var r02 = Math.max(0, +innerRadius.apply(this, arguments)), r12 = Math.max(0, +outerRadius.apply(this, arguments)), a02 = startAngle.apply(this, arguments) - halfπ, a12 = endAngle.apply(this, arguments) - halfπ, da2 = Math.abs(a12 - a02), cw = a02 > a12 ? 0 : 1; if (r12 < r02) rc2 = r12, r12 = r02, r02 = rc2; if (da2 >= τε) return circleSegment(r12, cw) + (r02 ? circleSegment(r02, 1 - cw) : "") + "Z"; var rc2, cr2, rp2, ap2, p02 = 0, p12 = 0, x02, y02, x12, y12, x2, y2, x3, y3, path = []; if (ap2 = (+padAngle.apply(this, arguments) || 0) / 2) { rp2 = padRadius === d3_svg_arcAuto ? Math.sqrt(r02 * r02 + r12 * r12) : +padRadius.apply(this, arguments); if (!cw) p12 *= -1; if (r12) p12 = d3_asin(rp2 / r12 * Math.sin(ap2)); if (r02) p02 = d3_asin(rp2 / r02 * Math.sin(ap2)); } if (r12) { x02 = r12 * Math.cos(a02 + p12); y02 = r12 * Math.sin(a02 + p12); x12 = r12 * Math.cos(a12 - p12); y12 = r12 * Math.sin(a12 - p12); var l12 = Math.abs(a12 - a02 - 2 * p12) <= π ? 0 : 1; if (p12 && d3_svg_arcSweep(x02, y02, x12, y12) === cw ^ l12) { var h12 = (a02 + a12) / 2; x02 = r12 * Math.cos(h12); y02 = r12 * Math.sin(h12); x12 = y12 = null; } } else { x02 = y02 = 0; } if (r02) { x2 = r02 * Math.cos(a12 - p02); y2 = r02 * Math.sin(a12 - p02); x3 = r02 * Math.cos(a02 + p02); y3 = r02 * Math.sin(a02 + p02); var l02 = Math.abs(a02 - a12 + 2 * p02) <= π ? 0 : 1; if (p02 && d3_svg_arcSweep(x2, y2, x3, y3) === 1 - cw ^ l02) { var h02 = (a02 + a12) / 2; x2 = r02 * Math.cos(h02); y2 = r02 * Math.sin(h02); x3 = y3 = null; } } else { x2 = y2 = 0; } if (da2 > ε && (rc2 = Math.min(Math.abs(r12 - r02) / 2, +cornerRadius.apply(this, arguments))) > 1e-3) { cr2 = r02 < r12 ^ cw ? 0 : 1; var rc1 = rc2, rc0 = rc2; if (da2 < π) { var oc2 = x3 == null ? [x2, y2] : x12 == null ? [x02, y02] : d3_geom_polygonIntersect([x02, y02], [x3, y3], [x12, y12], [x2, y2]), ax = x02 - oc2[0], ay = y02 - oc2[1], bx = x12 - oc2[0], by = y12 - oc2[1], kc2 = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc2 = Math.sqrt(oc2[0] * oc2[0] + oc2[1] * oc2[1]); rc0 = Math.min(rc2, (r02 - lc2) / (kc2 - 1)); rc1 = Math.min(rc2, (r12 - lc2) / (kc2 + 1)); } if (x12 != null) { var t30 = d3_svg_arcCornerTangents(x3 == null ? [x2, y2] : [x3, y3], [x02, y02], r12, rc1, cw), t122 = d3_svg_arcCornerTangents([x12, y12], [x2, y2], r12, rc1, cw); if (rc2 === rc1) { path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr2, " ", t30[1], "A", r12, ",", r12, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t122[1][0], t122[1][1]), ",", cw, " ", t122[1], "A", rc1, ",", rc1, " 0 0,", cr2, " ", t122[0]); } else { path.push("M", t30[0], "A", rc1, ",", rc1, " 0 1,", cr2, " ", t122[0]); } } else { path.push("M", x02, ",", y02); } if (x3 != null) { var t03 = d3_svg_arcCornerTangents([x02, y02], [x3, y3], r02, -rc0, cw), t21 = d3_svg_arcCornerTangents([x2, y2], x12 == null ? [x02, y02] : [x12, y12], r02, -rc0, cw); if (rc2 === rc0) { path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr2, " ", t21[1], "A", r02, ",", r02, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr2, " ", t03[0]); } else { path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr2, " ", t03[0]); } } else { path.push("L", x2, ",", y2); } } else { path.push("M", x02, ",", y02); if (x12 != null) path.push("A", r12, ",", r12, " 0 ", l12, ",", cw, " ", x12, ",", y12); path.push("L", x2, ",", y2); if (x3 != null) path.push("A", r02, ",", r02, " 0 ", l02, ",", 1 - cw, " ", x3, ",", y3); } path.push("Z"); return path.join(""); } function circleSegment(r12, cw) { return "M0," + r12 + "A" + r12 + "," + r12 + " 0 1," + cw + " 0," + -r12 + "A" + r12 + "," + r12 + " 0 1," + cw + " 0," + r12; } 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.cornerRadius = function(v) { if (!arguments.length) return cornerRadius; cornerRadius = d3_functor(v); return arc; }; arc.padRadius = function(v) { if (!arguments.length) return padRadius; padRadius = v == d3_svg_arcAuto ? d3_svg_arcAuto : 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.padAngle = function(v) { if (!arguments.length) return padAngle; padAngle = 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 - halfπ; return [Math.cos(a) * r, Math.sin(a) * r]; }; return arc; }; var d3_svg_arcAuto = "auto"; 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_arcPadAngle(d) { return d && d.padAngle; } function d3_svg_arcSweep(x02, y02, x12, y12) { return (x02 - x12) * y02 - (y02 - y12) * x02 > 0 ? 0 : 1; } function d3_svg_arcCornerTangents(p02, p12, r12, rc2, cw) { var x01 = p02[0] - p12[0], y01 = p02[1] - p12[1], lo2 = (cw ? rc2 : -rc2) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo2 * y01, oy = -lo2 * x01, x12 = p02[0] + ox, y12 = p02[1] + oy, x2 = p12[0] + ox, y2 = p12[1] + oy, x3 = (x12 + x2) / 2, y3 = (y12 + y2) / 2, dx = x2 - x12, dy = y2 - y12, d2 = dx * dx + dy * dy, r = r12 - rc2, D2 = x12 * y2 - x2 * y12, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3; if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return [[cx0 - ox, cy0 - oy], [cx0 * r12 / r, cy0 * r12 / r]]; } function d3_true() { return true; } 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 = 0.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.length > 1 ? points.join("L") : points + "Z"; } function d3_svg_lineLinearClosed(points) { return points.join("L") + "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, -1), d3_svg_lineCardinalTangents(points, tension)); } function d3_svg_lineCardinalClosed(points, tension) { return points.length < 3 ? d3_svg_lineLinearClosed(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 = "", p02 = points[0], p = points[1], t03 = tangents[0], t = t03, pi2 = 1; if (quad) { path += "Q" + (p[0] - t03[0] * 2 / 3) + "," + (p[1] - t03[1] * 2 / 3) + "," + p[0] + "," + p[1]; p02 = points[1]; pi2 = 2; } if (tangents.length > 1) { t = tangents[1]; p = points[pi2]; pi2++; path += "C" + (p02[0] + t03[0]) + "," + (p02[1] + t03[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; for (var i = 2; i < tangents.length; i++, pi2++) { p = points[pi2]; t = tangents[i]; path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1]; } } if (quad) { var lp2 = points[pi2]; path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp2[0] + "," + lp2[1]; } return path; } function d3_svg_lineCardinalTangents(points, tension) { var tangents = [], a = (1 - tension) / 2, p02, p12 = points[0], p2 = points[1], i = 1, n = points.length; while (++i < n) { p02 = p12; p12 = p2; p2 = points[i]; tangents.push([a * (p2[0] - p02[0]), a * (p2[1] - p02[1])]); } return tangents; } function d3_svg_lineBasis(points) { if (points.length < 3) return d3_svg_lineLinear(points); var i = 1, n = points.length, pi2 = points[0], x02 = pi2[0], y02 = pi2[1], px = [x02, x02, x02, (pi2 = points[1])[0]], py = [y02, y02, y02, pi2[1]], path = [x02, ",", y02, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)]; points.push(points[n - 1]); while (++i <= n) { pi2 = points[i]; px.shift(); px.push(pi2[0]); py.shift(); py.push(pi2[1]); d3_svg_lineBasisBezier(path, px, py); } points.pop(); path.push("L", pi2); return path.join(""); } function d3_svg_lineBasisOpen(points) { if (points.length < 4) return d3_svg_lineLinear(points); var path = [], i = -1, n = points.length, pi2, px = [0], py = [0]; while (++i < 3) { pi2 = points[i]; px.push(pi2[0]); py.push(pi2[1]); } path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)); --i; while (++i < n) { pi2 = points[i]; px.shift(); px.push(pi2[0]); py.shift(); py.push(pi2[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, pi2, px = [], py = []; while (++i < 4) { pi2 = points[i % n]; px.push(pi2[0]); py.push(pi2[1]); } path = [d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py)]; --i; while (++i < m) { pi2 = points[i % n]; px.shift(); px.push(pi2[0]); py.shift(); py.push(pi2[1]); d3_svg_lineBasisBezier(path, px, py); } return path.join(""); } function d3_svg_lineBundle(points, tension) { var n = points.length - 1; if (n) { var x02 = points[0][0], y02 = points[0][1], dx = points[n][0] - x02, dy = points[n][1] - y02, i = -1, p, t; while (++i <= n) { p = points[i]; t = i / n; p[0] = tension * p[0] + (1 - tension) * (x02 + t * dx); p[1] = tension * p[1] + (1 - tension) * (y02 + 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(p02, p12) { return (p12[1] - p02[1]) / (p12[0] - p02[0]); } function d3_svg_lineFiniteDifferences(points) { var i = 0, j = points.length - 1, m = [], p02 = points[0], p12 = points[1], d = m[0] = d3_svg_lineSlope(p02, p12); while (++i < j) { m[i] = (d + (d = d3_svg_lineSlope(p02 = p12, p12 = 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] - halfπ; point[0] = r * Math.cos(a); point[1] = r * Math.sin(a); } return points; } function d3_svg_area(projection) { var x02 = d3_geom_pointX, x12 = d3_geom_pointX, y02 = 0, y12 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = 0.7; function area(data) { var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x02), fy0 = d3_functor(y02), fx1 = x02 === x12 ? function() { return x; } : d3_functor(x12), fy1 = y02 === y12 ? function() { return y; } : d3_functor(y12), 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 x12; x02 = x12 = _; return area; }; area.x0 = function(_) { if (!arguments.length) return x02; x02 = _; return area; }; area.x1 = function(_) { if (!arguments.length) return x12; x12 = _; return area; }; area.y = function(_) { if (!arguments.length) return y12; y02 = y12 = _; return area; }; area.y0 = function(_) { if (!arguments.length) return y02; y02 = _; return area; }; area.y1 = function(_) { if (!arguments.length) return y12; y12 = _; 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; }; function d3_source(d) { return d.source; } function d3_target(d) { return d.target; } 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(self2, f, d, i) { var subgroup2 = f.call(self2, d, i), r = radius.call(self2, subgroup2, i), a02 = startAngle.call(self2, subgroup2, i) - halfπ, a12 = endAngle.call(self2, subgroup2, i) - halfπ; return { r, a0: a02, a1: a12, p0: [r * Math.cos(a02), r * Math.sin(a02)], p1: [r * Math.cos(a12), r * Math.sin(a12)] }; } 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(r02, p02, r12, p12) { return "Q 0,0 " + p12; } 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 p02 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p02.y + p3.y) / 2, p = [p02, { x: p02.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] - halfπ; 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 + ",0Z"; }, 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); d3_selectionPrototype.transition = function(name) { var id2 = d3_transitionInheritId || ++d3_transitionId, ns2 = d3_transitionNamespace(name), 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, ns2, id2, transition); subgroup.push(node); } } return d3_transition(subgroups, ns2, id2); }; d3_selectionPrototype.interrupt = function(name) { return this.each(name == null ? d3_selection_interrupt : d3_selection_interruptNS(d3_transitionNamespace(name))); }; var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace()); function d3_selection_interruptNS(ns2) { return function() { var lock, activeId, active; if ((lock = this[ns2]) && (active = lock[activeId = lock.active])) { active.timer.c = null; active.timer.t = NaN; if (--lock.count) delete lock[activeId]; else delete this[ns2]; lock.active += 0.5; active.event && active.event.interrupt.call(this, this.__data__, active.index); } }; } function d3_transition(groups, ns2, id2) { d3_subclass(groups, d3_transitionPrototype); groups.namespace = ns2; groups.id = id2; 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, name) { return selection && selection.transition ? d3_transitionInheritId ? selection.transition(name) : selection : d3.selection().transition(selection); }; d3.transition.prototype = d3_transitionPrototype; d3_transitionPrototype.select = function(selector) { var id2 = this.id, ns2 = this.namespace, 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, ns2, id2, node[ns2][id2]); subgroup.push(subnode); } else { subgroup.push(null); } } } return d3_transition(subgroups, ns2, id2); }; d3_transitionPrototype.selectAll = function(selector) { var id2 = this.id, ns2 = this.namespace, 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[ns2][id2]; 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, ns2, id2, transition); subgroup.push(subnode); } } } } return d3_transition(subgroups, ns2, id2); }; 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.namespace, this.id); }; d3_transitionPrototype.tween = function(name, tween) { var id2 = this.id, ns2 = this.namespace; if (arguments.length < 2) return this.node()[ns2][id2].tween.get(name); return d3_selection_each(this, tween == null ? function(node) { node[ns2][id2].tween.remove(name); } : function(node) { node[ns2][id2].tween.set(name, tween); }); }; function d3_transition_tween(groups, name, value, tween) { var id2 = groups.id, ns2 = groups.namespace; return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) { node[ns2][id2].tween.set(name, tween(value.call(node, node.__data__, i, j))); } : (value = tween(value), function(node) { node[ns2][id2].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(this).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(this).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() { var ns2 = this.namespace; return this.each("end.transition", function() { var p; if (this[ns2].count < 2 && (p = this.parentNode)) p.removeChild(this); }); }; d3_transitionPrototype.ease = function(value) { var id2 = this.id, ns2 = this.namespace; if (arguments.length < 1) return this.node()[ns2][id2].ease; if (typeof value !== "function") value = d3.ease.apply(d3, arguments); return d3_selection_each(this, function(node) { node[ns2][id2].ease = value; }); }; d3_transitionPrototype.delay = function(value) { var id2 = this.id, ns2 = this.namespace; if (arguments.length < 1) return this.node()[ns2][id2].delay; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { node[ns2][id2].delay = +value.call(node, node.__data__, i, j); } : (value = +value, function(node) { node[ns2][id2].delay = value; })); }; d3_transitionPrototype.duration = function(value) { var id2 = this.id, ns2 = this.namespace; if (arguments.length < 1) return this.node()[ns2][id2].duration; return d3_selection_each(this, typeof value === "function" ? function(node, i, j) { node[ns2][id2].duration = Math.max(1, value.call(node, node.__data__, i, j)); } : (value = Math.max(1, value), function(node) { node[ns2][id2].duration = value; })); }; d3_transitionPrototype.each = function(type, listener) { var id2 = this.id, ns2 = this.namespace; if (arguments.length < 2) { var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId; try { d3_transitionInheritId = id2; d3_selection_each(this, function(node, i, j) { d3_transitionInherit = node[ns2][id2]; type.call(node, node.__data__, i, j); }); } finally { d3_transitionInherit = inherit; d3_transitionInheritId = inheritId; } } else { d3_selection_each(this, function(node) { var transition = node[ns2][id2]; (transition.event || (transition.event = d3.dispatch("start", "end", "interrupt"))).on(type, listener); }); } return this; }; d3_transitionPrototype.transition = function() { var id0 = this.id, id1 = ++d3_transitionId, ns2 = this.namespace, 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 = node[ns2][id0]; d3_transitionNode(node, i, ns2, id1, { time: transition.time, ease: transition.ease, delay: transition.delay + transition.duration, duration: transition.duration }); } subgroup.push(node); } } return d3_transition(subgroups, ns2, id1); }; function d3_transitionNamespace(name) { return name == null ? "__transition__" : "__transition_" + name + "__"; } function d3_transitionNode(node, i, ns2, id2, inherit) { var lock = node[ns2] || (node[ns2] = { active: 0, count: 0 }), transition = lock[id2], time, timer, duration, ease, tweens; function schedule(elapsed) { var delay = transition.delay; timer.t = delay + time; if (delay <= elapsed) return start(elapsed - delay); timer.c = start; } function start(elapsed) { var activeId = lock.active, active = lock[activeId]; if (active) { active.timer.c = null; active.timer.t = NaN; --lock.count; delete lock[activeId]; active.event && active.event.interrupt.call(node, node.__data__, active.index); } for (var cancelId in lock) { if (+cancelId < id2) { var cancel = lock[cancelId]; cancel.timer.c = null; cancel.timer.t = NaN; --lock.count; delete lock[cancelId]; } } timer.c = tick; d3_timer(function() { if (timer.c && tick(elapsed || 1)) { timer.c = null; timer.t = NaN; } return 1; }, 0, time); lock.active = id2; transition.event && transition.event.start.call(node, node.__data__, i); tweens = []; transition.tween.forEach(function(key, value) { if (value = value.call(node, node.__data__, i)) { tweens.push(value); } }); ease = transition.ease; duration = transition.duration; } function tick(elapsed) { var t = elapsed / duration, e = ease(t), n = tweens.length; while (n > 0) { tweens[--n].call(node, e); } if (t >= 1) { transition.event && transition.event.end.call(node, node.__data__, i); if (--lock.count) delete lock[id2]; else delete node[ns2]; return 1; } } if (!transition) { time = inherit.time; timer = d3_timer(schedule, 0, time); transition = lock[id2] = { tween: new d3_Map(), time, timer, delay: inherit.delay, duration: inherit.duration, ease: inherit.ease, index: i }; inherit = null; ++lock.count; } } 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 g2 = 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 = g2.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), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform; var range = d3_scaleRange(scale1), path = g2.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"), sign = orient === "top" || orient === "left" ? -1 : 1, x12, x2, y12, y2; if (orient === "bottom" || orient === "top") { tickTransform = d3_svg_axisX, x12 = "x", y12 = "y", x2 = "x2", y2 = "y2"; text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle"); pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize); } else { tickTransform = d3_svg_axisY, x12 = "y", y12 = "x", x2 = "y2", y2 = "x2"; text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start"); pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize); } lineEnter.attr(y2, sign * innerTickSize); textEnter.attr(y12, sign * tickSpacing); lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize); textUpdate.attr(x12, 0).attr(y12, sign * tickSpacing); 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, scale0); } tickEnter.call(tickTransform, scale0, scale1); tickUpdate.call(tickTransform, scale1, 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_ = d3_array(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, x02, x12) { selection.attr("transform", function(d) { var v02 = x02(d); return "translate(" + (isFinite(v02) ? v02 : x12(d)) + ",0)"; }); } function d3_svg_axisY(selection, y02, y12) { selection.attr("transform", function(d) { var v02 = y02(d); return "translate(0," + (isFinite(v02) ? v02 : y12(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 g2 = 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 = g2.selectAll(".background").data([0]); background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair"); g2.selectAll(".extent").data([0]).enter().append("rect").attr("class", "extent").style("cursor", "move"); var resize = g2.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(g2), 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 xi2 = d3_interpolateArray(xExtent, extent1.x), yi2 = d3_interpolateArray(yExtent, extent1.y); xExtentDomain = yExtentDomain = null; return function(t) { xExtent = extent1.x = xi2(t); yExtent = extent1.y = yi2(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(target), center, origin = d3.mouse(target), offset; var w = d3.select(d3_window(target)).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), r02 = range[0], r12 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max; if (dragging) { r02 -= position; r12 -= size + position; } min = (i ? yClamp : xClamp) ? Math.max(r02, Math.min(r12, point[i])) : point[i]; if (dragging) { max = (min += position) + size; } else { if (center) position = Math.max(r02, Math.min(r12, 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 x02, x12, y02, y12, t; if (!arguments.length) { if (x) { if (xExtentDomain) { x02 = xExtentDomain[0], x12 = xExtentDomain[1]; } else { x02 = xExtent[0], x12 = xExtent[1]; if (x.invert) x02 = x.invert(x02), x12 = x.invert(x12); if (x12 < x02) t = x02, x02 = x12, x12 = t; } } if (y) { if (yExtentDomain) { y02 = yExtentDomain[0], y12 = yExtentDomain[1]; } else { y02 = yExtent[0], y12 = yExtent[1]; if (y.invert) y02 = y.invert(y02), y12 = y.invert(y12); if (y12 < y02) t = y02, y02 = y12, y12 = t; } } return x && y ? [[x02, y02], [x12, y12]] : x ? [x02, x12] : y && [y02, y12]; } if (x) { x02 = z[0], x12 = z[1]; if (y) x02 = x02[0], x12 = x12[0]; xExtentDomain = [x02, x12]; if (x.invert) x02 = x(x02), x12 = x(x12); if (x12 < x02) t = x02, x02 = x12, x12 = t; if (x02 != xExtent[0] || x12 != xExtent[1]) xExtent = [x02, x12]; } if (y) { y02 = z[0], y12 = z[1]; if (x) y02 = y02[1], y12 = y12[1]; yExtentDomain = [y02, y12]; if (y.invert) y02 = y(y02), y12 = y(y12); if (y12 < y02) t = y02, y02 = y12, y12 = t; if (y02 != yExtent[0] || y12 != yExtent[1]) yExtent = [y02, y12]; } 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"], []]; 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 module2 === "object" && module2.exports) module2.exports = d3; else this.d3 = d3; }).apply(self); } }); // node_modules/d3-time/src/interval.js function newInterval(floori, offseti, count, field) { function interval(date) { return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date; } interval.floor = function(date) { return floori(date = /* @__PURE__ */ new Date(+date)), date; }; interval.ceil = function(date) { return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; }; interval.round = function(date) { var d02 = interval(date), d12 = interval.ceil(date); return date - d02 < d12 - date ? d02 : d12; }; interval.offset = function(date, step) { return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date; }; interval.range = function(start, stop, step) { var range = [], previous; start = interval.ceil(start); step = step == null ? 1 : Math.floor(step); if (!(start < stop) || !(step > 0)) return range; do range.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); while (previous < start && start < stop); return range; }; interval.filter = function(test) { return newInterval(function(date) { if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); }, function(date, step) { if (date >= date) { if (step < 0) while (++step <= 0) { while (offseti(date, -1), !test(date)) { } } else while (--step >= 0) { while (offseti(date, 1), !test(date)) { } } } }); }; if (count) { interval.count = function(start, end) { t0.setTime(+start), t1.setTime(+end); floori(t0), floori(t1); return Math.floor(count(t0, t1)); }; interval.every = function(step) { step = Math.floor(step); return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function(d) { return field(d) % step === 0; } : function(d) { return interval.count(0, d) % step === 0; }); }; } return interval; } var t0, t1; var init_interval = __esm({ "node_modules/d3-time/src/interval.js"() { t0 = /* @__PURE__ */ new Date(); t1 = /* @__PURE__ */ new Date(); } }); // node_modules/d3-time/src/millisecond.js var millisecond, millisecond_default, milliseconds; var init_millisecond = __esm({ "node_modules/d3-time/src/millisecond.js"() { init_interval(); millisecond = newInterval(function() { }, function(date, step) { date.setTime(+date + step); }, function(start, end) { return end - start; }); millisecond.every = function(k) { k = Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; return newInterval(function(date) { date.setTime(Math.floor(date / k) * k); }, function(date, step) { date.setTime(+date + step * k); }, function(start, end) { return (end - start) / k; }); }; millisecond_default = millisecond; milliseconds = millisecond.range; } }); // node_modules/d3-time/src/duration.js var durationSecond, durationMinute, durationHour, durationDay, durationWeek; var init_duration = __esm({ "node_modules/d3-time/src/duration.js"() { durationSecond = 1e3; durationMinute = 6e4; durationHour = 36e5; durationDay = 864e5; durationWeek = 6048e5; } }); // node_modules/d3-time/src/second.js var second, second_default, seconds; var init_second = __esm({ "node_modules/d3-time/src/second.js"() { init_interval(); init_duration(); second = newInterval(function(date) { date.setTime(date - date.getMilliseconds()); }, function(date, step) { date.setTime(+date + step * durationSecond); }, function(start, end) { return (end - start) / durationSecond; }, function(date) { return date.getUTCSeconds(); }); second_default = second; seconds = second.range; } }); // node_modules/d3-time/src/minute.js var minute, minute_default, minutes; var init_minute = __esm({ "node_modules/d3-time/src/minute.js"() { init_interval(); init_duration(); minute = newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getMinutes(); }); minute_default = minute; minutes = minute.range; } }); // node_modules/d3-time/src/hour.js var hour, hour_default, hours; var init_hour = __esm({ "node_modules/d3-time/src/hour.js"() { init_interval(); init_duration(); hour = newInterval(function(date) { date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getHours(); }); hour_default = hour; hours = hour.range; } }); // node_modules/d3-time/src/day.js var day, day_default, days; var init_day = __esm({ "node_modules/d3-time/src/day.js"() { init_interval(); init_duration(); day = newInterval(function(date) { date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay; }, function(date) { return date.getDate() - 1; }); day_default = day; days = day.range; } }); // node_modules/d3-time/src/week.js function weekday(i) { return newInterval(function(date) { date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setDate(date.getDate() + step * 7); }, function(start, end) { return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; }); } var sunday, monday, tuesday, wednesday, thursday, friday, saturday, sundays, mondays, tuesdays, wednesdays, thursdays, fridays, saturdays; var init_week = __esm({ "node_modules/d3-time/src/week.js"() { init_interval(); init_duration(); sunday = weekday(0); monday = weekday(1); tuesday = weekday(2); wednesday = weekday(3); thursday = weekday(4); friday = weekday(5); saturday = weekday(6); sundays = sunday.range; mondays = monday.range; tuesdays = tuesday.range; wednesdays = wednesday.range; thursdays = thursday.range; fridays = friday.range; saturdays = saturday.range; } }); // node_modules/d3-time/src/month.js var month, month_default, months; var init_month = __esm({ "node_modules/d3-time/src/month.js"() { init_interval(); month = newInterval(function(date) { date.setDate(1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setMonth(date.getMonth() + step); }, function(start, end) { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; }, function(date) { return date.getMonth(); }); month_default = month; months = month.range; } }); // node_modules/d3-time/src/year.js var year, year_default, years; var init_year = __esm({ "node_modules/d3-time/src/year.js"() { init_interval(); year = newInterval(function(date) { date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step); }, function(start, end) { return end.getFullYear() - start.getFullYear(); }, function(date) { return date.getFullYear(); }); year.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { date.setFullYear(Math.floor(date.getFullYear() / k) * k); date.setMonth(0, 1); date.setHours(0, 0, 0, 0); }, function(date, step) { date.setFullYear(date.getFullYear() + step * k); }); }; year_default = year; years = year.range; } }); // node_modules/d3-time/src/utcMinute.js var utcMinute, utcMinute_default, utcMinutes; var init_utcMinute = __esm({ "node_modules/d3-time/src/utcMinute.js"() { init_interval(); init_duration(); utcMinute = newInterval(function(date) { date.setUTCSeconds(0, 0); }, function(date, step) { date.setTime(+date + step * durationMinute); }, function(start, end) { return (end - start) / durationMinute; }, function(date) { return date.getUTCMinutes(); }); utcMinute_default = utcMinute; utcMinutes = utcMinute.range; } }); // node_modules/d3-time/src/utcHour.js var utcHour, utcHour_default, utcHours; var init_utcHour = __esm({ "node_modules/d3-time/src/utcHour.js"() { init_interval(); init_duration(); utcHour = newInterval(function(date) { date.setUTCMinutes(0, 0, 0); }, function(date, step) { date.setTime(+date + step * durationHour); }, function(start, end) { return (end - start) / durationHour; }, function(date) { return date.getUTCHours(); }); utcHour_default = utcHour; utcHours = utcHour.range; } }); // node_modules/d3-time/src/utcDay.js var utcDay, utcDay_default, utcDays; var init_utcDay = __esm({ "node_modules/d3-time/src/utcDay.js"() { init_interval(); init_duration(); utcDay = newInterval(function(date) { date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step); }, function(start, end) { return (end - start) / durationDay; }, function(date) { return date.getUTCDate() - 1; }); utcDay_default = utcDay; utcDays = utcDay.range; } }); // node_modules/d3-time/src/utcWeek.js function utcWeekday(i) { return newInterval(function(date) { date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCDate(date.getUTCDate() + step * 7); }, function(start, end) { return (end - start) / durationWeek; }); } var utcSunday, utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSundays, utcMondays, utcTuesdays, utcWednesdays, utcThursdays, utcFridays, utcSaturdays; var init_utcWeek = __esm({ "node_modules/d3-time/src/utcWeek.js"() { init_interval(); init_duration(); utcSunday = utcWeekday(0); utcMonday = utcWeekday(1); utcTuesday = utcWeekday(2); utcWednesday = utcWeekday(3); utcThursday = utcWeekday(4); utcFriday = utcWeekday(5); utcSaturday = utcWeekday(6); utcSundays = utcSunday.range; utcMondays = utcMonday.range; utcTuesdays = utcTuesday.range; utcWednesdays = utcWednesday.range; utcThursdays = utcThursday.range; utcFridays = utcFriday.range; utcSaturdays = utcSaturday.range; } }); // node_modules/d3-time/src/utcMonth.js var utcMonth, utcMonth_default, utcMonths; var init_utcMonth = __esm({ "node_modules/d3-time/src/utcMonth.js"() { init_interval(); utcMonth = newInterval(function(date) { date.setUTCDate(1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCMonth(date.getUTCMonth() + step); }, function(start, end) { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; }, function(date) { return date.getUTCMonth(); }); utcMonth_default = utcMonth; utcMonths = utcMonth.range; } }); // node_modules/d3-time/src/utcYear.js var utcYear, utcYear_default, utcYears; var init_utcYear = __esm({ "node_modules/d3-time/src/utcYear.js"() { init_interval(); utcYear = newInterval(function(date) { date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step); }, function(start, end) { return end.getUTCFullYear() - start.getUTCFullYear(); }, function(date) { return date.getUTCFullYear(); }); utcYear.every = function(k) { return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); date.setUTCMonth(0, 1); date.setUTCHours(0, 0, 0, 0); }, function(date, step) { date.setUTCFullYear(date.getUTCFullYear() + step * k); }); }; utcYear_default = utcYear; utcYears = utcYear.range; } }); // node_modules/d3-time/src/index.js var src_exports = {}; __export(src_exports, { timeDay: () => day_default, timeDays: () => days, timeFriday: () => friday, timeFridays: () => fridays, timeHour: () => hour_default, timeHours: () => hours, timeInterval: () => newInterval, timeMillisecond: () => millisecond_default, timeMilliseconds: () => milliseconds, timeMinute: () => minute_default, timeMinutes: () => minutes, timeMonday: () => monday, timeMondays: () => mondays, timeMonth: () => month_default, timeMonths: () => months, timeSaturday: () => saturday, timeSaturdays: () => saturdays, timeSecond: () => second_default, timeSeconds: () => seconds, timeSunday: () => sunday, timeSundays: () => sundays, timeThursday: () => thursday, timeThursdays: () => thursdays, timeTuesday: () => tuesday, timeTuesdays: () => tuesdays, timeWednesday: () => wednesday, timeWednesdays: () => wednesdays, timeWeek: () => sunday, timeWeeks: () => sundays, timeYear: () => year_default, timeYears: () => years, utcDay: () => utcDay_default, utcDays: () => utcDays, utcFriday: () => utcFriday, utcFridays: () => utcFridays, utcHour: () => utcHour_default, utcHours: () => utcHours, utcMillisecond: () => millisecond_default, utcMilliseconds: () => milliseconds, utcMinute: () => utcMinute_default, utcMinutes: () => utcMinutes, utcMonday: () => utcMonday, utcMondays: () => utcMondays, utcMonth: () => utcMonth_default, utcMonths: () => utcMonths, utcSaturday: () => utcSaturday, utcSaturdays: () => utcSaturdays, utcSecond: () => second_default, utcSeconds: () => seconds, utcSunday: () => utcSunday, utcSundays: () => utcSundays, utcThursday: () => utcThursday, utcThursdays: () => utcThursdays, utcTuesday: () => utcTuesday, utcTuesdays: () => utcTuesdays, utcWednesday: () => utcWednesday, utcWednesdays: () => utcWednesdays, utcWeek: () => utcSunday, utcWeeks: () => utcSundays, utcYear: () => utcYear_default, utcYears: () => utcYears }); var init_src = __esm({ "node_modules/d3-time/src/index.js"() { init_interval(); init_millisecond(); init_second(); init_minute(); init_hour(); init_day(); init_week(); init_month(); init_year(); init_utcMinute(); init_utcHour(); init_utcDay(); init_utcWeek(); init_utcMonth(); init_utcYear(); } }); // node_modules/d3-time-format/src/locale.js function localDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date.setFullYear(d.y); return date; } return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); } function utcDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); date.setUTCFullYear(d.y); return date; } return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); } function newDate(y, m, d) { return { y, m, d, H: 0, M: 0, S: 0, L: 0 }; } function formatLocale(locale3) { var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths; var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); var formats = { "a": formatShortWeekday, "A": formatWeekday, "b": formatShortMonth, "B": formatMonth, "c": null, "d": formatDayOfMonth, "e": formatDayOfMonth, "f": formatMicroseconds, "g": formatYearISO, "G": formatFullYearISO, "H": formatHour24, "I": formatHour12, "j": formatDayOfYear, "L": formatMilliseconds, "m": formatMonthNumber, "M": formatMinutes, "p": formatPeriod, "q": formatQuarter, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatSeconds, "u": formatWeekdayNumberMonday, "U": formatWeekNumberSunday, "V": formatWeekNumberISO, "w": formatWeekdayNumberSunday, "W": formatWeekNumberMonday, "x": null, "X": null, "y": formatYear, "Y": formatFullYear, "Z": formatZone, "%": formatLiteralPercent }; var utcFormats = { "a": formatUTCShortWeekday, "A": formatUTCWeekday, "b": formatUTCShortMonth, "B": formatUTCMonth, "c": null, "d": formatUTCDayOfMonth, "e": formatUTCDayOfMonth, "f": formatUTCMicroseconds, "g": formatUTCYearISO, "G": formatUTCFullYearISO, "H": formatUTCHour24, "I": formatUTCHour12, "j": formatUTCDayOfYear, "L": formatUTCMilliseconds, "m": formatUTCMonthNumber, "M": formatUTCMinutes, "p": formatUTCPeriod, "q": formatUTCQuarter, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatUTCSeconds, "u": formatUTCWeekdayNumberMonday, "U": formatUTCWeekNumberSunday, "V": formatUTCWeekNumberISO, "w": formatUTCWeekdayNumberSunday, "W": formatUTCWeekNumberMonday, "x": null, "X": null, "y": formatUTCYear, "Y": formatUTCFullYear, "Z": formatUTCZone, "%": formatLiteralPercent }; var parses = { "a": parseShortWeekday, "A": parseWeekday, "b": parseShortMonth, "B": parseMonth, "c": parseLocaleDateTime, "d": parseDayOfMonth, "e": parseDayOfMonth, "f": parseMicroseconds, "g": parseYear, "G": parseFullYear, "H": parseHour24, "I": parseHour24, "j": parseDayOfYear, "L": parseMilliseconds, "m": parseMonthNumber, "M": parseMinutes, "p": parsePeriod, "q": parseQuarter, "Q": parseUnixTimestamp, "s": parseUnixTimestampSeconds, "S": parseSeconds, "u": parseWeekdayNumberMonday, "U": parseWeekNumberSunday, "V": parseWeekNumberISO, "w": parseWeekdayNumberSunday, "W": parseWeekNumberMonday, "x": parseLocaleDate, "X": parseLocaleTime, "y": parseYear, "Y": parseFullYear, "Z": parseZone, "%": parseLiteralPercent }; formats.x = newFormat(locale_date, formats); formats.X = newFormat(locale_time, formats); formats.c = newFormat(locale_dateTime, formats); utcFormats.x = newFormat(locale_date, utcFormats); utcFormats.X = newFormat(locale_time, utcFormats); utcFormats.c = newFormat(locale_dateTime, utcFormats); function newFormat(specifier, formats2) { return function(date) { var string = [], i = -1, j = 0, n = specifier.length, c, pad2, format2; if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date); while (++i < n) { if (specifier.charCodeAt(i) === 37) { string.push(specifier.slice(j, i)); if ((pad2 = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); else pad2 = c === "e" ? " " : "0"; if (format2 = formats2[c]) c = format2(date, pad2); string.push(c); j = i + 1; } } string.push(specifier.slice(j, i)); return string.join(""); }; } function newParse(specifier, Z) { return function(string) { var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day2; if (i != string.length) return null; if ("Q" in d) return new Date(d.Q); if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); if (Z && !("Z" in d)) d.Z = 0; if ("p" in d) d.H = d.H % 12 + d.p * 12; if (d.m === void 0) d.m = "q" in d ? d.q : 0; if ("V" in d) { if (d.V < 1 || d.V > 53) return null; if (!("w" in d)) d.w = 1; if ("Z" in d) { week = utcDate(newDate(d.y, 0, 1)), day2 = week.getUTCDay(); week = day2 > 4 || day2 === 0 ? utcMonday.ceil(week) : utcMonday(week); week = utcDay_default.offset(week, (d.V - 1) * 7); d.y = week.getUTCFullYear(); d.m = week.getUTCMonth(); d.d = week.getUTCDate() + (d.w + 6) % 7; } else { week = localDate(newDate(d.y, 0, 1)), day2 = week.getDay(); week = day2 > 4 || day2 === 0 ? monday.ceil(week) : monday(week); week = day_default.offset(week, (d.V - 1) * 7); d.y = week.getFullYear(); d.m = week.getMonth(); d.d = week.getDate() + (d.w + 6) % 7; } } else if ("W" in d || "U" in d) { if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; day2 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); d.m = 0; d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day2 + 5) % 7 : d.w + d.U * 7 - (day2 + 6) % 7; } if ("Z" in d) { d.H += d.Z / 100 | 0; d.M += d.Z % 100; return utcDate(d); } return localDate(d); }; } function parseSpecifier(d, specifier, string, j) { var i = 0, n = specifier.length, m = string.length, c, parse; while (i < n) { if (j >= m) return -1; c = specifier.charCodeAt(i++); if (c === 37) { c = specifier.charAt(i++); parse = parses[c in pads ? specifier.charAt(i++) : c]; if (!parse || (j = parse(d, string, j)) < 0) return -1; } else if (c != string.charCodeAt(j++)) { return -1; } } return j; } function parsePeriod(d, string, i) { var n = periodRe.exec(string.slice(i)); return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortWeekday(d, string, i) { var n = shortWeekdayRe.exec(string.slice(i)); return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseWeekday(d, string, i) { var n = weekdayRe.exec(string.slice(i)); return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseShortMonth(d, string, i) { var n = shortMonthRe.exec(string.slice(i)); return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseMonth(d, string, i) { var n = monthRe.exec(string.slice(i)); return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseLocaleDateTime(d, string, i) { return parseSpecifier(d, locale_dateTime, string, i); } function parseLocaleDate(d, string, i) { return parseSpecifier(d, locale_date, string, i); } function parseLocaleTime(d, string, i) { return parseSpecifier(d, locale_time, string, i); } function formatShortWeekday(d) { return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { return locale_months[d.getMonth()]; } function formatPeriod(d) { return locale_periods[+(d.getHours() >= 12)]; } function formatQuarter(d) { return 1 + ~~(d.getMonth() / 3); } function formatUTCShortWeekday(d) { return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { return locale_periods[+(d.getUTCHours() >= 12)]; } function formatUTCQuarter(d) { return 1 + ~~(d.getUTCMonth() / 3); } return { format: function(specifier) { var f = newFormat(specifier += "", formats); f.toString = function() { return specifier; }; return f; }, parse: function(specifier) { var p = newParse(specifier += "", false); p.toString = function() { return specifier; }; return p; }, utcFormat: function(specifier) { var f = newFormat(specifier += "", utcFormats); f.toString = function() { return specifier; }; return f; }, utcParse: function(specifier) { var p = newParse(specifier += "", true); p.toString = function() { return specifier; }; return p; } }; } function pad(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 requote(s) { return s.replace(requoteRe, "\\$&"); } function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { var map2 = {}, i = -1, n = names.length; while (++i < n) map2[names[i].toLowerCase()] = i; return map2; } function parseWeekdayNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; } function parseWeekdayNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; } function parseWeekNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; } function parseWeekNumberISO(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; } function parseWeekNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; } function parseFullYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; } function parseYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; } function parseZone(d, string, i) { var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; } function parseQuarter(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; } function parseMonthNumber(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; } function parseDayOfMonth(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; } function parseDayOfYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; } function parseHour24(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; } function parseMinutes(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; } function parseSeconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; } function parseMilliseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; } function parseMicroseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 6)); return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; } function parseLiteralPercent(d, string, i) { var n = percentRe.exec(string.slice(i, i + 1)); return n ? i + n[0].length : -1; } function parseUnixTimestamp(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; } function parseUnixTimestampSeconds(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.s = +n[0], i + n[0].length) : -1; } function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); } function formatHour24(d, p) { return pad(d.getHours(), p, 2); } function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); } function formatDayOfYear(d, p) { return pad(1 + day_default.count(year_default(d), d), p, 3); } function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); } function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; } function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); } function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); } function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); } function formatWeekdayNumberMonday(d) { var day2 = d.getDay(); return day2 === 0 ? 7 : day2; } function formatWeekNumberSunday(d, p) { return pad(sunday.count(year_default(d) - 1, d), p, 2); } function dISO(d) { var day2 = d.getDay(); return day2 >= 4 || day2 === 0 ? thursday(d) : thursday.ceil(d); } function formatWeekNumberISO(d, p) { d = dISO(d); return pad(thursday.count(year_default(d), d) + (year_default(d).getDay() === 4), p, 2); } function formatWeekdayNumberSunday(d) { return d.getDay(); } function formatWeekNumberMonday(d, p) { return pad(monday.count(year_default(d) - 1, d), p, 2); } function formatYear(d, p) { return pad(d.getFullYear() % 100, p, 2); } function formatYearISO(d, p) { d = dISO(d); return pad(d.getFullYear() % 100, p, 2); } function formatFullYear(d, p) { return pad(d.getFullYear() % 1e4, p, 4); } function formatFullYearISO(d, p) { var day2 = d.getDay(); d = day2 >= 4 || day2 === 0 ? thursday(d) : thursday.ceil(d); return pad(d.getFullYear() % 1e4, p, 4); } function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); } function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); } function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); } function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); } function formatUTCDayOfYear(d, p) { return pad(1 + utcDay_default.count(utcYear_default(d), d), p, 3); } function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); } function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; } function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); } function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); } function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); } function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; } function formatUTCWeekNumberSunday(d, p) { return pad(utcSunday.count(utcYear_default(d) - 1, d), p, 2); } function UTCdISO(d) { var day2 = d.getUTCDay(); return day2 >= 4 || day2 === 0 ? utcThursday(d) : utcThursday.ceil(d); } function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); return pad(utcThursday.count(utcYear_default(d), d) + (utcYear_default(d).getUTCDay() === 4), p, 2); } function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); } function formatUTCWeekNumberMonday(d, p) { return pad(utcMonday.count(utcYear_default(d) - 1, d), p, 2); } function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCYearISO(d, p) { d = UTCdISO(d); return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCFullYear(d, p) { return pad(d.getUTCFullYear() % 1e4, p, 4); } function formatUTCFullYearISO(d, p) { var day2 = d.getUTCDay(); d = day2 >= 4 || day2 === 0 ? utcThursday(d) : utcThursday.ceil(d); return pad(d.getUTCFullYear() % 1e4, p, 4); } function formatUTCZone() { return "+0000"; } function formatLiteralPercent() { return "%"; } function formatUnixTimestamp(d) { return +d; } function formatUnixTimestampSeconds(d) { return Math.floor(+d / 1e3); } var pads, numberRe, percentRe, requoteRe; var init_locale = __esm({ "node_modules/d3-time-format/src/locale.js"() { init_src(); pads = { "-": "", "_": " ", "0": "0" }; numberRe = /^\s*\d+/; percentRe = /^%/; requoteRe = /[\\^$*+?|[\]().{}]/g; } }); // node_modules/d3-time-format/src/defaultLocale.js function defaultLocale(definition) { locale = formatLocale(definition); timeFormat = locale.format; timeParse = locale.parse; utcFormat = locale.utcFormat; utcParse = locale.utcParse; return locale; } var locale, timeFormat, timeParse, utcFormat, utcParse; var init_defaultLocale = __esm({ "node_modules/d3-time-format/src/defaultLocale.js"() { init_locale(); defaultLocale({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", 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"] }); } }); // node_modules/d3-time-format/src/isoFormat.js function formatIsoNative(date) { return date.toISOString(); } var isoSpecifier, formatIso, isoFormat_default; var init_isoFormat = __esm({ "node_modules/d3-time-format/src/isoFormat.js"() { init_defaultLocale(); isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; formatIso = Date.prototype.toISOString ? formatIsoNative : utcFormat(isoSpecifier); isoFormat_default = formatIso; } }); // node_modules/d3-time-format/src/isoParse.js function parseIsoNative(string) { var date = new Date(string); return isNaN(date) ? null : date; } var parseIso, isoParse_default; var init_isoParse = __esm({ "node_modules/d3-time-format/src/isoParse.js"() { init_isoFormat(); init_defaultLocale(); parseIso = +/* @__PURE__ */ new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : utcParse(isoSpecifier); isoParse_default = parseIso; } }); // node_modules/d3-time-format/src/index.js var src_exports2 = {}; __export(src_exports2, { isoFormat: () => isoFormat_default, isoParse: () => isoParse_default, timeFormat: () => timeFormat, timeFormatDefaultLocale: () => defaultLocale, timeFormatLocale: () => formatLocale, timeParse: () => timeParse, utcFormat: () => utcFormat, utcParse: () => utcParse }); var init_src2 = __esm({ "node_modules/d3-time-format/src/index.js"() { init_defaultLocale(); init_locale(); init_isoFormat(); init_isoParse(); } }); // node_modules/d3-format/src/formatDecimal.js function formatDecimal_default(x) { return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); } function formatDecimalParts(x, p) { if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; var i, coefficient = x.slice(0, i); return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ]; } var init_formatDecimal = __esm({ "node_modules/d3-format/src/formatDecimal.js"() { } }); // node_modules/d3-format/src/exponent.js function exponent_default(x) { return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN; } var init_exponent = __esm({ "node_modules/d3-format/src/exponent.js"() { init_formatDecimal(); } }); // node_modules/d3-format/src/formatGroup.js function formatGroup_default(grouping, thousands) { return function(value, width) { var i = value.length, t = [], j = 0, g = grouping[0], length = 0; while (i > 0 && g > 0) { if (length + g + 1 > width) g = Math.max(1, width - length); t.push(value.substring(i -= g, i + g)); if ((length += g + 1) > width) break; g = grouping[j = (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; } var init_formatGroup = __esm({ "node_modules/d3-format/src/formatGroup.js"() { } }); // node_modules/d3-format/src/formatNumerals.js function formatNumerals_default(numerals) { return function(value) { return value.replace(/[0-9]/g, function(i) { return numerals[+i]; }); }; } var init_formatNumerals = __esm({ "node_modules/d3-format/src/formatNumerals.js"() { } }); // node_modules/d3-format/src/formatSpecifier.js function formatSpecifier(specifier) { if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); var match; return new FormatSpecifier({ fill: match[1], align: match[2], sign: match[3], symbol: match[4], zero: match[5], width: match[6], comma: match[7], precision: match[8] && match[8].slice(1), trim: match[9], type: match[10] }); } function FormatSpecifier(specifier) { this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; this.align = specifier.align === void 0 ? ">" : specifier.align + ""; this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; this.type = specifier.type === void 0 ? "" : specifier.type + ""; } var re; var init_formatSpecifier = __esm({ "node_modules/d3-format/src/formatSpecifier.js"() { re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; formatSpecifier.prototype = FormatSpecifier.prototype; FormatSpecifier.prototype.toString = function() { return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; }; } }); // node_modules/d3-format/src/formatTrim.js function formatTrim_default(s) { out: for (var n = s.length, i = 1, i02 = -1, i12; i < n; ++i) { switch (s[i]) { case ".": i02 = i12 = i; break; case "0": if (i02 === 0) i02 = i; i12 = i; break; default: if (!+s[i]) break out; if (i02 > 0) i02 = 0; break; } } return i02 > 0 ? s.slice(0, i02) + s.slice(i12 + 1) : s; } var init_formatTrim = __esm({ "node_modules/d3-format/src/formatTrim.js"() { } }); // node_modules/d3-format/src/formatPrefixAuto.js function formatPrefixAuto_default(x, p) { var d = formatDecimalParts(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; } var prefixExponent; var init_formatPrefixAuto = __esm({ "node_modules/d3-format/src/formatPrefixAuto.js"() { init_formatDecimal(); } }); // node_modules/d3-format/src/formatRounded.js function formatRounded_default(x, p) { var d = formatDecimalParts(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); } var init_formatRounded = __esm({ "node_modules/d3-format/src/formatRounded.js"() { init_formatDecimal(); } }); // node_modules/d3-format/src/formatTypes.js var formatTypes_default; var init_formatTypes = __esm({ "node_modules/d3-format/src/formatTypes.js"() { init_formatDecimal(); init_formatPrefixAuto(); init_formatRounded(); formatTypes_default = { "%": function(x, p) { return (x * 100).toFixed(p); }, "b": function(x) { return Math.round(x).toString(2); }, "c": function(x) { return x + ""; }, "d": formatDecimal_default, "e": function(x, p) { return x.toExponential(p); }, "f": function(x, p) { return x.toFixed(p); }, "g": function(x, p) { return x.toPrecision(p); }, "o": function(x) { return Math.round(x).toString(8); }, "p": function(x, p) { return formatRounded_default(x * 100, p); }, "r": formatRounded_default, "s": formatPrefixAuto_default, "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, "x": function(x) { return Math.round(x).toString(16); } }; } }); // node_modules/d3-format/src/identity.js function identity_default(x) { return x; } var init_identity = __esm({ "node_modules/d3-format/src/identity.js"() { } }); // node_modules/d3-format/src/locale.js function locale_default(locale3) { var group = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "-" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + ""; function newFormat(specifier) { specifier = formatSpecifier(specifier); var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; if (type === "n") comma = true, type = "g"; else if (!formatTypes_default[type]) precision === void 0 && (precision = 12), trim = true, type = "g"; if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; var formatType = formatTypes_default[type], maybeSuffix = /[defgprs%]/.test(type); precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); function format2(value) { var valuePrefix = prefix, valueSuffix = suffix, i, n, c; if (type === "c") { valueSuffix = formatType(value) + valueSuffix; value = ""; } else { value = +value; var valueNegative = value < 0 || 1 / value < 0; value = isNaN(value) ? nan : formatType(Math.abs(value), precision); if (trim) value = formatTrim_default(value); if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); if (maybeSuffix) { i = -1, n = value.length; while (++i < n) { if (c = value.charCodeAt(i), 48 > c || c > 57) { valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; value = value.slice(0, i); break; } } } } if (comma && !zero) value = group(value, Infinity); var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; switch (align) { case "<": value = valuePrefix + value + valueSuffix + padding; break; case "=": value = valuePrefix + padding + value + valueSuffix; break; case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; default: value = padding + valuePrefix + value + valueSuffix; break; } return numerals(value); } format2.toString = function() { return specifier + ""; }; return format2; } function formatPrefix2(specifier, value) { var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; return function(value2) { return f(k * value2) + prefix; }; } return { format: newFormat, formatPrefix: formatPrefix2 }; } var map, prefixes; var init_locale2 = __esm({ "node_modules/d3-format/src/locale.js"() { init_exponent(); init_formatGroup(); init_formatNumerals(); init_formatSpecifier(); init_formatTrim(); init_formatTypes(); init_formatPrefixAuto(); init_identity(); map = Array.prototype.map; prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; } }); // node_modules/d3-format/src/defaultLocale.js function defaultLocale2(definition) { locale2 = locale_default(definition); format = locale2.format; formatPrefix = locale2.formatPrefix; return locale2; } var locale2, format, formatPrefix; var init_defaultLocale2 = __esm({ "node_modules/d3-format/src/defaultLocale.js"() { init_locale2(); defaultLocale2({ decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""], minus: "-" }); } }); // node_modules/d3-format/src/precisionFixed.js function precisionFixed_default(step) { return Math.max(0, -exponent_default(Math.abs(step))); } var init_precisionFixed = __esm({ "node_modules/d3-format/src/precisionFixed.js"() { init_exponent(); } }); // node_modules/d3-format/src/precisionPrefix.js function precisionPrefix_default(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step))); } var init_precisionPrefix = __esm({ "node_modules/d3-format/src/precisionPrefix.js"() { init_exponent(); } }); // node_modules/d3-format/src/precisionRound.js function precisionRound_default(step, max) { step = Math.abs(step), max = Math.abs(max) - step; return Math.max(0, exponent_default(max) - exponent_default(step)) + 1; } var init_precisionRound = __esm({ "node_modules/d3-format/src/precisionRound.js"() { init_exponent(); } }); // node_modules/d3-format/src/index.js var src_exports3 = {}; __export(src_exports3, { FormatSpecifier: () => FormatSpecifier, format: () => format, formatDefaultLocale: () => defaultLocale2, formatLocale: () => locale_default, formatPrefix: () => formatPrefix, formatSpecifier: () => formatSpecifier, precisionFixed: () => precisionFixed_default, precisionPrefix: () => precisionPrefix_default, precisionRound: () => precisionRound_default }); var init_src3 = __esm({ "node_modules/d3-format/src/index.js"() { init_defaultLocale2(); init_locale2(); init_formatSpecifier(); init_precisionFixed(); init_precisionPrefix(); init_precisionRound(); } }); // node_modules/is-string-blank/index.js var require_is_string_blank = __commonJS({ "node_modules/is-string-blank/index.js"(exports2, module2) { "use strict"; module2.exports = function(str) { var l = str.length, a; for (var i = 0; i < l; i++) { a = str.charCodeAt(i); if ((a < 9 || a > 13) && a !== 32 && a !== 133 && a !== 160 && a !== 5760 && a !== 6158 && (a < 8192 || a > 8205) && a !== 8232 && a !== 8233 && a !== 8239 && a !== 8287 && a !== 8288 && a !== 12288 && a !== 65279) { return false; } } return true; }; } }); // node_modules/fast-isnumeric/index.js var require_fast_isnumeric = __commonJS({ "node_modules/fast-isnumeric/index.js"(exports2, module2) { "use strict"; var allBlankCharCodes = require_is_string_blank(); module2.exports = function(n) { var type = typeof n; if (type === "string") { var original = n; n = +n; if (n === 0 && allBlankCharCodes(original)) return false; } else if (type !== "number") return false; return n - n < 1; }; } }); // node_modules/plotly.js/src/constants/numerical.js var require_numerical = __commonJS({ "node_modules/plotly.js/src/constants/numerical.js"(exports2, module2) { "use strict"; module2.exports = { /** * Standardize all missing data in calcdata to use undefined * never null or NaN. * That way we can use !==undefined, or !== BADNUM, * to test for real data */ BADNUM: void 0, /* * Limit certain operations to well below floating point max value * to avoid glitches: Make sure that even when you multiply it by the * number of pixels on a giant screen it still works */ FP_SAFE: Number.MAX_VALUE * 1e-4, /* * conversion of date units to milliseconds * year and month constants are marked "AVG" * to remind us that not all years and months * have the same length */ ONEMAXYEAR: 316224e5, // 366 * ONEDAY ONEAVGYEAR: 315576e5, // 365.25 days ONEMINYEAR: 31536e6, // 365 * ONEDAY ONEMAXQUARTER: 79488e5, // 92 * ONEDAY ONEAVGQUARTER: 78894e5, // 1/4 of ONEAVGYEAR ONEMINQUARTER: 76896e5, // 89 * ONEDAY ONEMAXMONTH: 26784e5, // 31 * ONEDAY ONEAVGMONTH: 26298e5, // 1/12 of ONEAVGYEAR ONEMINMONTH: 24192e5, // 28 * ONEDAY ONEWEEK: 6048e5, // 7 * ONEDAY ONEDAY: 864e5, // 24 * ONEHOUR ONEHOUR: 36e5, ONEMIN: 6e4, ONESEC: 1e3, ONEMILLI: 1, ONEMICROSEC: 1e-3, /* * For fast conversion btwn world calendars and epoch ms, the Julian Day Number * of the unix epoch. From calendars.instance().newDate(1970, 1, 1).toJD() */ EPOCHJD: 24405875e-1, /* * Are two values nearly equal? Compare to 1PPM */ ALMOST_EQUAL: 1 - 1e-6, /* * If we're asked to clip a non-positive log value, how far off-screen * do we put it? */ LOG_CLIP: 10, /* * not a number, but for displaying numbers: the "minus sign" symbol is * wider than the regular ascii dash "-" */ MINUS_SIGN: "−" }; } }); // node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js var base64_arraybuffer_es5_exports = {}; __export(base64_arraybuffer_es5_exports, { decode: () => decode, encode: () => encode }); var chars, lookup, i, encode, decode; var init_base64_arraybuffer_es5 = __esm({ "node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js"() { chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); for (i = 0; i < chars.length; i++) { lookup[chars.charCodeAt(i)] = i; } encode = function(arraybuffer) { var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = ""; for (i = 0; i < len; i += 3) { base64 += chars[bytes[i] >> 2]; base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4]; base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6]; base64 += chars[bytes[i + 2] & 63]; } if (len % 3 === 2) { base64 = base64.substring(0, base64.length - 1) + "="; } else if (len % 3 === 1) { base64 = base64.substring(0, base64.length - 2) + "=="; } return base64; }; decode = function(base64) { var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; if (base64[base64.length - 1] === "=") { bufferLength--; if (base64[base64.length - 2] === "=") { bufferLength--; } } var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer); for (i = 0; i < len; i += 4) { encoded1 = lookup[base64.charCodeAt(i)]; encoded2 = lookup[base64.charCodeAt(i + 1)]; encoded3 = lookup[base64.charCodeAt(i + 2)]; encoded4 = lookup[base64.charCodeAt(i + 3)]; bytes[p++] = encoded1 << 2 | encoded2 >> 4; bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; } return arraybuffer; }; } }); // node_modules/plotly.js/src/lib/is_plain_object.js var require_is_plain_object = __commonJS({ "node_modules/plotly.js/src/lib/is_plain_object.js"(exports2, module2) { "use strict"; module2.exports = function isPlainObject(obj) { if (window && window.process && window.process.versions) { return Object.prototype.toString.call(obj) === "[object Object]"; } return Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj).hasOwnProperty("hasOwnProperty"); }; } }); // node_modules/plotly.js/src/lib/array.js var require_array = __commonJS({ "node_modules/plotly.js/src/lib/array.js"(exports2) { "use strict"; var b64decode = (init_base64_arraybuffer_es5(), __toCommonJS(base64_arraybuffer_es5_exports)).decode; var isPlainObject = require_is_plain_object(); var isArray = Array.isArray; var ab = ArrayBuffer; var dv2 = DataView; function isTypedArray(a) { return ab.isView(a) && !(a instanceof dv2); } exports2.isTypedArray = isTypedArray; function isArrayOrTypedArray(a) { return isArray(a) || isTypedArray(a); } exports2.isArrayOrTypedArray = isArrayOrTypedArray; function isArray1D(a) { return !isArrayOrTypedArray(a[0]); } exports2.isArray1D = isArray1D; exports2.ensureArray = function(out, n) { if (!isArray(out)) out = []; out.length = n; return out; }; var typedArrays = { u1c: typeof Uint8ClampedArray === "undefined" ? void 0 : Uint8ClampedArray, // not supported in numpy? i1: typeof Int8Array === "undefined" ? void 0 : Int8Array, u1: typeof Uint8Array === "undefined" ? void 0 : Uint8Array, i2: typeof Int16Array === "undefined" ? void 0 : Int16Array, u2: typeof Uint16Array === "undefined" ? void 0 : Uint16Array, i4: typeof Int32Array === "undefined" ? void 0 : Int32Array, u4: typeof Uint32Array === "undefined" ? void 0 : Uint32Array, f4: typeof Float32Array === "undefined" ? void 0 : Float32Array, f8: typeof Float64Array === "undefined" ? void 0 : Float64Array /* TODO: potentially add Big Int i8: typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, u8: typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, */ }; typedArrays.uint8c = typedArrays.u1c; typedArrays.uint8 = typedArrays.u1; typedArrays.int8 = typedArrays.i1; typedArrays.uint16 = typedArrays.u2; typedArrays.int16 = typedArrays.i2; typedArrays.uint32 = typedArrays.u4; typedArrays.int32 = typedArrays.i4; typedArrays.float32 = typedArrays.f4; typedArrays.float64 = typedArrays.f8; function isArrayBuffer(a) { return a.constructor === ArrayBuffer; } exports2.isArrayBuffer = isArrayBuffer; exports2.decodeTypedArraySpec = function(vIn) { var out = []; var v = coerceTypedArraySpec(vIn); var dtype = v.dtype; var T = typedArrays[dtype]; if (!T) throw new Error('Error in dtype: "' + dtype + '"'); var BYTES_PER_ELEMENT = T.BYTES_PER_ELEMENT; var buffer = v.bdata; if (!isArrayBuffer(buffer)) { buffer = b64decode(buffer); } var shape = v.shape === void 0 ? ( // detect 1-d length [buffer.byteLength / BYTES_PER_ELEMENT] ) : ( // convert number to string and split to array ("" + v.shape).split(",") ); shape.reverse(); var ndim = shape.length; var nj, j; var ni2 = +shape[0]; var rowBytes = BYTES_PER_ELEMENT * ni2; var pos = 0; if (ndim === 1) { out = new T(buffer); } else if (ndim === 2) { nj = +shape[1]; for (j = 0; j < nj; j++) { out[j] = new T(buffer, pos, ni2); pos += rowBytes; } } else if (ndim === 3) { nj = +shape[1]; var nk = +shape[2]; for (var k = 0; k < nk; k++) { out[k] = []; for (j = 0; j < nj; j++) { out[k][j] = new T(buffer, pos, ni2); pos += rowBytes; } } } else { throw new Error("ndim: " + ndim + 'is not supported with the shape:"' + v.shape + '"'); } out.bdata = v.bdata; out.dtype = v.dtype; out.shape = shape.reverse().join(","); vIn._inputArray = out; return out; }; exports2.isTypedArraySpec = function(v) { return isPlainObject(v) && v.hasOwnProperty("dtype") && typeof v.dtype === "string" && v.hasOwnProperty("bdata") && (typeof v.bdata === "string" || isArrayBuffer(v.bdata)) && (v.shape === void 0 || v.hasOwnProperty("shape") && (typeof v.shape === "string" || typeof v.shape === "number")); }; function coerceTypedArraySpec(v) { return { bdata: v.bdata, dtype: v.dtype, shape: v.shape }; } exports2.concat = function() { var args = []; var allArray = true; var totalLen = 0; var _constructor, arg0, i, argi, posi, leni, out, j; for (i = 0; i < arguments.length; i++) { argi = arguments[i]; leni = argi.length; if (leni) { if (arg0) args.push(argi); else { arg0 = argi; posi = leni; } if (isArray(argi)) { _constructor = false; } else { allArray = false; if (!totalLen) { _constructor = argi.constructor; } else if (_constructor !== argi.constructor) { _constructor = false; } } totalLen += leni; } } if (!totalLen) return []; if (!args.length) return arg0; if (allArray) return arg0.concat.apply(arg0, args); if (_constructor) { out = new _constructor(totalLen); out.set(arg0); for (i = 0; i < args.length; i++) { argi = args[i]; out.set(argi, posi); posi += argi.length; } return out; } out = new Array(totalLen); for (j = 0; j < arg0.length; j++) out[j] = arg0[j]; for (i = 0; i < args.length; i++) { argi = args[i]; for (j = 0; j < argi.length; j++) out[posi + j] = argi[j]; posi += j; } return out; }; exports2.maxRowLength = function(z) { return _rowLength(z, Math.max, 0); }; exports2.minRowLength = function(z) { return _rowLength(z, Math.min, Infinity); }; function _rowLength(z, fn, len0) { if (isArrayOrTypedArray(z)) { if (isArrayOrTypedArray(z[0])) { var len = len0; for (var i = 0; i < z.length; i++) { len = fn(len, z[i].length); } return len; } else { return z.length; } } return 0; } } }); // node_modules/plotly.js/src/lib/nested_property.js var require_nested_property = __commonJS({ "node_modules/plotly.js/src/lib/nested_property.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var isArrayOrTypedArray = require_array().isArrayOrTypedArray; module2.exports = function nestedProperty(container, propStr) { if (isNumeric(propStr)) propStr = String(propStr); else if (typeof propStr !== "string" || propStr.substr(propStr.length - 4) === "[-1]") { throw "bad property string"; } var propParts = propStr.split("."); var indexed; var indices; var i, j; for (j = 0; j < propParts.length; j++) { if (String(propParts[j]).slice(0, 2) === "__") { throw "bad property string"; } } j = 0; while (j < propParts.length) { indexed = String(propParts[j]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/); if (indexed) { if (indexed[1]) propParts[j] = indexed[1]; else if (j === 0) propParts.splice(0, 1); else throw "bad property string"; indices = indexed[2].substr(1, indexed[2].length - 2).split("]["); for (i = 0; i < indices.length; i++) { j++; propParts.splice(j, 0, Number(indices[i])); } } j++; } if (typeof container !== "object") { return badContainer(container, propStr, propParts); } return { set: npSet(container, propParts, propStr), get: npGet(container, propParts), astr: propStr, parts: propParts, obj: container }; }; function npGet(cont, parts) { return function() { var curCont = cont; var curPart; var allSame; var out; var i; var j; for (i = 0; i < parts.length - 1; i++) { curPart = parts[i]; if (curPart === -1) { allSame = true; out = []; for (j = 0; j < curCont.length; j++) { out[j] = npGet(curCont[j], parts.slice(i + 1))(); if (out[j] !== out[0]) allSame = false; } return allSame ? out[0] : out; } if (typeof curPart === "number" && !isArrayOrTypedArray(curCont)) { return void 0; } curCont = curCont[curPart]; if (typeof curCont !== "object" || curCont === null) { return void 0; } } if (typeof curCont !== "object" || curCont === null) return void 0; out = curCont[parts[i]]; if (out === null) return void 0; return out; }; } var ARGS_PATTERN = /(^|\.)args\[/; function isDeletable(val, propStr) { return val === void 0 || val === null && !propStr.match(ARGS_PATTERN); } function npSet(cont, parts, propStr) { return function(val) { var curCont = cont; var propPart = ""; var containerLevels = [[cont, propPart]]; var toDelete = isDeletable(val, propStr); var curPart; var i; for (i = 0; i < parts.length - 1; i++) { curPart = parts[i]; if (typeof curPart === "number" && !isArrayOrTypedArray(curCont)) { throw "array index but container is not an array"; } if (curPart === -1) { toDelete = !setArrayAll(curCont, parts.slice(i + 1), val, propStr); if (toDelete) break; else return; } if (!checkNewContainer(curCont, curPart, parts[i + 1], toDelete)) { break; } curCont = curCont[curPart]; if (typeof curCont !== "object" || curCont === null) { throw "container is not an object"; } propPart = joinPropStr(propPart, curPart); containerLevels.push([curCont, propPart]); } if (toDelete) { if (i === parts.length - 1) { delete curCont[parts[i]]; if (Array.isArray(curCont) && +parts[i] === curCont.length - 1) { while (curCont.length && curCont[curCont.length - 1] === void 0) { curCont.pop(); } } } } else curCont[parts[i]] = val; }; } function joinPropStr(propStr, newPart) { var toAdd = newPart; if (isNumeric(newPart)) toAdd = "[" + newPart + "]"; else if (propStr) toAdd = "." + newPart; return propStr + toAdd; } function setArrayAll(containerArray, innerParts, val, propStr) { var arrayVal = isArrayOrTypedArray(val); var allSet = true; var thisVal = val; var thisPropStr = propStr.replace("-1", 0); var deleteThis = arrayVal ? false : isDeletable(val, thisPropStr); var firstPart = innerParts[0]; var i; for (i = 0; i < containerArray.length; i++) { thisPropStr = propStr.replace("-1", i); if (arrayVal) { thisVal = val[i % val.length]; deleteThis = isDeletable(thisVal, thisPropStr); } if (deleteThis) allSet = false; if (!checkNewContainer(containerArray, i, firstPart, deleteThis)) { continue; } npSet(containerArray[i], innerParts, propStr.replace("-1", i))(thisVal); } return allSet; } function checkNewContainer(container, part, nextPart, toDelete) { if (container[part] === void 0) { if (toDelete) return false; if (typeof nextPart === "number") container[part] = []; else container[part] = {}; } return true; } function badContainer(container, propStr, propParts) { return { set: function() { throw "bad container"; }, get: function() { }, astr: propStr, parts: propParts, obj: container }; } } }); // node_modules/plotly.js/src/lib/keyed_container.js var require_keyed_container = __commonJS({ "node_modules/plotly.js/src/lib/keyed_container.js"(exports2, module2) { "use strict"; var nestedProperty = require_nested_property(); var SIMPLE_PROPERTY_REGEX = /^\w*$/; var NONE = 0; var NAME = 1; var VALUE = 2; var BOTH = 3; var UNSET = 4; module2.exports = function keyedContainer(baseObj, path, keyName, valueName) { keyName = keyName || "name"; valueName = valueName || "value"; var i, arr, baseProp; var changeTypes = {}; if (path && path.length) { baseProp = nestedProperty(baseObj, path); arr = baseProp.get(); } else { arr = baseObj; } path = path || ""; var indexLookup = {}; if (arr) { for (i = 0; i < arr.length; i++) { indexLookup[arr[i][keyName]] = i; } } var isSimpleValueProp = SIMPLE_PROPERTY_REGEX.test(valueName); var obj = { set: function(name, value) { var changeType = value === null ? UNSET : NONE; if (!arr) { if (!baseProp || changeType === UNSET) return; arr = []; baseProp.set(arr); } var idx = indexLookup[name]; if (idx === void 0) { if (changeType === UNSET) return; changeType = changeType | BOTH; idx = arr.length; indexLookup[name] = idx; } else if (value !== (isSimpleValueProp ? arr[idx][valueName] : nestedProperty(arr[idx], valueName).get())) { changeType = changeType | VALUE; } var newValue = arr[idx] = arr[idx] || {}; newValue[keyName] = name; if (isSimpleValueProp) { newValue[valueName] = value; } else { nestedProperty(newValue, valueName).set(value); } if (value !== null) { changeType = changeType & ~UNSET; } changeTypes[idx] = changeTypes[idx] | changeType; return obj; }, get: function(name) { if (!arr) return; var idx = indexLookup[name]; if (idx === void 0) { return void 0; } else if (isSimpleValueProp) { return arr[idx][valueName]; } else { return nestedProperty(arr[idx], valueName).get(); } }, rename: function(name, newName) { var idx = indexLookup[name]; if (idx === void 0) return obj; changeTypes[idx] = changeTypes[idx] | NAME; indexLookup[newName] = idx; delete indexLookup[name]; arr[idx][keyName] = newName; return obj; }, remove: function(name) { var idx = indexLookup[name]; if (idx === void 0) return obj; var object = arr[idx]; if (Object.keys(object).length > 2) { changeTypes[idx] = changeTypes[idx] | VALUE; return obj.set(name, null); } if (isSimpleValueProp) { for (i = idx; i < arr.length; i++) { changeTypes[i] = changeTypes[i] | BOTH; } for (i = idx; i < arr.length; i++) { indexLookup[arr[i][keyName]]--; } arr.splice(idx, 1); delete indexLookup[name]; } else { nestedProperty(object, valueName).set(null); changeTypes[idx] = changeTypes[idx] | VALUE | UNSET; } return obj; }, constructUpdate: function() { var astr, idx; var update = {}; var changed = Object.keys(changeTypes); for (var i2 = 0; i2 < changed.length; i2++) { idx = changed[i2]; astr = path + "[" + idx + "]"; if (arr[idx]) { if (changeTypes[idx] & NAME) { update[astr + "." + keyName] = arr[idx][keyName]; } if (changeTypes[idx] & VALUE) { if (isSimpleValueProp) { update[astr + "." + valueName] = changeTypes[idx] & UNSET ? null : arr[idx][valueName]; } else { update[astr + "." + valueName] = changeTypes[idx] & UNSET ? null : nestedProperty(arr[idx], valueName).get(); } } } else { update[astr] = null; } } return update; } }; return obj; }; } }); // node_modules/plotly.js/src/lib/relative_attr.js var require_relative_attr = __commonJS({ "node_modules/plotly.js/src/lib/relative_attr.js"(exports2, module2) { "use strict"; var ASCEND = /^(.*)(\.[^\.\[\]]+|\[\d\])$/; var SIMPLEATTR = /^[^\.\[\]]+$/; module2.exports = function(baseAttr, relativeAttr) { while (relativeAttr) { var match = baseAttr.match(ASCEND); if (match) baseAttr = match[1]; else if (baseAttr.match(SIMPLEATTR)) baseAttr = ""; else throw new Error("bad relativeAttr call:" + [baseAttr, relativeAttr]); if (relativeAttr.charAt(0) === "^") relativeAttr = relativeAttr.slice(1); else break; } if (baseAttr && relativeAttr.charAt(0) !== "[") { return baseAttr + "." + relativeAttr; } return baseAttr + relativeAttr; }; } }); // node_modules/plotly.js/src/lib/to_log_range.js var require_to_log_range = __commonJS({ "node_modules/plotly.js/src/lib/to_log_range.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); module2.exports = function toLogRange(val, range) { if (val > 0) return Math.log(val) / Math.LN10; var newVal = Math.log(Math.min(range[0], range[1])) / Math.LN10; if (!isNumeric(newVal)) newVal = Math.log(Math.max(range[0], range[1])) / Math.LN10 - 6; return newVal; }; } }); // node_modules/plotly.js/src/lib/relink_private.js var require_relink_private = __commonJS({ "node_modules/plotly.js/src/lib/relink_private.js"(exports2, module2) { "use strict"; var isArrayOrTypedArray = require_array().isArrayOrTypedArray; var isPlainObject = require_is_plain_object(); module2.exports = function relinkPrivateKeys(toContainer, fromContainer) { for (var k in fromContainer) { var fromVal = fromContainer[k]; var toVal = toContainer[k]; if (toVal === fromVal) continue; if (k.charAt(0) === "_" || typeof fromVal === "function") { if (k in toContainer) continue; toContainer[k] = fromVal; } else if (isArrayOrTypedArray(fromVal) && isArrayOrTypedArray(toVal) && isPlainObject(fromVal[0])) { if (k === "customdata" || k === "ids") continue; var minLen = Math.min(fromVal.length, toVal.length); for (var j = 0; j < minLen; j++) { if (toVal[j] !== fromVal[j] && isPlainObject(fromVal[j]) && isPlainObject(toVal[j])) { relinkPrivateKeys(toVal[j], fromVal[j]); } } } else if (isPlainObject(fromVal) && isPlainObject(toVal)) { relinkPrivateKeys(toVal, fromVal); if (!Object.keys(toVal).length) delete toContainer[k]; } } }; } }); // node_modules/plotly.js/src/lib/mod.js var require_mod = __commonJS({ "node_modules/plotly.js/src/lib/mod.js"(exports2, module2) { "use strict"; function mod(v, d) { var out = v % d; return out < 0 ? out + d : out; } function modHalf(v, d) { return Math.abs(v) > d / 2 ? v - Math.round(v / d) * d : v; } module2.exports = { mod, modHalf }; } }); // node_modules/tinycolor2/cjs/tinycolor.js var require_tinycolor = __commonJS({ "node_modules/tinycolor2/cjs/tinycolor.js"(exports2, module2) { (function(global2, factory) { typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.tinycolor = factory()); })(exports2, function() { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } var trimLeft = /^\s+/; var trimRight = /\s+$/; function tinycolor(color, opts) { color = color ? color : ""; opts = opts || {}; if (color instanceof tinycolor) { return color; } if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } var rgb = inputToRGB(color); this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; this._gradientType = opts.gradientType; if (this._r < 1) this._r = Math.round(this._r); if (this._g < 1) this._g = Math.round(this._g); if (this._b < 1) this._b = Math.round(this._b); this._ok = rgb.ok; } tinycolor.prototype = { isDark: function isDark() { return this.getBrightness() < 128; }, isLight: function isLight() { return !this.isDark(); }, isValid: function isValid() { return this._ok; }, getOriginalInput: function getOriginalInput() { return this._originalInput; }, getFormat: function getFormat() { return this._format; }, getAlpha: function getAlpha() { return this._a; }, getBrightness: function getBrightness() { var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3; }, getLuminance: function getLuminance() { var rgb = this.toRgb(); var RsRGB, GsRGB, BsRGB, R, G, B; RsRGB = rgb.r / 255; GsRGB = rgb.g / 255; BsRGB = rgb.b / 255; if (RsRGB <= 0.03928) R = RsRGB / 12.92; else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); if (GsRGB <= 0.03928) G = GsRGB / 12.92; else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); if (BsRGB <= 0.03928) B = BsRGB / 12.92; else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); return 0.2126 * R + 0.7152 * G + 0.0722 * B; }, setAlpha: function setAlpha(value) { this._a = boundAlpha(value); this._roundA = Math.round(100 * this._a) / 100; return this; }, toHsv: function toHsv() { var hsv = rgbToHsv(this._r, this._g, this._b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; }, toHsvString: function toHsvString() { var hsv = rgbToHsv(this._r, this._g, this._b); var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100); return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; }, toHsl: function toHsl() { var hsl = rgbToHsl(this._r, this._g, this._b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; }, toHslString: function toHslString() { var hsl = rgbToHsl(this._r, this._g, this._b); var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100); return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; }, toHex: function toHex(allow3Char) { return rgbToHex(this._r, this._g, this._b, allow3Char); }, toHexString: function toHexString(allow3Char) { return "#" + this.toHex(allow3Char); }, toHex8: function toHex8(allow4Char) { return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); }, toHex8String: function toHex8String(allow4Char) { return "#" + this.toHex8(allow4Char); }, toRgb: function toRgb() { return { r: Math.round(this._r), g: Math.round(this._g), b: Math.round(this._b), a: this._a }; }, toRgbString: function toRgbString() { return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; }, toPercentageRgb: function toPercentageRgb() { return { r: Math.round(bound01(this._r, 255) * 100) + "%", g: Math.round(bound01(this._g, 255) * 100) + "%", b: Math.round(bound01(this._b, 255) * 100) + "%", a: this._a }; }, toPercentageRgbString: function toPercentageRgbString() { return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; }, toName: function toName() { if (this._a === 0) { return "transparent"; } if (this._a < 1) { return false; } return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; }, toFilter: function toFilter(secondColor) { var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); var secondHex8String = hex8String; var gradientType = this._gradientType ? "GradientType = 1, " : ""; if (secondColor) { var s = tinycolor(secondColor); secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); } return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; }, toString: function toString(format2) { var formatSet = !!format2; format2 = format2 || this._format; var formattedString = false; var hasAlpha = this._a < 1 && this._a >= 0; var needsAlphaFormat = !formatSet && hasAlpha && (format2 === "hex" || format2 === "hex6" || format2 === "hex3" || format2 === "hex4" || format2 === "hex8" || format2 === "name"); if (needsAlphaFormat) { if (format2 === "name" && this._a === 0) { return this.toName(); } return this.toRgbString(); } if (format2 === "rgb") { formattedString = this.toRgbString(); } if (format2 === "prgb") { formattedString = this.toPercentageRgbString(); } if (format2 === "hex" || format2 === "hex6") { formattedString = this.toHexString(); } if (format2 === "hex3") { formattedString = this.toHexString(true); } if (format2 === "hex4") { formattedString = this.toHex8String(true); } if (format2 === "hex8") { formattedString = this.toHex8String(); } if (format2 === "name") { formattedString = this.toName(); } if (format2 === "hsl") { formattedString = this.toHslString(); } if (format2 === "hsv") { formattedString = this.toHsvString(); } return formattedString || this.toHexString(); }, clone: function clone() { return tinycolor(this.toString()); }, _applyModification: function _applyModification(fn, args) { var color = fn.apply(null, [this].concat([].slice.call(args))); this._r = color._r; this._g = color._g; this._b = color._b; this.setAlpha(color._a); return this; }, lighten: function lighten() { return this._applyModification(_lighten, arguments); }, brighten: function brighten() { return this._applyModification(_brighten, arguments); }, darken: function darken() { return this._applyModification(_darken, arguments); }, desaturate: function desaturate() { return this._applyModification(_desaturate, arguments); }, saturate: function saturate() { return this._applyModification(_saturate, arguments); }, greyscale: function greyscale() { return this._applyModification(_greyscale, arguments); }, spin: function spin() { return this._applyModification(_spin, arguments); }, _applyCombination: function _applyCombination(fn, args) { return fn.apply(null, [this].concat([].slice.call(args))); }, analogous: function analogous() { return this._applyCombination(_analogous, arguments); }, complement: function complement() { return this._applyCombination(_complement, arguments); }, monochromatic: function monochromatic() { return this._applyCombination(_monochromatic, arguments); }, splitcomplement: function splitcomplement() { return this._applyCombination(_splitcomplement, arguments); }, // Disabled until https://github.com/bgrins/TinyColor/issues/254 // polyad: function (number) { // return this._applyCombination(polyad, [number]); // }, triad: function triad() { return this._applyCombination(polyad, [3]); }, tetrad: function tetrad() { return this._applyCombination(polyad, [4]); } }; tinycolor.fromRatio = function(color, opts) { if (_typeof(color) == "object") { var newColor = {}; for (var i in color) { if (color.hasOwnProperty(i)) { if (i === "a") { newColor[i] = color[i]; } else { newColor[i] = convertToPercentage(color[i]); } } } color = newColor; } return tinycolor(color, opts); }; function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format2 = false; if (typeof color == "string") { color = stringInputToObject(color); } if (_typeof(color) == "object") { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = rgbToRgb(color.r, color.g, color.b); ok = true; format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s = convertToPercentage(color.s); v = convertToPercentage(color.v); rgb = hsvToRgb(color.h, s, v); ok = true; format2 = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s = convertToPercentage(color.s); l = convertToPercentage(color.l); rgb = hslToRgb(color.h, s, l); ok = true; format2 = "hsl"; } if (color.hasOwnProperty("a")) { a = color.a; } } a = boundAlpha(a); return { ok, format: color.format || format2, r: Math.min(255, Math.max(rgb.r, 0)), g: Math.min(255, Math.max(rgb.g, 0)), b: Math.min(255, Math.max(rgb.b, 0)), a }; } function rgbToRgb(r, g, b) { return { r: bound01(r, 255) * 255, g: bound01(g, 255) * 255, b: bound01(b, 255) * 255 }; } function rgbToHsl(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; if (max == min) { h = s = 0; } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h, s, l }; } function hslToRgb(h, s, l) { var r, g, b; h = bound01(h, 360); s = bound01(s, 100); l = bound01(l, 100); function hue2rgb(p2, q2, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t; if (t < 1 / 2) return q2; if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6; return p2; } if (s === 0) { r = g = b = l; } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return { r: r * 255, g: g * 255, b: b * 255 }; } function rgbToHsv(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, v = max; var d = max - min; s = max === 0 ? 0 : d / max; if (max == min) { h = 0; } else { switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h, s, v }; } function hsvToRgb(h, s, v) { h = bound01(h, 360) * 6; s = bound01(s, 100); v = bound01(v, 100); var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod]; return { r: r * 255, g: g * 255, b: b * 255 }; } function rgbToHex(r, g, b, allow3Char) { var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } return hex.join(""); } function rgbaToHex(r, g, b, a, allow4Char) { var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(""); } function rgbaToArgbHex(r, g, b, a) { var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; return hex.join(""); } tinycolor.equals = function(color1, color2) { if (!color1 || !color2) return false; return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); }; tinycolor.random = function() { return tinycolor.fromRatio({ r: Math.random(), g: Math.random(), b: Math.random() }); }; function _desaturate(color, amount) { amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function _saturate(color, amount) { amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function _greyscale(color) { return tinycolor(color).desaturate(100); } function _lighten(color, amount) { amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } function _brighten(color, amount) { amount = amount === 0 ? 0 : amount || 10; var rgb = tinycolor(color).toRgb(); rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); return tinycolor(rgb); } function _darken(color, amount) { amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } function _spin(color, amount) { var hsl = tinycolor(color).toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return tinycolor(hsl); } function _complement(color) { var hsl = tinycolor(color).toHsl(); hsl.h = (hsl.h + 180) % 360; return tinycolor(hsl); } function polyad(color, number) { if (isNaN(number) || number <= 0) { throw new Error("Argument to polyad must be a positive number"); } var hsl = tinycolor(color).toHsl(); var result = [tinycolor(color)]; var step = 360 / number; for (var i = 1; i < number; i++) { result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l })); } return result; } function _splitcomplement(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [tinycolor(color), tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })]; } function _analogous(color, results, slices) { results = results || 6; slices = slices || 30; var hsl = tinycolor(color).toHsl(); var part = 360 / slices; var ret = [tinycolor(color)]; for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) { hsl.h = (hsl.h + part) % 360; ret.push(tinycolor(hsl)); } return ret; } function _monochromatic(color, results) { results = results || 6; var hsv = tinycolor(color).toHsv(); var h = hsv.h, s = hsv.s, v = hsv.v; var ret = []; var modification = 1 / results; while (results--) { ret.push(tinycolor({ h, s, v })); v = (v + modification) % 1; } return ret; } tinycolor.mix = function(color1, color2, amount) { amount = amount === 0 ? 0 : amount || 50; var rgb1 = tinycolor(color1).toRgb(); var rgb2 = tinycolor(color2).toRgb(); var p = amount / 100; var rgba = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b, a: (rgb2.a - rgb1.a) * p + rgb1.a }; return tinycolor(rgba); }; tinycolor.readability = function(color1, color2) { var c12 = tinycolor(color1); var c2 = tinycolor(color2); return (Math.max(c12.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c12.getLuminance(), c2.getLuminance()) + 0.05); }; tinycolor.isReadable = function(color1, color2, wcag2) { var readability = tinycolor.readability(color1, color2); var wcag2Parms, out; out = false; wcag2Parms = validateWCAG2Parms(wcag2); switch (wcag2Parms.level + wcag2Parms.size) { case "AAsmall": case "AAAlarge": out = readability >= 4.5; break; case "AAlarge": out = readability >= 3; break; case "AAAsmall": out = readability >= 7; break; } return out; }; tinycolor.mostReadable = function(baseColor, colorList, args) { var bestColor = null; var bestScore = 0; var readability; var includeFallbackColors, level, size; args = args || {}; includeFallbackColors = args.includeFallbackColors; level = args.level; size = args.size; for (var i = 0; i < colorList.length; i++) { readability = tinycolor.readability(baseColor, colorList[i]); if (readability > bestScore) { bestScore = readability; bestColor = tinycolor(colorList[i]); } } if (tinycolor.isReadable(baseColor, bestColor, { level, size }) || !includeFallbackColors) { return bestColor; } else { args.includeFallbackColors = false; return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); } }; var names = tinycolor.names = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "0ff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "00f", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", burntsienna: "ea7e5d", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "0ff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "f0f", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" }; var hexNames = tinycolor.hexNames = flip(names); function flip(o) { var flipped = {}; for (var i in o) { if (o.hasOwnProperty(i)) { flipped[o[i]] = i; } } return flipped; } function boundAlpha(a) { a = parseFloat(a); if (isNaN(a) || a < 0 || a > 1) { a = 1; } return a; } function bound01(n, max) { if (isOnePointZero(n)) n = "100%"; var processPercent = isPercentage(n); n = Math.min(max, Math.max(0, parseFloat(n))); if (processPercent) { n = parseInt(n * max, 10) / 100; } if (Math.abs(n - max) < 1e-6) { return 1; } return n % max / parseFloat(max); } function clamp01(val) { return Math.min(1, Math.max(0, val)); } function parseIntFromHex(val) { return parseInt(val, 16); } function isOnePointZero(n) { return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; } function isPercentage(n) { return typeof n === "string" && n.indexOf("%") != -1; } function pad2(c) { return c.length == 1 ? "0" + c : "" + c; } function convertToPercentage(n) { if (n <= 1) { n = n * 100 + "%"; } return n; } function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); } function convertHexToDecimal(h) { return parseIntFromHex(h) / 255; } var matchers = function() { var CSS_INTEGER = "[-\\+]?\\d+%?"; var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; return { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; }(); function isValidCSSUnit(color) { return !!matchers.CSS_UNIT.exec(color); } function stringInputToObject(color) { color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); var named = false; if (names[color]) { color = names[color]; named = true; } else if (color == "transparent") { return { r: 0, g: 0, b: 0, a: 0, format: "name" }; } var match; if (match = matchers.rgb.exec(color)) { return { r: match[1], g: match[2], b: match[3] }; } if (match = matchers.rgba.exec(color)) { return { r: match[1], g: match[2], b: match[3], a: match[4] }; } if (match = matchers.hsl.exec(color)) { return { h: match[1], s: match[2], l: match[3] }; } if (match = matchers.hsla.exec(color)) { return { h: match[1], s: match[2], l: match[3], a: match[4] }; } if (match = matchers.hsv.exec(color)) { return { h: match[1], s: match[2], v: match[3] }; } if (match = matchers.hsva.exec(color)) { return { h: match[1], s: match[2], v: match[3], a: match[4] }; } if (match = matchers.hex8.exec(color)) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), a: convertHexToDecimal(match[4]), format: named ? "name" : "hex8" }; } if (match = matchers.hex6.exec(color)) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), format: named ? "name" : "hex" }; } if (match = matchers.hex4.exec(color)) { return { r: parseIntFromHex(match[1] + "" + match[1]), g: parseIntFromHex(match[2] + "" + match[2]), b: parseIntFromHex(match[3] + "" + match[3]), a: convertHexToDecimal(match[4] + "" + match[4]), format: named ? "name" : "hex8" }; } if (match = matchers.hex3.exec(color)) { return { r: parseIntFromHex(match[1] + "" + match[1]), g: parseIntFromHex(match[2] + "" + match[2]), b: parseIntFromHex(match[3] + "" + match[3]), format: named ? "name" : "hex" }; } return false; } function validateWCAG2Parms(parms) { var level, size; parms = parms || { level: "AA", size: "small" }; level = (parms.level || "AA").toUpperCase(); size = (parms.size || "small").toLowerCase(); if (level !== "AA" && level !== "AAA") { level = "AA"; } if (size !== "small" && size !== "large") { size = "small"; } return { level, size }; } return tinycolor; }); } }); // node_modules/plotly.js/src/lib/extend.js var require_extend = __commonJS({ "node_modules/plotly.js/src/lib/extend.js"(exports2) { "use strict"; var isPlainObject = require_is_plain_object(); var isArray = Array.isArray; function primitivesLoopSplice(source, target) { var i, value; for (i = 0; i < source.length; i++) { value = source[i]; if (value !== null && typeof value === "object") { return false; } if (value !== void 0) { target[i] = value; } } return true; } exports2.extendFlat = function() { return _extend(arguments, false, false, false); }; exports2.extendDeep = function() { return _extend(arguments, true, false, false); }; exports2.extendDeepAll = function() { return _extend(arguments, true, true, false); }; exports2.extendDeepNoArrays = function() { return _extend(arguments, true, false, true); }; function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { var target = inputs[0]; var length = inputs.length; var input, key, src, copy, copyIsArray, clone, allPrimitives; if (length === 2 && isArray(target) && isArray(inputs[1]) && target.length === 0) { allPrimitives = primitivesLoopSplice(inputs[1], target); if (allPrimitives) { return target; } else { target.splice(0, target.length); } } for (var i = 1; i < length; i++) { input = inputs[i]; for (key in input) { src = target[key]; copy = input[key]; if (noArrayCopies && isArray(copy)) { target[key] = copy; } else if (isDeep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } target[key] = _extend([clone, copy], isDeep, keepAllKeys, noArrayCopies); } else if (typeof copy !== "undefined" || keepAllKeys) { target[key] = copy; } } } return target; } } }); // node_modules/plotly.js/src/plots/font_attributes.js var require_font_attributes = __commonJS({ "node_modules/plotly.js/src/plots/font_attributes.js"(exports2, module2) { "use strict"; module2.exports = function(opts) { var variantValues = opts.variantValues; var editType = opts.editType; var colorEditType = opts.colorEditType; if (colorEditType === void 0) colorEditType = editType; var weight = { editType, valType: "integer", min: 1, max: 1e3, extras: ["normal", "bold"], dflt: "normal", description: [ "Sets the weight (or boldness) of the font." ].join(" ") }; if (opts.noNumericWeightValues) { weight.valType = "enumerated"; weight.values = weight.extras; weight.extras = void 0; weight.min = void 0; weight.max = void 0; } var attrs = { family: { valType: "string", noBlank: true, strict: true, editType, description: [ "HTML font family - the typeface that will be applied by the web browser.", "The web browser will only be able to apply a font if it is available on the system", "which it operates. Provide multiple font families, separated by commas, to indicate", "the preference in which to apply fonts if they aren't available on the system.", "The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server,", "where only a select number of", "fonts are installed and supported.", "These include *Arial*, *Balto*, *Courier New*, *Droid Sans*, *Droid Serif*,", "*Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*,", "*PT Sans Narrow*, *Raleway*, *Times New Roman*." ].join(" ") }, size: { valType: "number", min: 1, editType }, color: { valType: "color", editType: colorEditType }, weight, style: { editType, valType: "enumerated", values: ["normal", "italic"], dflt: "normal", description: [ "Sets whether a font should be styled with a normal or italic face from its family." ].join(" ") }, variant: opts.noFontVariant ? void 0 : { editType, valType: "enumerated", values: variantValues || [ "normal", "small-caps", "all-small-caps", "all-petite-caps", "petite-caps", "unicase" ], dflt: "normal", description: [ "Sets the variant of the font." ].join(" ") }, textcase: opts.noFontTextcase ? void 0 : { editType, valType: "enumerated", values: ["normal", "word caps", "upper", "lower"], dflt: "normal", description: [ "Sets capitalization of text.", "It can be used to make text appear in all-uppercase or all-lowercase,", "or with each word capitalized." ].join(" ") }, lineposition: opts.noFontLineposition ? void 0 : { editType, valType: "flaglist", flags: ["under", "over", "through"], extras: ["none"], dflt: "none", description: [ "Sets the kind of decoration line(s) with text,", "such as an *under*, *over* or *through*", "as well as combinations e.g. *under+over*, etc." ].join(" ") }, shadow: opts.noFontShadow ? void 0 : { editType, valType: "string", dflt: opts.autoShadowDflt ? "auto" : "none", description: [ "Sets the shape and color of the shadow behind text.", "*auto* places minimal shadow and applies contrast text font color.", "See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options." ].join(" ") }, editType, // blank strings so compress_attributes can remove // TODO - that's uber hacky... better solution? description: "" + (opts.description || "") }; if (opts.autoSize) attrs.size.dflt = "auto"; if (opts.autoColor) attrs.color.dflt = "auto"; if (opts.arrayOk) { attrs.family.arrayOk = true; attrs.weight.arrayOk = true; attrs.style.arrayOk = true; if (!opts.noFontVariant) { attrs.variant.arrayOk = true; } if (!opts.noFontTextcase) { attrs.textcase.arrayOk = true; } if (!opts.noFontLineposition) { attrs.lineposition.arrayOk = true; } if (!opts.noFontShadow) { attrs.shadow.arrayOk = true; } attrs.size.arrayOk = true; attrs.color.arrayOk = true; } return attrs; }; } }); // node_modules/plotly.js/src/components/fx/constants.js var require_constants = __commonJS({ "node_modules/plotly.js/src/components/fx/constants.js"(exports2, module2) { "use strict"; module2.exports = { // hover labels for multiple horizontal bars get tilted by this angle YANGLE: 60, // size and display constants for hover text // pixel size of hover arrows HOVERARROWSIZE: 6, // pixels padding around text HOVERTEXTPAD: 3, // hover font HOVERFONTSIZE: 13, HOVERFONT: "Arial, sans-serif", // minimum time (msec) between hover calls HOVERMINTIME: 50, // ID suffix (with fullLayout._uid) for hover events in the throttle cache HOVERID: "-hover" }; } }); // node_modules/plotly.js/src/components/fx/layout_attributes.js var require_layout_attributes = __commonJS({ "node_modules/plotly.js/src/components/fx/layout_attributes.js"(exports2, module2) { "use strict"; var constants = require_constants(); var fontAttrs = require_font_attributes(); var font = fontAttrs({ editType: "none", description: "Sets the default hover label font used by all traces on the graph." }); font.family.dflt = constants.HOVERFONT; font.size.dflt = constants.HOVERFONTSIZE; module2.exports = { clickmode: { valType: "flaglist", flags: ["event", "select"], dflt: "event", editType: "plot", extras: ["none"], description: [ "Determines the mode of single click interactions.", "*event* is the default value and emits the `plotly_click`", "event. In addition this mode emits the `plotly_selected` event", "in drag modes *lasso* and *select*, but with no event data attached", "(kept for compatibility reasons).", "The *select* flag enables selecting single", "data points via click. This mode also supports persistent selections,", "meaning that pressing Shift while clicking, adds to / subtracts from an", "existing selection. *select* with `hovermode`: *x* can be confusing, consider", "explicitly setting `hovermode`: *closest* when using this feature.", "Selection events are sent accordingly as long as *event* flag is set as well.", "When the *event* flag is missing, `plotly_click` and `plotly_selected`", "events are not fired." ].join(" ") }, dragmode: { valType: "enumerated", values: [ "zoom", "pan", "select", "lasso", "drawclosedpath", "drawopenpath", "drawline", "drawrect", "drawcircle", "orbit", "turntable", false ], dflt: "zoom", editType: "modebar", description: [ "Determines the mode of drag interactions.", "*select* and *lasso* apply only to scatter traces with", "markers or text. *orbit* and *turntable* apply only to", "3D scenes." ].join(" ") }, hovermode: { valType: "enumerated", values: ["x", "y", "closest", false, "x unified", "y unified"], dflt: "closest", editType: "modebar", description: [ "Determines the mode of hover interactions.", "If *closest*, a single hoverlabel will appear", "for the *closest* point within the `hoverdistance`.", "If *x* (or *y*), multiple hoverlabels will appear for multiple points", "at the *closest* x- (or y-) coordinate within the `hoverdistance`,", "with the caveat that no more than one hoverlabel will appear per trace.", "If *x unified* (or *y unified*), a single hoverlabel will appear", "multiple points at the closest x- (or y-) coordinate within the `hoverdistance`", "with the caveat that no more than one hoverlabel will appear per trace.", "In this mode, spikelines are enabled by default perpendicular to the specified axis.", "If false, hover interactions are disabled." ].join(" ") }, hoversubplots: { valType: "enumerated", values: ["single", "overlaying", "axis"], dflt: "overlaying", editType: "none", description: [ "Determines expansion of hover effects to other subplots", "If *single* just the axis pair of the primary point is included without overlaying subplots.", "If *overlaying* all subplots using the main axis and occupying the same space are included.", "If *axis*, also include stacked subplots using the same axis", "when `hovermode` is set to *x*, *x unified*, *y* or *y unified*." ].join(" ") }, hoverdistance: { valType: "integer", min: -1, dflt: 20, editType: "none", description: [ "Sets the default distance (in pixels) to look for data", "to add hover labels (-1 means no cutoff, 0 means no looking for data).", "This is only a real distance for hovering on point-like objects,", "like scatter points. For area-like objects (bars, scatter fills, etc)", "hovering is on inside the area and off outside, but these objects", "will not supersede hover on point-like objects in case of conflict." ].join(" ") }, spikedistance: { valType: "integer", min: -1, dflt: -1, editType: "none", description: [ "Sets the default distance (in pixels) to look for data to draw", "spikelines to (-1 means no cutoff, 0 means no looking for data).", "As with hoverdistance, distance does not apply to area-like objects.", "In addition, some objects can be hovered on but will not generate", "spikelines, such as scatter fills." ].join(" ") }, hoverlabel: { bgcolor: { valType: "color", editType: "none", description: [ "Sets the background color of all hover labels on graph" ].join(" ") }, bordercolor: { valType: "color", editType: "none", description: [ "Sets the border color of all hover labels on graph." ].join(" ") }, font, grouptitlefont: fontAttrs({ editType: "none", description: [ "Sets the font for group titles in hover (unified modes).", "Defaults to `hoverlabel.font`." ].join(" ") }), align: { valType: "enumerated", values: ["left", "right", "auto"], dflt: "auto", editType: "none", description: [ "Sets the horizontal alignment of the text content within hover label box.", "Has an effect only if the hover label text spans more two or more lines" ].join(" ") }, namelength: { valType: "integer", min: -1, dflt: 15, editType: "none", description: [ "Sets the default length (in number of characters) of the trace name in", "the hover labels for all traces. -1 shows the whole name", "regardless of length. 0-3 shows the first 0-3 characters, and", "an integer >3 will show the whole name if it is less than that", "many characters, but if it is longer, will truncate to", "`namelength - 3` characters and add an ellipsis." ].join(" ") }, editType: "none" }, selectdirection: { valType: "enumerated", values: ["h", "v", "d", "any"], dflt: "any", description: [ "When `dragmode` is set to *select*, this limits the selection of the drag to", "horizontal, vertical or diagonal. *h* only allows horizontal selection,", "*v* only vertical, *d* only diagonal and *any* sets no limit." ].join(" "), editType: "none" } }; } }); // node_modules/plotly.js/src/components/fx/attributes.js var require_attributes = __commonJS({ "node_modules/plotly.js/src/components/fx/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var hoverLabelAttrs = require_layout_attributes().hoverlabel; var extendFlat = require_extend().extendFlat; module2.exports = { hoverlabel: { bgcolor: extendFlat({}, hoverLabelAttrs.bgcolor, { arrayOk: true, description: "Sets the background color of the hover labels for this trace" }), bordercolor: extendFlat({}, hoverLabelAttrs.bordercolor, { arrayOk: true, description: "Sets the border color of the hover labels for this trace." }), font: fontAttrs({ arrayOk: true, editType: "none", description: "Sets the font used in hover labels." }), align: extendFlat({}, hoverLabelAttrs.align, { arrayOk: true }), namelength: extendFlat({}, hoverLabelAttrs.namelength, { arrayOk: true }), editType: "none" } }; } }); // node_modules/plotly.js/src/plots/attributes.js var require_attributes2 = __commonJS({ "node_modules/plotly.js/src/plots/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var fxAttrs = require_attributes(); module2.exports = { type: { valType: "enumerated", values: [], // listed dynamically dflt: "scatter", editType: "calc+clearAxisTypes", _noTemplating: true // we handle this at a higher level }, visible: { valType: "enumerated", values: [true, false, "legendonly"], dflt: true, editType: "calc", description: [ "Determines whether or not this trace is visible.", "If *legendonly*, the trace is not drawn,", "but can appear as a legend item", "(provided that the legend itself is visible)." ].join(" ") }, showlegend: { valType: "boolean", dflt: true, editType: "style", description: [ "Determines whether or not an item corresponding to this", "trace is shown in the legend." ].join(" ") }, legend: { valType: "subplotid", dflt: "legend", editType: "style", description: [ "Sets the reference to a legend to show this trace in.", "References to these legends are *legend*, *legend2*, *legend3*, etc.", "Settings for these legends are set in the layout, under", "`layout.legend`, `layout.legend2`, etc." ].join(" ") }, legendgroup: { valType: "string", dflt: "", editType: "style", description: [ "Sets the legend group for this trace.", "Traces and shapes part of the same legend group hide/show at the same time", "when toggling legend items." ].join(" ") }, legendgrouptitle: { text: { valType: "string", dflt: "", editType: "style", description: [ "Sets the title of the legend group." ].join(" ") }, font: fontAttrs({ editType: "style", description: [ "Sets this legend group's title font." ].join(" ") }), editType: "style" }, legendrank: { valType: "number", dflt: 1e3, editType: "style", description: [ "Sets the legend rank for this trace.", "Items and groups with smaller ranks are presented on top/left side while", "with *reversed* `legend.traceorder` they are on bottom/right side.", "The default legendrank is 1000,", "so that you can use ranks less than 1000 to place certain items before all unranked items,", "and ranks greater than 1000 to go after all unranked items.", "When having unranked or equal rank items shapes would be displayed after traces", "i.e. according to their order in data and layout." ].join(" ") }, legendwidth: { valType: "number", min: 0, editType: "style", description: "Sets the width (in px or fraction) of the legend for this trace." }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "style", description: "Sets the opacity of the trace." }, name: { valType: "string", editType: "style", description: [ "Sets the trace name.", "The trace name appears as the legend item and on hover." ].join(" ") }, uid: { valType: "string", editType: "plot", anim: true, description: [ "Assign an id to this trace,", "Use this to provide object constancy between traces during animations", "and transitions." ].join(" ") }, ids: { valType: "data_array", editType: "calc", anim: true, description: [ "Assigns id labels to each datum.", "These ids for object constancy of data points during animation.", "Should be an array of strings, not numbers or any other type." ].join(" ") }, customdata: { valType: "data_array", editType: "calc", description: [ "Assigns extra data each datum.", "This may be useful when listening to hover, click and selection events.", "Note that, *scatter* traces also appends customdata items in the markers", "DOM elements" ].join(" ") }, meta: { valType: "any", arrayOk: true, editType: "plot", description: [ "Assigns extra meta information associated with this trace", "that can be used in various text attributes.", "Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text`", "`rangeselector`, `updatemenues` and `sliders` `label` text", "all support `meta`.", "To access the trace `meta` values in an attribute in the same trace, simply use", "`%{meta[i]}` where `i` is the index or key of the `meta`", "item in question.", "To access trace `meta` in layout attributes, use", "`%{data[n[.meta[i]}` where `i` is the index or key of the `meta`", "and `n` is the trace index." ].join(" ") }, // N.B. these cannot be 'data_array' as they do not have the same length as // other data arrays and arrayOk attributes in general // // Maybe add another valType: // https://github.com/plotly/plotly.js/issues/1894 selectedpoints: { valType: "any", editType: "calc", description: [ "Array containing integer indices of selected points.", "Has an effect only for traces that support selections.", "Note that an empty array means an empty selection where the `unselected`", "are turned on for all points, whereas, any other non-array values means no", "selection all where the `selected` and `unselected` styles have no effect." ].join(" ") }, hoverinfo: { valType: "flaglist", flags: ["x", "y", "z", "text", "name"], extras: ["all", "none", "skip"], arrayOk: true, dflt: "all", editType: "none", description: [ "Determines which trace information appear on hover.", "If `none` or `skip` are set, no information is displayed upon hovering.", "But, if `none` is set, click and hover events are still fired." ].join(" ") }, hoverlabel: fxAttrs.hoverlabel, stream: { token: { valType: "string", noBlank: true, strict: true, editType: "calc", description: [ "The stream id number links a data trace on a plot with a stream.", "See https://chart-studio.plotly.com/settings for more details." ].join(" ") }, maxpoints: { valType: "number", min: 0, max: 1e4, dflt: 500, editType: "calc", description: [ "Sets the maximum number of points to keep on the plots from an", "incoming stream.", "If `maxpoints` is set to *50*, only the newest 50 points will", "be displayed on the plot." ].join(" ") }, editType: "calc" }, transforms: { _isLinkedToArray: "transform", editType: "calc", description: [ "WARNING: All transforms are deprecated and may be removed from the API in next major version.", "An array of operations that manipulate the trace data,", "for example filtering or sorting the data arrays." ].join(" ") }, uirevision: { valType: "any", editType: "none", description: [ "Controls persistence of some user-driven changes to the trace:", "`constraintrange` in `parcoords` traces, as well as some", "`editable: true` modifications such as `name` and `colorbar.title`.", "Defaults to `layout.uirevision`.", "Note that other user-driven trace attribute changes are controlled", "by `layout` attributes:", "`trace.visible` is controlled by `layout.legend.uirevision`,", "`selectedpoints` is controlled by `layout.selectionrevision`,", "and `colorbar.(x|y)` (accessible with `config: {editable: true}`)", "is controlled by `layout.editrevision`.", "Trace changes are tracked by `uid`, which only falls back on trace", "index if no `uid` is provided. So if your app can add/remove traces", "before the end of the `data` array, such that the same trace has a", "different index, you can still preserve user-driven changes if you", "give each trace a `uid` that stays with it as it moves." ].join(" ") } }; } }); // node_modules/plotly.js/src/components/colorscale/scales.js var require_scales = __commonJS({ "node_modules/plotly.js/src/components/colorscale/scales.js"(exports2, module2) { "use strict"; var tinycolor = require_tinycolor(); var scales = { Greys: [ [0, "rgb(0,0,0)"], [1, "rgb(255,255,255)"] ], YlGnBu: [ [0, "rgb(8,29,88)"], [0.125, "rgb(37,52,148)"], [0.25, "rgb(34,94,168)"], [0.375, "rgb(29,145,192)"], [0.5, "rgb(65,182,196)"], [0.625, "rgb(127,205,187)"], [0.75, "rgb(199,233,180)"], [0.875, "rgb(237,248,217)"], [1, "rgb(255,255,217)"] ], Greens: [ [0, "rgb(0,68,27)"], [0.125, "rgb(0,109,44)"], [0.25, "rgb(35,139,69)"], [0.375, "rgb(65,171,93)"], [0.5, "rgb(116,196,118)"], [0.625, "rgb(161,217,155)"], [0.75, "rgb(199,233,192)"], [0.875, "rgb(229,245,224)"], [1, "rgb(247,252,245)"] ], YlOrRd: [ [0, "rgb(128,0,38)"], [0.125, "rgb(189,0,38)"], [0.25, "rgb(227,26,28)"], [0.375, "rgb(252,78,42)"], [0.5, "rgb(253,141,60)"], [0.625, "rgb(254,178,76)"], [0.75, "rgb(254,217,118)"], [0.875, "rgb(255,237,160)"], [1, "rgb(255,255,204)"] ], Bluered: [ [0, "rgb(0,0,255)"], [1, "rgb(255,0,0)"] ], // modified RdBu based on // http://www.kennethmoreland.com/color-maps/ RdBu: [ [0, "rgb(5,10,172)"], [0.35, "rgb(106,137,247)"], [0.5, "rgb(190,190,190)"], [0.6, "rgb(220,170,132)"], [0.7, "rgb(230,145,90)"], [1, "rgb(178,10,28)"] ], // Scale for non-negative numeric values Reds: [ [0, "rgb(220,220,220)"], [0.2, "rgb(245,195,157)"], [0.4, "rgb(245,160,105)"], [1, "rgb(178,10,28)"] ], // Scale for non-positive numeric values Blues: [ [0, "rgb(5,10,172)"], [0.35, "rgb(40,60,190)"], [0.5, "rgb(70,100,245)"], [0.6, "rgb(90,120,245)"], [0.7, "rgb(106,137,247)"], [1, "rgb(220,220,220)"] ], Picnic: [ [0, "rgb(0,0,255)"], [0.1, "rgb(51,153,255)"], [0.2, "rgb(102,204,255)"], [0.3, "rgb(153,204,255)"], [0.4, "rgb(204,204,255)"], [0.5, "rgb(255,255,255)"], [0.6, "rgb(255,204,255)"], [0.7, "rgb(255,153,255)"], [0.8, "rgb(255,102,204)"], [0.9, "rgb(255,102,102)"], [1, "rgb(255,0,0)"] ], Rainbow: [ [0, "rgb(150,0,90)"], [0.125, "rgb(0,0,200)"], [0.25, "rgb(0,25,255)"], [0.375, "rgb(0,152,255)"], [0.5, "rgb(44,255,150)"], [0.625, "rgb(151,255,0)"], [0.75, "rgb(255,234,0)"], [0.875, "rgb(255,111,0)"], [1, "rgb(255,0,0)"] ], Portland: [ [0, "rgb(12,51,131)"], [0.25, "rgb(10,136,186)"], [0.5, "rgb(242,211,56)"], [0.75, "rgb(242,143,56)"], [1, "rgb(217,30,30)"] ], Jet: [ [0, "rgb(0,0,131)"], [0.125, "rgb(0,60,170)"], [0.375, "rgb(5,255,255)"], [0.625, "rgb(255,255,0)"], [0.875, "rgb(250,0,0)"], [1, "rgb(128,0,0)"] ], Hot: [ [0, "rgb(0,0,0)"], [0.3, "rgb(230,0,0)"], [0.6, "rgb(255,210,0)"], [1, "rgb(255,255,255)"] ], Blackbody: [ [0, "rgb(0,0,0)"], [0.2, "rgb(230,0,0)"], [0.4, "rgb(230,210,0)"], [0.7, "rgb(255,255,255)"], [1, "rgb(160,200,255)"] ], Earth: [ [0, "rgb(0,0,130)"], [0.1, "rgb(0,180,180)"], [0.2, "rgb(40,210,40)"], [0.4, "rgb(230,230,50)"], [0.6, "rgb(120,70,20)"], [1, "rgb(255,255,255)"] ], Electric: [ [0, "rgb(0,0,0)"], [0.15, "rgb(30,0,100)"], [0.4, "rgb(120,0,100)"], [0.6, "rgb(160,90,0)"], [0.8, "rgb(230,200,0)"], [1, "rgb(255,250,220)"] ], Viridis: [ [0, "#440154"], [0.06274509803921569, "#48186a"], [0.12549019607843137, "#472d7b"], [0.18823529411764706, "#424086"], [0.25098039215686274, "#3b528b"], [0.3137254901960784, "#33638d"], [0.3764705882352941, "#2c728e"], [0.4392156862745098, "#26828e"], [0.5019607843137255, "#21918c"], [0.5647058823529412, "#1fa088"], [0.6274509803921569, "#28ae80"], [0.6901960784313725, "#3fbc73"], [0.7529411764705882, "#5ec962"], [0.8156862745098039, "#84d44b"], [0.8784313725490196, "#addc30"], [0.9411764705882353, "#d8e219"], [1, "#fde725"] ], Cividis: [ [0, "rgb(0,32,76)"], [0.058824, "rgb(0,42,102)"], [0.117647, "rgb(0,52,110)"], [0.176471, "rgb(39,63,108)"], [0.235294, "rgb(60,74,107)"], [0.294118, "rgb(76,85,107)"], [0.352941, "rgb(91,95,109)"], [0.411765, "rgb(104,106,112)"], [0.470588, "rgb(117,117,117)"], [0.529412, "rgb(131,129,120)"], [0.588235, "rgb(146,140,120)"], [0.647059, "rgb(161,152,118)"], [0.705882, "rgb(176,165,114)"], [0.764706, "rgb(192,177,109)"], [0.823529, "rgb(209,191,102)"], [0.882353, "rgb(225,204,92)"], [0.941176, "rgb(243,219,79)"], [1, "rgb(255,233,69)"] ] }; var defaultScale = scales.RdBu; function getScale(scl, dflt) { if (!dflt) dflt = defaultScale; if (!scl) return dflt; function parseScale() { try { scl = scales[scl] || JSON.parse(scl); } catch (e) { scl = dflt; } } if (typeof scl === "string") { parseScale(); if (typeof scl === "string") parseScale(); } if (!isValidScaleArray(scl)) return dflt; return scl; } function isValidScaleArray(scl) { var highestVal = 0; if (!Array.isArray(scl) || scl.length < 2) return false; if (!scl[0] || !scl[scl.length - 1]) return false; if (+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false; for (var i = 0; i < scl.length; i++) { var si2 = scl[i]; if (si2.length !== 2 || +si2[0] < highestVal || !tinycolor(si2[1]).isValid()) { return false; } highestVal = +si2[0]; } return true; } function isValidScale(scl) { if (scales[scl] !== void 0) return true; else return isValidScaleArray(scl); } module2.exports = { scales, defaultScale, get: getScale, isValid: isValidScale }; } }); // node_modules/plotly.js/src/components/color/attributes.js var require_attributes3 = __commonJS({ "node_modules/plotly.js/src/components/color/attributes.js"(exports2) { "use strict"; exports2.defaults = [ "#1f77b4", // muted blue "#ff7f0e", // safety orange "#2ca02c", // cooked asparagus green "#d62728", // brick red "#9467bd", // muted purple "#8c564b", // chestnut brown "#e377c2", // raspberry yogurt pink "#7f7f7f", // middle gray "#bcbd22", // curry yellow-green "#17becf" // blue-teal ]; exports2.defaultLine = "#444"; exports2.lightLine = "#eee"; exports2.background = "#fff"; exports2.borderLine = "#BEC8D9"; exports2.lightFraction = 100 * (14 - 4) / (15 - 4); } }); // node_modules/plotly.js/src/components/color/index.js var require_color = __commonJS({ "node_modules/plotly.js/src/components/color/index.js"(exports2, module2) { "use strict"; var tinycolor = require_tinycolor(); var isNumeric = require_fast_isnumeric(); var isTypedArray = require_array().isTypedArray; var color = module2.exports = {}; var colorAttrs = require_attributes3(); color.defaults = colorAttrs.defaults; var defaultLine = color.defaultLine = colorAttrs.defaultLine; color.lightLine = colorAttrs.lightLine; var background = color.background = colorAttrs.background; color.tinyRGB = function(tc2) { var c = tc2.toRgb(); return "rgb(" + Math.round(c.r) + ", " + Math.round(c.g) + ", " + Math.round(c.b) + ")"; }; color.rgb = function(cstr) { return color.tinyRGB(tinycolor(cstr)); }; color.opacity = function(cstr) { return cstr ? tinycolor(cstr).getAlpha() : 0; }; color.addOpacity = function(cstr, op2) { var c = tinycolor(cstr).toRgb(); return "rgba(" + Math.round(c.r) + ", " + Math.round(c.g) + ", " + Math.round(c.b) + ", " + op2 + ")"; }; color.combine = function(front, back) { var fc2 = tinycolor(front).toRgb(); if (fc2.a === 1) return tinycolor(front).toRgbString(); var bc2 = tinycolor(back || background).toRgb(); var bcflat = bc2.a === 1 ? bc2 : { r: 255 * (1 - bc2.a) + bc2.r * bc2.a, g: 255 * (1 - bc2.a) + bc2.g * bc2.a, b: 255 * (1 - bc2.a) + bc2.b * bc2.a }; var fcflat = { r: bcflat.r * (1 - fc2.a) + fc2.r * fc2.a, g: bcflat.g * (1 - fc2.a) + fc2.g * fc2.a, b: bcflat.b * (1 - fc2.a) + fc2.b * fc2.a }; return tinycolor(fcflat).toRgbString(); }; color.interpolate = function(first, second2, factor) { var fc2 = tinycolor(first).toRgb(); var sc2 = tinycolor(second2).toRgb(); var ic2 = { r: factor * fc2.r + (1 - factor) * sc2.r, g: factor * fc2.g + (1 - factor) * sc2.g, b: factor * fc2.b + (1 - factor) * sc2.b }; return tinycolor(ic2).toRgbString(); }; color.contrast = function(cstr, lightAmount, darkAmount) { var tc2 = tinycolor(cstr); if (tc2.getAlpha() !== 1) tc2 = tinycolor(color.combine(cstr, background)); var newColor = tc2.isDark() ? lightAmount ? tc2.lighten(lightAmount) : background : darkAmount ? tc2.darken(darkAmount) : defaultLine; return newColor.toString(); }; color.stroke = function(s, c) { var tc2 = tinycolor(c); s.style({ stroke: color.tinyRGB(tc2), "stroke-opacity": tc2.getAlpha() }); }; color.fill = function(s, c) { var tc2 = tinycolor(c); s.style({ fill: color.tinyRGB(tc2), "fill-opacity": tc2.getAlpha() }); }; color.clean = function(container) { if (!container || typeof container !== "object") return; var keys = Object.keys(container); var i, j, key, val; for (i = 0; i < keys.length; i++) { key = keys[i]; val = container[key]; if (key.substr(key.length - 5) === "color") { if (Array.isArray(val)) { for (j = 0; j < val.length; j++) val[j] = cleanOne(val[j]); } else container[key] = cleanOne(val); } else if (key.substr(key.length - 10) === "colorscale" && Array.isArray(val)) { for (j = 0; j < val.length; j++) { if (Array.isArray(val[j])) val[j][1] = cleanOne(val[j][1]); } } else if (Array.isArray(val)) { var el0 = val[0]; if (!Array.isArray(el0) && el0 && typeof el0 === "object") { for (j = 0; j < val.length; j++) color.clean(val[j]); } } else if (val && typeof val === "object" && !isTypedArray(val)) color.clean(val); } }; function cleanOne(val) { if (isNumeric(val) || typeof val !== "string") return val; var valTrim = val.trim(); if (valTrim.substr(0, 3) !== "rgb") return val; var match = valTrim.match(/^rgba?\s*\(([^()]*)\)$/); if (!match) return val; var parts = match[1].trim().split(/\s*[\s,]\s*/); var rgba = valTrim.charAt(3) === "a" && parts.length === 4; if (!rgba && parts.length !== 3) return val; for (var i = 0; i < parts.length; i++) { if (!parts[i].length) return val; parts[i] = Number(parts[i]); if (!(parts[i] >= 0)) { return val; } if (i === 3) { if (parts[i] > 1) parts[i] = 1; } else if (parts[i] >= 1) { return val; } } var rgbStr = Math.round(parts[0] * 255) + ", " + Math.round(parts[1] * 255) + ", " + Math.round(parts[2] * 255); if (rgba) return "rgba(" + rgbStr + ", " + parts[3] + ")"; return "rgb(" + rgbStr + ")"; } } }); // node_modules/plotly.js/src/constants/interactions.js var require_interactions = __commonJS({ "node_modules/plotly.js/src/constants/interactions.js"(exports2, module2) { "use strict"; module2.exports = { /** * Timing information for interactive elements */ SHOW_PLACEHOLDER: 100, HIDE_PLACEHOLDER: 1e3, // opacity dimming fraction for points that are not in selection DESELECTDIM: 0.2 }; } }); // node_modules/plotly.js/src/lib/regex.js var require_regex = __commonJS({ "node_modules/plotly.js/src/lib/regex.js"(exports2) { "use strict"; exports2.counter = function(head, tail, openEnded, matchBeginning) { var fullTail = (tail || "") + (openEnded ? "" : "$"); var startWithPrefix = matchBeginning === false ? "" : "^"; if (head === "xy") { return new RegExp(startWithPrefix + "x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?" + fullTail); } return new RegExp(startWithPrefix + head + "([2-9]|[1-9][0-9]+)?" + fullTail); }; } }); // node_modules/plotly.js/src/lib/coerce.js var require_coerce = __commonJS({ "node_modules/plotly.js/src/lib/coerce.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var tinycolor = require_tinycolor(); var extendFlat = require_extend().extendFlat; var baseTraceAttrs = require_attributes2(); var colorscales = require_scales(); var Color = require_color(); var DESELECTDIM = require_interactions().DESELECTDIM; var nestedProperty = require_nested_property(); var counterRegex = require_regex().counter; var modHalf = require_mod().modHalf; var isArrayOrTypedArray = require_array().isArrayOrTypedArray; var isTypedArraySpec = require_array().isTypedArraySpec; var decodeTypedArraySpec = require_array().decodeTypedArraySpec; exports2.valObjectMeta = { data_array: { // You can use *dflt=[] to force said array to exist though. description: [ "An {array} of data.", "The value must represent an {array} or it will be ignored,", "but this array can be provided in several forms:", "(1) a regular {array} object", "(2) a typed array (e.g. Float32Array)", "(3) an object with keys dtype, bdata, and optionally shape.", "In this 3rd form, dtype is one of", "*f8*, *f4*.", "*i4*, *u4*,", "*i2*, *u2*,", "*i1*, *u1* or *u1c* for Uint8ClampedArray.", "In addition to shorthand `dtype` above one could also use the following forms:", "*float64*, *float32*,", "*int32*, *uint32*,", "*int16*, *uint16*,", "*int8*, *uint8* or *uint8c* for Uint8ClampedArray.", "`bdata` is either a base64-encoded string or the ArrayBuffer of", "an integer or float typed array.", "For either multi-dimensional arrays you must also", "provide its dimensions separated by comma via `shape`.", "For example using `dtype`: *f4* and `shape`: *5,100* you can", "declare a 2-D array that has 5 rows and 100 columns", "containing float32 values i.e. 4 bits per value.", "`shape` is optional for one dimensional arrays." ].join(" "), requiredOpts: [], otherOpts: ["dflt"], coerceFunction: function(v, propOut, dflt) { propOut.set( isArrayOrTypedArray(v) ? v : isTypedArraySpec(v) ? decodeTypedArraySpec(v) : dflt ); } }, enumerated: { description: [ "Enumerated value type. The available values are listed", "in `values`." ].join(" "), requiredOpts: ["values"], otherOpts: ["dflt", "coerceNumber", "arrayOk"], coerceFunction: function(v, propOut, dflt, opts) { if (opts.coerceNumber) v = +v; if (opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); }, validateFunction: function(v, opts) { if (opts.coerceNumber) v = +v; var values = opts.values; for (var i = 0; i < values.length; i++) { var k = String(values[i]); if (k.charAt(0) === "/" && k.charAt(k.length - 1) === "/") { var regex = new RegExp(k.substr(1, k.length - 2)); if (regex.test(v)) return true; } else if (v === values[i]) return true; } return false; } }, boolean: { description: "A boolean (true/false) value.", requiredOpts: [], otherOpts: ["dflt"], coerceFunction: function(v, propOut, dflt) { if (v === true || v === false) propOut.set(v); else propOut.set(dflt); } }, number: { description: [ "A number or a numeric value", "(e.g. a number inside a string).", "When applicable, values greater (less) than `max` (`min`)", "are coerced to the `dflt`." ].join(" "), requiredOpts: [], otherOpts: ["dflt", "min", "max", "arrayOk"], coerceFunction: function(v, propOut, dflt, opts) { if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); if (!isNumeric(v) || opts.min !== void 0 && v < opts.min || opts.max !== void 0 && v > opts.max) { propOut.set(dflt); } else propOut.set(+v); } }, integer: { description: [ "An integer or an integer inside a string.", "When applicable, values greater (less) than `max` (`min`)", "are coerced to the `dflt`." ].join(" "), requiredOpts: [], otherOpts: ["dflt", "min", "max", "arrayOk", "extras"], coerceFunction: function(v, propOut, dflt, opts) { if ((opts.extras || []).indexOf(v) !== -1) { propOut.set(v); return; } if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); if (v % 1 || !isNumeric(v) || opts.min !== void 0 && v < opts.min || opts.max !== void 0 && v > opts.max) { propOut.set(dflt); } else propOut.set(+v); } }, string: { description: [ "A string value.", "Numbers are converted to strings except for attributes with", "`strict` set to true." ].join(" "), requiredOpts: [], // TODO 'values shouldn't be in there (edge case: 'dash' in Scatter) otherOpts: ["dflt", "noBlank", "strict", "arrayOk", "values"], coerceFunction: function(v, propOut, dflt, opts) { if (typeof v !== "string") { var okToCoerce = typeof v === "number"; if (opts.strict === true || !okToCoerce) propOut.set(dflt); else propOut.set(String(v)); } else if (opts.noBlank && !v) propOut.set(dflt); else propOut.set(v); } }, color: { description: [ "A string describing color.", "Supported formats:", "- hex (e.g. '#d3d3d3')", "- rgb (e.g. 'rgb(255, 0, 0)')", "- rgba (e.g. 'rgb(255, 0, 0, 0.5)')", "- hsl (e.g. 'hsl(0, 100%, 50%)')", "- hsv (e.g. 'hsv(0, 100%, 100%)')", "- named colors (full list: http://www.w3.org/TR/css3-color/#svg-color)" ].join(" "), requiredOpts: [], otherOpts: ["dflt", "arrayOk"], coerceFunction: function(v, propOut, dflt) { if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); if (tinycolor(v).isValid()) propOut.set(v); else propOut.set(dflt); } }, colorlist: { description: [ "A list of colors.", "Must be an {array} containing valid colors." ].join(" "), requiredOpts: [], otherOpts: ["dflt"], coerceFunction: function(v, propOut, dflt) { function isColor(color) { return tinycolor(color).isValid(); } if (!Array.isArray(v) || !v.length) propOut.set(dflt); else if (v.every(isColor)) propOut.set(v); else propOut.set(dflt); } }, colorscale: { description: [ "A Plotly colorscale either picked by a name:", "(any of", Object.keys(colorscales.scales).join(", "), ")", "customized as an {array} of 2-element {arrays} where", "the first element is the normalized color level value", "(starting at *0* and ending at *1*),", "and the second item is a valid color string." ].join(" "), requiredOpts: [], otherOpts: ["dflt"], coerceFunction: function(v, propOut, dflt) { propOut.set(colorscales.get(v, dflt)); } }, angle: { description: [ "A number (in degree) between -180 and 180." ].join(" "), requiredOpts: [], otherOpts: ["dflt", "arrayOk"], coerceFunction: function(v, propOut, dflt) { if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); if (v === "auto") propOut.set("auto"); else if (!isNumeric(v)) propOut.set(dflt); else propOut.set(modHalf(+v, 360)); } }, subplotid: { description: [ "An id string of a subplot type (given by dflt), optionally", "followed by an integer >1. e.g. if dflt='geo', we can have", "'geo', 'geo2', 'geo3', ..." ].join(" "), requiredOpts: ["dflt"], otherOpts: ["regex"], coerceFunction: function(v, propOut, dflt, opts) { var regex = opts.regex || counterRegex(dflt); if (typeof v === "string" && regex.test(v)) { propOut.set(v); return; } propOut.set(dflt); }, validateFunction: function(v, opts) { var dflt = opts.dflt; if (v === dflt) return true; if (typeof v !== "string") return false; if (counterRegex(dflt).test(v)) return true; return false; } }, flaglist: { description: [ "A string representing a combination of flags", "(order does not matter here).", "Combine any of the available `flags` with *+*.", "(e.g. ('lines+markers')).", "Values in `extras` cannot be combined." ].join(" "), requiredOpts: ["flags"], otherOpts: ["dflt", "extras", "arrayOk"], coerceFunction: function(v, propOut, dflt, opts) { if ((opts.extras || []).indexOf(v) !== -1) { propOut.set(v); return; } if (typeof v !== "string") { propOut.set(dflt); return; } var vParts = v.split("+"); var i = 0; while (i < vParts.length) { var vi2 = vParts[i]; if (opts.flags.indexOf(vi2) === -1 || vParts.indexOf(vi2) < i) { vParts.splice(i, 1); } else i++; } if (!vParts.length) propOut.set(dflt); else propOut.set(vParts.join("+")); } }, any: { description: "Any type.", requiredOpts: [], otherOpts: ["dflt", "values", "arrayOk"], coerceFunction: function(v, propOut, dflt) { if (v === void 0) { propOut.set(dflt); } else { propOut.set( isTypedArraySpec(v) ? decodeTypedArraySpec(v) : v ); } } }, info_array: { description: [ "An {array} of plot information." ].join(" "), requiredOpts: ["items"], // set `dimensions=2` for a 2D array or '1-2' for either // `items` may be a single object instead of an array, in which case // `freeLength` must be true. // if `dimensions='1-2'` and items is a 1D array, then the value can // either be a matching 1D array or an array of such matching 1D arrays otherOpts: ["dflt", "freeLength", "dimensions"], coerceFunction: function(v, propOut, dflt, opts) { function coercePart(v2, opts2, dflt2) { var out; var propPart = { set: function(v3) { out = v3; } }; if (dflt2 === void 0) dflt2 = opts2.dflt; exports2.valObjectMeta[opts2.valType].coerceFunction(v2, propPart, dflt2, opts2); return out; } if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); if (!isArrayOrTypedArray(v)) { propOut.set(dflt); return; } var twoD = opts.dimensions === 2 || opts.dimensions === "1-2" && Array.isArray(v) && isArrayOrTypedArray(v[0]); var items = opts.items; var vOut = []; var arrayItems = Array.isArray(items); var arrayItems2D = arrayItems && twoD && isArrayOrTypedArray(items[0]); var innerItemsOnly = twoD && arrayItems && !arrayItems2D; var len = arrayItems && !innerItemsOnly ? items.length : v.length; var i, j, row, item, len2, vNew; dflt = Array.isArray(dflt) ? dflt : []; if (twoD) { for (i = 0; i < len; i++) { vOut[i] = []; row = isArrayOrTypedArray(v[i]) ? v[i] : []; if (innerItemsOnly) len2 = items.length; else if (arrayItems) len2 = items[i].length; else len2 = row.length; for (j = 0; j < len2; j++) { if (innerItemsOnly) item = items[j]; else if (arrayItems) item = items[i][j]; else item = items; vNew = coercePart(row[j], item, (dflt[i] || [])[j]); if (vNew !== void 0) vOut[i][j] = vNew; } } } else { for (i = 0; i < len; i++) { vNew = coercePart(v[i], arrayItems ? items[i] : items, dflt[i]); if (vNew !== void 0) vOut[i] = vNew; } } propOut.set(vOut); }, validateFunction: function(v, opts) { if (!isArrayOrTypedArray(v)) return false; var items = opts.items; var arrayItems = Array.isArray(items); var twoD = opts.dimensions === 2; if (!opts.freeLength && v.length !== items.length) return false; for (var i = 0; i < v.length; i++) { if (twoD) { if (!isArrayOrTypedArray(v[i]) || !opts.freeLength && v[i].length !== items[i].length) { return false; } for (var j = 0; j < v[i].length; j++) { if (!validate(v[i][j], arrayItems ? items[i][j] : items)) { return false; } } } else if (!validate(v[i], arrayItems ? items[i] : items)) return false; } return true; } } }; exports2.coerce = function(containerIn, containerOut, attributes, attribute, dflt) { var opts = nestedProperty(attributes, attribute).get(); var propIn = nestedProperty(containerIn, attribute); var propOut = nestedProperty(containerOut, attribute); var v = propIn.get(); var template = containerOut._template; if (v === void 0 && template) { v = nestedProperty(template, attribute).get(); template = 0; } if (dflt === void 0) dflt = opts.dflt; if (opts.arrayOk) { if (isArrayOrTypedArray(v)) { propOut.set(v); return v; } else { if (isTypedArraySpec(v)) { v = decodeTypedArraySpec(v); propOut.set(v); return v; } } } var coerceFunction = exports2.valObjectMeta[opts.valType].coerceFunction; coerceFunction(v, propOut, dflt, opts); var out = propOut.get(); if (template && out === dflt && !validate(v, opts)) { v = nestedProperty(template, attribute).get(); coerceFunction(v, propOut, dflt, opts); out = propOut.get(); } return out; }; exports2.coerce2 = function(containerIn, containerOut, attributes, attribute, dflt) { var propIn = nestedProperty(containerIn, attribute); var propOut = exports2.coerce(containerIn, containerOut, attributes, attribute, dflt); var valIn = propIn.get(); return valIn !== void 0 && valIn !== null ? propOut : false; }; exports2.coerceFont = function(coerce, attr, dfltObj, opts) { if (!opts) opts = {}; dfltObj = extendFlat({}, dfltObj); dfltObj = extendFlat(dfltObj, opts.overrideDflt || {}); var out = { family: coerce(attr + ".family", dfltObj.family), size: coerce(attr + ".size", dfltObj.size), color: coerce(attr + ".color", dfltObj.color), weight: coerce(attr + ".weight", dfltObj.weight), style: coerce(attr + ".style", dfltObj.style) }; if (!opts.noFontVariant) out.variant = coerce(attr + ".variant", dfltObj.variant); if (!opts.noFontLineposition) out.lineposition = coerce(attr + ".lineposition", dfltObj.lineposition); if (!opts.noFontTextcase) out.textcase = coerce(attr + ".textcase", dfltObj.textcase); if (!opts.noFontShadow) { var dfltShadow = dfltObj.shadow; if (dfltShadow === "none" && opts.autoShadowDflt) { dfltShadow = "auto"; } out.shadow = coerce(attr + ".shadow", dfltShadow); } return out; }; exports2.coercePattern = function(coerce, attr, markerColor, hasMarkerColorscale) { var shape = coerce(attr + ".shape"); if (shape) { coerce(attr + ".solidity"); coerce(attr + ".size"); var fillmode = coerce(attr + ".fillmode"); var isOverlay = fillmode === "overlay"; if (!hasMarkerColorscale) { var bgcolor = coerce( attr + ".bgcolor", isOverlay ? markerColor : void 0 ); coerce( attr + ".fgcolor", isOverlay ? Color.contrast(bgcolor) : markerColor ); } coerce( attr + ".fgopacity", isOverlay ? 0.5 : 1 ); } }; exports2.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { var moduleAttrs = traceOut._module.attributes; var attrs = moduleAttrs.hoverinfo ? moduleAttrs : baseTraceAttrs; var valObj = attrs.hoverinfo; var dflt; if (layoutOut._dataLength === 1) { var flags = valObj.dflt === "all" ? valObj.flags.slice() : valObj.dflt.split("+"); flags.splice(flags.indexOf("name"), 1); dflt = flags.join("+"); } return exports2.coerce(traceIn, traceOut, attrs, "hoverinfo", dflt); }; exports2.coerceSelectionMarkerOpacity = function(traceOut, coerce) { if (!traceOut.marker) return; var mo2 = traceOut.marker.opacity; if (mo2 === void 0) return; var smoDflt; var usmoDflt; if (!isArrayOrTypedArray(mo2) && !traceOut.selected && !traceOut.unselected) { smoDflt = mo2; usmoDflt = DESELECTDIM * mo2; } coerce("selected.marker.opacity", smoDflt); coerce("unselected.marker.opacity", usmoDflt); }; function validate(value, opts) { var valObjectDef = exports2.valObjectMeta[opts.valType]; if (opts.arrayOk && isArrayOrTypedArray(value)) return true; if (valObjectDef.validateFunction) { return valObjectDef.validateFunction(value, opts); } var failed = {}; var out = failed; var propMock = { set: function(v) { out = v; } }; valObjectDef.coerceFunction(value, propMock, failed, opts); return out !== failed; } exports2.validate = validate; } }); // node_modules/plotly.js/src/plot_api/plot_config.js var require_plot_config = __commonJS({ "node_modules/plotly.js/src/plot_api/plot_config.js"(exports2, module2) { "use strict"; var configAttributes = { staticPlot: { valType: "boolean", dflt: false, description: [ "Determines whether the graphs are interactive or not.", "If *false*, no interactivity, for export or image generation." ].join(" ") }, typesetMath: { valType: "boolean", dflt: true, description: [ "Determines whether math should be typeset or not,", "when MathJax (either v2 or v3) is present on the page." ].join(" ") }, plotlyServerURL: { valType: "string", dflt: "", description: [ "When set it determines base URL for", "the 'Edit in Chart Studio' `showEditInChartStudio`/`showSendToCloud` mode bar button", "and the showLink/sendData on-graph link.", "To enable sending your data to Chart Studio Cloud, you need to", "set both `plotlyServerURL` to 'https://chart-studio.plotly.com' and", "also set `showSendToCloud` to true." ].join(" ") }, editable: { valType: "boolean", dflt: false, description: [ "Determines whether the graph is editable or not.", "Sets all pieces of `edits`", "unless a separate `edits` config item overrides individual parts." ].join(" ") }, edits: { annotationPosition: { valType: "boolean", dflt: false, description: [ "Determines if the main anchor of the annotation is editable.", "The main anchor corresponds to the", "text (if no arrow) or the arrow (which drags the whole thing leaving", "the arrow length & direction unchanged)." ].join(" ") }, annotationTail: { valType: "boolean", dflt: false, description: [ "Has only an effect for annotations with arrows.", "Enables changing the length and direction of the arrow." ].join(" ") }, annotationText: { valType: "boolean", dflt: false, description: "Enables editing annotation text." }, axisTitleText: { valType: "boolean", dflt: false, description: "Enables editing axis title text." }, colorbarPosition: { valType: "boolean", dflt: false, description: "Enables moving colorbars." }, colorbarTitleText: { valType: "boolean", dflt: false, description: "Enables editing colorbar title text." }, legendPosition: { valType: "boolean", dflt: false, description: "Enables moving the legend." }, legendText: { valType: "boolean", dflt: false, description: "Enables editing the trace name fields from the legend" }, shapePosition: { valType: "boolean", dflt: false, description: "Enables moving shapes." }, titleText: { valType: "boolean", dflt: false, description: "Enables editing the global layout title." } }, editSelection: { valType: "boolean", dflt: true, description: "Enables moving selections." }, autosizable: { valType: "boolean", dflt: false, description: [ "Determines whether the graphs are plotted with respect to", "layout.autosize:true and infer its container size." ].join(" ") }, responsive: { valType: "boolean", dflt: false, description: [ "Determines whether to change the layout size when window is resized.", "In v3, this option will be removed and will always be true." ].join(" ") }, fillFrame: { valType: "boolean", dflt: false, description: [ "When `layout.autosize` is turned on, determines whether the graph", "fills the container (the default) or the screen (if set to *true*)." ].join(" ") }, frameMargins: { valType: "number", dflt: 0, min: 0, max: 0.5, description: [ "When `layout.autosize` is turned on, set the frame margins", "in fraction of the graph size." ].join(" ") }, scrollZoom: { valType: "flaglist", flags: ["cartesian", "gl3d", "geo", "mapbox", "map"], extras: [true, false], dflt: "gl3d+geo+map", description: [ "Determines whether mouse wheel or two-finger scroll zooms is enable.", "Turned on by default for gl3d, geo, mapbox and map subplots", "(as these subplot types do not have zoombox via pan),", "but turned off by default for cartesian subplots.", "Set `scrollZoom` to *false* to disable scrolling for all subplots." ].join(" ") }, doubleClick: { valType: "enumerated", values: [false, "reset", "autosize", "reset+autosize"], dflt: "reset+autosize", description: [ "Sets the double click interaction mode.", "Has an effect only in cartesian plots.", "If *false*, double click is disable.", "If *reset*, double click resets the axis ranges to their initial values.", "If *autosize*, double click set the axis ranges to their autorange values.", "If *reset+autosize*, the odd double clicks resets the axis ranges", "to their initial values and even double clicks set the axis ranges", "to their autorange values." ].join(" ") }, doubleClickDelay: { valType: "number", dflt: 300, min: 0, description: [ "Sets the delay for registering a double-click in ms.", "This is the time interval (in ms) between first mousedown and", "2nd mouseup to constitute a double-click.", "This setting propagates to all on-subplot double clicks", "(except for geo, mapbox and map) and on-legend double clicks." ].join(" ") }, showAxisDragHandles: { valType: "boolean", dflt: true, description: [ "Set to *false* to omit cartesian axis pan/zoom drag handles." ].join(" ") }, showAxisRangeEntryBoxes: { valType: "boolean", dflt: true, description: [ "Set to *false* to omit direct range entry at the pan/zoom drag points,", "note that `showAxisDragHandles` must be enabled to have an effect." ].join(" ") }, showTips: { valType: "boolean", dflt: true, description: [ "Determines whether or not tips are shown while interacting", "with the resulting graphs." ].join(" ") }, showLink: { valType: "boolean", dflt: false, description: [ "Determines whether a link to Chart Studio Cloud is displayed", "at the bottom right corner of resulting graphs.", "Use with `sendData` and `linkText`." ].join(" ") }, linkText: { valType: "string", dflt: "Edit chart", noBlank: true, description: [ "Sets the text appearing in the `showLink` link." ].join(" ") }, sendData: { valType: "boolean", dflt: true, description: [ "If *showLink* is true, does it contain data", "just link to a Chart Studio Cloud file?" ].join(" ") }, showSources: { valType: "any", dflt: false, description: [ "Adds a source-displaying function to show sources on", "the resulting graphs." ].join(" ") }, displayModeBar: { valType: "enumerated", values: ["hover", true, false], dflt: "hover", description: [ "Determines the mode bar display mode.", "If *true*, the mode bar is always visible.", "If *false*, the mode bar is always hidden.", "If *hover*, the mode bar is visible while the mouse cursor", "is on the graph container." ].join(" ") }, showSendToCloud: { valType: "boolean", dflt: false, description: [ 'Should we include a ModeBar button, labeled "Edit in Chart Studio",', "that sends this chart to chart-studio.plotly.com (formerly plot.ly) or another plotly server", "as specified by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0", "this button was included by default, now it is opt-in using this flag.", "Note that this button can (depending on `plotlyServerURL` being set) send your data", "to an external server. However that server does not persist your data", 'until you arrive at the Chart Studio and explicitly click "Save".' ].join(" ") }, showEditInChartStudio: { valType: "boolean", dflt: false, description: [ "Same as `showSendToCloud`, but use a pencil icon instead of a floppy-disk.", "Note that if both `showSendToCloud` and `showEditInChartStudio` are turned,", "only `showEditInChartStudio` will be honored." ].join(" ") }, modeBarButtonsToRemove: { valType: "any", dflt: [], description: [ "Remove mode bar buttons by name.", "See ./components/modebar/buttons.js for the list of names." ].join(" ") }, modeBarButtonsToAdd: { valType: "any", dflt: [], description: [ "Add mode bar button using config objects", "See ./components/modebar/buttons.js for list of arguments.", "To enable predefined modebar buttons e.g. shape drawing, hover and spikelines,", "simply provide their string name(s). This could include:", "*v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*,", "*drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect* and *eraseshape*.", "Please note that these predefined buttons will only be shown if they are compatible", "with all trace types used in a graph." ].join(" ") }, modeBarButtons: { valType: "any", dflt: false, description: [ "Define fully custom mode bar buttons as nested array,", "where the outer arrays represents button groups, and", "the inner arrays have buttons config objects or names of default buttons", "See ./components/modebar/buttons.js for more info." ].join(" ") }, toImageButtonOptions: { valType: "any", dflt: {}, description: [ "Statically override options for toImage modebar button", "allowed keys are format, filename, width, height, scale", "see ../components/modebar/buttons.js" ].join(" ") }, displaylogo: { valType: "boolean", dflt: true, description: [ "Determines whether or not the plotly logo is displayed", "on the end of the mode bar." ].join(" ") }, watermark: { valType: "boolean", dflt: false, description: "watermark the images with the company's logo" }, plotGlPixelRatio: { valType: "number", dflt: 2, min: 1, max: 4, description: [ "Set the pixel ratio during WebGL image export.", "This config option was formerly named `plot3dPixelRatio`", "which is now deprecated." ].join(" ") }, setBackground: { valType: "any", dflt: "transparent", description: [ "Set function to add the background color (i.e. `layout.paper_color`)", "to a different container.", "This function take the graph div as first argument and the current background", "color as second argument.", "Alternatively, set to string *opaque* to ensure there is white behind it." ].join(" ") }, topojsonURL: { valType: "string", noBlank: true, dflt: "https://cdn.plot.ly/", description: [ "Set the URL to topojson used in geo charts.", "By default, the topojson files are fetched from cdn.plot.ly.", "For example, set this option to:", "/dist/topojson/", "to render geographical feature using the topojson files", "that ship with the plotly.js module." ].join(" ") }, mapboxAccessToken: { valType: "string", dflt: null, description: [ "Mapbox access token (required to plot mapbox trace types)", "If using an Mapbox Atlas server, set this option to ''", "so that plotly.js won't attempt to authenticate to the public Mapbox server." ].join(" ") }, logging: { valType: "integer", min: 0, max: 2, dflt: 1, description: [ "Turn all console logging on or off (errors will be thrown)", "This should ONLY be set via Plotly.setPlotConfig", "Available levels:", "0: no logs", "1: warnings and errors, but not informational messages", "2: verbose logs" ].join(" ") }, notifyOnLogging: { valType: "integer", min: 0, max: 2, dflt: 0, description: [ "Set on-graph logging (notifier) level", "This should ONLY be set via Plotly.setPlotConfig", "Available levels:", "0: no on-graph logs", "1: warnings and errors, but not informational messages", "2: verbose logs" ].join(" ") }, queueLength: { valType: "integer", min: 0, dflt: 0, description: "Sets the length of the undo/redo queue." }, globalTransforms: { valType: "any", dflt: [], description: [ "Set global transform to be applied to all traces with no", "specification needed" ].join(" ") }, locale: { valType: "string", dflt: "en-US", description: [ "Which localization should we use?", "Should be a string like 'en' or 'en-US'." ].join(" ") }, locales: { valType: "any", dflt: {}, description: [ "Localization definitions", "Locales can be provided either here (specific to one chart) or globally", "by registering them as modules.", "Should be an object of objects {locale: {dictionary: {...}, format: {...}}}", "{", " da: {", " dictionary: {'Reset axes': 'Nulstil aksler', ...},", " format: {months: [...], shortMonths: [...]}", " },", " ...", "}", "All parts are optional. When looking for translation or format fields, we", "look first for an exact match in a config locale, then in a registered", "module. If those fail, we strip off any regionalization ('en-US' -> 'en')", "and try each (config, registry) again. The final fallback for translation", "is untranslated (which is US English) and for formats is the base English", "(the only consequence being the last fallback date format %x is DD/MM/YYYY", "instead of MM/DD/YYYY). Currently `grouping` and `currency` are ignored", "for our automatic number formatting, but can be used in custom formats." ].join(" ") } }; var dfltConfig = {}; function crawl(src, target) { for (var k in src) { var obj = src[k]; if (obj.valType) { target[k] = obj.dflt; } else { if (!target[k]) { target[k] = {}; } crawl(obj, target[k]); } } } crawl(configAttributes, dfltConfig); module2.exports = { configAttributes, dfltConfig }; } }); // node_modules/plotly.js/src/lib/notifier.js var require_notifier = __commonJS({ "node_modules/plotly.js/src/lib/notifier.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var NOTEDATA = []; module2.exports = function(text, displayLength) { if (NOTEDATA.indexOf(text) !== -1) return; NOTEDATA.push(text); var ts2 = 1e3; if (isNumeric(displayLength)) ts2 = displayLength; else if (displayLength === "long") ts2 = 3e3; var notifierContainer = d3.select("body").selectAll(".plotly-notifier").data([0]); notifierContainer.enter().append("div").classed("plotly-notifier", true); var notes = notifierContainer.selectAll(".notifier-note").data(NOTEDATA); function killNote(transition) { transition.duration(700).style("opacity", 0).each("end", function(thisText) { var thisIndex = NOTEDATA.indexOf(thisText); if (thisIndex !== -1) NOTEDATA.splice(thisIndex, 1); d3.select(this).remove(); }); } notes.enter().append("div").classed("notifier-note", true).style("opacity", 0).each(function(thisText) { var note = d3.select(this); note.append("button").classed("notifier-close", true).html("×").on("click", function() { note.transition().call(killNote); }); var p = note.append("p"); var lines = thisText.split(//g); for (var i = 0; i < lines.length; i++) { if (i) p.append("br"); p.append("span").text(lines[i]); } if (displayLength === "stick") { note.transition().duration(350).style("opacity", 1); } else { note.transition().duration(700).style("opacity", 1).transition().delay(ts2).call(killNote); } }); }; } }); // node_modules/plotly.js/src/lib/loggers.js var require_loggers = __commonJS({ "node_modules/plotly.js/src/lib/loggers.js"(exports2, module2) { "use strict"; var dfltConfig = require_plot_config().dfltConfig; var notifier = require_notifier(); var loggers = module2.exports = {}; loggers.log = function() { var i; if (dfltConfig.logging > 1) { var messages = ["LOG:"]; for (i = 0; i < arguments.length; i++) { messages.push(arguments[i]); } console.trace.apply(console, messages); } if (dfltConfig.notifyOnLogging > 1) { var lines = []; for (i = 0; i < arguments.length; i++) { lines.push(arguments[i]); } notifier(lines.join("
"), "long"); } }; loggers.warn = function() { var i; if (dfltConfig.logging > 0) { var messages = ["WARN:"]; for (i = 0; i < arguments.length; i++) { messages.push(arguments[i]); } console.trace.apply(console, messages); } if (dfltConfig.notifyOnLogging > 0) { var lines = []; for (i = 0; i < arguments.length; i++) { lines.push(arguments[i]); } notifier(lines.join("
"), "stick"); } }; loggers.error = function() { var i; if (dfltConfig.logging > 0) { var messages = ["ERROR:"]; for (i = 0; i < arguments.length; i++) { messages.push(arguments[i]); } console.error.apply(console, messages); } if (dfltConfig.notifyOnLogging > 0) { var lines = []; for (i = 0; i < arguments.length; i++) { lines.push(arguments[i]); } notifier(lines.join("
"), "stick"); } }; } }); // node_modules/plotly.js/src/lib/noop.js var require_noop = __commonJS({ "node_modules/plotly.js/src/lib/noop.js"(exports2, module2) { "use strict"; module2.exports = function noop() { }; } }); // node_modules/plotly.js/src/lib/push_unique.js var require_push_unique = __commonJS({ "node_modules/plotly.js/src/lib/push_unique.js"(exports2, module2) { "use strict"; module2.exports = function pushUnique(array, item) { if (item instanceof RegExp) { var itemStr = item.toString(); for (var i = 0; i < array.length; i++) { if (array[i] instanceof RegExp && array[i].toString() === itemStr) { return array; } } array.push(item); } else if ((item || item === 0) && array.indexOf(item) === -1) array.push(item); return array; }; } }); // node_modules/gl-mat4/create.js var require_create = __commonJS({ "node_modules/gl-mat4/create.js"(exports2, module2) { module2.exports = create; function create() { var out = new Float32Array(16); out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/clone.js var require_clone = __commonJS({ "node_modules/gl-mat4/clone.js"(exports2, module2) { module2.exports = clone; function clone(a) { var out = new Float32Array(16); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } } }); // node_modules/gl-mat4/copy.js var require_copy = __commonJS({ "node_modules/gl-mat4/copy.js"(exports2, module2) { module2.exports = copy; function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } } }); // node_modules/gl-mat4/identity.js var require_identity = __commonJS({ "node_modules/gl-mat4/identity.js"(exports2, module2) { module2.exports = identity; function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/transpose.js var require_transpose = __commonJS({ "node_modules/gl-mat4/transpose.js"(exports2, module2) { module2.exports = transpose; function transpose(out, a) { if (out === a) { var a01 = a[1], a02 = a[2], a03 = a[3], a12 = a[6], a13 = a[7], a23 = a[11]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a01; out[6] = a[9]; out[7] = a[13]; out[8] = a02; out[9] = a12; out[11] = a[14]; out[12] = a03; out[13] = a13; out[14] = a23; } else { out[0] = a[0]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a[1]; out[5] = a[5]; out[6] = a[9]; out[7] = a[13]; out[8] = a[2]; out[9] = a[6]; out[10] = a[10]; out[11] = a[14]; out[12] = a[3]; out[13] = a[7]; out[14] = a[11]; out[15] = a[15]; } return out; } } }); // node_modules/gl-mat4/invert.js var require_invert = __commonJS({ "node_modules/gl-mat4/invert.js"(exports2, module2) { module2.exports = invert; function invert(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32, det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) { return null; } det = 1 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; } } }); // node_modules/gl-mat4/adjoint.js var require_adjoint = __commonJS({ "node_modules/gl-mat4/adjoint.js"(exports2, module2) { module2.exports = adjoint; function adjoint(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); return out; } } }); // node_modules/gl-mat4/determinant.js var require_determinant = __commonJS({ "node_modules/gl-mat4/determinant.js"(exports2, module2) { module2.exports = determinant; function determinant(a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32; return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; } } }); // node_modules/gl-mat4/multiply.js var require_multiply = __commonJS({ "node_modules/gl-mat4/multiply.js"(exports2, module2) { module2.exports = multiply; function multiply(out, a, b) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; var b02 = b[0], b12 = b[1], b2 = b[2], b3 = b[3]; out[0] = b02 * a00 + b12 * a10 + b2 * a20 + b3 * a30; out[1] = b02 * a01 + b12 * a11 + b2 * a21 + b3 * a31; out[2] = b02 * a02 + b12 * a12 + b2 * a22 + b3 * a32; out[3] = b02 * a03 + b12 * a13 + b2 * a23 + b3 * a33; b02 = b[4]; b12 = b[5]; b2 = b[6]; b3 = b[7]; out[4] = b02 * a00 + b12 * a10 + b2 * a20 + b3 * a30; out[5] = b02 * a01 + b12 * a11 + b2 * a21 + b3 * a31; out[6] = b02 * a02 + b12 * a12 + b2 * a22 + b3 * a32; out[7] = b02 * a03 + b12 * a13 + b2 * a23 + b3 * a33; b02 = b[8]; b12 = b[9]; b2 = b[10]; b3 = b[11]; out[8] = b02 * a00 + b12 * a10 + b2 * a20 + b3 * a30; out[9] = b02 * a01 + b12 * a11 + b2 * a21 + b3 * a31; out[10] = b02 * a02 + b12 * a12 + b2 * a22 + b3 * a32; out[11] = b02 * a03 + b12 * a13 + b2 * a23 + b3 * a33; b02 = b[12]; b12 = b[13]; b2 = b[14]; b3 = b[15]; out[12] = b02 * a00 + b12 * a10 + b2 * a20 + b3 * a30; out[13] = b02 * a01 + b12 * a11 + b2 * a21 + b3 * a31; out[14] = b02 * a02 + b12 * a12 + b2 * a22 + b3 * a32; out[15] = b02 * a03 + b12 * a13 + b2 * a23 + b3 * a33; return out; } } }); // node_modules/gl-mat4/translate.js var require_translate = __commonJS({ "node_modules/gl-mat4/translate.js"(exports2, module2) { module2.exports = translate; function translate(out, a, v) { var x = v[0], y = v[1], z = v[2], a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23; if (a === out) { out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; } else { a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; out[12] = a00 * x + a10 * y + a20 * z + a[12]; out[13] = a01 * x + a11 * y + a21 * z + a[13]; out[14] = a02 * x + a12 * y + a22 * z + a[14]; out[15] = a03 * x + a13 * y + a23 * z + a[15]; } return out; } } }); // node_modules/gl-mat4/scale.js var require_scale = __commonJS({ "node_modules/gl-mat4/scale.js"(exports2, module2) { module2.exports = scale; function scale(out, a, v) { var x = v[0], y = v[1], z = v[2]; out[0] = a[0] * x; out[1] = a[1] * x; out[2] = a[2] * x; out[3] = a[3] * x; out[4] = a[4] * y; out[5] = a[5] * y; out[6] = a[6] * y; out[7] = a[7] * y; out[8] = a[8] * z; out[9] = a[9] * z; out[10] = a[10] * z; out[11] = a[11] * z; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; } } }); // node_modules/gl-mat4/rotate.js var require_rotate = __commonJS({ "node_modules/gl-mat4/rotate.js"(exports2, module2) { module2.exports = rotate; function rotate(out, a, rad, axis) { var x = axis[0], y = axis[1], z = axis[2], len = Math.sqrt(x * x + y * y + z * z), s, c, t, a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, b00, b01, b02, b10, b11, b12, b20, b21, b22; if (Math.abs(len) < 1e-6) { return null; } len = 1 / len; x *= len; y *= len; z *= len; s = Math.sin(rad); c = Math.cos(rad); t = 1 - c; a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; out[0] = a00 * b00 + a10 * b01 + a20 * b02; out[1] = a01 * b00 + a11 * b01 + a21 * b02; out[2] = a02 * b00 + a12 * b01 + a22 * b02; out[3] = a03 * b00 + a13 * b01 + a23 * b02; out[4] = a00 * b10 + a10 * b11 + a20 * b12; out[5] = a01 * b10 + a11 * b11 + a21 * b12; out[6] = a02 * b10 + a12 * b11 + a22 * b12; out[7] = a03 * b10 + a13 * b11 + a23 * b12; out[8] = a00 * b20 + a10 * b21 + a20 * b22; out[9] = a01 * b20 + a11 * b21 + a21 * b22; out[10] = a02 * b20 + a12 * b21 + a22 * b22; out[11] = a03 * b20 + a13 * b21 + a23 * b22; if (a !== out) { out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } return out; } } }); // node_modules/gl-mat4/rotateX.js var require_rotateX = __commonJS({ "node_modules/gl-mat4/rotateX.js"(exports2, module2) { module2.exports = rotateX; function rotateX(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; if (a !== out) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } out[4] = a10 * c + a20 * s; out[5] = a11 * c + a21 * s; out[6] = a12 * c + a22 * s; out[7] = a13 * c + a23 * s; out[8] = a20 * c - a10 * s; out[9] = a21 * c - a11 * s; out[10] = a22 * c - a12 * s; out[11] = a23 * c - a13 * s; return out; } } }); // node_modules/gl-mat4/rotateY.js var require_rotateY = __commonJS({ "node_modules/gl-mat4/rotateY.js"(exports2, module2) { module2.exports = rotateY; function rotateY(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; if (a !== out) { out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } out[0] = a00 * c - a20 * s; out[1] = a01 * c - a21 * s; out[2] = a02 * c - a22 * s; out[3] = a03 * c - a23 * s; out[8] = a00 * s + a20 * c; out[9] = a01 * s + a21 * c; out[10] = a02 * s + a22 * c; out[11] = a03 * s + a23 * c; return out; } } }); // node_modules/gl-mat4/rotateZ.js var require_rotateZ = __commonJS({ "node_modules/gl-mat4/rotateZ.js"(exports2, module2) { module2.exports = rotateZ; function rotateZ(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; if (a !== out) { out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } out[0] = a00 * c + a10 * s; out[1] = a01 * c + a11 * s; out[2] = a02 * c + a12 * s; out[3] = a03 * c + a13 * s; out[4] = a10 * c - a00 * s; out[5] = a11 * c - a01 * s; out[6] = a12 * c - a02 * s; out[7] = a13 * c - a03 * s; return out; } } }); // node_modules/gl-mat4/fromRotation.js var require_fromRotation = __commonJS({ "node_modules/gl-mat4/fromRotation.js"(exports2, module2) { module2.exports = fromRotation; function fromRotation(out, rad, axis) { var s, c, t; var x = axis[0]; var y = axis[1]; var z = axis[2]; var len = Math.sqrt(x * x + y * y + z * z); if (Math.abs(len) < 1e-6) { return null; } len = 1 / len; x *= len; y *= len; z *= len; s = Math.sin(rad); c = Math.cos(rad); t = 1 - c; out[0] = x * x * t + c; out[1] = y * x * t + z * s; out[2] = z * x * t - y * s; out[3] = 0; out[4] = x * y * t - z * s; out[5] = y * y * t + c; out[6] = z * y * t + x * s; out[7] = 0; out[8] = x * z * t + y * s; out[9] = y * z * t - x * s; out[10] = z * z * t + c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromRotationTranslation.js var require_fromRotationTranslation = __commonJS({ "node_modules/gl-mat4/fromRotationTranslation.js"(exports2, module2) { module2.exports = fromRotationTranslation; function fromRotationTranslation(out, q, v) { var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2; out[0] = 1 - (yy + zz); out[1] = xy + wz; out[2] = xz - wy; out[3] = 0; out[4] = xy - wz; out[5] = 1 - (xx + zz); out[6] = yz + wx; out[7] = 0; out[8] = xz + wy; out[9] = yz - wx; out[10] = 1 - (xx + yy); out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromScaling.js var require_fromScaling = __commonJS({ "node_modules/gl-mat4/fromScaling.js"(exports2, module2) { module2.exports = fromScaling; function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = v[1]; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = v[2]; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromTranslation.js var require_fromTranslation = __commonJS({ "node_modules/gl-mat4/fromTranslation.js"(exports2, module2) { module2.exports = fromTranslation; function fromTranslation(out, v) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromXRotation.js var require_fromXRotation = __commonJS({ "node_modules/gl-mat4/fromXRotation.js"(exports2, module2) { module2.exports = fromXRotation; function fromXRotation(out, rad) { var s = Math.sin(rad), c = Math.cos(rad); out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = c; out[6] = s; out[7] = 0; out[8] = 0; out[9] = -s; out[10] = c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromYRotation.js var require_fromYRotation = __commonJS({ "node_modules/gl-mat4/fromYRotation.js"(exports2, module2) { module2.exports = fromYRotation; function fromYRotation(out, rad) { var s = Math.sin(rad), c = Math.cos(rad); out[0] = c; out[1] = 0; out[2] = -s; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = s; out[9] = 0; out[10] = c; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromZRotation.js var require_fromZRotation = __commonJS({ "node_modules/gl-mat4/fromZRotation.js"(exports2, module2) { module2.exports = fromZRotation; function fromZRotation(out, rad) { var s = Math.sin(rad), c = Math.cos(rad); out[0] = c; out[1] = s; out[2] = 0; out[3] = 0; out[4] = -s; out[5] = c; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/fromQuat.js var require_fromQuat = __commonJS({ "node_modules/gl-mat4/fromQuat.js"(exports2, module2) { module2.exports = fromQuat; function fromQuat(out, q) { var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, yx = y * x2, yy = y * y2, zx = z * x2, zy = z * y2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2; out[0] = 1 - yy - zz; out[1] = yx + wz; out[2] = zx - wy; out[3] = 0; out[4] = yx - wz; out[5] = 1 - xx - zz; out[6] = zy + wx; out[7] = 0; out[8] = zx + wy; out[9] = zy - wx; out[10] = 1 - xx - yy; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; } } }); // node_modules/gl-mat4/frustum.js var require_frustum = __commonJS({ "node_modules/gl-mat4/frustum.js"(exports2, module2) { module2.exports = frustum; function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left), tb = 1 / (top - bottom), nf2 = 1 / (near - far); out[0] = near * 2 * rl; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = near * 2 * tb; out[6] = 0; out[7] = 0; out[8] = (right + left) * rl; out[9] = (top + bottom) * tb; out[10] = (far + near) * nf2; out[11] = -1; out[12] = 0; out[13] = 0; out[14] = far * near * 2 * nf2; out[15] = 0; return out; } } }); // node_modules/gl-mat4/perspective.js var require_perspective = __commonJS({ "node_modules/gl-mat4/perspective.js"(exports2, module2) { module2.exports = perspective; function perspective(out, fovy, aspect, near, far) { var f = 1 / Math.tan(fovy / 2), nf2 = 1 / (near - far); out[0] = f / aspect; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = f; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = (far + near) * nf2; out[11] = -1; out[12] = 0; out[13] = 0; out[14] = 2 * far * near * nf2; out[15] = 0; return out; } } }); // node_modules/gl-mat4/perspectiveFromFieldOfView.js var require_perspectiveFromFieldOfView = __commonJS({ "node_modules/gl-mat4/perspectiveFromFieldOfView.js"(exports2, module2) { module2.exports = perspectiveFromFieldOfView; function perspectiveFromFieldOfView(out, fov, near, far) { var upTan = Math.tan(fov.upDegrees * Math.PI / 180), downTan = Math.tan(fov.downDegrees * Math.PI / 180), leftTan = Math.tan(fov.leftDegrees * Math.PI / 180), rightTan = Math.tan(fov.rightDegrees * Math.PI / 180), xScale = 2 / (leftTan + rightTan), yScale = 2 / (upTan + downTan); out[0] = xScale; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = yScale; out[6] = 0; out[7] = 0; out[8] = -((leftTan - rightTan) * xScale * 0.5); out[9] = (upTan - downTan) * yScale * 0.5; out[10] = far / (near - far); out[11] = -1; out[12] = 0; out[13] = 0; out[14] = far * near / (near - far); out[15] = 0; return out; } } }); // node_modules/gl-mat4/ortho.js var require_ortho = __commonJS({ "node_modules/gl-mat4/ortho.js"(exports2, module2) { module2.exports = ortho; function ortho(out, left, right, bottom, top, near, far) { var lr = 1 / (left - right), bt = 1 / (bottom - top), nf2 = 1 / (near - far); out[0] = -2 * lr; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = -2 * bt; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 2 * nf2; out[11] = 0; out[12] = (left + right) * lr; out[13] = (top + bottom) * bt; out[14] = (far + near) * nf2; out[15] = 1; return out; } } }); // node_modules/gl-mat4/lookAt.js var require_lookAt = __commonJS({ "node_modules/gl-mat4/lookAt.js"(exports2, module2) { var identity = require_identity(); module2.exports = lookAt; function lookAt(out, eye, center, up2) { var x02, x12, x2, y02, y12, y2, z02, z1, z2, len, eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up2[0], upy = up2[1], upz = up2[2], centerx = center[0], centery = center[1], centerz = center[2]; if (Math.abs(eyex - centerx) < 1e-6 && Math.abs(eyey - centery) < 1e-6 && Math.abs(eyez - centerz) < 1e-6) { return identity(out); } z02 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; len = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); z02 *= len; z1 *= len; z2 *= len; x02 = upy * z2 - upz * z1; x12 = upz * z02 - upx * z2; x2 = upx * z1 - upy * z02; len = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); if (!len) { x02 = 0; x12 = 0; x2 = 0; } else { len = 1 / len; x02 *= len; x12 *= len; x2 *= len; } y02 = z1 * x2 - z2 * x12; y12 = z2 * x02 - z02 * x2; y2 = z02 * x12 - z1 * x02; len = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); if (!len) { y02 = 0; y12 = 0; y2 = 0; } else { len = 1 / len; y02 *= len; y12 *= len; y2 *= len; } out[0] = x02; out[1] = y02; out[2] = z02; out[3] = 0; out[4] = x12; out[5] = y12; out[6] = z1; out[7] = 0; out[8] = x2; out[9] = y2; out[10] = z2; out[11] = 0; out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); out[15] = 1; return out; } } }); // node_modules/gl-mat4/str.js var require_str = __commonJS({ "node_modules/gl-mat4/str.js"(exports2, module2) { module2.exports = str; function str(a) { return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; } } }); // node_modules/gl-mat4/index.js var require_gl_mat4 = __commonJS({ "node_modules/gl-mat4/index.js"(exports2, module2) { module2.exports = { create: require_create(), clone: require_clone(), copy: require_copy(), identity: require_identity(), transpose: require_transpose(), invert: require_invert(), adjoint: require_adjoint(), determinant: require_determinant(), multiply: require_multiply(), translate: require_translate(), scale: require_scale(), rotate: require_rotate(), rotateX: require_rotateX(), rotateY: require_rotateY(), rotateZ: require_rotateZ(), fromRotation: require_fromRotation(), fromRotationTranslation: require_fromRotationTranslation(), fromScaling: require_fromScaling(), fromTranslation: require_fromTranslation(), fromXRotation: require_fromXRotation(), fromYRotation: require_fromYRotation(), fromZRotation: require_fromZRotation(), fromQuat: require_fromQuat(), frustum: require_frustum(), perspective: require_perspective(), perspectiveFromFieldOfView: require_perspectiveFromFieldOfView(), ortho: require_ortho(), lookAt: require_lookAt(), str: require_str() }; } }); // node_modules/plotly.js/src/lib/matrix.js var require_matrix = __commonJS({ "node_modules/plotly.js/src/lib/matrix.js"(exports2) { "use strict"; var mat4X4 = require_gl_mat4(); exports2.init2dArray = function(rowLength, colLength) { var array = new Array(rowLength); for (var i = 0; i < rowLength; i++) array[i] = new Array(colLength); return array; }; exports2.transposeRagged = function(z) { var maxlen = 0; var zlen = z.length; var i, j; for (i = 0; i < zlen; i++) maxlen = Math.max(maxlen, z[i].length); var t = new Array(maxlen); for (i = 0; i < maxlen; i++) { t[i] = new Array(zlen); for (j = 0; j < zlen; j++) t[i][j] = z[j][i]; } return t; }; exports2.dot = function(x, y) { if (!(x.length && y.length) || x.length !== y.length) return null; var len = x.length; var out; var i; if (x[0].length) { out = new Array(len); for (i = 0; i < len; i++) out[i] = exports2.dot(x[i], y); } else if (y[0].length) { var yTranspose = exports2.transposeRagged(y); out = new Array(yTranspose.length); for (i = 0; i < yTranspose.length; i++) out[i] = exports2.dot(x, yTranspose[i]); } else { out = 0; for (i = 0; i < len; i++) out += x[i] * y[i]; } return out; }; exports2.translationMatrix = function(x, y) { return [[1, 0, x], [0, 1, y], [0, 0, 1]]; }; exports2.rotationMatrix = function(alpha) { var a = alpha * Math.PI / 180; return [ [Math.cos(a), -Math.sin(a), 0], [Math.sin(a), Math.cos(a), 0], [0, 0, 1] ]; }; exports2.rotationXYMatrix = function(a, x, y) { return exports2.dot( exports2.dot( exports2.translationMatrix(x, y), exports2.rotationMatrix(a) ), exports2.translationMatrix(-x, -y) ); }; exports2.apply3DTransform = function(transform) { return function() { var args = arguments; var xyz = arguments.length === 1 ? args[0] : [args[0], args[1], args[2] || 0]; return exports2.dot(transform, [xyz[0], xyz[1], xyz[2], 1]).slice(0, 3); }; }; exports2.apply2DTransform = function(transform) { return function() { var args = arguments; if (args.length === 3) { args = args[0]; } var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports2.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; }; exports2.apply2DTransform2 = function(transform) { var at2 = exports2.apply2DTransform(transform); return function(xys) { return at2(xys.slice(0, 2)).concat(at2(xys.slice(2, 4))); }; }; exports2.convertCssMatrix = function(m) { if (m) { var len = m.length; if (len === 16) return m; if (len === 6) { return [ m[0], m[1], 0, 0, m[2], m[3], 0, 0, 0, 0, 1, 0, m[4], m[5], 0, 1 ]; } } return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; }; exports2.inverseTransformMatrix = function(m) { var out = []; mat4X4.invert(out, m); return [ [out[0], out[1], out[2], out[3]], [out[4], out[5], out[6], out[7]], [out[8], out[9], out[10], out[11]], [out[12], out[13], out[14], out[15]] ]; }; } }); // node_modules/plotly.js/src/lib/dom.js var require_dom = __commonJS({ "node_modules/plotly.js/src/lib/dom.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var loggers = require_loggers(); var matrix = require_matrix(); var mat4X4 = require_gl_mat4(); function getGraphDiv(gd2) { var gdElement; if (typeof gd2 === "string") { gdElement = document.getElementById(gd2); if (gdElement === null) { throw new Error("No DOM element with id '" + gd2 + "' exists on the page."); } return gdElement; } else if (gd2 === null || gd2 === void 0) { throw new Error("DOM element provided is null or undefined"); } return gd2; } function isPlotDiv(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && el3.size() && el3.classed("js-plotly-plot"); } function removeElement(el) { var elParent = el && el.parentNode; if (elParent) elParent.removeChild(el); } function addStyleRule(selector, styleString) { addRelatedStyleRule("global", selector, styleString); } function addRelatedStyleRule(uid, selector, styleString) { var id2 = "plotly.js-style-" + uid; var style = document.getElementById(id2); if (!style) { style = document.createElement("style"); style.setAttribute("id", id2); style.appendChild(document.createTextNode("")); document.head.appendChild(style); } var styleSheet = style.sheet; if (styleSheet.insertRule) { styleSheet.insertRule(selector + "{" + styleString + "}", 0); } else if (styleSheet.addRule) { styleSheet.addRule(selector, styleString, 0); } else loggers.warn("addStyleRule failed"); } function deleteRelatedStyleRule(uid) { var id2 = "plotly.js-style-" + uid; var style = document.getElementById(id2); if (style) removeElement(style); } function getFullTransformMatrix(element) { var allElements = getElementAndAncestors(element); var out = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; allElements.forEach(function(e) { var t = getElementTransformMatrix(e); if (t) { var m = matrix.convertCssMatrix(t); out = mat4X4.multiply(out, out, m); } }); return out; } function getElementTransformMatrix(element) { var style = window.getComputedStyle(element, null); var transform = style.getPropertyValue("-webkit-transform") || style.getPropertyValue("-moz-transform") || style.getPropertyValue("-ms-transform") || style.getPropertyValue("-o-transform") || style.getPropertyValue("transform"); if (transform === "none") return null; return transform.replace("matrix", "").replace("3d", "").slice(1, -1).split(",").map(function(n) { return +n; }); } function getElementAndAncestors(element) { var allElements = []; while (isTransformableElement(element)) { allElements.push(element); element = element.parentNode; if (typeof ShadowRoot === "function" && element instanceof ShadowRoot) { element = element.host; } } return allElements; } function isTransformableElement(element) { return element && (element instanceof Element || element instanceof HTMLElement); } function equalDomRects(a, b) { return a && b && a.top === b.top && a.left === b.left && a.right === b.right && a.bottom === b.bottom; } module2.exports = { getGraphDiv, isPlotDiv, removeElement, addStyleRule, addRelatedStyleRule, deleteRelatedStyleRule, getFullTransformMatrix, getElementTransformMatrix, getElementAndAncestors, equalDomRects }; } }); // node_modules/plotly.js/src/plots/animation_attributes.js var require_animation_attributes = __commonJS({ "node_modules/plotly.js/src/plots/animation_attributes.js"(exports2, module2) { "use strict"; module2.exports = { mode: { valType: "enumerated", dflt: "afterall", values: ["immediate", "next", "afterall"], description: [ "Describes how a new animate call interacts with currently-running", "animations. If `immediate`, current animations are interrupted and", "the new animation is started. If `next`, the current frame is allowed", "to complete, after which the new animation is started. If `afterall`", "all existing frames are animated to completion before the new animation", "is started." ].join(" ") }, direction: { valType: "enumerated", values: ["forward", "reverse"], dflt: "forward", description: [ "The direction in which to play the frames triggered by the animation call" ].join(" ") }, fromcurrent: { valType: "boolean", dflt: false, description: [ "Play frames starting at the current frame instead of the beginning." ].join(" ") }, frame: { duration: { valType: "number", min: 0, dflt: 500, description: [ "The duration in milliseconds of each frame. If greater than the frame", "duration, it will be limited to the frame duration." ].join(" ") }, redraw: { valType: "boolean", dflt: true, description: [ "Redraw the plot at completion of the transition. This is desirable", "for transitions that include properties that cannot be transitioned,", "but may significantly slow down updates that do not require a full", "redraw of the plot" ].join(" ") } }, transition: { duration: { valType: "number", min: 0, dflt: 500, editType: "none", description: [ "The duration of the transition, in milliseconds. If equal to zero,", "updates are synchronous." ].join(" ") }, easing: { valType: "enumerated", dflt: "cubic-in-out", values: [ "linear", "quad", "cubic", "sin", "exp", "circle", "elastic", "back", "bounce", "linear-in", "quad-in", "cubic-in", "sin-in", "exp-in", "circle-in", "elastic-in", "back-in", "bounce-in", "linear-out", "quad-out", "cubic-out", "sin-out", "exp-out", "circle-out", "elastic-out", "back-out", "bounce-out", "linear-in-out", "quad-in-out", "cubic-in-out", "sin-in-out", "exp-in-out", "circle-in-out", "elastic-in-out", "back-in-out", "bounce-in-out" ], editType: "none", description: "The easing function used for the transition" }, ordering: { valType: "enumerated", values: ["layout first", "traces first"], dflt: "layout first", editType: "none", description: [ "Determines whether the figure's layout or traces smoothly transitions", "during updates that make both traces and layout change." ].join(" ") } } }; } }); // node_modules/plotly.js/src/plot_api/edit_types.js var require_edit_types = __commonJS({ "node_modules/plotly.js/src/plot_api/edit_types.js"(exports2, module2) { "use strict"; var extendFlat = require_extend().extendFlat; var isPlainObject = require_is_plain_object(); var traceOpts = { valType: "flaglist", extras: ["none"], flags: ["calc", "clearAxisTypes", "plot", "style", "markerSize", "colorbars"], description: [ "trace attributes should include an `editType` string matching this flaglist.", "*calc* is the most extensive: a full (re)plot starting by clearing `gd.calcdata`", "to force it to be regenerated", "*clearAxisTypes* resets the types of the axes this trace is on, because new data could", "cause the automatic axis type detection to change. Log type will not be cleared, as that", "is never automatically chosen so must have been user-specified.", "*plot* (re)plots but without first clearing `gd.calcdata`.", "*style* only calls `module.style` (or module.editStyle) for all trace modules and redraws the legend.", "*markerSize* is like *style*, but propagate axis-range changes due to scatter `marker.size`", "*colorbars* only redraws colorbars." ].join(" ") }; var layoutOpts = { valType: "flaglist", extras: ["none"], flags: [ "calc", "plot", "legend", "ticks", "axrange", "layoutstyle", "modebar", "camera", "arraydraw", "colorbars" ], description: [ "layout attributes should include an `editType` string matching this flaglist.", "*calc* is the most extensive: a full (re)plot starting by clearing `gd.calcdata`", "to force it to be regenerated", "*plot* (re)plots but without first clearing `gd.calcdata`.", "*legend* only redraws the legend.", "*ticks* only redraws axis ticks, labels, and gridlines.", "*axrange* minimal sequence when updating axis ranges.", "*layoutstyle* reapplies global and SVG cartesian axis styles.", "*modebar* just updates the modebar.", "*camera* just updates the camera settings for gl3d scenes.", "*arraydraw* allows component arrays to invoke the redraw routines just for the", "component(s) that changed.", "*colorbars* only redraws colorbars." ].join(" ") }; var traceEditTypeFlags = traceOpts.flags.slice().concat(["fullReplot"]); var layoutEditTypeFlags = layoutOpts.flags.slice().concat("layoutReplot"); module2.exports = { traces: traceOpts, layout: layoutOpts, /* * default (all false) edit flags for restyle (traces) * creates a new object each call, so the caller can mutate freely */ traceFlags: function() { return falseObj(traceEditTypeFlags); }, /* * default (all false) edit flags for relayout * creates a new object each call, so the caller can mutate freely */ layoutFlags: function() { return falseObj(layoutEditTypeFlags); }, /* * update `flags` with the `editType` values found in `attr` */ update: function(flags, attr) { var editType = attr.editType; if (editType && editType !== "none") { var editTypeParts = editType.split("+"); for (var i = 0; i < editTypeParts.length; i++) { flags[editTypeParts[i]] = true; } } }, overrideAll }; function falseObj(keys) { var out = {}; for (var i = 0; i < keys.length; i++) out[keys[i]] = false; return out; } function overrideAll(attrs, editTypeOverride, overrideContainers) { var out = extendFlat({}, attrs); for (var key in out) { var attr = out[key]; if (isPlainObject(attr)) { out[key] = overrideOne(attr, editTypeOverride, overrideContainers, key); } } if (overrideContainers === "from-root") out.editType = editTypeOverride; return out; } function overrideOne(attr, editTypeOverride, overrideContainers, key) { if (attr.valType) { var out = extendFlat({}, attr); out.editType = editTypeOverride; if (Array.isArray(attr.items)) { out.items = new Array(attr.items.length); for (var i = 0; i < attr.items.length; i++) { out.items[i] = overrideOne(attr.items[i], editTypeOverride, "from-root"); } } return out; } else { return overrideAll( attr, editTypeOverride, key.charAt(0) === "_" ? "nested" : "from-root" ); } } } }); // node_modules/plotly.js/src/components/drawing/attributes.js var require_attributes4 = __commonJS({ "node_modules/plotly.js/src/components/drawing/attributes.js"(exports2) { "use strict"; exports2.dash = { valType: "string", // string type usually doesn't take values... this one should really be // a special type or at least a special coercion function, from the GUI // you only get these values but elsewhere the user can supply a list of // dash lengths in px, and it will be honored values: ["solid", "dot", "dash", "longdash", "dashdot", "longdashdot"], dflt: "solid", editType: "style", description: [ "Sets the dash style of lines. Set to a dash type string", "(*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*)", "or a dash length list in px (eg *5px,10px,2px,2px*)." ].join(" ") }; exports2.pattern = { shape: { valType: "enumerated", values: ["", "/", "\\", "x", "-", "|", "+", "."], dflt: "", arrayOk: true, editType: "style", description: [ "Sets the shape of the pattern fill.", "By default, no pattern is used for filling the area." ].join(" ") }, fillmode: { valType: "enumerated", values: ["replace", "overlay"], dflt: "replace", editType: "style", description: [ "Determines whether `marker.color` should be used", "as a default to `bgcolor` or a `fgcolor`." ].join(" ") }, bgcolor: { valType: "color", arrayOk: true, editType: "style", description: [ "When there is no colorscale sets the color of background pattern fill.", "Defaults to a `marker.color` background when `fillmode` is *overlay*.", "Otherwise, defaults to a transparent background." ].join(" ") }, fgcolor: { valType: "color", arrayOk: true, editType: "style", description: [ "When there is no colorscale sets the color of foreground pattern fill.", "Defaults to a `marker.color` background when `fillmode` is *replace*.", "Otherwise, defaults to dark grey or white", "to increase contrast with the `bgcolor`." ].join(" ") }, fgopacity: { valType: "number", editType: "style", min: 0, max: 1, description: [ "Sets the opacity of the foreground pattern fill.", "Defaults to a 0.5 when `fillmode` is *overlay*.", "Otherwise, defaults to 1." ].join(" ") }, size: { valType: "number", min: 0, dflt: 8, arrayOk: true, editType: "style", description: [ "Sets the size of unit squares of the pattern fill in pixels,", "which corresponds to the interval of repetition of the pattern." ].join(" ") }, solidity: { valType: "number", min: 0, max: 1, dflt: 0.3, arrayOk: true, editType: "style", description: [ "Sets the solidity of the pattern fill.", "Solidity is roughly the fraction of the area filled by the pattern.", "Solidity of 0 shows only the background color without pattern", "and solidty of 1 shows only the foreground color without pattern." ].join(" ") }, editType: "style", description: [ "Sets the pattern within the marker." ].join(" ") }; } }); // node_modules/plotly.js/src/constants/docs.js var require_docs = __commonJS({ "node_modules/plotly.js/src/constants/docs.js"(exports2, module2) { "use strict"; module2.exports = { FORMAT_LINK: "https://github.com/d3/d3-format/tree/v1.4.5#d3-format", DATE_FORMAT_LINK: "https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format" }; } }); // node_modules/plotly.js/src/plots/template_attributes.js var require_template_attributes = __commonJS({ "node_modules/plotly.js/src/plots/template_attributes.js"(exports2) { "use strict"; var docs = require_docs(); var FORMAT_LINK = docs.FORMAT_LINK; var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; function templateFormatStringDescription(opts) { var supportOther = opts && opts.supportOther; return [ "Variables are inserted using %{variable},", 'for example "y: %{y}"' + (supportOther ? " as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown." : "."), `Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}".`, FORMAT_LINK, "for details on the formatting syntax.", `Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}".`, DATE_FORMAT_LINK, "for details on the date formatting syntax." ].join(" "); } function shapeTemplateFormatStringDescription() { return [ "Variables are inserted using %{variable},", 'for example "x0: %{x0}".', `Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{x0:$.2f}". See`, FORMAT_LINK, "for details on the formatting syntax.", `Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{x0|%m %b %Y}". See`, DATE_FORMAT_LINK, "for details on the date formatting syntax.", "A single multiplication or division operation may be applied to numeric variables, and combined with", 'd3 number formatting, for example "Length in cm: %{x0*2.54}", "%{slope*60:.1f} meters per second."', "For log axes, variable values are given in log units.", "For date axes, x/y coordinate variables and center variables use datetimes, while all other variable values use values in ms." ].join(" "); } function describeVariables(extra) { var descPart = extra.description ? " " + extra.description : ""; var keys = extra.keys || []; if (keys.length > 0) { var quotedKeys = []; for (var i = 0; i < keys.length; i++) { quotedKeys[i] = "`" + keys[i] + "`"; } descPart = descPart + "Finally, the template string has access to "; if (keys.length === 1) { descPart = descPart + "variable " + quotedKeys[0]; } else { descPart = descPart + "variables " + quotedKeys.slice(0, -1).join(", ") + " and " + quotedKeys.slice(-1) + "."; } } return descPart; } exports2.hovertemplateAttrs = function(opts, extra) { opts = opts || {}; extra = extra || {}; var descPart = describeVariables(extra); var hovertemplate = { valType: "string", dflt: "", editType: opts.editType || "none", description: [ "Template string used for rendering the information that appear on hover box.", "Note that this will override `hoverinfo`.", templateFormatStringDescription({ supportOther: true }), "The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data.", "Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.", descPart, 'Anything contained in tag `` is displayed in the secondary box, for example "{fullData.name}".', "To hide the secondary box completely, use an empty tag ``." ].join(" ") }; if (opts.arrayOk !== false) { hovertemplate.arrayOk = true; } return hovertemplate; }; exports2.texttemplateAttrs = function(opts, extra) { opts = opts || {}; extra = extra || {}; var descPart = describeVariables(extra); var texttemplate = { valType: "string", dflt: "", editType: opts.editType || "calc", description: [ "Template string used for rendering the information text that appear on points.", "Note that this will override `textinfo`.", templateFormatStringDescription(), "Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.", descPart ].join(" ") }; if (opts.arrayOk !== false) { texttemplate.arrayOk = true; } return texttemplate; }; exports2.shapeTexttemplateAttrs = function(opts, extra) { opts = opts || {}; extra = extra || {}; var newStr = opts.newshape ? "new " : ""; var descPart = describeVariables(extra); var texttemplate = { valType: "string", dflt: "", editType: opts.editType || "arraydraw", description: [ "Template string used for rendering the " + newStr + "shape's label.", "Note that this will override `text`.", shapeTemplateFormatStringDescription(), descPart ].join(" ") }; return texttemplate; }; } }); // node_modules/plotly.js/src/components/shapes/label_texttemplate.js var require_label_texttemplate = __commonJS({ "node_modules/plotly.js/src/components/shapes/label_texttemplate.js"(exports2, module2) { "use strict"; function d2l(v, axis) { return axis ? axis.d2l(v) : v; } function l2d(v, axis) { return axis ? axis.l2d(v) : v; } function x0Fn(shape) { return shape.x0; } function x1Fn(shape) { return shape.x1; } function y0Fn(shape) { return shape.y0; } function y1Fn(shape) { return shape.y1; } function x0shiftFn(shape) { return shape.x0shift || 0; } function x1shiftFn(shape) { return shape.x1shift || 0; } function y0shiftFn(shape) { return shape.y0shift || 0; } function y1shiftFn(shape) { return shape.y1shift || 0; } function dxFn(shape, xa2) { return d2l(shape.x1, xa2) + x1shiftFn(shape) - d2l(shape.x0, xa2) - x0shiftFn(shape); } function dyFn(shape, xa2, ya2) { return d2l(shape.y1, ya2) + y1shiftFn(shape) - d2l(shape.y0, ya2) - y0shiftFn(shape); } function widthFn(shape, xa2) { return Math.abs(dxFn(shape, xa2)); } function heightFn(shape, xa2, ya2) { return Math.abs(dyFn(shape, xa2, ya2)); } function lengthFn(shape, xa2, ya2) { return shape.type !== "line" ? void 0 : Math.sqrt( Math.pow(dxFn(shape, xa2), 2) + Math.pow(dyFn(shape, xa2, ya2), 2) ); } function xcenterFn(shape, xa2) { return l2d((d2l(shape.x1, xa2) + x1shiftFn(shape) + d2l(shape.x0, xa2) + x0shiftFn(shape)) / 2, xa2); } function ycenterFn(shape, xa2, ya2) { return l2d((d2l(shape.y1, ya2) + y1shiftFn(shape) + d2l(shape.y0, ya2) + y0shiftFn(shape)) / 2, ya2); } function slopeFn(shape, xa2, ya2) { return shape.type !== "line" ? void 0 : dyFn(shape, xa2, ya2) / dxFn(shape, xa2); } module2.exports = { x0: x0Fn, x1: x1Fn, y0: y0Fn, y1: y1Fn, slope: slopeFn, dx: dxFn, dy: dyFn, width: widthFn, height: heightFn, length: lengthFn, xcenter: xcenterFn, ycenter: ycenterFn }; } }); // node_modules/plotly.js/src/components/shapes/draw_newshape/attributes.js var require_attributes5 = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw_newshape/attributes.js"(exports2, module2) { "use strict"; var overrideAll = require_edit_types().overrideAll; var basePlotAttributes = require_attributes2(); var fontAttrs = require_font_attributes(); var dash = require_attributes4().dash; var extendFlat = require_extend().extendFlat; var shapeTexttemplateAttrs = require_template_attributes().shapeTexttemplateAttrs; var shapeLabelTexttemplateVars = require_label_texttemplate(); module2.exports = overrideAll({ newshape: { visible: extendFlat({}, basePlotAttributes.visible, { description: [ "Determines whether or not new shape is visible.", "If *legendonly*, the shape is not drawn,", "but can appear as a legend item", "(provided that the legend itself is visible)." ].join(" ") }), showlegend: { valType: "boolean", dflt: false, description: [ "Determines whether or not new", "shape is shown in the legend." ].join(" ") }, legend: extendFlat({}, basePlotAttributes.legend, { description: [ "Sets the reference to a legend to show new shape in.", "References to these legends are *legend*, *legend2*, *legend3*, etc.", "Settings for these legends are set in the layout, under", "`layout.legend`, `layout.legend2`, etc." ].join(" ") }), legendgroup: extendFlat({}, basePlotAttributes.legendgroup, { description: [ "Sets the legend group for new shape.", "Traces and shapes part of the same legend group hide/show at the same time", "when toggling legend items." ].join(" ") }), legendgrouptitle: { text: extendFlat({}, basePlotAttributes.legendgrouptitle.text, {}), font: fontAttrs({ description: [ "Sets this legend group's title font." ].join(" ") }) }, legendrank: extendFlat({}, basePlotAttributes.legendrank, { description: [ "Sets the legend rank for new shape.", "Items and groups with smaller ranks are presented on top/left side while", "with *reversed* `legend.traceorder` they are on bottom/right side.", "The default legendrank is 1000,", "so that you can use ranks less than 1000 to place certain items before all unranked items,", "and ranks greater than 1000 to go after all unranked items." ].join(" ") }), legendwidth: extendFlat({}, basePlotAttributes.legendwidth, { description: "Sets the width (in px or fraction) of the legend for new shape." }), line: { color: { valType: "color", description: [ "Sets the line color.", "By default uses either dark grey or white", "to increase contrast with background color." ].join(" ") }, width: { valType: "number", min: 0, dflt: 4, description: "Sets the line width (in px)." }, dash: extendFlat({}, dash, { dflt: "solid" }) }, fillcolor: { valType: "color", dflt: "rgba(0,0,0,0)", description: [ "Sets the color filling new shapes' interior.", "Please note that if using a fillcolor with alpha greater than half,", "drag inside the active shape starts moving the shape underneath,", "otherwise a new shape could be started over." ].join(" ") }, fillrule: { valType: "enumerated", values: ["evenodd", "nonzero"], dflt: "evenodd", description: [ "Determines the path's interior.", "For more info please visit https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule" ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, description: "Sets the opacity of new shapes." }, layer: { valType: "enumerated", values: ["below", "above", "between"], dflt: "above", description: [ "Specifies whether new shapes are drawn below gridlines (*below*),", "between gridlines and traces (*between*) or above traces (*above*)." ].join(" ") }, drawdirection: { valType: "enumerated", values: ["ortho", "horizontal", "vertical", "diagonal"], dflt: "diagonal", description: [ "When `dragmode` is set to *drawrect*, *drawline* or *drawcircle*", "this limits the drag to be horizontal, vertical or diagonal.", "Using *diagonal* there is no limit e.g. in drawing lines in any direction.", "*ortho* limits the draw to be either horizontal or vertical.", "*horizontal* allows horizontal extend.", "*vertical* allows vertical extend." ].join(" ") }, name: extendFlat({}, basePlotAttributes.name, { description: [ "Sets new shape name.", "The name appears as the legend item." ].join(" ") }), label: { text: { valType: "string", dflt: "", description: [ "Sets the text to display with the new shape.", "It is also used for legend item if `name` is not provided." ].join(" ") }, texttemplate: shapeTexttemplateAttrs({ newshape: true }, { keys: Object.keys(shapeLabelTexttemplateVars) }), font: fontAttrs({ description: "Sets the new shape label text font." }), textposition: { valType: "enumerated", values: [ "top left", "top center", "top right", "middle left", "middle center", "middle right", "bottom left", "bottom center", "bottom right", "start", "middle", "end" ], description: [ "Sets the position of the label text relative to the new shape.", "Supported values for rectangles, circles and paths are", "*top left*, *top center*, *top right*, *middle left*,", "*middle center*, *middle right*, *bottom left*, *bottom center*,", "and *bottom right*.", "Supported values for lines are *start*, *middle*, and *end*.", "Default: *middle center* for rectangles, circles, and paths; *middle* for lines." ].join(" ") }, textangle: { valType: "angle", dflt: "auto", description: [ "Sets the angle at which the label text is drawn", "with respect to the horizontal. For lines, angle *auto*", "is the same angle as the line. For all other shapes,", "angle *auto* is horizontal." ].join(" ") }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "auto", description: [ "Sets the label's horizontal position anchor", "This anchor binds the specified `textposition` to the *left*, *center*", "or *right* of the label text.", "For example, if `textposition` is set to *top right* and", "`xanchor` to *right* then the right-most portion of the", "label text lines up with the right-most edge of the", "new shape." ].join(" ") }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"], description: [ "Sets the label's vertical position anchor", "This anchor binds the specified `textposition` to the *top*, *middle*", "or *bottom* of the label text.", "For example, if `textposition` is set to *top right* and", "`yanchor` to *top* then the top-most portion of the", "label text lines up with the top-most edge of the", "new shape." ].join(" ") }, padding: { valType: "number", dflt: 3, min: 0, description: "Sets padding (in px) between edge of label and edge of new shape." } } }, activeshape: { fillcolor: { valType: "color", dflt: "rgb(255,0,255)", description: "Sets the color filling the active shape' interior." }, opacity: { valType: "number", min: 0, max: 1, dflt: 0.5, description: "Sets the opacity of the active shape." } } }, "none", "from-root"); } }); // node_modules/plotly.js/src/components/selections/draw_newselection/attributes.js var require_attributes6 = __commonJS({ "node_modules/plotly.js/src/components/selections/draw_newselection/attributes.js"(exports2, module2) { "use strict"; var dash = require_attributes4().dash; var extendFlat = require_extend().extendFlat; module2.exports = { newselection: { mode: { valType: "enumerated", values: ["immediate", "gradual"], dflt: "immediate", editType: "none", description: [ "Describes how a new selection is created.", "If `immediate`, a new selection is created after first mouse up.", "If `gradual`, a new selection is not created after first mouse.", "By adding to and subtracting from the initial selection,", "this option allows declaring extra outlines of the selection." ].join(" ") }, line: { color: { valType: "color", editType: "none", description: [ "Sets the line color.", "By default uses either dark grey or white", "to increase contrast with background color." ].join(" ") }, width: { valType: "number", min: 1, dflt: 1, editType: "none", description: "Sets the line width (in px)." }, dash: extendFlat({}, dash, { dflt: "dot", editType: "none" }), editType: "none" }, // no drawdirection here noting that layout.selectdirection is used instead. editType: "none" }, activeselection: { fillcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "none", description: "Sets the color filling the active selection' interior." }, opacity: { valType: "number", min: 0, max: 1, dflt: 0.5, editType: "none", description: "Sets the opacity of the active selection." }, editType: "none" } }; } }); // node_modules/plotly.js/src/plots/pad_attributes.js var require_pad_attributes = __commonJS({ "node_modules/plotly.js/src/plots/pad_attributes.js"(exports2, module2) { "use strict"; module2.exports = function(opts) { var editType = opts.editType; return { t: { valType: "number", dflt: 0, editType, description: "The amount of padding (in px) along the top of the component." }, r: { valType: "number", dflt: 0, editType, description: "The amount of padding (in px) on the right side of the component." }, b: { valType: "number", dflt: 0, editType, description: "The amount of padding (in px) along the bottom of the component." }, l: { valType: "number", dflt: 0, editType, description: "The amount of padding (in px) on the left side of the component." }, editType }; }; } }); // node_modules/plotly.js/src/plots/layout_attributes.js var require_layout_attributes2 = __commonJS({ "node_modules/plotly.js/src/plots/layout_attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var animationAttrs = require_animation_attributes(); var colorAttrs = require_attributes3(); var drawNewShapeAttrs = require_attributes5(); var drawNewSelectionAttrs = require_attributes6(); var padAttrs = require_pad_attributes(); var extendFlat = require_extend().extendFlat; var globalFont = fontAttrs({ editType: "calc", description: [ "Sets the global font.", "Note that fonts used in traces and other", "layout components inherit from the global font." ].join(" ") }); globalFont.family.dflt = '"Open Sans", verdana, arial, sans-serif'; globalFont.size.dflt = 12; globalFont.color.dflt = colorAttrs.defaultLine; module2.exports = { font: globalFont, title: { text: { valType: "string", editType: "layoutstyle", description: [ "Sets the plot's title.", "Note that before the existence of `title.text`, the title's", "contents used to be defined as the `title` attribute itself.", "This behavior has been deprecated." ].join(" ") }, font: fontAttrs({ editType: "layoutstyle", description: [ "Sets the title font.", "Note that the title's font used to be customized", "by the now deprecated `titlefont` attribute." ].join(" ") }), subtitle: { text: { valType: "string", editType: "layoutstyle", description: "Sets the plot's subtitle." }, font: fontAttrs({ editType: "layoutstyle", description: "Sets the subtitle font." }), editType: "layoutstyle" }, xref: { valType: "enumerated", dflt: "container", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `x` refers to.", "*container* spans the entire `width` of the plot.", "*paper* refers to the width of the plotting area only." ].join(" ") }, yref: { valType: "enumerated", dflt: "container", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `y` refers to.", "*container* spans the entire `height` of the plot.", "*paper* refers to the height of the plotting area only." ].join(" ") }, x: { valType: "number", min: 0, max: 1, dflt: 0.5, editType: "layoutstyle", description: [ "Sets the x position with respect to `xref` in normalized", "coordinates from *0* (left) to *1* (right)." ].join(" ") }, y: { valType: "number", min: 0, max: 1, dflt: "auto", editType: "layoutstyle", description: [ "Sets the y position with respect to `yref` in normalized", "coordinates from *0* (bottom) to *1* (top).", "*auto* places the baseline of the title onto the", "vertical center of the top margin." ].join(" ") }, xanchor: { valType: "enumerated", dflt: "auto", values: ["auto", "left", "center", "right"], editType: "layoutstyle", description: [ "Sets the title's horizontal alignment with respect to its x position.", "*left* means that the title starts at x,", "*right* means that the title ends at x", "and *center* means that the title's center is at x.", "*auto* divides `xref` by three and calculates the `xanchor`", "value automatically based on the value of `x`." ].join(" ") }, yanchor: { valType: "enumerated", dflt: "auto", values: ["auto", "top", "middle", "bottom"], editType: "layoutstyle", description: [ "Sets the title's vertical alignment with respect to its y position.", "*top* means that the title's cap line is at y,", "*bottom* means that the title's baseline is at y", "and *middle* means that the title's midline is at y.", "*auto* divides `yref` by three and calculates the `yanchor`", "value automatically based on the value of `y`." ].join(" ") }, pad: extendFlat(padAttrs({ editType: "layoutstyle" }), { description: [ "Sets the padding of the title.", "Each padding value only applies when the corresponding", "`xanchor`/`yanchor` value is set accordingly. E.g. for left", "padding to take effect, `xanchor` must be set to *left*.", "The same rule applies if `xanchor`/`yanchor` is determined automatically.", "Padding is muted if the respective anchor value is *middle*/*center*." ].join(" ") }), automargin: { valType: "boolean", dflt: false, editType: "plot", description: [ "Determines whether the title can automatically push the figure margins.", "If `yref='paper'` then the margin will expand to ensure that the title doesn’t", "overlap with the edges of the container. If `yref='container'` then the margins", "will ensure that the title doesn’t overlap with the plot area, tick labels,", "and axis titles. If `automargin=true` and the margins need to be expanded,", "then y will be set to a default 1 and yanchor will be set to an appropriate", "default to ensure that minimal margin space is needed. Note that when `yref='paper'`,", "only 1 or 0 are allowed y values. Invalid values will be reset to the default 1." ].join(" ") }, editType: "layoutstyle" }, uniformtext: { mode: { valType: "enumerated", values: [false, "hide", "show"], dflt: false, editType: "plot", description: [ "Determines how the font size for various text", "elements are uniformed between each trace type.", "If the computed text sizes were smaller than", "the minimum size defined by `uniformtext.minsize`", "using *hide* option hides the text; and", "using *show* option shows the text without further downscaling.", "Please note that if the size defined by `minsize` is greater than", "the font size defined by trace, then the `minsize` is used." ].join(" ") }, minsize: { valType: "number", min: 0, dflt: 0, editType: "plot", description: [ "Sets the minimum text size between traces of the same type." ].join(" ") }, editType: "plot" }, autosize: { valType: "boolean", dflt: false, // autosize, width, and height get special editType treatment in _relayout // so we can handle noop resizes more efficiently editType: "none", description: [ "Determines whether or not a layout width or height", "that has been left undefined by the user", "is initialized on each relayout.", "Note that, regardless of this attribute,", "an undefined layout width or height", "is always initialized on the first call to plot." ].join(" ") }, width: { valType: "number", min: 10, dflt: 700, editType: "plot", description: [ "Sets the plot's width (in px)." ].join(" ") }, height: { valType: "number", min: 10, dflt: 450, editType: "plot", description: [ "Sets the plot's height (in px)." ].join(" ") }, minreducedwidth: { valType: "number", min: 2, dflt: 64, editType: "plot", description: "Minimum width of the plot with margin.automargin applied (in px)" }, minreducedheight: { valType: "number", min: 2, dflt: 64, editType: "plot", description: "Minimum height of the plot with margin.automargin applied (in px)" }, margin: { l: { valType: "number", min: 0, dflt: 80, editType: "plot", description: "Sets the left margin (in px)." }, r: { valType: "number", min: 0, dflt: 80, editType: "plot", description: "Sets the right margin (in px)." }, t: { valType: "number", min: 0, dflt: 100, editType: "plot", description: "Sets the top margin (in px)." }, b: { valType: "number", min: 0, dflt: 80, editType: "plot", description: "Sets the bottom margin (in px)." }, pad: { valType: "number", min: 0, dflt: 0, editType: "plot", description: [ "Sets the amount of padding (in px)", "between the plotting area and the axis lines" ].join(" ") }, autoexpand: { valType: "boolean", dflt: true, editType: "plot", description: [ "Turns on/off margin expansion computations.", "Legends, colorbars, updatemenus, sliders, axis rangeselector and rangeslider", "are allowed to push the margins by defaults." ].join(" ") }, editType: "plot" }, computed: { valType: "any", editType: "none", description: [ "Placeholder for exporting automargin-impacting values namely", "`margin.t`, `margin.b`, `margin.l` and `margin.r` in *full-json* mode." ].join(" ") }, paper_bgcolor: { valType: "color", dflt: colorAttrs.background, editType: "plot", description: "Sets the background color of the paper where the graph is drawn." }, plot_bgcolor: { // defined here, but set in cartesian.supplyLayoutDefaults // because it needs to know if there are (2D) axes or not valType: "color", dflt: colorAttrs.background, editType: "layoutstyle", description: [ "Sets the background color of the plotting area in-between x and y axes." ].join(" ") }, autotypenumbers: { valType: "enumerated", values: ["convert types", "strict"], dflt: "convert types", editType: "calc", description: [ "Using *strict* a numeric string in trace data is not converted to a number.", "Using *convert types* a numeric string in trace data may be", "treated as a number during automatic axis `type` detection.", "This is the default value; however it could be overridden for individual axes." ].join(" ") }, separators: { valType: "string", editType: "plot", description: [ "Sets the decimal and thousand separators.", "For example, *. * puts a '.' before decimals and a space", "between thousands. In English locales, dflt is *.,* but", "other locales may alter this default." ].join(" ") }, hidesources: { valType: "boolean", dflt: false, editType: "plot", description: [ "Determines whether or not a text link citing the data source is", "placed at the bottom-right cored of the figure.", "Has only an effect only on graphs that have been generated via", "forked graphs from the Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise)." ].join(" ") }, showlegend: { // handled in legend.supplyLayoutDefaults // but included here because it's not in the legend object valType: "boolean", editType: "legend", description: [ "Determines whether or not a legend is drawn.", "Default is `true` if there is a trace to show and any of these:", "a) Two or more traces would by default be shown in the legend.", "b) One pie trace is shown in the legend.", "c) One trace is explicitly given with `showlegend: true`." ].join(" ") }, colorway: { valType: "colorlist", dflt: colorAttrs.defaults, editType: "calc", description: "Sets the default trace colors." }, datarevision: { valType: "any", editType: "calc", description: [ "If provided, a changed value tells `Plotly.react` that", "one or more data arrays has changed. This way you can modify", "arrays in-place rather than making a complete new copy for an", "incremental change.", "If NOT provided, `Plotly.react` assumes that data arrays are", "being treated as immutable, thus any data array with a", "different identity from its predecessor contains new data." ].join(" ") }, uirevision: { valType: "any", editType: "none", description: [ "Used to allow user interactions with the plot to persist after", "`Plotly.react` calls that are unaware of these interactions.", "If `uirevision` is omitted, or if it is given and it changed from", "the previous `Plotly.react` call, the exact new figure is used.", "If `uirevision` is truthy and did NOT change, any attribute", "that has been affected by user interactions and did not receive a", "different value in the new figure will keep the interaction value.", "`layout.uirevision` attribute serves as the default for", "`uirevision` attributes in various sub-containers. For finer", "control you can set these sub-attributes directly. For example,", "if your app separately controls the data on the x and y axes you", "might set `xaxis.uirevision=*time*` and `yaxis.uirevision=*cost*`.", "Then if only the y data is changed, you can update", "`yaxis.uirevision=*quantity*` and the y axis range will reset but", "the x axis range will retain any user-driven zoom." ].join(" ") }, editrevision: { valType: "any", editType: "none", description: [ "Controls persistence of user-driven changes in `editable: true`", "configuration, other than trace names and axis titles.", "Defaults to `layout.uirevision`." ].join(" ") }, selectionrevision: { valType: "any", editType: "none", description: [ "Controls persistence of user-driven changes in selected points", "from all traces." ].join(" ") }, template: { valType: "any", editType: "calc", description: [ "Default attributes to be applied to the plot. Templates can be", "created from existing plots using `Plotly.makeTemplate`, or", "created manually. They should be objects with format:", "`{layout: layoutTemplate, data: {[type]: [traceTemplate, ...]}, ...}`", "`layoutTemplate` and `traceTemplate` are objects matching the", "attribute structure of `layout` and a data trace. ", "Trace templates are applied cyclically to traces of each type.", "Container arrays (eg `annotations`) have special handling:", "An object ending in `defaults` (eg `annotationdefaults`) is applied", "to each array item. But if an item has a `templateitemname` key", "we look in the template array for an item with matching `name` and", "apply that instead. If no matching `name` is found we mark the item", "invisible. Any named template item not referenced is appended to", "the end of the array, so you can use this for a watermark annotation", "or a logo image, for example. To omit one of these items on the plot,", "make an item with matching `templateitemname` and `visible: false`." ].join(" ") }, newshape: drawNewShapeAttrs.newshape, activeshape: drawNewShapeAttrs.activeshape, newselection: drawNewSelectionAttrs.newselection, activeselection: drawNewSelectionAttrs.activeselection, meta: { valType: "any", arrayOk: true, editType: "plot", description: [ "Assigns extra meta information that can be used in various `text` attributes.", "Attributes such as the graph, axis and colorbar `title.text`, annotation `text`", "`trace.name` in legend items, `rangeselector`, `updatemenus` and `sliders` `label` text", "all support `meta`. One can access `meta` fields using template strings:", "`%{meta[i]}` where `i` is the index of the `meta`", "item in question.", "`meta` can also be an object for example `{key: value}` which can be accessed", "%{meta[key]}." ].join(" ") }, transition: extendFlat({}, animationAttrs.transition, { description: [ "Sets transition options used during Plotly.react updates." ].join(" "), editType: "none" }), _deprecated: { title: { valType: "string", editType: "layoutstyle", description: [ "Value of `title` is no longer a simple *string* but a set of sub-attributes.", "To set the contents of the title, please use `title.text` now." ].join(" ") }, titlefont: fontAttrs({ editType: "layoutstyle", description: [ "Former `titlefont` is now the sub-attribute `font` of `title`.", "To customize title font properties, please use `title.font` now." ].join(" ") }) } }; } }); // vite:dep-pre-bundle:external-conversion:/home/cmiss/Jenkins/workspace/mapintegratedvuer/node_modules/maplibre-gl/dist/maplibre-gl.css var maplibre_gl_exports = {}; import "/home/cmiss/Jenkins/workspace/mapintegratedvuer/node_modules/maplibre-gl/dist/maplibre-gl.css"; var init_maplibre_gl = __esm({ "vite:dep-pre-bundle:external-conversion:/home/cmiss/Jenkins/workspace/mapintegratedvuer/node_modules/maplibre-gl/dist/maplibre-gl.css"() { } }); // node_modules/plotly.js/src/registry.js var require_registry = __commonJS({ "node_modules/plotly.js/src/registry.js"(exports2) { "use strict"; var Loggers = require_loggers(); var noop = require_noop(); var pushUnique = require_push_unique(); var isPlainObject = require_is_plain_object(); var addStyleRule = require_dom().addStyleRule; var ExtendModule = require_extend(); var basePlotAttributes = require_attributes2(); var baseLayoutAttributes = require_layout_attributes2(); var extendFlat = ExtendModule.extendFlat; var extendDeepAll = ExtendModule.extendDeepAll; exports2.modules = {}; exports2.allCategories = {}; exports2.allTypes = []; exports2.subplotsRegistry = {}; exports2.transformsRegistry = {}; exports2.componentsRegistry = {}; exports2.layoutArrayContainers = []; exports2.layoutArrayRegexes = []; exports2.traceLayoutAttributes = {}; exports2.localeRegistry = {}; exports2.apiMethodRegistry = {}; exports2.collectableSubplotTypes = null; exports2.register = function register(_modules) { exports2.collectableSubplotTypes = null; if (!_modules) { throw new Error("No argument passed to Plotly.register."); } else if (_modules && !Array.isArray(_modules)) { _modules = [_modules]; } for (var i = 0; i < _modules.length; i++) { var newModule = _modules[i]; if (!newModule) { throw new Error("Invalid module was attempted to be registered!"); } switch (newModule.moduleType) { case "trace": registerTraceModule(newModule); break; case "transform": registerTransformModule(newModule); break; case "component": registerComponentModule(newModule); break; case "locale": registerLocale(newModule); break; case "apiMethod": var name = newModule.name; exports2.apiMethodRegistry[name] = newModule.fn; break; default: throw new Error("Invalid module was attempted to be registered!"); } } }; exports2.getModule = function(trace) { var _module = exports2.modules[getTraceType(trace)]; if (!_module) return false; return _module._module; }; exports2.traceIs = function(traceType, category) { traceType = getTraceType(traceType); if (traceType === "various") return false; var _module = exports2.modules[traceType]; if (!_module) { if (traceType) { Loggers.log("Unrecognized trace type " + traceType + "."); } _module = exports2.modules[basePlotAttributes.type.dflt]; } return !!_module.categories[category]; }; exports2.getTransformIndices = function(data, type) { var indices = []; var transforms = data.transforms || []; for (var i = 0; i < transforms.length; i++) { if (transforms[i].type === type) { indices.push(i); } } return indices; }; exports2.hasTransform = function(data, type) { var transforms = data.transforms || []; for (var i = 0; i < transforms.length; i++) { if (transforms[i].type === type) { return true; } } return false; }; exports2.getComponentMethod = function(name, method) { var _module = exports2.componentsRegistry[name]; if (!_module) return noop; return _module[method] || noop; }; exports2.call = function() { var name = arguments[0]; var args = [].slice.call(arguments, 1); return exports2.apiMethodRegistry[name].apply(null, args); }; function registerTraceModule(_module) { var thisType = _module.name; var categoriesIn = _module.categories; var meta = _module.meta; if (exports2.modules[thisType]) { Loggers.log("Type " + thisType + " already registered"); return; } if (!exports2.subplotsRegistry[_module.basePlotModule.name]) { registerSubplot(_module.basePlotModule); } var categoryObj = {}; for (var i = 0; i < categoriesIn.length; i++) { categoryObj[categoriesIn[i]] = true; exports2.allCategories[categoriesIn[i]] = true; } exports2.modules[thisType] = { _module, categories: categoryObj }; if (meta && Object.keys(meta).length) { exports2.modules[thisType].meta = meta; } exports2.allTypes.push(thisType); for (var componentName in exports2.componentsRegistry) { mergeComponentAttrsToTrace(componentName, thisType); } if (_module.layoutAttributes) { extendFlat(exports2.traceLayoutAttributes, _module.layoutAttributes); } var basePlotModule = _module.basePlotModule; var bpmName = basePlotModule.name; if (bpmName === "mapbox") { var styleRules = basePlotModule.constants.styleRules; for (var k in styleRules) { addStyleRule(".js-plotly-plot .plotly .mapboxgl-" + k, styleRules[k]); } } if (bpmName === "map") { init_maplibre_gl(); } if ((bpmName === "geo" || bpmName === "mapbox" || bpmName === "map") && window.PlotlyGeoAssets === void 0) { window.PlotlyGeoAssets = { topojson: {} }; } } function registerSubplot(_module) { var plotType = _module.name; if (exports2.subplotsRegistry[plotType]) { Loggers.log("Plot type " + plotType + " already registered."); return; } findArrayRegexps(_module); exports2.subplotsRegistry[plotType] = _module; for (var componentName in exports2.componentsRegistry) { mergeComponentAttrsToSubplot(componentName, _module.name); } } function registerComponentModule(_module) { if (typeof _module.name !== "string") { throw new Error("Component module *name* must be a string."); } var name = _module.name; exports2.componentsRegistry[name] = _module; if (_module.layoutAttributes) { if (_module.layoutAttributes._isLinkedToArray) { pushUnique(exports2.layoutArrayContainers, name); } findArrayRegexps(_module); } for (var traceType in exports2.modules) { mergeComponentAttrsToTrace(name, traceType); } for (var subplotName in exports2.subplotsRegistry) { mergeComponentAttrsToSubplot(name, subplotName); } for (var transformType in exports2.transformsRegistry) { mergeComponentAttrsToTransform(name, transformType); } if (_module.schema && _module.schema.layout) { extendDeepAll(baseLayoutAttributes, _module.schema.layout); } } function registerTransformModule(_module) { if (typeof _module.name !== "string") { throw new Error("Transform module *name* must be a string."); } var prefix = "Transform module " + _module.name; var hasTransform = typeof _module.transform === "function"; var hasCalcTransform = typeof _module.calcTransform === "function"; if (!hasTransform && !hasCalcTransform) { throw new Error(prefix + " is missing a *transform* or *calcTransform* method."); } if (hasTransform && hasCalcTransform) { Loggers.log([ prefix + " has both a *transform* and *calcTransform* methods.", "Please note that all *transform* methods are executed", "before all *calcTransform* methods." ].join(" ")); } if (!isPlainObject(_module.attributes)) { Loggers.log(prefix + " registered without an *attributes* object."); } if (typeof _module.supplyDefaults !== "function") { Loggers.log(prefix + " registered without a *supplyDefaults* method."); } exports2.transformsRegistry[_module.name] = _module; for (var componentName in exports2.componentsRegistry) { mergeComponentAttrsToTransform(componentName, _module.name); } } function registerLocale(_module) { var locale3 = _module.name; var baseLocale = locale3.split("-")[0]; var newDict = _module.dictionary; var newFormat = _module.format; var hasDict = newDict && Object.keys(newDict).length; var hasFormat = newFormat && Object.keys(newFormat).length; var locales = exports2.localeRegistry; var localeObj = locales[locale3]; if (!localeObj) locales[locale3] = localeObj = {}; if (baseLocale !== locale3) { var baseLocaleObj = locales[baseLocale]; if (!baseLocaleObj) locales[baseLocale] = baseLocaleObj = {}; if (hasDict && baseLocaleObj.dictionary === localeObj.dictionary) { baseLocaleObj.dictionary = newDict; } if (hasFormat && baseLocaleObj.format === localeObj.format) { baseLocaleObj.format = newFormat; } } if (hasDict) localeObj.dictionary = newDict; if (hasFormat) localeObj.format = newFormat; } function findArrayRegexps(_module) { if (_module.layoutAttributes) { var arrayAttrRegexps = _module.layoutAttributes._arrayAttrRegexps; if (arrayAttrRegexps) { for (var i = 0; i < arrayAttrRegexps.length; i++) { pushUnique(exports2.layoutArrayRegexes, arrayAttrRegexps[i]); } } } } function mergeComponentAttrsToTrace(componentName, traceType) { var componentSchema = exports2.componentsRegistry[componentName].schema; if (!componentSchema || !componentSchema.traces) return; var traceAttrs = componentSchema.traces[traceType]; if (traceAttrs) { extendDeepAll(exports2.modules[traceType]._module.attributes, traceAttrs); } } function mergeComponentAttrsToTransform(componentName, transformType) { var componentSchema = exports2.componentsRegistry[componentName].schema; if (!componentSchema || !componentSchema.transforms) return; var transformAttrs = componentSchema.transforms[transformType]; if (transformAttrs) { extendDeepAll(exports2.transformsRegistry[transformType].attributes, transformAttrs); } } function mergeComponentAttrsToSubplot(componentName, subplotName) { var componentSchema = exports2.componentsRegistry[componentName].schema; if (!componentSchema || !componentSchema.subplots) return; var subplotModule = exports2.subplotsRegistry[subplotName]; var subplotAttrs = subplotModule.layoutAttributes; var subplotAttr = subplotModule.attr === "subplot" ? subplotModule.name : subplotModule.attr; if (Array.isArray(subplotAttr)) subplotAttr = subplotAttr[0]; var componentLayoutAttrs = componentSchema.subplots[subplotAttr]; if (subplotAttrs && componentLayoutAttrs) { extendDeepAll(subplotAttrs, componentLayoutAttrs); } } function getTraceType(traceType) { if (typeof traceType === "object") traceType = traceType.type; return traceType; } } }); // node_modules/plotly.js/src/lib/dates.js var require_dates = __commonJS({ "node_modules/plotly.js/src/lib/dates.js"(exports2) { "use strict"; var timeFormat2 = (init_src2(), __toCommonJS(src_exports2)).timeFormat; var isNumeric = require_fast_isnumeric(); var Loggers = require_loggers(); var mod = require_mod().mod; var constants = require_numerical(); var BADNUM = constants.BADNUM; var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; var EPOCHJD = constants.EPOCHJD; var Registry = require_registry(); var utcFormat2 = (init_src2(), __toCommonJS(src_exports2)).utcFormat; var DATETIME_REGEXP = /^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d(:?\d\d)?)?)?)?)?)?\s*$/m; var DATETIME_REGEXP_CN = /^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d(:?\d\d)?)?)?)?)?)?\s*$/m; var YFIRST = (/* @__PURE__ */ new Date()).getFullYear() - 70; function isWorldCalendar(calendar) { return calendar && Registry.componentsRegistry.calendars && typeof calendar === "string" && calendar !== "gregorian"; } exports2.dateTick0 = function(calendar, dayOfWeek) { var tick0 = _dateTick0(calendar, !!dayOfWeek); if (dayOfWeek < 2) return tick0; var v = exports2.dateTime2ms(tick0, calendar); v += ONEDAY * (dayOfWeek - 1); return exports2.ms2DateTime(v, 0, calendar); }; function _dateTick0(calendar, sunday2) { if (isWorldCalendar(calendar)) { return sunday2 ? Registry.getComponentMethod("calendars", "CANONICAL_SUNDAY")[calendar] : Registry.getComponentMethod("calendars", "CANONICAL_TICK")[calendar]; } else { return sunday2 ? "2000-01-02" : "2000-01-01"; } } exports2.dfltRange = function(calendar) { if (isWorldCalendar(calendar)) { return Registry.getComponentMethod("calendars", "DFLTRANGE")[calendar]; } else { return ["2000-01-01", "2001-01-01"]; } }; exports2.isJSDate = function(v) { return typeof v === "object" && v !== null && typeof v.getTime === "function"; }; var MIN_MS; var MAX_MS; exports2.dateTime2ms = function(s, calendar) { if (exports2.isJSDate(s)) { var tzOffset = s.getTimezoneOffset() * ONEMIN; var offsetTweak = (s.getUTCMinutes() - s.getMinutes()) * ONEMIN + (s.getUTCSeconds() - s.getSeconds()) * ONESEC + (s.getUTCMilliseconds() - s.getMilliseconds()); if (offsetTweak) { var comb = 3 * ONEMIN; tzOffset = tzOffset - comb / 2 + mod(offsetTweak - tzOffset + comb / 2, comb); } s = Number(s) - tzOffset; if (s >= MIN_MS && s <= MAX_MS) return s; return BADNUM; } if (typeof s !== "string" && typeof s !== "number") return BADNUM; s = String(s); var isWorld = isWorldCalendar(calendar); var s02 = s.charAt(0); if (isWorld && (s02 === "G" || s02 === "g")) { s = s.substr(1); calendar = ""; } var isChinese = isWorld && calendar.substr(0, 7) === "chinese"; var match = s.match(isChinese ? DATETIME_REGEXP_CN : DATETIME_REGEXP); if (!match) return BADNUM; var y = match[1]; var m = match[3] || "1"; var d = Number(match[5] || 1); var H = Number(match[7] || 0); var M = Number(match[9] || 0); var S = Number(match[11] || 0); if (isWorld) { if (y.length === 2) return BADNUM; y = Number(y); var cDate; try { var calInstance = Registry.getComponentMethod("calendars", "getCal")(calendar); if (isChinese) { var isIntercalary = m.charAt(m.length - 1) === "i"; m = parseInt(m, 10); cDate = calInstance.newDate(y, calInstance.toMonthIndex(y, m, isIntercalary), d); } else { cDate = calInstance.newDate(y, Number(m), d); } } catch (e) { return BADNUM; } if (!cDate) return BADNUM; return (cDate.toJD() - EPOCHJD) * ONEDAY + H * ONEHOUR + M * ONEMIN + S * ONESEC; } if (y.length === 2) { y = (Number(y) + 2e3 - YFIRST) % 100 + YFIRST; } else y = Number(y); m -= 1; var date = new Date(Date.UTC(2e3, m, d, H, M)); date.setUTCFullYear(y); if (date.getUTCMonth() !== m) return BADNUM; if (date.getUTCDate() !== d) return BADNUM; return date.getTime() + S * ONESEC; }; MIN_MS = exports2.MIN_MS = exports2.dateTime2ms("-9999"); MAX_MS = exports2.MAX_MS = exports2.dateTime2ms("9999-12-31 23:59:59.9999"); exports2.isDateTime = function(s, calendar) { return exports2.dateTime2ms(s, calendar) !== BADNUM; }; function lpad(val, digits) { return String(val + Math.pow(10, digits)).substr(1); } var NINETYDAYS = 90 * ONEDAY; var THREEHOURS = 3 * ONEHOUR; var FIVEMIN = 5 * ONEMIN; exports2.ms2DateTime = function(ms2, r, calendar) { if (typeof ms2 !== "number" || !(ms2 >= MIN_MS && ms2 <= MAX_MS)) return BADNUM; if (!r) r = 0; var msecTenths = Math.floor(mod(ms2 + 0.05, 1) * 10); var msRounded = Math.round(ms2 - msecTenths / 10); var dateStr, h, m, s, msec10, d; if (isWorldCalendar(calendar)) { var dateJD = Math.floor(msRounded / ONEDAY) + EPOCHJD; var timeMs = Math.floor(mod(ms2, ONEDAY)); try { dateStr = Registry.getComponentMethod("calendars", "getCal")(calendar).fromJD(dateJD).formatDate("yyyy-mm-dd"); } catch (e) { dateStr = utcFormat2("G%Y-%m-%d")(new Date(msRounded)); } if (dateStr.charAt(0) === "-") { while (dateStr.length < 11) dateStr = "-0" + dateStr.substr(1); } else { while (dateStr.length < 10) dateStr = "0" + dateStr; } h = r < NINETYDAYS ? Math.floor(timeMs / ONEHOUR) : 0; m = r < NINETYDAYS ? Math.floor(timeMs % ONEHOUR / ONEMIN) : 0; s = r < THREEHOURS ? Math.floor(timeMs % ONEMIN / ONESEC) : 0; msec10 = r < FIVEMIN ? timeMs % ONESEC * 10 + msecTenths : 0; } else { d = new Date(msRounded); dateStr = utcFormat2("%Y-%m-%d")(d); h = r < NINETYDAYS ? d.getUTCHours() : 0; m = r < NINETYDAYS ? d.getUTCMinutes() : 0; s = r < THREEHOURS ? d.getUTCSeconds() : 0; msec10 = r < FIVEMIN ? d.getUTCMilliseconds() * 10 + msecTenths : 0; } return includeTime(dateStr, h, m, s, msec10); }; exports2.ms2DateTimeLocal = function(ms2) { if (!(ms2 >= MIN_MS + ONEDAY && ms2 <= MAX_MS - ONEDAY)) return BADNUM; var msecTenths = Math.floor(mod(ms2 + 0.05, 1) * 10); var d = new Date(Math.round(ms2 - msecTenths / 10)); var dateStr = timeFormat2("%Y-%m-%d")(d); var h = d.getHours(); var m = d.getMinutes(); var s = d.getSeconds(); var msec10 = d.getUTCMilliseconds() * 10 + msecTenths; return includeTime(dateStr, h, m, s, msec10); }; function includeTime(dateStr, h, m, s, msec10) { if (h || m || s || msec10) { dateStr += " " + lpad(h, 2) + ":" + lpad(m, 2); if (s || msec10) { dateStr += ":" + lpad(s, 2); if (msec10) { var digits = 4; while (msec10 % 10 === 0) { digits -= 1; msec10 /= 10; } dateStr += "." + lpad(msec10, digits); } } } return dateStr; } exports2.cleanDate = function(v, dflt, calendar) { if (v === BADNUM) return dflt; if (exports2.isJSDate(v) || typeof v === "number" && isFinite(v)) { if (isWorldCalendar(calendar)) { Loggers.error("JS Dates and milliseconds are incompatible with world calendars", v); return dflt; } v = exports2.ms2DateTimeLocal(+v); if (!v && dflt !== void 0) return dflt; } else if (!exports2.isDateTime(v, calendar)) { Loggers.error("unrecognized date", v); return dflt; } return v; }; var fracMatch = /%\d?f/g; var halfYearMatch = /%h/g; var quarterToHalfYear = { 1: "1", 2: "1", 3: "2", 4: "2" }; function modDateFormat(fmt, x, formatter, calendar) { fmt = fmt.replace(fracMatch, function(match) { var digits = Math.min(+match.charAt(1) || 6, 6); var fracSecs = (x / 1e3 % 1 + 2).toFixed(digits).substr(2).replace(/0+$/, "") || "0"; return fracSecs; }); var d = new Date(Math.floor(x + 0.05)); fmt = fmt.replace(halfYearMatch, function() { return quarterToHalfYear[formatter("%q")(d)]; }); if (isWorldCalendar(calendar)) { try { fmt = Registry.getComponentMethod("calendars", "worldCalFmt")(fmt, x, calendar); } catch (e) { return "Invalid"; } } return formatter(fmt)(d); } var MAXSECONDS = [59, 59.9, 59.99, 59.999, 59.9999]; function formatTime(x, tr2) { var timePart = mod(x + 0.05, ONEDAY); var timeStr = lpad(Math.floor(timePart / ONEHOUR), 2) + ":" + lpad(mod(Math.floor(timePart / ONEMIN), 60), 2); if (tr2 !== "M") { if (!isNumeric(tr2)) tr2 = 0; var sec = Math.min(mod(x / ONESEC, 60), MAXSECONDS[tr2]); var secStr = (100 + sec).toFixed(tr2).substr(1); if (tr2 > 0) { secStr = secStr.replace(/0+$/, "").replace(/[\.]$/, ""); } timeStr += ":" + secStr; } return timeStr; } exports2.formatDate = function(x, fmt, tr2, formatter, calendar, extraFormat) { calendar = isWorldCalendar(calendar) && calendar; if (!fmt) { if (tr2 === "y") fmt = extraFormat.year; else if (tr2 === "m") fmt = extraFormat.month; else if (tr2 === "d") { fmt = extraFormat.dayMonth + "\n" + extraFormat.year; } else { return formatTime(x, tr2) + "\n" + modDateFormat(extraFormat.dayMonthYear, x, formatter, calendar); } } return modDateFormat(fmt, x, formatter, calendar); }; var THREEDAYS = 3 * ONEDAY; exports2.incrementMonth = function(ms2, dMonth, calendar) { calendar = isWorldCalendar(calendar) && calendar; var timeMs = mod(ms2, ONEDAY); ms2 = Math.round(ms2 - timeMs); if (calendar) { try { var dateJD = Math.round(ms2 / ONEDAY) + EPOCHJD; var calInstance = Registry.getComponentMethod("calendars", "getCal")(calendar); var cDate = calInstance.fromJD(dateJD); if (dMonth % 12) calInstance.add(cDate, dMonth, "m"); else calInstance.add(cDate, dMonth / 12, "y"); return (cDate.toJD() - EPOCHJD) * ONEDAY + timeMs; } catch (e) { Loggers.error("invalid ms " + ms2 + " in calendar " + calendar); } } var y = new Date(ms2 + THREEDAYS); return y.setUTCMonth(y.getUTCMonth() + dMonth) + timeMs - THREEDAYS; }; exports2.findExactDates = function(data, calendar) { var exactYears = 0; var exactMonths = 0; var exactDays = 0; var blankCount = 0; var d; var di2; var calInstance = isWorldCalendar(calendar) && Registry.getComponentMethod("calendars", "getCal")(calendar); for (var i = 0; i < data.length; i++) { di2 = data[i]; if (!isNumeric(di2)) { blankCount++; continue; } if (di2 % ONEDAY) continue; if (calInstance) { try { d = calInstance.fromJD(di2 / ONEDAY + EPOCHJD); if (d.day() === 1) { if (d.month() === 1) exactYears++; else exactMonths++; } else exactDays++; } catch (e) { } } else { d = new Date(di2); if (d.getUTCDate() === 1) { if (d.getUTCMonth() === 0) exactYears++; else exactMonths++; } else exactDays++; } } exactMonths += exactYears; exactDays += exactMonths; var dataCount = data.length - blankCount; return { exactYears: exactYears / dataCount, exactMonths: exactMonths / dataCount, exactDays: exactDays / dataCount }; }; } }); // node_modules/plotly.js/src/lib/identity.js var require_identity2 = __commonJS({ "node_modules/plotly.js/src/lib/identity.js"(exports2, module2) { "use strict"; module2.exports = function identity(d) { return d; }; } }); // node_modules/plotly.js/src/lib/search.js var require_search = __commonJS({ "node_modules/plotly.js/src/lib/search.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var loggers = require_loggers(); var identity = require_identity2(); var BADNUM = require_numerical().BADNUM; var roundingError = 1e-9; exports2.findBin = function(val, bins, linelow) { if (isNumeric(bins.start)) { return linelow ? Math.ceil((val - bins.start) / bins.size - roundingError) - 1 : Math.floor((val - bins.start) / bins.size + roundingError); } else { var n12 = 0; var n2 = bins.length; var c = 0; var binSize = n2 > 1 ? (bins[n2 - 1] - bins[0]) / (n2 - 1) : 1; var n, test; if (binSize >= 0) { test = linelow ? lessThan : lessOrEqual; } else { test = linelow ? greaterOrEqual : greaterThan; } val += binSize * roundingError * (linelow ? -1 : 1) * (binSize >= 0 ? 1 : -1); while (n12 < n2 && c++ < 100) { n = Math.floor((n12 + n2) / 2); if (test(bins[n], val)) n12 = n + 1; else n2 = n; } if (c > 90) loggers.log("Long binary search..."); return n12 - 1; } }; function lessThan(a, b) { return a < b; } function lessOrEqual(a, b) { return a <= b; } function greaterThan(a, b) { return a > b; } function greaterOrEqual(a, b) { return a >= b; } exports2.sorterAsc = function(a, b) { return a - b; }; exports2.sorterDes = function(a, b) { return b - a; }; exports2.distinctVals = function(valsIn) { var vals = valsIn.slice(); vals.sort(exports2.sorterAsc); var last; for (last = vals.length - 1; last > -1; last--) { if (vals[last] !== BADNUM) break; } var minDiff = vals[last] - vals[0] || 1; var errDiff = minDiff / (last || 1) / 1e4; var newVals = []; var preV; for (var i = 0; i <= last; i++) { var v = vals[i]; var diff = v - preV; if (preV === void 0) { newVals.push(v); preV = v; } else if (diff > errDiff) { minDiff = Math.min(minDiff, diff); newVals.push(v); preV = v; } } return { vals: newVals, minDiff }; }; exports2.roundUp = function(val, arrayIn, reverse) { var low = 0; var high = arrayIn.length - 1; var mid; var c = 0; var dlow = reverse ? 0 : 1; var dhigh = reverse ? 1 : 0; var rounded = reverse ? Math.ceil : Math.floor; while (low < high && c++ < 100) { mid = rounded((low + high) / 2); if (arrayIn[mid] <= val) low = mid + dlow; else high = mid - dhigh; } return arrayIn[low]; }; exports2.sort = function(array, sortFn) { var notOrdered = 0; var notReversed = 0; for (var i = 1; i < array.length; i++) { var pairOrder = sortFn(array[i], array[i - 1]); if (pairOrder < 0) notOrdered = 1; else if (pairOrder > 0) notReversed = 1; if (notOrdered && notReversed) return array.sort(sortFn); } return notReversed ? array : array.reverse(); }; exports2.findIndexOfMin = function(arr, fn) { fn = fn || identity; var min = Infinity; var ind; for (var i = 0; i < arr.length; i++) { var v = fn(arr[i]); if (v < min) { min = v; ind = i; } } return ind; }; } }); // node_modules/plotly.js/src/lib/sort_object_keys.js var require_sort_object_keys = __commonJS({ "node_modules/plotly.js/src/lib/sort_object_keys.js"(exports2, module2) { "use strict"; module2.exports = function sortObjectKeys(obj) { return Object.keys(obj).sort(); }; } }); // node_modules/plotly.js/src/lib/stats.js var require_stats = __commonJS({ "node_modules/plotly.js/src/lib/stats.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var isArrayOrTypedArray = require_array().isArrayOrTypedArray; exports2.aggNums = function(f, v, a, len) { var i, b; if (!len || len > a.length) len = a.length; if (!isNumeric(v)) v = false; if (isArrayOrTypedArray(a[0])) { b = new Array(len); for (i = 0; i < len; i++) b[i] = exports2.aggNums(f, v, a[i]); a = b; } for (i = 0; i < len; i++) { if (!isNumeric(v)) v = a[i]; else if (isNumeric(a[i])) v = f(+v, +a[i]); } return v; }; exports2.len = function(data) { return exports2.aggNums(function(a) { return a + 1; }, 0, data); }; exports2.mean = function(data, len) { if (!len) len = exports2.len(data); return exports2.aggNums(function(a, b) { return a + b; }, 0, data) / len; }; exports2.geometricMean = function(data, len) { if (!len) len = exports2.len(data); return Math.pow(exports2.aggNums(function(a, b) { return a * b; }, 1, data), 1 / len); }; exports2.midRange = function(numArr) { if (numArr === void 0 || numArr.length === 0) return void 0; return (exports2.aggNums(Math.max, null, numArr) + exports2.aggNums(Math.min, null, numArr)) / 2; }; exports2.variance = function(data, len, mean) { if (!len) len = exports2.len(data); if (!isNumeric(mean)) mean = exports2.mean(data, len); return exports2.aggNums(function(a, b) { return a + Math.pow(b - mean, 2); }, 0, data) / len; }; exports2.stdev = function(data, len, mean) { return Math.sqrt(exports2.variance(data, len, mean)); }; exports2.median = function(data) { var b = data.slice().sort(); return exports2.interp(b, 0.5); }; exports2.interp = function(arr, n) { if (!isNumeric(n)) throw "n should be a finite number"; n = n * arr.length - 0.5; if (n < 0) return arr[0]; if (n > arr.length - 1) return arr[arr.length - 1]; var frac = n % 1; return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; } }); // node_modules/plotly.js/src/lib/angles.js var require_angles = __commonJS({ "node_modules/plotly.js/src/lib/angles.js"(exports2, module2) { "use strict"; var modModule = require_mod(); var mod = modModule.mod; var modHalf = modModule.modHalf; var PI = Math.PI; var twoPI = 2 * PI; function deg2rad(deg) { return deg / 180 * PI; } function rad2deg(rad) { return rad / PI * 180; } function isFullCircle(aBnds) { return Math.abs(aBnds[1] - aBnds[0]) > twoPI - 1e-14; } function angleDelta(a, b) { return modHalf(b - a, twoPI); } function angleDist(a, b) { return Math.abs(angleDelta(a, b)); } function isAngleInsideSector(a, aBnds) { if (isFullCircle(aBnds)) return true; var s02, s12; if (aBnds[0] < aBnds[1]) { s02 = aBnds[0]; s12 = aBnds[1]; } else { s02 = aBnds[1]; s12 = aBnds[0]; } s02 = mod(s02, twoPI); s12 = mod(s12, twoPI); if (s02 > s12) s12 += twoPI; var a02 = mod(a, twoPI); var a12 = a02 + twoPI; return a02 >= s02 && a02 <= s12 || a12 >= s02 && a12 <= s12; } function isPtInsideSector(r, a, rBnds, aBnds) { if (!isAngleInsideSector(a, aBnds)) return false; var r02, r12; if (rBnds[0] < rBnds[1]) { r02 = rBnds[0]; r12 = rBnds[1]; } else { r02 = rBnds[1]; r12 = rBnds[0]; } return r >= r02 && r <= r12; } function _path(r02, r12, a02, a12, cx, cy, isClosed) { cx = cx || 0; cy = cy || 0; var isCircle = isFullCircle([a02, a12]); var aStart, aMid, aEnd; var rStart, rEnd; if (isCircle) { aStart = 0; aMid = PI; aEnd = twoPI; } else { if (a02 < a12) { aStart = a02; aEnd = a12; } else { aStart = a12; aEnd = a02; } } if (r02 < r12) { rStart = r02; rEnd = r12; } else { rStart = r12; rEnd = r02; } function pt2(r, a) { return [r * Math.cos(a) + cx, cy - r * Math.sin(a)]; } var largeArc = Math.abs(aEnd - aStart) <= PI ? 0 : 1; function arc(r, a, cw) { return "A" + [r, r] + " " + [0, largeArc, cw] + " " + pt2(r, a); } var p; if (isCircle) { if (rStart === null) { p = "M" + pt2(rEnd, aStart) + arc(rEnd, aMid, 0) + arc(rEnd, aEnd, 0) + "Z"; } else { p = "M" + pt2(rStart, aStart) + arc(rStart, aMid, 0) + arc(rStart, aEnd, 0) + "ZM" + pt2(rEnd, aStart) + arc(rEnd, aMid, 1) + arc(rEnd, aEnd, 1) + "Z"; } } else { if (rStart === null) { p = "M" + pt2(rEnd, aStart) + arc(rEnd, aEnd, 0); if (isClosed) p += "L0,0Z"; } else { p = "M" + pt2(rStart, aStart) + "L" + pt2(rEnd, aStart) + arc(rEnd, aEnd, 0) + "L" + pt2(rStart, aEnd) + arc(rStart, aStart, 1) + "Z"; } } return p; } function pathArc(r, a02, a12, cx, cy) { return _path(null, r, a02, a12, cx, cy, 0); } function pathSector(r, a02, a12, cx, cy) { return _path(null, r, a02, a12, cx, cy, 1); } function pathAnnulus(r02, r12, a02, a12, cx, cy) { return _path(r02, r12, a02, a12, cx, cy, 1); } module2.exports = { deg2rad, rad2deg, angleDelta, angleDist, isFullCircle, isAngleInsideSector, isPtInsideSector, pathArc, pathSector, pathAnnulus }; } }); // node_modules/plotly.js/src/lib/anchor_utils.js var require_anchor_utils = __commonJS({ "node_modules/plotly.js/src/lib/anchor_utils.js"(exports2) { "use strict"; exports2.isLeftAnchor = function isLeftAnchor(opts) { return opts.xanchor === "left" || opts.xanchor === "auto" && opts.x <= 1 / 3; }; exports2.isCenterAnchor = function isCenterAnchor(opts) { return opts.xanchor === "center" || opts.xanchor === "auto" && opts.x > 1 / 3 && opts.x < 2 / 3; }; exports2.isRightAnchor = function isRightAnchor(opts) { return opts.xanchor === "right" || opts.xanchor === "auto" && opts.x >= 2 / 3; }; exports2.isTopAnchor = function isTopAnchor(opts) { return opts.yanchor === "top" || opts.yanchor === "auto" && opts.y >= 2 / 3; }; exports2.isMiddleAnchor = function isMiddleAnchor(opts) { return opts.yanchor === "middle" || opts.yanchor === "auto" && opts.y > 1 / 3 && opts.y < 2 / 3; }; exports2.isBottomAnchor = function isBottomAnchor(opts) { return opts.yanchor === "bottom" || opts.yanchor === "auto" && opts.y <= 1 / 3; }; } }); // node_modules/plotly.js/src/lib/geometry2d.js var require_geometry2d = __commonJS({ "node_modules/plotly.js/src/lib/geometry2d.js"(exports2) { "use strict"; var mod = require_mod().mod; exports2.segmentsIntersect = segmentsIntersect; function segmentsIntersect(x12, y12, x2, y2, x3, y3, x4, y4) { var a = x2 - x12; var b = x3 - x12; var c = x4 - x3; var d = y2 - y12; var e = y3 - y12; var f = y4 - y3; var det = a * f - c * d; if (det === 0) return null; var t = (b * f - c * e) / det; var u = (b * d - a * e) / det; if (u < 0 || u > 1 || t < 0 || t > 1) return null; return { x: x12 + a * t, y: y12 + d * t }; } exports2.segmentDistance = function segmentDistance(x12, y12, x2, y2, x3, y3, x4, y4) { if (segmentsIntersect(x12, y12, x2, y2, x3, y3, x4, y4)) return 0; var x122 = x2 - x12; var y122 = y2 - y12; var x34 = x4 - x3; var y34 = y4 - y3; var ll12 = x122 * x122 + y122 * y122; var ll34 = x34 * x34 + y34 * y34; var dist2 = Math.min( perpDistance2(x122, y122, ll12, x3 - x12, y3 - y12), perpDistance2(x122, y122, ll12, x4 - x12, y4 - y12), perpDistance2(x34, y34, ll34, x12 - x3, y12 - y3), perpDistance2(x34, y34, ll34, x2 - x3, y2 - y3) ); return Math.sqrt(dist2); }; function perpDistance2(xab, yab, llab, xac, yac) { var fcAB = xac * xab + yac * yab; if (fcAB < 0) { return xac * xac + yac * yac; } else if (fcAB > llab) { var xbc = xac - xab; var ybc = yac - yab; return xbc * xbc + ybc * ybc; } else { var crossProduct = xac * yab - yac * xab; return crossProduct * crossProduct / llab; } } var locationCache; var workingPath; var workingTextWidth; exports2.getTextLocation = function getTextLocation(path, totalPathLen, positionOnPath, textWidth) { if (path !== workingPath || textWidth !== workingTextWidth) { locationCache = {}; workingPath = path; workingTextWidth = textWidth; } if (locationCache[positionOnPath]) { return locationCache[positionOnPath]; } var p02 = path.getPointAtLength(mod(positionOnPath - textWidth / 2, totalPathLen)); var p12 = path.getPointAtLength(mod(positionOnPath + textWidth / 2, totalPathLen)); var theta = Math.atan((p12.y - p02.y) / (p12.x - p02.x)); var pCenter = path.getPointAtLength(mod(positionOnPath, totalPathLen)); var x = (pCenter.x * 4 + p02.x + p12.x) / 6; var y = (pCenter.y * 4 + p02.y + p12.y) / 6; var out = { x, y, theta }; locationCache[positionOnPath] = out; return out; }; exports2.clearLocationCache = function() { workingPath = null; }; exports2.getVisibleSegment = function getVisibleSegment(path, bounds, buffer) { var left = bounds.left; var right = bounds.right; var top = bounds.top; var bottom = bounds.bottom; var pMin = 0; var pTotal = path.getTotalLength(); var pMax = pTotal; var pt0, ptTotal; function getDistToPlot(len) { var pt2 = path.getPointAtLength(len); if (len === 0) pt0 = pt2; else if (len === pTotal) ptTotal = pt2; var dx = pt2.x < left ? left - pt2.x : pt2.x > right ? pt2.x - right : 0; var dy = pt2.y < top ? top - pt2.y : pt2.y > bottom ? pt2.y - bottom : 0; return Math.sqrt(dx * dx + dy * dy); } var distToPlot = getDistToPlot(pMin); while (distToPlot) { pMin += distToPlot + buffer; if (pMin > pMax) return; distToPlot = getDistToPlot(pMin); } distToPlot = getDistToPlot(pMax); while (distToPlot) { pMax -= distToPlot + buffer; if (pMin > pMax) return; distToPlot = getDistToPlot(pMax); } return { min: pMin, max: pMax, len: pMax - pMin, total: pTotal, isClosed: pMin === 0 && pMax === pTotal && Math.abs(pt0.x - ptTotal.x) < 0.1 && Math.abs(pt0.y - ptTotal.y) < 0.1 }; }; exports2.findPointOnPath = function findPointOnPath(path, val, coord, opts) { opts = opts || {}; var pathLength = opts.pathLength || path.getTotalLength(); var tolerance = opts.tolerance || 1e-3; var iterationLimit = opts.iterationLimit || 30; var mul = path.getPointAtLength(0)[coord] > path.getPointAtLength(pathLength)[coord] ? -1 : 1; var i = 0; var b02 = 0; var b12 = pathLength; var mid; var pt2; var diff; while (i < iterationLimit) { mid = (b02 + b12) / 2; pt2 = path.getPointAtLength(mid); diff = pt2[coord] - val; if (Math.abs(diff) < tolerance) { return pt2; } else { if (mul * diff > 0) { b12 = mid; } else { b02 = mid; } i++; } } return pt2; }; } }); // node_modules/plotly.js/src/lib/throttle.js var require_throttle = __commonJS({ "node_modules/plotly.js/src/lib/throttle.js"(exports2) { "use strict"; var timerCache = {}; exports2.throttle = function throttle(id2, minInterval, callback) { var cache = timerCache[id2]; var now = Date.now(); if (!cache) { for (var idi in timerCache) { if (timerCache[idi].ts < now - 6e4) { delete timerCache[idi]; } } cache = timerCache[id2] = { ts: 0, timer: null }; } _clearTimeout(cache); function exec() { callback(); cache.ts = Date.now(); if (cache.onDone) { cache.onDone(); cache.onDone = null; } } if (now > cache.ts + minInterval) { exec(); return; } cache.timer = setTimeout(function() { exec(); cache.timer = null; }, minInterval); }; exports2.done = function(id2) { var cache = timerCache[id2]; if (!cache || !cache.timer) return Promise.resolve(); return new Promise(function(resolve) { var previousOnDone = cache.onDone; cache.onDone = function onDone() { if (previousOnDone) previousOnDone(); resolve(); cache.onDone = null; }; }); }; exports2.clear = function(id2) { if (id2) { _clearTimeout(timerCache[id2]); delete timerCache[id2]; } else { for (var idi in timerCache) exports2.clear(idi); } }; function _clearTimeout(cache) { if (cache && cache.timer !== null) { clearTimeout(cache.timer); cache.timer = null; } } } }); // node_modules/plotly.js/src/lib/clear_responsive.js var require_clear_responsive = __commonJS({ "node_modules/plotly.js/src/lib/clear_responsive.js"(exports2, module2) { "use strict"; module2.exports = function clearResponsive(gd2) { if (gd2._responsiveChartHandler) { window.removeEventListener("resize", gd2._responsiveChartHandler); delete gd2._responsiveChartHandler; } }; } }); // node_modules/is-mobile/index.js var require_is_mobile = __commonJS({ "node_modules/is-mobile/index.js"(exports2, module2) { "use strict"; module2.exports = isMobile; module2.exports.isMobile = isMobile; module2.exports.default = isMobile; var mobileRE = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i; var notMobileRE = /CrOS/; var tabletRE = /android|ipad|playbook|silk/i; function isMobile(opts) { if (!opts) opts = {}; let ua2 = opts.ua; if (!ua2 && typeof navigator !== "undefined") ua2 = navigator.userAgent; if (ua2 && ua2.headers && typeof ua2.headers["user-agent"] === "string") { ua2 = ua2.headers["user-agent"]; } if (typeof ua2 !== "string") return false; let result = mobileRE.test(ua2) && !notMobileRE.test(ua2) || !!opts.tablet && tabletRE.test(ua2); if (!result && opts.tablet && opts.featureDetect && navigator && navigator.maxTouchPoints > 1 && ua2.indexOf("Macintosh") !== -1 && ua2.indexOf("Safari") !== -1) { result = true; } return result; } } }); // node_modules/plotly.js/src/lib/preserve_drawing_buffer.js var require_preserve_drawing_buffer = __commonJS({ "node_modules/plotly.js/src/lib/preserve_drawing_buffer.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var isMobileOrTablet = require_is_mobile(); module2.exports = function preserveDrawingBuffer(opts) { var ua2; if (opts && opts.hasOwnProperty("userAgent")) { ua2 = opts.userAgent; } else { ua2 = getUserAgent(); } if (typeof ua2 !== "string") return true; var enable = isMobileOrTablet({ ua: { headers: { "user-agent": ua2 } }, tablet: true, featureDetect: false }); if (!enable) { var allParts = ua2.split(" "); for (var i = 1; i < allParts.length; i++) { var part = allParts[i]; if (part.indexOf("Safari") !== -1) { for (var k = i - 1; k > -1; k--) { var prevPart = allParts[k]; if (prevPart.substr(0, 8) === "Version/") { var v = prevPart.substr(8).split(".")[0]; if (isNumeric(v)) v = +v; if (v >= 13) return true; } } } } } return enable; }; function getUserAgent() { var ua2; if (typeof navigator !== "undefined") { ua2 = navigator.userAgent; } if (ua2 && ua2.headers && typeof ua2.headers["user-agent"] === "string") { ua2 = ua2.headers["user-agent"]; } return ua2; } } }); // node_modules/plotly.js/src/lib/make_trace_groups.js var require_make_trace_groups = __commonJS({ "node_modules/plotly.js/src/lib/make_trace_groups.js"(exports2, module2) { "use strict"; var d3 = require_d3(); module2.exports = function makeTraceGroups(traceLayer, cdModule, cls) { var traces = traceLayer.selectAll("g." + cls.replace(/\s/g, ".")).data(cdModule, function(cd2) { return cd2[0].trace.uid; }); traces.exit().remove(); traces.enter().append("g").attr("class", cls); traces.order(); var k = traceLayer.classed("rangeplot") ? "nodeRangePlot3" : "node3"; traces.each(function(cd2) { cd2[0][k] = d3.select(this); }); return traces; }; } }); // node_modules/plotly.js/src/lib/localize.js var require_localize = __commonJS({ "node_modules/plotly.js/src/lib/localize.js"(exports2, module2) { "use strict"; var Registry = require_registry(); module2.exports = function localize(gd2, s) { var locale3 = gd2._context.locale; for (var i = 0; i < 2; i++) { var locales = gd2._context.locales; for (var j = 0; j < 2; j++) { var dict = (locales[locale3] || {}).dictionary; if (dict) { var out = dict[s]; if (out) return out; } locales = Registry.localeRegistry; } var baseLocale = locale3.split("-")[0]; if (baseLocale === locale3) break; locale3 = baseLocale; } return s; }; } }); // node_modules/plotly.js/src/lib/filter_unique.js var require_filter_unique = __commonJS({ "node_modules/plotly.js/src/lib/filter_unique.js"(exports2, module2) { "use strict"; module2.exports = function filterUnique(array) { var seen = {}; var out = []; var j = 0; for (var i = 0; i < array.length; i++) { var item = array[i]; if (seen[item] !== 1) { seen[item] = 1; out[j++] = item; } } return out; }; } }); // node_modules/plotly.js/src/lib/filter_visible.js var require_filter_visible = __commonJS({ "node_modules/plotly.js/src/lib/filter_visible.js"(exports2, module2) { "use strict"; module2.exports = function filterVisible(container) { var filterFn = isCalcData(container) ? calcDataFilter : baseFilter; var out = []; for (var i = 0; i < container.length; i++) { var item = container[i]; if (filterFn(item)) out.push(item); } return out; }; function baseFilter(item) { return item.visible === true; } function calcDataFilter(item) { var trace = item[0].trace; return trace.visible === true && trace._length !== 0; } function isCalcData(cont) { return Array.isArray(cont) && Array.isArray(cont[0]) && cont[0][0] && cont[0][0].trace; } } }); // node_modules/plotly.js/src/lib/increment.js var require_increment = __commonJS({ "node_modules/plotly.js/src/lib/increment.js"(exports2, module2) { "use strict"; module2.exports = function incrementNumeric(x, delta) { if (!delta) return x; var scale = 1 / Math.abs(delta); var newX = scale > 1 ? (scale * x + scale * delta) / scale : x + delta; var lenX1 = String(newX).length; if (lenX1 > 16) { var lenDt = String(delta).length; var lenX0 = String(x).length; if (lenX1 >= lenX0 + lenDt) { var s = parseFloat(newX).toPrecision(12); if (s.indexOf("e+") === -1) newX = +s; } } return newX; }; } }); // node_modules/plotly.js/src/lib/clean_number.js var require_clean_number = __commonJS({ "node_modules/plotly.js/src/lib/clean_number.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var BADNUM = require_numerical().BADNUM; var JUNK = /^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g; module2.exports = function cleanNumber(v) { if (typeof v === "string") { v = v.replace(JUNK, ""); } if (isNumeric(v)) return Number(v); return BADNUM; }; } }); // node_modules/plotly.js/src/lib/index.js var require_lib = __commonJS({ "node_modules/plotly.js/src/lib/index.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var utcFormat2 = (init_src2(), __toCommonJS(src_exports2)).utcFormat; var d3Format = (init_src3(), __toCommonJS(src_exports3)).format; var isNumeric = require_fast_isnumeric(); var numConstants = require_numerical(); var MAX_SAFE = numConstants.FP_SAFE; var MIN_SAFE = -MAX_SAFE; var BADNUM = numConstants.BADNUM; var lib = module2.exports = {}; lib.adjustFormat = function adjustFormat(formatStr) { if (!formatStr || /^\d[.]\df/.test(formatStr) || /[.]\d%/.test(formatStr)) return formatStr; if (formatStr === "0.f") return "~f"; if (/^\d%/.test(formatStr)) return "~%"; if (/^\ds/.test(formatStr)) return "~s"; if (!/^[~,.0$]/.test(formatStr) && /[&fps]/.test(formatStr)) return "~" + formatStr; return formatStr; }; var seenBadFormats = {}; lib.warnBadFormat = function(f) { var key = String(f); if (!seenBadFormats[key]) { seenBadFormats[key] = 1; lib.warn('encountered bad format: "' + key + '"'); } }; lib.noFormat = function(value) { return String(value); }; lib.numberFormat = function(formatStr) { var fn; try { fn = d3Format(lib.adjustFormat(formatStr)); } catch (e) { lib.warnBadFormat(formatStr); return lib.noFormat; } return fn; }; lib.nestedProperty = require_nested_property(); lib.keyedContainer = require_keyed_container(); lib.relativeAttr = require_relative_attr(); lib.isPlainObject = require_is_plain_object(); lib.toLogRange = require_to_log_range(); lib.relinkPrivateKeys = require_relink_private(); var arrayModule = require_array(); lib.isArrayBuffer = arrayModule.isArrayBuffer; lib.isTypedArray = arrayModule.isTypedArray; lib.isArrayOrTypedArray = arrayModule.isArrayOrTypedArray; lib.isArray1D = arrayModule.isArray1D; lib.ensureArray = arrayModule.ensureArray; lib.concat = arrayModule.concat; lib.maxRowLength = arrayModule.maxRowLength; lib.minRowLength = arrayModule.minRowLength; var modModule = require_mod(); lib.mod = modModule.mod; lib.modHalf = modModule.modHalf; var coerceModule = require_coerce(); lib.valObjectMeta = coerceModule.valObjectMeta; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; lib.coercePattern = coerceModule.coercePattern; lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.coerceSelectionMarkerOpacity = coerceModule.coerceSelectionMarkerOpacity; lib.validate = coerceModule.validate; var datesModule = require_dates(); lib.dateTime2ms = datesModule.dateTime2ms; lib.isDateTime = datesModule.isDateTime; lib.ms2DateTime = datesModule.ms2DateTime; lib.ms2DateTimeLocal = datesModule.ms2DateTimeLocal; lib.cleanDate = datesModule.cleanDate; lib.isJSDate = datesModule.isJSDate; lib.formatDate = datesModule.formatDate; lib.incrementMonth = datesModule.incrementMonth; lib.dateTick0 = datesModule.dateTick0; lib.dfltRange = datesModule.dfltRange; lib.findExactDates = datesModule.findExactDates; lib.MIN_MS = datesModule.MIN_MS; lib.MAX_MS = datesModule.MAX_MS; var searchModule = require_search(); lib.findBin = searchModule.findBin; lib.sorterAsc = searchModule.sorterAsc; lib.sorterDes = searchModule.sorterDes; lib.distinctVals = searchModule.distinctVals; lib.roundUp = searchModule.roundUp; lib.sort = searchModule.sort; lib.findIndexOfMin = searchModule.findIndexOfMin; lib.sortObjectKeys = require_sort_object_keys(); var statsModule = require_stats(); lib.aggNums = statsModule.aggNums; lib.len = statsModule.len; lib.mean = statsModule.mean; lib.geometricMean = statsModule.geometricMean; lib.median = statsModule.median; lib.midRange = statsModule.midRange; lib.variance = statsModule.variance; lib.stdev = statsModule.stdev; lib.interp = statsModule.interp; var matrixModule = require_matrix(); lib.init2dArray = matrixModule.init2dArray; lib.transposeRagged = matrixModule.transposeRagged; lib.dot = matrixModule.dot; lib.translationMatrix = matrixModule.translationMatrix; lib.rotationMatrix = matrixModule.rotationMatrix; lib.rotationXYMatrix = matrixModule.rotationXYMatrix; lib.apply3DTransform = matrixModule.apply3DTransform; lib.apply2DTransform = matrixModule.apply2DTransform; lib.apply2DTransform2 = matrixModule.apply2DTransform2; lib.convertCssMatrix = matrixModule.convertCssMatrix; lib.inverseTransformMatrix = matrixModule.inverseTransformMatrix; var anglesModule = require_angles(); lib.deg2rad = anglesModule.deg2rad; lib.rad2deg = anglesModule.rad2deg; lib.angleDelta = anglesModule.angleDelta; lib.angleDist = anglesModule.angleDist; lib.isFullCircle = anglesModule.isFullCircle; lib.isAngleInsideSector = anglesModule.isAngleInsideSector; lib.isPtInsideSector = anglesModule.isPtInsideSector; lib.pathArc = anglesModule.pathArc; lib.pathSector = anglesModule.pathSector; lib.pathAnnulus = anglesModule.pathAnnulus; var anchorUtils = require_anchor_utils(); lib.isLeftAnchor = anchorUtils.isLeftAnchor; lib.isCenterAnchor = anchorUtils.isCenterAnchor; lib.isRightAnchor = anchorUtils.isRightAnchor; lib.isTopAnchor = anchorUtils.isTopAnchor; lib.isMiddleAnchor = anchorUtils.isMiddleAnchor; lib.isBottomAnchor = anchorUtils.isBottomAnchor; var geom2dModule = require_geometry2d(); lib.segmentsIntersect = geom2dModule.segmentsIntersect; lib.segmentDistance = geom2dModule.segmentDistance; lib.getTextLocation = geom2dModule.getTextLocation; lib.clearLocationCache = geom2dModule.clearLocationCache; lib.getVisibleSegment = geom2dModule.getVisibleSegment; lib.findPointOnPath = geom2dModule.findPointOnPath; var extendModule = require_extend(); lib.extendFlat = extendModule.extendFlat; lib.extendDeep = extendModule.extendDeep; lib.extendDeepAll = extendModule.extendDeepAll; lib.extendDeepNoArrays = extendModule.extendDeepNoArrays; var loggersModule = require_loggers(); lib.log = loggersModule.log; lib.warn = loggersModule.warn; lib.error = loggersModule.error; var regexModule = require_regex(); lib.counterRegex = regexModule.counter; var throttleModule = require_throttle(); lib.throttle = throttleModule.throttle; lib.throttleDone = throttleModule.done; lib.clearThrottle = throttleModule.clear; var domModule = require_dom(); lib.getGraphDiv = domModule.getGraphDiv; lib.isPlotDiv = domModule.isPlotDiv; lib.removeElement = domModule.removeElement; lib.addStyleRule = domModule.addStyleRule; lib.addRelatedStyleRule = domModule.addRelatedStyleRule; lib.deleteRelatedStyleRule = domModule.deleteRelatedStyleRule; lib.getFullTransformMatrix = domModule.getFullTransformMatrix; lib.getElementTransformMatrix = domModule.getElementTransformMatrix; lib.getElementAndAncestors = domModule.getElementAndAncestors; lib.equalDomRects = domModule.equalDomRects; lib.clearResponsive = require_clear_responsive(); lib.preserveDrawingBuffer = require_preserve_drawing_buffer(); lib.makeTraceGroups = require_make_trace_groups(); lib._ = require_localize(); lib.notifier = require_notifier(); lib.filterUnique = require_filter_unique(); lib.filterVisible = require_filter_visible(); lib.pushUnique = require_push_unique(); lib.increment = require_increment(); lib.cleanNumber = require_clean_number(); lib.ensureNumber = function ensureNumber(v) { if (!isNumeric(v)) return BADNUM; v = Number(v); return v > MAX_SAFE || v < MIN_SAFE ? BADNUM : v; }; lib.isIndex = function(v, len) { if (len !== void 0 && v >= len) return false; return isNumeric(v) && v >= 0 && v % 1 === 0; }; lib.noop = require_noop(); lib.identity = require_identity2(); lib.repeat = function(v, cnt) { var out = new Array(cnt); for (var i = 0; i < cnt; i++) { out[i] = v; } return out; }; lib.swapAttrs = function(cont, attrList, part1, part2) { if (!part1) part1 = "x"; if (!part2) part2 = "y"; for (var i = 0; i < attrList.length; i++) { var attr = attrList[i]; var xp2 = lib.nestedProperty(cont, attr.replace("?", part1)); var yp2 = lib.nestedProperty(cont, attr.replace("?", part2)); var temp = xp2.get(); xp2.set(yp2.get()); yp2.set(temp); } }; lib.raiseToTop = function raiseToTop(elem) { elem.parentNode.appendChild(elem); }; lib.cancelTransition = function(selection) { return selection.transition().duration(0); }; lib.constrain = function(v, v02, v12) { if (v02 > v12) return Math.max(v12, Math.min(v02, v)); return Math.max(v02, Math.min(v12, v)); }; lib.bBoxIntersect = function(a, b, pad2) { pad2 = pad2 || 0; return a.left <= b.right + pad2 && b.left <= a.right + pad2 && a.top <= b.bottom + pad2 && b.top <= a.bottom + pad2; }; lib.simpleMap = function(array, func, x12, x2, opts) { var len = array.length; var out = new Array(len); for (var i = 0; i < len; i++) out[i] = func(array[i], x12, x2, opts); return out; }; lib.randstr = function randstr(existing, bits, base, _recursion) { if (!base) base = 16; if (bits === void 0) bits = 24; if (bits <= 0) return "0"; var digits = Math.log(Math.pow(2, bits)) / Math.log(base); var res = ""; var i, b, x; for (i = 2; digits === Infinity; i *= 2) { digits = Math.log(Math.pow(2, bits / i)) / Math.log(base) * i; } var rem = digits - Math.floor(digits); for (i = 0; i < Math.floor(digits); i++) { x = Math.floor(Math.random() * base).toString(base); res = x + res; } if (rem) { b = Math.pow(base, rem); x = Math.floor(Math.random() * b).toString(base); res = x + res; } var parsed = parseInt(res, base); if (existing && existing[res] || parsed !== Infinity && parsed >= Math.pow(2, bits)) { if (_recursion > 10) { lib.warn("randstr failed uniqueness"); return res; } return randstr(existing, bits, base, (_recursion || 0) + 1); } else return res; }; lib.OptionControl = function(opt, optname) { if (!opt) opt = {}; if (!optname) optname = "opt"; var self2 = {}; self2.optionList = []; self2._newoption = function(optObj) { optObj[optname] = opt; self2[optObj.name] = optObj; self2.optionList.push(optObj); }; self2["_" + optname] = opt; return self2; }; lib.smooth = function(arrayIn, FWHM) { FWHM = Math.round(FWHM) || 0; if (FWHM < 2) return arrayIn; var alen = arrayIn.length; var alen2 = 2 * alen; var wlen = 2 * FWHM - 1; var w = new Array(wlen); var arrayOut = new Array(alen); var i; var j; var k; var v; for (i = 0; i < wlen; i++) { w[i] = (1 - Math.cos(Math.PI * (i + 1) / FWHM)) / (2 * FWHM); } for (i = 0; i < alen; i++) { v = 0; for (j = 0; j < wlen; j++) { k = i + j + 1 - FWHM; if (k < -alen) k -= alen2 * Math.round(k / alen2); else if (k >= alen2) k -= alen2 * Math.floor(k / alen2); if (k < 0) k = -1 - k; else if (k >= alen) k = alen2 - 1 - k; v += arrayIn[k] * w[j]; } arrayOut[i] = v; } return arrayOut; }; lib.syncOrAsync = function(sequence, arg, finalStep) { var ret, fni; function continueAsync() { return lib.syncOrAsync(sequence, arg, finalStep); } while (sequence.length) { fni = sequence.splice(0, 1)[0]; ret = fni(arg); if (ret && ret.then) { return ret.then(continueAsync); } } return finalStep && finalStep(arg); }; lib.stripTrailingSlash = function(str) { if (str.substr(-1) === "/") return str.substr(0, str.length - 1); return str; }; lib.noneOrAll = function(containerIn, containerOut, attrList) { if (!containerIn) return; var hasAny = false; var hasAll = true; var i; var val; for (i = 0; i < attrList.length; i++) { val = containerIn[attrList[i]]; if (val !== void 0 && val !== null) hasAny = true; else hasAll = false; } if (hasAny && !hasAll) { for (i = 0; i < attrList.length; i++) { containerIn[attrList[i]] = containerOut[attrList[i]]; } } }; lib.mergeArray = function(traceAttr, cd2, cdAttr, fn) { var hasFn = typeof fn === "function"; if (lib.isArrayOrTypedArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd2.length); for (var i = 0; i < imax; i++) { var v = traceAttr[i]; cd2[i][cdAttr] = hasFn ? fn(v) : v; } } }; lib.mergeArrayCastPositive = function(traceAttr, cd2, cdAttr) { return lib.mergeArray(traceAttr, cd2, cdAttr, function(v) { var w = +v; return !isFinite(w) ? 0 : w > 0 ? w : 0; }); }; lib.fillArray = function(traceAttr, cd2, cdAttr, fn) { fn = fn || lib.identity; if (lib.isArrayOrTypedArray(traceAttr)) { for (var i = 0; i < cd2.length; i++) { cd2[i][cdAttr] = fn(traceAttr[i]); } } }; lib.castOption = function(trace, ptNumber, astr, fn) { fn = fn || lib.identity; var val = lib.nestedProperty(trace, astr).get(); if (lib.isArrayOrTypedArray(val)) { if (Array.isArray(ptNumber) && lib.isArrayOrTypedArray(val[ptNumber[0]])) { return fn(val[ptNumber[0]][ptNumber[1]]); } else { return fn(val[ptNumber]); } } else { return val; } }; lib.extractOption = function(calcPt, trace, calcKey, traceKey) { if (calcKey in calcPt) return calcPt[calcKey]; var traceVal = lib.nestedProperty(trace, traceKey).get(); if (!Array.isArray(traceVal)) return traceVal; }; function makePtIndex2PtNumber(indexToPoints) { var ptIndex2ptNumber = {}; for (var k in indexToPoints) { var pts = indexToPoints[k]; for (var j = 0; j < pts.length; j++) { ptIndex2ptNumber[pts[j]] = +k; } } return ptIndex2ptNumber; } lib.tagSelected = function(calcTrace, trace, ptNumber2cdIndex) { var selectedpoints = trace.selectedpoints; var indexToPoints = trace._indexToPoints; var ptIndex2ptNumber; if (indexToPoints) { ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints); } function isCdIndexValid(v) { return v !== void 0 && v < calcTrace.length; } for (var i = 0; i < selectedpoints.length; i++) { var ptIndex = selectedpoints[i]; if (lib.isIndex(ptIndex) || lib.isArrayOrTypedArray(ptIndex) && lib.isIndex(ptIndex[0]) && lib.isIndex(ptIndex[1])) { var ptNumber = ptIndex2ptNumber ? ptIndex2ptNumber[ptIndex] : ptIndex; var cdIndex = ptNumber2cdIndex ? ptNumber2cdIndex[ptNumber] : ptNumber; if (isCdIndexValid(cdIndex)) { calcTrace[cdIndex].selected = 1; } } } }; lib.selIndices2selPoints = function(trace) { var selectedpoints = trace.selectedpoints; var indexToPoints = trace._indexToPoints; if (indexToPoints) { var ptIndex2ptNumber = makePtIndex2PtNumber(indexToPoints); var out = []; for (var i = 0; i < selectedpoints.length; i++) { var ptIndex = selectedpoints[i]; if (lib.isIndex(ptIndex)) { var ptNumber = ptIndex2ptNumber[ptIndex]; if (lib.isIndex(ptNumber)) { out.push(ptNumber); } } } return out; } else { return selectedpoints; } }; lib.getTargetArray = function(trace, transformOpts) { var target = transformOpts.target; if (typeof target === "string" && target) { var array = lib.nestedProperty(trace, target).get(); return lib.isArrayOrTypedArray(array) ? array : false; } else if (lib.isArrayOrTypedArray(target)) { return target; } return false; }; function minExtend(obj1, obj2, opt) { var objOut = {}; if (typeof obj2 !== "object") obj2 = {}; var arrayLen = opt === "pieLike" ? -1 : 3; var keys = Object.keys(obj1); var i, k, v; for (i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; if (k.charAt(0) === "_" || typeof v === "function") continue; else if (k === "module") objOut[k] = v; else if (Array.isArray(v)) { if (k === "colorscale" || arrayLen === -1) { objOut[k] = v.slice(); } else { objOut[k] = v.slice(0, arrayLen); } } else if (lib.isTypedArray(v)) { if (arrayLen === -1) { objOut[k] = v.subarray(); } else { objOut[k] = v.subarray(0, arrayLen); } } else if (v && typeof v === "object") objOut[k] = minExtend(obj1[k], obj2[k], opt); else objOut[k] = v; } keys = Object.keys(obj2); for (i = 0; i < keys.length; i++) { k = keys[i]; v = obj2[k]; if (typeof v !== "object" || !(k in objOut) || typeof objOut[k] !== "object") { objOut[k] = v; } } return objOut; } lib.minExtend = minExtend; lib.titleCase = function(s) { return s.charAt(0).toUpperCase() + s.substr(1); }; lib.containsAny = function(s, fragments) { for (var i = 0; i < fragments.length; i++) { if (s.indexOf(fragments[i]) !== -1) return true; } return false; }; lib.isIE = function() { return typeof window.navigator.msSaveBlob !== "undefined"; }; var IS_SAFARI_REGEX = /Version\/[\d\.]+.*Safari/; lib.isSafari = function() { return IS_SAFARI_REGEX.test(window.navigator.userAgent); }; var IS_IOS_REGEX = /iPad|iPhone|iPod/; lib.isIOS = function() { return IS_IOS_REGEX.test(window.navigator.userAgent); }; var FIREFOX_VERSION_REGEX = /Firefox\/(\d+)\.\d+/; lib.getFirefoxVersion = function() { var match = FIREFOX_VERSION_REGEX.exec(window.navigator.userAgent); if (match && match.length === 2) { var versionInt = parseInt(match[1]); if (!isNaN(versionInt)) { return versionInt; } } return null; }; lib.isD3Selection = function(obj) { return obj instanceof d3.selection; }; lib.ensureSingle = function(parent, nodeType, className, enterFn) { var sel = parent.select(nodeType + (className ? "." + className : "")); if (sel.size()) return sel; var layer = parent.append(nodeType); if (className) layer.classed(className, true); if (enterFn) layer.call(enterFn); return layer; }; lib.ensureSingleById = function(parent, nodeType, id2, enterFn) { var sel = parent.select(nodeType + "#" + id2); if (sel.size()) return sel; var layer = parent.append(nodeType).attr("id", id2); if (enterFn) layer.call(enterFn); return layer; }; lib.objectFromPath = function(path, value) { var keys = path.split("."); var tmpObj; var obj = tmpObj = {}; for (var i = 0; i < keys.length; i++) { var key = keys[i]; var el = null; var parts = keys[i].match(/(.*)\[([0-9]+)\]/); if (parts) { key = parts[1]; el = parts[2]; tmpObj = tmpObj[key] = []; if (i === keys.length - 1) { tmpObj[el] = value; } else { tmpObj[el] = {}; } tmpObj = tmpObj[el]; } else { if (i === keys.length - 1) { tmpObj[key] = value; } else { tmpObj[key] = {}; } tmpObj = tmpObj[key]; } } return obj; }; var dottedPropertyRegex = /^([^\[\.]+)\.(.+)?/; var indexedPropertyRegex = /^([^\.]+)\[([0-9]+)\](\.)?(.+)?/; function notValid(prop) { return prop.slice(0, 2) === "__"; } lib.expandObjectPaths = function(data) { var match, key, prop, datum, idx, dest, trailingPath; if (typeof data === "object" && !Array.isArray(data)) { for (key in data) { if (data.hasOwnProperty(key)) { if (match = key.match(dottedPropertyRegex)) { datum = data[key]; prop = match[1]; if (notValid(prop)) continue; delete data[key]; data[prop] = lib.extendDeepNoArrays(data[prop] || {}, lib.objectFromPath(key, lib.expandObjectPaths(datum))[prop]); } else if (match = key.match(indexedPropertyRegex)) { datum = data[key]; prop = match[1]; if (notValid(prop)) continue; idx = parseInt(match[2]); delete data[key]; data[prop] = data[prop] || []; if (match[3] === ".") { trailingPath = match[4]; dest = data[prop][idx] = data[prop][idx] || {}; lib.extendDeepNoArrays(dest, lib.objectFromPath(trailingPath, lib.expandObjectPaths(datum))); } else { if (notValid(prop)) continue; data[prop][idx] = lib.expandObjectPaths(datum); } } else { if (notValid(key)) continue; data[key] = lib.expandObjectPaths(data[key]); } } } } return data; }; lib.numSeparate = function(value, separators, separatethousands) { if (!separatethousands) separatethousands = false; if (typeof separators !== "string" || separators.length === 0) { throw new Error("Separator string required for formatting!"); } if (typeof value === "number") { value = String(value); } var thousandsRe = /(\d+)(\d{3})/; var decimalSep = separators.charAt(0); var thouSep = separators.charAt(1); var x = value.split("."); var x12 = x[0]; var x2 = x.length > 1 ? decimalSep + x[1] : ""; if (thouSep && (x.length > 1 || x12.length > 4 || separatethousands)) { while (thousandsRe.test(x12)) { x12 = x12.replace(thousandsRe, "$1" + thouSep + "$2"); } } return x12 + x2; }; lib.TEMPLATE_STRING_REGEX = /%{([^\s%{}:]*)([:|\|][^}]*)?}/g; var SIMPLE_PROPERTY_REGEX = /^\w*$/; lib.templateString = function(string, obj) { var getterCache = {}; return string.replace(lib.TEMPLATE_STRING_REGEX, function(dummy, key) { var v; if (SIMPLE_PROPERTY_REGEX.test(key)) { v = obj[key]; } else { getterCache[key] = getterCache[key] || lib.nestedProperty(obj, key).get; v = getterCache[key](); } return lib.isValidTextValue(v) ? v : ""; }); }; var hovertemplateWarnings = { max: 10, count: 0, name: "hovertemplate" }; lib.hovertemplateString = function() { return templateFormatString.apply(hovertemplateWarnings, arguments); }; var texttemplateWarnings = { max: 10, count: 0, name: "texttemplate" }; lib.texttemplateString = function() { return templateFormatString.apply(texttemplateWarnings, arguments); }; var MULT_DIV_REGEX = /^(\S+)([\*\/])(-?\d+(\.\d+)?)$/; function multDivParser(inputStr) { var match = inputStr.match(MULT_DIV_REGEX); if (match) return { key: match[1], op: match[2], number: Number(match[3]) }; return { key: inputStr, op: null, number: null }; } var texttemplateWarningsForShapes = { max: 10, count: 0, name: "texttemplate", parseMultDiv: true }; lib.texttemplateStringForShapes = function() { return templateFormatString.apply(texttemplateWarningsForShapes, arguments); }; var TEMPLATE_STRING_FORMAT_SEPARATOR = /^[:|\|]/; function templateFormatString(string, labels, d3locale) { var opts = this; var args = arguments; if (!labels) labels = {}; var getterCache = {}; return string.replace(lib.TEMPLATE_STRING_REGEX, function(match, rawKey, format2) { var isOther = rawKey === "xother" || rawKey === "yother"; var isSpaceOther = rawKey === "_xother" || rawKey === "_yother"; var isSpaceOtherSpace = rawKey === "_xother_" || rawKey === "_yother_"; var isOtherSpace = rawKey === "xother_" || rawKey === "yother_"; var hasOther = isOther || isSpaceOther || isOtherSpace || isSpaceOtherSpace; var key = rawKey; if (isSpaceOther || isSpaceOtherSpace) key = key.substring(1); if (isOtherSpace || isSpaceOtherSpace) key = key.substring(0, key.length - 1); var parsedOp = null; var parsedNumber = null; if (opts.parseMultDiv) { var _match = multDivParser(key); key = _match.key; parsedOp = _match.op; parsedNumber = _match.number; } var value; if (hasOther) { value = labels[key]; if (value === void 0) return ""; } else { var obj, i; for (i = 3; i < args.length; i++) { obj = args[i]; if (!obj) continue; if (obj.hasOwnProperty(key)) { value = obj[key]; break; } if (!SIMPLE_PROPERTY_REGEX.test(key)) { value = lib.nestedProperty(obj, key).get(); value = getterCache[key] || lib.nestedProperty(obj, key).get(); if (value) getterCache[key] = value; } if (value !== void 0) break; } } if (value !== void 0) { if (parsedOp === "*") value *= parsedNumber; if (parsedOp === "/") value /= parsedNumber; } if (value === void 0 && opts) { if (opts.count < opts.max) { lib.warn("Variable '" + key + "' in " + opts.name + " could not be found!"); value = match; } if (opts.count === opts.max) { lib.warn("Too many " + opts.name + " warnings - additional warnings will be suppressed"); } opts.count++; return match; } if (format2) { var fmt; if (format2[0] === ":") { fmt = d3locale ? d3locale.numberFormat : lib.numberFormat; if (value !== "") { value = fmt(format2.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ""))(value); } } if (format2[0] === "|") { fmt = d3locale ? d3locale.timeFormat : utcFormat2; var ms2 = lib.dateTime2ms(value); value = lib.formatDate(ms2, format2.replace(TEMPLATE_STRING_FORMAT_SEPARATOR, ""), false, fmt); } } else { var keyLabel = key + "Label"; if (labels.hasOwnProperty(keyLabel)) value = labels[keyLabel]; } if (hasOther) { value = "(" + value + ")"; if (isSpaceOther || isSpaceOtherSpace) value = " " + value; if (isOtherSpace || isSpaceOtherSpace) value = value + " "; } return value; }); } var char0 = 48; var char9 = 57; lib.subplotSort = function(a, b) { var l = Math.min(a.length, b.length) + 1; var numA = 0; var numB = 0; for (var i = 0; i < l; i++) { var charA = a.charCodeAt(i) || 0; var charB = b.charCodeAt(i) || 0; var isNumA = charA >= char0 && charA <= char9; var isNumB = charB >= char0 && charB <= char9; if (isNumA) numA = 10 * numA + charA - char0; if (isNumB) numB = 10 * numB + charB - char0; if (!isNumA || !isNumB) { if (numA !== numB) return numA - numB; if (charA !== charB) return charA - charB; } } return numB - numA; }; var randSeed = 2e9; lib.seedPseudoRandom = function() { randSeed = 2e9; }; lib.pseudoRandom = function() { var lastVal = randSeed; randSeed = (69069 * randSeed + 1) % 4294967296; if (Math.abs(randSeed - lastVal) < 429496729) return lib.pseudoRandom(); return randSeed / 4294967296; }; lib.fillText = function(calcPt, trace, contOut) { var fill = Array.isArray(contOut) ? function(v) { contOut.push(v); } : function(v) { contOut.text = v; }; var htx = lib.extractOption(calcPt, trace, "htx", "hovertext"); if (lib.isValidTextValue(htx)) return fill(htx); var tx = lib.extractOption(calcPt, trace, "tx", "text"); if (lib.isValidTextValue(tx)) return fill(tx); }; lib.isValidTextValue = function(v) { return v || v === 0; }; lib.formatPercent = function(ratio, n) { n = n || 0; var str = (Math.round(100 * ratio * Math.pow(10, n)) * Math.pow(0.1, n)).toFixed(n) + "%"; for (var i = 0; i < n; i++) { if (str.indexOf(".") !== -1) { str = str.replace("0%", "%"); str = str.replace(".%", "%"); } } return str; }; lib.isHidden = function(gd2) { var display = window.getComputedStyle(gd2).display; return !display || display === "none"; }; lib.strTranslate = function(x, y) { return x || y ? "translate(" + x + "," + y + ")" : ""; }; lib.strRotate = function(a) { return a ? "rotate(" + a + ")" : ""; }; lib.strScale = function(s) { return s !== 1 ? "scale(" + s + ")" : ""; }; lib.getTextTransform = function(transform) { var noCenter = transform.noCenter; var textX = transform.textX; var textY = transform.textY; var targetX = transform.targetX; var targetY = transform.targetY; var anchorX = transform.anchorX || 0; var anchorY = transform.anchorY || 0; var rotate = transform.rotate; var scale = transform.scale; if (!scale) scale = 0; else if (scale > 1) scale = 1; return lib.strTranslate( targetX - scale * (textX + anchorX), targetY - scale * (textY + anchorY) ) + lib.strScale(scale) + (rotate ? "rotate(" + rotate + (noCenter ? "" : " " + textX + " " + textY) + ")" : ""); }; lib.setTransormAndDisplay = function(s, transform) { s.attr("transform", lib.getTextTransform(transform)); s.style("display", transform.scale ? null : "none"); }; lib.ensureUniformFontSize = function(gd2, baseFont) { var out = lib.extendFlat({}, baseFont); out.size = Math.max( baseFont.size, gd2._fullLayout.uniformtext.minsize || 0 ); return out; }; lib.join2 = function(arr, mainSeparator, lastSeparator) { var len = arr.length; if (len > 1) { return arr.slice(0, -1).join(mainSeparator) + lastSeparator + arr[len - 1]; } return arr.join(mainSeparator); }; lib.bigFont = function(size) { return Math.round(1.2 * size); }; var firefoxVersion = lib.getFirefoxVersion(); var isProblematicFirefox = firefoxVersion !== null && firefoxVersion < 86; lib.getPositionFromD3Event = function() { if (isProblematicFirefox) { return [ d3.event.layerX, d3.event.layerY ]; } else { return [ d3.event.offsetX, d3.event.offsetY ]; } }; } }); // node_modules/plotly.js/build/plotcss.js var require_plotcss = __commonJS({ "node_modules/plotly.js/build/plotcss.js"() { "use strict"; var Lib = require_lib(); var rules = { "X,X div": 'direction:ltr;font-family:"Open Sans",verdana,arial,sans-serif;margin:0;padding:0;', "X input,X button": 'font-family:"Open Sans",verdana,arial,sans-serif;', "X input:focus,X button:focus": "outline:none;", "X a": "text-decoration:none;", "X a:hover": "text-decoration:none;", "X .crisp": "shape-rendering:crispEdges;", "X .user-select-none": "-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;", "X svg": "overflow:hidden;", "X svg a": "fill:#447adb;", "X svg a:hover": "fill:#3c6dc5;", "X .main-svg": "position:absolute;top:0;left:0;pointer-events:none;", "X .main-svg .draglayer": "pointer-events:all;", "X .cursor-default": "cursor:default;", "X .cursor-pointer": "cursor:pointer;", "X .cursor-crosshair": "cursor:crosshair;", "X .cursor-move": "cursor:move;", "X .cursor-col-resize": "cursor:col-resize;", "X .cursor-row-resize": "cursor:row-resize;", "X .cursor-ns-resize": "cursor:ns-resize;", "X .cursor-ew-resize": "cursor:ew-resize;", "X .cursor-sw-resize": "cursor:sw-resize;", "X .cursor-s-resize": "cursor:s-resize;", "X .cursor-se-resize": "cursor:se-resize;", "X .cursor-w-resize": "cursor:w-resize;", "X .cursor-e-resize": "cursor:e-resize;", "X .cursor-nw-resize": "cursor:nw-resize;", "X .cursor-n-resize": "cursor:n-resize;", "X .cursor-ne-resize": "cursor:ne-resize;", "X .cursor-grab": "cursor:-webkit-grab;cursor:grab;", "X .modebar": "position:absolute;top:2px;right:2px;", "X .ease-bg": "-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;", "X .modebar--hover>:not(.watermark)": "opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;", "X:hover .modebar--hover .modebar-group": "opacity:1;", "X .modebar-group": "float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;", "X .modebar-btn": "position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;", "X .modebar-btn svg": "position:relative;top:2px;", "X .modebar.vertical": "display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;", "X .modebar.vertical svg": "top:-1px;", "X .modebar.vertical .modebar-group": "display:block;float:none;padding-left:0px;padding-bottom:8px;", "X .modebar.vertical .modebar-group .modebar-btn": "display:block;text-align:center;", "X [data-title]:before,X [data-title]:after": "position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;", "X [data-title]:hover:before,X [data-title]:hover:after": "display:block;opacity:1;", "X [data-title]:before": 'content:"";position:absolute;background:rgba(0,0,0,0);border:6px solid rgba(0,0,0,0);z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;', "X [data-title]:after": "content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;", "X .vertical [data-title]:before,X .vertical [data-title]:after": "top:0%;right:200%;", "X .vertical [data-title]:before": "border:6px solid rgba(0,0,0,0);border-left-color:#69738a;margin-top:8px;margin-right:-30px;", Y: 'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;', "Y p": "margin:0;", "Y .notifier-note": "min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;", "Y .notifier-close": "color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;", "Y .notifier-close:hover": "color:#444;text-decoration:none;cursor:pointer;" }; for (selector in rules) { fullSelector = selector.replace(/^,/, " ,").replace(/X/g, ".js-plotly-plot .plotly").replace(/Y/g, ".plotly-notifier"); Lib.addStyleRule(fullSelector, rules[selector]); } var fullSelector; var selector; } }); // node_modules/is-browser/client.js var require_client = __commonJS({ "node_modules/is-browser/client.js"(exports2, module2) { module2.exports = true; } }); // node_modules/has-hover/index.js var require_has_hover = __commonJS({ "node_modules/has-hover/index.js"(exports2, module2) { "use strict"; var isBrowser = require_client(); var hasHover; if (typeof global.matchMedia === "function") { hasHover = !global.matchMedia("(hover: none)").matches; } else { hasHover = isBrowser; } module2.exports = hasHover; } }); // node_modules/events/events.js var require_events = __commonJS({ "node_modules/events/events.js"(exports2, module2) { "use strict"; var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); }; var ReflectOwnKeys; if (R && typeof R.ownKeys === "function") { ReflectOwnKeys = R.ownKeys; } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys2(target) { return Object.getOwnPropertyNames(target); }; } function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) { return value !== value; }; function EventEmitter() { EventEmitter.init.call(this); } module2.exports = EventEmitter; module2.exports.once = once; EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = void 0; EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = void 0; var defaultMaxListeners = 10; function checkListener(listener) { if (typeof listener !== "function") { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } } Object.defineProperty(EventEmitter, "defaultMaxListeners", { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); } defaultMaxListeners = arg; } }); EventEmitter.init = function() { if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || void 0; }; EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); } this._maxListeners = n; return this; }; function _getMaxListeners(that) { if (that._maxListeners === void 0) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return _getMaxListeners(this); }; EventEmitter.prototype.emit = function emit(type) { var args = []; for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = type === "error"; var events = this._events; if (events !== void 0) doError = doError && events.error === void 0; else if (!doError) return false; if (doError) { var er2; if (args.length > 0) er2 = args[0]; if (er2 instanceof Error) { throw er2; } var err = new Error("Unhandled error." + (er2 ? " (" + er2.message + ")" : "")); err.context = er2; throw err; } var handler = events[type]; if (handler === void 0) return false; if (typeof handler === "function") { ReflectApply(handler, this, args); } else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; checkListener(listener); events = target._events; if (events === void 0) { events = target._events = /* @__PURE__ */ Object.create(null); target._eventsCount = 0; } else { if (events.newListener !== void 0) { target.emit( "newListener", type, listener.listener ? listener.listener : listener ); events = target._events; } existing = events[type]; } if (existing === void 0) { existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === "function") { existing = events[type] = prepend ? [listener, existing] : [existing, listener]; } else if (prepend) { existing.unshift(listener); } else { existing.push(listener); } m = _getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); w.name = "MaxListenersExceededWarning"; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; if (arguments.length === 0) return this.listener.call(this.target); return this.listener.apply(this.target, arguments); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: void 0, target, type, listener }; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once2(type, listener) { checkListener(listener); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { checkListener(listener); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; checkListener(listener); events = this._events; if (events === void 0) return this; list = events[type]; if (list === void 0) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = /* @__PURE__ */ Object.create(null); else { delete events[type]; if (events.removeListener) this.emit("removeListener", type, list.listener || listener); } } else if (typeof list !== "function") { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else { spliceOne(list, position); } if (list.length === 1) events[type] = list[0]; if (events.removeListener !== void 0) this.emit("removeListener", type, originalListener || listener); } return this; }; EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (events === void 0) return this; if (events.removeListener === void 0) { if (arguments.length === 0) { this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; } else if (events[type] !== void 0) { if (--this._eventsCount === 0) this._events = /* @__PURE__ */ Object.create(null); else delete events[type]; } return this; } if (arguments.length === 0) { var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === "removeListener") continue; this.removeAllListeners(key); } this.removeAllListeners("removeListener"); this._events = /* @__PURE__ */ Object.create(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === "function") { this.removeListener(type, listeners); } else if (listeners !== void 0) { for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (events === void 0) return []; var evlistener = events[type]; if (evlistener === void 0) return []; if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === "function") { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events !== void 0) { var evlistener = events[type]; if (typeof evlistener === "function") { return 1; } else if (evlistener !== void 0) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function once(emitter, name) { return new Promise(function(resolve, reject) { function errorListener(err) { emitter.removeListener(name, resolver); reject(err); } function resolver() { if (typeof emitter.removeListener === "function") { emitter.removeListener("error", errorListener); } resolve([].slice.call(arguments)); } ; eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); if (name !== "error") { addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); } }); } function addErrorHandlerIfEventEmitter(emitter, handler, flags) { if (typeof emitter.on === "function") { eventTargetAgnosticAddListener(emitter, "error", handler, flags); } } function eventTargetAgnosticAddListener(emitter, name, listener, flags) { if (typeof emitter.on === "function") { if (flags.once) { emitter.once(name, listener); } else { emitter.on(name, listener); } } else if (typeof emitter.addEventListener === "function") { emitter.addEventListener(name, function wrapListener(arg) { if (flags.once) { emitter.removeEventListener(name, wrapListener); } listener(arg); }); } else { throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); } } } }); // node_modules/plotly.js/src/lib/events.js var require_events2 = __commonJS({ "node_modules/plotly.js/src/lib/events.js"(exports2, module2) { "use strict"; var EventEmitter = require_events().EventEmitter; var Events = { init: function(plotObj) { if (plotObj._ev instanceof EventEmitter) return plotObj; var ev2 = new EventEmitter(); var internalEv = new EventEmitter(); plotObj._ev = ev2; plotObj._internalEv = internalEv; plotObj.on = ev2.on.bind(ev2); plotObj.once = ev2.once.bind(ev2); plotObj.removeListener = ev2.removeListener.bind(ev2); plotObj.removeAllListeners = ev2.removeAllListeners.bind(ev2); plotObj._internalOn = internalEv.on.bind(internalEv); plotObj._internalOnce = internalEv.once.bind(internalEv); plotObj._removeInternalListener = internalEv.removeListener.bind(internalEv); plotObj._removeAllInternalListeners = internalEv.removeAllListeners.bind(internalEv); plotObj.emit = function(event, data) { if (typeof jQuery !== "undefined") { jQuery(plotObj).trigger(event, data); } ev2.emit(event, data); internalEv.emit(event, data); }; return plotObj; }, /* * This function behaves like jQuery's triggerHandler. It calls * all handlers for a particular event and returns the return value * of the LAST handler. This function also triggers jQuery's * triggerHandler for backwards compatibility. */ triggerHandler: function(plotObj, event, data) { var jQueryHandlerValue; var nodeEventHandlerValue; if (typeof jQuery !== "undefined") { jQueryHandlerValue = jQuery(plotObj).triggerHandler(event, data); } var ev2 = plotObj._ev; if (!ev2) return jQueryHandlerValue; var handlers = ev2._events[event]; if (!handlers) return jQueryHandlerValue; function apply(handler) { if (handler.listener) { ev2.removeListener(event, handler.listener); if (!handler.fired) { handler.fired = true; return handler.listener.apply(ev2, [data]); } } else { return handler.apply(ev2, [data]); } } handlers = Array.isArray(handlers) ? handlers : [handlers]; var i; for (i = 0; i < handlers.length - 1; i++) { apply(handlers[i]); } nodeEventHandlerValue = apply(handlers[i]); return jQueryHandlerValue !== void 0 ? jQueryHandlerValue : nodeEventHandlerValue; }, purge: function(plotObj) { delete plotObj._ev; delete plotObj.on; delete plotObj.once; delete plotObj.removeListener; delete plotObj.removeAllListeners; delete plotObj.emit; delete plotObj._ev; delete plotObj._internalEv; delete plotObj._internalOn; delete plotObj._internalOnce; delete plotObj._removeInternalListener; delete plotObj._removeAllInternalListeners; return plotObj; } }; module2.exports = Events; } }); // node_modules/plotly.js/src/lib/queue.js var require_queue = __commonJS({ "node_modules/plotly.js/src/lib/queue.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var dfltConfig = require_plot_config().dfltConfig; function copyArgArray(gd2, args) { var copy = []; var arg; for (var i = 0; i < args.length; i++) { arg = args[i]; if (arg === gd2) copy[i] = arg; else if (typeof arg === "object") { copy[i] = Array.isArray(arg) ? Lib.extendDeep([], arg) : Lib.extendDeepAll({}, arg); } else copy[i] = arg; } return copy; } var queue = {}; queue.add = function(gd2, undoFunc, undoArgs, redoFunc, redoArgs) { var queueObj, queueIndex; gd2.undoQueue = gd2.undoQueue || { index: 0, queue: [], sequence: false }; queueIndex = gd2.undoQueue.index; if (gd2.autoplay) { if (!gd2.undoQueue.inSequence) gd2.autoplay = false; return; } if (!gd2.undoQueue.sequence || gd2.undoQueue.beginSequence) { queueObj = { undo: { calls: [], args: [] }, redo: { calls: [], args: [] } }; gd2.undoQueue.queue.splice(queueIndex, gd2.undoQueue.queue.length - queueIndex, queueObj); gd2.undoQueue.index += 1; } else { queueObj = gd2.undoQueue.queue[queueIndex - 1]; } gd2.undoQueue.beginSequence = false; if (queueObj) { queueObj.undo.calls.unshift(undoFunc); queueObj.undo.args.unshift(undoArgs); queueObj.redo.calls.push(redoFunc); queueObj.redo.args.push(redoArgs); } if (gd2.undoQueue.queue.length > dfltConfig.queueLength) { gd2.undoQueue.queue.shift(); gd2.undoQueue.index--; } }; queue.startSequence = function(gd2) { gd2.undoQueue = gd2.undoQueue || { index: 0, queue: [], sequence: false }; gd2.undoQueue.sequence = true; gd2.undoQueue.beginSequence = true; }; queue.stopSequence = function(gd2) { gd2.undoQueue = gd2.undoQueue || { index: 0, queue: [], sequence: false }; gd2.undoQueue.sequence = false; gd2.undoQueue.beginSequence = false; }; queue.undo = function undo(gd2) { var queueObj, i; if (gd2.undoQueue === void 0 || isNaN(gd2.undoQueue.index) || gd2.undoQueue.index <= 0) { return; } gd2.undoQueue.index--; queueObj = gd2.undoQueue.queue[gd2.undoQueue.index]; gd2.undoQueue.inSequence = true; for (i = 0; i < queueObj.undo.calls.length; i++) { queue.plotDo(gd2, queueObj.undo.calls[i], queueObj.undo.args[i]); } gd2.undoQueue.inSequence = false; gd2.autoplay = false; }; queue.redo = function redo(gd2) { var queueObj, i; if (gd2.undoQueue === void 0 || isNaN(gd2.undoQueue.index) || gd2.undoQueue.index >= gd2.undoQueue.queue.length) { return; } queueObj = gd2.undoQueue.queue[gd2.undoQueue.index]; gd2.undoQueue.inSequence = true; for (i = 0; i < queueObj.redo.calls.length; i++) { queue.plotDo(gd2, queueObj.redo.calls[i], queueObj.redo.args[i]); } gd2.undoQueue.inSequence = false; gd2.autoplay = false; gd2.undoQueue.index++; }; queue.plotDo = function(gd2, func, args) { gd2.autoplay = true; args = copyArgArray(gd2, args); func.apply(null, args); }; module2.exports = queue; } }); // node_modules/plotly.js/src/plots/frame_attributes.js var require_frame_attributes = __commonJS({ "node_modules/plotly.js/src/plots/frame_attributes.js"(exports2, module2) { "use strict"; module2.exports = { _isLinkedToArray: "frames_entry", group: { valType: "string", description: [ "An identifier that specifies the group to which the frame belongs,", "used by animate to select a subset of frames." ].join(" ") }, name: { valType: "string", description: "A label by which to identify the frame" }, traces: { valType: "any", description: [ "A list of trace indices that identify the respective traces in the", "data attribute" ].join(" ") }, baseframe: { valType: "string", description: [ "The name of the frame into which this frame's properties are merged", "before applying. This is used to unify properties and avoid needing", "to specify the same values for the same properties in multiple frames." ].join(" ") }, data: { valType: "any", description: [ "A list of traces this frame modifies. The format is identical to the", "normal trace definition." ].join(" ") }, layout: { valType: "any", description: [ "Layout properties which this frame modifies. The format is identical", "to the normal layout definition." ].join(" ") } }; } }); // node_modules/plotly.js/src/plot_api/plot_schema.js var require_plot_schema = __commonJS({ "node_modules/plotly.js/src/plot_api/plot_schema.js"(exports2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var baseAttributes = require_attributes2(); var baseLayoutAttributes = require_layout_attributes2(); var frameAttributes = require_frame_attributes(); var animationAttributes = require_animation_attributes(); var configAttributes = require_plot_config().configAttributes; var editTypes = require_edit_types(); var extendDeepAll = Lib.extendDeepAll; var isPlainObject = Lib.isPlainObject; var isArrayOrTypedArray = Lib.isArrayOrTypedArray; var nestedProperty = Lib.nestedProperty; var valObjectMeta = Lib.valObjectMeta; var IS_SUBPLOT_OBJ = "_isSubplotObj"; var IS_LINKED_TO_ARRAY = "_isLinkedToArray"; var ARRAY_ATTR_REGEXPS = "_arrayAttrRegexps"; var DEPRECATED = "_deprecated"; var UNDERSCORE_ATTRS = [IS_SUBPLOT_OBJ, IS_LINKED_TO_ARRAY, ARRAY_ATTR_REGEXPS, DEPRECATED]; exports2.IS_SUBPLOT_OBJ = IS_SUBPLOT_OBJ; exports2.IS_LINKED_TO_ARRAY = IS_LINKED_TO_ARRAY; exports2.DEPRECATED = DEPRECATED; exports2.UNDERSCORE_ATTRS = UNDERSCORE_ATTRS; exports2.get = function() { var traces = {}; Registry.allTypes.forEach(function(type) { traces[type] = getTraceAttributes(type); }); var transforms = {}; Object.keys(Registry.transformsRegistry).forEach(function(type) { transforms[type] = getTransformAttributes(type); }); return { defs: { valObjects: valObjectMeta, metaKeys: UNDERSCORE_ATTRS.concat(["description", "role", "editType", "impliedEdits"]), editType: { traces: editTypes.traces, layout: editTypes.layout }, impliedEdits: { description: [ "Sometimes when an attribute is changed, other attributes", "must be altered as well in order to achieve the intended", "result. For example, when `range` is specified, it is", "important to set `autorange` to `false` or the new `range`", "value would be lost in the redraw. `impliedEdits` is the", "mechanism to do this: `impliedEdits: {autorange: false}`.", "Each key is a relative paths to the attribute string to", "change, using *^* to ascend into the parent container,", "for example `range[0]` has `impliedEdits: {*^autorange*: false}`.", "A value of `undefined` means that the attribute will not be", "changed, but its previous value should be recorded in case", "we want to reverse this change later. For example, `autorange`", "has `impliedEdits: {*range[0]*: undefined, *range[1]*:undefined}", "because the range will likely be changed by redraw." ].join(" ") } }, traces, layout: getLayoutAttributes(), transforms, frames: getFramesAttributes(), animation: formatAttributes(animationAttributes), config: formatAttributes(configAttributes) }; }; exports2.crawl = function(attrs, callback, specifiedLevel, attrString) { var level = specifiedLevel || 0; attrString = attrString || ""; Object.keys(attrs).forEach(function(attrName) { var attr = attrs[attrName]; if (UNDERSCORE_ATTRS.indexOf(attrName) !== -1) return; var fullAttrString = (attrString ? attrString + "." : "") + attrName; callback(attr, attrName, attrs, level, fullAttrString); if (exports2.isValObject(attr)) return; if (isPlainObject(attr) && attrName !== "impliedEdits") { exports2.crawl(attr, callback, level + 1, fullAttrString); } }); }; exports2.isValObject = function(obj) { return obj && obj.valType !== void 0; }; exports2.findArrayAttributes = function(trace) { var arrayAttributes = []; var stack = []; var isArrayStack = []; var baseContainer, baseAttrName; function callback(attr, attrName, attrs, level) { stack = stack.slice(0, level).concat([attrName]); isArrayStack = isArrayStack.slice(0, level).concat([attr && attr._isLinkedToArray]); var splittableAttr = attr && (attr.valType === "data_array" || attr.arrayOk === true) && !(stack[level - 1] === "colorbar" && (attrName === "ticktext" || attrName === "tickvals")); if (!splittableAttr) return; crawlIntoTrace(baseContainer, 0, ""); } function crawlIntoTrace(container, i2, astrPartial) { var item = container[stack[i2]]; var newAstrPartial = astrPartial + stack[i2]; if (i2 === stack.length - 1) { if (isArrayOrTypedArray(item)) { arrayAttributes.push(baseAttrName + newAstrPartial); } } else { if (isArrayStack[i2]) { if (Array.isArray(item)) { for (var j = 0; j < item.length; j++) { if (isPlainObject(item[j])) { crawlIntoTrace(item[j], i2 + 1, newAstrPartial + "[" + j + "]."); } } } } else if (isPlainObject(item)) { crawlIntoTrace(item, i2 + 1, newAstrPartial + "."); } } } baseContainer = trace; baseAttrName = ""; exports2.crawl(baseAttributes, callback); if (trace._module && trace._module.attributes) { exports2.crawl(trace._module.attributes, callback); } var transforms = trace.transforms; if (transforms) { for (var i = 0; i < transforms.length; i++) { var transform = transforms[i]; var module3 = transform._module; if (module3) { baseAttrName = "transforms[" + i + "]."; baseContainer = transform; exports2.crawl(module3.attributes, callback); } } } return arrayAttributes; }; exports2.getTraceValObject = function(trace, parts) { var head = parts[0]; var i = 1; var moduleAttrs, valObject; if (head === "transforms") { if (parts.length === 1) { return baseAttributes.transforms; } var transforms = trace.transforms; if (!Array.isArray(transforms) || !transforms.length) return false; var tNum = parts[1]; if (!isIndex(tNum) || tNum >= transforms.length) { return false; } moduleAttrs = (Registry.transformsRegistry[transforms[tNum].type] || {}).attributes; valObject = moduleAttrs && moduleAttrs[parts[2]]; i = 3; } else { var _module = trace._module; if (!_module) _module = (Registry.modules[trace.type || baseAttributes.type.dflt] || {})._module; if (!_module) return false; moduleAttrs = _module.attributes; valObject = moduleAttrs && moduleAttrs[head]; if (!valObject) { var subplotModule = _module.basePlotModule; if (subplotModule && subplotModule.attributes) { valObject = subplotModule.attributes[head]; } } if (!valObject) valObject = baseAttributes[head]; } return recurseIntoValObject(valObject, parts, i); }; exports2.getLayoutValObject = function(fullLayout, parts) { var valObject = layoutHeadAttr(fullLayout, parts[0]); return recurseIntoValObject(valObject, parts, 1); }; function layoutHeadAttr(fullLayout, head) { var i, key, _module, attributes; var basePlotModules = fullLayout._basePlotModules; if (basePlotModules) { var out; for (i = 0; i < basePlotModules.length; i++) { _module = basePlotModules[i]; if (_module.attrRegex && _module.attrRegex.test(head)) { if (_module.layoutAttrOverrides) return _module.layoutAttrOverrides; if (!out && _module.layoutAttributes) out = _module.layoutAttributes; } var baseOverrides = _module.baseLayoutAttrOverrides; if (baseOverrides && head in baseOverrides) return baseOverrides[head]; } if (out) return out; } var modules = fullLayout._modules; if (modules) { for (i = 0; i < modules.length; i++) { attributes = modules[i].layoutAttributes; if (attributes && head in attributes) { return attributes[head]; } } } for (key in Registry.componentsRegistry) { _module = Registry.componentsRegistry[key]; if (_module.name === "colorscale" && head.indexOf("coloraxis") === 0) { return _module.layoutAttributes[head]; } else if (!_module.schema && head === _module.name) { return _module.layoutAttributes; } } if (head in baseLayoutAttributes) return baseLayoutAttributes[head]; return false; } function recurseIntoValObject(valObject, parts, i) { if (!valObject) return false; if (valObject._isLinkedToArray) { if (isIndex(parts[i])) i++; else if (i < parts.length) return false; } for (; i < parts.length; i++) { var newValObject = valObject[parts[i]]; if (isPlainObject(newValObject)) valObject = newValObject; else break; if (i === parts.length - 1) break; if (valObject._isLinkedToArray) { i++; if (!isIndex(parts[i])) return false; } else if (valObject.valType === "info_array") { i++; var index = parts[i]; if (!isIndex(index)) return false; var items = valObject.items; if (Array.isArray(items)) { if (index >= items.length) return false; if (valObject.dimensions === 2) { i++; if (parts.length === i) return valObject; var index2 = parts[i]; if (!isIndex(index2)) return false; valObject = items[index][index2]; } else valObject = items[index]; } else { valObject = items; } } } return valObject; } function isIndex(val) { return val === Math.round(val) && val >= 0; } function getTraceAttributes(type) { var _module, basePlotModule; _module = Registry.modules[type]._module, basePlotModule = _module.basePlotModule; var attributes = {}; attributes.type = null; var copyBaseAttributes = extendDeepAll({}, baseAttributes); var copyModuleAttributes = extendDeepAll({}, _module.attributes); exports2.crawl(copyModuleAttributes, function(attr, attrName, attrs, level, fullAttrString) { nestedProperty(copyBaseAttributes, fullAttrString).set(void 0); if (attr === void 0) nestedProperty(copyModuleAttributes, fullAttrString).set(void 0); }); extendDeepAll(attributes, copyBaseAttributes); if (Registry.traceIs(type, "noOpacity")) { delete attributes.opacity; } if (!Registry.traceIs(type, "showLegend")) { delete attributes.showlegend; delete attributes.legendgroup; } if (Registry.traceIs(type, "noHover")) { delete attributes.hoverinfo; delete attributes.hoverlabel; } if (!_module.selectPoints) { delete attributes.selectedpoints; } extendDeepAll(attributes, copyModuleAttributes); if (basePlotModule.attributes) { extendDeepAll(attributes, basePlotModule.attributes); } attributes.type = type; var out = { meta: _module.meta || {}, categories: _module.categories || {}, animatable: Boolean(_module.animatable), type, attributes: formatAttributes(attributes) }; if (_module.layoutAttributes) { var layoutAttributes = {}; extendDeepAll(layoutAttributes, _module.layoutAttributes); out.layoutAttributes = formatAttributes(layoutAttributes); } if (!_module.animatable) { exports2.crawl(out, function(attr) { if (exports2.isValObject(attr) && "anim" in attr) { delete attr.anim; } }); } return out; } function getLayoutAttributes() { var layoutAttributes = {}; var key, _module; extendDeepAll(layoutAttributes, baseLayoutAttributes); for (key in Registry.subplotsRegistry) { _module = Registry.subplotsRegistry[key]; if (!_module.layoutAttributes) continue; if (Array.isArray(_module.attr)) { for (var i = 0; i < _module.attr.length; i++) { handleBasePlotModule(layoutAttributes, _module, _module.attr[i]); } } else { var astr = _module.attr === "subplot" ? _module.name : _module.attr; handleBasePlotModule(layoutAttributes, _module, astr); } } for (key in Registry.componentsRegistry) { _module = Registry.componentsRegistry[key]; var schema = _module.schema; if (schema && (schema.subplots || schema.layout)) { var subplots = schema.subplots; if (subplots && subplots.xaxis && !subplots.yaxis) { for (var xkey in subplots.xaxis) { delete layoutAttributes.yaxis[xkey]; } } delete layoutAttributes.xaxis.shift; delete layoutAttributes.xaxis.autoshift; } else if (_module.name === "colorscale") { extendDeepAll(layoutAttributes, _module.layoutAttributes); } else if (_module.layoutAttributes) { insertAttrs(layoutAttributes, _module.layoutAttributes, _module.name); } } return { layoutAttributes: formatAttributes(layoutAttributes) }; } function getTransformAttributes(type) { var _module = Registry.transformsRegistry[type]; var attributes = extendDeepAll({}, _module.attributes); Object.keys(Registry.componentsRegistry).forEach(function(k) { var _module2 = Registry.componentsRegistry[k]; if (_module2.schema && _module2.schema.transforms && _module2.schema.transforms[type]) { Object.keys(_module2.schema.transforms[type]).forEach(function(v) { insertAttrs(attributes, _module2.schema.transforms[type][v], v); }); } }); return { attributes: formatAttributes(attributes) }; } function getFramesAttributes() { var attrs = { frames: extendDeepAll({}, frameAttributes) }; formatAttributes(attrs); return attrs.frames; } function formatAttributes(attrs) { mergeValTypeAndRole(attrs); formatArrayContainers(attrs); stringify(attrs); return attrs; } function mergeValTypeAndRole(attrs) { function makeSrcAttr(attrName) { return { valType: "string", description: "Sets the source reference on Chart Studio Cloud for `" + attrName + "`.", editType: "none" }; } function callback(attr, attrName, attrs2) { if (exports2.isValObject(attr)) { if (attr.arrayOk === true || attr.valType === "data_array") { attrs2[attrName + "src"] = makeSrcAttr(attrName); } } else if (isPlainObject(attr)) { attr.role = "object"; } } exports2.crawl(attrs, callback); } function formatArrayContainers(attrs) { function callback(attr, attrName, attrs2) { if (!attr) return; var itemName = attr[IS_LINKED_TO_ARRAY]; if (!itemName) return; delete attr[IS_LINKED_TO_ARRAY]; attrs2[attrName] = { items: {} }; attrs2[attrName].items[itemName] = attr; attrs2[attrName].role = "object"; } exports2.crawl(attrs, callback); } function stringify(attrs) { function walk(attr) { for (var k in attr) { if (isPlainObject(attr[k])) { walk(attr[k]); } else if (Array.isArray(attr[k])) { for (var i = 0; i < attr[k].length; i++) { walk(attr[k][i]); } } else { if (attr[k] instanceof RegExp) { attr[k] = attr[k].toString(); } } } } walk(attrs); } function handleBasePlotModule(layoutAttributes, _module, astr) { var np2 = nestedProperty(layoutAttributes, astr); var attrs = extendDeepAll({}, _module.layoutAttributes); attrs[IS_SUBPLOT_OBJ] = true; np2.set(attrs); } function insertAttrs(baseAttrs, newAttrs, astr) { var np2 = nestedProperty(baseAttrs, astr); np2.set(extendDeepAll(np2.get() || {}, newAttrs)); } } }); // node_modules/plotly.js/src/plot_api/plot_template.js var require_plot_template = __commonJS({ "node_modules/plotly.js/src/plot_api/plot_template.js"(exports2) { "use strict"; var Lib = require_lib(); var plotAttributes = require_attributes2(); var TEMPLATEITEMNAME = "templateitemname"; var templateAttrs = { name: { valType: "string", editType: "none", description: [ "When used in a template, named items are created in the output figure", "in addition to any items the figure already has in this array.", "You can modify these items in the output figure by making your own", "item with `templateitemname` matching this `name`", "alongside your modifications (including `visible: false` or", "`enabled: false` to hide it).", "Has no effect outside of a template." ].join(" ") } }; templateAttrs[TEMPLATEITEMNAME] = { valType: "string", editType: "calc", description: [ "Used to refer to a named item in this array in the template. Named", "items from the template will be created even without a matching item", "in the input figure, but you can modify one by making an item with", "`templateitemname` matching its `name`, alongside your modifications", "(including `visible: false` or `enabled: false` to hide it).", "If there is no template or no matching item, this item will be", "hidden unless you explicitly show it with `visible: true`." ].join(" ") }; exports2.templatedArray = function(name, attrs) { attrs._isLinkedToArray = name; attrs.name = templateAttrs.name; attrs[TEMPLATEITEMNAME] = templateAttrs[TEMPLATEITEMNAME]; return attrs; }; exports2.traceTemplater = function(dataTemplate) { var traceCounts = {}; var traceType, typeTemplates; for (traceType in dataTemplate) { typeTemplates = dataTemplate[traceType]; if (Array.isArray(typeTemplates) && typeTemplates.length) { traceCounts[traceType] = 0; } } function newTrace(traceIn) { traceType = Lib.coerce(traceIn, {}, plotAttributes, "type"); var traceOut = { type: traceType, _template: null }; if (traceType in traceCounts) { typeTemplates = dataTemplate[traceType]; var typei = traceCounts[traceType] % typeTemplates.length; traceCounts[traceType]++; traceOut._template = typeTemplates[typei]; } else { } return traceOut; } return { newTrace // TODO: function to figure out what's left & what didn't work }; }; exports2.newContainer = function(container, name, baseName) { var template = container._template; var part = template && (template[name] || baseName && template[baseName]); if (!Lib.isPlainObject(part)) part = null; var out = container[name] = { _template: part }; return out; }; exports2.arrayTemplater = function(container, name, inclusionAttr) { var template = container._template; var defaultsTemplate = template && template[arrayDefaultKey(name)]; var templateItems = template && template[name]; if (!Array.isArray(templateItems) || !templateItems.length) { templateItems = []; } var usedNames = {}; function newItem(itemIn) { var out = { name: itemIn.name, _input: itemIn }; var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME]; if (!validItemName(templateItemName)) { out._template = defaultsTemplate; return out; } for (var i = 0; i < templateItems.length; i++) { var templateItem = templateItems[i]; if (templateItem.name === templateItemName) { usedNames[templateItemName] = 1; out._template = templateItem; return out; } } out[inclusionAttr] = itemIn[inclusionAttr] || false; out._template = false; return out; } function defaultItems() { var out = []; for (var i = 0; i < templateItems.length; i++) { var templateItem = templateItems[i]; var name2 = templateItem.name; if (validItemName(name2) && !usedNames[name2]) { var outi = { _template: templateItem, name: name2, _input: { _templateitemname: name2 } }; outi[TEMPLATEITEMNAME] = templateItem[TEMPLATEITEMNAME]; out.push(outi); usedNames[name2] = 1; } } return out; } return { newItem, defaultItems }; }; function validItemName(name) { return name && typeof name === "string"; } function arrayDefaultKey(name) { var lastChar = name.length - 1; if (name.charAt(lastChar) !== "s") { Lib.warn("bad argument to arrayDefaultKey: " + name); } return name.substr(0, name.length - 1) + "defaults"; } exports2.arrayDefaultKey = arrayDefaultKey; exports2.arrayEditor = function(parentIn, containerStr, itemOut) { var lengthIn = (Lib.nestedProperty(parentIn, containerStr).get() || []).length; var index = itemOut._index; var templateItemName = index >= lengthIn && (itemOut._input || {})._templateitemname; if (templateItemName) index = lengthIn; var itemStr = containerStr + "[" + index + "]"; var update; function resetUpdate() { update = {}; if (templateItemName) { update[itemStr] = {}; update[itemStr][TEMPLATEITEMNAME] = templateItemName; } } resetUpdate(); function modifyBase(attr, value) { update[attr] = value; } function modifyItem(attr, value) { if (templateItemName) { Lib.nestedProperty(update[itemStr], attr).set(value); } else { update[itemStr + "." + attr] = value; } } function getUpdateObj() { var updateOut = update; resetUpdate(); return updateOut; } function applyUpdate(attr, value) { if (attr) modifyItem(attr, value); var updateToApply = getUpdateObj(); for (var key in updateToApply) { Lib.nestedProperty(parentIn, key).set(updateToApply[key]); } } return { modifyBase, modifyItem, getUpdateObj, applyUpdate }; }; } }); // node_modules/plotly.js/src/plots/cartesian/constants.js var require_constants2 = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/constants.js"(exports2, module2) { "use strict"; var counterRegex = require_regex().counter; module2.exports = { idRegex: { x: counterRegex("x", "( domain)?"), y: counterRegex("y", "( domain)?") }, attrRegex: counterRegex("[xy]axis"), // axis match regular expression xAxisMatch: counterRegex("xaxis"), yAxisMatch: counterRegex("yaxis"), // pattern matching axis ids and names // note that this is more permissive than counterRegex, as // id2name, name2id, and cleanId accept "x1" etc AX_ID_PATTERN: /^[xyz][0-9]*( domain)?$/, AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/, // and for 2D subplots SUBPLOT_PATTERN: /^x([0-9]*)y([0-9]*)$/, HOUR_PATTERN: "hour", WEEKDAY_PATTERN: "day of week", // pixels to move mouse before you stop clamping to starting point MINDRAG: 8, // smallest dimension allowed for a zoombox MINZOOM: 20, // width of axis drag regions DRAGGERSIZE: 20, // delay before a redraw (relayout) after smooth panning and zooming REDRAWDELAY: 50, // last resort axis ranges for x and y axes if we have no data DFLTRANGEX: [-1, 6], DFLTRANGEY: [-1, 4], // Layers to keep trace types in the right order // N.B. each 'unique' plot method must have its own layer traceLayerClasses: [ "imagelayer", "heatmaplayer", "contourcarpetlayer", "contourlayer", "funnellayer", "waterfalllayer", "barlayer", "carpetlayer", "violinlayer", "boxlayer", "ohlclayer", "scattercarpetlayer", "scatterlayer" ], clipOnAxisFalseQuery: [ ".scatterlayer", ".barlayer", ".funnellayer", ".waterfalllayer" ], layerValue2layerClass: { "above traces": "above", "below traces": "below" }, zindexSeparator: "z" // used for zindex of cartesian subplots e.g. xy, xyz2, xyz3, etc. }; } }); // node_modules/plotly.js/src/plots/cartesian/axis_ids.js var require_axis_ids = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/axis_ids.js"(exports2) { "use strict"; var Registry = require_registry(); var constants = require_constants2(); exports2.id2name = function id2name(id2) { if (typeof id2 !== "string" || !id2.match(constants.AX_ID_PATTERN)) return; var axNum = id2.split(" ")[0].substr(1); if (axNum === "1") axNum = ""; return id2.charAt(0) + "axis" + axNum; }; exports2.name2id = function name2id(name) { if (!name.match(constants.AX_NAME_PATTERN)) return; var axNum = name.substr(5); if (axNum === "1") axNum = ""; return name.charAt(0) + axNum; }; exports2.cleanId = function cleanId(id2, axLetter, domainId) { var domainTest = /( domain)$/.test(id2); if (typeof id2 !== "string" || !id2.match(constants.AX_ID_PATTERN)) return; if (axLetter && id2.charAt(0) !== axLetter) return; if (domainTest && !domainId) return; var axNum = id2.split(" ")[0].substr(1).replace(/^0+/, ""); if (axNum === "1") axNum = ""; return id2.charAt(0) + axNum + (domainTest && domainId ? " domain" : ""); }; exports2.list = function(gd2, axLetter, only2d) { var fullLayout = gd2._fullLayout; if (!fullLayout) return []; var idList = exports2.listIds(gd2, axLetter); var out = new Array(idList.length); var i; for (i = 0; i < idList.length; i++) { var idi = idList[i]; out[i] = fullLayout[idi.charAt(0) + "axis" + idi.substr(1)]; } if (!only2d) { var sceneIds3D = fullLayout._subplots.gl3d || []; for (i = 0; i < sceneIds3D.length; i++) { var scene = fullLayout[sceneIds3D[i]]; if (axLetter) out.push(scene[axLetter + "axis"]); else out.push(scene.xaxis, scene.yaxis, scene.zaxis); } } return out; }; exports2.listIds = function(gd2, axLetter) { var fullLayout = gd2._fullLayout; if (!fullLayout) return []; var subplotLists = fullLayout._subplots; if (axLetter) return subplotLists[axLetter + "axis"]; return subplotLists.xaxis.concat(subplotLists.yaxis); }; exports2.getFromId = function(gd2, id2, type) { var fullLayout = gd2._fullLayout; id2 = id2 === void 0 || typeof id2 !== "string" ? id2 : id2.replace(" domain", ""); if (type === "x") id2 = id2.replace(/y[0-9]*/, ""); else if (type === "y") id2 = id2.replace(/x[0-9]*/, ""); return fullLayout[exports2.id2name(id2)]; }; exports2.getFromTrace = function(gd2, fullTrace, type) { var fullLayout = gd2._fullLayout; var ax = null; if (Registry.traceIs(fullTrace, "gl3d")) { var scene = fullTrace.scene; if (scene.substr(0, 5) === "scene") { ax = fullLayout[scene][type + "axis"]; } } else { ax = exports2.getFromId(gd2, fullTrace[type + "axis"] || type); } return ax; }; exports2.idSort = function(id1, id2) { var letter1 = id1.charAt(0); var letter2 = id2.charAt(0); if (letter1 !== letter2) return letter1 > letter2 ? 1 : -1; return +(id1.substr(1) || 1) - +(id2.substr(1) || 1); }; exports2.ref2id = function(ar2) { return /^[xyz]/.test(ar2) ? ar2.split(" ")[0] : false; }; function isFound(axId, list) { if (list && list.length) { for (var i = 0; i < list.length; i++) { if (list[i][axId]) return true; } } return false; } exports2.isLinked = function(fullLayout, axId) { return isFound(axId, fullLayout._axisMatchGroups) || isFound(axId, fullLayout._axisConstraintGroups); }; } }); // node_modules/plotly.js/src/components/shapes/handle_outline.js var require_handle_outline = __commonJS({ "node_modules/plotly.js/src/components/shapes/handle_outline.js"(exports2, module2) { "use strict"; function clearOutlineControllers(gd2) { var zoomLayer = gd2._fullLayout._zoomlayer; if (zoomLayer) { zoomLayer.selectAll(".outline-controllers").remove(); } } function clearOutline(gd2) { var zoomLayer = gd2._fullLayout._zoomlayer; if (zoomLayer) { zoomLayer.selectAll(".select-outline").remove(); } gd2._fullLayout._outlining = false; } module2.exports = { clearOutlineControllers, clearOutline }; } }); // node_modules/plotly.js/src/traces/scatter/layout_attributes.js var require_layout_attributes3 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/layout_attributes.js"(exports2, module2) { "use strict"; module2.exports = { scattermode: { valType: "enumerated", values: ["group", "overlay"], dflt: "overlay", editType: "calc", description: [ "Determines how scatter points at the same location coordinate", "are displayed on the graph.", "With *group*, the scatter points are plotted next to one another", "centered around the shared location.", "With *overlay*, the scatter points are plotted over one another,", "you might need to reduce *opacity* to see multiple scatter points." ].join(" ") }, scattergap: { valType: "number", min: 0, max: 1, editType: "calc", description: [ "Sets the gap (in plot fraction) between scatter points of", "adjacent location coordinates.", "Defaults to `bargap`." ].join(" ") } }; } }); // node_modules/plotly.js/src/plots/get_data.js var require_get_data = __commonJS({ "node_modules/plotly.js/src/plots/get_data.js"(exports2) { "use strict"; var Registry = require_registry(); var SUBPLOT_PATTERN = require_constants2().SUBPLOT_PATTERN; exports2.getSubplotCalcData = function(calcData, type, subplotId) { var basePlotModule = Registry.subplotsRegistry[type]; if (!basePlotModule) return []; var attr = basePlotModule.attr; var subplotCalcData = []; for (var i = 0; i < calcData.length; i++) { var calcTrace = calcData[i]; var trace = calcTrace[0].trace; if (trace[attr] === subplotId) subplotCalcData.push(calcTrace); } return subplotCalcData; }; exports2.getModuleCalcData = function(calcdata, arg1, arg2) { var moduleCalcData = []; var remainingCalcData = []; var plotMethod; if (typeof arg1 === "string") { plotMethod = Registry.getModule(arg1).plot; } else if (typeof arg1 === "function") { plotMethod = arg1; } else { plotMethod = arg1.plot; } if (!plotMethod) { return [moduleCalcData, calcdata]; } var zorder = arg2; for (var i = 0; i < calcdata.length; i++) { var cd2 = calcdata[i]; var trace = cd2[0].trace; var filterByZ = trace.zorder !== void 0; if (trace.visible !== true || trace._length === 0) continue; if (trace._module && trace._module.plot === plotMethod && (!filterByZ || trace.zorder === zorder)) { moduleCalcData.push(cd2); } else { remainingCalcData.push(cd2); } } return [moduleCalcData, remainingCalcData]; }; exports2.getSubplotData = function getSubplotData(data, type, subplotId) { if (!Registry.subplotsRegistry[type]) return []; var attr = Registry.subplotsRegistry[type].attr; var subplotData = []; var trace, subplotX, subplotY; if (type === "gl2d") { var spmatch = subplotId.match(SUBPLOT_PATTERN); subplotX = "x" + spmatch[1]; subplotY = "y" + spmatch[2]; } for (var i = 0; i < data.length; i++) { trace = data[i]; if (type === "gl2d" && Registry.traceIs(trace, "gl2d")) { if (trace[attr[0]] === subplotX && trace[attr[1]] === subplotY) { subplotData.push(trace); } } else { if (trace[attr] === subplotId) subplotData.push(trace); } } return subplotData; }; } }); // node_modules/plotly.js/src/plots/command.js var require_command = __commonJS({ "node_modules/plotly.js/src/plots/command.js"(exports2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); exports2.manageCommandObserver = function(gd2, container, commandList, onchange) { var ret = {}; var enabled = true; if (container && container._commandObserver) { ret = container._commandObserver; } if (!ret.cache) { ret.cache = {}; } ret.lookupTable = {}; var binding = exports2.hasSimpleAPICommandBindings(gd2, commandList, ret.lookupTable); if (container && container._commandObserver) { if (!binding) { if (container._commandObserver.remove) { container._commandObserver.remove(); container._commandObserver = null; return ret; } } else { return ret; } } if (binding) { bindingValueHasChanged(gd2, binding, ret.cache); ret.check = function check() { if (!enabled) return; var update = bindingValueHasChanged(gd2, binding, ret.cache); if (update.changed && onchange) { if (ret.lookupTable[update.value] !== void 0) { ret.disable(); Promise.resolve(onchange({ value: update.value, type: binding.type, prop: binding.prop, traces: binding.traces, index: ret.lookupTable[update.value] })).then(ret.enable, ret.enable); } } return update.changed; }; var checkEvents = [ "plotly_relayout", "plotly_redraw", "plotly_restyle", "plotly_update", "plotly_animatingframe", "plotly_afterplot" ]; for (var i = 0; i < checkEvents.length; i++) { gd2._internalOn(checkEvents[i], ret.check); } ret.remove = function() { for (var i2 = 0; i2 < checkEvents.length; i2++) { gd2._removeInternalListener(checkEvents[i2], ret.check); } }; } else { Lib.log("Unable to automatically bind plot updates to API command"); ret.lookupTable = {}; ret.remove = function() { }; } ret.disable = function disable() { enabled = false; }; ret.enable = function enable() { enabled = true; }; if (container) { container._commandObserver = ret; } return ret; }; exports2.hasSimpleAPICommandBindings = function(gd2, commandList, bindingsByValue) { var i; var n = commandList.length; var refBinding; for (i = 0; i < n; i++) { var binding; var command = commandList[i]; var method = command.method; var args = command.args; if (!Array.isArray(args)) args = []; if (!method) { return false; } var bindings = exports2.computeAPICommandBindings(gd2, method, args); if (bindings.length !== 1) { return false; } if (!refBinding) { refBinding = bindings[0]; if (Array.isArray(refBinding.traces)) { refBinding.traces.sort(); } } else { binding = bindings[0]; if (binding.type !== refBinding.type) { return false; } if (binding.prop !== refBinding.prop) { return false; } if (Array.isArray(refBinding.traces)) { if (Array.isArray(binding.traces)) { binding.traces.sort(); for (var j = 0; j < refBinding.traces.length; j++) { if (refBinding.traces[j] !== binding.traces[j]) { return false; } } } else { return false; } } else { if (binding.prop !== refBinding.prop) { return false; } } } binding = bindings[0]; var value = binding.value; if (Array.isArray(value)) { if (value.length === 1) { value = value[0]; } else { return false; } } if (bindingsByValue) { bindingsByValue[value] = i; } } return refBinding; }; function bindingValueHasChanged(gd2, binding, cache) { var container, value, obj; var changed = false; if (binding.type === "data") { container = gd2._fullData[binding.traces !== null ? binding.traces[0] : 0]; } else if (binding.type === "layout") { container = gd2._fullLayout; } else { return false; } value = Lib.nestedProperty(container, binding.prop).get(); obj = cache[binding.type] = cache[binding.type] || {}; if (obj.hasOwnProperty(binding.prop)) { if (obj[binding.prop] !== value) { changed = true; } } obj[binding.prop] = value; return { changed, value }; } exports2.executeAPICommand = function(gd2, method, args) { if (method === "skip") return Promise.resolve(); var _method = Registry.apiMethodRegistry[method]; var allArgs = [gd2]; if (!Array.isArray(args)) args = []; for (var i = 0; i < args.length; i++) { allArgs.push(args[i]); } return _method.apply(null, allArgs).catch(function(err) { Lib.warn("API call to Plotly." + method + " rejected.", err); return Promise.reject(err); }); }; exports2.computeAPICommandBindings = function(gd2, method, args) { var bindings; if (!Array.isArray(args)) args = []; switch (method) { case "restyle": bindings = computeDataBindings(gd2, args); break; case "relayout": bindings = computeLayoutBindings(gd2, args); break; case "update": bindings = computeDataBindings(gd2, [args[0], args[2]]).concat(computeLayoutBindings(gd2, [args[1]])); break; case "animate": bindings = computeAnimateBindings(gd2, args); break; default: bindings = []; } return bindings; }; function computeAnimateBindings(gd2, args) { if (Array.isArray(args[0]) && args[0].length === 1 && ["string", "number"].indexOf(typeof args[0][0]) !== -1) { return [{ type: "layout", prop: "_currentFrame", value: args[0][0].toString() }]; } else { return []; } } function computeLayoutBindings(gd2, args) { var bindings = []; var astr = args[0]; var aobj = {}; if (typeof astr === "string") { aobj[astr] = args[1]; } else if (Lib.isPlainObject(astr)) { aobj = astr; } else { return bindings; } crawl(aobj, function(path, attrName, attr) { bindings.push({ type: "layout", prop: path, value: attr }); }, "", 0); return bindings; } function computeDataBindings(gd2, args) { var traces, astr, val, aobj; var bindings = []; astr = args[0]; val = args[1]; traces = args[2]; aobj = {}; if (typeof astr === "string") { aobj[astr] = val; } else if (Lib.isPlainObject(astr)) { aobj = astr; if (traces === void 0) { traces = val; } } else { return bindings; } if (traces === void 0) { traces = null; } crawl(aobj, function(path, attrName, _attr) { var thisTraces; var attr; if (Array.isArray(_attr)) { attr = _attr.slice(); var nAttr = Math.min(attr.length, gd2.data.length); if (traces) { nAttr = Math.min(nAttr, traces.length); } thisTraces = []; for (var j = 0; j < nAttr; j++) { thisTraces[j] = traces ? traces[j] : j; } } else { attr = _attr; thisTraces = traces ? traces.slice() : null; } if (thisTraces === null) { if (Array.isArray(attr)) { attr = attr[0]; } } else if (Array.isArray(thisTraces)) { if (!Array.isArray(attr)) { var tmp = attr; attr = []; for (var i = 0; i < thisTraces.length; i++) { attr[i] = tmp; } } attr.length = Math.min(thisTraces.length, attr.length); } bindings.push({ type: "data", prop: path, traces: thisTraces, value: attr }); }, "", 0); return bindings; } function crawl(attrs, callback, path, depth) { Object.keys(attrs).forEach(function(attrName) { var attr = attrs[attrName]; if (attrName[0] === "_") return; var thisPath = path + (depth > 0 ? "." : "") + attrName; if (Lib.isPlainObject(attr)) { crawl(attr, callback, thisPath, depth + 1); } else { callback(thisPath, attrName, attr); } }); } } }); // node_modules/plotly.js/src/plots/plots.js var require_plots = __commonJS({ "node_modules/plotly.js/src/plots/plots.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var timeFormatLocale = (init_src2(), __toCommonJS(src_exports2)).timeFormatLocale; var formatLocale2 = (init_src3(), __toCommonJS(src_exports3)).formatLocale; var isNumeric = require_fast_isnumeric(); var b64encode = (init_base64_arraybuffer_es5(), __toCommonJS(base64_arraybuffer_es5_exports)); var Registry = require_registry(); var PlotSchema = require_plot_schema(); var Template = require_plot_template(); var Lib = require_lib(); var Color = require_color(); var BADNUM = require_numerical().BADNUM; var axisIDs = require_axis_ids(); var clearOutline = require_handle_outline().clearOutline; var scatterAttrs = require_layout_attributes3(); var animationAttrs = require_animation_attributes(); var frameAttrs = require_frame_attributes(); var getModuleCalcData = require_get_data().getModuleCalcData; var relinkPrivateKeys = Lib.relinkPrivateKeys; var _ = Lib._; var plots = module2.exports = {}; Lib.extendFlat(plots, Registry); plots.attributes = require_attributes2(); plots.attributes.type.values = plots.allTypes; plots.fontAttrs = require_font_attributes(); plots.layoutAttributes = require_layout_attributes2(); var transformsRegistry = plots.transformsRegistry; var commandModule = require_command(); plots.executeAPICommand = commandModule.executeAPICommand; plots.computeAPICommandBindings = commandModule.computeAPICommandBindings; plots.manageCommandObserver = commandModule.manageCommandObserver; plots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings; plots.redrawText = function(gd2) { gd2 = Lib.getGraphDiv(gd2); return new Promise(function(resolve) { setTimeout(function() { if (!gd2._fullLayout) return; Registry.getComponentMethod("annotations", "draw")(gd2); Registry.getComponentMethod("legend", "draw")(gd2); Registry.getComponentMethod("colorbar", "draw")(gd2); resolve(plots.previousPromises(gd2)); }, 300); }); }; plots.resize = function(gd2) { gd2 = Lib.getGraphDiv(gd2); var resolveLastResize; var p = new Promise(function(resolve, reject) { if (!gd2 || Lib.isHidden(gd2)) { reject(new Error("Resize must be passed a displayed plot div element.")); } if (gd2._redrawTimer) clearTimeout(gd2._redrawTimer); if (gd2._resolveResize) resolveLastResize = gd2._resolveResize; gd2._resolveResize = resolve; gd2._redrawTimer = setTimeout(function() { if (!gd2.layout || gd2.layout.width && gd2.layout.height || Lib.isHidden(gd2)) { resolve(gd2); return; } delete gd2.layout.width; delete gd2.layout.height; var oldchanged = gd2.changed; gd2.autoplay = true; Registry.call("relayout", gd2, { autosize: true }).then(function() { gd2.changed = oldchanged; if (gd2._resolveResize === resolve) { delete gd2._resolveResize; resolve(gd2); } }); }, 100); }); if (resolveLastResize) resolveLastResize(p); return p; }; plots.previousPromises = function(gd2) { if ((gd2._promises || []).length) { return Promise.all(gd2._promises).then(function() { gd2._promises = []; }); } }; plots.addLinks = function(gd2) { if (!gd2._context.showLink && !gd2._context.showSources) return; var fullLayout = gd2._fullLayout; var linkContainer = Lib.ensureSingle(fullLayout._paper, "text", "js-plot-link-container", function(s) { s.style({ "font-family": '"Open Sans", Arial, sans-serif', "font-size": "12px", fill: Color.defaultLine, "pointer-events": "all" }).each(function() { var links = d3.select(this); links.append("tspan").classed("js-link-to-tool", true); links.append("tspan").classed("js-link-spacer", true); links.append("tspan").classed("js-sourcelinks", true); }); }); var text = linkContainer.node(); var attrs = { y: fullLayout._paper.attr("height") - 9 }; if (document.body.contains(text) && text.getComputedTextLength() >= fullLayout.width - 20) { attrs["text-anchor"] = "start"; attrs.x = 5; } else { attrs["text-anchor"] = "end"; attrs.x = fullLayout._paper.attr("width") - 7; } linkContainer.attr(attrs); var toolspan = linkContainer.select(".js-link-to-tool"); var spacespan = linkContainer.select(".js-link-spacer"); var sourcespan = linkContainer.select(".js-sourcelinks"); if (gd2._context.showSources) gd2._context.showSources(gd2); if (gd2._context.showLink) positionPlayWithData(gd2, toolspan); spacespan.text(toolspan.text() && sourcespan.text() ? " - " : ""); }; function positionPlayWithData(gd2, container) { container.text(""); var link = container.append("a").attr({ "xlink:xlink:href": "#", class: "link--impt link--embedview", "font-weight": "bold" }).text(gd2._context.linkText + " " + String.fromCharCode(187)); if (gd2._context.sendData) { link.on("click", function() { plots.sendDataToCloud(gd2); }); } else { var path = window.location.pathname.split("/"); var query = window.location.search; link.attr({ "xlink:xlink:show": "new", "xlink:xlink:href": "/" + path[2].split(".")[0] + "/" + path[1] + query }); } } plots.sendDataToCloud = function(gd2) { var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd2._context.plotlyServerURL; if (!baseUrl) return; gd2.emit("plotly_beforeexport"); var hiddenformDiv = d3.select(gd2).append("div").attr("id", "hiddenform").style("display", "none"); var hiddenform = hiddenformDiv.append("form").attr({ action: baseUrl + "/external", method: "post", target: "_blank" }); var hiddenformInput = hiddenform.append("input").attr({ type: "text", name: "data" }); hiddenformInput.node().value = plots.graphJson(gd2, false, "keepdata"); hiddenform.node().submit(); hiddenformDiv.remove(); gd2.emit("plotly_afterexport"); return false; }; var d3FormatKeys = [ "days", "shortDays", "months", "shortMonths", "periods", "dateTime", "date", "time", "decimal", "thousands", "grouping", "currency" ]; var extraFormatKeys = [ "year", "month", "dayMonth", "dayMonthYear" ]; plots.supplyDefaults = function(gd2, opts) { var skipUpdateCalc = opts && opts.skipUpdateCalc; var oldFullLayout = gd2._fullLayout || {}; if (oldFullLayout._skipDefaults) { delete oldFullLayout._skipDefaults; return; } var newFullLayout = gd2._fullLayout = {}; var newLayout = gd2.layout || {}; var oldFullData = gd2._fullData || []; var newFullData = gd2._fullData = []; var newData = gd2.data || []; var oldCalcdata = gd2.calcdata || []; var context = gd2._context || {}; var i; if (!gd2._transitionData) plots.createTransitionData(gd2); newFullLayout._dfltTitle = { plot: _(gd2, "Click to enter Plot title"), subtitle: _(gd2, "Click to enter Plot subtitle"), x: _(gd2, "Click to enter X axis title"), y: _(gd2, "Click to enter Y axis title"), colorbar: _(gd2, "Click to enter Colorscale title"), annotation: _(gd2, "new text") }; newFullLayout._traceWord = _(gd2, "trace"); var formatObj = getFormatObj(gd2, d3FormatKeys); newFullLayout._mapboxAccessToken = context.mapboxAccessToken; if (oldFullLayout._initialAutoSizeIsDone) { var oldWidth = oldFullLayout.width; var oldHeight = oldFullLayout.height; plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); if (!newLayout.width) newFullLayout.width = oldWidth; if (!newLayout.height) newFullLayout.height = oldHeight; plots.sanitizeMargins(newFullLayout); } else { plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj); var missingWidthOrHeight = !newLayout.width || !newLayout.height; var autosize = newFullLayout.autosize; var autosizable = context.autosizable; var initialAutoSize = missingWidthOrHeight && (autosize || autosizable); if (initialAutoSize) plots.plotAutoSize(gd2, newLayout, newFullLayout); else if (missingWidthOrHeight) plots.sanitizeMargins(newFullLayout); if (!autosize && missingWidthOrHeight) { newLayout.width = newFullLayout.width; newLayout.height = newFullLayout.height; } } newFullLayout._d3locale = getFormatter(formatObj, newFullLayout.separators); newFullLayout._extraFormat = getFormatObj(gd2, extraFormatKeys); newFullLayout._initialAutoSizeIsDone = true; newFullLayout._dataLength = newData.length; newFullLayout._modules = []; newFullLayout._visibleModules = []; newFullLayout._basePlotModules = []; var subplots = newFullLayout._subplots = emptySubplotLists(); var splomAxes = newFullLayout._splomAxes = { x: {}, y: {} }; var splomSubplots = newFullLayout._splomSubplots = {}; newFullLayout._splomGridDflt = {}; newFullLayout._scatterStackOpts = {}; newFullLayout._firstScatter = {}; newFullLayout._alignmentOpts = {}; newFullLayout._colorAxes = {}; newFullLayout._requestRangeslider = {}; newFullLayout._traceUids = getTraceUids(oldFullData, newData); newFullLayout._globalTransforms = (gd2._context || {}).globalTransforms; plots.supplyDataDefaults(newData, newFullData, newLayout, newFullLayout); var splomXa = Object.keys(splomAxes.x); var splomYa = Object.keys(splomAxes.y); if (splomXa.length > 1 && splomYa.length > 1) { Registry.getComponentMethod("grid", "sizeDefaults")(newLayout, newFullLayout); for (i = 0; i < splomXa.length; i++) { Lib.pushUnique(subplots.xaxis, splomXa[i]); } for (i = 0; i < splomYa.length; i++) { Lib.pushUnique(subplots.yaxis, splomYa[i]); } for (var k in splomSubplots) { Lib.pushUnique(subplots.cartesian, k); } } newFullLayout._has = plots._hasPlotType.bind(newFullLayout); if (oldFullData.length === newFullData.length) { for (i = 0; i < newFullData.length; i++) { relinkPrivateKeys(newFullData[i], oldFullData[i]); } } plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd2._transitionData); var _modules = newFullLayout._visibleModules; var crossTraceDefaultsFuncs = []; for (i = 0; i < _modules.length; i++) { var funci = _modules[i].crossTraceDefaults; if (funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci); } for (i = 0; i < crossTraceDefaultsFuncs.length; i++) { crossTraceDefaultsFuncs[i](newFullData, newFullLayout); } newFullLayout._hasOnlyLargeSploms = newFullLayout._basePlotModules.length === 1 && newFullLayout._basePlotModules[0].name === "splom" && splomXa.length > 15 && splomYa.length > 15 && newFullLayout.shapes.length === 0 && newFullLayout.images.length === 0; plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout); plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout); var hadGL2D = !!(oldFullLayout._has && oldFullLayout._has("gl2d")); var hasGL2D = !!(newFullLayout._has && newFullLayout._has("gl2d")); var hadCartesian = !!(oldFullLayout._has && oldFullLayout._has("cartesian")); var hasCartesian = !!(newFullLayout._has && newFullLayout._has("cartesian")); var hadBgLayer = hadCartesian || hadGL2D; var hasBgLayer = hasCartesian || hasGL2D; if (hadBgLayer && !hasBgLayer) { oldFullLayout._bgLayer.remove(); } else if (hasBgLayer && !hadBgLayer) { newFullLayout._shouldCreateBgLayer = true; } if (oldFullLayout._zoomlayer && !gd2._dragging) { clearOutline({ // mock old gd _fullLayout: oldFullLayout }); } fillMetaTextHelpers(newFullData, newFullLayout); relinkPrivateKeys(newFullLayout, oldFullLayout); Registry.getComponentMethod("colorscale", "crossTraceDefaults")(newFullData, newFullLayout); if (!newFullLayout._preGUI) newFullLayout._preGUI = {}; if (!newFullLayout._tracePreGUI) newFullLayout._tracePreGUI = {}; var tracePreGUI = newFullLayout._tracePreGUI; var uids = {}; var uid; for (uid in tracePreGUI) uids[uid] = "old"; for (i = 0; i < newFullData.length; i++) { uid = newFullData[i]._fullInput.uid; if (!uids[uid]) tracePreGUI[uid] = {}; uids[uid] = "new"; } for (uid in uids) { if (uids[uid] === "old") delete tracePreGUI[uid]; } initMargins(newFullLayout); Registry.getComponentMethod("rangeslider", "makeData")(newFullLayout); if (!skipUpdateCalc && oldCalcdata.length === newFullData.length) { plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData); } }; plots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) { for (var i = 0; i < newFullData.length; i++) { var newTrace = newFullData[i]; var cd0 = (oldCalcdata[i] || [])[0]; if (cd0 && cd0.trace) { var oldTrace = cd0.trace; if (oldTrace._hasCalcTransform) { var arrayAttrs = oldTrace._arrayAttrs; var j, astr, oldArrayVal; for (j = 0; j < arrayAttrs.length; j++) { astr = arrayAttrs[j]; oldArrayVal = Lib.nestedProperty(oldTrace, astr).get().slice(); Lib.nestedProperty(newTrace, astr).set(oldArrayVal); } } cd0.trace = newTrace; } } }; function getTraceUids(oldFullData, newData) { var len = newData.length; var oldFullInput = []; var i, prevFullInput; for (i = 0; i < oldFullData.length; i++) { var thisFullInput = oldFullData[i]._fullInput; if (thisFullInput !== prevFullInput) oldFullInput.push(thisFullInput); prevFullInput = thisFullInput; } var oldLen = oldFullInput.length; var out = new Array(len); var seenUids = {}; function setUid(uid, i2) { out[i2] = uid; seenUids[uid] = 1; } function tryUid(uid, i2) { if (uid && typeof uid === "string" && !seenUids[uid]) { setUid(uid, i2); return true; } } for (i = 0; i < len; i++) { var newUid = newData[i].uid; if (typeof newUid === "number") newUid = String(newUid); if (tryUid(newUid, i)) continue; if (i < oldLen && tryUid(oldFullInput[i].uid, i)) continue; setUid(Lib.randstr(seenUids), i); } return out; } function emptySubplotLists() { var collectableSubplotTypes = Registry.collectableSubplotTypes; var out = {}; var i, j; if (!collectableSubplotTypes) { collectableSubplotTypes = []; var subplotsRegistry = Registry.subplotsRegistry; for (var subplotType in subplotsRegistry) { var subplotModule = subplotsRegistry[subplotType]; var subplotAttr = subplotModule.attr; if (subplotAttr) { collectableSubplotTypes.push(subplotType); if (Array.isArray(subplotAttr)) { for (j = 0; j < subplotAttr.length; j++) { Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]); } } } } } for (i = 0; i < collectableSubplotTypes.length; i++) { out[collectableSubplotTypes[i]] = []; } return out; } function getFormatObj(gd2, formatKeys) { var locale3 = gd2._context.locale; if (!locale3) locale3 = "en-US"; var formatDone = false; var formatObj = {}; function includeFormat(newFormat) { var formatFinished = true; for (var i2 = 0; i2 < formatKeys.length; i2++) { var formatKey = formatKeys[i2]; if (!formatObj[formatKey]) { if (newFormat[formatKey]) { formatObj[formatKey] = newFormat[formatKey]; } else formatFinished = false; } } if (formatFinished) formatDone = true; } for (var i = 0; i < 2; i++) { var locales = gd2._context.locales; for (var j = 0; j < 2; j++) { var formatj = (locales[locale3] || {}).format; if (formatj) { includeFormat(formatj); if (formatDone) break; } locales = Registry.localeRegistry; } var baseLocale = locale3.split("-")[0]; if (formatDone || baseLocale === locale3) break; locale3 = baseLocale; } if (!formatDone) includeFormat(Registry.localeRegistry.en.format); return formatObj; } function getFormatter(formatObj, separators) { formatObj.decimal = separators.charAt(0); formatObj.thousands = separators.charAt(1); return { numberFormat: function(formatStr) { try { formatStr = formatLocale2(formatObj).format( Lib.adjustFormat(formatStr) ); } catch (e) { Lib.warnBadFormat(formatStr); return Lib.noFormat; } return formatStr; }, timeFormat: timeFormatLocale(formatObj).utcFormat }; } function fillMetaTextHelpers(newFullData, newFullLayout) { var _meta; var meta4data = []; if (newFullLayout.meta) { _meta = newFullLayout._meta = { meta: newFullLayout.meta, layout: { meta: newFullLayout.meta } }; } for (var i = 0; i < newFullData.length; i++) { var trace = newFullData[i]; if (trace.meta) { meta4data[trace.index] = trace._meta = { meta: trace.meta }; } else if (newFullLayout.meta) { trace._meta = { meta: newFullLayout.meta }; } if (newFullLayout.meta) { trace._meta.layout = { meta: newFullLayout.meta }; } } if (meta4data.length) { if (!_meta) { _meta = newFullLayout._meta = {}; } _meta.data = meta4data; } } plots.createTransitionData = function(gd2) { if (!gd2._transitionData) { gd2._transitionData = {}; } if (!gd2._transitionData._frames) { gd2._transitionData._frames = []; } if (!gd2._transitionData._frameHash) { gd2._transitionData._frameHash = {}; } if (!gd2._transitionData._counter) { gd2._transitionData._counter = 0; } if (!gd2._transitionData._interruptCallbacks) { gd2._transitionData._interruptCallbacks = []; } }; plots._hasPlotType = function(category) { var i; var basePlotModules = this._basePlotModules || []; for (i = 0; i < basePlotModules.length; i++) { if (basePlotModules[i].name === category) return true; } var modules = this._modules || []; for (i = 0; i < modules.length; i++) { var name = modules[i].name; if (name === category) return true; var _module = Registry.modules[name]; if (_module && _module.categories[category]) return true; } return false; }; plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { var i, j; var basePlotModules = oldFullLayout._basePlotModules || []; for (i = 0; i < basePlotModules.length; i++) { var _module = basePlotModules[i]; if (_module.clean) { _module.clean(newFullData, newFullLayout, oldFullData, oldFullLayout); } } var hadGl = oldFullLayout._has && oldFullLayout._has("gl"); var hasGl = newFullLayout._has && newFullLayout._has("gl"); if (hadGl && !hasGl) { if (oldFullLayout._glcontainer !== void 0) { oldFullLayout._glcontainer.selectAll(".gl-canvas").remove(); oldFullLayout._glcontainer.selectAll(".no-webgl").remove(); oldFullLayout._glcanvas = null; } } var hasInfoLayer = !!oldFullLayout._infolayer; oldLoop: for (i = 0; i < oldFullData.length; i++) { var oldTrace = oldFullData[i]; var oldUid = oldTrace.uid; for (j = 0; j < newFullData.length; j++) { var newTrace = newFullData[j]; if (oldUid === newTrace.uid) continue oldLoop; } if (hasInfoLayer) { oldFullLayout._infolayer.select(".cb" + oldUid).remove(); } } }; plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { var i, j; var oldSubplots = oldFullLayout._plots || {}; var newSubplots = newFullLayout._plots = {}; var newSubplotList = newFullLayout._subplots; var mockGd = { _fullData: newFullData, _fullLayout: newFullLayout }; var ids = newSubplotList.cartesian.concat(newSubplotList.gl2d || []); for (i = 0; i < ids.length; i++) { var id2 = ids[i]; var oldSubplot = oldSubplots[id2]; var xaxis = axisIDs.getFromId(mockGd, id2, "x"); var yaxis = axisIDs.getFromId(mockGd, id2, "y"); var plotinfo; if (oldSubplot) { plotinfo = newSubplots[id2] = oldSubplot; } else { plotinfo = newSubplots[id2] = {}; plotinfo.id = id2; } xaxis._counterAxes.push(yaxis._id); yaxis._counterAxes.push(xaxis._id); xaxis._subplotsWith.push(id2); yaxis._subplotsWith.push(id2); plotinfo.xaxis = xaxis; plotinfo.yaxis = yaxis; plotinfo._hasClipOnAxisFalse = false; for (j = 0; j < newFullData.length; j++) { var trace = newFullData[j]; if (trace.xaxis === plotinfo.xaxis._id && trace.yaxis === plotinfo.yaxis._id && trace.cliponaxis === false) { plotinfo._hasClipOnAxisFalse = true; break; } } } var axList = axisIDs.list(mockGd, null, true); var ax; for (i = 0; i < axList.length; i++) { ax = axList[i]; var mainAx = null; if (ax.overlaying) { mainAx = axisIDs.getFromId(mockGd, ax.overlaying); if (mainAx && mainAx.overlaying) { ax.overlaying = false; mainAx = null; } } ax._mainAxis = mainAx || ax; if (mainAx) ax.domain = mainAx.domain.slice(); ax._anchorAxis = ax.anchor === "free" ? null : axisIDs.getFromId(mockGd, ax.anchor); } for (i = 0; i < axList.length; i++) { ax = axList[i]; ax._counterAxes.sort(axisIDs.idSort); ax._subplotsWith.sort(Lib.subplotSort); ax._mainSubplot = findMainSubplot(ax, newFullLayout); if (ax._counterAxes.length && (ax.spikemode && ax.spikemode.indexOf("across") !== -1 || ax.automargin && ax.mirror && ax.anchor !== "free" || Registry.getComponentMethod("rangeslider", "isVisible")(ax))) { var min = 1; var max = 0; for (j = 0; j < ax._counterAxes.length; j++) { var ax2 = axisIDs.getFromId(mockGd, ax._counterAxes[j]); min = Math.min(min, ax2.domain[0]); max = Math.max(max, ax2.domain[1]); } if (min < max) { ax._counterDomainMin = min; ax._counterDomainMax = max; } } } }; function findMainSubplot(ax, fullLayout) { var mockGd = { _fullLayout: fullLayout }; var isX = ax._id.charAt(0) === "x"; var anchorAx = ax._mainAxis._anchorAxis; var mainSubplotID = ""; var nextBestMainSubplotID = ""; var anchorID = ""; if (anchorAx) { anchorID = anchorAx._mainAxis._id; mainSubplotID = isX ? ax._id + anchorID : anchorID + ax._id; } if (!mainSubplotID || !fullLayout._plots[mainSubplotID]) { mainSubplotID = ""; var counterIDs = ax._counterAxes; for (var j = 0; j < counterIDs.length; j++) { var counterPart = counterIDs[j]; var id2 = isX ? ax._id + counterPart : counterPart + ax._id; if (!nextBestMainSubplotID) nextBestMainSubplotID = id2; var counterAx = axisIDs.getFromId(mockGd, counterPart); if (anchorID && counterAx.overlaying === anchorID) { mainSubplotID = id2; break; } } } return mainSubplotID || nextBestMainSubplotID; } plots.clearExpandedTraceDefaultColors = function(trace) { var colorAttrs, path, i; function locateColorAttrs(attr, attrName, attrs, level) { path[level] = attrName; path.length = level + 1; if (attr.valType === "color" && attr.dflt === void 0) { colorAttrs.push(path.join(".")); } } path = []; colorAttrs = trace._module._colorAttrs; if (!colorAttrs) { trace._module._colorAttrs = colorAttrs = []; PlotSchema.crawl( trace._module.attributes, locateColorAttrs ); } for (i = 0; i < colorAttrs.length; i++) { var origprop = Lib.nestedProperty(trace, "_input." + colorAttrs[i]); if (!origprop.get()) { Lib.nestedProperty(trace, colorAttrs[i]).set(null); } } }; plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) { var modules = fullLayout._modules; var visibleModules = fullLayout._visibleModules; var basePlotModules = fullLayout._basePlotModules; var cnt = 0; var colorCnt = 0; var i, fullTrace, trace; fullLayout._transformModules = []; function pushModule(fullTrace2) { dataOut.push(fullTrace2); var _module = fullTrace2._module; if (!_module) return; Lib.pushUnique(modules, _module); if (fullTrace2.visible === true) Lib.pushUnique(visibleModules, _module); Lib.pushUnique(basePlotModules, fullTrace2._module.basePlotModule); cnt++; if (fullTrace2._input.visible !== false) colorCnt++; } var carpetIndex = {}; var carpetDependents = []; var dataTemplate = (layout.template || {}).data || {}; var templater = Template.traceTemplater(dataTemplate); for (i = 0; i < dataIn.length; i++) { trace = dataIn[i]; fullTrace = templater.newTrace(trace); fullTrace.uid = fullLayout._traceUids[i]; plots.supplyTraceDefaults(trace, fullTrace, colorCnt, fullLayout, i); fullTrace.index = i; fullTrace._input = trace; fullTrace._expandedIndex = cnt; if (fullTrace.transforms && fullTrace.transforms.length) { var sdInvisible = trace.visible !== false && fullTrace.visible === false; var expandedTraces = applyTransforms(fullTrace, dataOut, layout, fullLayout); for (var j = 0; j < expandedTraces.length; j++) { var expandedTrace = expandedTraces[j]; var fullExpandedTrace = { _template: fullTrace._template, type: fullTrace.type, // set uid using parent uid and expanded index // to promote consistency between update calls uid: fullTrace.uid + j }; if (sdInvisible && expandedTrace.visible === false) { delete expandedTrace.visible; } plots.supplyTraceDefaults(expandedTrace, fullExpandedTrace, cnt, fullLayout, i); relinkPrivateKeys(fullExpandedTrace, expandedTrace); fullExpandedTrace.index = i; fullExpandedTrace._input = trace; fullExpandedTrace._fullInput = fullTrace; fullExpandedTrace._expandedIndex = cnt; fullExpandedTrace._expandedInput = expandedTrace; pushModule(fullExpandedTrace); } } else { fullTrace._fullInput = fullTrace; fullTrace._expandedInput = fullTrace; pushModule(fullTrace); } if (Registry.traceIs(fullTrace, "carpetAxis")) { carpetIndex[fullTrace.carpet] = fullTrace; } if (Registry.traceIs(fullTrace, "carpetDependent")) { carpetDependents.push(i); } } for (i = 0; i < carpetDependents.length; i++) { fullTrace = dataOut[carpetDependents[i]]; if (!fullTrace.visible) continue; var carpetAxis = carpetIndex[fullTrace.carpet]; fullTrace._carpet = carpetAxis; if (!carpetAxis || !carpetAxis.visible) { fullTrace.visible = false; continue; } fullTrace.xaxis = carpetAxis.xaxis; fullTrace.yaxis = carpetAxis.yaxis; } }; plots.supplyAnimationDefaults = function(opts) { opts = opts || {}; var i; var optsOut = {}; function coerce(attr, dflt) { return Lib.coerce(opts || {}, optsOut, animationAttrs, attr, dflt); } coerce("mode"); coerce("direction"); coerce("fromcurrent"); if (Array.isArray(opts.frame)) { optsOut.frame = []; for (i = 0; i < opts.frame.length; i++) { optsOut.frame[i] = plots.supplyAnimationFrameDefaults(opts.frame[i] || {}); } } else { optsOut.frame = plots.supplyAnimationFrameDefaults(opts.frame || {}); } if (Array.isArray(opts.transition)) { optsOut.transition = []; for (i = 0; i < opts.transition.length; i++) { optsOut.transition[i] = plots.supplyAnimationTransitionDefaults(opts.transition[i] || {}); } } else { optsOut.transition = plots.supplyAnimationTransitionDefaults(opts.transition || {}); } return optsOut; }; plots.supplyAnimationFrameDefaults = function(opts) { var optsOut = {}; function coerce(attr, dflt) { return Lib.coerce(opts || {}, optsOut, animationAttrs.frame, attr, dflt); } coerce("duration"); coerce("redraw"); return optsOut; }; plots.supplyAnimationTransitionDefaults = function(opts) { var optsOut = {}; function coerce(attr, dflt) { return Lib.coerce(opts || {}, optsOut, animationAttrs.transition, attr, dflt); } coerce("duration"); coerce("easing"); return optsOut; }; plots.supplyFrameDefaults = function(frameIn) { var frameOut = {}; function coerce(attr, dflt) { return Lib.coerce(frameIn, frameOut, frameAttrs, attr, dflt); } coerce("group"); coerce("name"); coerce("traces"); coerce("baseframe"); coerce("data"); coerce("layout"); return frameOut; }; plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, traceInIndex) { var colorway = layout.colorway || Color.defaults; var defaultColor = colorway[colorIndex % colorway.length]; var i; function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt); } var visible = coerce("visible"); coerce("type"); coerce("name", layout._traceWord + " " + traceInIndex); coerce("uirevision", layout.uirevision); var _module = plots.getModule(traceOut); traceOut._module = _module; if (_module) { var basePlotModule = _module.basePlotModule; var subplotAttr = basePlotModule.attr; var subplotAttrs = basePlotModule.attributes; if (subplotAttr && subplotAttrs) { var subplots = layout._subplots; var subplotId = ""; if (visible || basePlotModule.name !== "gl2d") { if (Array.isArray(subplotAttr)) { for (i = 0; i < subplotAttr.length; i++) { var attri = subplotAttr[i]; var vali = Lib.coerce(traceIn, traceOut, subplotAttrs, attri); if (subplots[attri]) Lib.pushUnique(subplots[attri], vali); subplotId += vali; } } else { subplotId = Lib.coerce(traceIn, traceOut, subplotAttrs, subplotAttr); } if (subplots[basePlotModule.name]) { Lib.pushUnique(subplots[basePlotModule.name], subplotId); } } } } if (visible) { coerce("customdata"); coerce("ids"); coerce("meta"); if (Registry.traceIs(traceOut, "showLegend")) { Lib.coerce( traceIn, traceOut, _module.attributes.showlegend ? _module.attributes : plots.attributes, "showlegend" ); coerce("legend"); coerce("legendwidth"); coerce("legendgroup"); coerce("legendgrouptitle.text"); coerce("legendrank"); traceOut._dfltShowLegend = true; } else { traceOut._dfltShowLegend = false; } if (_module) { _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); } if (!Registry.traceIs(traceOut, "noOpacity")) { coerce("opacity"); } if (Registry.traceIs(traceOut, "notLegendIsolatable")) { traceOut.visible = !!traceOut.visible; } if (!Registry.traceIs(traceOut, "noHover")) { if (!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout); if (traceOut.type !== "parcats") { Registry.getComponentMethod("fx", "supplyDefaults")(traceIn, traceOut, defaultColor, layout); } } if (_module && _module.selectPoints) { var selectedpoints = coerce("selectedpoints"); if (Lib.isTypedArray(selectedpoints)) { traceOut.selectedpoints = Array.from(selectedpoints); } } plots.supplyTransformDefaults(traceIn, traceOut, layout); } return traceOut; }; function hasMakesDataTransform(trace) { var transforms = trace.transforms; if (Array.isArray(transforms) && transforms.length) { for (var i = 0; i < transforms.length; i++) { var ti2 = transforms[i]; var _module = ti2._module || transformsRegistry[ti2.type]; if (_module && _module.makesData) return true; } } return false; } plots.hasMakesDataTransform = hasMakesDataTransform; plots.supplyTransformDefaults = function(traceIn, traceOut, layout) { if (!(traceOut._length || hasMakesDataTransform(traceIn))) return; var globalTransforms = layout._globalTransforms || []; var transformModules = layout._transformModules || []; if (!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return; var containerIn = traceIn.transforms || []; var transformList = globalTransforms.concat(containerIn); var containerOut = traceOut.transforms = []; for (var i = 0; i < transformList.length; i++) { var transformIn = transformList[i]; var type = transformIn.type; var _module = transformsRegistry[type]; var transformOut; var isFirstStage = !(transformIn._module && transformIn._module === _module); var doLaterStages = _module && typeof _module.transform === "function"; if (!_module) Lib.warn("Unrecognized transform type " + type + "."); if (_module && _module.supplyDefaults && (isFirstStage || doLaterStages)) { transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn); transformOut.type = type; transformOut._module = _module; Lib.pushUnique(transformModules, _module); } else { transformOut = Lib.extendFlat({}, transformIn); } containerOut.push(transformOut); } }; function applyTransforms(fullTrace, fullData, layout, fullLayout) { var container = fullTrace.transforms; var dataOut = [fullTrace]; for (var i = 0; i < container.length; i++) { var transform = container[i]; var _module = transformsRegistry[transform.type]; if (_module && _module.transform) { dataOut = _module.transform(dataOut, { transform, fullTrace, fullData, layout, fullLayout, transformIndex: i }); } } return dataOut; } plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt); } var template = layoutIn.template; if (Lib.isPlainObject(template)) { layoutOut.template = template; layoutOut._template = template.layout; layoutOut._dataTemplate = template.data; } coerce("autotypenumbers"); var font = Lib.coerceFont(coerce, "font"); var fontSize = font.size; Lib.coerceFont(coerce, "title.font", font, { overrideDflt: { size: Math.round(fontSize * 1.4) } }); coerce("title.text", layoutOut._dfltTitle.plot); coerce("title.xref"); var titleYref = coerce("title.yref"); coerce("title.pad.t"); coerce("title.pad.r"); coerce("title.pad.b"); coerce("title.pad.l"); var titleAutomargin = coerce("title.automargin"); coerce("title.x"); coerce("title.xanchor"); coerce("title.y"); coerce("title.yanchor"); coerce("title.subtitle.text", layoutOut._dfltTitle.subtitle); Lib.coerceFont(coerce, "title.subtitle.font", font, { overrideDflt: { size: Math.round(layoutOut.title.font.size * 0.7) } }); if (titleAutomargin) { if (titleYref === "paper") { if (layoutOut.title.y !== 0) layoutOut.title.y = 1; if (layoutOut.title.yanchor === "auto") { layoutOut.title.yanchor = layoutOut.title.y === 0 ? "top" : "bottom"; } } if (titleYref === "container") { if (layoutOut.title.y === "auto") layoutOut.title.y = 1; if (layoutOut.title.yanchor === "auto") { layoutOut.title.yanchor = layoutOut.title.y < 0.5 ? "bottom" : "top"; } } } var uniformtextMode = coerce("uniformtext.mode"); if (uniformtextMode) { coerce("uniformtext.minsize"); } coerce("autosize", !(layoutIn.width && layoutIn.height)); coerce("width"); coerce("height"); coerce("minreducedwidth"); coerce("minreducedheight"); coerce("margin.l"); coerce("margin.r"); coerce("margin.t"); coerce("margin.b"); coerce("margin.pad"); coerce("margin.autoexpand"); if (layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut); Registry.getComponentMethod("grid", "sizeDefaults")(layoutIn, layoutOut); coerce("paper_bgcolor"); coerce("separators", formatObj.decimal + formatObj.thousands); coerce("hidesources"); coerce("colorway"); coerce("datarevision"); var uirevision = coerce("uirevision"); coerce("editrevision", uirevision); coerce("selectionrevision", uirevision); Registry.getComponentMethod( "modebar", "supplyLayoutDefaults" )(layoutIn, layoutOut); Registry.getComponentMethod( "shapes", "supplyDrawNewShapeDefaults" )(layoutIn, layoutOut, coerce); Registry.getComponentMethod( "selections", "supplyDrawNewSelectionDefaults" )(layoutIn, layoutOut, coerce); coerce("meta"); if (Lib.isPlainObject(layoutIn.transition)) { coerce("transition.duration"); coerce("transition.easing"); coerce("transition.ordering"); } Registry.getComponentMethod( "calendars", "handleDefaults" )(layoutIn, layoutOut, "calendar"); Registry.getComponentMethod( "fx", "supplyLayoutGlobalDefaults" )(layoutIn, layoutOut, coerce); Lib.coerce(layoutIn, layoutOut, scatterAttrs, "scattermode"); }; function getComputedSize(attr) { return typeof attr === "string" && attr.substr(attr.length - 2) === "px" && parseFloat(attr); } plots.plotAutoSize = function plotAutoSize(gd2, layout, fullLayout) { var context = gd2._context || {}; var frameMargins = context.frameMargins; var newWidth; var newHeight; var isPlotDiv = Lib.isPlotDiv(gd2); if (isPlotDiv) gd2.emit("plotly_autosize"); if (context.fillFrame) { newWidth = window.innerWidth; newHeight = window.innerHeight; document.body.style.overflow = "hidden"; } else { var computedStyle = isPlotDiv ? window.getComputedStyle(gd2) : {}; newWidth = getComputedSize(computedStyle.width) || getComputedSize(computedStyle.maxWidth) || fullLayout.width; newHeight = getComputedSize(computedStyle.height) || getComputedSize(computedStyle.maxHeight) || fullLayout.height; if (isNumeric(frameMargins) && frameMargins > 0) { var factor = 1 - 2 * frameMargins; newWidth = Math.round(factor * newWidth); newHeight = Math.round(factor * newHeight); } } var minWidth = plots.layoutAttributes.width.min; var minHeight = plots.layoutAttributes.height.min; if (newWidth < minWidth) newWidth = minWidth; if (newHeight < minHeight) newHeight = minHeight; var widthHasChanged = !layout.width && Math.abs(fullLayout.width - newWidth) > 1; var heightHasChanged = !layout.height && Math.abs(fullLayout.height - newHeight) > 1; if (heightHasChanged || widthHasChanged) { if (widthHasChanged) fullLayout.width = newWidth; if (heightHasChanged) fullLayout.height = newHeight; } if (!gd2._initialAutoSize) { gd2._initialAutoSize = { width: newWidth, height: newHeight }; } plots.sanitizeMargins(fullLayout); }; plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) { var componentsRegistry = Registry.componentsRegistry; var basePlotModules = layoutOut._basePlotModules; var component, i, _module; var Cartesian = Registry.subplotsRegistry.cartesian; for (component in componentsRegistry) { _module = componentsRegistry[component]; if (_module.includeBasePlot) { _module.includeBasePlot(layoutIn, layoutOut); } } if (!basePlotModules.length) { basePlotModules.push(Cartesian); } if (layoutOut._has("cartesian")) { Registry.getComponentMethod("grid", "contentDefaults")(layoutIn, layoutOut); Cartesian.finalizeSubplots(layoutIn, layoutOut); } for (var subplotType in layoutOut._subplots) { layoutOut._subplots[subplotType].sort(Lib.subplotSort); } for (i = 0; i < basePlotModules.length; i++) { _module = basePlotModules[i]; if (_module.supplyLayoutDefaults) { _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } } var modules = layoutOut._modules; for (i = 0; i < modules.length; i++) { _module = modules[i]; if (_module.supplyLayoutDefaults) { _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } } var transformModules = layoutOut._transformModules; for (i = 0; i < transformModules.length; i++) { _module = transformModules[i]; if (_module.supplyLayoutDefaults) { _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData); } } for (component in componentsRegistry) { _module = componentsRegistry[component]; if (_module.supplyLayoutDefaults) { _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData); } } }; plots.purge = function(gd2) { var fullLayout = gd2._fullLayout || {}; if (fullLayout._glcontainer !== void 0) { fullLayout._glcontainer.selectAll(".gl-canvas").remove(); fullLayout._glcontainer.remove(); fullLayout._glcanvas = null; } if (fullLayout._modeBar) fullLayout._modeBar.destroy(); if (gd2._transitionData) { if (gd2._transitionData._interruptCallbacks) { gd2._transitionData._interruptCallbacks.length = 0; } if (gd2._transitionData._animationRaf) { window.cancelAnimationFrame(gd2._transitionData._animationRaf); } } Lib.clearThrottle(); Lib.clearResponsive(gd2); delete gd2.data; delete gd2.layout; delete gd2._fullData; delete gd2._fullLayout; delete gd2.calcdata; delete gd2.empty; delete gd2.fid; delete gd2.undoqueue; delete gd2.undonum; delete gd2.autoplay; delete gd2.changed; delete gd2._promises; delete gd2._redrawTimer; delete gd2._hmlumcount; delete gd2._hmpixcount; delete gd2._transitionData; delete gd2._transitioning; delete gd2._initialAutoSize; delete gd2._transitioningWithDuration; delete gd2._dragging; delete gd2._dragged; delete gd2._dragdata; delete gd2._hoverdata; delete gd2._snapshotInProgress; delete gd2._editing; delete gd2._mouseDownTime; delete gd2._legendMouseDownTime; if (gd2.removeAllListeners) gd2.removeAllListeners(); }; plots.style = function(gd2) { var _modules = gd2._fullLayout._visibleModules; var styleModules = []; var i; for (i = 0; i < _modules.length; i++) { var _module = _modules[i]; if (_module.style) { Lib.pushUnique(styleModules, _module.style); } } for (i = 0; i < styleModules.length; i++) { styleModules[i](gd2); } }; plots.sanitizeMargins = function(fullLayout) { if (!fullLayout || !fullLayout.margin) return; var width = fullLayout.width; var height = fullLayout.height; var margin = fullLayout.margin; var plotWidth = width - (margin.l + margin.r); var plotHeight = height - (margin.t + margin.b); var correction; if (plotWidth < 0) { correction = (width - 1) / (margin.l + margin.r); margin.l = Math.floor(correction * margin.l); margin.r = Math.floor(correction * margin.r); } if (plotHeight < 0) { correction = (height - 1) / (margin.t + margin.b); margin.t = Math.floor(correction * margin.t); margin.b = Math.floor(correction * margin.b); } }; plots.clearAutoMarginIds = function(gd2) { gd2._fullLayout._pushmarginIds = {}; }; plots.allowAutoMargin = function(gd2, id2) { gd2._fullLayout._pushmarginIds[id2] = 1; }; function initMargins(fullLayout) { var margin = fullLayout.margin; if (!fullLayout._size) { var gs2 = fullLayout._size = { l: Math.round(margin.l), r: Math.round(margin.r), t: Math.round(margin.t), b: Math.round(margin.b), p: Math.round(margin.pad) }; gs2.w = Math.round(fullLayout.width) - gs2.l - gs2.r; gs2.h = Math.round(fullLayout.height) - gs2.t - gs2.b; } if (!fullLayout._pushmargin) fullLayout._pushmargin = {}; if (!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {}; if (!fullLayout._reservedMargin) fullLayout._reservedMargin = {}; } var MIN_SPECIFIED_WIDTH = 2; var MIN_SPECIFIED_HEIGHT = 2; plots.autoMargin = function(gd2, id2, o) { var fullLayout = gd2._fullLayout; var width = fullLayout.width; var height = fullLayout.height; var margin = fullLayout.margin; var minreducedwidth = fullLayout.minreducedwidth; var minreducedheight = fullLayout.minreducedheight; var minFinalWidth = Lib.constrain( width - margin.l - margin.r, MIN_SPECIFIED_WIDTH, minreducedwidth ); var minFinalHeight = Lib.constrain( height - margin.t - margin.b, MIN_SPECIFIED_HEIGHT, minreducedheight ); var maxSpaceW = Math.max(0, width - minFinalWidth); var maxSpaceH = Math.max(0, height - minFinalHeight); var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; if (margin.autoexpand !== false) { if (!o) { delete pushMargin[id2]; delete pushMarginIds[id2]; } else { var pad2 = o.pad; if (pad2 === void 0) { pad2 = Math.min(12, margin.l, margin.r, margin.t, margin.b); } if (maxSpaceW) { var rW = (o.l + o.r) / maxSpaceW; if (rW > 1) { o.l /= rW; o.r /= rW; } } if (maxSpaceH) { var rH = (o.t + o.b) / maxSpaceH; if (rH > 1) { o.t /= rH; o.b /= rH; } } var xl = o.xl !== void 0 ? o.xl : o.x; var xr2 = o.xr !== void 0 ? o.xr : o.x; var yt2 = o.yt !== void 0 ? o.yt : o.y; var yb = o.yb !== void 0 ? o.yb : o.y; pushMargin[id2] = { l: { val: xl, size: o.l + pad2 }, r: { val: xr2, size: o.r + pad2 }, b: { val: yb, size: o.b + pad2 }, t: { val: yt2, size: o.t + pad2 } }; pushMarginIds[id2] = 1; } if (!fullLayout._replotting) { return plots.doAutoMargin(gd2); } } }; function needsRedrawForShift(gd2) { if ("_redrawFromAutoMarginCount" in gd2._fullLayout) { return false; } var axList = axisIDs.list(gd2, "", true); for (var ax in axList) { if (axList[ax].autoshift || axList[ax].shift) return true; } return false; } plots.doAutoMargin = function(gd2) { var fullLayout = gd2._fullLayout; var width = fullLayout.width; var height = fullLayout.height; if (!fullLayout._size) fullLayout._size = {}; initMargins(fullLayout); var gs2 = fullLayout._size; var margin = fullLayout.margin; var reservedMargins = { t: 0, b: 0, l: 0, r: 0 }; var oldMargins = Lib.extendFlat({}, gs2); var ml = margin.l; var mr2 = margin.r; var mt2 = margin.t; var mb = margin.b; var pushMargin = fullLayout._pushmargin; var pushMarginIds = fullLayout._pushmarginIds; var minreducedwidth = fullLayout.minreducedwidth; var minreducedheight = fullLayout.minreducedheight; if (margin.autoexpand !== false) { for (var k in pushMargin) { if (!pushMarginIds[k]) delete pushMargin[k]; } var margins = gd2._fullLayout._reservedMargin; for (var key in margins) { for (var side in margins[key]) { var val = margins[key][side]; reservedMargins[side] = Math.max(reservedMargins[side], val); } } pushMargin.base = { l: { val: 0, size: ml }, r: { val: 1, size: mr2 }, t: { val: 1, size: mt2 }, b: { val: 0, size: mb } }; for (var s in reservedMargins) { var autoMarginPush = 0; for (var m in pushMargin) { if (m !== "base") { if (isNumeric(pushMargin[m][s].size)) { autoMarginPush = pushMargin[m][s].size > autoMarginPush ? pushMargin[m][s].size : autoMarginPush; } } } var extraMargin = Math.max(0, margin[s] - autoMarginPush); reservedMargins[s] = Math.max(0, reservedMargins[s] - extraMargin); } for (var k1 in pushMargin) { var pushleft = pushMargin[k1].l || {}; var pushbottom = pushMargin[k1].b || {}; var fl = pushleft.val; var pl = pushleft.size; var fb = pushbottom.val; var pb = pushbottom.size; var availableWidth = width - reservedMargins.r - reservedMargins.l; var availableHeight = height - reservedMargins.t - reservedMargins.b; for (var k2 in pushMargin) { if (isNumeric(pl) && pushMargin[k2].r) { var fr2 = pushMargin[k2].r.val; var pr2 = pushMargin[k2].r.size; if (fr2 > fl) { var newL = (pl * fr2 + (pr2 - availableWidth) * fl) / (fr2 - fl); var newR = (pr2 * (1 - fl) + (pl - availableWidth) * (1 - fr2)) / (fr2 - fl); if (newL + newR > ml + mr2) { ml = newL; mr2 = newR; } } } if (isNumeric(pb) && pushMargin[k2].t) { var ft2 = pushMargin[k2].t.val; var pt2 = pushMargin[k2].t.size; if (ft2 > fb) { var newB = (pb * ft2 + (pt2 - availableHeight) * fb) / (ft2 - fb); var newT = (pt2 * (1 - fb) + (pb - availableHeight) * (1 - ft2)) / (ft2 - fb); if (newB + newT > mb + mt2) { mb = newB; mt2 = newT; } } } } } } var minFinalWidth = Lib.constrain( width - margin.l - margin.r, MIN_SPECIFIED_WIDTH, minreducedwidth ); var minFinalHeight = Lib.constrain( height - margin.t - margin.b, MIN_SPECIFIED_HEIGHT, minreducedheight ); var maxSpaceW = Math.max(0, width - minFinalWidth); var maxSpaceH = Math.max(0, height - minFinalHeight); if (maxSpaceW) { var rW = (ml + mr2) / maxSpaceW; if (rW > 1) { ml /= rW; mr2 /= rW; } } if (maxSpaceH) { var rH = (mb + mt2) / maxSpaceH; if (rH > 1) { mb /= rH; mt2 /= rH; } } gs2.l = Math.round(ml) + reservedMargins.l; gs2.r = Math.round(mr2) + reservedMargins.r; gs2.t = Math.round(mt2) + reservedMargins.t; gs2.b = Math.round(mb) + reservedMargins.b; gs2.p = Math.round(margin.pad); gs2.w = Math.round(width) - gs2.l - gs2.r; gs2.h = Math.round(height) - gs2.t - gs2.b; if (!fullLayout._replotting && (plots.didMarginChange(oldMargins, gs2) || needsRedrawForShift(gd2))) { if ("_redrawFromAutoMarginCount" in fullLayout) { fullLayout._redrawFromAutoMarginCount++; } else { fullLayout._redrawFromAutoMarginCount = 1; } var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length); if (fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) { return Registry.call("_doPlot", gd2); } else { fullLayout._size = oldMargins; Lib.warn("Too many auto-margin redraws."); } } refineTicks(gd2); }; function refineTicks(gd2) { var axList = axisIDs.list(gd2, "", true); [ "_adjustTickLabelsOverflow", "_hideCounterAxisInsideTickLabels" ].forEach(function(k) { for (var i = 0; i < axList.length; i++) { var hideFn = axList[i][k]; if (hideFn) hideFn(); } }); } var marginKeys = ["l", "r", "t", "b", "p", "w", "h"]; plots.didMarginChange = function(margin0, margin1) { for (var i = 0; i < marginKeys.length; i++) { var k = marginKeys[i]; var m02 = margin0[k]; var m12 = margin1[k]; if (!isNumeric(m02) || Math.abs(m12 - m02) > 1) { return true; } } return false; }; plots.graphJson = function(gd2, dataonly, mode, output, useDefaults, includeConfig) { if (useDefaults && dataonly && !gd2._fullData || useDefaults && !dataonly && !gd2._fullLayout) { plots.supplyDefaults(gd2); } var data = useDefaults ? gd2._fullData : gd2.data; var layout = useDefaults ? gd2._fullLayout : gd2.layout; var frames = (gd2._transitionData || {})._frames; function stripObj(d, keepFunction) { if (typeof d === "function") { return keepFunction ? "_function_" : null; } if (Lib.isPlainObject(d)) { var o = {}; var src; Object.keys(d).sort().forEach(function(v) { if (["_", "["].indexOf(v.charAt(0)) !== -1) return; if (typeof d[v] === "function") { if (keepFunction) o[v] = "_function"; return; } if (mode === "keepdata") { if (v.substr(v.length - 3) === "src") { return; } } else if (mode === "keepstream") { src = d[v + "src"]; if (typeof src === "string" && src.indexOf(":") > 0) { if (!Lib.isPlainObject(d.stream)) { return; } } } else if (mode !== "keepall") { src = d[v + "src"]; if (typeof src === "string" && src.indexOf(":") > 0) { return; } } o[v] = stripObj(d[v], keepFunction); }); return o; } var dIsArray = Array.isArray(d); var dIsTypedArray = Lib.isTypedArray(d); if ((dIsArray || dIsTypedArray) && d.dtype && d.shape) { var bdata = d.bdata; return stripObj({ dtype: d.dtype, shape: d.shape, bdata: ( // case of ArrayBuffer Lib.isArrayBuffer(bdata) ? b64encode.encode(bdata) : ( // case of b64 string bdata ) ) }, keepFunction); } if (dIsArray) { return d.map(function(x) { return stripObj(x, keepFunction); }); } if (dIsTypedArray) { return Lib.simpleMap(d, Lib.identity); } if (Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d); return d; } var obj = { data: (data || []).map(function(v) { var d = stripObj(v); if (dataonly) { delete d.fit; } return d; }) }; if (!dataonly) { obj.layout = stripObj(layout); if (useDefaults) { var gs2 = layout._size; obj.layout.computed = { margin: { b: gs2.b, l: gs2.l, r: gs2.r, t: gs2.t } }; } } if (frames) obj.frames = stripObj(frames); if (includeConfig) obj.config = stripObj(gd2._context, true); return output === "object" ? obj : JSON.stringify(obj); }; plots.modifyFrames = function(gd2, operations) { var i, op2, frame; var _frames = gd2._transitionData._frames; var _frameHash = gd2._transitionData._frameHash; for (i = 0; i < operations.length; i++) { op2 = operations[i]; switch (op2.type) { case "replace": frame = op2.value; var oldName = (_frames[op2.index] || {}).name; var newName = frame.name; _frames[op2.index] = _frameHash[newName] = frame; if (newName !== oldName) { delete _frameHash[oldName]; _frameHash[newName] = frame; } break; case "insert": frame = op2.value; _frameHash[frame.name] = frame; _frames.splice(op2.index, 0, frame); break; case "delete": frame = _frames[op2.index]; delete _frameHash[frame.name]; _frames.splice(op2.index, 1); break; } } return Promise.resolve(); }; plots.computeFrame = function(gd2, frameName) { var frameLookup = gd2._transitionData._frameHash; var i, traceIndices, traceIndex, destIndex; if (!frameName) { throw new Error("computeFrame must be given a string frame name"); } var framePtr = frameLookup[frameName.toString()]; if (!framePtr) { return false; } var frameStack = [framePtr]; var frameNameStack = [framePtr.name]; while (framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) { if (frameNameStack.indexOf(framePtr.name) !== -1) break; frameStack.push(framePtr); frameNameStack.push(framePtr.name); } var result = {}; while (framePtr = frameStack.pop()) { if (framePtr.layout) { result.layout = plots.extendLayout(result.layout, framePtr.layout); } if (framePtr.data) { if (!result.data) { result.data = []; } traceIndices = framePtr.traces; if (!traceIndices) { traceIndices = []; for (i = 0; i < framePtr.data.length; i++) { traceIndices[i] = i; } } if (!result.traces) { result.traces = []; } for (i = 0; i < framePtr.data.length; i++) { traceIndex = traceIndices[i]; if (traceIndex === void 0 || traceIndex === null) { continue; } destIndex = result.traces.indexOf(traceIndex); if (destIndex === -1) { destIndex = result.data.length; result.traces[destIndex] = traceIndex; } result.data[destIndex] = plots.extendTrace(result.data[destIndex], framePtr.data[i]); } } } return result; }; plots.recomputeFrameHash = function(gd2) { var hash = gd2._transitionData._frameHash = {}; var frames = gd2._transitionData._frames; for (var i = 0; i < frames.length; i++) { var frame = frames[i]; if (frame && frame.name) { hash[frame.name] = frame; } } }; plots.extendObjectWithContainers = function(dest, src, containerPaths) { var containerProp, containerVal, i, j, srcProp, destProp, srcContainer, destContainer; var copy = Lib.extendDeepNoArrays({}, src || {}); var expandedObj = Lib.expandObjectPaths(copy); var containerObj = {}; if (containerPaths && containerPaths.length) { for (i = 0; i < containerPaths.length; i++) { containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]); containerVal = containerProp.get(); if (containerVal === void 0) { Lib.nestedProperty(containerObj, containerPaths[i]).set(null); } else { containerProp.set(null); Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal); } } } dest = Lib.extendDeepNoArrays(dest || {}, expandedObj); if (containerPaths && containerPaths.length) { for (i = 0; i < containerPaths.length; i++) { srcProp = Lib.nestedProperty(containerObj, containerPaths[i]); srcContainer = srcProp.get(); if (!srcContainer) continue; destProp = Lib.nestedProperty(dest, containerPaths[i]); destContainer = destProp.get(); if (!Array.isArray(destContainer)) { destContainer = []; destProp.set(destContainer); } for (j = 0; j < srcContainer.length; j++) { var srcObj = srcContainer[j]; if (srcObj === null) destContainer[j] = null; else { destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj); } } destProp.set(destContainer); } } return dest; }; plots.dataArrayContainers = ["transforms", "dimensions"]; plots.layoutArrayContainers = Registry.layoutArrayContainers; plots.extendTrace = function(destTrace, srcTrace) { return plots.extendObjectWithContainers(destTrace, srcTrace, plots.dataArrayContainers); }; plots.extendLayout = function(destLayout, srcLayout) { return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers); }; plots.transition = function(gd2, data, layout, traces, frameOpts, transitionOpts) { var opts = { redraw: frameOpts.redraw }; var transitionedTraces = {}; var axEdits = []; opts.prepareFn = function() { var dataLength = Array.isArray(data) ? data.length : 0; var traceIndices = traces.slice(0, dataLength); for (var i = 0; i < traceIndices.length; i++) { var traceIdx = traceIndices[i]; var trace = gd2._fullData[traceIdx]; var _module = trace._module; if (!_module) continue; if (_module.animatable) { var n = _module.basePlotModule.name; if (!transitionedTraces[n]) transitionedTraces[n] = []; transitionedTraces[n].push(traceIdx); } gd2.data[traceIndices[i]] = plots.extendTrace(gd2.data[traceIndices[i]], data[i]); } var layoutUpdate = Lib.expandObjectPaths(Lib.extendDeepNoArrays({}, layout)); var axisAttrRe = /^[xy]axis[0-9]*$/; for (var attr in layoutUpdate) { if (!axisAttrRe.test(attr)) continue; delete layoutUpdate[attr].range; } plots.extendLayout(gd2.layout, layoutUpdate); delete gd2.calcdata; plots.supplyDefaults(gd2); plots.doCalcdata(gd2); var newLayout = Lib.expandObjectPaths(layout); if (newLayout) { var subplots = gd2._fullLayout._plots; for (var k in subplots) { var plotinfo = subplots[k]; var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var xr0 = xa2.range.slice(); var yr0 = ya2.range.slice(); var xr1 = null; var yr1 = null; var editX = null; var editY = null; if (Array.isArray(newLayout[xa2._name + ".range"])) { xr1 = newLayout[xa2._name + ".range"].slice(); } else if (Array.isArray((newLayout[xa2._name] || {}).range)) { xr1 = newLayout[xa2._name].range.slice(); } if (Array.isArray(newLayout[ya2._name + ".range"])) { yr1 = newLayout[ya2._name + ".range"].slice(); } else if (Array.isArray((newLayout[ya2._name] || {}).range)) { yr1 = newLayout[ya2._name].range.slice(); } if (xr0 && xr1 && (xa2.r2l(xr0[0]) !== xa2.r2l(xr1[0]) || xa2.r2l(xr0[1]) !== xa2.r2l(xr1[1]))) { editX = { xr0, xr1 }; } if (yr0 && yr1 && (ya2.r2l(yr0[0]) !== ya2.r2l(yr1[0]) || ya2.r2l(yr0[1]) !== ya2.r2l(yr1[1]))) { editY = { yr0, yr1 }; } if (editX || editY) { axEdits.push(Lib.extendFlat({ plotinfo }, editX, editY)); } } } return Promise.resolve(); }; opts.runFn = function(makeCallback) { var traceTransitionOpts; var basePlotModules = gd2._fullLayout._basePlotModules; var hasAxisTransition = axEdits.length; var i; if (layout) { for (i = 0; i < basePlotModules.length; i++) { if (basePlotModules[i].transitionAxes) { basePlotModules[i].transitionAxes(gd2, axEdits, transitionOpts, makeCallback); } } } if (hasAxisTransition) { traceTransitionOpts = Lib.extendFlat({}, transitionOpts); traceTransitionOpts.duration = 0; delete transitionedTraces.cartesian; } else { traceTransitionOpts = transitionOpts; } for (var n in transitionedTraces) { var traceIndices = transitionedTraces[n]; var _module = gd2._fullData[traceIndices[0]]._module; _module.basePlotModule.plot(gd2, traceIndices, traceTransitionOpts, makeCallback); } }; return _transition(gd2, transitionOpts, opts); }; plots.transitionFromReact = function(gd2, restyleFlags, relayoutFlags, oldFullLayout) { var fullLayout = gd2._fullLayout; var transitionOpts = fullLayout.transition; var opts = {}; var axEdits = []; opts.prepareFn = function() { var subplots = fullLayout._plots; opts.redraw = false; if (restyleFlags.anim === "some") opts.redraw = true; if (relayoutFlags.anim === "some") opts.redraw = true; for (var k in subplots) { var plotinfo = subplots[k]; var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var xr0 = oldFullLayout[xa2._name].range.slice(); var yr0 = oldFullLayout[ya2._name].range.slice(); var xr1 = xa2.range.slice(); var yr1 = ya2.range.slice(); xa2.setScale(); ya2.setScale(); var editX = null; var editY = null; if (xa2.r2l(xr0[0]) !== xa2.r2l(xr1[0]) || xa2.r2l(xr0[1]) !== xa2.r2l(xr1[1])) { editX = { xr0, xr1 }; } if (ya2.r2l(yr0[0]) !== ya2.r2l(yr1[0]) || ya2.r2l(yr0[1]) !== ya2.r2l(yr1[1])) { editY = { yr0, yr1 }; } if (editX || editY) { axEdits.push(Lib.extendFlat({ plotinfo }, editX, editY)); } } return Promise.resolve(); }; opts.runFn = function(makeCallback) { var fullData = gd2._fullData; var fullLayout2 = gd2._fullLayout; var basePlotModules = fullLayout2._basePlotModules; var axisTransitionOpts; var traceTransitionOpts; var transitionedTraces; var allTraceIndices = []; for (var i = 0; i < fullData.length; i++) { allTraceIndices.push(i); } function transitionAxes() { if (!gd2._fullLayout) return; for (var j = 0; j < basePlotModules.length; j++) { if (basePlotModules[j].transitionAxes) { basePlotModules[j].transitionAxes(gd2, axEdits, axisTransitionOpts, makeCallback); } } } function transitionTraces() { if (!gd2._fullLayout) return; for (var j = 0; j < basePlotModules.length; j++) { basePlotModules[j].plot(gd2, transitionedTraces, traceTransitionOpts, makeCallback); } } if (axEdits.length && restyleFlags.anim) { if (transitionOpts.ordering === "traces first") { axisTransitionOpts = Lib.extendFlat({}, transitionOpts, { duration: 0 }); transitionedTraces = allTraceIndices; traceTransitionOpts = transitionOpts; setTimeout(transitionAxes, transitionOpts.duration); transitionTraces(); } else { axisTransitionOpts = transitionOpts; transitionedTraces = null; traceTransitionOpts = Lib.extendFlat({}, transitionOpts, { duration: 0 }); setTimeout(transitionTraces, axisTransitionOpts.duration); transitionAxes(); } } else if (axEdits.length) { axisTransitionOpts = transitionOpts; transitionAxes(); } else if (restyleFlags.anim) { transitionedTraces = allTraceIndices; traceTransitionOpts = transitionOpts; transitionTraces(); } }; return _transition(gd2, transitionOpts, opts); }; function _transition(gd2, transitionOpts, opts) { var aborted = false; function executeCallbacks(list) { var p = Promise.resolve(); if (!list) return p; while (list.length) { p = p.then(list.shift()); } return p; } function flushCallbacks(list) { if (!list) return; while (list.length) { list.shift(); } } function executeTransitions() { gd2.emit("plotly_transitioning", []); return new Promise(function(resolve) { gd2._transitioning = true; if (transitionOpts.duration > 0) { gd2._transitioningWithDuration = true; } gd2._transitionData._interruptCallbacks.push(function() { aborted = true; }); if (opts.redraw) { gd2._transitionData._interruptCallbacks.push(function() { return Registry.call("redraw", gd2); }); } gd2._transitionData._interruptCallbacks.push(function() { gd2.emit("plotly_transitioninterrupted", []); }); var numCallbacks = 0; var numCompleted = 0; function makeCallback() { numCallbacks++; return function() { numCompleted++; if (!aborted && numCompleted === numCallbacks) { completeTransition(resolve); } }; } opts.runFn(makeCallback); setTimeout(makeCallback()); }); } function completeTransition(callback) { if (!gd2._transitionData) return; flushCallbacks(gd2._transitionData._interruptCallbacks); return Promise.resolve().then(function() { if (opts.redraw) { return Registry.call("redraw", gd2); } }).then(function() { gd2._transitioning = false; gd2._transitioningWithDuration = false; gd2.emit("plotly_transitioned", []); }).then(callback); } function interruptPreviousTransitions() { if (!gd2._transitionData) return; gd2._transitioning = false; return executeCallbacks(gd2._transitionData._interruptCallbacks); } var seq = [ plots.previousPromises, interruptPreviousTransitions, opts.prepareFn, plots.rehover, plots.reselect, executeTransitions ]; var transitionStarting = Lib.syncOrAsync(seq, gd2); if (!transitionStarting || !transitionStarting.then) { transitionStarting = Promise.resolve(); } return transitionStarting.then(function() { return gd2; }); } plots.doCalcdata = function(gd2, traces) { var axList = axisIDs.list(gd2); var fullData = gd2._fullData; var fullLayout = gd2._fullLayout; var trace, _module, i, j; var calcdata = new Array(fullData.length); var oldCalcdata = (gd2.calcdata || []).slice(); gd2.calcdata = calcdata; fullLayout._numBoxes = 0; fullLayout._numViolins = 0; fullLayout._violinScaleGroupStats = {}; gd2._hmpixcount = 0; gd2._hmlumcount = 0; fullLayout._piecolormap = {}; fullLayout._sunburstcolormap = {}; fullLayout._treemapcolormap = {}; fullLayout._iciclecolormap = {}; fullLayout._funnelareacolormap = {}; for (i = 0; i < fullData.length; i++) { if (Array.isArray(traces) && traces.indexOf(i) === -1) { calcdata[i] = oldCalcdata[i]; continue; } } for (i = 0; i < fullData.length; i++) { trace = fullData[i]; trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); trace._extremes = {}; } var polarIds = fullLayout._subplots.polar || []; for (i = 0; i < polarIds.length; i++) { axList.push( fullLayout[polarIds[i]].radialaxis, fullLayout[polarIds[i]].angularaxis ); } for (var k in fullLayout._colorAxes) { var cOpts = fullLayout[k]; if (cOpts.cauto !== false) { delete cOpts.cmin; delete cOpts.cmax; } } var hasCalcTransform = false; function transformCalci(i2) { trace = fullData[i2]; _module = trace._module; if (trace.visible === true && trace.transforms) { if (_module && _module.calc) { var cdi = _module.calc(gd2, trace); if (cdi[0] && cdi[0].t && cdi[0].t._scene) { delete cdi[0].t._scene.dirty; } } for (j = 0; j < trace.transforms.length; j++) { var transform = trace.transforms[j]; _module = transformsRegistry[transform.type]; if (_module && _module.calcTransform) { trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd2, trace, transform); } } } } function calci(i2, isContainer) { trace = fullData[i2]; _module = trace._module; if (!!_module.isContainer !== isContainer) return; var cd2 = []; if (trace.visible === true && trace._length !== 0) { delete trace._indexToPoints; var transforms = trace.transforms || []; for (j = transforms.length - 1; j >= 0; j--) { if (transforms[j].enabled) { trace._indexToPoints = transforms[j]._indexToPoints; break; } } if (_module && _module.calc) { cd2 = _module.calc(gd2, trace); } } if (!Array.isArray(cd2) || !cd2[0]) { cd2 = [{ x: BADNUM, y: BADNUM }]; } if (!cd2[0].t) cd2[0].t = {}; cd2[0].trace = trace; calcdata[i2] = cd2; } setupAxisCategories(axList, fullData, fullLayout); for (i = 0; i < fullData.length; i++) calci(i, true); for (i = 0; i < fullData.length; i++) transformCalci(i); if (hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout); for (i = 0; i < fullData.length; i++) calci(i, true); for (i = 0; i < fullData.length; i++) calci(i, false); doCrossTraceCalc(gd2); var sorted = sortAxisCategoriesByValue(axList, gd2); if (sorted.length) { fullLayout._numBoxes = 0; fullLayout._numViolins = 0; for (i = 0; i < sorted.length; i++) calci(sorted[i], true); for (i = 0; i < sorted.length; i++) calci(sorted[i], false); doCrossTraceCalc(gd2); } Registry.getComponentMethod("fx", "calc")(gd2); Registry.getComponentMethod("errorbars", "calc")(gd2); }; var sortAxisCategoriesByValueRegex = /(total|sum|min|max|mean|geometric mean|median) (ascending|descending)/; function sortAxisCategoriesByValue(axList, gd2) { var affectedTraces = []; var i, j, k, l, o; function zMapCategory(type2, ax2, value2) { var axLetter2 = ax2._id.charAt(0); if (type2 === "histogram2dcontour") { var counterAxLetter = ax2._counterAxes[0]; var counterAx = axisIDs.getFromId(gd2, counterAxLetter); var xCategorical = axLetter2 === "x" || counterAxLetter === "x" && counterAx.type === "category"; var yCategorical = axLetter2 === "y" || counterAxLetter === "y" && counterAx.type === "category"; return function(o2, l2) { if (o2 === 0 || l2 === 0) return -1; if (xCategorical && o2 === value2[l2].length - 1) return -1; if (yCategorical && l2 === value2.length - 1) return -1; return (axLetter2 === "y" ? l2 : o2) - 1; }; } else { return function(o2, l2) { return axLetter2 === "y" ? l2 : o2; }; } } var aggFn = { min: function(values) { return Lib.aggNums(Math.min, null, values); }, max: function(values) { return Lib.aggNums(Math.max, null, values); }, sum: function(values) { return Lib.aggNums(function(a, b) { return a + b; }, null, values); }, total: function(values) { return Lib.aggNums(function(a, b) { return a + b; }, null, values); }, mean: function(values) { return Lib.mean(values); }, "geometric mean": function(values) { return Lib.geometricMean(values); }, median: function(values) { return Lib.median(values); } }; function sortAscending(a, b) { return a[1] - b[1]; } function sortDescending(a, b) { return b[1] - a[1]; } for (i = 0; i < axList.length; i++) { var ax = axList[i]; if (ax.type !== "category") continue; var match = ax.categoryorder.match(sortAxisCategoriesByValueRegex); if (match) { var aggregator = match[1]; var order = match[2]; var axLetter = ax._id.charAt(0); var isX = axLetter === "x"; var categoriesValue = []; for (j = 0; j < ax._categories.length; j++) { categoriesValue.push([ax._categories[j], []]); } for (j = 0; j < ax._traceIndices.length; j++) { var traceIndex = ax._traceIndices[j]; var fullTrace = gd2._fullData[traceIndex]; if (fullTrace.visible !== true) continue; var type = fullTrace.type; if (Registry.traceIs(fullTrace, "histogram")) { delete fullTrace._xautoBinFinished; delete fullTrace._yautoBinFinished; } var isSplom = type === "splom"; var isScattergl = type === "scattergl"; var cd2 = gd2.calcdata[traceIndex]; for (k = 0; k < cd2.length; k++) { var cdi = cd2[k]; var catIndex, value; if (isSplom) { var currentDimensionIndex = fullTrace._axesDim[ax._id]; if (!isX) { var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0]; if (associatedXAxisID) ax = gd2._fullLayout[axisIDs.id2name(associatedXAxisID)]; } var categories = cdi.trace.dimensions[currentDimensionIndex].values; for (l = 0; l < categories.length; l++) { catIndex = ax._categoriesMap[categories[l]]; for (o = 0; o < cdi.trace.dimensions.length; o++) { if (o === currentDimensionIndex) continue; var dimension = cdi.trace.dimensions[o]; categoriesValue[catIndex][1].push(dimension.values[l]); } } } else if (isScattergl) { for (l = 0; l < cdi.t.x.length; l++) { if (isX) { catIndex = cdi.t.x[l]; value = cdi.t.y[l]; } else { catIndex = cdi.t.y[l]; value = cdi.t.x[l]; } categoriesValue[catIndex][1].push(value); } if (cdi.t && cdi.t._scene) { delete cdi.t._scene.dirty; } } else if (cdi.hasOwnProperty("z")) { value = cdi.z; var mapping = zMapCategory(fullTrace.type, ax, value); for (l = 0; l < value.length; l++) { for (o = 0; o < value[l].length; o++) { catIndex = mapping(o, l); if (catIndex + 1) categoriesValue[catIndex][1].push(value[l][o]); } } } else { catIndex = cdi.p; if (catIndex === void 0) catIndex = cdi[axLetter]; value = cdi.s; if (value === void 0) value = cdi.v; if (value === void 0) value = isX ? cdi.y : cdi.x; if (!Array.isArray(value)) { if (value === void 0) value = []; else value = [value]; } for (l = 0; l < value.length; l++) { categoriesValue[catIndex][1].push(value[l]); } } } } ax._categoriesValue = categoriesValue; var categoriesAggregatedValue = []; for (j = 0; j < categoriesValue.length; j++) { categoriesAggregatedValue.push([ categoriesValue[j][0], aggFn[aggregator](categoriesValue[j][1]) ]); } categoriesAggregatedValue.sort(order === "descending" ? sortDescending : sortAscending); ax._categoriesAggregatedValue = categoriesAggregatedValue; ax._initialCategories = categoriesAggregatedValue.map(function(c) { return c[0]; }); affectedTraces = affectedTraces.concat(ax.sortByInitialCategories()); } } return affectedTraces; } function setupAxisCategories(axList, fullData, fullLayout) { var axLookup = {}; function setupOne(ax) { ax.clearCalc(); if (ax.type === "multicategory") { ax.setupMultiCategory(fullData); } axLookup[ax._id] = 1; } Lib.simpleMap(axList, setupOne); var matchGroups = fullLayout._axisMatchGroups || []; for (var i = 0; i < matchGroups.length; i++) { for (var axId in matchGroups[i]) { if (!axLookup[axId]) { setupOne(fullLayout[axisIDs.id2name(axId)]); } } } } function doCrossTraceCalc(gd2) { var fullLayout = gd2._fullLayout; var modules = fullLayout._visibleModules; var hash = {}; var i, j, k; for (j = 0; j < modules.length; j++) { var _module = modules[j]; var fn = _module.crossTraceCalc; if (fn) { var spType = _module.basePlotModule.name; if (hash[spType]) { Lib.pushUnique(hash[spType], fn); } else { hash[spType] = [fn]; } } } for (k in hash) { var methods = hash[k]; var subplots = fullLayout._subplots[k]; if (Array.isArray(subplots)) { for (i = 0; i < subplots.length; i++) { var sp2 = subplots[i]; var spInfo = k === "cartesian" ? fullLayout._plots[sp2] : fullLayout[sp2]; for (j = 0; j < methods.length; j++) { methods[j](gd2, spInfo, sp2); } } } else { for (j = 0; j < methods.length; j++) { methods[j](gd2); } } } } plots.rehover = function(gd2) { if (gd2._fullLayout._rehover) { gd2._fullLayout._rehover(); } }; plots.redrag = function(gd2) { if (gd2._fullLayout._redrag) { gd2._fullLayout._redrag(); } }; plots.reselect = function(gd2) { var fullLayout = gd2._fullLayout; var A = (gd2.layout || {}).selections; var B = fullLayout._previousSelections; fullLayout._previousSelections = A; var mayEmitSelected = fullLayout._reselect || JSON.stringify(A) !== JSON.stringify(B); Registry.getComponentMethod("selections", "reselect")(gd2, mayEmitSelected); }; plots.generalUpdatePerTraceModule = function(gd2, subplot, subplotCalcData, subplotLayout) { var traceHashOld = subplot.traceHash; var traceHash = {}; var i; for (i = 0; i < subplotCalcData.length; i++) { var calcTraces = subplotCalcData[i]; var trace = calcTraces[0].trace; if (trace.visible) { traceHash[trace.type] = traceHash[trace.type] || []; traceHash[trace.type].push(calcTraces); } } for (var moduleNameOld in traceHashOld) { if (!traceHash[moduleNameOld]) { var fakeCalcTrace = traceHashOld[moduleNameOld][0]; var fakeTrace = fakeCalcTrace[0].trace; fakeTrace.visible = false; traceHash[moduleNameOld] = [fakeCalcTrace]; } } for (var moduleName in traceHash) { var moduleCalcData = traceHash[moduleName]; var _module = moduleCalcData[0][0].trace._module; _module.plot(gd2, subplot, Lib.filterVisible(moduleCalcData), subplotLayout); } subplot.traceHash = traceHash; }; plots.plotBasePlot = function(desiredType, gd2, traces, transitionOpts, makeOnCompleteCallback) { var _module = Registry.getModule(desiredType); var cdmodule = getModuleCalcData(gd2.calcdata, _module)[0]; _module.plot(gd2, cdmodule, transitionOpts, makeOnCompleteCallback); }; plots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullData, oldFullLayout) { var had = oldFullLayout._has && oldFullLayout._has(desiredType); var has = newFullLayout._has && newFullLayout._has(desiredType); if (had && !has) { oldFullLayout["_" + desiredType + "layer"].selectAll("g.trace").remove(); } }; } }); // node_modules/plotly.js/src/constants/xmlns_namespaces.js var require_xmlns_namespaces = __commonJS({ "node_modules/plotly.js/src/constants/xmlns_namespaces.js"(exports2) { "use strict"; exports2.xmlns = "http://www.w3.org/2000/xmlns/"; exports2.svg = "http://www.w3.org/2000/svg"; exports2.xlink = "http://www.w3.org/1999/xlink"; exports2.svgAttrs = { xmlns: exports2.svg, "xmlns:xlink": exports2.xlink }; } }); // node_modules/plotly.js/src/constants/alignment.js var require_alignment = __commonJS({ "node_modules/plotly.js/src/constants/alignment.js"(exports2, module2) { "use strict"; module2.exports = { // from bottom left: this is the origin of our paper-reference // positioning system FROM_BL: { left: 0, center: 0.5, right: 1, bottom: 0, middle: 0.5, top: 1 }, // from top left: this is the screen pixel positioning origin FROM_TL: { left: 0, center: 0.5, right: 1, bottom: 1, middle: 0.5, top: 0 }, // from bottom right: sometimes you just need the opposite of ^^ FROM_BR: { left: 1, center: 0.5, right: 0, bottom: 0, middle: 0.5, top: 1 }, // multiple of fontSize to get the vertical offset between lines LINE_SPACING: 1.3, // multiple of fontSize to shift from the baseline // to the cap (captical letter) line // (to use when we don't calculate this shift from Drawing.bBox) // This is an approximation since in reality cap height can differ // from font to font. However, according to Wikipedia // an "average" font might have a cap height of 70% of the em // https://en.wikipedia.org/wiki/Em_(typography)#History CAP_SHIFT: 0.7, // half the cap height (distance between baseline and cap line) // of an "average" font (for more info see above). MID_SHIFT: 0.35, OPPOSITE_SIDE: { left: "right", right: "left", top: "bottom", bottom: "top" } }; } }); // node_modules/plotly.js/src/lib/svg_text_utils.js var require_svg_text_utils = __commonJS({ "node_modules/plotly.js/src/lib/svg_text_utils.js"(exports2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var xmlnsNamespaces = require_xmlns_namespaces(); var LINE_SPACING = require_alignment().LINE_SPACING; var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; exports2.convertToTspans = function(_context, gd2, _callback) { var str = _context.text(); var tex = !_context.attr("data-notex") && gd2 && gd2._context.typesetMath && typeof MathJax !== "undefined" && str.match(FIND_TEX); var parent = d3.select(_context.node().parentNode); if (parent.empty()) return; var svgClass = _context.attr("class") ? _context.attr("class").split(" ")[0] : "text"; svgClass += "-math"; parent.selectAll("svg." + svgClass).remove(); parent.selectAll("g." + svgClass + "-group").remove(); _context.style("display", null).attr({ // some callers use data-unformatted *from the element* in 'cancel' // so we need it here even if we're going to turn it into math // these two (plus style and text-anchor attributes) form the key we're // going to use for Drawing.bBox "data-unformatted": str, "data-math": "N" }); function showText() { if (!parent.empty()) { svgClass = _context.attr("class") + "-math"; parent.select("svg." + svgClass).remove(); } _context.text("").style("white-space", "pre"); var hasLink = buildSVGText(_context.node(), str); if (hasLink) { _context.style("pointer-events", "all"); } exports2.positionText(_context); if (_callback) _callback.call(_context); } if (tex) { (gd2 && gd2._promises || []).push(new Promise(function(resolve) { _context.style("display", "none"); var fontSize = parseInt(_context.node().style.fontSize, 10); var config = { fontSize }; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll("svg." + svgClass).remove(); parent.selectAll("g." + svgClass + "-group").remove(); var newSvg = _svgEl && _svgEl.select("svg"); if (!newSvg || !newSvg.node()) { showText(); resolve(); return; } var mathjaxGroup = parent.append("g").classed(svgClass + "-group", true).attr({ "pointer-events": "none", "data-unformatted": str, "data-math": "Y" }); mathjaxGroup.node().appendChild(newSvg.node()); if (_glyphDefs && _glyphDefs.node()) { newSvg.node().insertBefore( _glyphDefs.node().cloneNode(true), newSvg.node().firstChild ); } var w02 = _svgBBox.width; var h02 = _svgBBox.height; newSvg.attr({ class: svgClass, height: h02, preserveAspectRatio: "xMinYMin meet" }).style({ overflow: "visible", "pointer-events": "none" }); var fill = _context.node().style.fill || "black"; var g = newSvg.select("g"); g.attr({ fill, stroke: fill }); var bb = g.node().getBoundingClientRect(); var w = bb.width; var h = bb.height; if (w > w02 || h > h02) { newSvg.style("overflow", "hidden"); bb = newSvg.node().getBoundingClientRect(); w = bb.width; h = bb.height; } var x = +_context.attr("x"); var y = +_context.attr("y"); var textHeight = fontSize || _context.node().getBoundingClientRect().height; var dy = -textHeight / 4; if (svgClass[0] === "y") { mathjaxGroup.attr({ transform: "rotate(" + [-90, x, y] + ")" + strTranslate(-w / 2, dy - h / 2) }); } else if (svgClass[0] === "l") { y = dy - h / 2; } else if (svgClass[0] === "a" && svgClass.indexOf("atitle") !== 0) { x = 0; y = dy; } else { var anchor = _context.attr("text-anchor"); x = x - w * (anchor === "middle" ? 0.5 : anchor === "end" ? 1 : 0); y = y + dy - h / 2; } newSvg.attr({ x, y }); if (_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); } else showText(); return _context; }; var LT_MATCH = /(<|<|<)/g; var GT_MATCH = /(>|>|>)/g; function cleanEscapesForTex(s) { return s.replace(LT_MATCH, "\\lt ").replace(GT_MATCH, "\\gt "); } var inlineMath = [["$", "$"], ["\\(", "\\)"]]; function texToSVG(_texString, _config, _callback) { var MathJaxVersion = parseInt( (MathJax.version || "").split(".")[0] ); if (MathJaxVersion !== 2 && MathJaxVersion !== 3) { Lib.warn("No MathJax version:", MathJax.version); return; } var originalRenderer, originalConfig, originalProcessSectionDelay, tmpDiv; var setConfig2 = function() { originalConfig = Lib.extendDeepAll({}, MathJax.Hub.config); originalProcessSectionDelay = MathJax.Hub.processSectionDelay; if (MathJax.Hub.processSectionDelay !== void 0) { MathJax.Hub.processSectionDelay = 0; } return MathJax.Hub.Config({ messageStyle: "none", tex2jax: { inlineMath }, displayAlign: "left" }); }; var setConfig3 = function() { originalConfig = Lib.extendDeepAll({}, MathJax.config); if (!MathJax.config.tex) { MathJax.config.tex = {}; } MathJax.config.tex.inlineMath = inlineMath; }; var setRenderer2 = function() { originalRenderer = MathJax.Hub.config.menuSettings.renderer; if (originalRenderer !== "SVG") { return MathJax.Hub.setRenderer("SVG"); } }; var setRenderer3 = function() { originalRenderer = MathJax.config.startup.output; if (originalRenderer !== "svg") { MathJax.config.startup.output = "svg"; } }; var initiateMathJax = function() { var randomID = "math-output-" + Lib.randstr({}, 64); tmpDiv = d3.select("body").append("div").attr({ id: randomID }).style({ visibility: "hidden", position: "absolute", "font-size": _config.fontSize + "px" }).text(cleanEscapesForTex(_texString)); var tmpNode = tmpDiv.node(); return MathJaxVersion === 2 ? MathJax.Hub.Typeset(tmpNode) : MathJax.typeset([tmpNode]); }; var finalizeMathJax = function() { var sel = tmpDiv.select( MathJaxVersion === 2 ? ".MathJax_SVG" : ".MathJax" ); var node = !sel.empty() && tmpDiv.select("svg").node(); if (!node) { Lib.log("There was an error in the tex syntax.", _texString); _callback(); } else { var nodeBBox = node.getBoundingClientRect(); var glyphDefs; if (MathJaxVersion === 2) { glyphDefs = d3.select("body").select("#MathJax_SVG_glyphs"); } else { glyphDefs = sel.select("defs"); } _callback(sel, glyphDefs, nodeBBox); } tmpDiv.remove(); }; var resetRenderer2 = function() { if (originalRenderer !== "SVG") { return MathJax.Hub.setRenderer(originalRenderer); } }; var resetRenderer3 = function() { if (originalRenderer !== "svg") { MathJax.config.startup.output = originalRenderer; } }; var resetConfig2 = function() { if (originalProcessSectionDelay !== void 0) { MathJax.Hub.processSectionDelay = originalProcessSectionDelay; } return MathJax.Hub.Config(originalConfig); }; var resetConfig3 = function() { MathJax.config = originalConfig; }; if (MathJaxVersion === 2) { MathJax.Hub.Queue( setConfig2, setRenderer2, initiateMathJax, finalizeMathJax, resetRenderer2, resetConfig2 ); } else if (MathJaxVersion === 3) { setConfig3(); setRenderer3(); MathJax.startup.defaultReady(); MathJax.startup.promise.then(function() { initiateMathJax(); finalizeMathJax(); resetRenderer3(); resetConfig3(); }); } } var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below sup: "font-size:70%", sub: "font-size:70%", s: "text-decoration:line-through", u: "text-decoration:underline", b: "font-weight:bold", i: "font-style:italic", a: "cursor:pointer", span: "", em: "font-style:italic;font-weight:bold" }; var SHIFT_DY = { sub: "0.3em", sup: "-0.6em" }; var RESET_DY = { sub: "-0.21em", sup: "0.42em" }; var ZERO_WIDTH_SPACE = "​"; var PROTOCOLS = ["http:", "https:", "mailto:", "", void 0, ":"]; var NEWLINES = exports2.NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; var BR_TAG = //i; exports2.BR_TAG_ALL = //gi; var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i; function getQuotedMatch(_str, re2) { if (!_str) return null; var match = _str.match(re2); var result = match && (match[3] || match[4]); return result && convertEntities(result); } var COLORMATCH = /(^|;)\s*color:/; exports2.plainText = function(_str, opts) { opts = opts || {}; var len = opts.len !== void 0 && opts.len !== -1 ? opts.len : Infinity; var allowedTags = opts.allowedTags !== void 0 ? opts.allowedTags : ["br"]; var ellipsis = "..."; var eLen = ellipsis.length; var oldParts = _str.split(SPLIT_TAGS); var newParts = []; var prevTag = ""; var l = 0; for (var i = 0; i < oldParts.length; i++) { var p = oldParts[i]; var match = p.match(ONE_TAG); var tagType = match && match[2].toLowerCase(); if (tagType) { if (allowedTags.indexOf(tagType) !== -1) { newParts.push(p); prevTag = tagType; } } else { var pLen = p.length; if (l + pLen < len) { newParts.push(p); l += pLen; } else if (l < len) { var pLen2 = len - l; if (prevTag && (prevTag !== "br" || pLen2 <= eLen || pLen <= eLen)) { newParts.pop(); } if (len > eLen) { newParts.push(p.substr(0, pLen2 - eLen) + ellipsis); } else { newParts.push(p.substr(0, pLen2)); } break; } prevTag = ""; } } return newParts.join(""); }; var entityToUnicode = { mu: "μ", amp: "&", lt: "<", gt: ">", nbsp: " ", times: "×", plusmn: "±", deg: "°" }; var ENTITY_MATCH = /&(#\d+|#x[\da-fA-F]+|[a-z]+);/g; function convertEntities(_str) { return _str.replace(ENTITY_MATCH, function(fullMatch, innerMatch) { var outChar; if (innerMatch.charAt(0) === "#") { outChar = fromCodePoint( innerMatch.charAt(1) === "x" ? parseInt(innerMatch.substr(2), 16) : parseInt(innerMatch.substr(1), 10) ); } else outChar = entityToUnicode[innerMatch]; return outChar || fullMatch; }); } exports2.convertEntities = convertEntities; function fromCodePoint(code) { if (code > 1114111) return; var stringFromCodePoint = String.fromCodePoint; if (stringFromCodePoint) return stringFromCodePoint(code); var stringFromCharCode = String.fromCharCode; if (code <= 65535) return stringFromCharCode(code); return stringFromCharCode( (code >> 10) + 55232, code % 1024 + 56320 ); } function buildSVGText(containerNode, str) { str = str.replace(NEWLINES, " "); var hasLink = false; var nodeStack = []; var currentNode; var currentLine = -1; function newLine() { currentLine++; var lineNode = document.createElementNS(xmlnsNamespaces.svg, "tspan"); d3.select(lineNode).attr({ class: "line", dy: currentLine * LINE_SPACING + "em" }); containerNode.appendChild(lineNode); currentNode = lineNode; var oldNodeStack = nodeStack; nodeStack = [{ node: lineNode }]; if (oldNodeStack.length > 1) { for (var i2 = 1; i2 < oldNodeStack.length; i2++) { enterNode(oldNodeStack[i2]); } } } function enterNode(nodeSpec2) { var type = nodeSpec2.type; var nodeAttrs = {}; var nodeType; if (type === "a") { nodeType = "a"; var target = nodeSpec2.target; var href2 = nodeSpec2.href; var popup = nodeSpec2.popup; if (href2) { nodeAttrs = { "xlink:xlink:show": target === "_blank" || target.charAt(0) !== "_" ? "new" : "replace", target, "xlink:xlink:href": href2 }; if (popup) { nodeAttrs.onclick = 'window.open(this.href.baseVal,this.target.baseVal,"' + popup + '");return false;'; } } } else nodeType = "tspan"; if (nodeSpec2.style) nodeAttrs.style = nodeSpec2.style; var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); if (type === "sup" || type === "sub") { addTextNode(currentNode, ZERO_WIDTH_SPACE); currentNode.appendChild(newNode); var resetter = document.createElementNS(xmlnsNamespaces.svg, "tspan"); addTextNode(resetter, ZERO_WIDTH_SPACE); d3.select(resetter).attr("dy", RESET_DY[type]); nodeAttrs.dy = SHIFT_DY[type]; currentNode.appendChild(newNode); currentNode.appendChild(resetter); } else { currentNode.appendChild(newNode); } d3.select(newNode).attr(nodeAttrs); currentNode = nodeSpec2.node = newNode; nodeStack.push(nodeSpec2); } function addTextNode(node, text) { node.appendChild(document.createTextNode(text)); } function exitNode(type) { if (nodeStack.length === 1) { Lib.log("Ignoring unexpected end tag .", str); return; } var innerNode = nodeStack.pop(); if (type !== innerNode.type) { Lib.log("Start tag <" + innerNode.type + "> doesnt match end tag <" + type + ">. Pretending it did match.", str); } currentNode = nodeStack[nodeStack.length - 1].node; } var hasLines = BR_TAG.test(str); if (hasLines) newLine(); else { currentNode = containerNode; nodeStack = [{ node: containerNode }]; } var parts = str.split(SPLIT_TAGS); for (var i = 0; i < parts.length; i++) { var parti = parts[i]; var match = parti.match(ONE_TAG); var tagType = match && match[2].toLowerCase(); var tagStyle = TAG_STYLES[tagType]; if (tagType === "br") { newLine(); } else if (tagStyle === void 0) { addTextNode(currentNode, convertEntities(parti)); } else { if (match[1]) { exitNode(tagType); } else { var extra = match[4]; var nodeSpec = { type: tagType }; var css = getQuotedMatch(extra, STYLEMATCH); if (css) { css = css.replace(COLORMATCH, "$1 fill:"); if (tagStyle) css += ";" + tagStyle; } else if (tagStyle) css = tagStyle; if (css) nodeSpec.style = css; if (tagType === "a") { hasLink = true; var href = getQuotedMatch(extra, HREFMATCH); if (href) { var safeHref = sanitizeHref(href); if (safeHref) { nodeSpec.href = safeHref; nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || "_blank"; nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); } } } enterNode(nodeSpec); } } } return hasLink; } function sanitizeHref(href) { var decodedHref = encodeURI(decodeURI(href)); var dummyAnchor1 = document.createElement("a"); var dummyAnchor2 = document.createElement("a"); dummyAnchor1.href = href; dummyAnchor2.href = decodedHref; var p12 = dummyAnchor1.protocol; var p2 = dummyAnchor2.protocol; if (PROTOCOLS.indexOf(p12) !== -1 && PROTOCOLS.indexOf(p2) !== -1) { return decodedHref; } else { return ""; } } exports2.sanitizeHTML = function sanitizeHTML(str) { str = str.replace(NEWLINES, " "); var rootNode = document.createElement("p"); var currentNode = rootNode; var nodeStack = []; var parts = str.split(SPLIT_TAGS); for (var i = 0; i < parts.length; i++) { var parti = parts[i]; var match = parti.match(ONE_TAG); var tagType = match && match[2].toLowerCase(); if (tagType in TAG_STYLES) { if (match[1]) { if (nodeStack.length) { currentNode = nodeStack.pop(); } } else { var extra = match[4]; var css = getQuotedMatch(extra, STYLEMATCH); var nodeAttrs = css ? { style: css } : {}; if (tagType === "a") { var href = getQuotedMatch(extra, HREFMATCH); if (href) { var safeHref = sanitizeHref(href); if (safeHref) { nodeAttrs.href = safeHref; var target = getQuotedMatch(extra, TARGETMATCH); if (target) { nodeAttrs.target = target; } } } } var newNode = document.createElement(tagType); currentNode.appendChild(newNode); d3.select(newNode).attr(nodeAttrs); currentNode = newNode; nodeStack.push(newNode); } } else { currentNode.appendChild( document.createTextNode(convertEntities(parti)) ); } } var key = "innerHTML"; return rootNode[key]; }; exports2.lineCount = function lineCount(s) { return s.selectAll("tspan.line").size() || 1; }; exports2.positionText = function positionText(s, x, y) { return s.each(function() { var text = d3.select(this); function setOrGet(attr, val) { if (val === void 0) { val = text.attr(attr); if (val === null) { text.attr(attr, 0); val = 0; } } else text.attr(attr, val); return val; } var thisX = setOrGet("x", x); var thisY = setOrGet("y", y); if (this.nodeName === "text") { text.selectAll("tspan.line").attr({ x: thisX, y: thisY }); } }); }; function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign; var alignV = options.verticalAlign || "top"; var bRect = _base.node().getBoundingClientRect(); var cRect = container.node().getBoundingClientRect(); var thisRect; var getTop; var getLeft; if (alignV === "bottom") { getTop = function() { return bRect.bottom - thisRect.height; }; } else if (alignV === "middle") { getTop = function() { return bRect.top + (bRect.height - thisRect.height) / 2; }; } else { getTop = function() { return bRect.top; }; } if (alignH === "right") { getLeft = function() { return bRect.right - thisRect.width; }; } else if (alignH === "center") { getLeft = function() { return bRect.left + (bRect.width - thisRect.width) / 2; }; } else { getLeft = function() { return bRect.left; }; } return function() { thisRect = this.node().getBoundingClientRect(); var x02 = getLeft() - cRect.left; var y02 = getTop() - cRect.top; var gd2 = options.gd || {}; if (options.gd) { gd2._fullLayout._calcInverseTransform(gd2); var transformedCoords = Lib.apply3DTransform(gd2._fullLayout._invTransform)(x02, y02); x02 = transformedCoords[0]; y02 = transformedCoords[1]; } this.style({ top: y02 + "px", left: x02 + "px", "z-index": 1e3 }); return this; }; } var onePx = "1px "; exports2.makeTextShadow = function(color) { var x = onePx; var y = onePx; var b = onePx; return x + y + b + color + ", -" + x + "-" + y + b + color + ", " + x + "-" + y + b + color + ", -" + x + y + b + color; }; exports2.makeEditable = function(context, options) { var gd2 = options.gd; var _delegate = options.delegate; var dispatch = d3.dispatch("edit", "input", "cancel"); var handlerElement = _delegate || context; context.style({ "pointer-events": _delegate ? "none" : "all" }); if (context.size() !== 1) throw new Error("boo"); function handleClick() { appendEditable(); context.style({ opacity: 0 }); var svgClass = handlerElement.attr("class"); var mathjaxClass; if (svgClass) mathjaxClass = "." + svgClass.split(" ")[0] + "-math-group"; else mathjaxClass = "[class*=-math-group]"; if (mathjaxClass) { d3.select(context.node().parentNode).select(mathjaxClass).style({ opacity: 0 }); } } function selectElementContents(_el) { var el = _el.node(); var range = document.createRange(); range.selectNodeContents(el); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); el.focus(); } function appendEditable() { var plotDiv = d3.select(gd2); var container = plotDiv.select(".svg-container"); var div = container.append("div"); var cStyle = context.node().style; var fontSize = parseFloat(cStyle.fontSize || 12); var initialText = options.text; if (initialText === void 0) initialText = context.attr("data-unformatted"); div.classed("plugin-editable editable", true).style({ position: "absolute", "font-family": cStyle.fontFamily || "Arial", "font-size": fontSize, color: options.fill || cStyle.fill || "black", opacity: 1, "background-color": options.background || "transparent", outline: "#ffffff33 1px solid", margin: [-fontSize / 8 + 1, 0, 0, -1].join("px ") + "px", padding: "0", "box-sizing": "border-box" }).attr({ contenteditable: true }).text(initialText).call(alignHTMLWith(context, container, options)).on("blur", function() { gd2._editing = false; context.text(this.textContent).style({ opacity: 1 }); var svgClass = d3.select(this).attr("class"); var mathjaxClass; if (svgClass) mathjaxClass = "." + svgClass.split(" ")[0] + "-math-group"; else mathjaxClass = "[class*=-math-group]"; if (mathjaxClass) { d3.select(context.node().parentNode).select(mathjaxClass).style({ opacity: 0 }); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on("mouseup", null); dispatch.edit.call(context, text); }).on("focus", function() { var editDiv = this; gd2._editing = true; d3.select(document).on("mouseup", function() { if (d3.event.target === editDiv) return false; if (document.activeElement === div.node()) div.node().blur(); }); }).on("keyup", function() { if (d3.event.which === 27) { gd2._editing = false; context.style({ opacity: 1 }); d3.select(this).style({ opacity: 0 }).on("blur", function() { return false; }).transition().remove(); dispatch.cancel.call(context, this.textContent); } else { dispatch.input.call(context, this.textContent); d3.select(this).call(alignHTMLWith(context, container, options)); } }).on("keydown", function() { if (d3.event.which === 13) this.blur(); }).call(selectElementContents); } if (options.immediate) handleClick(); else handlerElement.on("click", handleClick); return d3.rebind(context, dispatch, "on"); }; } }); // node_modules/plotly.js/src/components/colorscale/helpers.js var require_helpers = __commonJS({ "node_modules/plotly.js/src/components/colorscale/helpers.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var tinycolor = require_tinycolor(); var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Color = require_color(); var isValidScale = require_scales().isValid; function hasColorscale(trace, containerStr, colorKey) { var container = containerStr ? Lib.nestedProperty(trace, containerStr).get() || {} : trace; var color = container[colorKey || "color"]; if (color && color._inputArray) color = color._inputArray; var isArrayWithOneNumber = false; if (Lib.isArrayOrTypedArray(color)) { for (var i = 0; i < color.length; i++) { if (isNumeric(color[i])) { isArrayWithOneNumber = true; break; } } } return Lib.isPlainObject(container) && (isArrayWithOneNumber || container.showscale === true || isNumeric(container.cmin) && isNumeric(container.cmax) || isValidScale(container.colorscale) || Lib.isPlainObject(container.colorbar)); } var constantAttrs = ["showscale", "autocolorscale", "colorscale", "reversescale", "colorbar"]; var letterAttrs = ["min", "max", "mid", "auto"]; function extractOpts(cont) { var colorAx = cont._colorAx; var cont2 = colorAx ? colorAx : cont; var out = {}; var cLetter; var i, k; for (i = 0; i < constantAttrs.length; i++) { k = constantAttrs[i]; out[k] = cont2[k]; } if (colorAx) { cLetter = "c"; for (i = 0; i < letterAttrs.length; i++) { k = letterAttrs[i]; out[k] = cont2["c" + k]; } } else { var k2; for (i = 0; i < letterAttrs.length; i++) { k = letterAttrs[i]; k2 = "c" + k; if (k2 in cont2) { out[k] = cont2[k2]; continue; } k2 = "z" + k; if (k2 in cont2) { out[k] = cont2[k2]; } } cLetter = k2.charAt(0); } out._sync = function(k3, v) { var k22 = letterAttrs.indexOf(k3) !== -1 ? cLetter + k3 : k3; cont2[k22] = cont2["_" + k22] = v; }; return out; } function extractScale(cont) { var cOpts = extractOpts(cont); var cmin = cOpts.min; var cmax = cOpts.max; var scl = cOpts.reversescale ? flipScale(cOpts.colorscale) : cOpts.colorscale; var N = scl.length; var domain = new Array(N); var range = new Array(N); for (var i = 0; i < N; i++) { var si2 = scl[i]; domain[i] = cmin + si2[0] * (cmax - cmin); range[i] = si2[1]; } return { domain, range }; } function flipScale(scl) { var N = scl.length; var sclNew = new Array(N); for (var i = N - 1, j = 0; i >= 0; i--, j++) { var si2 = scl[i]; sclNew[j] = [1 - si2[0], si2[1]]; } return sclNew; } function makeColorScaleFunc(specs, opts) { opts = opts || {}; var domain = specs.domain; var range = specs.range; var N = range.length; var _range = new Array(N); for (var i = 0; i < N; i++) { var rgba = tinycolor(range[i]).toRgb(); _range[i] = [rgba.r, rgba.g, rgba.b, rgba.a]; } var _sclFunc = d3.scale.linear().domain(domain).range(_range).clamp(true); var noNumericCheck = opts.noNumericCheck; var returnArray = opts.returnArray; var sclFunc; if (noNumericCheck && returnArray) { sclFunc = _sclFunc; } else if (noNumericCheck) { sclFunc = function(v) { return colorArray2rbga(_sclFunc(v)); }; } else if (returnArray) { sclFunc = function(v) { if (isNumeric(v)) return _sclFunc(v); else if (tinycolor(v).isValid()) return v; else return Color.defaultLine; }; } else { sclFunc = function(v) { if (isNumeric(v)) return colorArray2rbga(_sclFunc(v)); else if (tinycolor(v).isValid()) return v; else return Color.defaultLine; }; } sclFunc.domain = _sclFunc.domain; sclFunc.range = function() { return range; }; return sclFunc; } function makeColorScaleFuncFromTrace(trace, opts) { return makeColorScaleFunc(extractScale(trace), opts); } function colorArray2rbga(colorArray) { var colorObj = { r: colorArray[0], g: colorArray[1], b: colorArray[2], a: colorArray[3] }; return tinycolor(colorObj).toRgbString(); } module2.exports = { hasColorscale, extractOpts, extractScale, flipScale, makeColorScaleFunc, makeColorScaleFuncFromTrace }; } }); // node_modules/plotly.js/src/plots/cartesian/axis_format_attributes.js var require_axis_format_attributes = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/axis_format_attributes.js"(exports2, module2) { "use strict"; var docs = require_docs(); var FORMAT_LINK = docs.FORMAT_LINK; var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; function axisHoverFormat(x, noDates) { return { valType: "string", dflt: "", editType: "none", description: (noDates ? descriptionOnlyNumbers : descriptionWithDates)("hover text", x) + [ "By default the values are formatted using " + (noDates ? "generic number format" : "`" + x + "axis.hoverformat`") + "." ].join(" ") }; } function descriptionOnlyNumbers(label, x) { return [ "Sets the " + label + " formatting rule" + (x ? "for `" + x + "` " : ""), "using d3 formatting mini-languages", "which are very similar to those in Python. For numbers, see: " + FORMAT_LINK + "." ].join(" "); } function descriptionWithDates(label, x) { return descriptionOnlyNumbers(label, x) + [ " And for dates see: " + DATE_FORMAT_LINK + ".", "We add two items to d3's date formatter:", "*%h* for half of the year as a decimal number as well as", "*%{n}f* for fractional seconds", "with n digits. For example, *2016-10-13 09:15:23.456* with tickformat", "*%H~%M~%S.%2f* would display *09~15~23.46*" ].join(" "); } module2.exports = { axisHoverFormat, descriptionOnlyNumbers, descriptionWithDates }; } }); // node_modules/plotly.js/src/plots/cartesian/layout_attributes.js var require_layout_attributes4 = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/layout_attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var colorAttrs = require_attributes3(); var dash = require_attributes4().dash; var extendFlat = require_extend().extendFlat; var templatedArray = require_plot_template().templatedArray; var descriptionWithDates = require_axis_format_attributes().descriptionWithDates; var ONEDAY = require_numerical().ONEDAY; var constants = require_constants2(); var HOUR = constants.HOUR_PATTERN; var DAY_OF_WEEK = constants.WEEKDAY_PATTERN; var minorTickmode = { valType: "enumerated", values: ["auto", "linear", "array"], editType: "ticks", impliedEdits: { tick0: void 0, dtick: void 0 }, description: [ "Sets the tick mode for this axis.", "If *auto*, the number of ticks is set via `nticks`.", "If *linear*, the placement of the ticks is determined by", "a starting position `tick0` and a tick step `dtick`", "(*linear* is the default value if `tick0` and `dtick` are provided).", "If *array*, the placement of the ticks is set via `tickvals`", "and the tick text is `ticktext`.", "(*array* is the default value if `tickvals` is provided)." ].join(" ") }; var tickmode = extendFlat({}, minorTickmode, { values: minorTickmode.values.slice().concat(["sync"]), description: [ minorTickmode.description, "If *sync*, the number of ticks will sync with the overlayed axis", "set by `overlaying` property." ].join(" ") }); function makeNticks(minor) { return { valType: "integer", min: 0, dflt: minor ? 5 : 0, editType: "ticks", description: [ "Specifies the maximum number of ticks for the particular axis.", "The actual number of ticks will be chosen automatically to be", "less than or equal to `nticks`.", "Has an effect only if `tickmode` is set to *auto*." ].join(" ") }; } var tick0 = { valType: "any", editType: "ticks", impliedEdits: { tickmode: "linear" }, description: [ "Sets the placement of the first tick on this axis.", "Use with `dtick`.", "If the axis `type` is *log*, then you must take the log of your starting tick", "(e.g. to set the starting tick to 100, set the `tick0` to 2)", "except when `dtick`=*L* (see `dtick` for more info).", "If the axis `type` is *date*, it should be a date string, like date data.", "If the axis `type` is *category*, it should be a number, using the scale where", "each category is assigned a serial number from zero in the order it appears." ].join(" ") }; var dtick = { valType: "any", editType: "ticks", impliedEdits: { tickmode: "linear" }, description: [ "Sets the step in-between ticks on this axis. Use with `tick0`.", "Must be a positive number, or special strings available to *log* and *date* axes.", "If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n", "is the tick number. For example,", "to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1.", "To set tick marks at 1, 100, 10000, ... set dtick to 2.", "To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433.", "*log* has several special values; *L*, where `f` is a positive number,", "gives ticks linearly spaced in value (but not position).", "For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc.", "To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5).", "`tick0` is ignored for *D1* and *D2*.", "If the axis `type` is *date*, then you must convert the time to milliseconds.", "For example, to set the interval between ticks to one day,", "set `dtick` to 86400000.0.", "*date* also has special values *M* gives ticks spaced by a number of months.", "`n` must be a positive integer.", "To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*.", "To set ticks every 4 years, set `dtick` to *M48*" ].join(" ") }; var tickvals = { valType: "data_array", editType: "ticks", description: [ "Sets the values at which ticks on this axis appear.", "Only has an effect if `tickmode` is set to *array*.", "Used with `ticktext`." ].join(" ") }; var ticks = { valType: "enumerated", values: ["outside", "inside", ""], editType: "ticks", description: [ "Determines whether ticks are drawn or not.", "If **, this axis' ticks are not drawn.", "If *outside* (*inside*), this axis' are drawn outside (inside)", "the axis lines." ].join(" ") }; function makeTicklen(minor) { var obj = { valType: "number", min: 0, editType: "ticks", description: "Sets the tick length (in px)." }; if (!minor) obj.dflt = 5; return obj; } function makeTickwidth(minor) { var obj = { valType: "number", min: 0, editType: "ticks", description: "Sets the tick width (in px)." }; if (!minor) obj.dflt = 1; return obj; } var tickcolor = { valType: "color", dflt: colorAttrs.defaultLine, editType: "ticks", description: "Sets the tick color." }; var gridcolor = { valType: "color", dflt: colorAttrs.lightLine, editType: "ticks", description: "Sets the color of the grid lines." }; function makeGridwidth(minor) { var obj = { valType: "number", min: 0, editType: "ticks", description: "Sets the width (in px) of the grid lines." }; if (!minor) obj.dflt = 1; return obj; } var griddash = extendFlat({}, dash, { editType: "ticks" }); var showgrid = { valType: "boolean", editType: "ticks", description: [ "Determines whether or not grid lines are drawn.", "If *true*, the grid lines are drawn at every tick mark." ].join(" ") }; module2.exports = { visible: { valType: "boolean", editType: "plot", description: [ "A single toggle to hide the axis while preserving interaction like dragging.", "Default is true when a cheater plot is present on the axis, otherwise", "false" ].join(" ") }, color: { valType: "color", dflt: colorAttrs.defaultLine, editType: "ticks", description: [ "Sets default for all colors associated with this axis", "all at once: line, font, tick, and grid colors.", "Grid color is lightened by blending this with the plot background", "Individual pieces can override this." ].join(" ") }, title: { text: { valType: "string", editType: "ticks", description: [ "Sets the title of this axis.", "Note that before the existence of `title.text`, the title's", "contents used to be defined as the `title` attribute itself.", "This behavior has been deprecated." ].join(" ") }, font: fontAttrs({ editType: "ticks", description: [ "Sets this axis' title font.", "Note that the title's font used to be customized", "by the now deprecated `titlefont` attribute." ].join(" ") }), standoff: { valType: "number", min: 0, editType: "ticks", description: [ "Sets the standoff distance (in px) between the axis labels and the title text", "The default value is a function of the axis tick labels, the title `font.size`", "and the axis `linewidth`.", "Note that the axis title position is always constrained within the margins,", "so the actual standoff distance is always less than the set or default value.", "By setting `standoff` and turning on `automargin`, plotly.js will push the", "margins to fit the axis title at given standoff distance." ].join(" ") }, editType: "ticks" }, type: { valType: "enumerated", // '-' means we haven't yet run autotype or couldn't find any data // it gets turned into linear in gd._fullLayout but not copied back // to gd.data like the others are. values: ["-", "linear", "log", "date", "category", "multicategory"], dflt: "-", editType: "calc", // we forget when an axis has been autotyped, just writing the auto // value back to the input - so it doesn't make sense to template this. // Note: we do NOT prohibit this in `coerce`, so if someone enters a // type in the template explicitly it will be honored as the default. _noTemplating: true, description: [ "Sets the axis type.", "By default, plotly attempts to determined the axis type", "by looking into the data of the traces that referenced", "the axis in question." ].join(" ") }, autotypenumbers: { valType: "enumerated", values: ["convert types", "strict"], dflt: "convert types", editType: "calc", description: [ "Using *strict* a numeric string in trace data is not converted to a number.", "Using *convert types* a numeric string in trace data may be", "treated as a number during automatic axis `type` detection.", "Defaults to layout.autotypenumbers." ].join(" ") }, autorange: { valType: "enumerated", values: [true, false, "reversed", "min reversed", "max reversed", "min", "max"], dflt: true, editType: "axrange", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Determines whether or not the range of this axis is", "computed in relation to the input data.", "See `rangemode` for more info.", "If `range` is provided and it has a value for both the", "lower and upper bound, `autorange` is set to *false*.", "Using *min* applies autorange only to set the minimum.", "Using *max* applies autorange only to set the maximum.", "Using *min reversed* applies autorange only to set the minimum on a reversed axis.", "Using *max reversed* applies autorange only to set the maximum on a reversed axis.", "Using *reversed* applies autorange on both ends and reverses the axis direction." ].join(" ") }, autorangeoptions: { minallowed: { valType: "any", editType: "plot", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Use this value exactly as autorange minimum." ].join(" ") }, maxallowed: { valType: "any", editType: "plot", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Use this value exactly as autorange maximum." ].join(" ") }, clipmin: { valType: "any", editType: "plot", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Clip autorange minimum if it goes beyond this value.", "Has no effect when `autorangeoptions.minallowed` is provided." ].join(" ") }, clipmax: { valType: "any", editType: "plot", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Clip autorange maximum if it goes beyond this value.", "Has no effect when `autorangeoptions.maxallowed` is provided." ].join(" ") }, include: { valType: "any", arrayOk: true, editType: "plot", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Ensure this value is included in autorange." ].join(" ") }, editType: "plot" }, rangemode: { valType: "enumerated", values: ["normal", "tozero", "nonnegative"], dflt: "normal", editType: "plot", description: [ "If *normal*, the range is computed in relation to the extrema", "of the input data.", "If *tozero*`, the range extends to 0,", "regardless of the input data", "If *nonnegative*, the range is non-negative,", "regardless of the input data.", "Applies only to linear axes." ].join(" ") }, range: { valType: "info_array", items: [ { valType: "any", editType: "axrange", impliedEdits: { "^autorange": false }, anim: true }, { valType: "any", editType: "axrange", impliedEdits: { "^autorange": false }, anim: true } ], editType: "axrange", impliedEdits: { autorange: false }, anim: true, description: [ "Sets the range of this axis.", "If the axis `type` is *log*, then you must take the log of your", "desired range (e.g. to set the range from 1 to 100,", "set the range from 0 to 2).", "If the axis `type` is *date*, it should be date strings,", "like date data, though Date objects and unix milliseconds", "will be accepted and converted to strings.", "If the axis `type` is *category*, it should be numbers,", "using the scale where each category is assigned a serial", "number from zero in the order it appears.", "Leaving either or both elements `null` impacts the default `autorange`." ].join(" ") }, minallowed: { valType: "any", editType: "plot", impliedEdits: { "^autorange": false }, description: [ "Determines the minimum range of this axis." ].join(" ") }, maxallowed: { valType: "any", editType: "plot", impliedEdits: { "^autorange": false }, description: [ "Determines the maximum range of this axis." ].join(" ") }, fixedrange: { valType: "boolean", dflt: false, editType: "calc", description: [ "Determines whether or not this axis is zoom-able.", "If true, then zoom is disabled." ].join(" ") }, insiderange: { valType: "info_array", items: [ { valType: "any", editType: "plot" }, { valType: "any", editType: "plot" } ], editType: "plot", description: [ "Could be used to set the desired inside range of this axis", "(excluding the labels) when `ticklabelposition` of", "the anchored axis has *inside*.", "Not implemented for axes with `type` *log*.", "This would be ignored when `range` is provided." ].join(" ") }, // scaleanchor: not used directly, just put here for reference // values are any opposite-letter axis id, or `false`. scaleanchor: { valType: "enumerated", values: [ constants.idRegex.x.toString(), constants.idRegex.y.toString(), false ], editType: "plot", description: [ "If set to another axis id (e.g. `x2`, `y`), the range of this axis", "changes together with the range of the corresponding axis", "such that the scale of pixels per unit is in a constant ratio.", "Both axes are still zoomable, but when you zoom one, the other will", "zoom the same amount, keeping a fixed midpoint.", "`constrain` and `constraintoward` determine how we enforce the constraint.", "You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}`", "but you can only link axes of the same `type`.", "The linked axis can have the opposite letter (to constrain the aspect ratio)", "or the same letter (to match scales across subplots).", "Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant", "and the last constraint encountered will be ignored to avoid possible", "inconsistent constraints via `scaleratio`.", "Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint", "is currently forbidden.", "Setting `false` allows to remove a default constraint (occasionally,", "you may need to prevent a default `scaleanchor` constraint from", 'being applied, eg. when having an image trace `yaxis: {scaleanchor: "x"}`', "is set automatically in order for pixels to be rendered as squares,", "setting `yaxis: {scaleanchor: false}` allows to remove the constraint)." ].join(" ") }, scaleratio: { valType: "number", min: 0, dflt: 1, editType: "plot", description: [ "If this axis is linked to another by `scaleanchor`, this determines the pixel", "to unit scale ratio. For example, if this value is 10, then every unit on", "this axis spans 10 times the number of pixels as a unit on the linked axis.", "Use this for example to create an elevation profile where the vertical scale", "is exaggerated a fixed amount with respect to the horizontal." ].join(" ") }, constrain: { valType: "enumerated", values: ["range", "domain"], editType: "plot", description: [ "If this axis needs to be compressed (either due to its own `scaleanchor` and", "`scaleratio` or those of the other axis), determines how that happens:", "by increasing the *range*, or by decreasing the *domain*.", "Default is *domain* for axes containing image traces, *range* otherwise." ].join(" ") }, // constraintoward: not used directly, just put here for reference constraintoward: { valType: "enumerated", values: ["left", "center", "right", "top", "middle", "bottom"], editType: "plot", description: [ "If this axis needs to be compressed (either due to its own `scaleanchor` and", "`scaleratio` or those of the other axis), determines which direction we push", "the originally specified plot area. Options are *left*, *center* (default),", "and *right* for x axes, and *top*, *middle* (default), and *bottom* for y axes." ].join(" ") }, matches: { valType: "enumerated", values: [ constants.idRegex.x.toString(), constants.idRegex.y.toString() ], editType: "calc", description: [ "If set to another axis id (e.g. `x2`, `y`), the range of this axis", "will match the range of the corresponding axis in data-coordinates space.", "Moreover, matching axes share auto-range values, category lists and", "histogram auto-bins.", "Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint", "is currently forbidden.", "Moreover, note that matching axes must have the same `type`." ].join(" ") }, rangebreaks: templatedArray("rangebreak", { enabled: { valType: "boolean", dflt: true, editType: "calc", description: [ "Determines whether this axis rangebreak is enabled or disabled.", "Please note that `rangebreaks` only work for *date* axis type." ].join(" ") }, bounds: { valType: "info_array", items: [ { valType: "any", editType: "calc" }, { valType: "any", editType: "calc" } ], editType: "calc", description: [ "Sets the lower and upper bounds of this axis rangebreak.", "Can be used with `pattern`." ].join(" ") }, pattern: { valType: "enumerated", values: [DAY_OF_WEEK, HOUR, ""], editType: "calc", description: [ "Determines a pattern on the time line that generates breaks.", "If *" + DAY_OF_WEEK + "* - days of the week in English e.g. 'Sunday' or `sun`", "(matching is case-insensitive and considers only the first three characters),", "as well as Sunday-based integers between 0 and 6.", "If *" + HOUR + "* - hour (24-hour clock) as decimal numbers between 0 and 24.", "for more info.", "Examples:", "- { pattern: '" + DAY_OF_WEEK + "', bounds: [6, 1] }", " or simply { bounds: ['sat', 'mon'] }", " breaks from Saturday to Monday (i.e. skips the weekends).", "- { pattern: '" + HOUR + "', bounds: [17, 8] }", " breaks from 5pm to 8am (i.e. skips non-work hours)." ].join(" ") }, values: { valType: "info_array", freeLength: true, editType: "calc", items: { valType: "any", editType: "calc" }, description: [ "Sets the coordinate values corresponding to the rangebreaks.", "An alternative to `bounds`.", "Use `dvalue` to set the size of the values along the axis." ].join(" ") }, dvalue: { // TODO could become 'any' to add support for 'months', 'years' valType: "number", editType: "calc", min: 0, dflt: ONEDAY, description: [ "Sets the size of each `values` item.", "The default is one day in milliseconds." ].join(" ") }, /* gap: { valType: 'number', min: 0, dflt: 0, // for *date* axes, maybe something else for *linear* editType: 'calc', description: [ 'Sets the gap distance between the start and the end of this rangebreak.', 'Use with `gapmode` to set the unit of measurement.' ].join(' ') }, gapmode: { valType: 'enumerated', values: ['pixels', 'fraction'], dflt: 'pixels', editType: 'calc', description: [ 'Determines if the `gap` value corresponds to a pixel length', 'or a fraction of the plot area.' ].join(' ') }, */ // To complete https://github.com/plotly/plotly.js/issues/4210 // we additionally need `gap` and make this work on *linear*, and // possibly all other cartesian axis types. We possibly would also need // some style attributes controlling the zig-zag on the corresponding // axis. editType: "calc" }), // ticks tickmode, nticks: makeNticks(), tick0, dtick, ticklabelstep: { valType: "integer", min: 1, dflt: 1, editType: "ticks", description: [ "Sets the spacing between tick labels as compared to the spacing between ticks.", "A value of 1 (default) means each tick gets a label.", "A value of 2 means shows every 2nd label.", "A larger value n means only every nth tick is labeled.", "`tick0` determines which labels are shown.", "Not implemented for axes with `type` *log* or *multicategory*, or when `tickmode` is *array*." ].join(" ") }, tickvals, ticktext: { valType: "data_array", editType: "ticks", description: [ "Sets the text displayed at the ticks position via `tickvals`.", "Only has an effect if `tickmode` is set to *array*.", "Used with `tickvals`." ].join(" ") }, ticks, tickson: { valType: "enumerated", values: ["labels", "boundaries"], dflt: "labels", editType: "ticks", description: [ "Determines where ticks and grid lines are drawn with respect to their", "corresponding tick labels.", "Only has an effect for axes of `type` *category* or *multicategory*.", "When set to *boundaries*, ticks and grid lines are drawn half a category", "to the left/bottom of labels." ].join(" ") }, ticklabelmode: { valType: "enumerated", values: ["instant", "period"], dflt: "instant", editType: "ticks", description: [ "Determines where tick labels are drawn with respect to their", "corresponding ticks and grid lines.", "Only has an effect for axes of `type` *date*", "When set to *period*, tick labels are drawn in the middle of the period", "between ticks." ].join(" ") }, // ticklabelposition: not used directly, as values depend on direction (similar to side) // left/right options are for x axes, and top/bottom options are for y axes ticklabelposition: { valType: "enumerated", values: [ "outside", "inside", "outside top", "inside top", "outside left", "inside left", "outside right", "inside right", "outside bottom", "inside bottom" ], dflt: "outside", editType: "calc", description: [ "Determines where tick labels are drawn with respect to the axis", "Please note that", "top or bottom has no effect on x axes or when `ticklabelmode` is set to *period*.", "Similarly", "left or right has no effect on y axes or when `ticklabelmode` is set to *period*.", "Has no effect on *multicategory* axes or when `tickson` is set to *boundaries*.", "When used on axes linked by `matches` or `scaleanchor`,", "no extra padding for inside labels would be added by autorange,", "so that the scales could match." ].join(" ") }, ticklabeloverflow: { valType: "enumerated", values: [ "allow", "hide past div", "hide past domain" ], editType: "calc", description: [ "Determines how we handle tick labels that would overflow either the graph div or the domain of the axis.", "The default value for inside tick labels is *hide past domain*.", "Otherwise on *category* and *multicategory* axes the default is *allow*.", "In other cases the default is *hide past div*." ].join(" ") }, ticklabelshift: { valType: "integer", dflt: 0, editType: "ticks", description: [ "Shifts the tick labels by the specified number of pixels in parallel to the axis.", "Positive values move the labels in the positive direction of the axis." ].join(" ") }, ticklabelstandoff: { valType: "integer", dflt: 0, editType: "ticks", description: [ "Sets the standoff distance (in px) between the axis tick labels and their default position.", "A positive `ticklabelstandoff` moves the labels farther away from the plot area", "if `ticklabelposition` is *outside*, and deeper into the plot area if", "`ticklabelposition` is *inside*. A negative `ticklabelstandoff` works in the opposite", "direction, moving outside ticks towards the plot area and inside ticks towards", "the outside. If the negative value is large enough, inside ticks can even end up", "outside and vice versa." ].join(" ") }, ticklabelindex: { // in the future maybe add `extras: ['all', 'minor']` to allow showing labels for all ticks // or for all minor ticks. valType: "integer", arrayOk: true, editType: "calc", description: [ "Only for axes with `type` *date* or *linear*.", "Instead of drawing the major tick label, draw the label for the minor tick", "that is n positions away from the major tick. E.g. to always draw the label for the", "minor tick before each major tick, choose `ticklabelindex` -1. This is useful for date", "axes with `ticklabelmode` *period* if you want to label the period that ends with each", "major tick instead of the period that begins there." ].join(" ") }, mirror: { valType: "enumerated", values: [true, "ticks", false, "all", "allticks"], dflt: false, editType: "ticks+layoutstyle", description: [ "Determines if the axis lines or/and ticks are mirrored to", "the opposite side of the plotting area.", "If *true*, the axis lines are mirrored.", "If *ticks*, the axis lines and ticks are mirrored.", "If *false*, mirroring is disable.", "If *all*, axis lines are mirrored on all shared-axes subplots.", "If *allticks*, axis lines and ticks are mirrored", "on all shared-axes subplots." ].join(" ") }, ticklen: makeTicklen(), tickwidth: makeTickwidth(), tickcolor, showticklabels: { valType: "boolean", dflt: true, editType: "ticks", description: "Determines whether or not the tick labels are drawn." }, labelalias: { valType: "any", dflt: false, editType: "ticks", description: [ "Replacement text for specific tick or hover labels.", "For example using {US: 'USA', CA: 'Canada'} changes US to USA", "and CA to Canada. The labels we would have shown must match", "the keys exactly, after adding any tickprefix or ticksuffix.", "For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash.", "That means you need to use −1 instead of -1.", "labelalias can be used with any axis type, and both keys (if needed)", "and values (if desired) can include html-like tags or MathJax." ].join(" ") }, automargin: { valType: "flaglist", flags: ["height", "width", "left", "right", "top", "bottom"], extras: [true, false], dflt: false, editType: "ticks", description: [ "Determines whether long tick labels automatically grow the figure", "margins." ].join(" ") }, showspikes: { valType: "boolean", dflt: false, editType: "modebar", description: [ "Determines whether or not spikes (aka droplines) are drawn for this axis.", "Note: This only takes affect when hovermode = closest" ].join(" ") }, spikecolor: { valType: "color", dflt: null, editType: "none", description: "Sets the spike color. If undefined, will use the series color" }, spikethickness: { valType: "number", dflt: 3, editType: "none", description: "Sets the width (in px) of the zero line." }, spikedash: extendFlat({}, dash, { dflt: "dash", editType: "none" }), spikemode: { valType: "flaglist", flags: ["toaxis", "across", "marker"], dflt: "toaxis", editType: "none", description: [ "Determines the drawing mode for the spike line", "If *toaxis*, the line is drawn from the data point to the axis the ", "series is plotted on.", "If *across*, the line is drawn across the entire plot area, and", "supercedes *toaxis*.", "If *marker*, then a marker dot is drawn on the axis the series is", "plotted on" ].join(" ") }, spikesnap: { valType: "enumerated", values: ["data", "cursor", "hovered data"], dflt: "hovered data", editType: "none", description: "Determines whether spikelines are stuck to the cursor or to the closest datapoints." }, tickfont: fontAttrs({ editType: "ticks", description: "Sets the tick font." }), tickangle: { valType: "angle", dflt: "auto", editType: "ticks", description: [ "Sets the angle of the tick labels with respect to the horizontal.", "For example, a `tickangle` of -90 draws the tick labels", "vertically." ].join(" ") }, autotickangles: { valType: "info_array", freeLength: true, items: { valType: "angle" }, dflt: [0, 30, 90], editType: "ticks", description: [ "When `tickangle` is set to *auto*, it will be set to the first", "angle in this array that is large enough to prevent label", "overlap." ].join(" ") }, tickprefix: { valType: "string", dflt: "", editType: "ticks", description: "Sets a tick label prefix." }, showtickprefix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks", description: [ "If *all*, all tick labels are displayed with a prefix.", "If *first*, only the first tick is displayed with a prefix.", "If *last*, only the last tick is displayed with a suffix.", "If *none*, tick prefixes are hidden." ].join(" ") }, ticksuffix: { valType: "string", dflt: "", editType: "ticks", description: "Sets a tick label suffix." }, showticksuffix: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks", description: "Same as `showtickprefix` but for tick suffixes." }, showexponent: { valType: "enumerated", values: ["all", "first", "last", "none"], dflt: "all", editType: "ticks", description: [ "If *all*, all exponents are shown besides their significands.", "If *first*, only the exponent of the first tick is shown.", "If *last*, only the exponent of the last tick is shown.", "If *none*, no exponents appear." ].join(" ") }, exponentformat: { valType: "enumerated", values: ["none", "e", "E", "power", "SI", "B"], dflt: "B", editType: "ticks", description: [ "Determines a formatting rule for the tick exponents.", "For example, consider the number 1,000,000,000.", "If *none*, it appears as 1,000,000,000.", "If *e*, 1e+9.", "If *E*, 1E+9.", "If *power*, 1x10^9 (with 9 in a super script).", "If *SI*, 1G.", "If *B*, 1B." ].join(" ") }, minexponent: { valType: "number", dflt: 3, min: 0, editType: "ticks", description: [ "Hide SI prefix for 10^n if |n| is below this number.", "This only has an effect when `tickformat` is *SI* or *B*." ].join(" ") }, separatethousands: { valType: "boolean", dflt: false, editType: "ticks", description: [ 'If "true", even 4-digit integers are separated' ].join(" ") }, tickformat: { valType: "string", dflt: "", editType: "ticks", description: descriptionWithDates("tick label") }, tickformatstops: templatedArray("tickformatstop", { enabled: { valType: "boolean", dflt: true, editType: "ticks", description: [ "Determines whether or not this stop is used.", "If `false`, this stop is ignored even within its `dtickrange`." ].join(" ") }, dtickrange: { valType: "info_array", items: [ { valType: "any", editType: "ticks" }, { valType: "any", editType: "ticks" } ], editType: "ticks", description: [ "range [*min*, *max*], where *min*, *max* - dtick values", "which describe some zoom level, it is possible to omit *min*", "or *max* value by passing *null*" ].join(" ") }, value: { valType: "string", dflt: "", editType: "ticks", description: [ "string - dtickformat for described zoom level, the same as *tickformat*" ].join(" ") }, editType: "ticks" }), hoverformat: { valType: "string", dflt: "", editType: "none", description: descriptionWithDates("hover text") }, // lines and grids showline: { valType: "boolean", dflt: false, editType: "ticks+layoutstyle", description: [ "Determines whether or not a line bounding this axis is drawn." ].join(" ") }, linecolor: { valType: "color", dflt: colorAttrs.defaultLine, editType: "layoutstyle", description: "Sets the axis line color." }, linewidth: { valType: "number", min: 0, dflt: 1, editType: "ticks+layoutstyle", description: "Sets the width (in px) of the axis line." }, showgrid, gridcolor, gridwidth: makeGridwidth(), griddash, zeroline: { valType: "boolean", editType: "ticks", description: [ "Determines whether or not a line is drawn at along the 0 value", "of this axis.", "If *true*, the zero line is drawn on top of the grid lines." ].join(" ") }, zerolinecolor: { valType: "color", dflt: colorAttrs.defaultLine, editType: "ticks", description: "Sets the line color of the zero line." }, zerolinewidth: { valType: "number", dflt: 1, editType: "ticks", description: "Sets the width (in px) of the zero line." }, showdividers: { valType: "boolean", dflt: true, editType: "ticks", description: [ "Determines whether or not a dividers are drawn", "between the category levels of this axis.", "Only has an effect on *multicategory* axes." ].join(" ") }, dividercolor: { valType: "color", dflt: colorAttrs.defaultLine, editType: "ticks", description: [ "Sets the color of the dividers", "Only has an effect on *multicategory* axes." ].join(" ") }, dividerwidth: { valType: "number", dflt: 1, editType: "ticks", description: [ "Sets the width (in px) of the dividers", "Only has an effect on *multicategory* axes." ].join(" ") }, // TODO dividerlen: that would override "to label base" length? // positioning attributes // anchor: not used directly, just put here for reference // values are any opposite-letter axis id anchor: { valType: "enumerated", values: [ "free", constants.idRegex.x.toString(), constants.idRegex.y.toString() ], editType: "plot", description: [ "If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to", "the corresponding opposite-letter axis.", "If set to *free*, this axis' position is determined by `position`." ].join(" ") }, // side: not used directly, as values depend on direction // values are top, bottom for x axes, and left, right for y side: { valType: "enumerated", values: ["top", "bottom", "left", "right"], editType: "plot", description: [ "Determines whether a x (y) axis is positioned", "at the *bottom* (*left*) or *top* (*right*)", "of the plotting area." ].join(" ") }, // overlaying: not used directly, just put here for reference // values are false and any other same-letter axis id that's not // itself overlaying anything overlaying: { valType: "enumerated", values: [ "free", constants.idRegex.x.toString(), constants.idRegex.y.toString() ], editType: "plot", description: [ "If set a same-letter axis id, this axis is overlaid on top of", "the corresponding same-letter axis, with traces and axes visible for both", "axes.", "If *false*, this axis does not overlay any same-letter axes.", "In this case, for axes with overlapping domains only the highest-numbered", "axis will be visible." ].join(" ") }, minor: { tickmode: minorTickmode, nticks: makeNticks("minor"), tick0, dtick, tickvals, ticks, ticklen: makeTicklen("minor"), tickwidth: makeTickwidth("minor"), tickcolor, gridcolor, gridwidth: makeGridwidth("minor"), griddash, showgrid, editType: "ticks" }, layer: { valType: "enumerated", values: ["above traces", "below traces"], dflt: "above traces", editType: "plot", description: [ "Sets the layer on which this axis is displayed.", "If *above traces*, this axis is displayed above all the subplot's traces", "If *below traces*, this axis is displayed below all the subplot's traces,", "but above the grid lines.", "Useful when used together with scatter-like traces with `cliponaxis`", "set to *false* to show markers and/or text nodes above this axis." ].join(" ") }, domain: { valType: "info_array", items: [ { valType: "number", min: 0, max: 1, editType: "plot" }, { valType: "number", min: 0, max: 1, editType: "plot" } ], dflt: [0, 1], editType: "plot", description: [ "Sets the domain of this axis (in plot fraction)." ].join(" ") }, position: { valType: "number", min: 0, max: 1, dflt: 0, editType: "plot", description: [ "Sets the position of this axis in the plotting space", "(in normalized coordinates).", "Only has an effect if `anchor` is set to *free*." ].join(" ") }, autoshift: { valType: "boolean", dflt: false, editType: "plot", description: [ "Automatically reposition the axis to avoid", "overlap with other axes with the same `overlaying` value.", "This repositioning will account for any `shift` amount applied to other", "axes on the same side with `autoshift` is set to true.", "Only has an effect if `anchor` is set to *free*." ].join(" ") }, shift: { valType: "number", editType: "plot", description: [ "Moves the axis a given number of pixels from where it would have been otherwise.", "Accepts both positive and negative values, which will shift the axis either right", "or left, respectively.", "If `autoshift` is set to true, then this defaults to a padding of -3 if `side` is set to *left*.", "and defaults to +3 if `side` is set to *right*. Defaults to 0 if `autoshift` is set to false.", "Only has an effect if `anchor` is set to *free*." ].join(" ") }, categoryorder: { valType: "enumerated", values: [ "trace", "category ascending", "category descending", "array", "total ascending", "total descending", "min ascending", "min descending", "max ascending", "max descending", "sum ascending", "sum descending", "mean ascending", "mean descending", "geometric mean ascending", "geometric mean descending", "median ascending", "median descending" ], dflt: "trace", editType: "calc", description: [ "Specifies the ordering logic for the case of categorical variables.", "By default, plotly uses *trace*, which specifies the order that is present in the data supplied.", "Set `categoryorder` to *category ascending* or *category descending* if order should be determined by", "the alphanumerical order of the category names.", "Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category", "is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to", "the *trace* mode. The unspecified categories will follow the categories in `categoryarray`.", "Set `categoryorder` to *total ascending* or *total descending* if order should be determined by the", "numerical order of the values.", "Similarly, the order can be determined by the min, max, sum, mean, geometric mean or median of all the values." ].join(" ") }, categoryarray: { valType: "data_array", editType: "calc", description: [ "Sets the order in which categories on this axis appear.", "Only has an effect if `categoryorder` is set to *array*.", "Used with `categoryorder`." ].join(" ") }, uirevision: { valType: "any", editType: "none", description: [ "Controls persistence of user-driven changes in axis `range`,", "`autorange`, and `title` if in `editable: true` configuration.", "Defaults to `layout.uirevision`." ].join(" ") }, editType: "calc", _deprecated: { autotick: { valType: "boolean", editType: "ticks", description: [ "Obsolete.", "Set `tickmode` to *auto* for old `autotick` *true* behavior.", "Set `tickmode` to *linear* for `autotick` *false*." ].join(" ") }, title: { valType: "string", editType: "ticks", description: [ "Value of `title` is no longer a simple *string* but a set of sub-attributes.", "To set the axis' title, please use `title.text` now." ].join(" ") }, titlefont: fontAttrs({ editType: "ticks", description: [ "Former `titlefont` is now the sub-attribute `font` of `title`.", "To customize title font properties, please use `title.font` now." ].join(" ") }) } }; } }); // node_modules/plotly.js/src/components/colorbar/attributes.js var require_attributes7 = __commonJS({ "node_modules/plotly.js/src/components/colorbar/attributes.js"(exports2, module2) { "use strict"; var axesAttrs = require_layout_attributes4(); var fontAttrs = require_font_attributes(); var extendFlat = require_extend().extendFlat; var overrideAll = require_edit_types().overrideAll; module2.exports = overrideAll({ orientation: { valType: "enumerated", values: ["h", "v"], dflt: "v", description: "Sets the orientation of the colorbar." }, thicknessmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "pixels", description: [ "Determines whether this color bar's thickness", "(i.e. the measure in the constant color direction)", "is set in units of plot *fraction* or in *pixels*.", "Use `thickness` to set the value." ].join(" ") }, thickness: { valType: "number", min: 0, dflt: 30, description: [ "Sets the thickness of the color bar", "This measure excludes the size of the padding, ticks and labels." ].join(" ") }, lenmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "fraction", description: [ "Determines whether this color bar's length", "(i.e. the measure in the color variation direction)", "is set in units of plot *fraction* or in *pixels.", "Use `len` to set the value." ].join(" ") }, len: { valType: "number", min: 0, dflt: 1, description: [ "Sets the length of the color bar", "This measure excludes the padding of both ends.", "That is, the color bar length is this length minus the", "padding on both ends." ].join(" ") }, x: { valType: "number", description: [ "Sets the x position with respect to `xref` of the color bar (in plot fraction).", "When `xref` is *paper*, defaults to 1.02 when `orientation` is *v* and", "0.5 when `orientation` is *h*.", "When `xref` is *container*, defaults to *1* when `orientation` is *v* and", "0.5 when `orientation` is *h*.", "Must be between *0* and *1* if `xref` is *container*", "and between *-2* and *3* if `xref` is *paper*." ].join(" ") }, xref: { valType: "enumerated", dflt: "paper", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `x` refers to.", "*container* spans the entire `width` of the plot.", "*paper* refers to the width of the plotting area only." ].join(" ") }, xanchor: { valType: "enumerated", values: ["left", "center", "right"], description: [ "Sets this color bar's horizontal position anchor.", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the color bar.", "Defaults to *left* when `orientation` is *v* and", "*center* when `orientation` is *h*." ].join(" ") }, xpad: { valType: "number", min: 0, dflt: 10, description: "Sets the amount of padding (in px) along the x direction." }, y: { valType: "number", description: [ "Sets the y position with respect to `yref` of the color bar (in plot fraction).", "When `yref` is *paper*, defaults to 0.5 when `orientation` is *v* and", "1.02 when `orientation` is *h*.", "When `yref` is *container*, defaults to 0.5 when `orientation` is *v* and", "1 when `orientation` is *h*.", "Must be between *0* and *1* if `yref` is *container*", "and between *-2* and *3* if `yref` is *paper*." ].join(" ") }, yref: { valType: "enumerated", dflt: "paper", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `y` refers to.", "*container* spans the entire `height` of the plot.", "*paper* refers to the height of the plotting area only." ].join(" ") }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"], description: [ "Sets this color bar's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the color bar.", "Defaults to *middle* when `orientation` is *v* and", "*bottom* when `orientation` is *h*." ].join(" ") }, ypad: { valType: "number", min: 0, dflt: 10, description: "Sets the amount of padding (in px) along the y direction." }, // a possible line around the bar itself outlinecolor: axesAttrs.linecolor, outlinewidth: axesAttrs.linewidth, // Should outlinewidth have {dflt: 0} ? // another possible line outside the padding and tick labels bordercolor: axesAttrs.linecolor, borderwidth: { valType: "number", min: 0, dflt: 0, description: [ "Sets the width (in px) or the border enclosing this color bar." ].join(" ") }, bgcolor: { valType: "color", dflt: "rgba(0,0,0,0)", description: "Sets the color of padded area." }, // tick and title properties named and function exactly as in axes tickmode: axesAttrs.minor.tickmode, nticks: axesAttrs.nticks, tick0: axesAttrs.tick0, dtick: axesAttrs.dtick, tickvals: axesAttrs.tickvals, ticktext: axesAttrs.ticktext, ticks: extendFlat({}, axesAttrs.ticks, { dflt: "" }), ticklabeloverflow: extendFlat({}, axesAttrs.ticklabeloverflow, { description: [ "Determines how we handle tick labels that would overflow either the graph div or the domain of the axis.", "The default value for inside tick labels is *hide past domain*.", "In other cases the default is *hide past div*." ].join(" ") }), // ticklabelposition: not used directly, as values depend on orientation // left/right options are for x axes, and top/bottom options are for y axes ticklabelposition: { valType: "enumerated", values: [ "outside", "inside", "outside top", "inside top", "outside left", "inside left", "outside right", "inside right", "outside bottom", "inside bottom" ], dflt: "outside", description: [ "Determines where tick labels are drawn relative to the ticks.", "Left and right options are used when `orientation` is *h*,", "top and bottom when `orientation` is *v*." ].join(" ") }, ticklen: axesAttrs.ticklen, tickwidth: axesAttrs.tickwidth, tickcolor: axesAttrs.tickcolor, ticklabelstep: axesAttrs.ticklabelstep, showticklabels: axesAttrs.showticklabels, labelalias: axesAttrs.labelalias, tickfont: fontAttrs({ description: "Sets the color bar's tick label font" }), tickangle: axesAttrs.tickangle, tickformat: axesAttrs.tickformat, tickformatstops: axesAttrs.tickformatstops, tickprefix: axesAttrs.tickprefix, showtickprefix: axesAttrs.showtickprefix, ticksuffix: axesAttrs.ticksuffix, showticksuffix: axesAttrs.showticksuffix, separatethousands: axesAttrs.separatethousands, exponentformat: axesAttrs.exponentformat, minexponent: axesAttrs.minexponent, showexponent: axesAttrs.showexponent, title: { text: { valType: "string", description: [ "Sets the title of the color bar.", "Note that before the existence of `title.text`, the title's", "contents used to be defined as the `title` attribute itself.", "This behavior has been deprecated." ].join(" ") }, font: fontAttrs({ description: [ "Sets this color bar's title font.", "Note that the title's font used to be set", "by the now deprecated `titlefont` attribute." ].join(" ") }), side: { valType: "enumerated", values: ["right", "top", "bottom"], description: [ "Determines the location of color bar's title", "with respect to the color bar.", "Defaults to *top* when `orientation` if *v* and ", "defaults to *right* when `orientation` if *h*.", "Note that the title's location used to be set", "by the now deprecated `titleside` attribute." ].join(" ") } }, _deprecated: { title: { valType: "string", description: [ "Deprecated in favor of color bar's `title.text`.", "Note that value of color bar's `title` is no longer a simple", "*string* but a set of sub-attributes." ].join(" ") }, titlefont: fontAttrs({ description: "Deprecated in favor of color bar's `title.font`." }), titleside: { valType: "enumerated", values: ["right", "top", "bottom"], dflt: "top", description: "Deprecated in favor of color bar's `title.side`." } } }, "colorbars", "from-root"); } }); // node_modules/plotly.js/src/components/colorscale/attributes.js var require_attributes8 = __commonJS({ "node_modules/plotly.js/src/components/colorscale/attributes.js"(exports2, module2) { "use strict"; var colorbarAttrs = require_attributes7(); var counterRegex = require_regex().counter; var sortObjectKeys = require_sort_object_keys(); var palettes = require_scales().scales; var paletteStr = sortObjectKeys(palettes); function code(s) { return "`" + s + "`"; } module2.exports = function colorScaleAttrs(context, opts) { context = context || ""; opts = opts || {}; var cLetter = opts.cLetter || "c"; var onlyIfNumerical = "onlyIfNumerical" in opts ? opts.onlyIfNumerical : Boolean(context); var noScale = "noScale" in opts ? opts.noScale : context === "marker.line"; var showScaleDflt = "showScaleDflt" in opts ? opts.showScaleDflt : cLetter === "z"; var colorscaleDflt = typeof opts.colorscaleDflt === "string" ? palettes[opts.colorscaleDflt] : null; var editTypeOverride = opts.editTypeOverride || ""; var contextHead = context ? context + "." : ""; var colorAttr, colorAttrFull; if ("colorAttr" in opts) { colorAttr = opts.colorAttr; colorAttrFull = opts.colorAttr; } else { colorAttr = { z: "z", c: "color" }[cLetter]; colorAttrFull = "in " + code(contextHead + colorAttr); } var effectDesc = onlyIfNumerical ? " Has an effect only if " + colorAttrFull + " is set to a numerical array." : ""; var auto = cLetter + "auto"; var min = cLetter + "min"; var max = cLetter + "max"; var mid = cLetter + "mid"; var autoFull = code(contextHead + auto); var minFull = code(contextHead + min); var maxFull = code(contextHead + max); var minmaxFull = minFull + " and " + maxFull; var autoImpliedEdits = {}; autoImpliedEdits[min] = autoImpliedEdits[max] = void 0; var minmaxImpliedEdits = {}; minmaxImpliedEdits[auto] = false; var attrs = {}; if (colorAttr === "color") { attrs.color = { valType: "color", arrayOk: true, editType: editTypeOverride || "style", description: [ "Sets the", context, "color.", "It accepts either a specific color", "or an array of numbers that are mapped to the colorscale", "relative to the max and min values of the array or relative to", minmaxFull, "if set." ].join(" ") }; if (opts.anim) { attrs.color.anim = true; } } attrs[auto] = { valType: "boolean", dflt: true, editType: "calc", impliedEdits: autoImpliedEdits, description: [ "Determines whether or not the color domain is computed", "with respect to the input data (here " + colorAttrFull + ") or the bounds set in", minmaxFull + effectDesc, "Defaults to `false` when", minmaxFull, "are set by the user." ].join(" ") }; attrs[min] = { valType: "number", dflt: null, editType: editTypeOverride || "plot", impliedEdits: minmaxImpliedEdits, description: [ "Sets the lower bound of the color domain." + effectDesc, "Value should have the same units as", colorAttrFull, "and if set,", maxFull, "must be set as well." ].join(" ") }; attrs[max] = { valType: "number", dflt: null, editType: editTypeOverride || "plot", impliedEdits: minmaxImpliedEdits, description: [ "Sets the upper bound of the color domain." + effectDesc, "Value should have the same units as", colorAttrFull, "and if set,", minFull, "must be set as well." ].join(" ") }; attrs[mid] = { valType: "number", dflt: null, editType: "calc", impliedEdits: autoImpliedEdits, description: [ "Sets the mid-point of the color domain by scaling", minFull, "and/or", maxFull, "to be equidistant to this point." + effectDesc, "Value should have the same units as", colorAttrFull + ".", "Has no effect when", autoFull, "is `false`." ].join(" ") }; attrs.colorscale = { valType: "colorscale", editType: "calc", dflt: colorscaleDflt, impliedEdits: { autocolorscale: false }, description: [ "Sets the colorscale." + effectDesc, "The colorscale must be an array containing", "arrays mapping a normalized value to an", "rgb, rgba, hex, hsl, hsv, or named color string.", "At minimum, a mapping for the lowest (0) and highest (1)", "values are required. For example,", "`[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`.", "To control the bounds of the colorscale in color space,", "use", minmaxFull + ".", "Alternatively, `colorscale` may be a palette name string", "of the following list: " + paletteStr + "." ].join(" ") }; attrs.autocolorscale = { valType: "boolean", // gets overrode in 'heatmap' & 'surface' for backwards comp. dflt: opts.autoColorDflt === false ? false : true, editType: "calc", impliedEdits: { colorscale: void 0 }, description: [ "Determines whether the colorscale is a default palette (`autocolorscale: true`)", "or the palette determined by", code(contextHead + "colorscale") + "." + effectDesc, "In case `colorscale` is unspecified or `autocolorscale` is true, the default", "palette will be chosen according to whether numbers in the `color` array are", "all positive, all negative or mixed." ].join(" ") }; attrs.reversescale = { valType: "boolean", dflt: false, editType: "plot", description: [ "Reverses the color mapping if true." + effectDesc, "If true,", minFull, "will correspond to the last color", "in the array and", maxFull, "will correspond to the first color." ].join(" ") }; if (!noScale) { attrs.showscale = { valType: "boolean", dflt: showScaleDflt, editType: "calc", description: [ "Determines whether or not a colorbar is displayed for this trace." + effectDesc ].join(" ") }; attrs.colorbar = colorbarAttrs; } if (!opts.noColorAxis) { attrs.coloraxis = { valType: "subplotid", regex: counterRegex("coloraxis"), dflt: null, editType: "calc", description: [ "Sets a reference to a shared color axis.", "References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc.", "Settings for these shared color axes are set in the layout, under", "`layout.coloraxis`, `layout.coloraxis2`, etc.", "Note that multiple color scales can be linked to the same color axis." ].join(" ") }; } return attrs; }; } }); // node_modules/plotly.js/src/components/colorscale/layout_attributes.js var require_layout_attributes5 = __commonJS({ "node_modules/plotly.js/src/components/colorscale/layout_attributes.js"(exports2, module2) { "use strict"; var extendFlat = require_extend().extendFlat; var colorScaleAttrs = require_attributes8(); var scales = require_scales().scales; var msg = "Note that `autocolorscale` must be true for this attribute to work."; module2.exports = { editType: "calc", colorscale: { editType: "calc", sequential: { valType: "colorscale", dflt: scales.Reds, editType: "calc", description: [ "Sets the default sequential colorscale for positive values.", msg ].join(" ") }, sequentialminus: { valType: "colorscale", dflt: scales.Blues, editType: "calc", description: [ "Sets the default sequential colorscale for negative values.", msg ].join(" ") }, diverging: { valType: "colorscale", dflt: scales.RdBu, editType: "calc", description: [ "Sets the default diverging colorscale.", msg ].join(" ") } }, coloraxis: extendFlat({ // not really a 'subplot' attribute container, // but this is the flag we use to denote attributes that // support yaxis, yaxis2, yaxis3, ... counters _isSubplotObj: true, editType: "calc", description: [ "" ].join(" ") }, colorScaleAttrs("", { colorAttr: "corresponding trace color array(s)", noColorAxis: true, showScaleDflt: true })) }; } }); // node_modules/plotly.js/src/components/colorbar/has_colorbar.js var require_has_colorbar = __commonJS({ "node_modules/plotly.js/src/components/colorbar/has_colorbar.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; } }); // node_modules/plotly.js/src/plots/cartesian/clean_ticks.js var require_clean_ticks = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/clean_ticks.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var constants = require_numerical(); var ONEDAY = constants.ONEDAY; var ONEWEEK = constants.ONEWEEK; exports2.dtick = function(dtick, axType) { var isLog = axType === "log"; var isDate = axType === "date"; var isCat = axType === "category"; var dtickDflt = isDate ? ONEDAY : 1; if (!dtick) return dtickDflt; if (isNumeric(dtick)) { dtick = Number(dtick); if (dtick <= 0) return dtickDflt; if (isCat) { return Math.max(1, Math.round(dtick)); } if (isDate) { return Math.max(0.1, dtick); } return dtick; } if (typeof dtick !== "string" || !(isDate || isLog)) { return dtickDflt; } var prefix = dtick.charAt(0); var dtickNum = dtick.substr(1); dtickNum = isNumeric(dtickNum) ? Number(dtickNum) : 0; if (dtickNum <= 0 || !// "M" gives ticks every (integer) n months (isDate && prefix === "M" && dtickNum === Math.round(dtickNum) || // "L" gives ticks linearly spaced in data (not in position) every (float) f isLog && prefix === "L" || // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5 isLog && prefix === "D" && (dtickNum === 1 || dtickNum === 2))) { return dtickDflt; } return dtick; }; exports2.tick0 = function(tick0, axType, calendar, dtick) { if (axType === "date") { return Lib.cleanDate( tick0, Lib.dateTick0(calendar, dtick % ONEWEEK === 0 ? 1 : 0) ); } if (dtick === "D1" || dtick === "D2") { return void 0; } return isNumeric(tick0) ? Number(tick0) : 0; }; } }); // node_modules/plotly.js/src/plots/cartesian/tick_value_defaults.js var require_tick_value_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/tick_value_defaults.js"(exports2, module2) { "use strict"; var cleanTicks = require_clean_ticks(); var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; var isTypedArraySpec = require_array().isTypedArraySpec; var decodeTypedArraySpec = require_array().decodeTypedArraySpec; module2.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType, opts) { if (!opts) opts = {}; var isMinor = opts.isMinor; var cIn = isMinor ? containerIn.minor || {} : containerIn; var cOut = isMinor ? containerOut.minor : containerOut; var prefix = isMinor ? "minor." : ""; function readInput(attr) { var v = cIn[attr]; if (isTypedArraySpec(v)) v = decodeTypedArraySpec(v); return v !== void 0 ? v : (cOut._template || {})[attr]; } var _tick0 = readInput("tick0"); var _dtick = readInput("dtick"); var _tickvals = readInput("tickvals"); var tickmodeDefault = isArrayOrTypedArray(_tickvals) ? "array" : _dtick ? "linear" : "auto"; var tickmode = coerce(prefix + "tickmode", tickmodeDefault); if (tickmode === "auto" || tickmode === "sync") { coerce(prefix + "nticks"); } else if (tickmode === "linear") { var dtick = cOut.dtick = cleanTicks.dtick( _dtick, axType ); cOut.tick0 = cleanTicks.tick0( _tick0, axType, containerOut.calendar, dtick ); } else if (axType !== "multicategory") { var tickvals = coerce(prefix + "tickvals"); if (tickvals === void 0) cOut.tickmode = "auto"; else if (!isMinor) coerce("ticktext"); } }; } }); // node_modules/plotly.js/src/plots/cartesian/tick_mark_defaults.js var require_tick_mark_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/tick_mark_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var layoutAttributes = require_layout_attributes4(); module2.exports = function handleTickMarkDefaults(containerIn, containerOut, coerce, options) { var isMinor = options.isMinor; var cIn = isMinor ? containerIn.minor || {} : containerIn; var cOut = isMinor ? containerOut.minor : containerOut; var lAttr = isMinor ? layoutAttributes.minor : layoutAttributes; var prefix = isMinor ? "minor." : ""; var tickLen = Lib.coerce2(cIn, cOut, lAttr, "ticklen", isMinor ? (containerOut.ticklen || 5) * 0.6 : void 0); var tickWidth = Lib.coerce2(cIn, cOut, lAttr, "tickwidth", isMinor ? containerOut.tickwidth || 1 : void 0); var tickColor = Lib.coerce2(cIn, cOut, lAttr, "tickcolor", (isMinor ? containerOut.tickcolor : void 0) || cOut.color); var showTicks = coerce(prefix + "ticks", !isMinor && options.outerTicks || tickLen || tickWidth || tickColor ? "outside" : ""); if (!showTicks) { delete cOut.ticklen; delete cOut.tickwidth; delete cOut.tickcolor; } }; } }); // node_modules/plotly.js/src/plots/cartesian/show_dflt.js var require_show_dflt = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/show_dflt.js"(exports2, module2) { "use strict"; module2.exports = function getShowAttrDflt(containerIn) { var showAttrsAll = ["showexponent", "showtickprefix", "showticksuffix"]; var showAttrs = showAttrsAll.filter(function(a) { return containerIn[a] !== void 0; }); var sameVal = function(a) { return containerIn[a] === containerIn[showAttrs[0]]; }; if (showAttrs.every(sameVal) || showAttrs.length === 1) { return containerIn[showAttrs[0]]; } }; } }); // node_modules/plotly.js/src/plots/array_container_defaults.js var require_array_container_defaults = __commonJS({ "node_modules/plotly.js/src/plots/array_container_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Template = require_plot_template(); module2.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut, opts) { var name = opts.name; var inclusionAttr = opts.inclusionAttr || "visible"; var previousContOut = parentObjOut[name]; var contIn = Lib.isArrayOrTypedArray(parentObjIn[name]) ? parentObjIn[name] : []; var contOut = parentObjOut[name] = []; var templater = Template.arrayTemplater(parentObjOut, name, inclusionAttr); var i, itemOut; for (i = 0; i < contIn.length; i++) { var itemIn = contIn[i]; if (!Lib.isPlainObject(itemIn)) { itemOut = templater.newItem({}); itemOut[inclusionAttr] = false; } else { itemOut = templater.newItem(itemIn); } itemOut._index = i; if (itemOut[inclusionAttr] !== false) { opts.handleItemDefaults(itemIn, itemOut, parentObjOut, opts); } contOut.push(itemOut); } var defaultItems = templater.defaultItems(); for (i = 0; i < defaultItems.length; i++) { itemOut = defaultItems[i]; itemOut._index = contOut.length; opts.handleItemDefaults({}, itemOut, parentObjOut, opts, {}); contOut.push(itemOut); } if (Lib.isArrayOrTypedArray(previousContOut)) { var len = Math.min(previousContOut.length, contOut.length); for (i = 0; i < len; i++) { Lib.relinkPrivateKeys(contOut[i], previousContOut[i]); } } return contOut; }; } }); // node_modules/plotly.js/src/plots/cartesian/tick_label_defaults.js var require_tick_label_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/tick_label_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var contrast = require_color().contrast; var layoutAttributes = require_layout_attributes4(); var getShowAttrDflt = require_show_dflt(); var handleArrayContainerDefaults = require_array_container_defaults(); module2.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) { if (!options) options = {}; var labelalias = coerce("labelalias"); if (!Lib.isPlainObject(labelalias)) delete containerOut.labelalias; var showAttrDflt = getShowAttrDflt(containerIn); var showTickLabels = coerce("showticklabels"); if (showTickLabels) { if (!options.noTicklabelshift) { coerce("ticklabelshift"); } if (!options.noTicklabelstandoff) { coerce("ticklabelstandoff"); } var font = options.font || {}; var contColor = containerOut.color; var position = containerOut.ticklabelposition || ""; var dfltFontColor = position.indexOf("inside") !== -1 ? contrast(options.bgColor) : ( // as with titlefont.color, inherit axis.color only if one was // explicitly provided contColor && contColor !== layoutAttributes.color.dflt ? contColor : font.color ); Lib.coerceFont(coerce, "tickfont", font, { overrideDflt: { color: dfltFontColor } }); if (!options.noTicklabelstep && axType !== "multicategory" && axType !== "log") { coerce("ticklabelstep"); } if (!options.noAng) { var tickAngle = coerce("tickangle"); if (!options.noAutotickangles && tickAngle === "auto") { coerce("autotickangles"); } } if (axType !== "category") { var tickFormat = coerce("tickformat"); handleArrayContainerDefaults(containerIn, containerOut, { name: "tickformatstops", inclusionAttr: "enabled", handleItemDefaults: tickformatstopDefaults }); if (!containerOut.tickformatstops.length) { delete containerOut.tickformatstops; } if (!options.noExp && !tickFormat && axType !== "date") { coerce("showexponent", showAttrDflt); coerce("exponentformat"); coerce("minexponent"); coerce("separatethousands"); } } } }; function tickformatstopDefaults(valueIn, valueOut) { function coerce(attr, dflt) { return Lib.coerce(valueIn, valueOut, layoutAttributes.tickformatstops, attr, dflt); } var enabled = coerce("enabled"); if (enabled) { coerce("dtickrange"); coerce("value"); } } } }); // node_modules/plotly.js/src/plots/cartesian/prefix_suffix_defaults.js var require_prefix_suffix_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/prefix_suffix_defaults.js"(exports2, module2) { "use strict"; var getShowAttrDflt = require_show_dflt(); module2.exports = function handlePrefixSuffixDefaults(containerIn, containerOut, coerce, axType, options) { if (!options) options = {}; var tickSuffixDflt = options.tickSuffixDflt; var showAttrDflt = getShowAttrDflt(containerIn); var tickPrefix = coerce("tickprefix"); if (tickPrefix) coerce("showtickprefix", showAttrDflt); var tickSuffix = coerce("ticksuffix", tickSuffixDflt); if (tickSuffix) coerce("showticksuffix", showAttrDflt); }; } }); // node_modules/plotly.js/src/components/colorbar/defaults.js var require_defaults = __commonJS({ "node_modules/plotly.js/src/components/colorbar/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Template = require_plot_template(); var handleTickValueDefaults = require_tick_value_defaults(); var handleTickMarkDefaults = require_tick_mark_defaults(); var handleTickLabelDefaults = require_tick_label_defaults(); var handlePrefixSuffixDefaults = require_prefix_suffix_defaults(); var attributes = require_attributes7(); module2.exports = function colorbarDefaults(containerIn, containerOut, layout) { var colorbarOut = Template.newContainer(containerOut, "colorbar"); var colorbarIn = containerIn.colorbar || {}; function coerce(attr, dflt) { return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt); } var margin = layout.margin || { t: 0, b: 0, l: 0, r: 0 }; var w = layout.width - margin.l - margin.r; var h = layout.height - margin.t - margin.b; var orientation = coerce("orientation"); var isVertical = orientation === "v"; var thicknessmode = coerce("thicknessmode"); coerce( "thickness", thicknessmode === "fraction" ? 30 / (isVertical ? w : h) : 30 ); var lenmode = coerce("lenmode"); coerce( "len", lenmode === "fraction" ? 1 : isVertical ? h : w ); var yref = coerce("yref"); var xref = coerce("xref"); var isPaperY = yref === "paper"; var isPaperX = xref === "paper"; var defaultX, defaultY, defaultYAnchor; var defaultXAnchor = "left"; if (isVertical) { defaultYAnchor = "middle"; defaultXAnchor = isPaperX ? "left" : "right"; defaultX = isPaperX ? 1.02 : 1; defaultY = 0.5; } else { defaultYAnchor = isPaperY ? "bottom" : "top"; defaultXAnchor = "center"; defaultX = 0.5; defaultY = isPaperY ? 1.02 : 1; } Lib.coerce(colorbarIn, colorbarOut, { x: { valType: "number", min: isPaperX ? -2 : 0, max: isPaperX ? 3 : 1, dflt: defaultX } }, "x"); Lib.coerce(colorbarIn, colorbarOut, { y: { valType: "number", min: isPaperY ? -2 : 0, max: isPaperY ? 3 : 1, dflt: defaultY } }, "y"); coerce("xanchor", defaultXAnchor); coerce("xpad"); coerce("yanchor", defaultYAnchor); coerce("ypad"); Lib.noneOrAll(colorbarIn, colorbarOut, ["x", "y"]); coerce("outlinecolor"); coerce("outlinewidth"); coerce("bordercolor"); coerce("borderwidth"); coerce("bgcolor"); var ticklabelposition = Lib.coerce(colorbarIn, colorbarOut, { ticklabelposition: { valType: "enumerated", dflt: "outside", values: isVertical ? [ "outside", "inside", "outside top", "inside top", "outside bottom", "inside bottom" ] : [ "outside", "inside", "outside left", "inside left", "outside right", "inside right" ] } }, "ticklabelposition"); coerce("ticklabeloverflow", ticklabelposition.indexOf("inside") !== -1 ? "hide past domain" : "hide past div"); handleTickValueDefaults(colorbarIn, colorbarOut, coerce, "linear"); var font = layout.font; var opts = { noAutotickangles: true, noTicklabelshift: true, noTicklabelstandoff: true, outerTicks: false, font }; if (ticklabelposition.indexOf("inside") !== -1) { opts.bgColor = "black"; } handlePrefixSuffixDefaults(colorbarIn, colorbarOut, coerce, "linear", opts); handleTickLabelDefaults(colorbarIn, colorbarOut, coerce, "linear", opts); handleTickMarkDefaults(colorbarIn, colorbarOut, coerce, "linear", opts); coerce("title.text", layout._dfltTitle.colorbar); var tickFont = colorbarOut.showticklabels ? colorbarOut.tickfont : font; var dfltTitleFont = Lib.extendFlat({}, font, { family: tickFont.family, size: Lib.bigFont(tickFont.size) }); Lib.coerceFont(coerce, "title.font", dfltTitleFont); coerce("title.side", isVertical ? "top" : "right"); }; } }); // node_modules/plotly.js/src/components/colorscale/defaults.js var require_defaults2 = __commonJS({ "node_modules/plotly.js/src/components/colorscale/defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var hasColorbar = require_has_colorbar(); var colorbarDefaults = require_defaults(); var isValidScale = require_scales().isValid; var traceIs = require_registry().traceIs; function npMaybe(parentCont, prefix) { var containerStr = prefix.slice(0, prefix.length - 1); return prefix ? Lib.nestedProperty(parentCont, containerStr).get() || {} : parentCont; } module2.exports = function colorScaleDefaults(parentContIn, parentContOut, layout, coerce, opts) { var prefix = opts.prefix; var cLetter = opts.cLetter; var inTrace = "_module" in parentContOut; var containerIn = npMaybe(parentContIn, prefix); var containerOut = npMaybe(parentContOut, prefix); var template = npMaybe(parentContOut._template || {}, prefix) || {}; var thisFn = function() { delete parentContIn.coloraxis; delete parentContOut.coloraxis; return colorScaleDefaults(parentContIn, parentContOut, layout, coerce, opts); }; if (inTrace) { var colorAxes = layout._colorAxes || {}; var colorAx = coerce(prefix + "coloraxis"); if (colorAx) { var colorbarVisuals = traceIs(parentContOut, "contour") && Lib.nestedProperty(parentContOut, "contours.coloring").get() || "heatmap"; var stash = colorAxes[colorAx]; if (stash) { stash[2].push(thisFn); if (stash[0] !== colorbarVisuals) { stash[0] = false; Lib.warn([ "Ignoring coloraxis:", colorAx, "setting", "as it is linked to incompatible colorscales." ].join(" ")); } } else { colorAxes[colorAx] = [colorbarVisuals, parentContOut, [thisFn]]; } return; } } var minIn = containerIn[cLetter + "min"]; var maxIn = containerIn[cLetter + "max"]; var validMinMax = isNumeric(minIn) && isNumeric(maxIn) && minIn < maxIn; var auto = coerce(prefix + cLetter + "auto", !validMinMax); if (auto) { coerce(prefix + cLetter + "mid"); } else { coerce(prefix + cLetter + "min"); coerce(prefix + cLetter + "max"); } var sclIn = containerIn.colorscale; var sclTemplate = template.colorscale; var autoColorscaleDflt; if (sclIn !== void 0) autoColorscaleDflt = !isValidScale(sclIn); if (sclTemplate !== void 0) autoColorscaleDflt = !isValidScale(sclTemplate); coerce(prefix + "autocolorscale", autoColorscaleDflt); coerce(prefix + "colorscale"); coerce(prefix + "reversescale"); if (prefix !== "marker.line.") { var showScaleDflt; if (prefix && inTrace) showScaleDflt = hasColorbar(containerIn); var showScale = coerce(prefix + "showscale", showScaleDflt); if (showScale) { if (prefix && template) containerOut._template = template; colorbarDefaults(containerIn, containerOut, layout); } } }; } }); // node_modules/plotly.js/src/components/colorscale/layout_defaults.js var require_layout_defaults = __commonJS({ "node_modules/plotly.js/src/components/colorscale/layout_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Template = require_plot_template(); var colorScaleAttrs = require_layout_attributes5(); var colorScaleDefaults = require_defaults2(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, colorScaleAttrs, attr, dflt); } coerce("colorscale.sequential"); coerce("colorscale.sequentialminus"); coerce("colorscale.diverging"); var colorAxes = layoutOut._colorAxes; var colorAxIn, colorAxOut; function coerceAx(attr, dflt) { return Lib.coerce(colorAxIn, colorAxOut, colorScaleAttrs.coloraxis, attr, dflt); } for (var k in colorAxes) { var stash = colorAxes[k]; if (stash[0]) { colorAxIn = layoutIn[k] || {}; colorAxOut = Template.newContainer(layoutOut, k, "coloraxis"); colorAxOut._name = k; colorScaleDefaults(colorAxIn, colorAxOut, layoutOut, coerceAx, { prefix: "", cLetter: "c" }); } else { for (var i = 0; i < stash[2].length; i++) { stash[2][i](); } delete layoutOut._colorAxes[k]; } } }; } }); // node_modules/plotly.js/src/components/colorscale/cross_trace_defaults.js var require_cross_trace_defaults = __commonJS({ "node_modules/plotly.js/src/components/colorscale/cross_trace_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var hasColorscale = require_helpers().hasColorscale; var extractOpts = require_helpers().extractOpts; module2.exports = function crossTraceDefaults(fullData, fullLayout) { function replace(cont, k2) { var val = cont["_" + k2]; if (val !== void 0) { cont[k2] = val; } } function relinkColorAttrs(outerCont, cbOpt) { var cont = cbOpt.container ? Lib.nestedProperty(outerCont, cbOpt.container).get() : outerCont; if (cont) { if (cont.coloraxis) { cont._colorAx = fullLayout[cont.coloraxis]; } else { var cOpts = extractOpts(cont); var isAuto = cOpts.auto; if (isAuto || cOpts.min === void 0) { replace(cont, cbOpt.min); } if (isAuto || cOpts.max === void 0) { replace(cont, cbOpt.max); } if (cOpts.autocolorscale) { replace(cont, "colorscale"); } } } } for (var i = 0; i < fullData.length; i++) { var trace = fullData[i]; var cbOpts = trace._module.colorbar; if (cbOpts) { if (Array.isArray(cbOpts)) { for (var j = 0; j < cbOpts.length; j++) { relinkColorAttrs(trace, cbOpts[j]); } } else { relinkColorAttrs(trace, cbOpts); } } if (hasColorscale(trace, "marker.line")) { relinkColorAttrs(trace, { container: "marker.line", min: "cmin", max: "cmax" }); } } for (var k in fullLayout._colorAxes) { relinkColorAttrs(fullLayout[k], { min: "cmin", max: "cmax" }); } }; } }); // node_modules/plotly.js/src/components/colorscale/calc.js var require_calc = __commonJS({ "node_modules/plotly.js/src/components/colorscale/calc.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var extractOpts = require_helpers().extractOpts; module2.exports = function calc(gd2, trace, opts) { var fullLayout = gd2._fullLayout; var vals = opts.vals; var containerStr = opts.containerStr; var container = containerStr ? Lib.nestedProperty(trace, containerStr).get() : trace; var cOpts = extractOpts(container); var auto = cOpts.auto !== false; var min = cOpts.min; var max = cOpts.max; var mid = cOpts.mid; var minVal = function() { return Lib.aggNums(Math.min, null, vals); }; var maxVal = function() { return Lib.aggNums(Math.max, null, vals); }; if (min === void 0) { min = minVal(); } else if (auto) { if (container._colorAx && isNumeric(min)) { min = Math.min(min, minVal()); } else { min = minVal(); } } if (max === void 0) { max = maxVal(); } else if (auto) { if (container._colorAx && isNumeric(max)) { max = Math.max(max, maxVal()); } else { max = maxVal(); } } if (auto && mid !== void 0) { if (max - mid > mid - min) { min = mid - (max - mid); } else if (max - mid < mid - min) { max = mid + (mid - min); } } if (min === max) { min -= 0.5; max += 0.5; } cOpts._sync("min", min); cOpts._sync("max", max); if (cOpts.autocolorscale) { var scl; if (min * max < 0) scl = fullLayout.colorscale.diverging; else if (min >= 0) scl = fullLayout.colorscale.sequential; else scl = fullLayout.colorscale.sequentialminus; cOpts._sync("colorscale", scl); } }; } }); // node_modules/plotly.js/src/components/colorscale/index.js var require_colorscale = __commonJS({ "node_modules/plotly.js/src/components/colorscale/index.js"(exports2, module2) { "use strict"; var scales = require_scales(); var helpers = require_helpers(); module2.exports = { moduleType: "component", name: "colorscale", attributes: require_attributes8(), layoutAttributes: require_layout_attributes5(), supplyLayoutDefaults: require_layout_defaults(), handleDefaults: require_defaults2(), crossTraceDefaults: require_cross_trace_defaults(), calc: require_calc(), // ./scales.js is required in lib/coerce.js ; // it needs to be a separate module to avoid a circular dependency scales: scales.scales, defaultScale: scales.defaultScale, getScale: scales.get, isValidScale: scales.isValid, hasColorscale: helpers.hasColorscale, extractOpts: helpers.extractOpts, extractScale: helpers.extractScale, flipScale: helpers.flipScale, makeColorScaleFunc: helpers.makeColorScaleFunc, makeColorScaleFuncFromTrace: helpers.makeColorScaleFuncFromTrace }; } }); // node_modules/plotly.js/src/traces/scatter/subtypes.js var require_subtypes = __commonJS({ "node_modules/plotly.js/src/traces/scatter/subtypes.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var isTypedArraySpec = require_array().isTypedArraySpec; module2.exports = { hasLines: function(trace) { return trace.visible && trace.mode && trace.mode.indexOf("lines") !== -1; }, hasMarkers: function(trace) { return trace.visible && (trace.mode && trace.mode.indexOf("markers") !== -1 || // until splom implements 'mode' trace.type === "splom"); }, hasText: function(trace) { return trace.visible && trace.mode && trace.mode.indexOf("text") !== -1; }, isBubble: function(trace) { var marker = trace.marker; return Lib.isPlainObject(marker) && (Lib.isArrayOrTypedArray(marker.size) || isTypedArraySpec(marker.size)); } }; } }); // node_modules/plotly.js/src/traces/scatter/make_bubble_size_func.js var require_make_bubble_size_func = __commonJS({ "node_modules/plotly.js/src/traces/scatter/make_bubble_size_func.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); module2.exports = function makeBubbleSizeFn(trace, factor) { if (!factor) { factor = 2; } var marker = trace.marker; var sizeRef = marker.sizeref || 1; var sizeMin = marker.sizemin || 0; var baseFn = marker.sizemode === "area" ? function(v) { return Math.sqrt(v / sizeRef); } : function(v) { return v / sizeRef; }; return function(v) { var baseSize = baseFn(v / factor); return isNumeric(baseSize) && baseSize > 0 ? Math.max(baseSize, sizeMin) : 0; }; }; } }); // node_modules/plotly.js/src/components/fx/helpers.js var require_helpers2 = __commonJS({ "node_modules/plotly.js/src/components/fx/helpers.js"(exports2) { "use strict"; var Lib = require_lib(); exports2.getSubplot = function(trace) { return trace.subplot || trace.xaxis + trace.yaxis || trace.geo; }; exports2.isTraceInSubplots = function(trace, subplots) { if (trace.type === "splom") { var xaxes = trace.xaxes || []; var yaxes = trace.yaxes || []; for (var i = 0; i < xaxes.length; i++) { for (var j = 0; j < yaxes.length; j++) { if (subplots.indexOf(xaxes[i] + yaxes[j]) !== -1) { return true; } } } return false; } return subplots.indexOf(exports2.getSubplot(trace)) !== -1; }; exports2.flat = function(subplots, v) { var out = new Array(subplots.length); for (var i = 0; i < subplots.length; i++) { out[i] = v; } return out; }; exports2.p2c = function(axArray, v) { var out = new Array(axArray.length); for (var i = 0; i < axArray.length; i++) { out[i] = axArray[i].p2c(v); } return out; }; exports2.getDistanceFunction = function(mode, dx, dy, dxy) { if (mode === "closest") return dxy || exports2.quadrature(dx, dy); return mode.charAt(0) === "x" ? dx : dy; }; exports2.getClosest = function(cd2, distfn, pointData) { if (pointData.index !== false) { if (pointData.index >= 0 && pointData.index < cd2.length) { pointData.distance = 0; } else pointData.index = false; } else { for (var i = 0; i < cd2.length; i++) { var newDistance = distfn(cd2[i]); if (newDistance <= pointData.distance) { pointData.index = i; pointData.distance = newDistance; } } } return pointData; }; exports2.inbox = function(v02, v12, passVal) { return v02 * v12 < 0 || v02 === 0 ? passVal : Infinity; }; exports2.quadrature = function(dx, dy) { return function(di2) { var x = dx(di2); var y = dy(di2); return Math.sqrt(x * x + y * y); }; }; exports2.makeEventData = function(pt2, trace, cd2) { var pointNumber = "index" in pt2 ? pt2.index : pt2.pointNumber; var out = { data: trace._input, fullData: trace, curveNumber: trace.index, pointNumber }; if (trace._indexToPoints) { var pointIndices = trace._indexToPoints[pointNumber]; if (pointIndices.length === 1) { out.pointIndex = pointIndices[0]; } else { out.pointIndices = pointIndices; } } else { out.pointIndex = pointNumber; } if (trace._module.eventData) { out = trace._module.eventData(out, pt2, trace, cd2, pointNumber); } else { if ("xVal" in pt2) out.x = pt2.xVal; else if ("x" in pt2) out.x = pt2.x; if ("yVal" in pt2) out.y = pt2.yVal; else if ("y" in pt2) out.y = pt2.y; if (pt2.xa) out.xaxis = pt2.xa; if (pt2.ya) out.yaxis = pt2.ya; if (pt2.zLabelVal !== void 0) out.z = pt2.zLabelVal; } exports2.appendArrayPointValue(out, trace, pointNumber); return out; }; exports2.appendArrayPointValue = function(pointData, trace, pointNumber) { var arrayAttrs = trace._arrayAttrs; if (!arrayAttrs) { return; } for (var i = 0; i < arrayAttrs.length; i++) { var astr = arrayAttrs[i]; var key = getPointKey(astr); if (pointData[key] === void 0) { var val = Lib.nestedProperty(trace, astr).get(); var pointVal = getPointData(val, pointNumber); if (pointVal !== void 0) pointData[key] = pointVal; } } }; exports2.appendArrayMultiPointValues = function(pointData, trace, pointNumbers) { var arrayAttrs = trace._arrayAttrs; if (!arrayAttrs) { return; } for (var i = 0; i < arrayAttrs.length; i++) { var astr = arrayAttrs[i]; var key = getPointKey(astr); if (pointData[key] === void 0) { var val = Lib.nestedProperty(trace, astr).get(); var keyVal = new Array(pointNumbers.length); for (var j = 0; j < pointNumbers.length; j++) { keyVal[j] = getPointData(val, pointNumbers[j]); } pointData[key] = keyVal; } } }; var pointKeyMap = { ids: "id", locations: "location", labels: "label", values: "value", "marker.colors": "color", parents: "parent" }; function getPointKey(astr) { return pointKeyMap[astr] || astr; } function getPointData(val, pointNumber) { if (Array.isArray(pointNumber)) { if (Array.isArray(val) && Array.isArray(val[pointNumber[0]])) { return val[pointNumber[0]][pointNumber[1]]; } } else { return val[pointNumber]; } } var xyHoverMode = { x: true, y: true }; var unifiedHoverMode = { "x unified": true, "y unified": true }; exports2.isUnifiedHover = function(hovermode) { if (typeof hovermode !== "string") return false; return !!unifiedHoverMode[hovermode]; }; exports2.isXYhover = function(hovermode) { if (typeof hovermode !== "string") return false; return !!xyHoverMode[hovermode]; }; } }); // node_modules/parse-svg-path/index.js var require_parse_svg_path = __commonJS({ "node_modules/parse-svg-path/index.js"(exports2, module2) { module2.exports = parse; var length = { a: 7, c: 6, h: 1, l: 2, m: 2, q: 4, s: 4, t: 2, v: 1, z: 0 }; var segment = /([astvzqmhlc])([^astvzqmhlc]*)/ig; function parse(path) { var data = []; path.replace(segment, function(_, command, args) { var type = command.toLowerCase(); args = parseValues(args); if (type == "m" && args.length > 2) { data.push([command].concat(args.splice(0, 2))); type = "l"; command = command == "m" ? "l" : "L"; } while (true) { if (args.length == length[type]) { args.unshift(command); return data.push(args); } if (args.length < length[type]) throw new Error("malformed path data"); data.push([command].concat(args.splice(0, length[type]))); } }); return data; } var number = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig; function parseValues(args) { var numbers = args.match(number); return numbers ? numbers.map(Number) : []; } } }); // node_modules/plotly.js/src/components/drawing/symbol_defs.js var require_symbol_defs = __commonJS({ "node_modules/plotly.js/src/components/drawing/symbol_defs.js"(exports2, module2) { "use strict"; var parseSvgPath = require_parse_svg_path(); var round = require_d3().round; var emptyPath = "M0,0Z"; var sqrt2 = Math.sqrt(2); var sqrt3 = Math.sqrt(3); var PI = Math.PI; var cos = Math.cos; var sin = Math.sin; module2.exports = { circle: { n: 0, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); var circle = "M" + rs + ",0A" + rs + "," + rs + " 0 1,1 0,-" + rs + "A" + rs + "," + rs + " 0 0,1 " + rs + ",0Z"; return standoff ? align(angle, standoff, circle) : circle; } }, square: { n: 1, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M" + rs + "," + rs + "H-" + rs + "V-" + rs + "H" + rs + "Z"); } }, diamond: { n: 2, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rd2 = round(r * 1.3, 2); return align(angle, standoff, "M" + rd2 + ",0L0," + rd2 + "L-" + rd2 + ",0L0,-" + rd2 + "Z"); } }, cross: { n: 3, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rc2 = round(r * 0.4, 2); var rc22 = round(r * 1.2, 2); return align(angle, standoff, "M" + rc22 + "," + rc2 + "H" + rc2 + "V" + rc22 + "H-" + rc2 + "V" + rc2 + "H-" + rc22 + "V-" + rc2 + "H-" + rc2 + "V-" + rc22 + "H" + rc2 + "V-" + rc2 + "H" + rc22 + "Z"); } }, x: { n: 4, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r * 0.8 / sqrt2, 2); var ne2 = "l" + rx + "," + rx; var se2 = "l" + rx + ",-" + rx; var sw = "l-" + rx + ",-" + rx; var nw = "l-" + rx + "," + rx; return align(angle, standoff, "M0," + rx + ne2 + se2 + sw + se2 + sw + nw + sw + nw + ne2 + nw + ne2 + "Z"); } }, "triangle-up": { n: 5, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rt2 = round(r * 2 / sqrt3, 2); var r2 = round(r / 2, 2); var rs = round(r, 2); return align(angle, standoff, "M-" + rt2 + "," + r2 + "H" + rt2 + "L0,-" + rs + "Z"); } }, "triangle-down": { n: 6, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rt2 = round(r * 2 / sqrt3, 2); var r2 = round(r / 2, 2); var rs = round(r, 2); return align(angle, standoff, "M-" + rt2 + ",-" + r2 + "H" + rt2 + "L0," + rs + "Z"); } }, "triangle-left": { n: 7, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rt2 = round(r * 2 / sqrt3, 2); var r2 = round(r / 2, 2); var rs = round(r, 2); return align(angle, standoff, "M" + r2 + ",-" + rt2 + "V" + rt2 + "L-" + rs + ",0Z"); } }, "triangle-right": { n: 8, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rt2 = round(r * 2 / sqrt3, 2); var r2 = round(r / 2, 2); var rs = round(r, 2); return align(angle, standoff, "M-" + r2 + ",-" + rt2 + "V" + rt2 + "L" + rs + ",0Z"); } }, "triangle-ne": { n: 9, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var r12 = round(r * 0.6, 2); var r2 = round(r * 1.2, 2); return align(angle, standoff, "M-" + r2 + ",-" + r12 + "H" + r12 + "V" + r2 + "Z"); } }, "triangle-se": { n: 10, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var r12 = round(r * 0.6, 2); var r2 = round(r * 1.2, 2); return align(angle, standoff, "M" + r12 + ",-" + r2 + "V" + r12 + "H-" + r2 + "Z"); } }, "triangle-sw": { n: 11, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var r12 = round(r * 0.6, 2); var r2 = round(r * 1.2, 2); return align(angle, standoff, "M" + r2 + "," + r12 + "H-" + r12 + "V-" + r2 + "Z"); } }, "triangle-nw": { n: 12, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var r12 = round(r * 0.6, 2); var r2 = round(r * 1.2, 2); return align(angle, standoff, "M-" + r12 + "," + r2 + "V-" + r12 + "H" + r2 + "Z"); } }, pentagon: { n: 13, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x12 = round(r * 0.951, 2); var x2 = round(r * 0.588, 2); var y02 = round(-r, 2); var y12 = round(r * -0.309, 2); var y2 = round(r * 0.809, 2); return align(angle, standoff, "M" + x12 + "," + y12 + "L" + x2 + "," + y2 + "H-" + x2 + "L-" + x12 + "," + y12 + "L0," + y02 + "Z"); } }, hexagon: { n: 14, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var y02 = round(r, 2); var y12 = round(r / 2, 2); var x = round(r * sqrt3 / 2, 2); return align(angle, standoff, "M" + x + ",-" + y12 + "V" + y12 + "L0," + y02 + "L-" + x + "," + y12 + "V-" + y12 + "L0,-" + y02 + "Z"); } }, hexagon2: { n: 15, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x02 = round(r, 2); var x12 = round(r / 2, 2); var y = round(r * sqrt3 / 2, 2); return align(angle, standoff, "M-" + x12 + "," + y + "H" + x12 + "L" + x02 + ",0L" + x12 + ",-" + y + "H-" + x12 + "L-" + x02 + ",0Z"); } }, octagon: { n: 16, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var a = round(r * 0.924, 2); var b = round(r * 0.383, 2); return align(angle, standoff, "M-" + b + ",-" + a + "H" + b + "L" + a + ",-" + b + "V" + b + "L" + b + "," + a + "H-" + b + "L-" + a + "," + b + "V-" + b + "Z"); } }, star: { n: 17, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = r * 1.4; var x12 = round(rs * 0.225, 2); var x2 = round(rs * 0.951, 2); var x3 = round(rs * 0.363, 2); var x4 = round(rs * 0.588, 2); var y02 = round(-rs, 2); var y12 = round(rs * -0.309, 2); var y3 = round(rs * 0.118, 2); var y4 = round(rs * 0.809, 2); var y5 = round(rs * 0.382, 2); return align(angle, standoff, "M" + x12 + "," + y12 + "H" + x2 + "L" + x3 + "," + y3 + "L" + x4 + "," + y4 + "L0," + y5 + "L-" + x4 + "," + y4 + "L-" + x3 + "," + y3 + "L-" + x2 + "," + y12 + "H-" + x12 + "L0," + y02 + "Z"); } }, hexagram: { n: 18, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var y = round(r * 0.66, 2); var x12 = round(r * 0.38, 2); var x2 = round(r * 0.76, 2); return align(angle, standoff, "M-" + x2 + ",0l-" + x12 + ",-" + y + "h" + x2 + "l" + x12 + ",-" + y + "l" + x12 + "," + y + "h" + x2 + "l-" + x12 + "," + y + "l" + x12 + "," + y + "h-" + x2 + "l-" + x12 + "," + y + "l-" + x12 + ",-" + y + "h-" + x2 + "Z"); } }, "star-triangle-up": { n: 19, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * sqrt3 * 0.8, 2); var y12 = round(r * 0.8, 2); var y2 = round(r * 1.6, 2); var rc2 = round(r * 4, 2); var aPart = "A " + rc2 + "," + rc2 + " 0 0 1 "; return align(angle, standoff, "M-" + x + "," + y12 + aPart + x + "," + y12 + aPart + "0,-" + y2 + aPart + "-" + x + "," + y12 + "Z"); } }, "star-triangle-down": { n: 20, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * sqrt3 * 0.8, 2); var y12 = round(r * 0.8, 2); var y2 = round(r * 1.6, 2); var rc2 = round(r * 4, 2); var aPart = "A " + rc2 + "," + rc2 + " 0 0 1 "; return align(angle, standoff, "M" + x + ",-" + y12 + aPart + "-" + x + ",-" + y12 + aPart + "0," + y2 + aPart + x + ",-" + y12 + "Z"); } }, "star-square": { n: 21, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rp2 = round(r * 1.1, 2); var rc2 = round(r * 2, 2); var aPart = "A " + rc2 + "," + rc2 + " 0 0 1 "; return align(angle, standoff, "M-" + rp2 + ",-" + rp2 + aPart + "-" + rp2 + "," + rp2 + aPart + rp2 + "," + rp2 + aPart + rp2 + ",-" + rp2 + aPart + "-" + rp2 + ",-" + rp2 + "Z"); } }, "star-diamond": { n: 22, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rp2 = round(r * 1.4, 2); var rc2 = round(r * 1.9, 2); var aPart = "A " + rc2 + "," + rc2 + " 0 0 1 "; return align(angle, standoff, "M-" + rp2 + ",0" + aPart + "0," + rp2 + aPart + rp2 + ",0" + aPart + "0,-" + rp2 + aPart + "-" + rp2 + ",0Z"); } }, "diamond-tall": { n: 23, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * 0.7, 2); var y = round(r * 1.4, 2); return align(angle, standoff, "M0," + y + "L" + x + ",0L0,-" + y + "L-" + x + ",0Z"); } }, "diamond-wide": { n: 24, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * 1.4, 2); var y = round(r * 0.7, 2); return align(angle, standoff, "M0," + y + "L" + x + ",0L0,-" + y + "L-" + x + ",0Z"); } }, hourglass: { n: 25, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M" + rs + "," + rs + "H-" + rs + "L" + rs + ",-" + rs + "H-" + rs + "Z"); }, noDot: true }, bowtie: { n: 26, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M" + rs + "," + rs + "V-" + rs + "L-" + rs + "," + rs + "V-" + rs + "Z"); }, noDot: true }, "circle-cross": { n: 27, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M0," + rs + "V-" + rs + "M" + rs + ",0H-" + rs + "M" + rs + ",0A" + rs + "," + rs + " 0 1,1 0,-" + rs + "A" + rs + "," + rs + " 0 0,1 " + rs + ",0Z"); }, needLine: true, noDot: true }, "circle-x": { n: 28, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); var rc2 = round(r / sqrt2, 2); return align(angle, standoff, "M" + rc2 + "," + rc2 + "L-" + rc2 + ",-" + rc2 + "M" + rc2 + ",-" + rc2 + "L-" + rc2 + "," + rc2 + "M" + rs + ",0A" + rs + "," + rs + " 0 1,1 0,-" + rs + "A" + rs + "," + rs + " 0 0,1 " + rs + ",0Z"); }, needLine: true, noDot: true }, "square-cross": { n: 29, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M0," + rs + "V-" + rs + "M" + rs + ",0H-" + rs + "M" + rs + "," + rs + "H-" + rs + "V-" + rs + "H" + rs + "Z"); }, needLine: true, noDot: true }, "square-x": { n: 30, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rs = round(r, 2); return align(angle, standoff, "M" + rs + "," + rs + "L-" + rs + ",-" + rs + "M" + rs + ",-" + rs + "L-" + rs + "," + rs + "M" + rs + "," + rs + "H-" + rs + "V-" + rs + "H" + rs + "Z"); }, needLine: true, noDot: true }, "diamond-cross": { n: 31, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rd2 = round(r * 1.3, 2); return align(angle, standoff, "M" + rd2 + ",0L0," + rd2 + "L-" + rd2 + ",0L0,-" + rd2 + "ZM0,-" + rd2 + "V" + rd2 + "M-" + rd2 + ",0H" + rd2); }, needLine: true, noDot: true }, "diamond-x": { n: 32, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rd2 = round(r * 1.3, 2); var r2 = round(r * 0.65, 2); return align(angle, standoff, "M" + rd2 + ",0L0," + rd2 + "L-" + rd2 + ",0L0,-" + rd2 + "ZM-" + r2 + ",-" + r2 + "L" + r2 + "," + r2 + "M-" + r2 + "," + r2 + "L" + r2 + ",-" + r2); }, needLine: true, noDot: true }, "cross-thin": { n: 33, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rc2 = round(r * 1.4, 2); return align(angle, standoff, "M0," + rc2 + "V-" + rc2 + "M" + rc2 + ",0H-" + rc2); }, needLine: true, noDot: true, noFill: true }, "x-thin": { n: 34, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); return align(angle, standoff, "M" + rx + "," + rx + "L-" + rx + ",-" + rx + "M" + rx + ",-" + rx + "L-" + rx + "," + rx); }, needLine: true, noDot: true, noFill: true }, asterisk: { n: 35, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rc2 = round(r * 1.2, 2); var rs = round(r * 0.85, 2); return align(angle, standoff, "M0," + rc2 + "V-" + rc2 + "M" + rc2 + ",0H-" + rc2 + "M" + rs + "," + rs + "L-" + rs + ",-" + rs + "M" + rs + ",-" + rs + "L-" + rs + "," + rs); }, needLine: true, noDot: true, noFill: true }, hash: { n: 36, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var r12 = round(r / 2, 2); var r2 = round(r, 2); return align(angle, standoff, "M" + r12 + "," + r2 + "V-" + r2 + "M" + (r12 - r2) + ",-" + r2 + "V" + r2 + "M" + r2 + "," + r12 + "H-" + r2 + "M-" + r2 + "," + (r12 - r2) + "H" + r2); }, needLine: true, noFill: true }, "y-up": { n: 37, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * 1.2, 2); var y02 = round(r * 1.6, 2); var y12 = round(r * 0.8, 2); return align(angle, standoff, "M-" + x + "," + y12 + "L0,0M" + x + "," + y12 + "L0,0M0,-" + y02 + "L0,0"); }, needLine: true, noDot: true, noFill: true }, "y-down": { n: 38, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var x = round(r * 1.2, 2); var y02 = round(r * 1.6, 2); var y12 = round(r * 0.8, 2); return align(angle, standoff, "M-" + x + ",-" + y12 + "L0,0M" + x + ",-" + y12 + "L0,0M0," + y02 + "L0,0"); }, needLine: true, noDot: true, noFill: true }, "y-left": { n: 39, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var y = round(r * 1.2, 2); var x02 = round(r * 1.6, 2); var x12 = round(r * 0.8, 2); return align(angle, standoff, "M" + x12 + "," + y + "L0,0M" + x12 + ",-" + y + "L0,0M-" + x02 + ",0L0,0"); }, needLine: true, noDot: true, noFill: true }, "y-right": { n: 40, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var y = round(r * 1.2, 2); var x02 = round(r * 1.6, 2); var x12 = round(r * 0.8, 2); return align(angle, standoff, "M-" + x12 + "," + y + "L0,0M-" + x12 + ",-" + y + "L0,0M" + x02 + ",0L0,0"); }, needLine: true, noDot: true, noFill: true }, "line-ew": { n: 41, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rc2 = round(r * 1.4, 2); return align(angle, standoff, "M" + rc2 + ",0H-" + rc2); }, needLine: true, noDot: true, noFill: true }, "line-ns": { n: 42, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rc2 = round(r * 1.4, 2); return align(angle, standoff, "M0," + rc2 + "V-" + rc2); }, needLine: true, noDot: true, noFill: true }, "line-ne": { n: 43, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); return align(angle, standoff, "M" + rx + ",-" + rx + "L-" + rx + "," + rx); }, needLine: true, noDot: true, noFill: true }, "line-nw": { n: 44, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); return align(angle, standoff, "M" + rx + "," + rx + "L-" + rx + ",-" + rx); }, needLine: true, noDot: true, noFill: true }, "arrow-up": { n: 45, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); var ry = round(r * 2, 2); return align(angle, standoff, "M0,0L-" + rx + "," + ry + "H" + rx + "Z"); }, backoff: 1, noDot: true }, "arrow-down": { n: 46, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); var ry = round(r * 2, 2); return align(angle, standoff, "M0,0L-" + rx + ",-" + ry + "H" + rx + "Z"); }, noDot: true }, "arrow-left": { n: 47, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r * 2, 2); var ry = round(r, 2); return align(angle, standoff, "M0,0L" + rx + ",-" + ry + "V" + ry + "Z"); }, noDot: true }, "arrow-right": { n: 48, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r * 2, 2); var ry = round(r, 2); return align(angle, standoff, "M0,0L-" + rx + ",-" + ry + "V" + ry + "Z"); }, noDot: true }, "arrow-bar-up": { n: 49, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); var ry = round(r * 2, 2); return align(angle, standoff, "M-" + rx + ",0H" + rx + "M0,0L-" + rx + "," + ry + "H" + rx + "Z"); }, backoff: 1, needLine: true, noDot: true }, "arrow-bar-down": { n: 50, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r, 2); var ry = round(r * 2, 2); return align(angle, standoff, "M-" + rx + ",0H" + rx + "M0,0L-" + rx + ",-" + ry + "H" + rx + "Z"); }, needLine: true, noDot: true }, "arrow-bar-left": { n: 51, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r * 2, 2); var ry = round(r, 2); return align(angle, standoff, "M0,-" + ry + "V" + ry + "M0,0L" + rx + ",-" + ry + "V" + ry + "Z"); }, needLine: true, noDot: true }, "arrow-bar-right": { n: 52, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var rx = round(r * 2, 2); var ry = round(r, 2); return align(angle, standoff, "M0,-" + ry + "V" + ry + "M0,0L-" + rx + ",-" + ry + "V" + ry + "Z"); }, needLine: true, noDot: true }, arrow: { n: 53, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var headAngle = PI / 2.5; var x = 2 * r * cos(headAngle); var y = 2 * r * sin(headAngle); return align( angle, standoff, "M0,0L" + -x + "," + y + "L" + x + "," + y + "Z" ); }, backoff: 0.9, noDot: true }, "arrow-wide": { n: 54, f: function(r, angle, standoff) { if (skipAngle(angle)) return emptyPath; var headAngle = PI / 4; var x = 2 * r * cos(headAngle); var y = 2 * r * sin(headAngle); return align( angle, standoff, "M0,0L" + -x + "," + y + "A " + 2 * r + "," + 2 * r + " 0 0 1 " + x + "," + y + "Z" ); }, backoff: 0.4, noDot: true } }; function skipAngle(angle) { return angle === null; } var lastPathIn; var lastPathOut; var lastAngle; var lastStandoff; function align(angle, standoff, path) { if ((!angle || angle % 360 === 0) && !standoff) return path; if (lastAngle === angle && lastStandoff === standoff && lastPathIn === path) return lastPathOut; lastAngle = angle; lastStandoff = standoff; lastPathIn = path; function rotate(t2, xy) { var cosT = cos(t2); var sinT = sin(t2); var x2 = xy[0]; var y2 = xy[1] + (standoff || 0); return [ x2 * cosT - y2 * sinT, x2 * sinT + y2 * cosT ]; } var t = angle / 180 * PI; var x = 0; var y = 0; var cmd = parseSvgPath(path); var str = ""; for (var i = 0; i < cmd.length; i++) { var cmdI = cmd[i]; var op2 = cmdI[0]; var x02 = x; var y02 = y; if (op2 === "M" || op2 === "L") { x = +cmdI[1]; y = +cmdI[2]; } else if (op2 === "m" || op2 === "l") { x += +cmdI[1]; y += +cmdI[2]; } else if (op2 === "H") { x = +cmdI[1]; } else if (op2 === "h") { x += +cmdI[1]; } else if (op2 === "V") { y = +cmdI[1]; } else if (op2 === "v") { y += +cmdI[1]; } else if (op2 === "A") { x = +cmdI[1]; y = +cmdI[2]; var E = rotate(t, [+cmdI[6], +cmdI[7]]); cmdI[6] = E[0]; cmdI[7] = E[1]; cmdI[3] = +cmdI[3] + angle; } if (op2 === "H" || op2 === "V") op2 = "L"; if (op2 === "h" || op2 === "v") op2 = "l"; if (op2 === "m" || op2 === "l") { x -= x02; y -= y02; } var B = rotate(t, [x, y]); if (op2 === "H" || op2 === "V") op2 = "L"; if (op2 === "M" || op2 === "L" || op2 === "m" || op2 === "l") { cmdI[1] = B[0]; cmdI[2] = B[1]; } cmdI[0] = op2; str += cmdI[0] + cmdI.slice(1).join(","); } lastPathOut = str; return str; } } }); // node_modules/plotly.js/src/components/drawing/index.js var require_drawing = __commonJS({ "node_modules/plotly.js/src/components/drawing/index.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var numberFormat = Lib.numberFormat; var isNumeric = require_fast_isnumeric(); var tinycolor = require_tinycolor(); var Registry = require_registry(); var Color = require_color(); var Colorscale = require_colorscale(); var strTranslate = Lib.strTranslate; var svgTextUtils = require_svg_text_utils(); var xmlnsNamespaces = require_xmlns_namespaces(); var alignment = require_alignment(); var LINE_SPACING = alignment.LINE_SPACING; var DESELECTDIM = require_interactions().DESELECTDIM; var subTypes = require_subtypes(); var makeBubbleSizeFn = require_make_bubble_size_func(); var appendArrayPointValue = require_helpers2().appendArrayPointValue; var drawing = module2.exports = {}; drawing.font = function(s, font) { var variant = font.variant; var style = font.style; var weight = font.weight; var color = font.color; var size = font.size; var family = font.family; var shadow = font.shadow; var lineposition = font.lineposition; var textcase = font.textcase; if (family) s.style("font-family", family); if (size + 1) s.style("font-size", size + "px"); if (color) s.call(Color.fill, color); if (weight) s.style("font-weight", weight); if (style) s.style("font-style", style); if (variant) s.style("font-variant", variant); if (textcase) s.style("text-transform", dropNone(textcase2transform(textcase))); if (shadow) s.style("text-shadow", shadow === "auto" ? svgTextUtils.makeTextShadow(Color.contrast(color)) : dropNone(shadow)); if (lineposition) s.style("text-decoration-line", dropNone(lineposition2decorationLine(lineposition))); }; function dropNone(a) { return a === "none" ? void 0 : a; } var textcase2transformOptions = { normal: "none", lower: "lowercase", upper: "uppercase", "word caps": "capitalize" }; function textcase2transform(textcase) { return textcase2transformOptions[textcase]; } function lineposition2decorationLine(lineposition) { return lineposition.replace("under", "underline").replace("over", "overline").replace("through", "line-through").split("+").join(" "); } drawing.setPosition = function(s, x, y) { s.attr("x", x).attr("y", y); }; drawing.setSize = function(s, w, h) { s.attr("width", w).attr("height", h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; drawing.translatePoint = function(d, sel, xa2, ya2) { var x = xa2.c2p(d.x); var y = ya2.c2p(d.y); if (isNumeric(x) && isNumeric(y) && sel.node()) { if (sel.node().nodeName === "text") { sel.attr("x", x).attr("y", y); } else { sel.attr("transform", strTranslate(x, y)); } } else { return false; } return true; }; drawing.translatePoints = function(s, xa2, ya2) { s.each(function(d) { var sel = d3.select(this); drawing.translatePoint(d, sel, xa2, ya2); }); }; drawing.hideOutsideRangePoint = function(d, sel, xa2, ya2, xcalendar, ycalendar) { sel.attr( "display", xa2.isPtWithinRange(d, xcalendar) && ya2.isPtWithinRange(d, ycalendar) ? null : "none" ); }; drawing.hideOutsideRangePoints = function(traceGroups, subplot) { if (!subplot._hasClipOnAxisFalse) return; var xa2 = subplot.xaxis; var ya2 = subplot.yaxis; traceGroups.each(function(d) { var trace = d[0].trace; var xcalendar = trace.xcalendar; var ycalendar = trace.ycalendar; var selector = Registry.traceIs(trace, "bar-like") ? ".bartext" : ".point,.textpoint"; traceGroups.selectAll(selector).each(function(d2) { drawing.hideOutsideRangePoint(d2, d3.select(this), xa2, ya2, xcalendar, ycalendar); }); }); }; drawing.crispRound = function(gd2, lineWidth, dflt) { if (!lineWidth || !isNumeric(lineWidth)) return dflt || 0; if (gd2._context.staticPlot) return lineWidth; if (lineWidth < 1) return 1; return Math.round(lineWidth); }; drawing.singleLineStyle = function(d, s, lw, lc2, ld2) { s.style("fill", "none"); var line = (((d || [])[0] || {}).trace || {}).line || {}; var lw1 = lw || line.width || 0; var dash = ld2 || line.dash || ""; Color.stroke(s, lc2 || line.color); drawing.dashLine(s, dash, lw1); }; drawing.lineGroupStyle = function(s, lw, lc2, ld2) { s.style("fill", "none").each(function(d) { var line = (((d || [])[0] || {}).trace || {}).line || {}; var lw1 = lw || line.width || 0; var dash = ld2 || line.dash || ""; d3.select(this).call(Color.stroke, lc2 || line.color).call(drawing.dashLine, dash, lw1); }); }; drawing.dashLine = function(s, dash, lineWidth) { lineWidth = +lineWidth || 0; dash = drawing.dashStyle(dash, lineWidth); s.style({ "stroke-dasharray": dash, "stroke-width": lineWidth + "px" }); }; drawing.dashStyle = function(dash, lineWidth) { lineWidth = +lineWidth || 1; var dlw = Math.max(lineWidth, 3); if (dash === "solid") dash = ""; else if (dash === "dot") dash = dlw + "px," + dlw + "px"; else if (dash === "dash") dash = 3 * dlw + "px," + 3 * dlw + "px"; else if (dash === "longdash") dash = 5 * dlw + "px," + 5 * dlw + "px"; else if (dash === "dashdot") { dash = 3 * dlw + "px," + dlw + "px," + dlw + "px," + dlw + "px"; } else if (dash === "longdashdot") { dash = 5 * dlw + "px," + 2 * dlw + "px," + dlw + "px," + 2 * dlw + "px"; } return dash; }; function setFillStyle(sel, trace, gd2, forLegend) { var markerPattern = trace.fillpattern; var fillgradient = trace.fillgradient; var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, 0, ""); if (patternShape) { var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, 0, null); var patternFGColor = drawing.getPatternAttr(markerPattern.fgcolor, 0, null); var patternFGOpacity = markerPattern.fgopacity; var patternSize = drawing.getPatternAttr(markerPattern.size, 0, 8); var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, 0, 0.3); var patternID = trace.uid; drawing.pattern( sel, "point", gd2, patternID, patternShape, patternSize, patternSolidity, void 0, markerPattern.fillmode, patternBGColor, patternFGColor, patternFGOpacity ); } else if (fillgradient && fillgradient.type !== "none") { var direction = fillgradient.type; var gradientID = "scatterfill-" + trace.uid; if (forLegend) { gradientID = "legendfill-" + trace.uid; } if (!forLegend && (fillgradient.start !== void 0 || fillgradient.stop !== void 0)) { var start, stop; if (direction === "horizontal") { start = { x: fillgradient.start, y: 0 }; stop = { x: fillgradient.stop, y: 0 }; } else if (direction === "vertical") { start = { x: 0, y: fillgradient.start }; stop = { x: 0, y: fillgradient.stop }; } start.x = trace._xA.c2p( start.x === void 0 ? trace._extremes.x.min[0].val : start.x, true ); start.y = trace._yA.c2p( start.y === void 0 ? trace._extremes.y.min[0].val : start.y, true ); stop.x = trace._xA.c2p( stop.x === void 0 ? trace._extremes.x.max[0].val : stop.x, true ); stop.y = trace._yA.c2p( stop.y === void 0 ? trace._extremes.y.max[0].val : stop.y, true ); sel.call(gradientWithBounds, gd2, gradientID, "linear", fillgradient.colorscale, "fill", start, stop, true, false); } else { if (direction === "horizontal") { direction = direction + "reversed"; } sel.call(drawing.gradient, gd2, gradientID, direction, fillgradient.colorscale, "fill"); } } else if (trace.fillcolor) { sel.call(Color.fill, trace.fillcolor); } } drawing.singleFillStyle = function(sel, gd2) { var node = d3.select(sel.node()); var data = node.data(); var trace = ((data[0] || [])[0] || {}).trace || {}; setFillStyle(sel, trace, gd2, false); }; drawing.fillGroupStyle = function(s, gd2, forLegend) { s.style("stroke-width", 0).each(function(d) { var shape = d3.select(this); if (d[0].trace) { setFillStyle(shape, d[0].trace, gd2, forLegend); } }); }; var SYMBOLDEFS = require_symbol_defs(); drawing.symbolNames = []; drawing.symbolFuncs = []; drawing.symbolBackOffs = []; drawing.symbolNeedLines = {}; drawing.symbolNoDot = {}; drawing.symbolNoFill = {}; drawing.symbolList = []; Object.keys(SYMBOLDEFS).forEach(function(k) { var symDef = SYMBOLDEFS[k]; var n = symDef.n; drawing.symbolList.push( n, String(n), k, n + 100, String(n + 100), k + "-open" ); drawing.symbolNames[n] = k; drawing.symbolFuncs[n] = symDef.f; drawing.symbolBackOffs[n] = symDef.backoff || 0; if (symDef.needLine) { drawing.symbolNeedLines[n] = true; } if (symDef.noDot) { drawing.symbolNoDot[n] = true; } else { drawing.symbolList.push( n + 200, String(n + 200), k + "-dot", n + 300, String(n + 300), k + "-open-dot" ); } if (symDef.noFill) { drawing.symbolNoFill[n] = true; } }); var MAXSYMBOL = drawing.symbolNames.length; var DOTPATH = "M0,0.5L0.5,0L0,-0.5L-0.5,0Z"; drawing.symbolNumber = function(v) { if (isNumeric(v)) { v = +v; } else if (typeof v === "string") { var vbase = 0; if (v.indexOf("-open") > 0) { vbase = 100; v = v.replace("-open", ""); } if (v.indexOf("-dot") > 0) { vbase += 200; v = v.replace("-dot", ""); } v = drawing.symbolNames.indexOf(v); if (v >= 0) { v += vbase; } } return v % 100 >= MAXSYMBOL || v >= 400 ? 0 : Math.floor(Math.max(v, 0)); }; function makePointPath(symbolNumber, r, t, s) { var base = symbolNumber % 100; return drawing.symbolFuncs[base](r, t, s) + (symbolNumber >= 200 ? DOTPATH : ""); } var stopFormatter = numberFormat("~f"); var gradientInfo = { radial: { type: "radial" }, radialreversed: { type: "radial", reversed: true }, horizontal: { type: "linear", start: { x: 1, y: 0 }, stop: { x: 0, y: 0 } }, horizontalreversed: { type: "linear", start: { x: 1, y: 0 }, stop: { x: 0, y: 0 }, reversed: true }, vertical: { type: "linear", start: { x: 0, y: 1 }, stop: { x: 0, y: 0 } }, verticalreversed: { type: "linear", start: { x: 0, y: 1 }, stop: { x: 0, y: 0 }, reversed: true } }; drawing.gradient = function(sel, gd2, gradientID, type, colorscale, prop) { var info = gradientInfo[type]; return gradientWithBounds( sel, gd2, gradientID, info.type, colorscale, prop, info.start, info.stop, false, info.reversed ); }; function gradientWithBounds(sel, gd2, gradientID, type, colorscale, prop, start, stop, inUserSpace, reversed) { var len = colorscale.length; var info; if (type === "linear") { info = { node: "linearGradient", attrs: { x1: start.x, y1: start.y, x2: stop.x, y2: stop.y, gradientUnits: inUserSpace ? "userSpaceOnUse" : "objectBoundingBox" }, reversed }; } else if (type === "radial") { info = { node: "radialGradient", reversed }; } var colorStops = new Array(len); for (var i = 0; i < len; i++) { if (info.reversed) { colorStops[len - 1 - i] = [stopFormatter((1 - colorscale[i][0]) * 100), colorscale[i][1]]; } else { colorStops[i] = [stopFormatter(colorscale[i][0] * 100), colorscale[i][1]]; } } var fullLayout = gd2._fullLayout; var fullID = "g" + fullLayout._uid + "-" + gradientID; var gradient = fullLayout._defs.select(".gradients").selectAll("#" + fullID).data([type + colorStops.join(";")], Lib.identity); gradient.exit().remove(); gradient.enter().append(info.node).each(function() { var el = d3.select(this); if (info.attrs) el.attr(info.attrs); el.attr("id", fullID); var stops = el.selectAll("stop").data(colorStops); stops.exit().remove(); stops.enter().append("stop"); stops.each(function(d) { var tc2 = tinycolor(d[1]); d3.select(this).attr({ offset: d[0] + "%", "stop-color": Color.tinyRGB(tc2), "stop-opacity": tc2.getAlpha() }); }); }); sel.style(prop, getFullUrl(fullID, gd2)).style(prop + "-opacity", null); sel.classed("gradient_filled", true); } drawing.pattern = function(sel, calledBy, gd2, patternID, shape, size, solidity, mcc, fillmode, bgcolor, fgcolor, fgopacity) { var isLegend = calledBy === "legend"; if (mcc) { if (fillmode === "overlay") { bgcolor = mcc; fgcolor = Color.contrast(bgcolor); } else { bgcolor = void 0; fgcolor = mcc; } } var fullLayout = gd2._fullLayout; var fullID = "p" + fullLayout._uid + "-" + patternID; var width, height; var linearFn = function(x, x02, x12, y02, y12) { return y02 + (y12 - y02) * (x - x02) / (x12 - x02); }; var path, linewidth, radius; var patternTag; var patternAttrs = {}; var fgC = tinycolor(fgcolor); var fgRGB = Color.tinyRGB(fgC); var fgAlpha = fgC.getAlpha(); var opacity = fgopacity * fgAlpha; switch (shape) { case "/": width = size * Math.sqrt(2); height = size * Math.sqrt(2); path = "M-" + width / 4 + "," + height / 4 + "l" + width / 2 + ",-" + height / 2 + "M0," + height + "L" + width + ",0M" + width / 4 * 3 + "," + height / 4 * 5 + "l" + width / 2 + ",-" + height / 2; linewidth = solidity * size; patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case "\\": width = size * Math.sqrt(2); height = size * Math.sqrt(2); path = "M" + width / 4 * 3 + ",-" + height / 4 + "l" + width / 2 + "," + height / 2 + "M0,0L" + width + "," + height + "M-" + width / 4 + "," + height / 4 * 3 + "l" + width / 2 + "," + height / 2; linewidth = solidity * size; patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case "x": width = size * Math.sqrt(2); height = size * Math.sqrt(2); path = "M-" + width / 4 + "," + height / 4 + "l" + width / 2 + ",-" + height / 2 + "M0," + height + "L" + width + ",0M" + width / 4 * 3 + "," + height / 4 * 5 + "l" + width / 2 + ",-" + height / 2 + "M" + width / 4 * 3 + ",-" + height / 4 + "l" + width / 2 + "," + height / 2 + "M0,0L" + width + "," + height + "M-" + width / 4 + "," + height / 4 * 3 + "l" + width / 2 + "," + height / 2; linewidth = size - size * Math.sqrt(1 - solidity); patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case "|": width = size; height = size; patternTag = "path"; path = "M" + width / 2 + ",0L" + width / 2 + "," + height; linewidth = solidity * size; patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case "-": width = size; height = size; patternTag = "path"; path = "M0," + height / 2 + "L" + width + "," + height / 2; linewidth = solidity * size; patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case "+": width = size; height = size; patternTag = "path"; path = "M" + width / 2 + ",0L" + width / 2 + "," + height + "M0," + height / 2 + "L" + width + "," + height / 2; linewidth = size - size * Math.sqrt(1 - solidity); patternTag = "path"; patternAttrs = { d: path, opacity, stroke: fgRGB, "stroke-width": linewidth + "px" }; break; case ".": width = size; height = size; if (solidity < Math.PI / 4) { radius = Math.sqrt(solidity * size * size / Math.PI); } else { radius = linearFn(solidity, Math.PI / 4, 1, size / 2, size / Math.sqrt(2)); } patternTag = "circle"; patternAttrs = { cx: width / 2, cy: height / 2, r: radius, opacity, fill: fgRGB }; break; } var str = [ shape || "noSh", bgcolor || "noBg", fgcolor || "noFg", size, solidity ].join(";"); var pattern = fullLayout._defs.select(".patterns").selectAll("#" + fullID).data([str], Lib.identity); pattern.exit().remove(); pattern.enter().append("pattern").each(function() { var el = d3.select(this); el.attr({ id: fullID, width: width + "px", height: height + "px", patternUnits: "userSpaceOnUse", // for legends scale down patterns just a bit so that default size (i.e 8) nicely fit in small icons patternTransform: isLegend ? "scale(0.8)" : "" }); if (bgcolor) { var bgC = tinycolor(bgcolor); var bgRGB = Color.tinyRGB(bgC); var bgAlpha = bgC.getAlpha(); var rects = el.selectAll("rect").data([0]); rects.exit().remove(); rects.enter().append("rect").attr({ width: width + "px", height: height + "px", fill: bgRGB, "fill-opacity": bgAlpha }); } var patterns = el.selectAll(patternTag).data([0]); patterns.exit().remove(); patterns.enter().append(patternTag).attr(patternAttrs); }); sel.style("fill", getFullUrl(fullID, gd2)).style("fill-opacity", null); sel.classed("pattern_filled", true); }; drawing.initGradients = function(gd2) { var fullLayout = gd2._fullLayout; var gradientsGroup = Lib.ensureSingle(fullLayout._defs, "g", "gradients"); gradientsGroup.selectAll("linearGradient,radialGradient").remove(); d3.select(gd2).selectAll(".gradient_filled").classed("gradient_filled", false); }; drawing.initPatterns = function(gd2) { var fullLayout = gd2._fullLayout; var patternsGroup = Lib.ensureSingle(fullLayout._defs, "g", "patterns"); patternsGroup.selectAll("pattern").remove(); d3.select(gd2).selectAll(".pattern_filled").classed("pattern_filled", false); }; drawing.getPatternAttr = function(mp2, i, dflt) { if (mp2 && Lib.isArrayOrTypedArray(mp2)) { return i < mp2.length ? mp2[i] : dflt; } return mp2; }; drawing.pointStyle = function(s, trace, gd2, pt2) { if (!s.size()) return; var fns = drawing.makePointStyleFns(trace); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, fns, gd2, pt2); }); }; drawing.singlePointStyle = function(d, sel, trace, fns, gd2, pt2) { var marker = trace.marker; var markerLine = marker.line; if (pt2 && pt2.i >= 0 && d.i === void 0) d.i = pt2.i; sel.style( "opacity", fns.selectedOpacityFn ? fns.selectedOpacityFn(d) : d.mo === void 0 ? marker.opacity : d.mo ); if (fns.ms2mrc) { var r; if (d.ms === "various" || marker.size === "various") { r = 3; } else { r = fns.ms2mrc(d.ms); } d.mrc = r; if (fns.selectedSizeFn) { r = d.mrc = fns.selectedSizeFn(d); } var x = drawing.symbolNumber(d.mx || marker.symbol) || 0; d.om = x % 200 >= 100; var angle = getMarkerAngle(d, trace); var standoff = getMarkerStandoff(d, trace); sel.attr("d", makePointPath(x, r, angle, standoff)); } var perPointGradient = false; var fillColor, lineColor, lineWidth; if (d.so) { lineWidth = markerLine.outlierwidth; lineColor = markerLine.outliercolor; fillColor = marker.outliercolor; } else { var markerLineWidth = (markerLine || {}).width; lineWidth = (d.mlw + 1 || markerLineWidth + 1 || // TODO: we need the latter for legends... can we get rid of it? (d.trace ? (d.trace.marker.line || {}).width : 0) + 1) - 1 || 0; if ("mlc" in d) lineColor = d.mlcc = fns.lineScale(d.mlc); else if (Lib.isArrayOrTypedArray(markerLine.color)) lineColor = Color.defaultLine; else lineColor = markerLine.color; if (Lib.isArrayOrTypedArray(marker.color)) { fillColor = Color.defaultLine; perPointGradient = true; } if ("mc" in d) { fillColor = d.mcc = fns.markerScale(d.mc); } else { fillColor = marker.color || marker.colors || "rgba(0,0,0,0)"; } if (fns.selectedColorFn) { fillColor = fns.selectedColorFn(d); } } if (d.om) { sel.call(Color.stroke, fillColor).style({ "stroke-width": (lineWidth || 1) + "px", fill: "none" }); } else { sel.style("stroke-width", (d.isBlank ? 0 : lineWidth) + "px"); var markerGradient = marker.gradient; var gradientType = d.mgt; if (gradientType) perPointGradient = true; else gradientType = markerGradient && markerGradient.type; if (Lib.isArrayOrTypedArray(gradientType)) { gradientType = gradientType[0]; if (!gradientInfo[gradientType]) gradientType = 0; } var markerPattern = marker.pattern; var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, d.i, ""); if (gradientType && gradientType !== "none") { var gradientColor = d.mgc; if (gradientColor) perPointGradient = true; else gradientColor = markerGradient.color; var gradientID = trace.uid; if (perPointGradient) gradientID += "-" + d.i; drawing.gradient( sel, gd2, gradientID, gradientType, [[0, gradientColor], [1, fillColor]], "fill" ); } else if (patternShape) { var perPointPattern = false; var fgcolor = markerPattern.fgcolor; if (!fgcolor && pt2 && pt2.color) { fgcolor = pt2.color; perPointPattern = true; } var patternFGColor = drawing.getPatternAttr(fgcolor, d.i, pt2 && pt2.color || null); var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, d.i, null); var patternFGOpacity = markerPattern.fgopacity; var patternSize = drawing.getPatternAttr(markerPattern.size, d.i, 8); var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, d.i, 0.3); perPointPattern = perPointPattern || d.mcc || Lib.isArrayOrTypedArray(markerPattern.shape) || Lib.isArrayOrTypedArray(markerPattern.bgcolor) || Lib.isArrayOrTypedArray(markerPattern.fgcolor) || Lib.isArrayOrTypedArray(markerPattern.size) || Lib.isArrayOrTypedArray(markerPattern.solidity); var patternID = trace.uid; if (perPointPattern) patternID += "-" + d.i; drawing.pattern( sel, "point", gd2, patternID, patternShape, patternSize, patternSolidity, d.mcc, markerPattern.fillmode, patternBGColor, patternFGColor, patternFGOpacity ); } else { Lib.isArrayOrTypedArray(fillColor) ? Color.fill(sel, fillColor[d.i]) : Color.fill(sel, fillColor); } if (lineWidth) { Color.stroke(sel, lineColor); } } }; drawing.makePointStyleFns = function(trace) { var out = {}; var marker = trace.marker; out.markerScale = drawing.tryColorscale(marker, ""); out.lineScale = drawing.tryColorscale(marker, "line"); if (Registry.traceIs(trace, "symbols")) { out.ms2mrc = subTypes.isBubble(trace) ? makeBubbleSizeFn(trace) : function() { return (marker.size || 6) / 2; }; } if (trace.selectedpoints) { Lib.extendFlat(out, drawing.makeSelectedPointStyleFns(trace)); } return out; }; drawing.makeSelectedPointStyleFns = function(trace) { var out = {}; var selectedAttrs = trace.selected || {}; var unselectedAttrs = trace.unselected || {}; var marker = trace.marker || {}; var selectedMarker = selectedAttrs.marker || {}; var unselectedMarker = unselectedAttrs.marker || {}; var mo2 = marker.opacity; var smo = selectedMarker.opacity; var usmo = unselectedMarker.opacity; var smoIsDefined = smo !== void 0; var usmoIsDefined = usmo !== void 0; if (Lib.isArrayOrTypedArray(mo2) || smoIsDefined || usmoIsDefined) { out.selectedOpacityFn = function(d) { var base = d.mo === void 0 ? marker.opacity : d.mo; if (d.selected) { return smoIsDefined ? smo : base; } else { return usmoIsDefined ? usmo : DESELECTDIM * base; } }; } var mc2 = marker.color; var smc = selectedMarker.color; var usmc = unselectedMarker.color; if (smc || usmc) { out.selectedColorFn = function(d) { var base = d.mcc || mc2; if (d.selected) { return smc || base; } else { return usmc || base; } }; } var ms2 = marker.size; var sms = selectedMarker.size; var usms = unselectedMarker.size; var smsIsDefined = sms !== void 0; var usmsIsDefined = usms !== void 0; if (Registry.traceIs(trace, "symbols") && (smsIsDefined || usmsIsDefined)) { out.selectedSizeFn = function(d) { var base = d.mrc || ms2 / 2; if (d.selected) { return smsIsDefined ? sms / 2 : base; } else { return usmsIsDefined ? usms / 2 : base; } }; } return out; }; drawing.makeSelectedTextStyleFns = function(trace) { var out = {}; var selectedAttrs = trace.selected || {}; var unselectedAttrs = trace.unselected || {}; var textFont = trace.textfont || {}; var selectedTextFont = selectedAttrs.textfont || {}; var unselectedTextFont = unselectedAttrs.textfont || {}; var tc2 = textFont.color; var stc = selectedTextFont.color; var utc = unselectedTextFont.color; out.selectedTextColorFn = function(d) { var base = d.tc || tc2; if (d.selected) { return stc || base; } else { if (utc) return utc; else return stc ? base : Color.addOpacity(base, DESELECTDIM); } }; return out; }; drawing.selectedPointStyle = function(s, trace) { if (!s.size() || !trace.selectedpoints) return; var fns = drawing.makeSelectedPointStyleFns(trace); var marker = trace.marker || {}; var seq = []; if (fns.selectedOpacityFn) { seq.push(function(pt2, d) { pt2.style("opacity", fns.selectedOpacityFn(d)); }); } if (fns.selectedColorFn) { seq.push(function(pt2, d) { Color.fill(pt2, fns.selectedColorFn(d)); }); } if (fns.selectedSizeFn) { seq.push(function(pt2, d) { var mx = d.mx || marker.symbol || 0; var mrc2 = fns.selectedSizeFn(d); pt2.attr("d", makePointPath(drawing.symbolNumber(mx), mrc2, getMarkerAngle(d, trace), getMarkerStandoff(d, trace))); d.mrc2 = mrc2; }); } if (seq.length) { s.each(function(d) { var pt2 = d3.select(this); for (var i = 0; i < seq.length; i++) { seq[i](pt2, d); } }); } }; drawing.tryColorscale = function(marker, prefix) { var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker; if (cont) { var colorArray = cont.color; if ((cont.colorscale || cont._colorAx) && Lib.isArrayOrTypedArray(colorArray)) { return Colorscale.makeColorScaleFuncFromTrace(cont); } } return Lib.identity; }; var TEXTOFFSETSIGN = { start: 1, end: -1, middle: 0, bottom: 1, top: -1 }; function textPointPosition(s, textPosition, fontSize, markerRadius, dontTouchParent) { var group = d3.select(s.node().parentNode); var v = textPosition.indexOf("top") !== -1 ? "top" : textPosition.indexOf("bottom") !== -1 ? "bottom" : "middle"; var h = textPosition.indexOf("left") !== -1 ? "end" : textPosition.indexOf("right") !== -1 ? "start" : "middle"; var r = markerRadius ? markerRadius / 0.8 + 1 : 0; var numLines = (svgTextUtils.lineCount(s) - 1) * LINE_SPACING + 1; var dx = TEXTOFFSETSIGN[h] * r; var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; s.attr("text-anchor", h); if (!dontTouchParent) { group.attr("transform", strTranslate(dx, dy)); } } function extracTextFontSize(d, trace) { var fontSize = d.ts || trace.textfont.size; return isNumeric(fontSize) && fontSize > 0 ? fontSize : 0; } drawing.textPointStyle = function(s, trace, gd2) { if (!s.size()) return; var selectedTextColorFn; if (trace.selectedpoints) { var fns = drawing.makeSelectedTextStyleFns(trace); selectedTextColorFn = fns.selectedTextColorFn; } var texttemplate = trace.texttemplate; var fullLayout = gd2._fullLayout; s.each(function(d) { var p = d3.select(this); var text = texttemplate ? Lib.extractOption(d, trace, "txt", "texttemplate") : Lib.extractOption(d, trace, "tx", "text"); if (!text && text !== 0) { p.remove(); return; } if (texttemplate) { var fn = trace._module.formatLabels; var labels = fn ? fn(d, trace, fullLayout) : {}; var pointValues = {}; appendArrayPointValue(pointValues, trace, d.i); var meta = trace._meta || {}; text = Lib.texttemplateString(text, labels, fullLayout._d3locale, pointValues, d, meta); } var pos = d.tp || trace.textposition; var fontSize = extracTextFontSize(d, trace); var fontColor = selectedTextColorFn ? selectedTextColorFn(d) : d.tc || trace.textfont.color; p.call(drawing.font, { family: d.tf || trace.textfont.family, weight: d.tw || trace.textfont.weight, style: d.ty || trace.textfont.style, variant: d.tv || trace.textfont.variant, textcase: d.tC || trace.textfont.textcase, lineposition: d.tE || trace.textfont.lineposition, shadow: d.tS || trace.textfont.shadow, size: fontSize, color: fontColor }).text(text).call(svgTextUtils.convertToTspans, gd2).call(textPointPosition, pos, fontSize, d.mrc); }); }; drawing.selectedTextStyle = function(s, trace) { if (!s.size() || !trace.selectedpoints) return; var fns = drawing.makeSelectedTextStyleFns(trace); s.each(function(d) { var tx = d3.select(this); var tc2 = fns.selectedTextColorFn(d); var tp2 = d.tp || trace.textposition; var fontSize = extracTextFontSize(d, trace); Color.fill(tx, tc2); var dontTouchParent = Registry.traceIs(trace, "bar-like"); textPointPosition(tx, tp2, fontSize, d.mrc2 || d.mrc, dontTouchParent); }); }; var CatmullRomExp = 0.5; drawing.smoothopen = function(pts, smoothness) { if (pts.length < 3) { return "M" + pts.join("L"); } var path = "M" + pts[0]; var tangents = []; var i; for (i = 1; i < pts.length - 1; i++) { tangents.push(makeTangent(pts[i - 1], pts[i], pts[i + 1], smoothness)); } path += "Q" + tangents[0][0] + " " + pts[1]; for (i = 2; i < pts.length - 1; i++) { path += "C" + tangents[i - 2][1] + " " + tangents[i - 1][0] + " " + pts[i]; } path += "Q" + tangents[pts.length - 3][1] + " " + pts[pts.length - 1]; return path; }; drawing.smoothclosed = function(pts, smoothness) { if (pts.length < 3) { return "M" + pts.join("L") + "Z"; } var path = "M" + pts[0]; var pLast = pts.length - 1; var tangents = [makeTangent(pts[pLast], pts[0], pts[1], smoothness)]; var i; for (i = 1; i < pLast; i++) { tangents.push(makeTangent(pts[i - 1], pts[i], pts[i + 1], smoothness)); } tangents.push( makeTangent(pts[pLast - 1], pts[pLast], pts[0], smoothness) ); for (i = 1; i <= pLast; i++) { path += "C" + tangents[i - 1][1] + " " + tangents[i][0] + " " + pts[i]; } path += "C" + tangents[pLast][1] + " " + tangents[0][0] + " " + pts[0] + "Z"; return path; }; var lastDrawnX; var lastDrawnY; function roundEnd(pt2, isY, isLastPoint) { if (isLastPoint) pt2 = applyBackoff(pt2); return isY ? roundY(pt2[1]) : roundX(pt2[0]); } function roundX(p) { var v = d3.round(p, 2); lastDrawnX = v; return v; } function roundY(p) { var v = d3.round(p, 2); lastDrawnY = v; return v; } function makeTangent(prevpt, thispt, nextpt, smoothness) { var d1x = prevpt[0] - thispt[0]; var d1y = prevpt[1] - thispt[1]; var d2x = nextpt[0] - thispt[0]; var d2y = nextpt[1] - thispt[1]; var d1a = Math.pow(d1x * d1x + d1y * d1y, CatmullRomExp / 2); var d2a = Math.pow(d2x * d2x + d2y * d2y, CatmullRomExp / 2); var numx = (d2a * d2a * d1x - d1a * d1a * d2x) * smoothness; var numy = (d2a * d2a * d1y - d1a * d1a * d2y) * smoothness; var denom1 = 3 * d2a * (d1a + d2a); var denom2 = 3 * d1a * (d1a + d2a); return [ [ roundX(thispt[0] + (denom1 && numx / denom1)), roundY(thispt[1] + (denom1 && numy / denom1)) ], [ roundX(thispt[0] - (denom2 && numx / denom2)), roundY(thispt[1] - (denom2 && numy / denom2)) ] ]; } var STEPPATH = { hv: function(p02, p12, isLastPoint) { return "H" + roundX(p12[0]) + "V" + roundEnd(p12, 1, isLastPoint); }, vh: function(p02, p12, isLastPoint) { return "V" + roundY(p12[1]) + "H" + roundEnd(p12, 0, isLastPoint); }, hvh: function(p02, p12, isLastPoint) { return "H" + roundX((p02[0] + p12[0]) / 2) + "V" + roundY(p12[1]) + "H" + roundEnd(p12, 0, isLastPoint); }, vhv: function(p02, p12, isLastPoint) { return "V" + roundY((p02[1] + p12[1]) / 2) + "H" + roundX(p12[0]) + "V" + roundEnd(p12, 1, isLastPoint); } }; var STEPLINEAR = function(p02, p12, isLastPoint) { return "L" + roundEnd(p12, 0, isLastPoint) + "," + roundEnd(p12, 1, isLastPoint); }; drawing.steps = function(shape) { var onestep = STEPPATH[shape] || STEPLINEAR; return function(pts) { var path = "M" + roundX(pts[0][0]) + "," + roundY(pts[0][1]); var len = pts.length; for (var i = 1; i < len; i++) { path += onestep(pts[i - 1], pts[i], i === len - 1); } return path; }; }; function applyBackoff(pt2, start) { var backoff = pt2.backoff; var trace = pt2.trace; var d = pt2.d; var i = pt2.i; if (backoff && trace && trace.marker && trace.marker.angle % 360 === 0 && trace.line && trace.line.shape !== "spline") { var arrayBackoff = Lib.isArrayOrTypedArray(backoff); var end = pt2; var x12 = start ? start[0] : lastDrawnX || 0; var y12 = start ? start[1] : lastDrawnY || 0; var x2 = end[0]; var y2 = end[1]; var dx = x2 - x12; var dy = y2 - y12; var t = Math.atan2(dy, dx); var b = arrayBackoff ? backoff[i] : backoff; if (b === "auto") { var endI = end.i; if (trace.type === "scatter") endI--; var endMarker = end.marker; var endMarkerSymbol = endMarker.symbol; if (Lib.isArrayOrTypedArray(endMarkerSymbol)) endMarkerSymbol = endMarkerSymbol[endI]; var endMarkerSize = endMarker.size; if (Lib.isArrayOrTypedArray(endMarkerSize)) endMarkerSize = endMarkerSize[endI]; b = endMarker ? drawing.symbolBackOffs[drawing.symbolNumber(endMarkerSymbol)] * endMarkerSize : 0; b += drawing.getMarkerStandoff(d[endI], trace) || 0; } var x = x2 - b * Math.cos(t); var y = y2 - b * Math.sin(t); if ((x <= x2 && x >= x12 || x >= x2 && x <= x12) && (y <= y2 && y >= y12 || y >= y2 && y <= y12)) { pt2 = [x, y]; } } return pt2; } drawing.applyBackoff = applyBackoff; drawing.makeTester = function() { var tester = Lib.ensureSingleById(d3.select("body"), "svg", "js-plotly-tester", function(s) { s.attr(xmlnsNamespaces.svgAttrs).style({ position: "absolute", left: "-10000px", top: "-10000px", width: "9000px", height: "9000px", "z-index": "1" }); }); var testref = Lib.ensureSingle(tester, "path", "js-reference-point", function(s) { s.attr("d", "M0,0H1V1H0Z").style({ "stroke-width": 0, fill: "black" }); }); drawing.tester = tester; drawing.testref = testref; }; drawing.savedBBoxes = {}; var savedBBoxesCount = 0; var maxSavedBBoxes = 1e4; drawing.bBox = function(node, inTester, hash) { if (!hash) hash = nodeHash(node); var out; if (hash) { out = drawing.savedBBoxes[hash]; if (out) return Lib.extendFlat({}, out); } else if (node.childNodes.length === 1) { var innerNode = node.childNodes[0]; hash = nodeHash(innerNode); if (hash) { var x = +innerNode.getAttribute("x") || 0; var y = +innerNode.getAttribute("y") || 0; var transform = innerNode.getAttribute("transform"); if (!transform) { var innerBB = drawing.bBox(innerNode, false, hash); if (x) { innerBB.left += x; innerBB.right += x; } if (y) { innerBB.top += y; innerBB.bottom += y; } return innerBB; } hash += "~" + x + "~" + y + "~" + transform; out = drawing.savedBBoxes[hash]; if (out) return Lib.extendFlat({}, out); } } var testNode, tester; if (inTester) { testNode = node; } else { tester = drawing.tester.node(); testNode = node.cloneNode(true); tester.appendChild(testNode); } d3.select(testNode).attr("transform", null).call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref.node().getBoundingClientRect(); if (!inTester) tester.removeChild(testNode); var bb = { height: testRect.height, width: testRect.width, left: testRect.left - refRect.left, top: testRect.top - refRect.top, right: testRect.right - refRect.left, bottom: testRect.bottom - refRect.top }; if (savedBBoxesCount >= maxSavedBBoxes) { drawing.savedBBoxes = {}; savedBBoxesCount = 0; } if (hash) drawing.savedBBoxes[hash] = bb; savedBBoxesCount++; return Lib.extendFlat({}, bb); }; function nodeHash(node) { var inputText = node.getAttribute("data-unformatted"); if (inputText === null) return; return inputText + node.getAttribute("data-math") + node.getAttribute("text-anchor") + node.getAttribute("style"); } drawing.setClipUrl = function(s, localId, gd2) { s.attr("clip-path", getFullUrl(localId, gd2)); }; function getFullUrl(localId, gd2) { if (!localId) return null; var context = gd2._context; var baseUrl = context._exportedPlot ? "" : context._baseUrl || ""; return baseUrl ? "url('" + baseUrl + "#" + localId + "')" : "url(#" + localId + ")"; } drawing.getTranslate = function(element) { var re2 = /.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/; var getter = element.attr ? "attr" : "getAttribute"; var transform = element[getter]("transform") || ""; var translate = transform.replace(re2, function(match, p12, p2) { return [p12, p2].join(" "); }).split(" "); return { x: +translate[0] || 0, y: +translate[1] || 0 }; }; drawing.setTranslate = function(element, x, y) { var re2 = /(\btranslate\(.*?\);?)/; var getter = element.attr ? "attr" : "getAttribute"; var setter = element.attr ? "attr" : "setAttribute"; var transform = element[getter]("transform") || ""; x = x || 0; y = y || 0; transform = transform.replace(re2, "").trim(); transform += strTranslate(x, y); transform = transform.trim(); element[setter]("transform", transform); return transform; }; drawing.getScale = function(element) { var re2 = /.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/; var getter = element.attr ? "attr" : "getAttribute"; var transform = element[getter]("transform") || ""; var translate = transform.replace(re2, function(match, p12, p2) { return [p12, p2].join(" "); }).split(" "); return { x: +translate[0] || 1, y: +translate[1] || 1 }; }; drawing.setScale = function(element, x, y) { var re2 = /(\bscale\(.*?\);?)/; var getter = element.attr ? "attr" : "getAttribute"; var setter = element.attr ? "attr" : "setAttribute"; var transform = element[getter]("transform") || ""; x = x || 1; y = y || 1; transform = transform.replace(re2, "").trim(); transform += "scale(" + x + "," + y + ")"; transform = transform.trim(); element[setter]("transform", transform); return transform; }; var SCALE_RE = /\s*sc.*/; drawing.setPointGroupScale = function(selection, xScale, yScale) { xScale = xScale || 1; yScale = yScale || 1; if (!selection) return; var scale = xScale === 1 && yScale === 1 ? "" : "scale(" + xScale + "," + yScale + ")"; selection.each(function() { var t = (this.getAttribute("transform") || "").replace(SCALE_RE, ""); t += scale; t = t.trim(); this.setAttribute("transform", t); }); }; var TEXT_POINT_LAST_TRANSLATION_RE = /translate\([^)]*\)\s*$/; drawing.setTextPointsScale = function(selection, xScale, yScale) { if (!selection) return; selection.each(function() { var transforms; var el = d3.select(this); var text = el.select("text"); if (!text.node()) return; var x = parseFloat(text.attr("x") || 0); var y = parseFloat(text.attr("y") || 0); var existingTransform = (el.attr("transform") || "").match(TEXT_POINT_LAST_TRANSLATION_RE); if (xScale === 1 && yScale === 1) { transforms = []; } else { transforms = [ strTranslate(x, y), "scale(" + xScale + "," + yScale + ")", strTranslate(-x, -y) ]; } if (existingTransform) { transforms.push(existingTransform); } el.attr("transform", transforms.join("")); }); }; function getMarkerStandoff(d, trace) { var standoff; if (d) standoff = d.mf; if (standoff === void 0) { standoff = trace.marker ? trace.marker.standoff || 0 : 0; } if (!trace._geo && !trace._xA) { return -standoff; } return standoff; } drawing.getMarkerStandoff = getMarkerStandoff; var atan2 = Math.atan2; var cos = Math.cos; var sin = Math.sin; function rotate(t, xy) { var x = xy[0]; var y = xy[1]; return [ x * cos(t) - y * sin(t), x * sin(t) + y * cos(t) ]; } var previousLon; var previousLat; var previousX; var previousY; var previousI; var previousTraceUid; function getMarkerAngle(d, trace) { var angle = d.ma; if (angle === void 0) { angle = trace.marker.angle; if (!angle || Lib.isArrayOrTypedArray(angle)) { angle = 0; } } var x, y; var ref2 = trace.marker.angleref; if (ref2 === "previous" || ref2 === "north") { if (trace._geo) { var p = trace._geo.project(d.lonlat); x = p[0]; y = p[1]; } else { var xa2 = trace._xA; var ya2 = trace._yA; if (xa2 && ya2) { x = xa2.c2p(d.x); y = ya2.c2p(d.y); } else { return 90; } } if (trace._geo) { var lon = d.lonlat[0]; var lat = d.lonlat[1]; var north = trace._geo.project([ lon, lat + 1e-5 // epsilon ]); var east = trace._geo.project([ lon + 1e-5, // epsilon lat ]); var u = atan2( east[1] - y, east[0] - x ); var v = atan2( north[1] - y, north[0] - x ); var t; if (ref2 === "north") { t = angle / 180 * Math.PI; } else if (ref2 === "previous") { var lon1 = lon / 180 * Math.PI; var lat1 = lat / 180 * Math.PI; var lon2 = previousLon / 180 * Math.PI; var lat2 = previousLat / 180 * Math.PI; var dLon = lon2 - lon1; var deltaY = cos(lat2) * sin(dLon); var deltaX = sin(lat2) * cos(lat1) - cos(lat2) * sin(lat1) * cos(dLon); t = -atan2( deltaY, deltaX ) - Math.PI; previousLon = lon; previousLat = lat; } var A = rotate(u, [cos(t), 0]); var B = rotate(v, [sin(t), 0]); angle = atan2( A[1] + B[1], A[0] + B[0] ) / Math.PI * 180; if (ref2 === "previous" && !(previousTraceUid === trace.uid && d.i === previousI + 1)) { angle = null; } } if (ref2 === "previous" && !trace._geo) { if (previousTraceUid === trace.uid && d.i === previousI + 1 && isNumeric(x) && isNumeric(y)) { var dX = x - previousX; var dY = y - previousY; var shape = trace.line ? trace.line.shape || "" : ""; var lastShapeChar = shape.slice(shape.length - 1); if (lastShapeChar === "h") dY = 0; if (lastShapeChar === "v") dX = 0; angle += atan2(dY, dX) / Math.PI * 180 + 90; } else { angle = null; } } } previousX = x; previousY = y; previousI = d.i; previousTraceUid = trace.uid; return angle; } drawing.getMarkerAngle = getMarkerAngle; } }); // node_modules/plotly.js/src/components/titles/index.js var require_titles = __commonJS({ "node_modules/plotly.js/src/components/titles/index.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Plots = require_plots(); var Registry = require_registry(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var Drawing = require_drawing(); var Color = require_color(); var svgTextUtils = require_svg_text_utils(); var interactConstants = require_interactions(); var OPPOSITE_SIDE = require_alignment().OPPOSITE_SIDE; var numStripRE = / [XY][0-9]* /; var SUBTITLE_PADDING_MATHJAX_EM = 1.6; var SUBTITLE_PADDING_EM = 1.6; function draw(gd2, titleClass, options) { var fullLayout = gd2._fullLayout; var cont = options.propContainer; var prop = options.propName; var placeholder = options.placeholder; var traceIndex = options.traceIndex; var avoid = options.avoid || {}; var attributes = options.attributes; var transform = options.transform; var group = options.containerGroup; var opacity = 1; var title = cont.title; var txt = (title && title.text ? title.text : "").trim(); var titleIsPlaceholder = false; var font = title && title.font ? title.font : {}; var fontFamily = font.family; var fontSize = font.size; var fontColor = font.color; var fontWeight = font.weight; var fontStyle = font.style; var fontVariant = font.variant; var fontTextcase = font.textcase; var fontLineposition = font.lineposition; var fontShadow = font.shadow; var subtitleProp = options.subtitlePropName; var subtitleEnabled = !!subtitleProp; var subtitlePlaceholder = options.subtitlePlaceholder; var subtitle = (cont.title || {}).subtitle || { text: "", font: {} }; var subtitleTxt = subtitle.text.trim(); var subtitleIsPlaceholder = false; var subtitleOpacity = 1; var subtitleFont = subtitle.font; var subFontFamily = subtitleFont.family; var subFontSize = subtitleFont.size; var subFontColor = subtitleFont.color; var subFontWeight = subtitleFont.weight; var subFontStyle = subtitleFont.style; var subFontVariant = subtitleFont.variant; var subFontTextcase = subtitleFont.textcase; var subFontLineposition = subtitleFont.lineposition; var subFontShadow = subtitleFont.shadow; var editAttr; if (prop === "title.text") editAttr = "titleText"; else if (prop.indexOf("axis") !== -1) editAttr = "axisTitleText"; else if (prop.indexOf("colorbar" !== -1)) editAttr = "colorbarTitleText"; var editable = gd2._context.edits[editAttr]; function matchesPlaceholder(text, placeholder2) { if (text === void 0 || placeholder2 === void 0) return false; return text.replace(numStripRE, " % ") === placeholder2.replace(numStripRE, " % "); } if (txt === "") opacity = 0; else if (matchesPlaceholder(txt, placeholder)) { if (!editable) txt = ""; opacity = 0.2; titleIsPlaceholder = true; } if (subtitleEnabled) { if (subtitleTxt === "") subtitleOpacity = 0; else if (matchesPlaceholder(subtitleTxt, subtitlePlaceholder)) { if (!editable) subtitleTxt = ""; subtitleOpacity = 0.2; subtitleIsPlaceholder = true; } } if (options._meta) { txt = Lib.templateString(txt, options._meta); } else if (fullLayout._meta) { txt = Lib.templateString(txt, fullLayout._meta); } var elShouldExist = txt || subtitleTxt || editable; var hColorbarMoveTitle; if (!group) { group = Lib.ensureSingle(fullLayout._infolayer, "g", "g-" + titleClass); hColorbarMoveTitle = fullLayout._hColorbarMoveTitle; } var el = group.selectAll("text." + titleClass).data(elShouldExist ? [0] : []); el.enter().append("text"); el.text(txt).attr("class", titleClass); el.exit().remove(); var subtitleEl = null; var subtitleClass = titleClass + "-subtitle"; var subtitleElShouldExist = subtitleTxt || editable; if (subtitleEnabled && subtitleElShouldExist) { subtitleEl = group.selectAll("text." + subtitleClass).data(subtitleElShouldExist ? [0] : []); subtitleEl.enter().append("text"); subtitleEl.text(subtitleTxt).attr("class", subtitleClass); subtitleEl.exit().remove(); } if (!elShouldExist) return group; function titleLayout(titleEl, subtitleEl2) { Lib.syncOrAsync([drawTitle, scootTitle], { title: titleEl, subtitle: subtitleEl2 }); } function drawTitle(titleAndSubtitleEls) { var titleEl = titleAndSubtitleEls.title; var subtitleEl2 = titleAndSubtitleEls.subtitle; var transformVal; if (!transform && hColorbarMoveTitle) { transform = {}; } if (transform) { transformVal = ""; if (transform.rotate) { transformVal += "rotate(" + [transform.rotate, attributes.x, attributes.y] + ")"; } if (transform.offset || hColorbarMoveTitle) { transformVal += strTranslate(0, (transform.offset || 0) - (hColorbarMoveTitle || 0)); } } else { transformVal = null; } titleEl.attr("transform", transformVal); function adjustSubtitlePosition(titleElMathGroup2) { if (!titleElMathGroup2) return; var subtitleElement = d3.select(titleElMathGroup2.node().parentNode).select("." + subtitleClass); if (!subtitleElement.empty()) { var titleElMathBbox2 = titleElMathGroup2.node().getBBox(); if (titleElMathBbox2.height) { var subtitleY3 = titleElMathBbox2.y + titleElMathBbox2.height + SUBTITLE_PADDING_MATHJAX_EM * subFontSize; subtitleElement.attr("y", subtitleY3); } } } titleEl.style("opacity", opacity * Color.opacity(fontColor)).call(Drawing.font, { color: Color.rgb(fontColor), size: d3.round(fontSize, 2), family: fontFamily, weight: fontWeight, style: fontStyle, variant: fontVariant, textcase: fontTextcase, shadow: fontShadow, lineposition: fontLineposition }).attr(attributes).call(svgTextUtils.convertToTspans, gd2, adjustSubtitlePosition); if (subtitleEl2) { var titleElMathGroup = group.select("." + titleClass + "-math-group"); var titleElBbox2 = titleEl.node().getBBox(); var titleElMathBbox = titleElMathGroup.node() ? titleElMathGroup.node().getBBox() : void 0; var subtitleY2 = titleElMathBbox ? titleElMathBbox.y + titleElMathBbox.height + SUBTITLE_PADDING_MATHJAX_EM * subFontSize : titleElBbox2.y + titleElBbox2.height + SUBTITLE_PADDING_EM * subFontSize; var subtitleAttributes = Lib.extendFlat({}, attributes, { y: subtitleY2 }); subtitleEl2.attr("transform", transformVal); subtitleEl2.style("opacity", subtitleOpacity * Color.opacity(subFontColor)).call(Drawing.font, { color: Color.rgb(subFontColor), size: d3.round(subFontSize, 2), family: subFontFamily, weight: subFontWeight, style: subFontStyle, variant: subFontVariant, textcase: subFontTextcase, shadow: subFontShadow, lineposition: subFontLineposition }).attr(subtitleAttributes).call(svgTextUtils.convertToTspans, gd2); } return Plots.previousPromises(gd2); } function scootTitle(titleAndSubtitleEls) { var titleElIn = titleAndSubtitleEls.title; var titleGroup = d3.select(titleElIn.node().parentNode); if (avoid && avoid.selection && avoid.side && txt) { titleGroup.attr("transform", null); var backside = OPPOSITE_SIDE[avoid.side]; var shiftSign = avoid.side === "left" || avoid.side === "top" ? -1 : 1; var pad2 = isNumeric(avoid.pad) ? avoid.pad : 2; var titlebb = Drawing.bBox(titleGroup.node()); var reservedMargins = { t: 0, b: 0, l: 0, r: 0 }; var margins = gd2._fullLayout._reservedMargin; for (var key in margins) { for (var side in margins[key]) { var val = margins[key][side]; reservedMargins[side] = Math.max(reservedMargins[side], val); } } var paperbb = { left: reservedMargins.l, top: reservedMargins.t, right: fullLayout.width - reservedMargins.r, bottom: fullLayout.height - reservedMargins.b }; var maxshift = avoid.maxShift || shiftSign * (paperbb[avoid.side] - titlebb[avoid.side]); var shift = 0; if (maxshift < 0) { shift = maxshift; } else { var offsetLeft = avoid.offsetLeft || 0; var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; titlebb.bottom -= offsetTop; avoid.selection.each(function() { var avoidbb = Drawing.bBox(this); if (Lib.bBoxIntersect(titlebb, avoidbb, pad2)) { shift = Math.max(shift, shiftSign * (avoidbb[avoid.side] - titlebb[backside]) + pad2); } }); shift = Math.min(maxshift, shift); cont._titleScoot = Math.abs(shift); } if (shift > 0 || maxshift < 0) { var shiftTemplate = { left: [-shift, 0], right: [shift, 0], top: [0, -shift], bottom: [0, shift] }[avoid.side]; titleGroup.attr("transform", strTranslate(shiftTemplate[0], shiftTemplate[1])); } } } el.call(titleLayout, subtitleEl); function setPlaceholder(element, placeholderText) { element.text(placeholderText).on("mouseover.opacity", function() { d3.select(this).transition().duration(interactConstants.SHOW_PLACEHOLDER).style("opacity", 1); }).on("mouseout.opacity", function() { d3.select(this).transition().duration(interactConstants.HIDE_PLACEHOLDER).style("opacity", 0); }); } if (editable) { if (!txt) { setPlaceholder(el, placeholder); titleIsPlaceholder = true; } else el.on(".opacity", null); el.call(svgTextUtils.makeEditable, { gd: gd2 }).on("edit", function(text) { if (traceIndex !== void 0) { Registry.call("_guiRestyle", gd2, prop, text, traceIndex); } else { Registry.call("_guiRelayout", gd2, prop, text); } }).on("cancel", function() { this.text(this.attr("data-unformatted")).call(titleLayout); }).on("input", function(d) { this.text(d || " ").call(svgTextUtils.positionText, attributes.x, attributes.y); }); if (subtitleEnabled) { if (subtitleEnabled && !txt) { var titleElBbox = el.node().getBBox(); var subtitleY = titleElBbox.y + titleElBbox.height + SUBTITLE_PADDING_EM * subFontSize; subtitleEl.attr("y", subtitleY); } if (!subtitleTxt) { setPlaceholder(subtitleEl, subtitlePlaceholder); subtitleIsPlaceholder = true; } else subtitleEl.on(".opacity", null); subtitleEl.call(svgTextUtils.makeEditable, { gd: gd2 }).on("edit", function(text) { Registry.call("_guiRelayout", gd2, "title.subtitle.text", text); }).on("cancel", function() { this.text(this.attr("data-unformatted")).call(titleLayout); }).on("input", function(d) { this.text(d || " ").call(svgTextUtils.positionText, subtitleEl.attr("x"), subtitleEl.attr("y")); }); } } el.classed("js-placeholder", titleIsPlaceholder); if (subtitleEl) subtitleEl.classed("js-placeholder", subtitleIsPlaceholder); return group; } module2.exports = { draw, SUBTITLE_PADDING_EM, SUBTITLE_PADDING_MATHJAX_EM }; } }); // node_modules/plotly.js/src/plots/cartesian/set_convert.js var require_set_convert = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/set_convert.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var utcFormat2 = (init_src2(), __toCommonJS(src_exports2)).utcFormat; var Lib = require_lib(); var numberFormat = Lib.numberFormat; var isNumeric = require_fast_isnumeric(); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; var ensureNumber = Lib.ensureNumber; var isArrayOrTypedArray = Lib.isArrayOrTypedArray; var numConstants = require_numerical(); var FP_SAFE = numConstants.FP_SAFE; var BADNUM = numConstants.BADNUM; var LOG_CLIP = numConstants.LOG_CLIP; var ONEWEEK = numConstants.ONEWEEK; var ONEDAY = numConstants.ONEDAY; var ONEHOUR = numConstants.ONEHOUR; var ONEMIN = numConstants.ONEMIN; var ONESEC = numConstants.ONESEC; var axisIds = require_axis_ids(); var constants = require_constants2(); var HOUR_PATTERN = constants.HOUR_PATTERN; var WEEKDAY_PATTERN = constants.WEEKDAY_PATTERN; function fromLog(v) { return Math.pow(10, v); } function isValidCategory(v) { return v !== null && v !== void 0; } module2.exports = function setConvert(ax, fullLayout) { fullLayout = fullLayout || {}; var axId = ax._id || "x"; var axLetter = axId.charAt(0); function toLog(v, clip) { if (v > 0) return Math.log(v) / Math.LN10; else if (v <= 0 && clip && ax.range && ax.range.length === 2) { var r02 = ax.range[0]; var r12 = ax.range[1]; return 0.5 * (r02 + r12 - 2 * LOG_CLIP * Math.abs(r02 - r12)); } else return BADNUM; } function dt2ms(v, _, calendar, opts) { if ((opts || {}).msUTC && isNumeric(v)) { return +v; } var ms2 = dateTime2ms(v, calendar || ax.calendar); if (ms2 === BADNUM) { if (isNumeric(v)) { v = +v; var msecTenths = Math.floor(Lib.mod(v + 0.05, 1) * 10); var msRounded = Math.round(v - msecTenths / 10); ms2 = dateTime2ms(new Date(msRounded)) + msecTenths / 10; } else return BADNUM; } return ms2; } function ms2dt(v, r, calendar) { return ms2DateTime(v, r, calendar || ax.calendar); } function getCategoryName(v) { return ax._categories[Math.round(v)]; } function setCategoryIndex(v) { if (isValidCategory(v)) { if (ax._categoriesMap === void 0) { ax._categoriesMap = {}; } if (ax._categoriesMap[v] !== void 0) { return ax._categoriesMap[v]; } else { ax._categories.push(typeof v === "number" ? String(v) : v); var curLength = ax._categories.length - 1; ax._categoriesMap[v] = curLength; return curLength; } } return BADNUM; } function setMultiCategoryIndex(arrayIn, len) { var arrayOut = new Array(len); for (var i = 0; i < len; i++) { var v02 = (arrayIn[0] || [])[i]; var v12 = (arrayIn[1] || [])[i]; arrayOut[i] = getCategoryIndex([v02, v12]); } return arrayOut; } function getCategoryIndex(v) { if (ax._categoriesMap) { return ax._categoriesMap[v]; } } function getCategoryPosition(v) { var index = getCategoryIndex(v); if (index !== void 0) return index; if (isNumeric(v)) return +v; } function getRangePosition(v) { return isNumeric(v) ? +v : getCategoryIndex(v); } function _l2p(v, m, b) { return d3.round(b + m * v, 2); } function _p2l(px, m, b) { return (px - b) / m; } var l2p = function l2p2(v) { if (!isNumeric(v)) return BADNUM; return _l2p(v, ax._m, ax._b); }; var p2l = function(px) { return _p2l(px, ax._m, ax._b); }; if (ax.rangebreaks) { var isY = axLetter === "y"; l2p = function(v) { if (!isNumeric(v)) return BADNUM; var len = ax._rangebreaks.length; if (!len) return _l2p(v, ax._m, ax._b); var flip = isY; if (ax.range[0] > ax.range[1]) flip = !flip; var signAx = flip ? -1 : 1; var pos = signAx * v; var q = 0; for (var i = 0; i < len; i++) { var min = signAx * ax._rangebreaks[i].min; var max = signAx * ax._rangebreaks[i].max; if (pos < min) break; if (pos > max) q = i + 1; else { q = pos < (min + max) / 2 ? i : i + 1; break; } } var b2 = ax._B[q] || 0; if (!isFinite(b2)) return 0; return _l2p(v, ax._m2, b2); }; p2l = function(px) { var len = ax._rangebreaks.length; if (!len) return _p2l(px, ax._m, ax._b); var q = 0; for (var i = 0; i < len; i++) { if (px < ax._rangebreaks[i].pmin) break; if (px > ax._rangebreaks[i].pmax) q = i + 1; } return _p2l(px, ax._m2, ax._B[q]); }; } ax.c2l = ax.type === "log" ? toLog : ensureNumber; ax.l2c = ax.type === "log" ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; ax.c2p = ax.type === "log" ? function(v, clip) { return l2p(toLog(v, clip)); } : l2p; ax.p2c = ax.type === "log" ? function(px) { return fromLog(p2l(px)); } : p2l; if (["linear", "-"].indexOf(ax.type) !== -1) { ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; ax.cleanPos = ensureNumber; } else if (ax.type === "log") { ax.d2r = ax.d2l = function(v, clip) { return toLog(cleanNumber(v), clip); }; ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; ax.cleanPos = ensureNumber; } else if (ax.type === "date") { ax.d2r = ax.r2d = Lib.identity; ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if (ax.type === "category") { ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { var index = getRangePosition(v); return index !== void 0 ? index : ax.fraction2r(0.5); }; ax.l2r = ax.c2r = ensureNumber; ax.r2l = getRangePosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; ax.r2p = ax.d2p; ax.p2r = p2l; ax.cleanPos = function(v) { if (typeof v === "string" && v !== "") return v; return ensureNumber(v); }; } else if (ax.type === "multicategory") { ax.r2d = ax.c2d = ax.l2d = getCategoryName; ax.d2r = ax.d2l_noadd = getCategoryPosition; ax.r2c = function(v) { var index = getCategoryPosition(v); return index !== void 0 ? index : ax.fraction2r(0.5); }; ax.r2c_just_indices = getCategoryIndex; ax.l2r = ax.c2r = ensureNumber; ax.r2l = getCategoryPosition; ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; ax.r2p = ax.d2p; ax.p2r = p2l; ax.cleanPos = function(v) { if (Array.isArray(v) || typeof v === "string" && v !== "") return v; return ensureNumber(v); }; ax.setupMultiCategory = function(fullData) { var traceIndices = ax._traceIndices; var i, j; var group = ax._matchGroup; if (group && ax._categories.length === 0) { for (var axId2 in group) { if (axId2 !== axId) { var ax2 = fullLayout[axisIds.id2name(axId2)]; traceIndices = traceIndices.concat(ax2._traceIndices); } } } var seen = [[0, {}], [0, {}]]; var list = []; for (i = 0; i < traceIndices.length; i++) { var trace = fullData[traceIndices[i]]; if (axLetter in trace) { var arrayIn = trace[axLetter]; var len = trace._length || Lib.minRowLength(arrayIn); if (isArrayOrTypedArray(arrayIn[0]) && isArrayOrTypedArray(arrayIn[1])) { for (j = 0; j < len; j++) { var v02 = arrayIn[0][j]; var v12 = arrayIn[1][j]; if (isValidCategory(v02) && isValidCategory(v12)) { list.push([v02, v12]); if (!(v02 in seen[0][1])) { seen[0][1][v02] = seen[0][0]++; } if (!(v12 in seen[1][1])) { seen[1][1][v12] = seen[1][0]++; } } } } } } list.sort(function(a, b) { var ind0 = seen[0][1]; var d = ind0[a[0]] - ind0[b[0]]; if (d) return d; var ind1 = seen[1][1]; return ind1[a[1]] - ind1[b[1]]; }); for (i = 0; i < list.length; i++) { setCategoryIndex(list[i]); } }; } ax.fraction2r = function(v) { var rl0 = ax.r2l(ax.range[0]); var rl1 = ax.r2l(ax.range[1]); return ax.l2r(rl0 + v * (rl1 - rl0)); }; ax.r2fraction = function(v) { var rl0 = ax.r2l(ax.range[0]); var rl1 = ax.r2l(ax.range[1]); return (ax.r2l(v) - rl0) / (rl1 - rl0); }; ax.limitRange = function(rangeAttr) { var minallowed = ax.minallowed; var maxallowed = ax.maxallowed; if (minallowed === void 0 && maxallowed === void 0) return; if (!rangeAttr) rangeAttr = "range"; var range = Lib.nestedProperty(ax, rangeAttr).get(); var rng = Lib.simpleMap(range, ax.r2l); var axrev = rng[1] < rng[0]; if (axrev) rng.reverse(); var bounds = Lib.simpleMap([minallowed, maxallowed], ax.r2l); if (minallowed !== void 0 && rng[0] < bounds[0]) range[axrev ? 1 : 0] = minallowed; if (maxallowed !== void 0 && rng[1] > bounds[1]) range[axrev ? 0 : 1] = maxallowed; if (range[0] === range[1]) { var minL = ax.l2r(minallowed); var maxL = ax.l2r(maxallowed); if (minallowed !== void 0) { var _max = minL + 1; if (maxallowed !== void 0) _max = Math.min(_max, maxL); range[axrev ? 1 : 0] = _max; } if (maxallowed !== void 0) { var _min = maxL + 1; if (minallowed !== void 0) _min = Math.max(_min, minL); range[axrev ? 0 : 1] = _min; } } }; ax.cleanRange = function(rangeAttr, opts) { ax._cleanRange(rangeAttr, opts); ax.limitRange(rangeAttr); }; ax._cleanRange = function(rangeAttr, opts) { if (!opts) opts = {}; if (!rangeAttr) rangeAttr = "range"; var range = Lib.nestedProperty(ax, rangeAttr).get(); var i, dflt; if (ax.type === "date") dflt = Lib.dfltRange(ax.calendar); else if (axLetter === "y") dflt = constants.DFLTRANGEY; else if (ax._name === "realaxis") dflt = [0, 1]; else dflt = opts.dfltRange || constants.DFLTRANGEX; dflt = dflt.slice(); if (ax.rangemode === "tozero" || ax.rangemode === "nonnegative") { dflt[0] = 0; } if (!range || range.length !== 2) { Lib.nestedProperty(ax, rangeAttr).set(dflt); return; } var nullRange0 = range[0] === null; var nullRange1 = range[1] === null; if (ax.type === "date" && !ax.autorange) { range[0] = Lib.cleanDate(range[0], BADNUM, ax.calendar); range[1] = Lib.cleanDate(range[1], BADNUM, ax.calendar); } for (i = 0; i < 2; i++) { if (ax.type === "date") { if (!Lib.isDateTime(range[i], ax.calendar)) { ax[rangeAttr] = dflt; break; } if (ax.r2l(range[0]) === ax.r2l(range[1])) { var linCenter = Lib.constrain( ax.r2l(range[0]), Lib.MIN_MS + 1e3, Lib.MAX_MS - 1e3 ); range[0] = ax.l2r(linCenter - 1e3); range[1] = ax.l2r(linCenter + 1e3); break; } } else { if (!isNumeric(range[i])) { if (!(nullRange0 || nullRange1) && isNumeric(range[1 - i])) { range[i] = range[1 - i] * (i ? 10 : 0.1); } else { ax[rangeAttr] = dflt; break; } } if (range[i] < -FP_SAFE) range[i] = -FP_SAFE; else if (range[i] > FP_SAFE) range[i] = FP_SAFE; if (range[0] === range[1]) { var inc = Math.max(1, Math.abs(range[0] * 1e-6)); range[0] -= inc; range[1] += inc; } } } }; ax.setScale = function(usePrivateRange) { var gs2 = fullLayout._size; if (ax.overlaying) { var ax2 = axisIds.getFromId({ _fullLayout: fullLayout }, ax.overlaying); ax.domain = ax2.domain; } var rangeAttr = usePrivateRange && ax._r ? "_r" : "range"; var calendar = ax.calendar; ax.cleanRange(rangeAttr); var rl0 = ax.r2l(ax[rangeAttr][0], calendar); var rl1 = ax.r2l(ax[rangeAttr][1], calendar); var isY2 = axLetter === "y"; if (isY2) { ax._offset = gs2.t + (1 - ax.domain[1]) * gs2.h; ax._length = gs2.h * (ax.domain[1] - ax.domain[0]); ax._m = ax._length / (rl0 - rl1); ax._b = -ax._m * rl1; } else { ax._offset = gs2.l + ax.domain[0] * gs2.w; ax._length = gs2.w * (ax.domain[1] - ax.domain[0]); ax._m = ax._length / (rl1 - rl0); ax._b = -ax._m * rl0; } ax._rangebreaks = []; ax._lBreaks = 0; ax._m2 = 0; ax._B = []; if (ax.rangebreaks) { var i, brk; ax._rangebreaks = ax.locateBreaks( Math.min(rl0, rl1), Math.max(rl0, rl1) ); if (ax._rangebreaks.length) { for (i = 0; i < ax._rangebreaks.length; i++) { brk = ax._rangebreaks[i]; ax._lBreaks += Math.abs(brk.max - brk.min); } var flip = isY2; if (rl0 > rl1) flip = !flip; if (flip) ax._rangebreaks.reverse(); var sign = flip ? -1 : 1; ax._m2 = sign * ax._length / (Math.abs(rl1 - rl0) - ax._lBreaks); ax._B.push(-ax._m2 * (isY2 ? rl1 : rl0)); for (i = 0; i < ax._rangebreaks.length; i++) { brk = ax._rangebreaks[i]; ax._B.push( ax._B[ax._B.length - 1] - sign * ax._m2 * (brk.max - brk.min) ); } for (i = 0; i < ax._rangebreaks.length; i++) { brk = ax._rangebreaks[i]; brk.pmin = l2p(brk.min); brk.pmax = l2p(brk.max); } } } if (!isFinite(ax._m) || !isFinite(ax._b) || ax._length < 0) { fullLayout._replotting = false; throw new Error("Something went wrong with axis scaling"); } }; ax.maskBreaks = function(v) { var rangebreaksIn = ax.rangebreaks || []; var bnds, b02, b12, vb, vDate; if (!rangebreaksIn._cachedPatterns) { rangebreaksIn._cachedPatterns = rangebreaksIn.map(function(brk2) { return brk2.enabled && brk2.bounds ? Lib.simpleMap( brk2.bounds, brk2.pattern ? cleanNumber : ax.d2c // case of pattern: '' ) : null; }); } if (!rangebreaksIn._cachedValues) { rangebreaksIn._cachedValues = rangebreaksIn.map(function(brk2) { return brk2.enabled && brk2.values ? Lib.simpleMap(brk2.values, ax.d2c).sort(Lib.sorterAsc) : null; }); } for (var i = 0; i < rangebreaksIn.length; i++) { var brk = rangebreaksIn[i]; if (brk.enabled) { if (brk.bounds) { var pattern = brk.pattern; bnds = rangebreaksIn._cachedPatterns[i]; b02 = bnds[0]; b12 = bnds[1]; switch (pattern) { case WEEKDAY_PATTERN: vDate = new Date(v); vb = vDate.getUTCDay(); if (b02 > b12) { b12 += 7; if (vb < b02) vb += 7; } break; case HOUR_PATTERN: vDate = new Date(v); var hours2 = vDate.getUTCHours(); var minutes2 = vDate.getUTCMinutes(); var seconds2 = vDate.getUTCSeconds(); var milliseconds2 = vDate.getUTCMilliseconds(); vb = hours2 + (minutes2 / 60 + seconds2 / 3600 + milliseconds2 / 36e5); if (b02 > b12) { b12 += 24; if (vb < b02) vb += 24; } break; case "": vb = v; break; } if (vb >= b02 && vb < b12) return BADNUM; } else { var vals = rangebreaksIn._cachedValues[i]; for (var j = 0; j < vals.length; j++) { b02 = vals[j]; b12 = b02 + brk.dvalue; if (v >= b02 && v < b12) return BADNUM; } } } } return v; }; ax.locateBreaks = function(r02, r12) { var i, bnds, b02, b12; var rangebreaksOut = []; if (!ax.rangebreaks) return rangebreaksOut; var rangebreaksIn = ax.rangebreaks.slice().sort(function(a, b) { if (a.pattern === WEEKDAY_PATTERN && b.pattern === HOUR_PATTERN) return -1; if (b.pattern === WEEKDAY_PATTERN && a.pattern === HOUR_PATTERN) return 1; return 0; }); var addBreak = function(min, max) { min = Lib.constrain(min, r02, r12); max = Lib.constrain(max, r02, r12); if (min === max) return; var isNewBreak = true; for (var j2 = 0; j2 < rangebreaksOut.length; j2++) { var brkj = rangebreaksOut[j2]; if (min < brkj.max && max >= brkj.min) { if (min < brkj.min) { brkj.min = min; } if (max > brkj.max) { brkj.max = max; } isNewBreak = false; } } if (isNewBreak) { rangebreaksOut.push({ min, max }); } }; for (i = 0; i < rangebreaksIn.length; i++) { var brk = rangebreaksIn[i]; if (brk.enabled) { if (brk.bounds) { var t03 = r02; var t13 = r12; if (brk.pattern) { t03 = Math.floor(t03); } bnds = Lib.simpleMap(brk.bounds, brk.pattern ? cleanNumber : ax.r2l); b02 = bnds[0]; b12 = bnds[1]; var t0Date = new Date(t03); var bndDelta; var step; switch (brk.pattern) { case WEEKDAY_PATTERN: step = ONEWEEK; bndDelta = ((b12 < b02 ? 7 : 0) + (b12 - b02)) * ONEDAY; t03 += b02 * ONEDAY - (t0Date.getUTCDay() * ONEDAY + t0Date.getUTCHours() * ONEHOUR + t0Date.getUTCMinutes() * ONEMIN + t0Date.getUTCSeconds() * ONESEC + t0Date.getUTCMilliseconds()); break; case HOUR_PATTERN: step = ONEDAY; bndDelta = ((b12 < b02 ? 24 : 0) + (b12 - b02)) * ONEHOUR; t03 += b02 * ONEHOUR - (t0Date.getUTCHours() * ONEHOUR + t0Date.getUTCMinutes() * ONEMIN + t0Date.getUTCSeconds() * ONESEC + t0Date.getUTCMilliseconds()); break; default: t03 = Math.min(bnds[0], bnds[1]); t13 = Math.max(bnds[0], bnds[1]); step = t13 - t03; bndDelta = step; } for (var t = t03; t < t13; t += step) { addBreak(t, t + bndDelta); } } else { var vals = Lib.simpleMap(brk.values, ax.d2c); for (var j = 0; j < vals.length; j++) { b02 = vals[j]; b12 = b02 + brk.dvalue; addBreak(b02, b12); } } } } rangebreaksOut.sort(function(a, b) { return a.min - b.min; }); return rangebreaksOut; }; ax.makeCalcdata = function(trace, axLetter2, opts) { var arrayIn, arrayOut, i, len; var axType = ax.type; var cal = axType === "date" && trace[axLetter2 + "calendar"]; if (axLetter2 in trace) { arrayIn = trace[axLetter2]; len = trace._length || Lib.minRowLength(arrayIn); if (Lib.isTypedArray(arrayIn) && (axType === "linear" || axType === "log")) { if (len === arrayIn.length) { return arrayIn; } else if (arrayIn.subarray) { return arrayIn.subarray(0, len); } } if (axType === "multicategory") { return setMultiCategoryIndex(arrayIn, len); } arrayOut = new Array(len); for (i = 0; i < len; i++) { arrayOut[i] = ax.d2c(arrayIn[i], 0, cal, opts); } } else { var v02 = axLetter2 + "0" in trace ? ax.d2c(trace[axLetter2 + "0"], 0, cal) : 0; var dv2 = trace["d" + axLetter2] ? Number(trace["d" + axLetter2]) : 1; arrayIn = trace[{ x: "y", y: "x" }[axLetter2]]; len = trace._length || arrayIn.length; arrayOut = new Array(len); for (i = 0; i < len; i++) { arrayOut[i] = v02 + i * dv2; } } if (ax.rangebreaks) { for (i = 0; i < len; i++) { arrayOut[i] = ax.maskBreaks(arrayOut[i]); } } return arrayOut; }; ax.isValidRange = function(range, nullOk) { return Array.isArray(range) && range.length === 2 && (nullOk && range[0] === null || isNumeric(ax.r2l(range[0]))) && (nullOk && range[1] === null || isNumeric(ax.r2l(range[1]))); }; ax.getAutorangeDflt = function(range, options) { var autorangeDflt = !ax.isValidRange(range, "nullOk"); if (autorangeDflt && options && options.reverseDflt) autorangeDflt = "reversed"; else if (range) { if (range[0] === null && range[1] === null) { autorangeDflt = true; } else if (range[0] === null && range[1] !== null) { autorangeDflt = "min"; } else if (range[0] !== null && range[1] === null) { autorangeDflt = "max"; } } return autorangeDflt; }; ax.isReversed = function() { var autorange = ax.autorange; return autorange === "reversed" || autorange === "min reversed" || autorange === "max reversed"; }; ax.isPtWithinRange = function(d, calendar) { var coord = ax.c2l(d[axLetter], null, calendar); var r02 = ax.r2l(ax.range[0]); var r12 = ax.r2l(ax.range[1]); if (r02 < r12) { return r02 <= coord && coord <= r12; } else { return r12 <= coord && coord <= r02; } }; ax._emptyCategories = function() { ax._categories = []; ax._categoriesMap = {}; }; ax.clearCalc = function() { var group = ax._matchGroup; if (group) { var categories = null; var categoriesMap = null; for (var axId2 in group) { var ax2 = fullLayout[axisIds.id2name(axId2)]; if (ax2._categories) { categories = ax2._categories; categoriesMap = ax2._categoriesMap; break; } } if (categories && categoriesMap) { ax._categories = categories; ax._categoriesMap = categoriesMap; } else { ax._emptyCategories(); } } else { ax._emptyCategories(); } if (ax._initialCategories) { for (var j = 0; j < ax._initialCategories.length; j++) { setCategoryIndex(ax._initialCategories[j]); } } }; ax.sortByInitialCategories = function() { var affectedTraces = []; ax._emptyCategories(); if (ax._initialCategories) { for (var j = 0; j < ax._initialCategories.length; j++) { setCategoryIndex(ax._initialCategories[j]); } } affectedTraces = affectedTraces.concat(ax._traceIndices); var group = ax._matchGroup; for (var axId2 in group) { if (axId === axId2) continue; var ax2 = fullLayout[axisIds.id2name(axId2)]; ax2._categories = ax._categories; ax2._categoriesMap = ax._categoriesMap; affectedTraces = affectedTraces.concat(ax2._traceIndices); } return affectedTraces; }; var locale3 = fullLayout._d3locale; if (ax.type === "date") { ax._dateFormat = locale3 ? locale3.timeFormat : utcFormat2; ax._extraFormat = fullLayout._extraFormat; } ax._separators = fullLayout.separators; ax._numFormat = locale3 ? locale3.numberFormat : numberFormat; delete ax._minDtick; delete ax._forceTick0; }; } }); // node_modules/plotly.js/src/plots/cartesian/axis_autotype.js var require_axis_autotype = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/axis_autotype.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var BADNUM = require_numerical().BADNUM; var isArrayOrTypedArray = Lib.isArrayOrTypedArray; var isDateTime = Lib.isDateTime; var cleanNumber = Lib.cleanNumber; var round = Math.round; module2.exports = function autoType(array, calendar, opts) { var a = array; var noMultiCategory = opts.noMultiCategory; if (isArrayOrTypedArray(a) && !a.length) return "-"; if (!noMultiCategory && multiCategory(a)) return "multicategory"; if (noMultiCategory && Array.isArray(a[0])) { var b = []; for (var i = 0; i < a.length; i++) { if (isArrayOrTypedArray(a[i])) { for (var j = 0; j < a[i].length; j++) { b.push(a[i][j]); } } } a = b; } if (moreDates(a, calendar)) return "date"; var convertNumeric = opts.autotypenumbers !== "strict"; if (category(a, convertNumeric)) return "category"; if (linearOK(a, convertNumeric)) return "linear"; return "-"; }; function hasTypeNumber(v, convertNumeric) { return convertNumeric ? isNumeric(v) : typeof v === "number"; } function linearOK(a, convertNumeric) { var len = a.length; for (var i = 0; i < len; i++) { if (hasTypeNumber(a[i], convertNumeric)) return true; } return false; } function moreDates(a, calendar) { var len = a.length; var inc = getIncrement(len); var dats = 0; var nums = 0; var seen = {}; for (var f = 0; f < len; f += inc) { var i = round(f); var ai2 = a[i]; var stri = String(ai2); if (seen[stri]) continue; seen[stri] = 1; if (isDateTime(ai2, calendar)) dats++; if (isNumeric(ai2)) nums++; } return dats > nums * 2; } function getIncrement(len) { return Math.max(1, (len - 1) / 1e3); } function category(a, convertNumeric) { var len = a.length; var inc = getIncrement(len); var nums = 0; var cats = 0; var seen = {}; for (var f = 0; f < len; f += inc) { var i = round(f); var ai2 = a[i]; var stri = String(ai2); if (seen[stri]) continue; seen[stri] = 1; var t = typeof ai2; if (t === "boolean") cats++; else if (convertNumeric ? cleanNumber(ai2) !== BADNUM : t === "number") nums++; else if (t === "string") cats++; } return cats > nums * 2; } function multiCategory(a) { return isArrayOrTypedArray(a[0]) && isArrayOrTypedArray(a[1]); } } }); // node_modules/plotly.js/src/plots/cartesian/autorange.js var require_autorange = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/autorange.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var FP_SAFE = require_numerical().FP_SAFE; var Registry = require_registry(); var Drawing = require_drawing(); var axIds = require_axis_ids(); var getFromId = axIds.getFromId; var isLinked = axIds.isLinked; module2.exports = { applyAutorangeOptions, getAutoRange, makePadFn, doAutoRange, findExtremes, concatExtremes }; function getAutoRange(gd2, ax) { var i, j; var newRange = []; var fullLayout = gd2._fullLayout; var getPadMin = makePadFn(fullLayout, ax, 0); var getPadMax = makePadFn(fullLayout, ax, 1); var extremes = concatExtremes(gd2, ax); var minArray = extremes.min; var maxArray = extremes.max; if (minArray.length === 0 || maxArray.length === 0) { return Lib.simpleMap(ax.range, ax.r2l); } var minmin = minArray[0].val; var maxmax = maxArray[0].val; for (i = 1; i < minArray.length; i++) { if (minmin !== maxmax) break; minmin = Math.min(minmin, minArray[i].val); } for (i = 1; i < maxArray.length; i++) { if (minmin !== maxmax) break; maxmax = Math.max(maxmax, maxArray[i].val); } var autorange = ax.autorange; var axReverse = autorange === "reversed" || autorange === "min reversed" || autorange === "max reversed"; if (!axReverse && ax.range) { var rng = Lib.simpleMap(ax.range, ax.r2l); axReverse = rng[1] < rng[0]; } if (ax.autorange === "reversed") { ax.autorange = true; } var rangeMode = ax.rangemode; var toZero = rangeMode === "tozero"; var nonNegative = rangeMode === "nonnegative"; var axLen = ax._length; var minSpan = axLen / 10; var mbest = 0; var minpt, maxpt, minbest, maxbest, dp2, dv2; for (i = 0; i < minArray.length; i++) { minpt = minArray[i]; for (j = 0; j < maxArray.length; j++) { maxpt = maxArray[j]; dv2 = maxpt.val - minpt.val - calcBreaksLength(ax, minpt.val, maxpt.val); if (dv2 > 0) { dp2 = axLen - getPadMin(minpt) - getPadMax(maxpt); if (dp2 > minSpan) { if (dv2 / dp2 > mbest) { minbest = minpt; maxbest = maxpt; mbest = dv2 / dp2; } } else if (dv2 / axLen > mbest) { minbest = { val: minpt.val, nopad: 1 }; maxbest = { val: maxpt.val, nopad: 1 }; mbest = dv2 / axLen; } } } } function maximumPad(prev, pt2) { return Math.max(prev, getPadMax(pt2)); } if (minmin === maxmax) { var lower = minmin - 1; var upper = minmin + 1; if (toZero) { if (minmin === 0) { newRange = [0, 1]; } else { var maxPad = (minmin > 0 ? maxArray : minArray).reduce(maximumPad, 0); var rangeEnd = minmin / (1 - Math.min(0.5, maxPad / axLen)); newRange = minmin > 0 ? [0, rangeEnd] : [rangeEnd, 0]; } } else if (nonNegative) { newRange = [Math.max(0, lower), Math.max(1, upper)]; } else { newRange = [lower, upper]; } } else { if (toZero) { if (minbest.val >= 0) { minbest = { val: 0, nopad: 1 }; } if (maxbest.val <= 0) { maxbest = { val: 0, nopad: 1 }; } } else if (nonNegative) { if (minbest.val - mbest * getPadMin(minbest) < 0) { minbest = { val: 0, nopad: 1 }; } if (maxbest.val <= 0) { maxbest = { val: 1, nopad: 1 }; } } mbest = (maxbest.val - minbest.val - calcBreaksLength(ax, minpt.val, maxpt.val)) / (axLen - getPadMin(minbest) - getPadMax(maxbest)); newRange = [ minbest.val - mbest * getPadMin(minbest), maxbest.val + mbest * getPadMax(maxbest) ]; } newRange = applyAutorangeOptions(newRange, ax); if (ax.limitRange) ax.limitRange(); if (axReverse) newRange.reverse(); return Lib.simpleMap(newRange, ax.l2r || Number); } function calcBreaksLength(ax, v02, v12) { var lBreaks = 0; if (ax.rangebreaks) { var rangebreaksOut = ax.locateBreaks(v02, v12); for (var i = 0; i < rangebreaksOut.length; i++) { var brk = rangebreaksOut[i]; lBreaks += brk.max - brk.min; } } return lBreaks; } function makePadFn(fullLayout, ax, max) { var extrappad = 0.05 * ax._length; var anchorAxis = ax._anchorAxis || {}; if ((ax.ticklabelposition || "").indexOf("inside") !== -1 || (anchorAxis.ticklabelposition || "").indexOf("inside") !== -1) { var axReverse = ax.isReversed(); if (!axReverse) { var rng = Lib.simpleMap(ax.range, ax.r2l); axReverse = rng[1] < rng[0]; } if (axReverse) max = !max; } var zero = 0; if (!isLinked(fullLayout, ax._id)) { zero = padInsideLabelsOnAnchorAxis(fullLayout, ax, max); } extrappad = Math.max(zero, extrappad); if (ax.constrain === "domain" && ax._inputDomain) { extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / (ax.domain[1] - ax.domain[0]); } return function getPad(pt2) { if (pt2.nopad) return 0; return pt2.pad + (pt2.extrapad ? extrappad : zero); }; } var TEXTPAD = 3; function padInsideLabelsOnAnchorAxis(fullLayout, ax, max) { var pad2 = 0; var isX = ax._id.charAt(0) === "x"; for (var subplot in fullLayout._plots) { var plotinfo = fullLayout._plots[subplot]; if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue; var anchorAxis = (isX ? plotinfo.yaxis : plotinfo.xaxis) || {}; if ((anchorAxis.ticklabelposition || "").indexOf("inside") !== -1) { if (!max && (anchorAxis.side === "left" || anchorAxis.side === "bottom") || max && (anchorAxis.side === "top" || anchorAxis.side === "right")) { if (anchorAxis._vals) { var rad = Lib.deg2rad(anchorAxis._tickAngles[anchorAxis._id + "tick"] || 0); var cosA = Math.abs(Math.cos(rad)); var sinA = Math.abs(Math.sin(rad)); if (!anchorAxis._vals[0].bb) { var cls = anchorAxis._id + "tick"; var tickLabels = anchorAxis._selections[cls]; tickLabels.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select(".text-math-group"); if (mathjaxGroup.empty()) { d.bb = Drawing.bBox(thisLabel.node()); } }); } for (var i = 0; i < anchorAxis._vals.length; i++) { var t = anchorAxis._vals[i]; var bb = t.bb; if (bb) { var w = 2 * TEXTPAD + bb.width; var h = 2 * TEXTPAD + bb.height; pad2 = Math.max( pad2, isX ? Math.max(w * cosA, h * sinA) : Math.max(h * cosA, w * sinA) ); } } } if (anchorAxis.ticks === "inside" && anchorAxis.ticklabelposition === "inside") { pad2 += anchorAxis.ticklen || 0; } } } } return pad2; } function concatExtremes(gd2, ax, noMatch) { var axId = ax._id; var fullData = gd2._fullData; var fullLayout = gd2._fullLayout; var minArray = []; var maxArray = []; var i, j, d; function _concat(cont, indices) { for (i = 0; i < indices.length; i++) { var item = cont[indices[i]]; var extremes = (item._extremes || {})[axId]; if (item.visible === true && extremes) { for (j = 0; j < extremes.min.length; j++) { d = extremes.min[j]; collapseMinArray(minArray, d.val, d.pad, { extrapad: d.extrapad }); } for (j = 0; j < extremes.max.length; j++) { d = extremes.max[j]; collapseMaxArray(maxArray, d.val, d.pad, { extrapad: d.extrapad }); } } } } _concat(fullData, ax._traceIndices); _concat(fullLayout.annotations || [], ax._annIndices || []); _concat(fullLayout.shapes || [], ax._shapeIndices || []); if (ax._matchGroup && !noMatch) { for (var axId2 in ax._matchGroup) { if (axId2 !== ax._id) { var ax2 = getFromId(gd2, axId2); var extremes2 = concatExtremes(gd2, ax2, true); var lenRatio = ax._length / ax2._length; for (j = 0; j < extremes2.min.length; j++) { d = extremes2.min[j]; collapseMinArray(minArray, d.val, d.pad * lenRatio, { extrapad: d.extrapad }); } for (j = 0; j < extremes2.max.length; j++) { d = extremes2.max[j]; collapseMaxArray(maxArray, d.val, d.pad * lenRatio, { extrapad: d.extrapad }); } } } } return { min: minArray, max: maxArray }; } function doAutoRange(gd2, ax, presetRange) { ax.setScale(); if (ax.autorange) { ax.range = presetRange ? presetRange.slice() : getAutoRange(gd2, ax); ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); var axIn = ax._input; var edits = {}; edits[ax._attr + ".range"] = ax.range; edits[ax._attr + ".autorange"] = ax.autorange; Registry.call("_storeDirectGUIEdit", gd2.layout, gd2._fullLayout._preGUI, edits); axIn.range = ax.range.slice(); axIn.autorange = ax.autorange; } var anchorAx = ax._anchorAxis; if (anchorAx && anchorAx.rangeslider) { var axeRangeOpts = anchorAx.rangeslider[ax._name]; if (axeRangeOpts) { if (axeRangeOpts.rangemode === "auto") { axeRangeOpts.range = getAutoRange(gd2, ax); } } anchorAx._input.rangeslider[ax._name] = Lib.extendFlat({}, axeRangeOpts); } } function findExtremes(ax, data, opts) { if (!opts) opts = {}; if (!ax._m) ax.setScale(); var minArray = []; var maxArray = []; var len = data.length; var extrapad = opts.padded || false; var tozero = opts.tozero && (ax.type === "linear" || ax.type === "-"); var isLog = ax.type === "log"; var hasArrayOption = false; var vpadLinearized = opts.vpadLinearized || false; var i, v, di2, dmin, dmax, ppadiplus, ppadiminus, vmin, vmax; function makePadAccessor(item) { if (Array.isArray(item)) { hasArrayOption = true; return function(i2) { return Math.max(Number(item[i2] || 0), 0); }; } else { var v2 = Math.max(Number(item || 0), 0); return function() { return v2; }; } } var ppadplus = makePadAccessor((ax._m > 0 ? opts.ppadplus : opts.ppadminus) || opts.ppad || 0); var ppadminus = makePadAccessor((ax._m > 0 ? opts.ppadminus : opts.ppadplus) || opts.ppad || 0); var vpadplus = makePadAccessor(opts.vpadplus || opts.vpad); var vpadminus = makePadAccessor(opts.vpadminus || opts.vpad); if (!hasArrayOption) { vmin = Infinity; vmax = -Infinity; if (isLog) { for (i = 0; i < len; i++) { v = data[i]; if (v < vmin && v > 0) vmin = v; if (v > vmax && v < FP_SAFE) vmax = v; } } else { for (i = 0; i < len; i++) { v = data[i]; if (v < vmin && v > -FP_SAFE) vmin = v; if (v > vmax && v < FP_SAFE) vmax = v; } } data = [vmin, vmax]; len = 2; } var collapseOpts = { tozero, extrapad }; function addItem(i2) { di2 = data[i2]; if (!isNumeric(di2)) return; ppadiplus = ppadplus(i2); ppadiminus = ppadminus(i2); if (vpadLinearized) { dmin = ax.c2l(di2) - vpadminus(i2); dmax = ax.c2l(di2) + vpadplus(i2); } else { vmin = di2 - vpadminus(i2); vmax = di2 + vpadplus(i2); if (isLog && vmin < vmax / 10) vmin = vmax / 10; dmin = ax.c2l(vmin); dmax = ax.c2l(vmax); } if (tozero) { dmin = Math.min(0, dmin); dmax = Math.max(0, dmax); } if (goodNumber(dmin)) { collapseMinArray(minArray, dmin, ppadiminus, collapseOpts); } if (goodNumber(dmax)) { collapseMaxArray(maxArray, dmax, ppadiplus, collapseOpts); } } var iMax = Math.min(6, len); for (i = 0; i < iMax; i++) addItem(i); for (i = len - 1; i >= iMax; i--) addItem(i); return { min: minArray, max: maxArray, opts }; } function collapseMinArray(array, newVal, newPad, opts) { collapseArray(array, newVal, newPad, opts, lessOrEqual); } function collapseMaxArray(array, newVal, newPad, opts) { collapseArray(array, newVal, newPad, opts, greaterOrEqual); } function collapseArray(array, newVal, newPad, opts, atLeastAsExtreme) { var tozero = opts.tozero; var extrapad = opts.extrapad; var includeThis = true; for (var j = 0; j < array.length && includeThis; j++) { var v = array[j]; if (atLeastAsExtreme(v.val, newVal) && v.pad >= newPad && (v.extrapad || !extrapad)) { includeThis = false; break; } else if (atLeastAsExtreme(newVal, v.val) && v.pad <= newPad && (extrapad || !v.extrapad)) { array.splice(j, 1); j--; } } if (includeThis) { var clipAtZero = tozero && newVal === 0; array.push({ val: newVal, pad: clipAtZero ? 0 : newPad, extrapad: clipAtZero ? false : extrapad }); } } function goodNumber(v) { return isNumeric(v) && Math.abs(v) < FP_SAFE; } function lessOrEqual(v02, v12) { return v02 <= v12; } function greaterOrEqual(v02, v12) { return v02 >= v12; } function applyAutorangeMinOptions(v, ax) { var autorangeoptions = ax.autorangeoptions; if (autorangeoptions && autorangeoptions.minallowed !== void 0 && hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)) { return autorangeoptions.minallowed; } if (autorangeoptions && autorangeoptions.clipmin !== void 0 && hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)) { return Math.max(v, ax.d2l(autorangeoptions.clipmin)); } return v; } function applyAutorangeMaxOptions(v, ax) { var autorangeoptions = ax.autorangeoptions; if (autorangeoptions && autorangeoptions.maxallowed !== void 0 && hasValidMinAndMax(ax, autorangeoptions.minallowed, autorangeoptions.maxallowed)) { return autorangeoptions.maxallowed; } if (autorangeoptions && autorangeoptions.clipmax !== void 0 && hasValidMinAndMax(ax, autorangeoptions.clipmin, autorangeoptions.clipmax)) { return Math.min(v, ax.d2l(autorangeoptions.clipmax)); } return v; } function hasValidMinAndMax(ax, min, max) { if (min !== void 0 && max !== void 0) { min = ax.d2l(min); max = ax.d2l(max); return min < max; } return true; } function applyAutorangeOptions(range, ax) { if (!ax || !ax.autorangeoptions) return range; var min = range[0]; var max = range[1]; var include = ax.autorangeoptions.include; if (include !== void 0) { var lMin = ax.d2l(min); var lMax = ax.d2l(max); if (!Lib.isArrayOrTypedArray(include)) include = [include]; for (var i = 0; i < include.length; i++) { var v = ax.d2l(include[i]); if (lMin >= v) { lMin = v; min = v; } if (lMax <= v) { lMax = v; max = v; } } } min = applyAutorangeMinOptions(min, ax); max = applyAutorangeMaxOptions(max, ax); return [min, max]; } } }); // node_modules/plotly.js/src/plots/cartesian/axes.js var require_axes = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/axes.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Plots = require_plots(); var Registry = require_registry(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var svgTextUtils = require_svg_text_utils(); var Titles = require_titles(); var Color = require_color(); var Drawing = require_drawing(); var axAttrs = require_layout_attributes4(); var cleanTicks = require_clean_ticks(); var constants = require_numerical(); var ONEMAXYEAR = constants.ONEMAXYEAR; var ONEAVGYEAR = constants.ONEAVGYEAR; var ONEMINYEAR = constants.ONEMINYEAR; var ONEMAXQUARTER = constants.ONEMAXQUARTER; var ONEAVGQUARTER = constants.ONEAVGQUARTER; var ONEMINQUARTER = constants.ONEMINQUARTER; var ONEMAXMONTH = constants.ONEMAXMONTH; var ONEAVGMONTH = constants.ONEAVGMONTH; var ONEMINMONTH = constants.ONEMINMONTH; var ONEWEEK = constants.ONEWEEK; var ONEDAY = constants.ONEDAY; var HALFDAY = ONEDAY / 2; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; var ONEMILLI = constants.ONEMILLI; var ONEMICROSEC = constants.ONEMICROSEC; var MINUS_SIGN = constants.MINUS_SIGN; var BADNUM = constants.BADNUM; var ZERO_PATH = { K: "zeroline" }; var GRID_PATH = { K: "gridline", L: "path" }; var MINORGRID_PATH = { K: "minor-gridline", L: "path" }; var TICK_PATH = { K: "tick", L: "path" }; var TICK_TEXT = { K: "tick", L: "text" }; var MARGIN_MAPPING = { width: ["x", "r", "l", "xl", "xr"], height: ["y", "t", "b", "yt", "yb"], right: ["r", "xr"], left: ["l", "xl"], top: ["t", "yt"], bottom: ["b", "yb"] }; var alignmentConstants = require_alignment(); var MID_SHIFT = alignmentConstants.MID_SHIFT; var CAP_SHIFT = alignmentConstants.CAP_SHIFT; var LINE_SPACING = alignmentConstants.LINE_SPACING; var OPPOSITE_SIDE = alignmentConstants.OPPOSITE_SIDE; var TEXTPAD = 3; var axes = module2.exports = {}; axes.setConvert = require_set_convert(); var autoType = require_axis_autotype(); var axisIds = require_axis_ids(); var idSort = axisIds.idSort; var isLinked = axisIds.isLinked; axes.id2name = axisIds.id2name; axes.name2id = axisIds.name2id; axes.cleanId = axisIds.cleanId; axes.list = axisIds.list; axes.listIds = axisIds.listIds; axes.getFromId = axisIds.getFromId; axes.getFromTrace = axisIds.getFromTrace; var autorange = require_autorange(); axes.getAutoRange = autorange.getAutoRange; axes.findExtremes = autorange.findExtremes; var epsilon = 1e-4; function expandRange(range) { var delta = (range[1] - range[0]) * epsilon; return [ range[0] - delta, range[1] + delta ]; } axes.coerceRef = function(containerIn, containerOut, gd2, attr, dflt, extraOption) { var axLetter = attr.charAt(attr.length - 1); var axlist = gd2._fullLayout._subplots[axLetter + "axis"]; var refAttr = attr + "ref"; var attrDef = {}; if (!dflt) dflt = axlist[0] || (typeof extraOption === "string" ? extraOption : extraOption[0]); if (!extraOption) extraOption = dflt; axlist = axlist.concat(axlist.map(function(x) { return x + " domain"; })); attrDef[refAttr] = { valType: "enumerated", values: axlist.concat(extraOption ? typeof extraOption === "string" ? [extraOption] : extraOption : []), dflt }; return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; axes.getRefType = function(ar2) { if (ar2 === void 0) { return ar2; } if (ar2 === "paper") { return "paper"; } if (ar2 === "pixel") { return "pixel"; } if (/( domain)$/.test(ar2)) { return "domain"; } else { return "range"; } }; axes.coercePosition = function(containerOut, gd2, coerce, axRef, attr, dflt) { var cleanPos, pos; var axRefType = axes.getRefType(axRef); if (axRefType !== "range") { cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); } else { var ax = axes.getFromId(gd2, axRef); dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); cleanPos = ax.cleanPos; } containerOut[attr] = cleanPos(pos); }; axes.cleanPosition = function(pos, gd2, axRef) { var cleanPos = axRef === "paper" || axRef === "pixel" ? Lib.ensureNumber : axes.getFromId(gd2, axRef).cleanPos; return cleanPos(pos); }; axes.redrawComponents = function(gd2, axIds) { axIds = axIds ? axIds : axes.listIds(gd2); var fullLayout = gd2._fullLayout; function _redrawOneComp(moduleName, methodName, stashName, shortCircuit) { var method = Registry.getComponentMethod(moduleName, methodName); var stash = {}; for (var i = 0; i < axIds.length; i++) { var ax = fullLayout[axes.id2name(axIds[i])]; var indices = ax[stashName]; for (var j = 0; j < indices.length; j++) { var ind = indices[j]; if (!stash[ind]) { method(gd2, ind); stash[ind] = 1; if (shortCircuit) return; } } } } _redrawOneComp("annotations", "drawOne", "_annIndices"); _redrawOneComp("shapes", "drawOne", "_shapeIndices"); _redrawOneComp("images", "draw", "_imgIndices", true); _redrawOneComp("selections", "drawOne", "_selectionIndices"); }; var getDataConversions = axes.getDataConversions = function(gd2, trace, target, targetArray) { var ax; var d2cTarget = target === "x" || target === "y" || target === "z" ? target : targetArray; if (Lib.isArrayOrTypedArray(d2cTarget)) { ax = { type: autoType(targetArray, void 0, { autotypenumbers: gd2._fullLayout.autotypenumbers }), _categories: [] }; axes.setConvert(ax); if (ax.type === "category") { for (var i = 0; i < targetArray.length; i++) { ax.d2c(targetArray[i]); } } } else { ax = axes.getFromTrace(gd2, trace, d2cTarget); } if (ax) return { d2c: ax.d2c, c2d: ax.c2d }; if (d2cTarget === "ids") return { d2c: toString, c2d: toString }; return { d2c: toNum, c2d: toNum }; }; function toNum(v) { return +v; } function toString(v) { return String(v); } axes.getDataToCoordFunc = function(gd2, trace, target, targetArray) { return getDataConversions(gd2, trace, target, targetArray).d2c; }; axes.counterLetter = function(id2) { var axLetter = id2.charAt(0); if (axLetter === "x") return "y"; if (axLetter === "y") return "x"; }; axes.minDtick = function(ax, newDiff, newFirst, allow) { if (["log", "category", "multicategory"].indexOf(ax.type) !== -1 || !allow) { ax._minDtick = 0; } else if (ax._minDtick === void 0) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } else if (ax._minDtick) { if ((ax._minDtick / newDiff + 1e-6) % 1 < 2e-6 && // existing minDtick is an integer multiple of newDiff // (within rounding err) // and forceTick0 can be shifted to newFirst ((newFirst - ax._forceTick0) / newDiff % 1 + 1.000001) % 1 < 2e-6) { ax._minDtick = newDiff; ax._forceTick0 = newFirst; } else if ((newDiff / ax._minDtick + 1e-6) % 1 > 2e-6 || // if the converse is true (newDiff is a multiple of minDtick and // newFirst can be shifted to forceTick0) then do nothing - same // forcing stands. Otherwise, cancel forced minimum ((newFirst - ax._forceTick0) / ax._minDtick % 1 + 1.000001) % 1 > 2e-6) { ax._minDtick = 0; } } }; axes.saveRangeInitial = function(gd2, overwrite) { var axList = axes.list(gd2, "", true); var hasOneAxisChanged = false; for (var i = 0; i < axList.length; i++) { var ax = axList[i]; var isNew = ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0; var hasChanged = isNew || (ax.range[0] !== ax._rangeInitial0 || ax.range[1] !== ax._rangeInitial1); var autorange2 = ax.autorange; if (isNew && autorange2 !== true || overwrite && hasChanged) { ax._rangeInitial0 = autorange2 === "min" || autorange2 === "max reversed" ? void 0 : ax.range[0]; ax._rangeInitial1 = autorange2 === "max" || autorange2 === "min reversed" ? void 0 : ax.range[1]; ax._autorangeInitial = autorange2; hasOneAxisChanged = true; } } return hasOneAxisChanged; }; axes.saveShowSpikeInitial = function(gd2, overwrite) { var axList = axes.list(gd2, "", true); var hasOneAxisChanged = false; var allSpikesEnabled = "on"; for (var i = 0; i < axList.length; i++) { var ax = axList[i]; var isNew = ax._showSpikeInitial === void 0; var hasChanged = isNew || !(ax.showspikes === ax._showspikes); if (isNew || overwrite && hasChanged) { ax._showSpikeInitial = ax.showspikes; hasOneAxisChanged = true; } if (allSpikesEnabled === "on" && !ax.showspikes) { allSpikesEnabled = "off"; } } gd2._fullLayout._cartesianSpikesEnabled = allSpikesEnabled; return hasOneAxisChanged; }; axes.autoBin = function(data, ax, nbins, is2d, calendar, size) { var dataMin = Lib.aggNums(Math.min, null, data); var dataMax = Lib.aggNums(Math.max, null, data); if (ax.type === "category" || ax.type === "multicategory") { return { start: dataMin - 0.5, end: dataMax + 0.5, size: Math.max(1, Math.round(size) || 1), _dataSpan: dataMax - dataMin }; } if (!calendar) calendar = ax.calendar; var dummyAx; if (ax.type === "log") { dummyAx = { type: "linear", range: [dataMin, dataMax] }; } else { dummyAx = { type: ax.type, range: Lib.simpleMap([dataMin, dataMax], ax.c2r, 0, calendar), calendar }; } axes.setConvert(dummyAx); size = size && cleanTicks.dtick(size, dummyAx.type); if (size) { dummyAx.dtick = size; dummyAx.tick0 = cleanTicks.tick0(void 0, dummyAx.type, calendar); } else { var size0; if (nbins) size0 = (dataMax - dataMin) / nbins; else { var distinctData = Lib.distinctVals(data); var msexp = Math.pow(10, Math.floor( Math.log(distinctData.minDiff) / Math.LN10 )); var minSize = msexp * Lib.roundUp( distinctData.minDiff / msexp, [0.9, 1.9, 4.9, 9.9], true ); size0 = Math.max(minSize, 2 * Lib.stdev(data) / Math.pow(data.length, is2d ? 0.25 : 0.4)); if (!isNumeric(size0)) size0 = 1; } axes.autoTicks(dummyAx, size0); } var finalSize = dummyAx.dtick; var binStart = axes.tickIncrement( axes.tickFirst(dummyAx), finalSize, "reverse", calendar ); var binEnd, bincount; if (typeof finalSize === "number") { binStart = autoShiftNumericBins(binStart, data, dummyAx, dataMin, dataMax); bincount = 1 + Math.floor((dataMax - binStart) / finalSize); binEnd = binStart + bincount * finalSize; } else { if (dummyAx.dtick.charAt(0) === "M") { binStart = autoShiftMonthBins(binStart, data, finalSize, dataMin, calendar); } binEnd = binStart; bincount = 0; while (binEnd <= dataMax) { binEnd = axes.tickIncrement(binEnd, finalSize, false, calendar); bincount++; } } return { start: ax.c2r(binStart, 0, calendar), end: ax.c2r(binEnd, 0, calendar), size: finalSize, _dataSpan: dataMax - dataMin }; }; function autoShiftNumericBins(binStart, data, ax, dataMin, dataMax) { var edgecount = 0; var midcount = 0; var intcount = 0; var blankCount = 0; function nearEdge(v) { return (1 + (v - binStart) * 100 / ax.dtick) % 100 < 2; } for (var i = 0; i < data.length; i++) { if (data[i] % 1 === 0) intcount++; else if (!isNumeric(data[i])) blankCount++; if (nearEdge(data[i])) edgecount++; if (nearEdge(data[i] + ax.dtick / 2)) midcount++; } var dataCount = data.length - blankCount; if (intcount === dataCount && ax.type !== "date") { if (ax.dtick < 1) { binStart = dataMin - 0.5 * ax.dtick; } else { binStart -= 0.5; if (binStart + ax.dtick < dataMin) binStart += ax.dtick; } } else if (midcount < dataCount * 0.1) { if (edgecount > dataCount * 0.3 || nearEdge(dataMin) || nearEdge(dataMax)) { var binshift = ax.dtick / 2; binStart += binStart + binshift < dataMin ? binshift : -binshift; } } return binStart; } function autoShiftMonthBins(binStart, data, dtick, dataMin, calendar) { var stats = Lib.findExactDates(data, calendar); var threshold = 0.8; if (stats.exactDays > threshold) { var numMonths = Number(dtick.substr(1)); if (stats.exactYears > threshold && numMonths % 12 === 0) { binStart = axes.tickIncrement(binStart, "M6", "reverse") + ONEDAY * 1.5; } else if (stats.exactMonths > threshold) { binStart = axes.tickIncrement(binStart, "M1", "reverse") + ONEDAY * 15.5; } else { binStart -= HALFDAY; } var nextBinStart = axes.tickIncrement(binStart, dtick); if (nextBinStart <= dataMin) return nextBinStart; } return binStart; } axes.prepMinorTicks = function(mockAx, ax, opts) { if (!ax.minor.dtick) { delete mockAx.dtick; var hasMajor = ax.dtick && isNumeric(ax._tmin); var mockMinorRange; if (hasMajor) { var tick2 = axes.tickIncrement(ax._tmin, ax.dtick, true); mockMinorRange = [ax._tmin, tick2 * 0.99 + ax._tmin * 0.01]; } else { var rl = Lib.simpleMap(ax.range, ax.r2l); mockMinorRange = [rl[0], 0.8 * rl[0] + 0.2 * rl[1]]; } mockAx.range = Lib.simpleMap(mockMinorRange, ax.l2r); mockAx._isMinor = true; axes.prepTicks(mockAx, opts); if (hasMajor) { var numericMajor = isNumeric(ax.dtick); var numericMinor = isNumeric(mockAx.dtick); var majorNum = numericMajor ? ax.dtick : +ax.dtick.substring(1); var minorNum = numericMinor ? mockAx.dtick : +mockAx.dtick.substring(1); if (numericMajor && numericMinor) { if (!isMultiple(majorNum, minorNum)) { if (majorNum === 2 * ONEWEEK && minorNum === 3 * ONEDAY) { mockAx.dtick = ONEWEEK; } else if (majorNum === ONEWEEK && !(ax._input.minor || {}).nticks) { mockAx.dtick = ONEDAY; } else if (isClose(majorNum / minorNum, 2.5)) { mockAx.dtick = majorNum / 2; } else { mockAx.dtick = majorNum; } } else if (majorNum === 2 * ONEWEEK && minorNum === 2 * ONEDAY) { mockAx.dtick = ONEWEEK; } } else if (String(ax.dtick).charAt(0) === "M") { if (numericMinor) { mockAx.dtick = "M1"; } else { if (!isMultiple(majorNum, minorNum)) { mockAx.dtick = ax.dtick; } else if (majorNum >= 12 && minorNum === 2) { mockAx.dtick = "M3"; } } } else if (String(mockAx.dtick).charAt(0) === "L") { if (String(ax.dtick).charAt(0) === "L") { if (!isMultiple(majorNum, minorNum)) { mockAx.dtick = isClose(majorNum / minorNum, 2.5) ? ax.dtick / 2 : ax.dtick; } } else { mockAx.dtick = "D1"; } } else if (mockAx.dtick === "D2" && +ax.dtick > 1) { mockAx.dtick = 1; } } mockAx.range = ax.range; } if (ax.minor._tick0Init === void 0) { mockAx.tick0 = ax.tick0; } }; function isMultiple(bigger, smaller) { return Math.abs((bigger / smaller + 0.5) % 1 - 0.5) < 1e-3; } function isClose(a, b) { return Math.abs(a / b - 1) < 1e-3; } axes.prepTicks = function(ax, opts) { var rng = Lib.simpleMap(ax.range, ax.r2l, void 0, void 0, opts); if (ax.tickmode === "auto" || !ax.dtick) { var nt2 = ax.nticks; var minPx; if (!nt2) { if (ax.type === "category" || ax.type === "multicategory") { minPx = ax.tickfont ? Lib.bigFont(ax.tickfont.size || 12) : 15; nt2 = ax._length / minPx; } else { minPx = ax._id.charAt(0) === "y" ? 40 : 80; nt2 = Lib.constrain(ax._length / minPx, 4, 9) + 1; } if (ax._name === "radialaxis") nt2 *= 2; } if (!(ax.minor && ax.minor.tickmode !== "array")) { if (ax.tickmode === "array") nt2 *= 100; } ax._roughDTick = Math.abs(rng[1] - rng[0]) / nt2; axes.autoTicks(ax, ax._roughDTick); if (ax._minDtick > 0 && ax.dtick < ax._minDtick * 2) { ax.dtick = ax._minDtick; ax.tick0 = ax.l2r(ax._forceTick0); } } if (ax.ticklabelmode === "period") { adjustPeriodDelta(ax); } if (!ax.tick0) { ax.tick0 = ax.type === "date" ? "2000-01-01" : 0; } if (ax.type === "date" && ax.dtick < 0.1) ax.dtick = 0.1; autoTickRound(ax); }; function nMonths(dtick) { return +dtick.substring(1); } function adjustPeriodDelta(ax) { var definedDelta; function mDate() { return !(isNumeric(ax.dtick) || ax.dtick.charAt(0) !== "M"); } var isMDate = mDate(); var tickformat = axes.getTickFormat(ax); if (tickformat) { var noDtick = ax._dtickInit !== ax.dtick; if (!/%[fLQsSMX]/.test(tickformat)) { if (/%[HI]/.test(tickformat)) { definedDelta = ONEHOUR; if (noDtick && !isMDate && ax.dtick < ONEHOUR) ax.dtick = ONEHOUR; } else if (/%p/.test(tickformat)) { definedDelta = HALFDAY; if (noDtick && !isMDate && ax.dtick < HALFDAY) ax.dtick = HALFDAY; } else if (/%[Aadejuwx]/.test(tickformat)) { definedDelta = ONEDAY; if (noDtick && !isMDate && ax.dtick < ONEDAY) ax.dtick = ONEDAY; } else if (/%[UVW]/.test(tickformat)) { definedDelta = ONEWEEK; if (noDtick && !isMDate && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK; } else if (/%[Bbm]/.test(tickformat)) { definedDelta = ONEAVGMONTH; if (noDtick && (isMDate ? nMonths(ax.dtick) < 1 : ax.dtick < ONEMINMONTH)) ax.dtick = "M1"; } else if (/%[q]/.test(tickformat)) { definedDelta = ONEAVGQUARTER; if (noDtick && (isMDate ? nMonths(ax.dtick) < 3 : ax.dtick < ONEMINQUARTER)) ax.dtick = "M3"; } else if (/%[Yy]/.test(tickformat)) { definedDelta = ONEAVGYEAR; if (noDtick && (isMDate ? nMonths(ax.dtick) < 12 : ax.dtick < ONEMINYEAR)) ax.dtick = "M12"; } } } isMDate = mDate(); if (isMDate && ax.tick0 === ax._dowTick0) { ax.tick0 = ax._rawTick0; } ax._definedDelta = definedDelta; } function positionPeriodTicks(tickVals, ax, definedDelta) { for (var i = 0; i < tickVals.length; i++) { var v = tickVals[i].value; var a = i; var b = i + 1; if (i < tickVals.length - 1) { a = i; b = i + 1; } else if (i > 0) { a = i - 1; b = i; } else { a = i; b = i; } var A = tickVals[a].value; var B = tickVals[b].value; var actualDelta = Math.abs(B - A); var delta = definedDelta || actualDelta; var periodLength = 0; if (delta >= ONEMINYEAR) { if (actualDelta >= ONEMINYEAR && actualDelta <= ONEMAXYEAR) { periodLength = actualDelta; } else { periodLength = ONEAVGYEAR; } } else if (definedDelta === ONEAVGQUARTER && delta >= ONEMINQUARTER) { if (actualDelta >= ONEMINQUARTER && actualDelta <= ONEMAXQUARTER) { periodLength = actualDelta; } else { periodLength = ONEAVGQUARTER; } } else if (delta >= ONEMINMONTH) { if (actualDelta >= ONEMINMONTH && actualDelta <= ONEMAXMONTH) { periodLength = actualDelta; } else { periodLength = ONEAVGMONTH; } } else if (definedDelta === ONEWEEK && delta >= ONEWEEK) { periodLength = ONEWEEK; } else if (delta >= ONEDAY) { periodLength = ONEDAY; } else if (definedDelta === HALFDAY && delta >= HALFDAY) { periodLength = HALFDAY; } else if (definedDelta === ONEHOUR && delta >= ONEHOUR) { periodLength = ONEHOUR; } var inBetween; if (periodLength >= actualDelta) { periodLength = actualDelta; inBetween = true; } var endPeriod = v + periodLength; if (ax.rangebreaks && periodLength > 0) { var nAll = 84; var n = 0; for (var c = 0; c < nAll; c++) { var r = (c + 0.5) / nAll; if (ax.maskBreaks(v * (1 - r) + r * endPeriod) !== BADNUM) n++; } periodLength *= n / nAll; if (!periodLength) { tickVals[i].drop = true; } if (inBetween && actualDelta > ONEWEEK) periodLength = actualDelta; } if (periodLength > 0 || // not instant i === 0) { tickVals[i].periodX = v + periodLength / 2; } } } axes.calcTicks = function calcTicks(ax, opts) { var type = ax.type; var calendar = ax.calendar; var ticklabelstep = ax.ticklabelstep; var isPeriod = ax.ticklabelmode === "period"; var isReversed = ax.range[0] > ax.range[1]; var ticklabelIndex = !ax.ticklabelindex || Lib.isArrayOrTypedArray(ax.ticklabelindex) ? ax.ticklabelindex : [ax.ticklabelindex]; var rng = Lib.simpleMap(ax.range, ax.r2l, void 0, void 0, opts); var axrev = rng[1] < rng[0]; var minRange = Math.min(rng[0], rng[1]); var maxRange = Math.max(rng[0], rng[1]); var maxTicks = Math.max(1e3, ax._length || 0); var ticksOut = []; var minorTicks = []; var tickVals = []; var minorTickVals = []; var allTicklabelVals = []; var hasMinor = ax.minor && (ax.minor.ticks || ax.minor.showgrid); for (var major = 1; major >= (hasMinor ? 0 : 1); major--) { var isMinor = !major; if (major) { ax._dtickInit = ax.dtick; ax._tick0Init = ax.tick0; } else { ax.minor._dtickInit = ax.minor.dtick; ax.minor._tick0Init = ax.minor.tick0; } var mockAx = major ? ax : Lib.extendFlat({}, ax, ax.minor); if (isMinor) { axes.prepMinorTicks(mockAx, ax, opts); } else { axes.prepTicks(mockAx, opts); } if (mockAx.tickmode === "array") { if (major) { tickVals = []; ticksOut = arrayTicks(ax, !isMinor); } else { minorTickVals = []; minorTicks = arrayTicks(ax, !isMinor); } continue; } if (mockAx.tickmode === "sync") { tickVals = []; ticksOut = syncTicks(ax); continue; } var exRng = expandRange(rng); var startTick = exRng[0]; var endTick = exRng[1]; var numDtick = isNumeric(mockAx.dtick); var isDLog = type === "log" && !(numDtick || mockAx.dtick.charAt(0) === "L"); var x02 = axes.tickFirst(mockAx, opts); if (major) { ax._tmin = x02; if (x02 < startTick !== axrev) break; if (type === "category" || type === "multicategory") { endTick = axrev ? Math.max(-0.5, endTick) : Math.min(ax._categories.length - 0.5, endTick); } } var prevX = null; var x = x02; var majorId; if (major) { var _dTick; if (numDtick) { _dTick = ax.dtick; } else { if (type === "date") { if (typeof ax.dtick === "string" && ax.dtick.charAt(0) === "M") { _dTick = ONEAVGMONTH * ax.dtick.substring(1); } } else { _dTick = ax._roughDTick; } } majorId = Math.round((ax.r2l(x) - ax.r2l(ax.tick0)) / _dTick) - 1; } var dtick = mockAx.dtick; if (mockAx.rangebreaks && mockAx._tick0Init !== mockAx.tick0) { x = moveOutsideBreak(x, ax); if (!axrev) { x = axes.tickIncrement(x, dtick, !axrev, calendar); } } if (major && isPeriod) { x = axes.tickIncrement(x, dtick, !axrev, calendar); majorId--; } for (; axrev ? x >= endTick : x <= endTick; x = axes.tickIncrement( x, dtick, axrev, calendar )) { if (major) majorId++; if (mockAx.rangebreaks) { if (!axrev) { if (x < startTick) continue; if (mockAx.maskBreaks(x) === BADNUM && moveOutsideBreak(x, mockAx) >= maxRange) break; } } if (tickVals.length > maxTicks || x === prevX) break; prevX = x; var obj = { value: x }; if (major) { if (isDLog && x !== (x | 0)) { obj.simpleLabel = true; } if (ticklabelstep > 1 && majorId % ticklabelstep) { obj.skipLabel = true; } tickVals.push(obj); } else { obj.minor = true; minorTickVals.push(obj); } } } if (!minorTickVals || minorTickVals.length < 2) { ticklabelIndex = false; } else { var diff = (minorTickVals[1].value - minorTickVals[0].value) * (isReversed ? -1 : 1); if (!periodCompatibleWithTickformat(diff, ax.tickformat)) { ticklabelIndex = false; } } if (!ticklabelIndex) { allTicklabelVals = tickVals; } else { var allTickVals = tickVals.concat(minorTickVals); if (isPeriod && tickVals.length) { allTickVals = allTickVals.slice(1); } allTickVals = allTickVals.sort(function(a, b) { return a.value - b.value; }).filter(function(tick, index, self2) { return index === 0 || tick.value !== self2[index - 1].value; }); var majorTickIndices = allTickVals.map(function(item, index) { return item.minor === void 0 && !item.skipLabel ? index : null; }).filter(function(index) { return index !== null; }); majorTickIndices.forEach(function(majorIdx) { ticklabelIndex.map(function(nextLabelIdx) { var minorIdx = majorIdx + nextLabelIdx; if (minorIdx >= 0 && minorIdx < allTickVals.length) { Lib.pushUnique(allTicklabelVals, allTickVals[minorIdx]); } }); }); } if (hasMinor) { var canOverlap = ax.minor.ticks === "inside" && ax.ticks === "outside" || ax.minor.ticks === "outside" && ax.ticks === "inside"; if (!canOverlap) { var majorValues = tickVals.map(function(d) { return d.value; }); var list = []; for (var k = 0; k < minorTickVals.length; k++) { var T = minorTickVals[k]; var v = T.value; if (majorValues.indexOf(v) !== -1) { continue; } var found = false; for (var q = 0; !found && q < tickVals.length; q++) { if ( // add 10e6 to eliminate problematic digits 1e7 + tickVals[q].value === 1e7 + v ) { found = true; } } if (!found) list.push(T); } minorTickVals = list; } } if (isPeriod) positionPeriodTicks(allTicklabelVals, ax, ax._definedDelta); var i; if (ax.rangebreaks) { var flip = ax._id.charAt(0) === "y"; var fontSize = 1; if (ax.tickmode === "auto") { fontSize = ax.tickfont ? ax.tickfont.size : 12; } var prevL = NaN; for (i = tickVals.length - 1; i > -1; i--) { if (tickVals[i].drop) { tickVals.splice(i, 1); continue; } tickVals[i].value = moveOutsideBreak(tickVals[i].value, ax); var l = ax.c2p(tickVals[i].value); if (flip ? prevL > l - fontSize : prevL < l + fontSize) { tickVals.splice(axrev ? i + 1 : i, 1); } else { prevL = l; } } } if (isAngular(ax) && Math.abs(rng[1] - rng[0]) === 360) { tickVals.pop(); } ax._tmax = (tickVals[tickVals.length - 1] || {}).value; ax._prevDateHead = ""; ax._inCalcTicks = true; var lastVisibleHead; var hideLabel = function(tick) { tick.text = ""; ax._prevDateHead = lastVisibleHead; }; tickVals = tickVals.concat(minorTickVals); function setTickLabel(ax2, tickVal) { var text = axes.tickText( ax2, tickVal.value, false, // hover tickVal.simpleLabel // noSuffixPrefix ); var p = tickVal.periodX; if (p !== void 0) { text.periodX = p; if (p > maxRange || p < minRange) { if (p > maxRange) text.periodX = maxRange; if (p < minRange) text.periodX = minRange; hideLabel(text); } } return text; } var t; for (i = 0; i < tickVals.length; i++) { var _minor = tickVals[i].minor; var _value = tickVals[i].value; if (_minor) { if (ticklabelIndex && allTicklabelVals.indexOf(tickVals[i]) !== -1) { t = setTickLabel(ax, tickVals[i]); } else { t = { x: _value }; } t.minor = true; minorTicks.push(t); } else { lastVisibleHead = ax._prevDateHead; t = setTickLabel(ax, tickVals[i]); if (tickVals[i].skipLabel || ticklabelIndex && allTicklabelVals.indexOf(tickVals[i]) === -1) { hideLabel(t); } ticksOut.push(t); } } ticksOut = ticksOut.concat(minorTicks); ax._inCalcTicks = false; if (isPeriod && ticksOut.length) { ticksOut[0].noTick = true; } return ticksOut; }; function filterRangeBreaks(ax, ticksOut) { if (ax.rangebreaks) { ticksOut = ticksOut.filter(function(d) { return ax.maskBreaks(d.x) !== BADNUM; }); } return ticksOut; } function syncTicks(ax) { var baseAxis = ax._mainAxis; var ticksOut = []; if (baseAxis._vals) { for (var i = 0; i < baseAxis._vals.length; i++) { if (baseAxis._vals[i].noTick) { continue; } var pos = baseAxis.l2p(baseAxis._vals[i].x); var vali = ax.p2l(pos); var obj = axes.tickText(ax, vali); if (baseAxis._vals[i].minor) { obj.minor = true; obj.text = ""; } ticksOut.push(obj); } } ticksOut = filterRangeBreaks(ax, ticksOut); return ticksOut; } function arrayTicks(ax, majorOnly) { var rng = Lib.simpleMap(ax.range, ax.r2l); var exRng = expandRange(rng); var tickMin = Math.min(exRng[0], exRng[1]); var tickMax = Math.max(exRng[0], exRng[1]); var tickVal2l = ax.type === "category" ? ax.d2l_noadd : ax.d2l; if (ax.type === "log" && String(ax.dtick).charAt(0) !== "L") { ax.dtick = "L" + Math.pow(10, Math.floor(Math.min(ax.range[0], ax.range[1])) - 1); } var ticksOut = []; for (var isMinor = 0; isMinor <= 1; isMinor++) { if (majorOnly !== void 0 && (majorOnly && isMinor || majorOnly === false && !isMinor)) continue; if (isMinor && !ax.minor) continue; var vals = !isMinor ? ax.tickvals : ax.minor.tickvals; var text = !isMinor ? ax.ticktext : []; if (!vals) continue; if (!Lib.isArrayOrTypedArray(text)) text = []; for (var i = 0; i < vals.length; i++) { var vali = tickVal2l(vals[i]); if (vali > tickMin && vali < tickMax) { var obj = axes.tickText(ax, vali, false, String(text[i])); if (isMinor) { obj.minor = true; obj.text = ""; } ticksOut.push(obj); } } } ticksOut = filterRangeBreaks(ax, ticksOut); return ticksOut; } var roundBase10 = [2, 5, 10]; var roundBase24 = [1, 2, 3, 6, 12]; var roundBase60 = [1, 2, 5, 10, 15, 30]; var roundDays = [1, 2, 3, 7, 14]; var roundLog1 = [-0.046, 0, 0.301, 0.477, 0.602, 0.699, 0.778, 0.845, 0.903, 0.954, 1]; var roundLog2 = [-0.301, 0, 0.301, 0.699, 1]; var roundAngles = [15, 30, 45, 90, 180]; function roundDTick(roughDTick, base, roundingSet) { return base * Lib.roundUp(roughDTick / base, roundingSet); } axes.autoTicks = function(ax, roughDTick, isMinor) { var base; function getBase(v) { return Math.pow(v, Math.floor(Math.log(roughDTick) / Math.LN10)); } if (ax.type === "date") { ax.tick0 = Lib.dateTick0(ax.calendar, 0); var roughX2 = 2 * roughDTick; if (roughX2 > ONEAVGYEAR) { roughDTick /= ONEAVGYEAR; base = getBase(10); ax.dtick = "M" + 12 * roundDTick(roughDTick, base, roundBase10); } else if (roughX2 > ONEAVGMONTH) { roughDTick /= ONEAVGMONTH; ax.dtick = "M" + roundDTick(roughDTick, 1, roundBase24); } else if (roughX2 > ONEDAY) { ax.dtick = roundDTick(roughDTick, ONEDAY, ax._hasDayOfWeekBreaks ? [1, 2, 7, 14] : roundDays); if (!isMinor) { var tickformat = axes.getTickFormat(ax); var isPeriod = ax.ticklabelmode === "period"; if (isPeriod) ax._rawTick0 = ax.tick0; if (/%[uVW]/.test(tickformat)) { ax.tick0 = Lib.dateTick0(ax.calendar, 2); } else { ax.tick0 = Lib.dateTick0(ax.calendar, 1); } if (isPeriod) ax._dowTick0 = ax.tick0; } } else if (roughX2 > ONEHOUR) { ax.dtick = roundDTick(roughDTick, ONEHOUR, roundBase24); } else if (roughX2 > ONEMIN) { ax.dtick = roundDTick(roughDTick, ONEMIN, roundBase60); } else if (roughX2 > ONESEC) { ax.dtick = roundDTick(roughDTick, ONESEC, roundBase60); } else { base = getBase(10); ax.dtick = roundDTick(roughDTick, base, roundBase10); } } else if (ax.type === "log") { ax.tick0 = 0; var rng = Lib.simpleMap(ax.range, ax.r2l); if (ax._isMinor) { roughDTick *= 1.5; } if (roughDTick > 0.7) { ax.dtick = Math.ceil(roughDTick); } else if (Math.abs(rng[1] - rng[0]) < 1) { var nt2 = 1.5 * Math.abs((rng[1] - rng[0]) / roughDTick); roughDTick = Math.abs(Math.pow(10, rng[1]) - Math.pow(10, rng[0])) / nt2; base = getBase(10); ax.dtick = "L" + roundDTick(roughDTick, base, roundBase10); } else { ax.dtick = roughDTick > 0.3 ? "D2" : "D1"; } } else if (ax.type === "category" || ax.type === "multicategory") { ax.tick0 = 0; ax.dtick = Math.ceil(Math.max(roughDTick, 1)); } else if (isAngular(ax)) { ax.tick0 = 0; base = 1; ax.dtick = roundDTick(roughDTick, base, roundAngles); } else { ax.tick0 = 0; base = getBase(10); ax.dtick = roundDTick(roughDTick, base, roundBase10); } if (ax.dtick === 0) ax.dtick = 1; if (!isNumeric(ax.dtick) && typeof ax.dtick !== "string") { var olddtick = ax.dtick; ax.dtick = 1; throw "ax.dtick error: " + String(olddtick); } }; function autoTickRound(ax) { var dtick = ax.dtick; ax._tickexponent = 0; if (!isNumeric(dtick) && typeof dtick !== "string") { dtick = 1; } if (ax.type === "category" || ax.type === "multicategory") { ax._tickround = null; } if (ax.type === "date") { var tick0ms = ax.r2l(ax.tick0); var tick0str = ax.l2r(tick0ms).replace(/(^-|i)/g, ""); var tick0len = tick0str.length; if (String(dtick).charAt(0) === "M") { if (tick0len > 10 || tick0str.substr(5) !== "01-01") ax._tickround = "d"; else ax._tickround = +dtick.substr(1) % 12 === 0 ? "y" : "m"; } else if (dtick >= ONEDAY && tick0len <= 10 || dtick >= ONEDAY * 15) ax._tickround = "d"; else if (dtick >= ONEMIN && tick0len <= 16 || dtick >= ONEHOUR) ax._tickround = "M"; else if (dtick >= ONESEC && tick0len <= 19 || dtick >= ONEMIN) ax._tickround = "S"; else { var tick1len = ax.l2r(tick0ms + dtick).replace(/^-/, "").length; ax._tickround = Math.max(tick0len, tick1len) - 20; if (ax._tickround < 0) ax._tickround = 4; } } else if (isNumeric(dtick) || dtick.charAt(0) === "L") { var rng = ax.range.map(ax.r2d || Number); if (!isNumeric(dtick)) dtick = Number(dtick.substr(1)); ax._tickround = 2 - Math.floor(Math.log(dtick) / Math.LN10 + 0.01); var maxend = Math.max(Math.abs(rng[0]), Math.abs(rng[1])); var rangeexp = Math.floor(Math.log(maxend) / Math.LN10 + 0.01); var minexponent = ax.minexponent === void 0 ? 3 : ax.minexponent; if (Math.abs(rangeexp) > minexponent) { if (isSIFormat(ax.exponentformat) && !beyondSI(rangeexp)) { ax._tickexponent = 3 * Math.round((rangeexp - 1) / 3); } else ax._tickexponent = rangeexp; } } else { ax._tickround = null; } } axes.tickIncrement = function(x, dtick, axrev, calendar) { var axSign = axrev ? -1 : 1; if (isNumeric(dtick)) return Lib.increment(x, axSign * dtick); var tType = dtick.charAt(0); var dtSigned = axSign * Number(dtick.substr(1)); if (tType === "M") return Lib.incrementMonth(x, dtSigned, calendar); if (tType === "L") return Math.log(Math.pow(10, x) + dtSigned) / Math.LN10; if (tType === "D") { var tickset = dtick === "D2" ? roundLog2 : roundLog1; var x2 = x + axSign * 0.01; var frac = Lib.roundUp(Lib.mod(x2, 1), tickset, axrev); return Math.floor(x2) + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; } throw "unrecognized dtick " + String(dtick); }; axes.tickFirst = function(ax, opts) { var r2l = ax.r2l || Number; var rng = Lib.simpleMap(ax.range, r2l, void 0, void 0, opts); var axrev = rng[1] < rng[0]; var sRound = axrev ? Math.floor : Math.ceil; var r02 = expandRange(rng)[0]; var dtick = ax.dtick; var tick0 = r2l(ax.tick0); if (isNumeric(dtick)) { var tmin = sRound((r02 - tick0) / dtick) * dtick + tick0; if (ax.type === "category" || ax.type === "multicategory") { tmin = Lib.constrain(tmin, 0, ax._categories.length - 1); } return tmin; } var tType = dtick.charAt(0); var dtNum = Number(dtick.substr(1)); if (tType === "M") { var cnt = 0; var t03 = tick0; var t13, mult, newDTick; while (cnt < 10) { t13 = axes.tickIncrement(t03, dtick, axrev, ax.calendar); if ((t13 - r02) * (t03 - r02) <= 0) { if (axrev) return Math.min(t03, t13); return Math.max(t03, t13); } mult = (r02 - (t03 + t13) / 2) / (t13 - t03); newDTick = tType + (Math.abs(Math.round(mult)) || 1) * dtNum; t03 = axes.tickIncrement(t03, newDTick, mult < 0 ? !axrev : axrev, ax.calendar); cnt++; } Lib.error("tickFirst did not converge", ax); return t03; } else if (tType === "L") { return Math.log(sRound( (Math.pow(10, r02) - tick0) / dtNum ) * dtNum + tick0) / Math.LN10; } else if (tType === "D") { var tickset = dtick === "D2" ? roundLog2 : roundLog1; var frac = Lib.roundUp(Lib.mod(r02, 1), tickset, axrev); return Math.floor(r02) + Math.log(d3.round(Math.pow(10, frac), 1)) / Math.LN10; } else throw "unrecognized dtick " + String(dtick); }; axes.tickText = function(ax, x, hover, noSuffixPrefix) { var out = tickTextObj(ax, x); var arrayMode = ax.tickmode === "array"; var extraPrecision = hover || arrayMode; var axType = ax.type; var tickVal2l = axType === "category" ? ax.d2l_noadd : ax.d2l; var i; var inbounds = function(v) { var p = ax.l2p(v); return p >= 0 && p <= ax._length ? v : null; }; if (arrayMode && Lib.isArrayOrTypedArray(ax.ticktext)) { var rng = Lib.simpleMap(ax.range, ax.r2l); var minDiff = (Math.abs(rng[1] - rng[0]) - (ax._lBreaks || 0)) / 1e4; for (i = 0; i < ax.ticktext.length; i++) { if (Math.abs(x - tickVal2l(ax.tickvals[i])) < minDiff) break; } if (i < ax.ticktext.length) { out.text = String(ax.ticktext[i]); out.xbnd = [ inbounds(out.x - 0.5), inbounds(out.x + ax.dtick - 0.5) ]; return out; } } function isHidden(showAttr) { if (showAttr === void 0) return true; if (hover) return showAttr === "none"; var firstOrLast = { first: ax._tmin, last: ax._tmax }[showAttr]; return showAttr !== "all" && x !== firstOrLast; } var hideexp = hover ? "never" : ax.exponentformat !== "none" && isHidden(ax.showexponent) ? "hide" : ""; if (axType === "date") formatDate(ax, out, hover, extraPrecision); else if (axType === "log") formatLog(ax, out, hover, extraPrecision, hideexp); else if (axType === "category") formatCategory(ax, out); else if (axType === "multicategory") formatMultiCategory(ax, out, hover); else if (isAngular(ax)) formatAngle(ax, out, hover, extraPrecision, hideexp); else formatLinear(ax, out, hover, extraPrecision, hideexp); if (!noSuffixPrefix) { if (ax.tickprefix && !isHidden(ax.showtickprefix)) out.text = ax.tickprefix + out.text; if (ax.ticksuffix && !isHidden(ax.showticksuffix)) out.text += ax.ticksuffix; } if (ax.labelalias && ax.labelalias.hasOwnProperty(out.text)) { var t = ax.labelalias[out.text]; if (typeof t === "string") out.text = t; } if (ax.tickson === "boundaries" || ax.showdividers) { out.xbnd = [ inbounds(out.x - 0.5), inbounds(out.x + ax.dtick - 0.5) ]; } return out; }; axes.hoverLabelText = function(ax, values, hoverformat) { if (hoverformat) ax = Lib.extendFlat({}, ax, { hoverformat }); var val = Lib.isArrayOrTypedArray(values) ? values[0] : values; var val2 = Lib.isArrayOrTypedArray(values) ? values[1] : void 0; if (val2 !== void 0 && val2 !== val) { return axes.hoverLabelText(ax, val, hoverformat) + " - " + axes.hoverLabelText(ax, val2, hoverformat); } var logOffScale = ax.type === "log" && val <= 0; var tx = axes.tickText(ax, ax.c2l(logOffScale ? -val : val), "hover").text; if (logOffScale) { return val === 0 ? "0" : MINUS_SIGN + tx; } return tx; }; function tickTextObj(ax, x, text) { var tf2 = ax.tickfont || {}; return { x, dx: 0, dy: 0, text: text || "", fontSize: tf2.size, font: tf2.family, fontWeight: tf2.weight, fontStyle: tf2.style, fontVariant: tf2.variant, fontTextcase: tf2.textcase, fontLineposition: tf2.lineposition, fontShadow: tf2.shadow, fontColor: tf2.color }; } function formatDate(ax, out, hover, extraPrecision) { var tr2 = ax._tickround; var fmt = hover && ax.hoverformat || axes.getTickFormat(ax); extraPrecision = !fmt && extraPrecision; if (extraPrecision) { if (isNumeric(tr2)) tr2 = 4; else tr2 = { y: "m", m: "d", d: "M", M: "S", S: 4 }[tr2]; } var dateStr = Lib.formatDate(out.x, fmt, tr2, ax._dateFormat, ax.calendar, ax._extraFormat); var headStr; var splitIndex = dateStr.indexOf("\n"); if (splitIndex !== -1) { headStr = dateStr.substr(splitIndex + 1); dateStr = dateStr.substr(0, splitIndex); } if (extraPrecision) { if (headStr !== void 0 && (dateStr === "00:00:00" || dateStr === "00:00")) { dateStr = headStr; headStr = ""; } else if (dateStr.length === 8) { dateStr = dateStr.replace(/:00$/, ""); } } if (headStr) { if (hover) { if (tr2 === "d") dateStr += ", " + headStr; else dateStr = headStr + (dateStr ? ", " + dateStr : ""); } else { if (!ax._inCalcTicks || ax._prevDateHead !== headStr) { ax._prevDateHead = headStr; dateStr += "
" + headStr; } else { var isInside = insideTicklabelposition(ax); var side = ax._trueSide || ax.side; if (!isInside && side === "top" || isInside && side === "bottom") { dateStr += "
"; } } } } out.text = dateStr; } function formatLog(ax, out, hover, extraPrecision, hideexp) { var dtick = ax.dtick; var x = out.x; var tickformat = ax.tickformat; var dtChar0 = typeof dtick === "string" && dtick.charAt(0); if (hideexp === "never") { hideexp = ""; } if (extraPrecision && dtChar0 !== "L") { dtick = "L3"; dtChar0 = "L"; } if (tickformat || dtChar0 === "L") { out.text = numFormat(Math.pow(10, x), ax, hideexp, extraPrecision); } else if (isNumeric(dtick) || dtChar0 === "D" && Lib.mod(x + 0.01, 1) < 0.1) { var p = Math.round(x); var absP = Math.abs(p); var exponentFormat = ax.exponentformat; if (exponentFormat === "power" || isSIFormat(exponentFormat) && beyondSI(p)) { if (p === 0) out.text = 1; else if (p === 1) out.text = "10"; else out.text = "10" + (p > 1 ? "" : MINUS_SIGN) + absP + ""; out.fontSize *= 1.25; } else if ((exponentFormat === "e" || exponentFormat === "E") && absP > 2) { out.text = "1" + exponentFormat + (p > 0 ? "+" : MINUS_SIGN) + absP; } else { out.text = numFormat(Math.pow(10, x), ax, "", "fakehover"); if (dtick === "D1" && ax._id.charAt(0) === "y") { out.dy -= out.fontSize / 6; } } } else if (dtChar0 === "D") { out.text = String(Math.round(Math.pow(10, Lib.mod(x, 1)))); out.fontSize *= 0.75; } else throw "unrecognized dtick " + String(dtick); if (ax.dtick === "D1") { var firstChar = String(out.text).charAt(0); if (firstChar === "0" || firstChar === "1") { if (ax._id.charAt(0) === "y") { out.dx -= out.fontSize / 4; } else { out.dy += out.fontSize / 2; out.dx += (ax.range[1] > ax.range[0] ? 1 : -1) * out.fontSize * (x < 0 ? 0.5 : 0.25); } } } } function formatCategory(ax, out) { var tt = ax._categories[Math.round(out.x)]; if (tt === void 0) tt = ""; out.text = String(tt); } function formatMultiCategory(ax, out, hover) { var v = Math.round(out.x); var cats = ax._categories[v] || []; var tt = cats[1] === void 0 ? "" : String(cats[1]); var tt2 = cats[0] === void 0 ? "" : String(cats[0]); if (hover) { out.text = tt2 + " - " + tt; } else { out.text = tt; out.text2 = tt2; } } function formatLinear(ax, out, hover, extraPrecision, hideexp) { if (hideexp === "never") { hideexp = ""; } else if (ax.showexponent === "all" && Math.abs(out.x / ax.dtick) < 1e-6) { hideexp = "hide"; } out.text = numFormat(out.x, ax, hideexp, extraPrecision); } function formatAngle(ax, out, hover, extraPrecision, hideexp) { if (ax.thetaunit === "radians" && !hover) { var num = out.x / 180; if (num === 0) { out.text = "0"; } else { var frac = num2frac(num); if (frac[1] >= 100) { out.text = numFormat(Lib.deg2rad(out.x), ax, hideexp, extraPrecision); } else { var isNeg = out.x < 0; if (frac[1] === 1) { if (frac[0] === 1) out.text = "π"; else out.text = frac[0] + "π"; } else { out.text = [ "", frac[0], "", "⁄", "", frac[1], "", "π" ].join(""); } if (isNeg) out.text = MINUS_SIGN + out.text; } } } else { out.text = numFormat(out.x, ax, hideexp, extraPrecision); } } function num2frac(num) { function almostEq(a, b) { return Math.abs(a - b) <= 1e-6; } function findGCD(a, b) { return almostEq(b, 0) ? a : findGCD(b, a % b); } function findPrecision(n) { var e = 1; while (!almostEq(Math.round(n * e) / e, n)) { e *= 10; } return e; } var precision = findPrecision(num); var number = num * precision; var gcd = Math.abs(findGCD(number, precision)); return [ // numerator Math.round(number / gcd), // denominator Math.round(precision / gcd) ]; } var SIPREFIXES = ["f", "p", "n", "μ", "m", "", "k", "M", "G", "T"]; function isSIFormat(exponentFormat) { return exponentFormat === "SI" || exponentFormat === "B"; } function beyondSI(exponent) { return exponent > 14 || exponent < -15; } function numFormat(v, ax, fmtoverride, hover) { var isNeg = v < 0; var tickRound = ax._tickround; var exponentFormat = fmtoverride || ax.exponentformat || "B"; var exponent = ax._tickexponent; var tickformat = axes.getTickFormat(ax); var separatethousands = ax.separatethousands; if (hover) { var ah2 = { exponentformat: exponentFormat, minexponent: ax.minexponent, dtick: ax.showexponent === "none" ? ax.dtick : isNumeric(v) ? Math.abs(v) || 1 : 1, // if not showing any exponents, don't change the exponent // from what we calculate range: ax.showexponent === "none" ? ax.range.map(ax.r2d) : [0, v || 1] }; autoTickRound(ah2); tickRound = (Number(ah2._tickround) || 0) + 4; exponent = ah2._tickexponent; if (ax.hoverformat) tickformat = ax.hoverformat; } if (tickformat) return ax._numFormat(tickformat)(v).replace(/-/g, MINUS_SIGN); var e = Math.pow(10, -tickRound) / 2; if (exponentFormat === "none") exponent = 0; v = Math.abs(v); if (v < e) { v = "0"; isNeg = false; } else { v += e; if (exponent) { v *= Math.pow(10, -exponent); tickRound += exponent; } if (tickRound === 0) v = String(Math.floor(v)); else if (tickRound < 0) { v = String(Math.round(v)); v = v.substr(0, v.length + tickRound); for (var i = tickRound; i < 0; i++) v += "0"; } else { v = String(v); var dp2 = v.indexOf(".") + 1; if (dp2) v = v.substr(0, dp2 + tickRound).replace(/\.?0+$/, ""); } v = Lib.numSeparate(v, ax._separators, separatethousands); } if (exponent && exponentFormat !== "hide") { if (isSIFormat(exponentFormat) && beyondSI(exponent)) exponentFormat = "power"; var signedExponent; if (exponent < 0) signedExponent = MINUS_SIGN + -exponent; else if (exponentFormat !== "power") signedExponent = "+" + exponent; else signedExponent = String(exponent); if (exponentFormat === "e" || exponentFormat === "E") { v += exponentFormat + signedExponent; } else if (exponentFormat === "power") { v += "×10" + signedExponent + ""; } else if (exponentFormat === "B" && exponent === 9) { v += "B"; } else if (isSIFormat(exponentFormat)) { v += SIPREFIXES[exponent / 3 + 5]; } } if (isNeg) return MINUS_SIGN + v; return v; } axes.getTickFormat = function(ax) { var i; function convertToMs(dtick) { return typeof dtick !== "string" ? dtick : Number(dtick.replace("M", "")) * ONEAVGMONTH; } function compareLogTicks(left, right) { var priority = ["L", "D"]; if (typeof left === typeof right) { if (typeof left === "number") { return left - right; } else { var leftPriority = priority.indexOf(left.charAt(0)); var rightPriority = priority.indexOf(right.charAt(0)); if (leftPriority === rightPriority) { return Number(left.replace(/(L|D)/g, "")) - Number(right.replace(/(L|D)/g, "")); } else { return leftPriority - rightPriority; } } } else { return typeof left === "number" ? 1 : -1; } } function isProperStop(dtick, range, convert) { var convertFn = convert || function(x) { return x; }; var leftDtick = range[0]; var rightDtick = range[1]; return (!leftDtick && typeof leftDtick !== "number" || convertFn(leftDtick) <= convertFn(dtick)) && (!rightDtick && typeof rightDtick !== "number" || convertFn(rightDtick) >= convertFn(dtick)); } function isProperLogStop(dtick, range) { var isLeftDtickNull = range[0] === null; var isRightDtickNull = range[1] === null; var isDtickInRangeLeft = compareLogTicks(dtick, range[0]) >= 0; var isDtickInRangeRight = compareLogTicks(dtick, range[1]) <= 0; return (isLeftDtickNull || isDtickInRangeLeft) && (isRightDtickNull || isDtickInRangeRight); } var tickstop, stopi; if (ax.tickformatstops && ax.tickformatstops.length > 0) { switch (ax.type) { case "date": case "linear": { for (i = 0; i < ax.tickformatstops.length; i++) { stopi = ax.tickformatstops[i]; if (stopi.enabled && isProperStop(ax.dtick, stopi.dtickrange, convertToMs)) { tickstop = stopi; break; } } break; } case "log": { for (i = 0; i < ax.tickformatstops.length; i++) { stopi = ax.tickformatstops[i]; if (stopi.enabled && isProperLogStop(ax.dtick, stopi.dtickrange)) { tickstop = stopi; break; } } break; } default: } } return tickstop ? tickstop.value : ax.tickformat; }; axes.getSubplots = function(gd2, ax) { var subplotObj = gd2._fullLayout._subplots; var allSubplots = subplotObj.cartesian.concat(subplotObj.gl2d || []); var out = ax ? axes.findSubplotsWithAxis(allSubplots, ax) : allSubplots; out.sort(function(a, b) { var aParts = a.substr(1).split("y"); var bParts = b.substr(1).split("y"); if (aParts[0] === bParts[0]) return +aParts[1] - +bParts[1]; return +aParts[0] - +bParts[0]; }); return out; }; axes.findSubplotsWithAxis = function(subplots, ax) { var axMatch = new RegExp( ax._id.charAt(0) === "x" ? "^" + ax._id + "y" : ax._id + "$" ); var subplotsWithAx = []; for (var i = 0; i < subplots.length; i++) { var sp2 = subplots[i]; if (axMatch.test(sp2)) subplotsWithAx.push(sp2); } return subplotsWithAx; }; axes.makeClipPaths = function(gd2) { var fullLayout = gd2._fullLayout; if (fullLayout._hasOnlyLargeSploms) return; var fullWidth = { _offset: 0, _length: fullLayout.width, _id: "" }; var fullHeight = { _offset: 0, _length: fullLayout.height, _id: "" }; var xaList = axes.list(gd2, "x", true); var yaList = axes.list(gd2, "y", true); var clipList = []; var i, j; for (i = 0; i < xaList.length; i++) { clipList.push({ x: xaList[i], y: fullHeight }); for (j = 0; j < yaList.length; j++) { if (i === 0) clipList.push({ x: fullWidth, y: yaList[j] }); clipList.push({ x: xaList[i], y: yaList[j] }); } } var axClips = fullLayout._clips.selectAll(".axesclip").data(clipList, function(d) { return d.x._id + d.y._id; }); axClips.enter().append("clipPath").classed("axesclip", true).attr("id", function(d) { return "clip" + fullLayout._uid + d.x._id + d.y._id; }).append("rect"); axClips.exit().remove(); axClips.each(function(d) { d3.select(this).select("rect").attr({ x: d.x._offset || 0, y: d.y._offset || 0, width: d.x._length || 1, height: d.y._length || 1 }); }); }; axes.draw = function(gd2, arg, opts) { var fullLayout = gd2._fullLayout; if (arg === "redraw") { fullLayout._paper.selectAll("g.subplot").each(function(d) { var id2 = d[0]; var plotinfo = fullLayout._plots[id2]; if (plotinfo) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; plotinfo.xaxislayer.selectAll("." + xa2._id + "tick").remove(); plotinfo.yaxislayer.selectAll("." + ya2._id + "tick").remove(); plotinfo.xaxislayer.selectAll("." + xa2._id + "tick2").remove(); plotinfo.yaxislayer.selectAll("." + ya2._id + "tick2").remove(); plotinfo.xaxislayer.selectAll("." + xa2._id + "divider").remove(); plotinfo.yaxislayer.selectAll("." + ya2._id + "divider").remove(); if (plotinfo.minorGridlayer) plotinfo.minorGridlayer.selectAll("path").remove(); if (plotinfo.gridlayer) plotinfo.gridlayer.selectAll("path").remove(); if (plotinfo.zerolinelayer) plotinfo.zerolinelayer.selectAll("path").remove(); fullLayout._infolayer.select(".g-" + xa2._id + "title").remove(); fullLayout._infolayer.select(".g-" + ya2._id + "title").remove(); } }); } var axList = !arg || arg === "redraw" ? axes.listIds(gd2) : arg; var fullAxList = axes.list(gd2); var overlayingShiftedAx = fullAxList.filter(function(ax) { return ax.autoshift; }).map(function(ax) { return ax.overlaying; }); axList.map(function(axId) { var ax = axes.getFromId(gd2, axId); if (ax.tickmode === "sync" && ax.overlaying) { var overlayingIndex = axList.findIndex(function(axis) { return axis === ax.overlaying; }); if (overlayingIndex >= 0) { axList.unshift(axList.splice(overlayingIndex, 1).shift()); } } }); var axShifts = { false: { left: 0, right: 0 } }; return Lib.syncOrAsync(axList.map(function(axId) { return function() { if (!axId) return; var ax = axes.getFromId(gd2, axId); if (!opts) opts = {}; opts.axShifts = axShifts; opts.overlayingShiftedAx = overlayingShiftedAx; var axDone = axes.drawOne(gd2, ax, opts); if (ax._shiftPusher) { incrementShift(ax, ax._fullDepth || 0, axShifts, true); } ax._r = ax.range.slice(); ax._rl = Lib.simpleMap(ax._r, ax.r2l); return axDone; }; })); }; axes.drawOne = function(gd2, ax, opts) { opts = opts || {}; var axShifts = opts.axShifts || {}; var overlayingShiftedAx = opts.overlayingShiftedAx || []; var i, sp2, plotinfo; ax.setScale(); var fullLayout = gd2._fullLayout; var axId = ax._id; var axLetter = axId.charAt(0); var counterLetter = axes.counterLetter(axId); var mainPlotinfo = fullLayout._plots[ax._mainSubplot]; if (!mainPlotinfo) return; ax._shiftPusher = ax.autoshift || overlayingShiftedAx.indexOf(ax._id) !== -1 || overlayingShiftedAx.indexOf(ax.overlaying) !== -1; if (ax._shiftPusher & ax.anchor === "free") { var selfPush = ax.linewidth / 2 || 0; if (ax.ticks === "inside") { selfPush += ax.ticklen; } incrementShift(ax, selfPush, axShifts, true); incrementShift(ax, ax.shift || 0, axShifts, false); } if (opts.skipTitle !== true || ax._shift === void 0) ax._shift = setShiftVal(ax, axShifts); var mainAxLayer = mainPlotinfo[axLetter + "axislayer"]; var mainLinePosition = ax._mainLinePosition; var mainLinePositionShift = mainLinePosition += ax._shift; var mainMirrorPosition = ax._mainMirrorPosition; var vals = ax._vals = axes.calcTicks(ax); var axInfo = [ax.mirror, mainLinePositionShift, mainMirrorPosition].join("_"); for (i = 0; i < vals.length; i++) { vals[i].axInfo = axInfo; } ax._selections = {}; if (ax._tickAngles) ax._prevTickAngles = ax._tickAngles; ax._tickAngles = {}; ax._depth = null; var llbboxes = {}; function getLabelLevelBbox(suffix) { var cls = axId + (suffix || "tick"); if (!llbboxes[cls]) llbboxes[cls] = calcLabelLevelBbox(ax, cls, mainLinePositionShift); return llbboxes[cls]; } if (!ax.visible) return; var transTickFn = axes.makeTransTickFn(ax); var transTickLabelFn = axes.makeTransTickLabelFn(ax); var tickVals; var valsClipped; var insideTicks = ax.ticks === "inside"; var outsideTicks = ax.ticks === "outside"; if (ax.tickson === "boundaries") { var boundaryVals = getBoundaryVals(ax, vals); valsClipped = axes.clipEnds(ax, boundaryVals); tickVals = insideTicks ? valsClipped : boundaryVals; } else { valsClipped = axes.clipEnds(ax, vals); tickVals = insideTicks && ax.ticklabelmode !== "period" ? valsClipped : vals; } var gridVals = ax._gridVals = valsClipped; var dividerVals = getDividerVals(ax, vals); if (!fullLayout._hasOnlyLargeSploms) { var subplotsWithAx = ax._subplotsWith; var finishedGrids = {}; for (i = 0; i < subplotsWithAx.length; i++) { sp2 = subplotsWithAx[i]; plotinfo = fullLayout._plots[sp2]; var counterAxis = plotinfo[counterLetter + "axis"]; var mainCounterID = counterAxis._mainAxis._id; if (finishedGrids[mainCounterID]) continue; finishedGrids[mainCounterID] = 1; var gridPath = axLetter === "x" ? "M0," + counterAxis._offset + "v" + counterAxis._length : "M" + counterAxis._offset + ",0h" + counterAxis._length; axes.drawGrid(gd2, ax, { vals: gridVals, counterAxis, layer: plotinfo.gridlayer.select("." + axId), minorLayer: plotinfo.minorGridlayer.select("." + axId), path: gridPath, transFn: transTickFn }); axes.drawZeroLine(gd2, ax, { counterAxis, layer: plotinfo.zerolinelayer, path: gridPath, transFn: transTickFn }); } } var tickPath; var majorTickSigns = axes.getTickSigns(ax); var minorTickSigns = axes.getTickSigns(ax, "minor"); if (ax.ticks || ax.minor && ax.minor.ticks) { var majorTickPath = axes.makeTickPath(ax, mainLinePositionShift, majorTickSigns[2]); var minorTickPath = axes.makeTickPath(ax, mainLinePositionShift, minorTickSigns[2], { minor: true }); var mirrorMajorTickPath; var mirrorMinorTickPath; var fullMajorTickPath; var fullMinorTickPath; if (ax._anchorAxis && ax.mirror && ax.mirror !== true) { mirrorMajorTickPath = axes.makeTickPath(ax, mainMirrorPosition, majorTickSigns[3]); mirrorMinorTickPath = axes.makeTickPath(ax, mainMirrorPosition, minorTickSigns[3], { minor: true }); fullMajorTickPath = majorTickPath + mirrorMajorTickPath; fullMinorTickPath = minorTickPath + mirrorMinorTickPath; } else { mirrorMajorTickPath = ""; mirrorMinorTickPath = ""; fullMajorTickPath = majorTickPath; fullMinorTickPath = minorTickPath; } if (ax.showdividers && outsideTicks && ax.tickson === "boundaries") { var dividerLookup = {}; for (i = 0; i < dividerVals.length; i++) { dividerLookup[dividerVals[i].x] = 1; } tickPath = function(d) { return dividerLookup[d.x] ? mirrorMajorTickPath : fullMajorTickPath; }; } else { tickPath = function(d) { return d.minor ? fullMinorTickPath : fullMajorTickPath; }; } } axes.drawTicks(gd2, ax, { vals: tickVals, layer: mainAxLayer, path: tickPath, transFn: transTickFn }); if (ax.mirror === "allticks") { var tickSubplots = Object.keys(ax._linepositions || {}); for (i = 0; i < tickSubplots.length; i++) { sp2 = tickSubplots[i]; plotinfo = fullLayout._plots[sp2]; var linepositions = ax._linepositions[sp2] || []; var p02 = linepositions[0]; var p12 = linepositions[1]; var isMinor = linepositions[2]; var spTickPath = axes.makeTickPath( ax, p02, isMinor ? majorTickSigns[0] : minorTickSigns[0], { minor: isMinor } ) + axes.makeTickPath( ax, p12, isMinor ? majorTickSigns[1] : minorTickSigns[1], { minor: isMinor } ); axes.drawTicks(gd2, ax, { vals: tickVals, layer: plotinfo[axLetter + "axislayer"], path: spTickPath, transFn: transTickFn }); } } var seq = []; seq.push(function() { return axes.drawLabels(gd2, ax, { vals, layer: mainAxLayer, plotinfo, transFn: transTickLabelFn, labelFns: axes.makeLabelFns(ax, mainLinePositionShift) }); }); if (ax.type === "multicategory") { var pad2 = { x: 2, y: 10 }[axLetter]; seq.push(function() { var bboxKey = { x: "height", y: "width" }[axLetter]; var standoff = getLabelLevelBbox()[bboxKey] + pad2 + (ax._tickAngles[axId + "tick"] ? ax.tickfont.size * LINE_SPACING : 0); return axes.drawLabels(gd2, ax, { vals: getSecondaryLabelVals(ax, vals), layer: mainAxLayer, cls: axId + "tick2", repositionOnUpdate: true, secondary: true, transFn: transTickFn, labelFns: axes.makeLabelFns(ax, mainLinePositionShift + standoff * majorTickSigns[4]) }); }); seq.push(function() { ax._depth = majorTickSigns[4] * (getLabelLevelBbox("tick2")[ax.side] - mainLinePositionShift); return drawDividers(gd2, ax, { vals: dividerVals, layer: mainAxLayer, path: axes.makeTickPath(ax, mainLinePositionShift, majorTickSigns[4], { len: ax._depth }), transFn: transTickFn }); }); } else if (ax.title.hasOwnProperty("standoff")) { seq.push(function() { ax._depth = majorTickSigns[4] * (getLabelLevelBbox()[ax.side] - mainLinePositionShift); }); } var hasRangeSlider = Registry.getComponentMethod("rangeslider", "isVisible")(ax); if (!opts.skipTitle && !(hasRangeSlider && ax.side === "bottom")) { seq.push(function() { return drawTitle(gd2, ax); }); } seq.push(function() { var s = ax.side.charAt(0); var sMirror = OPPOSITE_SIDE[ax.side].charAt(0); var pos = axes.getPxPosition(gd2, ax); var outsideTickLen = outsideTicks ? ax.ticklen : 0; var llbbox; var push; var mirrorPush; var rangeSliderPush; if (ax.automargin || hasRangeSlider || ax._shiftPusher) { if (ax.type === "multicategory") { llbbox = getLabelLevelBbox("tick2"); } else { llbbox = getLabelLevelBbox(); if (axLetter === "x" && s === "b") { ax._depth = Math.max(llbbox.width > 0 ? llbbox.bottom - pos : 0, outsideTickLen); } } } var axDepth = 0; var titleDepth = 0; if (ax._shiftPusher) { axDepth = Math.max( outsideTickLen, llbbox.height > 0 ? s === "l" ? pos - llbbox.left : llbbox.right - pos : 0 ); if (ax.title.text !== fullLayout._dfltTitle[axLetter]) { titleDepth = (ax._titleStandoff || 0) + (ax._titleScoot || 0); if (s === "l") { titleDepth += approxTitleDepth(ax); } } ax._fullDepth = Math.max(axDepth, titleDepth); } if (ax.automargin) { push = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 }; var domainIndices = [0, 1]; var shift = typeof ax._shift === "number" ? ax._shift : 0; if (axLetter === "x") { if (s === "b") { push[s] = ax._depth; } else { push[s] = ax._depth = Math.max(llbbox.width > 0 ? pos - llbbox.top : 0, outsideTickLen); domainIndices.reverse(); } if (llbbox.width > 0) { var rExtra = llbbox.right - (ax._offset + ax._length); if (rExtra > 0) { push.xr = 1; push.r = rExtra; } var lExtra = ax._offset - llbbox.left; if (lExtra > 0) { push.xl = 0; push.l = lExtra; } } } else { if (s === "l") { ax._depth = Math.max(llbbox.height > 0 ? pos - llbbox.left : 0, outsideTickLen); push[s] = ax._depth - shift; } else { ax._depth = Math.max(llbbox.height > 0 ? llbbox.right - pos : 0, outsideTickLen); push[s] = ax._depth + shift; domainIndices.reverse(); } if (llbbox.height > 0) { var bExtra = llbbox.bottom - (ax._offset + ax._length); if (bExtra > 0) { push.yb = 0; push.b = bExtra; } var tExtra = ax._offset - llbbox.top; if (tExtra > 0) { push.yt = 1; push.t = tExtra; } } } push[counterLetter] = ax.anchor === "free" ? ax.position : ax._anchorAxis.domain[domainIndices[0]]; if (ax.title.text !== fullLayout._dfltTitle[axLetter]) { push[s] += approxTitleDepth(ax) + (ax.title.standoff || 0); } if (ax.mirror && ax.anchor !== "free") { mirrorPush = { x: 0, y: 0, r: 0, l: 0, t: 0, b: 0 }; mirrorPush[sMirror] = ax.linewidth; if (ax.mirror && ax.mirror !== true) mirrorPush[sMirror] += outsideTickLen; if (ax.mirror === true || ax.mirror === "ticks") { mirrorPush[counterLetter] = ax._anchorAxis.domain[domainIndices[1]]; } else if (ax.mirror === "all" || ax.mirror === "allticks") { mirrorPush[counterLetter] = [ax._counterDomainMin, ax._counterDomainMax][domainIndices[1]]; } } } if (hasRangeSlider) { rangeSliderPush = Registry.getComponentMethod("rangeslider", "autoMarginOpts")(gd2, ax); } if (typeof ax.automargin === "string") { filterPush(push, ax.automargin); filterPush(mirrorPush, ax.automargin); } Plots.autoMargin(gd2, axAutoMarginID(ax), push); Plots.autoMargin(gd2, axMirrorAutoMarginID(ax), mirrorPush); Plots.autoMargin(gd2, rangeSliderAutoMarginID(ax), rangeSliderPush); }); return Lib.syncOrAsync(seq); }; function filterPush(push, automargin) { if (!push) return; var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) { if (automargin.indexOf(nextKey) !== -1) { MARGIN_MAPPING[nextKey].forEach(function(key) { data[key] = 1; }); } return data; }, {}); Object.keys(push).forEach(function(key) { if (!keepMargin[key]) { if (key.length === 1) push[key] = 0; else delete push[key]; } }); } function getBoundaryVals(ax, vals) { var out = []; var i; var _push = function(d, bndIndex) { var xb = d.xbnd[bndIndex]; if (xb !== null) { out.push(Lib.extendFlat({}, d, { x: xb })); } }; if (vals.length) { for (i = 0; i < vals.length; i++) { _push(vals[i], 0); } _push(vals[i - 1], 1); } return out; } function getSecondaryLabelVals(ax, vals) { var out = []; var lookup2 = {}; for (var i = 0; i < vals.length; i++) { var d = vals[i]; if (lookup2[d.text2]) { lookup2[d.text2].push(d.x); } else { lookup2[d.text2] = [d.x]; } } for (var k in lookup2) { out.push(tickTextObj(ax, Lib.interp(lookup2[k], 0.5), k)); } return out; } function getDividerVals(ax, vals) { var out = []; var i, current; var reversed = vals.length && vals[vals.length - 1].x < vals[0].x; var _push = function(d2, bndIndex) { var xb = d2.xbnd[bndIndex]; if (xb !== null) { out.push(Lib.extendFlat({}, d2, { x: xb })); } }; if (ax.showdividers && vals.length) { for (i = 0; i < vals.length; i++) { var d = vals[i]; if (d.text2 !== current) { _push(d, reversed ? 1 : 0); } current = d.text2; } _push(vals[i - 1], reversed ? 0 : 1); } return out; } function calcLabelLevelBbox(ax, cls, mainLinePositionShift) { var top, bottom; var left, right; if (ax._selections[cls].size()) { top = Infinity; bottom = -Infinity; left = Infinity; right = -Infinity; ax._selections[cls].each(function() { var thisLabel = selectTickLabel(this); var bb = Drawing.bBox(thisLabel.node().parentNode); top = Math.min(top, bb.top); bottom = Math.max(bottom, bb.bottom); left = Math.min(left, bb.left); right = Math.max(right, bb.right); }); } else { var dummyCalc = axes.makeLabelFns(ax, mainLinePositionShift); top = bottom = dummyCalc.yFn({ dx: 0, dy: 0, fontSize: 0 }); left = right = dummyCalc.xFn({ dx: 0, dy: 0, fontSize: 0 }); } return { top, bottom, left, right, height: bottom - top, width: right - left }; } axes.getTickSigns = function(ax, minor) { var axLetter = ax._id.charAt(0); var sideOpposite = { x: "top", y: "right" }[axLetter]; var main = ax.side === sideOpposite ? 1 : -1; var out = [-1, 1, main, -main]; var ticks = minor ? (ax.minor || {}).ticks : ax.ticks; if (ticks !== "inside" === (axLetter === "x")) { out = out.map(function(v) { return -v; }); } if (ax.side) { out.push({ l: -1, t: -1, r: 1, b: 1 }[ax.side.charAt(0)]); } return out; }; axes.makeTransTickFn = function(ax) { return ax._id.charAt(0) === "x" ? function(d) { return strTranslate(ax._offset + ax.l2p(d.x), 0); } : function(d) { return strTranslate(0, ax._offset + ax.l2p(d.x)); }; }; axes.makeTransTickLabelFn = function(ax) { var uv2 = getTickLabelUV(ax); var shift = ax.ticklabelshift || 0; var standoff = ax.ticklabelstandoff || 0; var u = uv2[0]; var v = uv2[1]; var isReversed = ax.range[0] > ax.range[1]; var labelsInside = ax.ticklabelposition && ax.ticklabelposition.indexOf("inside") !== -1; var labelsOutside = !labelsInside; if (shift) { var shiftSign = isReversed ? -1 : 1; shift = shift * shiftSign; } if (standoff) { var side = ax.side; var standoffSign = labelsInside && (side === "top" || side === "left") || labelsOutside && (side === "bottom" || side === "right") ? 1 : -1; standoff = standoff * standoffSign; } return ax._id.charAt(0) === "x" ? function(d) { return strTranslate( u + ax._offset + ax.l2p(getPosX(d)) + shift, v + standoff ); } : function(d) { return strTranslate( v + standoff, u + ax._offset + ax.l2p(getPosX(d)) + shift ); }; }; function getPosX(d) { return d.periodX !== void 0 ? d.periodX : d.x; } function getTickLabelUV(ax) { var ticklabelposition = ax.ticklabelposition || ""; var has = function(str) { return ticklabelposition.indexOf(str) !== -1; }; var isTop = has("top"); var isLeft = has("left"); var isRight = has("right"); var isBottom = has("bottom"); var isInside = has("inside"); var isAligned = isBottom || isLeft || isTop || isRight; if (!isAligned && !isInside) return [0, 0]; var side = ax.side; var u = isAligned ? (ax.tickwidth || 0) / 2 : 0; var v = TEXTPAD; var fontSize = ax.tickfont ? ax.tickfont.size : 12; if (isBottom || isTop) { u += fontSize * CAP_SHIFT; v += (ax.linewidth || 0) / 2; } if (isLeft || isRight) { u += (ax.linewidth || 0) / 2; v += TEXTPAD; } if (isInside && side === "top") { v -= fontSize * (1 - CAP_SHIFT); } if (isLeft || isTop) u = -u; if (side === "bottom" || side === "right") v = -v; return [ isAligned ? u : 0, isInside ? v : 0 ]; } axes.makeTickPath = function(ax, shift, sgn, opts) { if (!opts) opts = {}; var minor = opts.minor; if (minor && !ax.minor) return ""; var len = opts.len !== void 0 ? opts.len : minor ? ax.minor.ticklen : ax.ticklen; var axLetter = ax._id.charAt(0); var pad2 = (ax.linewidth || 1) / 2; return axLetter === "x" ? "M0," + (shift + pad2 * sgn) + "v" + len * sgn : "M" + (shift + pad2 * sgn) + ",0h" + len * sgn; }; axes.makeLabelFns = function(ax, shift, angle) { var ticklabelposition = ax.ticklabelposition || ""; var has = function(str) { return ticklabelposition.indexOf(str) !== -1; }; var isTop = has("top"); var isLeft = has("left"); var isRight = has("right"); var isBottom = has("bottom"); var isAligned = isBottom || isLeft || isTop || isRight; var insideTickLabels = has("inside"); var labelsOverTicks = ticklabelposition === "inside" && ax.ticks === "inside" || !insideTickLabels && ax.ticks === "outside" && ax.tickson !== "boundaries"; var labelStandoff = 0; var labelShift = 0; var tickLen = labelsOverTicks ? ax.ticklen : 0; if (insideTickLabels) { tickLen *= -1; } else if (isAligned) { tickLen = 0; } if (labelsOverTicks) { labelStandoff += tickLen; if (angle) { var rad = Lib.deg2rad(angle); labelStandoff = tickLen * Math.cos(rad) + 1; labelShift = tickLen * Math.sin(rad); } } if (ax.showticklabels && (labelsOverTicks || ax.showline)) { labelStandoff += 0.2 * ax.tickfont.size; } labelStandoff += (ax.linewidth || 1) / 2 * (insideTickLabels ? -1 : 1); var out = { labelStandoff, labelShift }; var x02, y02, ff2, flipIt; var xQ = 0; var side = ax.side; var axLetter = ax._id.charAt(0); var tickangle = ax.tickangle; var endSide; if (axLetter === "x") { endSide = !insideTickLabels && side === "bottom" || insideTickLabels && side === "top"; flipIt = endSide ? 1 : -1; if (insideTickLabels) flipIt *= -1; x02 = labelShift * flipIt; y02 = shift + labelStandoff * flipIt; ff2 = endSide ? 1 : -0.2; if (Math.abs(tickangle) === 90) { if (insideTickLabels) { ff2 += MID_SHIFT; } else { if (tickangle === -90 && side === "bottom") { ff2 = CAP_SHIFT; } else if (tickangle === 90 && side === "top") { ff2 = MID_SHIFT; } else { ff2 = 0.5; } } xQ = MID_SHIFT / 2 * (tickangle / 90); } out.xFn = function(d) { return d.dx + x02 + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y02 + d.fontSize * ff2; }; out.anchorFn = function(d, a) { if (isAligned) { if (isLeft) return "end"; if (isRight) return "start"; } if (!isNumeric(a) || a === 0 || a === 180) { return "middle"; } return a * flipIt < 0 !== insideTickLabels ? "end" : "start"; }; out.heightFn = function(d, a, h) { return a < -60 || a > 60 ? -0.5 * h : ax.side === "top" !== insideTickLabels ? -h : 0; }; } else if (axLetter === "y") { endSide = !insideTickLabels && side === "left" || insideTickLabels && side === "right"; flipIt = endSide ? 1 : -1; if (insideTickLabels) flipIt *= -1; x02 = labelStandoff; y02 = labelShift * flipIt; ff2 = 0; if (!insideTickLabels && Math.abs(tickangle) === 90) { if (tickangle === -90 && side === "left" || tickangle === 90 && side === "right") { ff2 = CAP_SHIFT; } else { ff2 = 0.5; } } if (insideTickLabels) { var ang = isNumeric(tickangle) ? +tickangle : 0; if (ang !== 0) { var rA = Lib.deg2rad(ang); xQ = Math.abs(Math.sin(rA)) * CAP_SHIFT * flipIt; ff2 = 0; } } out.xFn = function(d) { return d.dx + shift - (x02 + d.fontSize * ff2) * flipIt + xQ * d.fontSize; }; out.yFn = function(d) { return d.dy + y02 + d.fontSize * MID_SHIFT; }; out.anchorFn = function(d, a) { if (isNumeric(a) && Math.abs(a) === 90) { return "middle"; } return endSide ? "end" : "start"; }; out.heightFn = function(d, a, h) { if (ax.side === "right") a *= -1; return a < -30 ? -h : a < 30 ? -0.5 * h : 0; }; } return out; }; function tickDataFn(d) { return [d.text, d.x, d.axInfo, d.font, d.fontSize, d.fontColor].join("_"); } axes.drawTicks = function(gd2, ax, opts) { opts = opts || {}; var cls = ax._id + "tick"; var vals = [].concat( ax.minor && ax.minor.ticks ? ( // minor vals opts.vals.filter(function(d) { return d.minor && !d.noTick; }) ) : [] ).concat( ax.ticks ? ( // major vals opts.vals.filter(function(d) { return !d.minor && !d.noTick; }) ) : [] ); var ticks = opts.layer.selectAll("path." + cls).data(vals, tickDataFn); ticks.exit().remove(); ticks.enter().append("path").classed(cls, 1).classed("ticks", 1).classed("crisp", opts.crisp !== false).each(function(d) { return Color.stroke(d3.select(this), d.minor ? ax.minor.tickcolor : ax.tickcolor); }).style("stroke-width", function(d) { return Drawing.crispRound( gd2, d.minor ? ax.minor.tickwidth : ax.tickwidth, 1 ) + "px"; }).attr("d", opts.path).style("display", null); hideCounterAxisInsideTickLabels(ax, [TICK_PATH]); ticks.attr("transform", opts.transFn); }; axes.drawGrid = function(gd2, ax, opts) { opts = opts || {}; if (ax.tickmode === "sync") { return; } var cls = ax._id + "grid"; var hasMinor = ax.minor && ax.minor.showgrid; var minorVals = hasMinor ? opts.vals.filter(function(d) { return d.minor; }) : []; var majorVals = ax.showgrid ? opts.vals.filter(function(d) { return !d.minor; }) : []; var counterAx = opts.counterAxis; if (counterAx && axes.shouldShowZeroLine(gd2, ax, counterAx)) { var isArrayMode = ax.tickmode === "array"; for (var i = 0; i < majorVals.length; i++) { var xi2 = majorVals[i].x; if (isArrayMode ? !xi2 : Math.abs(xi2) < ax.dtick / 100) { majorVals = majorVals.slice(0, i).concat(majorVals.slice(i + 1)); if (isArrayMode) i--; else break; } } } ax._gw = Drawing.crispRound(gd2, ax.gridwidth, 1); var wMinor = !hasMinor ? 0 : Drawing.crispRound(gd2, ax.minor.gridwidth, 1); var majorLayer = opts.layer; var minorLayer = opts.minorLayer; for (var major = 1; major >= 0; major--) { var layer = major ? majorLayer : minorLayer; if (!layer) continue; var grid = layer.selectAll("path." + cls).data(major ? majorVals : minorVals, tickDataFn); grid.exit().remove(); grid.enter().append("path").classed(cls, 1).classed("crisp", opts.crisp !== false); grid.attr("transform", opts.transFn).attr("d", opts.path).each(function(d) { return Color.stroke( d3.select(this), d.minor ? ax.minor.gridcolor : ax.gridcolor || "#ddd" ); }).style("stroke-dasharray", function(d) { return Drawing.dashStyle( d.minor ? ax.minor.griddash : ax.griddash, d.minor ? ax.minor.gridwidth : ax.gridwidth ); }).style("stroke-width", function(d) { return (d.minor ? wMinor : ax._gw) + "px"; }).style("display", null); if (typeof opts.path === "function") grid.attr("d", opts.path); } hideCounterAxisInsideTickLabels(ax, [GRID_PATH, MINORGRID_PATH]); }; axes.drawZeroLine = function(gd2, ax, opts) { opts = opts || opts; var cls = ax._id + "zl"; var show = axes.shouldShowZeroLine(gd2, ax, opts.counterAxis); var zl2 = opts.layer.selectAll("path." + cls).data(show ? [{ x: 0, id: ax._id }] : []); zl2.exit().remove(); zl2.enter().append("path").classed(cls, 1).classed("zl", 1).classed("crisp", opts.crisp !== false).each(function() { opts.layer.selectAll("path").sort(function(da2, db) { return idSort(da2.id, db.id); }); }); zl2.attr("transform", opts.transFn).attr("d", opts.path).call(Color.stroke, ax.zerolinecolor || Color.defaultLine).style("stroke-width", Drawing.crispRound(gd2, ax.zerolinewidth, ax._gw || 1) + "px").style("display", null); hideCounterAxisInsideTickLabels(ax, [ZERO_PATH]); }; axes.drawLabels = function(gd2, ax, opts) { opts = opts || {}; var fullLayout = gd2._fullLayout; var axId = ax._id; var cls = opts.cls || axId + "tick"; var vals = opts.vals.filter(function(d) { return d.text; }); var labelFns = opts.labelFns; var tickAngle = opts.secondary ? 0 : ax.tickangle; var prevAngle = (ax._prevTickAngles || {})[cls]; var tickLabels = opts.layer.selectAll("g." + cls).data(ax.showticklabels ? vals : [], tickDataFn); var labelsReady = []; tickLabels.enter().append("g").classed(cls, 1).append("text").attr("text-anchor", "middle").each(function(d) { var thisLabel = d3.select(this); var newPromise = gd2._promises.length; thisLabel.call(svgTextUtils.positionText, labelFns.xFn(d), labelFns.yFn(d)).call(Drawing.font, { family: d.font, size: d.fontSize, color: d.fontColor, weight: d.fontWeight, style: d.fontStyle, variant: d.fontVariant, textcase: d.fontTextcase, lineposition: d.fontLineposition, shadow: d.fontShadow }).text(d.text).call(svgTextUtils.convertToTspans, gd2); if (gd2._promises[newPromise]) { labelsReady.push(gd2._promises.pop().then(function() { positionLabels(thisLabel, tickAngle); })); } else { positionLabels(thisLabel, tickAngle); } }); hideCounterAxisInsideTickLabels(ax, [TICK_TEXT]); tickLabels.exit().remove(); if (opts.repositionOnUpdate) { tickLabels.each(function(d) { d3.select(this).select("text").call(svgTextUtils.positionText, labelFns.xFn(d), labelFns.yFn(d)); }); } function positionLabels(s, angle) { s.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select(".text-math-group"); var anchor = labelFns.anchorFn(d, angle); var transform = opts.transFn.call(thisLabel.node(), d) + (isNumeric(angle) && +angle !== 0 ? " rotate(" + angle + "," + labelFns.xFn(d) + "," + (labelFns.yFn(d) - d.fontSize / 2) + ")" : ""); var nLines = svgTextUtils.lineCount(thisLabel); var lineHeight = LINE_SPACING * d.fontSize; var anchorHeight = labelFns.heightFn(d, isNumeric(angle) ? +angle : 0, (nLines - 1) * lineHeight); if (anchorHeight) { transform += strTranslate(0, anchorHeight); } if (mathjaxGroup.empty()) { var thisText = thisLabel.select("text"); thisText.attr({ transform, "text-anchor": anchor }); thisText.style("opacity", 1); if (ax._adjustTickLabelsOverflow) { ax._adjustTickLabelsOverflow(); } } else { var mjWidth = Drawing.bBox(mathjaxGroup.node()).width; var mjShift = mjWidth * { end: -0.5, start: 0.5 }[anchor]; mathjaxGroup.attr("transform", transform + strTranslate(mjShift, 0)); } }); } ax._adjustTickLabelsOverflow = function() { var ticklabeloverflow = ax.ticklabeloverflow; if (!ticklabeloverflow || ticklabeloverflow === "allow") return; var hideOverflow = ticklabeloverflow.indexOf("hide") !== -1; var isX = ax._id.charAt(0) === "x"; var p03 = 0; var p13 = isX ? gd2._fullLayout.width : gd2._fullLayout.height; if (ticklabeloverflow.indexOf("domain") !== -1) { var rl = Lib.simpleMap(ax.range, ax.r2l); p03 = ax.l2p(rl[0]) + ax._offset; p13 = ax.l2p(rl[1]) + ax._offset; } var min = Math.min(p03, p13); var max = Math.max(p03, p13); var side = ax.side; var visibleLabelMin = Infinity; var visibleLabelMax = -Infinity; tickLabels.each(function(d) { var thisLabel = d3.select(this); var mathjaxGroup = thisLabel.select(".text-math-group"); if (mathjaxGroup.empty()) { var bb = Drawing.bBox(thisLabel.node()); var adjust = 0; if (isX) { if (bb.right > max) adjust = 1; else if (bb.left < min) adjust = 1; } else { if (bb.bottom > max) adjust = 1; else if (bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) adjust = 1; } var t = thisLabel.select("text"); if (adjust) { if (hideOverflow) t.style("opacity", 0); } else { t.style("opacity", 1); if (side === "bottom" || side === "right") { visibleLabelMin = Math.min(visibleLabelMin, isX ? bb.top : bb.left); } else { visibleLabelMin = -Infinity; } if (side === "top" || side === "left") { visibleLabelMax = Math.max(visibleLabelMax, isX ? bb.bottom : bb.right); } else { visibleLabelMax = Infinity; } } } }); for (var subplot in fullLayout._plots) { var plotinfo = fullLayout._plots[subplot]; if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue; var anchorAx2 = isX ? plotinfo.yaxis : plotinfo.xaxis; if (anchorAx2) { anchorAx2["_visibleLabelMin_" + ax._id] = visibleLabelMin; anchorAx2["_visibleLabelMax_" + ax._id] = visibleLabelMax; } } }; ax._hideCounterAxisInsideTickLabels = function(partialOpts) { var isX = ax._id.charAt(0) === "x"; var anchoredAxes = []; for (var subplot in fullLayout._plots) { var plotinfo = fullLayout._plots[subplot]; if (ax._id !== plotinfo.xaxis._id && ax._id !== plotinfo.yaxis._id) continue; anchoredAxes.push(isX ? plotinfo.yaxis : plotinfo.xaxis); } anchoredAxes.forEach(function(anchorAx2, idx) { if (anchorAx2 && insideTicklabelposition(anchorAx2)) { (partialOpts || [ ZERO_PATH, MINORGRID_PATH, GRID_PATH, TICK_PATH, TICK_TEXT ]).forEach(function(e) { var isPeriodLabel = e.K === "tick" && e.L === "text" && ax.ticklabelmode === "period"; var mainPlotinfo = fullLayout._plots[ax._mainSubplot]; var sel; if (e.K === ZERO_PATH.K) sel = mainPlotinfo.zerolinelayer.selectAll("." + ax._id + "zl"); else if (e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll("." + ax._id); else if (e.K === GRID_PATH.K) sel = mainPlotinfo.gridlayer.selectAll("." + ax._id); else sel = mainPlotinfo[ax._id.charAt(0) + "axislayer"]; sel.each(function() { var w = d3.select(this); if (e.L) w = w.selectAll(e.L); w.each(function(d) { var q = ax.l2p( isPeriodLabel ? getPosX(d) : d.x ) + ax._offset; var t = d3.select(this); if (q < ax["_visibleLabelMax_" + anchorAx2._id] && q > ax["_visibleLabelMin_" + anchorAx2._id]) { t.style("display", "none"); } else if (e.K === "tick" && !idx) { t.style("display", null); } }); }); }); } }); }; positionLabels(tickLabels, prevAngle + 1 ? prevAngle : tickAngle); function allLabelsReady() { return labelsReady.length && Promise.all(labelsReady); } var autoangle = null; function fixLabelOverlaps() { positionLabels(tickLabels, tickAngle); if (vals.length && ax.autotickangles && (ax.type !== "log" || String(ax.dtick).charAt(0) !== "D")) { autoangle = ax.autotickangles[0]; var maxFontSize = 0; var lbbArray = []; var i; var maxLines = 1; tickLabels.each(function(d) { maxFontSize = Math.max(maxFontSize, d.fontSize); var x = ax.l2p(d.x); var thisLabel = selectTickLabel(this); var bb = Drawing.bBox(thisLabel.node()); maxLines = Math.max(maxLines, svgTextUtils.lineCount(thisLabel)); lbbArray.push({ // ignore about y, just deal with x overlaps top: 0, bottom: 10, height: 10, left: x - bb.width / 2, // impose a 2px gap right: x + bb.width / 2 + 2, width: bb.width + 2 }); }); var preventOverlapWithTick = (ax.tickson === "boundaries" || ax.showdividers) && !opts.secondary; var vLen = vals.length; var tickSpacing = Math.abs((vals[vLen - 1].x - vals[0].x) * ax._m) / (vLen - 1); var adjacent = preventOverlapWithTick ? tickSpacing / 2 : tickSpacing; var opposite = preventOverlapWithTick ? ax.ticklen : maxFontSize * 1.25 * maxLines; var hypotenuse = Math.sqrt(Math.pow(adjacent, 2) + Math.pow(opposite, 2)); var maxCos = adjacent / hypotenuse; var autoTickAnglesRadians = ax.autotickangles.map( function(degrees) { return degrees * Math.PI / 180; } ); var angleRadians = autoTickAnglesRadians.find( function(angle) { return Math.abs(Math.cos(angle)) <= maxCos; } ); if (angleRadians === void 0) { angleRadians = autoTickAnglesRadians.reduce( function(currentMax, nextAngle) { return Math.abs(Math.cos(currentMax)) < Math.abs(Math.cos(nextAngle)) ? currentMax : nextAngle; }, autoTickAnglesRadians[0] ); } var newAngle = angleRadians * (180 / Math.PI); if (preventOverlapWithTick) { var gap = 2; if (ax.ticks) gap += ax.tickwidth / 2; for (i = 0; i < lbbArray.length; i++) { var xbnd = vals[i].xbnd; var lbb = lbbArray[i]; if (xbnd[0] !== null && lbb.left - ax.l2p(xbnd[0]) < gap || xbnd[1] !== null && ax.l2p(xbnd[1]) - lbb.right < gap) { autoangle = newAngle; break; } } } else { var ticklabelposition = ax.ticklabelposition || ""; var has = function(str) { return ticklabelposition.indexOf(str) !== -1; }; var isTop = has("top"); var isLeft = has("left"); var isRight = has("right"); var isBottom = has("bottom"); var isAligned = isBottom || isLeft || isTop || isRight; var pad2 = !isAligned ? 0 : (ax.tickwidth || 0) + 2 * TEXTPAD; for (i = 0; i < lbbArray.length - 1; i++) { if (Lib.bBoxIntersect(lbbArray[i], lbbArray[i + 1], pad2)) { autoangle = newAngle; break; } } } if (autoangle) { positionLabels(tickLabels, autoangle); } } } if (ax._selections) { ax._selections[cls] = tickLabels; } var seq = [allLabelsReady]; if (ax.automargin && fullLayout._redrawFromAutoMarginCount && prevAngle === 90) { autoangle = prevAngle; seq.push(function() { positionLabels(tickLabels, prevAngle); }); } else { seq.push(fixLabelOverlaps); } if (ax._tickAngles) { seq.push(function() { ax._tickAngles[cls] = autoangle === null ? isNumeric(tickAngle) ? tickAngle : 0 : autoangle; }); } var computeTickLabelBoundingBoxes = function() { var labelsMaxW = 0; var labelsMaxH = 0; tickLabels.each(function(d, i) { var thisLabel = selectTickLabel(this); var mathjaxGroup = thisLabel.select(".text-math-group"); if (mathjaxGroup.empty()) { var bb; if (ax._vals[i]) { bb = ax._vals[i].bb || Drawing.bBox(thisLabel.node()); ax._vals[i].bb = bb; } labelsMaxW = Math.max(labelsMaxW, bb.width); labelsMaxH = Math.max(labelsMaxH, bb.height); } }); return { labelsMaxW, labelsMaxH }; }; var anchorAx = ax._anchorAxis; if (anchorAx && (anchorAx.autorange || anchorAx.insiderange) && insideTicklabelposition(ax) && !isLinked(fullLayout, ax._id)) { if (!fullLayout._insideTickLabelsUpdaterange) { fullLayout._insideTickLabelsUpdaterange = {}; } if (anchorAx.autorange) { fullLayout._insideTickLabelsUpdaterange[anchorAx._name + ".autorange"] = anchorAx.autorange; seq.push(computeTickLabelBoundingBoxes); } if (anchorAx.insiderange) { var BBs = computeTickLabelBoundingBoxes(); var move = ax._id.charAt(0) === "y" ? BBs.labelsMaxW : BBs.labelsMaxH; move += 2 * TEXTPAD; if (ax.ticklabelposition === "inside") { move += ax.ticklen || 0; } var sgn = ax.side === "right" || ax.side === "top" ? 1 : -1; var index = sgn === 1 ? 1 : 0; var otherIndex = sgn === 1 ? 0 : 1; var newRange = []; newRange[otherIndex] = anchorAx.range[otherIndex]; var anchorAxRange = anchorAx.range; var p02 = anchorAx.r2p(anchorAxRange[index]); var p12 = anchorAx.r2p(anchorAxRange[otherIndex]); var _tempNewRange = fullLayout._insideTickLabelsUpdaterange[anchorAx._name + ".range"]; if (_tempNewRange) { var q02 = anchorAx.r2p(_tempNewRange[index]); var q1 = anchorAx.r2p(_tempNewRange[otherIndex]); var dir = sgn * (ax._id.charAt(0) === "y" ? 1 : -1); if (dir * p02 < dir * q02) { p02 = q02; newRange[index] = anchorAxRange[index] = _tempNewRange[index]; } if (dir * p12 > dir * q1) { p12 = q1; newRange[otherIndex] = anchorAxRange[otherIndex] = _tempNewRange[otherIndex]; } } var dist = Math.abs(p12 - p02); if (dist - move > 0) { dist -= move; move *= 1 + move / dist; } else { move = 0; } if (ax._id.charAt(0) !== "y") move = -move; newRange[index] = anchorAx.p2r( anchorAx.r2p(anchorAxRange[index]) + sgn * move ); if (anchorAx.autorange === "min" || anchorAx.autorange === "max reversed") { newRange[0] = null; anchorAx._rangeInitial0 = void 0; anchorAx._rangeInitial1 = void 0; } else if (anchorAx.autorange === "max" || anchorAx.autorange === "min reversed") { newRange[1] = null; anchorAx._rangeInitial0 = void 0; anchorAx._rangeInitial1 = void 0; } fullLayout._insideTickLabelsUpdaterange[anchorAx._name + ".range"] = newRange; } } var done = Lib.syncOrAsync(seq); if (done && done.then) gd2._promises.push(done); return done; }; function drawDividers(gd2, ax, opts) { var cls = ax._id + "divider"; var vals = opts.vals; var dividers = opts.layer.selectAll("path." + cls).data(vals, tickDataFn); dividers.exit().remove(); dividers.enter().insert("path", ":first-child").classed(cls, 1).classed("crisp", 1).call(Color.stroke, ax.dividercolor).style("stroke-width", Drawing.crispRound(gd2, ax.dividerwidth, 1) + "px"); dividers.attr("transform", opts.transFn).attr("d", opts.path); } axes.getPxPosition = function(gd2, ax) { var gs2 = gd2._fullLayout._size; var axLetter = ax._id.charAt(0); var side = ax.side; var anchorAxis; if (ax.anchor !== "free") { anchorAxis = ax._anchorAxis; } else if (axLetter === "x") { anchorAxis = { _offset: gs2.t + (1 - (ax.position || 0)) * gs2.h, _length: 0 }; } else if (axLetter === "y") { anchorAxis = { _offset: gs2.l + (ax.position || 0) * gs2.w + ax._shift, _length: 0 }; } if (side === "top" || side === "left") { return anchorAxis._offset; } else if (side === "bottom" || side === "right") { return anchorAxis._offset + anchorAxis._length; } }; function approxTitleDepth(ax) { var fontSize = ax.title.font.size; var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length; if (ax.title.hasOwnProperty("standoff")) { return fontSize * (CAP_SHIFT + extraLines * LINE_SPACING); } else { return extraLines ? fontSize * (extraLines + 1) * LINE_SPACING : fontSize; } } function drawTitle(gd2, ax) { var fullLayout = gd2._fullLayout; var axId = ax._id; var axLetter = axId.charAt(0); var fontSize = ax.title.font.size; var titleStandoff; var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length; if (ax.title.hasOwnProperty("standoff")) { if (ax.side === "bottom" || ax.side === "right") { titleStandoff = ax._depth + ax.title.standoff + fontSize * CAP_SHIFT; } else if (ax.side === "top" || ax.side === "left") { titleStandoff = ax._depth + ax.title.standoff + fontSize * (MID_SHIFT + extraLines * LINE_SPACING); } } else { var isInside = insideTicklabelposition(ax); if (ax.type === "multicategory") { titleStandoff = ax._depth; } else { var offsetBase = 1.5 * fontSize; if (isInside) { offsetBase = 0.5 * fontSize; if (ax.ticks === "outside") { offsetBase += ax.ticklen; } } titleStandoff = 10 + offsetBase + (ax.linewidth ? ax.linewidth - 1 : 0); } if (!isInside) { if (axLetter === "x") { titleStandoff += ax.side === "top" ? fontSize * (ax.showticklabels ? 1 : 0) : fontSize * (ax.showticklabels ? 1.5 : 0.5); } else { titleStandoff += ax.side === "right" ? fontSize * (ax.showticklabels ? 1 : 0.5) : fontSize * (ax.showticklabels ? 0.5 : 0); } } } var pos = axes.getPxPosition(gd2, ax); var transform, x, y; if (axLetter === "x") { x = ax._offset + ax._length / 2; y = ax.side === "top" ? pos - titleStandoff : pos + titleStandoff; } else { y = ax._offset + ax._length / 2; x = ax.side === "right" ? pos + titleStandoff : pos - titleStandoff; transform = { rotate: "-90", offset: 0 }; } var avoid; if (ax.type !== "multicategory") { var tickLabels = ax._selections[ax._id + "tick"]; avoid = { selection: tickLabels, side: ax.side }; if (tickLabels && tickLabels.node() && tickLabels.node().parentNode) { var translation = Drawing.getTranslate(tickLabels.node().parentNode); avoid.offsetLeft = translation.x; avoid.offsetTop = translation.y; } if (ax.title.hasOwnProperty("standoff")) { avoid.pad = 0; } } ax._titleStandoff = titleStandoff; return Titles.draw(gd2, axId + "title", { propContainer: ax, propName: ax._name + ".title.text", placeholder: fullLayout._dfltTitle[axLetter], avoid, transform, attributes: { x, y, "text-anchor": "middle" } }); } axes.shouldShowZeroLine = function(gd2, ax, counterAxis) { var rng = Lib.simpleMap(ax.range, ax.r2l); return rng[0] * rng[1] <= 0 && ax.zeroline && (ax.type === "linear" || ax.type === "-") && !(ax.rangebreaks && ax.maskBreaks(0) === BADNUM) && (clipEnds(ax, 0) || !anyCounterAxLineAtZero(gd2, ax, counterAxis, rng) || hasBarsOrFill(gd2, ax)); }; axes.clipEnds = function(ax, vals) { return vals.filter(function(d) { return clipEnds(ax, d.x); }); }; function clipEnds(ax, l) { var p = ax.l2p(l); return p > 1 && p < ax._length - 1; } function anyCounterAxLineAtZero(gd2, ax, counterAxis, rng) { var mainCounterAxis = counterAxis._mainAxis; if (!mainCounterAxis) return; var fullLayout = gd2._fullLayout; var axLetter = ax._id.charAt(0); var counterLetter = axes.counterLetter(ax._id); var zeroPosition = ax._offset + (Math.abs(rng[0]) < Math.abs(rng[1]) === (axLetter === "x") ? 0 : ax._length); function lineNearZero(ax2) { if (!ax2.showline || !ax2.linewidth) return false; var tolerance = Math.max((ax2.linewidth + ax.zerolinewidth) / 2, 1); function closeEnough(pos2) { return typeof pos2 === "number" && Math.abs(pos2 - zeroPosition) < tolerance; } if (closeEnough(ax2._mainLinePosition) || closeEnough(ax2._mainMirrorPosition)) { return true; } var linePositions = ax2._linepositions || {}; for (var k in linePositions) { if (closeEnough(linePositions[k][0]) || closeEnough(linePositions[k][1])) { return true; } } } var plotinfo = fullLayout._plots[counterAxis._mainSubplot]; if (!(plotinfo.mainplotinfo || plotinfo).overlays.length) { return lineNearZero(counterAxis, zeroPosition); } var counterLetterAxes = axes.list(gd2, counterLetter); for (var i = 0; i < counterLetterAxes.length; i++) { var counterAxis2 = counterLetterAxes[i]; if (counterAxis2._mainAxis === mainCounterAxis && lineNearZero(counterAxis2, zeroPosition)) { return true; } } } function hasBarsOrFill(gd2, ax) { var fullData = gd2._fullData; var subplot = ax._mainSubplot; var axLetter = ax._id.charAt(0); for (var i = 0; i < fullData.length; i++) { var trace = fullData[i]; if (trace.visible === true && trace.xaxis + trace.yaxis === subplot) { if (Registry.traceIs(trace, "bar-like") && trace.orientation === { x: "h", y: "v" }[axLetter]) return true; if (trace.fill && trace.fill.charAt(trace.fill.length - 1) === axLetter) return true; } } return false; } function selectTickLabel(gTick) { var s = d3.select(gTick); var mj = s.select(".text-math-group"); return mj.empty() ? s.select("text") : mj; } axes.allowAutoMargin = function(gd2) { var axList = axes.list(gd2, "", true); for (var i = 0; i < axList.length; i++) { var ax = axList[i]; if (ax.automargin) { Plots.allowAutoMargin(gd2, axAutoMarginID(ax)); if (ax.mirror) { Plots.allowAutoMargin(gd2, axMirrorAutoMarginID(ax)); } } if (Registry.getComponentMethod("rangeslider", "isVisible")(ax)) { Plots.allowAutoMargin(gd2, rangeSliderAutoMarginID(ax)); } } }; function axAutoMarginID(ax) { return ax._id + ".automargin"; } function axMirrorAutoMarginID(ax) { return axAutoMarginID(ax) + ".mirror"; } function rangeSliderAutoMarginID(ax) { return ax._id + ".rangeslider"; } axes.swap = function(gd2, traces) { var axGroups = makeAxisGroups(gd2, traces); for (var i = 0; i < axGroups.length; i++) { swapAxisGroup(gd2, axGroups[i].x, axGroups[i].y); } }; function makeAxisGroups(gd2, traces) { var groups = []; var i, j; for (i = 0; i < traces.length; i++) { var groupsi = []; var xi2 = gd2._fullData[traces[i]].xaxis; var yi2 = gd2._fullData[traces[i]].yaxis; if (!xi2 || !yi2) continue; for (j = 0; j < groups.length; j++) { if (groups[j].x.indexOf(xi2) !== -1 || groups[j].y.indexOf(yi2) !== -1) { groupsi.push(j); } } if (!groupsi.length) { groups.push({ x: [xi2], y: [yi2] }); continue; } var group0 = groups[groupsi[0]]; var groupj; if (groupsi.length > 1) { for (j = 1; j < groupsi.length; j++) { groupj = groups[groupsi[j]]; mergeAxisGroups(group0.x, groupj.x); mergeAxisGroups(group0.y, groupj.y); } } mergeAxisGroups(group0.x, [xi2]); mergeAxisGroups(group0.y, [yi2]); } return groups; } function mergeAxisGroups(intoSet, fromSet) { for (var i = 0; i < fromSet.length; i++) { if (intoSet.indexOf(fromSet[i]) === -1) intoSet.push(fromSet[i]); } } function swapAxisGroup(gd2, xIds, yIds) { var xFullAxes = []; var yFullAxes = []; var layout = gd2.layout; var i, j; for (i = 0; i < xIds.length; i++) xFullAxes.push(axes.getFromId(gd2, xIds[i])); for (i = 0; i < yIds.length; i++) yFullAxes.push(axes.getFromId(gd2, yIds[i])); var allAxKeys = Object.keys(axAttrs); var noSwapAttrs = [ "anchor", "domain", "overlaying", "position", "side", "tickangle", "editType" ]; var numericTypes = ["linear", "log"]; for (i = 0; i < allAxKeys.length; i++) { var keyi = allAxKeys[i]; var xVal = xFullAxes[0][keyi]; var yVal = yFullAxes[0][keyi]; var allEqual = true; var coerceLinearX = false; var coerceLinearY = false; if (keyi.charAt(0) === "_" || typeof xVal === "function" || noSwapAttrs.indexOf(keyi) !== -1) { continue; } for (j = 1; j < xFullAxes.length && allEqual; j++) { var xVali = xFullAxes[j][keyi]; if (keyi === "type" && numericTypes.indexOf(xVal) !== -1 && numericTypes.indexOf(xVali) !== -1 && xVal !== xVali) { coerceLinearX = true; } else if (xVali !== xVal) allEqual = false; } for (j = 1; j < yFullAxes.length && allEqual; j++) { var yVali = yFullAxes[j][keyi]; if (keyi === "type" && numericTypes.indexOf(yVal) !== -1 && numericTypes.indexOf(yVali) !== -1 && yVal !== yVali) { coerceLinearY = true; } else if (yFullAxes[j][keyi] !== yVal) allEqual = false; } if (allEqual) { if (coerceLinearX) layout[xFullAxes[0]._name].type = "linear"; if (coerceLinearY) layout[yFullAxes[0]._name].type = "linear"; swapAxisAttrs(layout, keyi, xFullAxes, yFullAxes, gd2._fullLayout._dfltTitle); } } for (i = 0; i < gd2._fullLayout.annotations.length; i++) { var ann = gd2._fullLayout.annotations[i]; if (xIds.indexOf(ann.xref) !== -1 && yIds.indexOf(ann.yref) !== -1) { Lib.swapAttrs(layout.annotations[i], ["?"]); } } } function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) { var np2 = Lib.nestedProperty; var xVal = np2(layout[xFullAxes[0]._name], key).get(); var yVal = np2(layout[yFullAxes[0]._name], key).get(); var i; if (key === "title") { if (xVal && xVal.text === dfltTitle.x) { xVal.text = dfltTitle.y; } if (yVal && yVal.text === dfltTitle.y) { yVal.text = dfltTitle.x; } } for (i = 0; i < xFullAxes.length; i++) { np2(layout, xFullAxes[i]._name + "." + key).set(yVal); } for (i = 0; i < yFullAxes.length; i++) { np2(layout, yFullAxes[i]._name + "." + key).set(xVal); } } function isAngular(ax) { return ax._id === "angularaxis"; } function moveOutsideBreak(v, ax) { var len = ax._rangebreaks.length; for (var k = 0; k < len; k++) { var brk = ax._rangebreaks[k]; if (v >= brk.min && v < brk.max) { return brk.max; } } return v; } function insideTicklabelposition(ax) { return (ax.ticklabelposition || "").indexOf("inside") !== -1; } function hideCounterAxisInsideTickLabels(ax, opts) { if (insideTicklabelposition(ax._anchorAxis || {})) { if (ax._hideCounterAxisInsideTickLabels) { ax._hideCounterAxisInsideTickLabels(opts); } } } function incrementShift(ax, shiftVal, axShifts, normalize) { var overlay = ax.anchor !== "free" && (ax.overlaying === void 0 || ax.overlaying === false) ? ax._id : ax.overlaying; var shiftValAdj; if (normalize) { shiftValAdj = ax.side === "right" ? shiftVal : -shiftVal; } else { shiftValAdj = shiftVal; } if (!(overlay in axShifts)) { axShifts[overlay] = {}; } if (!(ax.side in axShifts[overlay])) { axShifts[overlay][ax.side] = 0; } axShifts[overlay][ax.side] += shiftValAdj; } function setShiftVal(ax, axShifts) { return ax.autoshift ? axShifts[ax.overlaying][ax.side] : ax.shift || 0; } function periodCompatibleWithTickformat(period, tickformat) { return /%f/.test(tickformat) ? period >= ONEMICROSEC : /%L/.test(tickformat) ? period >= ONEMILLI : /%[SX]/.test(tickformat) ? period >= ONESEC : /%M/.test(tickformat) ? period >= ONEMIN : /%[HI]/.test(tickformat) ? period >= ONEHOUR : /%p/.test(tickformat) ? period >= HALFDAY : /%[Aadejuwx]/.test(tickformat) ? period >= ONEDAY : /%[UVW]/.test(tickformat) ? period >= ONEWEEK : /%[Bbm]/.test(tickformat) ? period >= ONEMINMONTH : /%[q]/.test(tickformat) ? period >= ONEMINQUARTER : /%[Yy]/.test(tickformat) ? period >= ONEMINYEAR : true; } } }); // node_modules/plotly.js/src/plots/cartesian/autorange_options_defaults.js var require_autorange_options_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/autorange_options_defaults.js"(exports2, module2) { "use strict"; module2.exports = function handleAutorangeOptionsDefaults(coerce, autorange, range) { var minRange, maxRange; if (range) { var isReversed = autorange === "reversed" || autorange === "min reversed" || autorange === "max reversed"; minRange = range[isReversed ? 1 : 0]; maxRange = range[isReversed ? 0 : 1]; } var minallowed = coerce("autorangeoptions.minallowed", maxRange === null ? minRange : void 0); var maxallowed = coerce("autorangeoptions.maxallowed", minRange === null ? maxRange : void 0); if (minallowed === void 0) coerce("autorangeoptions.clipmin"); if (maxallowed === void 0) coerce("autorangeoptions.clipmax"); coerce("autorangeoptions.include"); }; } }); // node_modules/plotly.js/src/plots/cartesian/range_defaults.js var require_range_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/range_defaults.js"(exports2, module2) { "use strict"; var handleAutorangeOptionsDefaults = require_autorange_options_defaults(); module2.exports = function handleRangeDefaults(containerIn, containerOut, coerce, options) { var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || "-"; coerce("minallowed"); coerce("maxallowed"); var range = coerce("range"); if (!range) { var insiderange; if (!options.noInsiderange && axType !== "log") { insiderange = coerce("insiderange"); if (insiderange && (insiderange[0] === null || insiderange[1] === null)) { containerOut.insiderange = false; insiderange = void 0; } if (insiderange) range = coerce("range", insiderange); } } var autorangeDflt = containerOut.getAutorangeDflt(range, options); var autorange = coerce("autorange", autorangeDflt); var shouldAutorange; if (range && (range[0] === null && range[1] === null || (range[0] === null || range[1] === null) && (autorange === "reversed" || autorange === true) || range[0] !== null && (autorange === "min" || autorange === "max reversed") || range[1] !== null && (autorange === "max" || autorange === "min reversed"))) { range = void 0; delete containerOut.range; containerOut.autorange = true; shouldAutorange = true; } if (!shouldAutorange) { autorangeDflt = containerOut.getAutorangeDflt(range, options); autorange = coerce("autorange", autorangeDflt); } if (autorange) { handleAutorangeOptionsDefaults(coerce, autorange, range); if (axType === "linear" || axType === "-") coerce("rangemode"); } containerOut.cleanRange(); }; } }); // node_modules/mouse-event-offset/index.js var require_mouse_event_offset = __commonJS({ "node_modules/mouse-event-offset/index.js"(exports2, module2) { var rootPosition = { left: 0, top: 0 }; module2.exports = mouseEventOffset; function mouseEventOffset(ev2, target, out) { target = target || ev2.currentTarget || ev2.srcElement; if (!Array.isArray(out)) { out = [0, 0]; } var cx = ev2.clientX || 0; var cy = ev2.clientY || 0; var rect = getBoundingClientOffset(target); out[0] = cx - rect.left; out[1] = cy - rect.top; return out; } function getBoundingClientOffset(element) { if (element === window || element === document || element === document.body) { return rootPosition; } else { return element.getBoundingClientRect(); } } } }); // node_modules/has-passive-events/index.js var require_has_passive_events = __commonJS({ "node_modules/has-passive-events/index.js"(exports2, module2) { "use strict"; var isBrowser = require_client(); function detect() { var supported = false; try { var opts = Object.defineProperty({}, "passive", { get: function() { supported = true; } }); window.addEventListener("test", null, opts); window.removeEventListener("test", null, opts); } catch (e) { supported = false; } return supported; } module2.exports = isBrowser && detect(); } }); // node_modules/plotly.js/src/components/dragelement/align.js var require_align = __commonJS({ "node_modules/plotly.js/src/components/dragelement/align.js"(exports2, module2) { "use strict"; module2.exports = function align(v, dv2, v02, v12, anchor) { var vmin = (v - v02) / (v12 - v02); var vmax = vmin + dv2 / (v12 - v02); var vc2 = (vmin + vmax) / 2; if (anchor === "left" || anchor === "bottom") return vmin; if (anchor === "center" || anchor === "middle") return vc2; if (anchor === "right" || anchor === "top") return vmax; if (vmin < 2 / 3 - vc2) return vmin; if (vmax > 4 / 3 - vc2) return vmax; return vc2; }; } }); // node_modules/plotly.js/src/components/dragelement/cursor.js var require_cursor = __commonJS({ "node_modules/plotly.js/src/components/dragelement/cursor.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var cursorset = [ ["sw-resize", "s-resize", "se-resize"], ["w-resize", "move", "e-resize"], ["nw-resize", "n-resize", "ne-resize"] ]; module2.exports = function getCursor(x, y, xanchor, yanchor) { if (xanchor === "left") x = 0; else if (xanchor === "center") x = 1; else if (xanchor === "right") x = 2; else x = Lib.constrain(Math.floor(x * 3), 0, 2); if (yanchor === "bottom") y = 0; else if (yanchor === "middle") y = 1; else if (yanchor === "top") y = 2; else y = Lib.constrain(Math.floor(y * 3), 0, 2); return cursorset[y][x]; }; } }); // node_modules/plotly.js/src/components/dragelement/unhover.js var require_unhover = __commonJS({ "node_modules/plotly.js/src/components/dragelement/unhover.js"(exports2, module2) { "use strict"; var Events = require_events2(); var throttle = require_throttle(); var getGraphDiv = require_dom().getGraphDiv; var hoverConstants = require_constants(); var unhover = module2.exports = {}; unhover.wrapped = function(gd2, evt, subplot) { gd2 = getGraphDiv(gd2); if (gd2._fullLayout) { throttle.clear(gd2._fullLayout._uid + hoverConstants.HOVERID); } unhover.raw(gd2, evt, subplot); }; unhover.raw = function raw(gd2, evt) { var fullLayout = gd2._fullLayout; var oldhoverdata = gd2._hoverdata; if (!evt) evt = {}; if (evt.target && !gd2._dragged && Events.triggerHandler(gd2, "plotly_beforehover", evt) === false) { return; } fullLayout._hoverlayer.selectAll("g").remove(); fullLayout._hoverlayer.selectAll("line").remove(); fullLayout._hoverlayer.selectAll("circle").remove(); gd2._hoverdata = void 0; if (evt.target && oldhoverdata) { gd2.emit("plotly_unhover", { event: evt, points: oldhoverdata }); } }; } }); // node_modules/plotly.js/src/components/dragelement/index.js var require_dragelement = __commonJS({ "node_modules/plotly.js/src/components/dragelement/index.js"(exports2, module2) { "use strict"; var mouseOffset = require_mouse_event_offset(); var hasHover = require_has_hover(); var supportsPassive = require_has_passive_events(); var removeElement = require_lib().removeElement; var constants = require_constants2(); var dragElement = module2.exports = {}; dragElement.align = require_align(); dragElement.getCursor = require_cursor(); var unhover = require_unhover(); dragElement.unhover = unhover.wrapped; dragElement.unhoverRaw = unhover.raw; dragElement.init = function init(options) { var gd2 = options.gd; var numClicks = 1; var doubleClickDelay = gd2._context.doubleClickDelay; var element = options.element; var startX, startY, newMouseDownTime, cursor, dragCover, initialEvent, initialTarget, rightClick; if (!gd2._mouseDownTime) gd2._mouseDownTime = 0; element.style.pointerEvents = "all"; element.onmousedown = onStart; if (!supportsPassive) { element.ontouchstart = onStart; } else { if (element._ontouchstart) { element.removeEventListener("touchstart", element._ontouchstart); } element._ontouchstart = onStart; element.addEventListener("touchstart", onStart, { passive: false }); } function _clampFn(dx, dy, minDrag) { if (Math.abs(dx) < minDrag) dx = 0; if (Math.abs(dy) < minDrag) dy = 0; return [dx, dy]; } var clampFn = options.clampFn || _clampFn; function onStart(e) { gd2._dragged = false; gd2._dragging = true; var offset = pointerOffset(e); startX = offset[0]; startY = offset[1]; initialTarget = e.target; initialEvent = e; rightClick = e.buttons === 2 || e.ctrlKey; if (typeof e.clientX === "undefined" && typeof e.clientY === "undefined") { e.clientX = startX; e.clientY = startY; } newMouseDownTime = (/* @__PURE__ */ new Date()).getTime(); if (newMouseDownTime - gd2._mouseDownTime < doubleClickDelay) { numClicks += 1; } else { numClicks = 1; gd2._mouseDownTime = newMouseDownTime; } if (options.prepFn) options.prepFn(e, startX, startY); if (hasHover && !rightClick) { dragCover = coverSlip(); dragCover.style.cursor = window.getComputedStyle(element).cursor; } else if (!hasHover) { dragCover = document; cursor = window.getComputedStyle(document.documentElement).cursor; document.documentElement.style.cursor = window.getComputedStyle(element).cursor; } document.addEventListener("mouseup", onDone); document.addEventListener("touchend", onDone); if (options.dragmode !== false) { e.preventDefault(); document.addEventListener("mousemove", onMove); document.addEventListener("touchmove", onMove, { passive: false }); } return; } function onMove(e) { e.preventDefault(); var offset = pointerOffset(e); var minDrag = options.minDrag || constants.MINDRAG; var dxdy = clampFn(offset[0] - startX, offset[1] - startY, minDrag); var dx = dxdy[0]; var dy = dxdy[1]; if (dx || dy) { gd2._dragged = true; dragElement.unhover(gd2, e); } if (gd2._dragged && options.moveFn && !rightClick) { gd2._dragdata = { element, dx, dy }; options.moveFn(dx, dy); } return; } function onDone(e) { delete gd2._dragdata; if (options.dragmode !== false) { e.preventDefault(); document.removeEventListener("mousemove", onMove); document.removeEventListener("touchmove", onMove); } document.removeEventListener("mouseup", onDone); document.removeEventListener("touchend", onDone); if (hasHover) { removeElement(dragCover); } else if (cursor) { dragCover.documentElement.style.cursor = cursor; cursor = null; } if (!gd2._dragging) { gd2._dragged = false; return; } gd2._dragging = false; if ((/* @__PURE__ */ new Date()).getTime() - gd2._mouseDownTime > doubleClickDelay) { numClicks = Math.max(numClicks - 1, 1); } if (gd2._dragged) { if (options.doneFn) options.doneFn(); } else { if (options.clickFn) options.clickFn(numClicks, initialEvent); if (!rightClick) { var e2; try { e2 = new MouseEvent("click", e); } catch (err) { var offset = pointerOffset(e); e2 = document.createEvent("MouseEvents"); e2.initMouseEvent( "click", e.bubbles, e.cancelable, e.view, e.detail, e.screenX, e.screenY, offset[0], offset[1], e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget ); } initialTarget.dispatchEvent(e2); } } gd2._dragging = false; gd2._dragged = false; return; } }; function coverSlip() { var cover = document.createElement("div"); cover.className = "dragcover"; var cStyle = cover.style; cStyle.position = "fixed"; cStyle.left = 0; cStyle.right = 0; cStyle.top = 0; cStyle.bottom = 0; cStyle.zIndex = 999999999; cStyle.background = "none"; document.body.appendChild(cover); return cover; } dragElement.coverSlip = coverSlip; function pointerOffset(e) { return mouseOffset( e.changedTouches ? e.changedTouches[0] : e, document.body ); } } }); // node_modules/plotly.js/src/lib/setcursor.js var require_setcursor = __commonJS({ "node_modules/plotly.js/src/lib/setcursor.js"(exports2, module2) { "use strict"; module2.exports = function setCursor(el3, csr) { (el3.attr("class") || "").split(" ").forEach(function(cls) { if (cls.indexOf("cursor-") === 0) el3.classed(cls, false); }); if (csr) el3.classed("cursor-" + csr, true); }; } }); // node_modules/plotly.js/src/lib/override_cursor.js var require_override_cursor = __commonJS({ "node_modules/plotly.js/src/lib/override_cursor.js"(exports2, module2) { "use strict"; var setCursor = require_setcursor(); var STASHATTR = "data-savedcursor"; var NO_CURSOR = "!!"; module2.exports = function overrideCursor(el3, csr) { var savedCursor = el3.attr(STASHATTR); if (csr) { if (!savedCursor) { var classes = (el3.attr("class") || "").split(" "); for (var i = 0; i < classes.length; i++) { var cls = classes[i]; if (cls.indexOf("cursor-") === 0) { el3.attr(STASHATTR, cls.substr(7)).classed(cls, false); } } if (!el3.attr(STASHATTR)) { el3.attr(STASHATTR, NO_CURSOR); } } setCursor(el3, csr); } else if (savedCursor) { el3.attr(STASHATTR, null); if (savedCursor === NO_CURSOR) setCursor(el3); else setCursor(el3, savedCursor); } }; } }); // node_modules/plotly.js/src/components/legend/attributes.js var require_attributes9 = __commonJS({ "node_modules/plotly.js/src/components/legend/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var colorAttrs = require_attributes3(); module2.exports = { // not really a 'subplot' attribute container, // but this is the flag we use to denote attributes that // support yaxis, yaxis2, yaxis3, ... counters _isSubplotObj: true, visible: { valType: "boolean", dflt: true, editType: "legend", description: [ "Determines whether or not this legend is visible." ].join(" ") }, bgcolor: { valType: "color", editType: "legend", description: [ "Sets the legend background color.", "Defaults to `layout.paper_bgcolor`." ].join(" ") }, bordercolor: { valType: "color", dflt: colorAttrs.defaultLine, editType: "legend", description: "Sets the color of the border enclosing the legend." }, borderwidth: { valType: "number", min: 0, dflt: 0, editType: "legend", description: "Sets the width (in px) of the border enclosing the legend." }, font: fontAttrs({ editType: "legend", description: "Sets the font used to text the legend items." }), grouptitlefont: fontAttrs({ editType: "legend", description: [ "Sets the font for group titles in legend.", "Defaults to `legend.font` with its size increased about 10%." ].join(" ") }), orientation: { valType: "enumerated", values: ["v", "h"], dflt: "v", editType: "legend", description: "Sets the orientation of the legend." }, traceorder: { valType: "flaglist", flags: ["reversed", "grouped"], extras: ["normal"], editType: "legend", description: [ "Determines the order at which the legend items are displayed.", "If *normal*, the items are displayed top-to-bottom in the same", "order as the input data.", "If *reversed*, the items are displayed in the opposite order", "as *normal*.", "If *grouped*, the items are displayed in groups", "(when a trace `legendgroup` is provided).", "if *grouped+reversed*, the items are displayed in the opposite order", "as *grouped*." ].join(" ") }, tracegroupgap: { valType: "number", min: 0, dflt: 10, editType: "legend", description: [ "Sets the amount of vertical space (in px) between legend groups." ].join(" ") }, entrywidth: { valType: "number", min: 0, editType: "legend", description: [ "Sets the width (in px or fraction) of the legend.", "Use 0 to size the entry based on the text width,", "when `entrywidthmode` is set to *pixels*." ].join(" ") }, entrywidthmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "pixels", editType: "legend", description: "Determines what entrywidth means." }, indentation: { valType: "number", min: -15, dflt: 0, editType: "legend", description: "Sets the indentation (in px) of the legend entries." }, itemsizing: { valType: "enumerated", values: ["trace", "constant"], dflt: "trace", editType: "legend", description: [ "Determines if the legend items symbols scale with their corresponding *trace* attributes", "or remain *constant* independent of the symbol size on the graph." ].join(" ") }, itemwidth: { valType: "number", min: 30, dflt: 30, editType: "legend", description: "Sets the width (in px) of the legend item symbols (the part other than the title.text)." }, itemclick: { valType: "enumerated", values: ["toggle", "toggleothers", false], dflt: "toggle", editType: "legend", description: [ "Determines the behavior on legend item click.", "*toggle* toggles the visibility of the item clicked on the graph.", "*toggleothers* makes the clicked item the sole visible item on the graph.", "*false* disables legend item click interactions." ].join(" ") }, itemdoubleclick: { valType: "enumerated", values: ["toggle", "toggleothers", false], dflt: "toggleothers", editType: "legend", description: [ "Determines the behavior on legend item double-click.", "*toggle* toggles the visibility of the item clicked on the graph.", "*toggleothers* makes the clicked item the sole visible item on the graph.", "*false* disables legend item double-click interactions." ].join(" ") }, groupclick: { valType: "enumerated", values: ["toggleitem", "togglegroup"], dflt: "togglegroup", editType: "legend", description: [ "Determines the behavior on legend group item click.", "*toggleitem* toggles the visibility of the individual item clicked on the graph.", "*togglegroup* toggles the visibility of all items in the same legendgroup as the item clicked on the graph." ].join(" ") }, x: { valType: "number", editType: "legend", description: [ "Sets the x position with respect to `xref` (in normalized coordinates) of the legend.", "When `xref` is *paper*, defaults to *1.02* for vertical legends and", "defaults to *0* for horizontal legends.", "When `xref` is *container*, defaults to *1* for vertical legends and", "defaults to *0* for horizontal legends.", "Must be between *0* and *1* if `xref` is *container*.", "and between *-2* and *3* if `xref` is *paper*." ].join(" ") }, xref: { valType: "enumerated", dflt: "paper", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `x` refers to.", "*container* spans the entire `width` of the plot.", "*paper* refers to the width of the plotting area only." ].join(" ") }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left", editType: "legend", description: [ "Sets the legend's horizontal position anchor.", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the legend.", "Value *auto* anchors legends to the right for `x` values greater than or equal to 2/3,", "anchors legends to the left for `x` values less than or equal to 1/3 and", "anchors legends with respect to their center otherwise." ].join(" ") }, y: { valType: "number", editType: "legend", description: [ "Sets the y position with respect to `yref` (in normalized coordinates) of the legend.", "When `yref` is *paper*, defaults to *1* for vertical legends,", "defaults to *-0.1* for horizontal legends on graphs w/o range sliders and", "defaults to *1.1* for horizontal legends on graph with one or multiple range sliders.", "When `yref` is *container*, defaults to *1*.", "Must be between *0* and *1* if `yref` is *container*", "and between *-2* and *3* if `yref` is *paper*." ].join(" ") }, yref: { valType: "enumerated", dflt: "paper", values: ["container", "paper"], editType: "layoutstyle", description: [ "Sets the container `y` refers to.", "*container* spans the entire `height` of the plot.", "*paper* refers to the height of the plotting area only." ].join(" ") }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], editType: "legend", description: [ "Sets the legend's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the legend.", "Value *auto* anchors legends at their bottom for `y` values less than or equal to 1/3,", "anchors legends to at their top for `y` values greater than or equal to 2/3 and", "anchors legends with respect to their middle otherwise." ].join(" ") }, uirevision: { valType: "any", editType: "none", description: [ "Controls persistence of legend-driven changes in trace and pie label", "visibility. Defaults to `layout.uirevision`." ].join(" ") }, valign: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "middle", editType: "legend", description: [ "Sets the vertical alignment of the symbols with respect to their associated text." ].join(" ") }, title: { text: { valType: "string", dflt: "", editType: "legend", description: [ "Sets the title of the legend." ].join(" ") }, font: fontAttrs({ editType: "legend", description: [ "Sets this legend's title font.", "Defaults to `legend.font` with its size increased about 20%." ].join(" ") }), side: { valType: "enumerated", values: ["top", "left", "top left", "top center", "top right"], editType: "legend", description: [ "Determines the location of legend's title", "with respect to the legend items.", "Defaulted to *top* with `orientation` is *h*.", "Defaulted to *left* with `orientation` is *v*.", "The *top left* options could be used to expand", "top center and top right are for horizontal alignment", "legend area in both x and y sides." ].join(" ") }, editType: "legend" }, editType: "legend" }; } }); // node_modules/plotly.js/src/components/legend/helpers.js var require_helpers3 = __commonJS({ "node_modules/plotly.js/src/components/legend/helpers.js"(exports2) { "use strict"; exports2.isGrouped = function isGrouped(legendLayout) { return (legendLayout.traceorder || "").indexOf("grouped") !== -1; }; exports2.isVertical = function isVertical(legendLayout) { return legendLayout.orientation !== "h"; }; exports2.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || "").indexOf("reversed") !== -1; }; } }); // node_modules/plotly.js/src/components/legend/defaults.js var require_defaults3 = __commonJS({ "node_modules/plotly.js/src/components/legend/defaults.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var Template = require_plot_template(); var plotsAttrs = require_attributes2(); var attributes = require_attributes9(); var basePlotLayoutAttributes = require_layout_attributes2(); var helpers = require_helpers3(); function groupDefaults(legendId, layoutIn, layoutOut, fullData) { var containerIn = layoutIn[legendId] || {}; var containerOut = Template.newContainer(layoutOut, legendId); function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); } var itemFont = Lib.coerceFont(coerce, "font", layoutOut.font); coerce("bgcolor", layoutOut.paper_bgcolor); coerce("bordercolor"); var visible = coerce("visible"); if (!visible) return; var trace; var traceCoerce = function(attr, dflt) { var traceIn = trace._input; var traceOut = trace; return Lib.coerce(traceIn, traceOut, plotsAttrs, attr, dflt); }; var globalFont = layoutOut.font || {}; var grouptitlefont = Lib.coerceFont(coerce, "grouptitlefont", globalFont, { overrideDflt: { size: Math.round(globalFont.size * 1.1) } }); var legendTraceCount = 0; var legendReallyHasATrace = false; var defaultOrder = "normal"; var shapesWithLegend = (layoutOut.shapes || []).filter(function(d) { return d.showlegend; }); var allLegendItems = fullData.concat(shapesWithLegend).filter(function(d) { return legendId === (d.legend || "legend"); }); for (var i = 0; i < allLegendItems.length; i++) { trace = allLegendItems[i]; if (!trace.visible) continue; var isShape = trace._isShape; if (trace.showlegend || trace._dfltShowLegend && !(trace._module && trace._module.attributes && trace._module.attributes.showlegend && trace._module.attributes.showlegend.dflt === false)) { legendTraceCount++; if (trace.showlegend) { legendReallyHasATrace = true; if (!isShape && Registry.traceIs(trace, "pie-like") || trace._input.showlegend === true) { legendTraceCount++; } } Lib.coerceFont(traceCoerce, "legendgrouptitle.font", grouptitlefont); } if (!isShape && Registry.traceIs(trace, "bar") && layoutOut.barmode === "stack" || ["tonextx", "tonexty"].indexOf(trace.fill) !== -1) { defaultOrder = helpers.isGrouped({ traceorder: defaultOrder }) ? "grouped+reversed" : "reversed"; } if (trace.legendgroup !== void 0 && trace.legendgroup !== "") { defaultOrder = helpers.isReversed({ traceorder: defaultOrder }) ? "reversed+grouped" : "grouped"; } } var showLegend = Lib.coerce( layoutIn, layoutOut, basePlotLayoutAttributes, "showlegend", legendReallyHasATrace && legendTraceCount > (legendId === "legend" ? 1 : 0) ); if (showLegend === false) layoutOut[legendId] = void 0; if (showLegend === false && !containerIn.uirevision) return; coerce("uirevision", layoutOut.uirevision); if (showLegend === false) return; coerce("borderwidth"); var orientation = coerce("orientation"); var yref = coerce("yref"); var xref = coerce("xref"); var isHorizontal = orientation === "h"; var isPaperY = yref === "paper"; var isPaperX = xref === "paper"; var defaultX, defaultY, defaultYAnchor; var defaultXAnchor = "left"; if (isHorizontal) { defaultX = 0; if (Registry.getComponentMethod("rangeslider", "isVisible")(layoutIn.xaxis)) { if (isPaperY) { defaultY = 1.1; defaultYAnchor = "bottom"; } else { defaultY = 1; defaultYAnchor = "top"; } } else { if (isPaperY) { defaultY = -0.1; defaultYAnchor = "top"; } else { defaultY = 0; defaultYAnchor = "bottom"; } } } else { defaultY = 1; defaultYAnchor = "auto"; if (isPaperX) { defaultX = 1.02; } else { defaultX = 1; defaultXAnchor = "right"; } } Lib.coerce(containerIn, containerOut, { x: { valType: "number", editType: "legend", min: isPaperX ? -2 : 0, max: isPaperX ? 3 : 1, dflt: defaultX } }, "x"); Lib.coerce(containerIn, containerOut, { y: { valType: "number", editType: "legend", min: isPaperY ? -2 : 0, max: isPaperY ? 3 : 1, dflt: defaultY } }, "y"); coerce("traceorder", defaultOrder); if (helpers.isGrouped(layoutOut[legendId])) coerce("tracegroupgap"); coerce("entrywidth"); coerce("entrywidthmode"); coerce("indentation"); coerce("itemsizing"); coerce("itemwidth"); coerce("itemclick"); coerce("itemdoubleclick"); coerce("groupclick"); coerce("xanchor", defaultXAnchor); coerce("yanchor", defaultYAnchor); coerce("valign"); Lib.noneOrAll(containerIn, containerOut, ["x", "y"]); var titleText = coerce("title.text"); if (titleText) { coerce("title.side", isHorizontal ? "left" : "top"); var dfltTitleFont = Lib.extendFlat({}, itemFont, { size: Lib.bigFont(itemFont.size) }); Lib.coerceFont(coerce, "title.font", dfltTitleFont); } } module2.exports = function legendDefaults(layoutIn, layoutOut, fullData) { var i; var allLegendsData = fullData.slice(); var shapes = layoutOut.shapes; if (shapes) { for (i = 0; i < shapes.length; i++) { var shape = shapes[i]; if (!shape.showlegend) continue; var mockTrace = { _input: shape._input, visible: shape.visible, showlegend: shape.showlegend, legend: shape.legend }; allLegendsData.push(mockTrace); } } var legends = ["legend"]; for (i = 0; i < allLegendsData.length; i++) { Lib.pushUnique(legends, allLegendsData[i].legend); } layoutOut._legends = []; for (i = 0; i < legends.length; i++) { var legendId = legends[i]; groupDefaults(legendId, layoutIn, layoutOut, allLegendsData); if (layoutOut[legendId] && layoutOut[legendId].visible) { layoutOut[legendId]._id = legendId; } layoutOut._legends.push(legendId); } }; } }); // node_modules/plotly.js/src/components/legend/handle_click.js var require_handle_click = __commonJS({ "node_modules/plotly.js/src/components/legend/handle_click.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var pushUnique = Lib.pushUnique; var SHOWISOLATETIP = true; module2.exports = function handleClick(g, gd2, numClicks) { var fullLayout = gd2._fullLayout; if (gd2._dragged || gd2._editing) return; var itemClick = fullLayout.legend.itemclick; var itemDoubleClick = fullLayout.legend.itemdoubleclick; var groupClick = fullLayout.legend.groupclick; if (numClicks === 1 && itemClick === "toggle" && itemDoubleClick === "toggleothers" && SHOWISOLATETIP && gd2.data && gd2._context.showTips) { Lib.notifier(Lib._(gd2, "Double-click on legend to isolate one trace"), "long"); SHOWISOLATETIP = false; } else { SHOWISOLATETIP = false; } var mode; if (numClicks === 1) mode = itemClick; else if (numClicks === 2) mode = itemDoubleClick; if (!mode) return; var toggleGroup = groupClick === "togglegroup"; var hiddenSlices = fullLayout.hiddenlabels ? fullLayout.hiddenlabels.slice() : []; var legendItem = g.data()[0][0]; if (legendItem.groupTitle && legendItem.noClick) return; var fullData = gd2._fullData; var shapesWithLegend = (fullLayout.shapes || []).filter(function(d2) { return d2.showlegend; }); var allLegendItems = fullData.concat(shapesWithLegend); var fullTrace = legendItem.trace; if (fullTrace._isShape) { fullTrace = fullTrace._fullInput; } var legendgroup = fullTrace.legendgroup; var i, j, kcont, key, keys, val; var dataUpdate = {}; var dataIndices = []; var carrs = []; var carrIdx = []; function insertDataUpdate(traceIndex, value) { var attrIndex = dataIndices.indexOf(traceIndex); var valueArray = dataUpdate.visible; if (!valueArray) { valueArray = dataUpdate.visible = []; } if (dataIndices.indexOf(traceIndex) === -1) { dataIndices.push(traceIndex); attrIndex = dataIndices.length - 1; } valueArray[attrIndex] = value; return attrIndex; } var updatedShapes = (fullLayout.shapes || []).map(function(d2) { return d2._input; }); var shapesUpdated = false; function insertShapesUpdate(shapeIndex, value) { updatedShapes[shapeIndex].visible = value; shapesUpdated = true; } function setVisibility(fullTrace2, visibility) { if (legendItem.groupTitle && !toggleGroup) return; var fullInput2 = fullTrace2._fullInput || fullTrace2; var isShape2 = fullInput2._isShape; var index = fullInput2.index; if (index === void 0) index = fullInput2._index; if (Registry.hasTransform(fullInput2, "groupby")) { var kcont2 = carrs[index]; if (!kcont2) { var groupbyIndices = Registry.getTransformIndices(fullInput2, "groupby"); var lastGroupbyIndex = groupbyIndices[groupbyIndices.length - 1]; kcont2 = Lib.keyedContainer(fullInput2, "transforms[" + lastGroupbyIndex + "].styles", "target", "value.visible"); carrs[index] = kcont2; } var curState = kcont2.get(fullTrace2._group); if (curState === void 0) { curState = true; } if (curState !== false) { kcont2.set(fullTrace2._group, visibility); } carrIdx[index] = insertDataUpdate(index, fullInput2.visible === false ? false : true); } else { var nextVisibility2 = fullInput2.visible === false ? false : visibility; if (isShape2) { insertShapesUpdate(index, nextVisibility2); } else { insertDataUpdate(index, nextVisibility2); } } } var thisLegend = fullTrace.legend; var fullInput = fullTrace._fullInput; var isShape = fullInput && fullInput._isShape; if (!isShape && Registry.traceIs(fullTrace, "pie-like")) { var thisLabel = legendItem.label; var thisLabelIndex = hiddenSlices.indexOf(thisLabel); if (mode === "toggle") { if (thisLabelIndex === -1) hiddenSlices.push(thisLabel); else hiddenSlices.splice(thisLabelIndex, 1); } else if (mode === "toggleothers") { var changed = thisLabelIndex !== -1; var unhideList = []; for (i = 0; i < gd2.calcdata.length; i++) { var cdi = gd2.calcdata[i]; for (j = 0; j < cdi.length; j++) { var d = cdi[j]; var dLabel = d.label; if (thisLegend === cdi[0].trace.legend) { if (thisLabel !== dLabel) { if (hiddenSlices.indexOf(dLabel) === -1) changed = true; pushUnique(hiddenSlices, dLabel); unhideList.push(dLabel); } } } } if (!changed) { for (var q = 0; q < unhideList.length; q++) { var pos = hiddenSlices.indexOf(unhideList[q]); if (pos !== -1) { hiddenSlices.splice(pos, 1); } } } } Registry.call("_guiRelayout", gd2, "hiddenlabels", hiddenSlices); } else { var hasLegendgroup = legendgroup && legendgroup.length; var traceIndicesInGroup = []; var tracei; if (hasLegendgroup) { for (i = 0; i < allLegendItems.length; i++) { tracei = allLegendItems[i]; if (!tracei.visible) continue; if (tracei.legendgroup === legendgroup) { traceIndicesInGroup.push(i); } } } if (mode === "toggle") { var nextVisibility; switch (fullTrace.visible) { case true: nextVisibility = "legendonly"; break; case false: nextVisibility = false; break; case "legendonly": nextVisibility = true; break; } if (hasLegendgroup) { if (toggleGroup) { for (i = 0; i < allLegendItems.length; i++) { var item = allLegendItems[i]; if (item.visible !== false && item.legendgroup === legendgroup) { setVisibility(item, nextVisibility); } } } else { setVisibility(fullTrace, nextVisibility); } } else { setVisibility(fullTrace, nextVisibility); } } else if (mode === "toggleothers") { var isClicked, isInGroup, notInLegend, otherState, _item; var isIsolated = true; for (i = 0; i < allLegendItems.length; i++) { _item = allLegendItems[i]; isClicked = _item === fullTrace; notInLegend = _item.showlegend !== true; if (isClicked || notInLegend) continue; isInGroup = hasLegendgroup && _item.legendgroup === legendgroup; if (!isInGroup && _item.legend === thisLegend && _item.visible === true && !Registry.traceIs(_item, "notLegendIsolatable")) { isIsolated = false; break; } } for (i = 0; i < allLegendItems.length; i++) { _item = allLegendItems[i]; if (_item.visible === false || _item.legend !== thisLegend) continue; if (Registry.traceIs(_item, "notLegendIsolatable")) { continue; } switch (fullTrace.visible) { case "legendonly": setVisibility(_item, true); break; case true: otherState = isIsolated ? true : "legendonly"; isClicked = _item === fullTrace; notInLegend = _item.showlegend !== true && !_item.legendgroup; isInGroup = isClicked || hasLegendgroup && _item.legendgroup === legendgroup; setVisibility(_item, isInGroup || notInLegend ? true : otherState); break; } } } for (i = 0; i < carrs.length; i++) { kcont = carrs[i]; if (!kcont) continue; var update = kcont.constructUpdate(); var updateKeys = Object.keys(update); for (j = 0; j < updateKeys.length; j++) { key = updateKeys[j]; val = dataUpdate[key] = dataUpdate[key] || []; val[carrIdx[i]] = update[key]; } } keys = Object.keys(dataUpdate); for (i = 0; i < keys.length; i++) { key = keys[i]; for (j = 0; j < dataIndices.length; j++) { if (!dataUpdate[key].hasOwnProperty(j)) { dataUpdate[key][j] = void 0; } } } if (shapesUpdated) { Registry.call("_guiUpdate", gd2, dataUpdate, { shapes: updatedShapes }, dataIndices); } else { Registry.call("_guiRestyle", gd2, dataUpdate, dataIndices); } } }; } }); // node_modules/plotly.js/src/components/legend/constants.js var require_constants3 = __commonJS({ "node_modules/plotly.js/src/components/legend/constants.js"(exports2, module2) { "use strict"; module2.exports = { scrollBarWidth: 6, scrollBarMinHeight: 20, scrollBarColor: "#808BA4", scrollBarMargin: 4, scrollBarEnterAttrs: { rx: 20, ry: 3, width: 0, height: 0 }, // number of px between legend title and (left) side of legend (always in x direction and from inner border) titlePad: 2, // number of px between each legend item (x and/or y direction) itemGap: 5 }; } }); // node_modules/plotly.js/src/components/legend/get_legend_data.js var require_get_legend_data = __commonJS({ "node_modules/plotly.js/src/components/legend/get_legend_data.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var helpers = require_helpers3(); module2.exports = function getLegendData(calcdata, opts, hasMultipleLegends) { var inHover = opts._inHover; var grouped = helpers.isGrouped(opts); var reversed = helpers.isReversed(opts); var lgroupToTraces = {}; var lgroups = []; var hasOneNonBlankGroup = false; var slicesShown = {}; var lgroupi = 0; var maxNameLength = 0; var i, j; function addOneItem(legendId, legendGroup, legendItem) { if (opts.visible === false) return; if (hasMultipleLegends && legendId !== opts._id) return; if (legendGroup === "" || !helpers.isGrouped(opts)) { var uniqueGroup = "~~i" + lgroupi; lgroups.push(uniqueGroup); lgroupToTraces[uniqueGroup] = [legendItem]; lgroupi++; } else if (lgroups.indexOf(legendGroup) === -1) { lgroups.push(legendGroup); hasOneNonBlankGroup = true; lgroupToTraces[legendGroup] = [legendItem]; } else { lgroupToTraces[legendGroup].push(legendItem); } } for (i = 0; i < calcdata.length; i++) { var cd2 = calcdata[i]; var cd0 = cd2[0]; var trace = cd0.trace; var lid = trace.legend; var lgroup = trace.legendgroup; if (!inHover && (!trace.visible || !trace.showlegend)) continue; if (Registry.traceIs(trace, "pie-like")) { if (!slicesShown[lgroup]) slicesShown[lgroup] = {}; for (j = 0; j < cd2.length; j++) { var labelj = cd2[j].label; if (!slicesShown[lgroup][labelj]) { addOneItem(lid, lgroup, { label: labelj, color: cd2[j].color, i: cd2[j].i, trace, pts: cd2[j].pts }); slicesShown[lgroup][labelj] = true; maxNameLength = Math.max(maxNameLength, (labelj || "").length); } } } else { addOneItem(lid, lgroup, cd0); maxNameLength = Math.max(maxNameLength, (trace.name || "").length); } } if (!lgroups.length) return []; var shouldCollapse = !hasOneNonBlankGroup || !grouped; var legendData = []; for (i = 0; i < lgroups.length; i++) { var t = lgroupToTraces[lgroups[i]]; if (shouldCollapse) { legendData.push(t[0]); } else { legendData.push(t); } } if (shouldCollapse) legendData = [legendData]; for (i = 0; i < legendData.length; i++) { var groupMinRank = Infinity; for (j = 0; j < legendData[i].length; j++) { var rank = legendData[i][j].trace.legendrank; if (groupMinRank > rank) groupMinRank = rank; } legendData[i][0]._groupMinRank = groupMinRank; legendData[i][0]._preGroupSort = i; } var orderFn1 = function(a, b) { return a[0]._groupMinRank - b[0]._groupMinRank || a[0]._preGroupSort - b[0]._preGroupSort; }; var orderFn2 = function(a, b) { return a.trace.legendrank - b.trace.legendrank || a._preSort - b._preSort; }; legendData.forEach(function(a, k) { a[0]._preGroupSort = k; }); legendData.sort(orderFn1); for (i = 0; i < legendData.length; i++) { legendData[i].forEach(function(a, k) { a._preSort = k; }); legendData[i].sort(orderFn2); var firstItemTrace = legendData[i][0].trace; var groupTitle = null; for (j = 0; j < legendData[i].length; j++) { var gt2 = legendData[i][j].trace.legendgrouptitle; if (gt2 && gt2.text) { groupTitle = gt2; if (inHover) gt2.font = opts._groupTitleFont; break; } } if (reversed) legendData[i].reverse(); if (groupTitle) { var hasPieLike = false; for (j = 0; j < legendData[i].length; j++) { if (Registry.traceIs(legendData[i][j].trace, "pie-like")) { hasPieLike = true; break; } } legendData[i].unshift({ i: -1, groupTitle, noClick: hasPieLike, trace: { showlegend: firstItemTrace.showlegend, legendgroup: firstItemTrace.legendgroup, visible: opts.groupclick === "toggleitem" ? true : firstItemTrace.visible } }); } for (j = 0; j < legendData[i].length; j++) { legendData[i][j] = [ legendData[i][j] ]; } } opts._lgroupsLength = legendData.length; opts._maxNameLength = maxNameLength; return legendData; }; } }); // node_modules/plotly.js/src/traces/pie/helpers.js var require_helpers4 = __commonJS({ "node_modules/plotly.js/src/traces/pie/helpers.js"(exports2) { "use strict"; var Lib = require_lib(); function format2(vRounded) { return vRounded.indexOf("e") !== -1 ? vRounded.replace(/[.]?0+e/, "e") : vRounded.indexOf(".") !== -1 ? vRounded.replace(/[.]?0+$/, "") : vRounded; } exports2.formatPiePercent = function formatPiePercent(v, separators) { var vRounded = format2((v * 100).toPrecision(3)); return Lib.numSeparate(vRounded, separators) + "%"; }; exports2.formatPieValue = function formatPieValue(v, separators) { var vRounded = format2(v.toPrecision(10)); return Lib.numSeparate(vRounded, separators); }; exports2.getFirstFilled = function getFirstFilled(array, indices) { if (!Lib.isArrayOrTypedArray(array)) return; for (var i = 0; i < indices.length; i++) { var v = array[indices[i]]; if (v || v === 0 || v === "") return v; } }; exports2.castOption = function castOption(item, indices) { if (Lib.isArrayOrTypedArray(item)) return exports2.getFirstFilled(item, indices); else if (item) return item; }; exports2.getRotationAngle = function(rotation) { return (rotation === "auto" ? 0 : rotation) * Math.PI / 180; }; } }); // node_modules/plotly.js/src/traces/pie/fill_one.js var require_fill_one = __commonJS({ "node_modules/plotly.js/src/traces/pie/fill_one.js"(exports2, module2) { "use strict"; var Drawing = require_drawing(); var Color = require_color(); module2.exports = function fillOne(s, pt2, trace, gd2) { var pattern = trace.marker.pattern; if (pattern && pattern.shape) { Drawing.pointStyle(s, trace, gd2, pt2); } else { Color.fill(s, pt2.color); } }; } }); // node_modules/plotly.js/src/traces/pie/style_one.js var require_style_one = __commonJS({ "node_modules/plotly.js/src/traces/pie/style_one.js"(exports2, module2) { "use strict"; var Color = require_color(); var castOption = require_helpers4().castOption; var fillOne = require_fill_one(); module2.exports = function styleOne(s, pt2, trace, gd2) { var line = trace.marker.line; var lineColor = castOption(line.color, pt2.pts) || Color.defaultLine; var lineWidth = castOption(line.width, pt2.pts) || 0; s.call(fillOne, pt2, trace, gd2).style("stroke-width", lineWidth).call(Color.stroke, lineColor); }; } }); // node_modules/plotly.js/src/components/legend/style.js var require_style = __commonJS({ "node_modules/plotly.js/src/components/legend/style.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var Drawing = require_drawing(); var Color = require_color(); var extractOpts = require_helpers().extractOpts; var subTypes = require_subtypes(); var stylePie = require_style_one(); var pieCastOption = require_helpers4().castOption; var constants = require_constants3(); var CST_MARKER_SIZE = 12; var CST_LINE_WIDTH = 5; var CST_MARKER_LINE_WIDTH = 2; var MAX_LINE_WIDTH = 10; var MAX_MARKER_LINE_WIDTH = 5; module2.exports = function style(s, gd2, legend) { var fullLayout = gd2._fullLayout; if (!legend) legend = fullLayout.legend; var constantItemSizing = legend.itemsizing === "constant"; var itemWidth = legend.itemwidth; var centerPos = (itemWidth + constants.itemGap * 2) / 2; var centerTransform = strTranslate(centerPos, 0); var boundLineWidth = function(mlw, cont, max, cst) { var v; if (mlw + 1) { v = mlw; } else if (cont && cont.width > 0) { v = cont.width; } else { return 0; } return constantItemSizing ? cst : Math.min(v, max); }; s.each(function(d) { var traceGroup = d3.select(this); var layers = Lib.ensureSingle(traceGroup, "g", "layers"); layers.style("opacity", d[0].trace.opacity); var indentation = legend.indentation; var valign = legend.valign; var lineHeight = d[0].lineHeight; var height = d[0].height; if (valign === "middle" && indentation === 0 || !lineHeight || !height) { layers.attr("transform", null); } else { var factor = { top: 1, bottom: -1 }[valign]; var markerOffsetY = factor * (0.5 * (lineHeight - height + 3)) || 0; var markerOffsetX = legend.indentation; layers.attr("transform", strTranslate(markerOffsetX, markerOffsetY)); } var fill = layers.selectAll("g.legendfill").data([d]); fill.enter().append("g").classed("legendfill", true); var line = layers.selectAll("g.legendlines").data([d]); line.enter().append("g").classed("legendlines", true); var symbol = layers.selectAll("g.legendsymbols").data([d]); symbol.enter().append("g").classed("legendsymbols", true); symbol.selectAll("g.legendpoints").data([d]).enter().append("g").classed("legendpoints", true); }).each(styleSpatial).each(styleWaterfalls).each(styleFunnels).each(styleBars).each(styleBoxes).each(styleFunnelareas).each(stylePies).each(styleLines).each(stylePoints).each(styleCandles).each(styleOHLC); function styleLines(d) { var styleGuide = getStyleGuide(d); var showFill = styleGuide.showFill; var showLine = styleGuide.showLine; var showGradientLine = styleGuide.showGradientLine; var showGradientFill = styleGuide.showGradientFill; var anyFill = styleGuide.anyFill; var anyLine = styleGuide.anyLine; var d02 = d[0]; var trace = d02.trace; var dMod, tMod; var cOpts = extractOpts(trace); var colorscale = cOpts.colorscale; var reversescale = cOpts.reversescale; var fillStyle = function(s2) { if (s2.size()) { if (showFill) { Drawing.fillGroupStyle(s2, gd2, true); } else { var gradientID = "legendfill-" + trace.uid; Drawing.gradient( s2, gd2, gradientID, getGradientDirection(reversescale), colorscale, "fill" ); } } }; var lineGradient = function(s2) { if (s2.size()) { var gradientID = "legendline-" + trace.uid; Drawing.lineGroupStyle(s2); Drawing.gradient( s2, gd2, gradientID, getGradientDirection(reversescale), colorscale, "stroke" ); } }; var pathStart = subTypes.hasMarkers(trace) || !anyFill ? "M5,0" : ( // with a line leave it slightly below center, to leave room for the // line thickness and because the line is usually more prominent anyLine ? "M5,-2" : "M5,-3" ); var this3 = d3.select(this); var fill = this3.select(".legendfill").selectAll("path").data(showFill || showGradientFill ? [d] : []); fill.enter().append("path").classed("js-fill", true); fill.exit().remove(); fill.attr("d", pathStart + "h" + itemWidth + "v6h-" + itemWidth + "z").call(fillStyle); if (showLine || showGradientLine) { var lw = boundLineWidth(void 0, trace.line, MAX_LINE_WIDTH, CST_LINE_WIDTH); tMod = Lib.minExtend(trace, { line: { width: lw } }); dMod = [Lib.minExtend(d02, { trace: tMod })]; } var line = this3.select(".legendlines").selectAll("path").data(showLine || showGradientLine ? [dMod] : []); line.enter().append("path").classed("js-line", true); line.exit().remove(); line.attr("d", pathStart + (showGradientLine ? "l" + itemWidth + ",0.0001" : "h" + itemWidth)).call(showLine ? Drawing.lineGroupStyle : lineGradient); } function stylePoints(d) { var styleGuide = getStyleGuide(d); var anyFill = styleGuide.anyFill; var anyLine = styleGuide.anyLine; var showLine = styleGuide.showLine; var showMarker = styleGuide.showMarker; var d02 = d[0]; var trace = d02.trace; var showText = !showMarker && !anyLine && !anyFill && subTypes.hasText(trace); var dMod, tMod; function boundVal(attrIn, arrayToValFn, bounds, cst) { var valIn = Lib.nestedProperty(trace, attrIn).get(); var valToBound = Lib.isArrayOrTypedArray(valIn) && arrayToValFn ? arrayToValFn(valIn) : valIn; if (constantItemSizing && valToBound && cst !== void 0) { valToBound = cst; } if (bounds) { if (valToBound < bounds[0]) return bounds[0]; else if (valToBound > bounds[1]) return bounds[1]; } return valToBound; } function pickFirst(array) { if (d02._distinct && d02.index && array[d02.index]) return array[d02.index]; return array[0]; } if (showMarker || showText || showLine) { var dEdit = {}; var tEdit = {}; if (showMarker) { dEdit.mc = boundVal("marker.color", pickFirst); dEdit.mx = boundVal("marker.symbol", pickFirst); dEdit.mo = boundVal("marker.opacity", Lib.mean, [0.2, 1]); dEdit.mlc = boundVal("marker.line.color", pickFirst); dEdit.mlw = boundVal("marker.line.width", Lib.mean, [0, 5], CST_MARKER_LINE_WIDTH); tEdit.marker = { sizeref: 1, sizemin: 1, sizemode: "diameter" }; var ms2 = boundVal("marker.size", Lib.mean, [2, 16], CST_MARKER_SIZE); dEdit.ms = ms2; tEdit.marker.size = ms2; } if (showLine) { tEdit.line = { width: boundVal("line.width", pickFirst, [0, 10], CST_LINE_WIDTH) }; } if (showText) { dEdit.tx = "Aa"; dEdit.tp = boundVal("textposition", pickFirst); dEdit.ts = 10; dEdit.tc = boundVal("textfont.color", pickFirst); dEdit.tf = boundVal("textfont.family", pickFirst); dEdit.tw = boundVal("textfont.weight", pickFirst); dEdit.ty = boundVal("textfont.style", pickFirst); dEdit.tv = boundVal("textfont.variant", pickFirst); dEdit.tC = boundVal("textfont.textcase", pickFirst); dEdit.tE = boundVal("textfont.lineposition", pickFirst); dEdit.tS = boundVal("textfont.shadow", pickFirst); } dMod = [Lib.minExtend(d02, dEdit)]; tMod = Lib.minExtend(trace, tEdit); tMod.selectedpoints = null; tMod.texttemplate = null; } var ptgroup = d3.select(this).select("g.legendpoints"); var pts = ptgroup.selectAll("path.scatterpts").data(showMarker ? dMod : []); pts.enter().insert("path", ":first-child").classed("scatterpts", true).attr("transform", centerTransform); pts.exit().remove(); pts.call(Drawing.pointStyle, tMod, gd2); if (showMarker) dMod[0].mrc = 3; var txt = ptgroup.selectAll("g.pointtext").data(showText ? dMod : []); txt.enter().append("g").classed("pointtext", true).append("text").attr("transform", centerTransform); txt.exit().remove(); txt.selectAll("text").call(Drawing.textPointStyle, tMod, gd2); } function styleWaterfalls(d) { var trace = d[0].trace; var isWaterfall = trace.type === "waterfall"; if (d[0]._distinct && isWaterfall) { var cont = d[0].trace[d[0].dir].marker; d[0].mc = cont.color; d[0].mlw = cont.line.width; d[0].mlc = cont.line.color; return styleBarLike(d, this, "waterfall"); } var ptsData = []; if (trace.visible && isWaterfall) { ptsData = d[0].hasTotals ? [["increasing", "M-6,-6V6H0Z"], ["totals", "M6,6H0L-6,-6H-0Z"], ["decreasing", "M6,6V-6H0Z"]] : [["increasing", "M-6,-6V6H6Z"], ["decreasing", "M6,6V-6H-6Z"]]; } var pts = d3.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(ptsData); pts.enter().append("path").classed("legendwaterfall", true).attr("transform", centerTransform).style("stroke-miterlimit", 1); pts.exit().remove(); pts.each(function(dd2) { var pt2 = d3.select(this); var cont2 = trace[dd2[0]].marker; var lw = boundLineWidth(void 0, cont2.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); pt2.attr("d", dd2[1]).style("stroke-width", lw + "px").call(Color.fill, cont2.color); if (lw) { pt2.call(Color.stroke, cont2.line.color); } }); } function styleBars(d) { styleBarLike(d, this); } function styleFunnels(d) { styleBarLike(d, this, "funnel"); } function styleBarLike(d, lThis, desiredType) { var trace = d[0].trace; var marker = trace.marker || {}; var markerLine = marker.line || {}; var pathStr = marker.cornerradius ? "M6,3a3,3,0,0,1-3,3H-3a3,3,0,0,1-3-3V-3a3,3,0,0,1,3-3H3a3,3,0,0,1,3,3Z" : ( // Square with rounded corners "M6,6H-6V-6H6Z" ); var isVisible = !desiredType ? Registry.traceIs(trace, "bar") : trace.visible && trace.type === desiredType; var barpath = d3.select(lThis).select("g.legendpoints").selectAll("path.legend" + desiredType).data(isVisible ? [d] : []); barpath.enter().append("path").classed("legend" + desiredType, true).attr("d", pathStr).attr("transform", centerTransform); barpath.exit().remove(); barpath.each(function(d2) { var p = d3.select(this); var d02 = d2[0]; var w = boundLineWidth(d02.mlw, marker.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); p.style("stroke-width", w + "px"); var mcc = d02.mcc; if (!legend._inHover && "mc" in d02) { var cOpts = extractOpts(marker); var mid = cOpts.mid; if (mid === void 0) mid = (cOpts.max + cOpts.min) / 2; mcc = Drawing.tryColorscale(marker, "")(mid); } var fillColor = mcc || d02.mc || marker.color; var markerPattern = marker.pattern; var patternShape = markerPattern && Drawing.getPatternAttr(markerPattern.shape, 0, ""); if (patternShape) { var patternBGColor = Drawing.getPatternAttr(markerPattern.bgcolor, 0, null); var patternFGColor = Drawing.getPatternAttr(markerPattern.fgcolor, 0, null); var patternFGOpacity = markerPattern.fgopacity; var patternSize = dimAttr(markerPattern.size, 8, 10); var patternSolidity = dimAttr(markerPattern.solidity, 0.5, 1); var patternID = "legend-" + trace.uid; p.call( Drawing.pattern, "legend", gd2, patternID, patternShape, patternSize, patternSolidity, mcc, markerPattern.fillmode, patternBGColor, patternFGColor, patternFGOpacity ); } else { p.call(Color.fill, fillColor); } if (w) Color.stroke(p, d02.mlc || markerLine.color); }); } function styleBoxes(d) { var trace = d[0].trace; var pts = d3.select(this).select("g.legendpoints").selectAll("path.legendbox").data(trace.visible && Registry.traceIs(trace, "box-violin") ? [d] : []); pts.enter().append("path").classed("legendbox", true).attr("d", "M6,6H-6V-6H6Z").attr("transform", centerTransform); pts.exit().remove(); pts.each(function() { var p = d3.select(this); if ((trace.boxpoints === "all" || trace.points === "all") && Color.opacity(trace.fillcolor) === 0 && Color.opacity((trace.line || {}).color) === 0) { var tMod = Lib.minExtend(trace, { marker: { size: constantItemSizing ? CST_MARKER_SIZE : Lib.constrain(trace.marker.size, 2, 16), sizeref: 1, sizemin: 1, sizemode: "diameter" } }); pts.call(Drawing.pointStyle, tMod, gd2); } else { var w = boundLineWidth(void 0, trace.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); p.style("stroke-width", w + "px").call(Color.fill, trace.fillcolor); if (w) Color.stroke(p, trace.line.color); } }); } function styleCandles(d) { var trace = d[0].trace; var pts = d3.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(trace.visible && trace.type === "candlestick" ? [d, d] : []); pts.enter().append("path").classed("legendcandle", true).attr("d", function(_, i) { if (i) return "M-15,0H-8M-8,6V-6H8Z"; return "M15,0H8M8,-6V6H-8Z"; }).attr("transform", centerTransform).style("stroke-miterlimit", 1); pts.exit().remove(); pts.each(function(_, i) { var p = d3.select(this); var cont = trace[i ? "increasing" : "decreasing"]; var w = boundLineWidth(void 0, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); p.style("stroke-width", w + "px").call(Color.fill, cont.fillcolor); if (w) Color.stroke(p, cont.line.color); }); } function styleOHLC(d) { var trace = d[0].trace; var pts = d3.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(trace.visible && trace.type === "ohlc" ? [d, d] : []); pts.enter().append("path").classed("legendohlc", true).attr("d", function(_, i) { if (i) return "M-15,0H0M-8,-6V0"; return "M15,0H0M8,6V0"; }).attr("transform", centerTransform).style("stroke-miterlimit", 1); pts.exit().remove(); pts.each(function(_, i) { var p = d3.select(this); var cont = trace[i ? "increasing" : "decreasing"]; var w = boundLineWidth(void 0, cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); p.style("fill", "none").call(Drawing.dashLine, cont.line.dash, w); if (w) Color.stroke(p, cont.line.color); }); } function stylePies(d) { stylePieLike(d, this, "pie"); } function styleFunnelareas(d) { stylePieLike(d, this, "funnelarea"); } function stylePieLike(d, lThis, desiredType) { var d02 = d[0]; var trace = d02.trace; var isVisible = !desiredType ? Registry.traceIs(trace, desiredType) : trace.visible && trace.type === desiredType; var pts = d3.select(lThis).select("g.legendpoints").selectAll("path.legend" + desiredType).data(isVisible ? [d] : []); pts.enter().append("path").classed("legend" + desiredType, true).attr("d", "M6,6H-6V-6H6Z").attr("transform", centerTransform); pts.exit().remove(); if (pts.size()) { var cont = trace.marker || {}; var lw = boundLineWidth(pieCastOption(cont.line.width, d02.pts), cont.line, MAX_MARKER_LINE_WIDTH, CST_MARKER_LINE_WIDTH); var opt = "pieLike"; var tMod = Lib.minExtend(trace, { marker: { line: { width: lw } } }, opt); var d0Mod = Lib.minExtend(d02, { trace: tMod }, opt); stylePie(pts, d0Mod, tMod, gd2); } } function styleSpatial(d) { var trace = d[0].trace; var useGradient; var ptsData = []; if (trace.visible) { switch (trace.type) { case "histogram2d": case "heatmap": ptsData = [ ["M-15,-2V4H15V-2Z"] // similar to contour ]; useGradient = true; break; case "choropleth": case "choroplethmapbox": case "choroplethmap": ptsData = [ ["M-6,-6V6H6V-6Z"] ]; useGradient = true; break; case "densitymapbox": case "densitymap": ptsData = [ ["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"] ]; useGradient = "radial"; break; case "cone": ptsData = [ ["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"], ["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"], ["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"] ]; useGradient = false; break; case "streamtube": ptsData = [ ["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"], ["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"], ["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"] ]; useGradient = false; break; case "surface": ptsData = [ ["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"], ["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"] ]; useGradient = true; break; case "mesh3d": ptsData = [ ["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6H6L0,6Z"] ]; useGradient = false; break; case "volume": ptsData = [ ["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6H6L0,6Z"] ]; useGradient = true; break; case "isosurface": ptsData = [ ["M-6,6H0L-6,-6Z"], ["M6,6H0L6,-6Z"], ["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"] ]; useGradient = false; break; } } var pts = d3.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(ptsData); pts.enter().append("path").classed("legend3dandfriends", true).attr("transform", centerTransform).style("stroke-miterlimit", 1); pts.exit().remove(); pts.each(function(dd2, i) { var pt2 = d3.select(this); var cOpts = extractOpts(trace); var colorscale = cOpts.colorscale; var reversescale = cOpts.reversescale; var fillGradient = function(s2) { if (s2.size()) { var gradientID = "legendfill-" + trace.uid; Drawing.gradient( s2, gd2, gradientID, getGradientDirection(reversescale, useGradient === "radial"), colorscale, "fill" ); } }; var fillColor; if (!colorscale) { var color = trace.vertexcolor || trace.facecolor || trace.color; fillColor = Lib.isArrayOrTypedArray(color) ? color[i] || color[0] : color; } else { if (!useGradient) { var len = colorscale.length; fillColor = i === 0 ? colorscale[reversescale ? len - 1 : 0][1] : ( // minimum i === 1 ? colorscale[reversescale ? 0 : len - 1][1] : ( // maximum colorscale[Math.floor((len - 1) / 2)][1] ) ); } } pt2.attr("d", dd2[0]); if (fillColor) { pt2.call(Color.fill, fillColor); } else { pt2.call(fillGradient); } }); } }; function getGradientDirection(reversescale, isRadial) { var str = isRadial ? "radial" : "horizontal"; return str + (reversescale ? "" : "reversed"); } function getStyleGuide(d) { var trace = d[0].trace; var contours = trace.contours; var showLine = subTypes.hasLines(trace); var showMarker = subTypes.hasMarkers(trace); var showFill = trace.visible && trace.fill && trace.fill !== "none"; var showGradientLine = false; var showGradientFill = false; if (contours) { var coloring = contours.coloring; if (coloring === "lines") { showGradientLine = true; } else { showLine = coloring === "none" || coloring === "heatmap" || contours.showlines; } if (contours.type === "constraint") { showFill = contours._operation !== "="; } else if (coloring === "fill" || coloring === "heatmap") { showGradientFill = true; } } return { showMarker, showLine, showFill, showGradientLine, showGradientFill, anyLine: showLine || showGradientLine, anyFill: showFill || showGradientFill }; } function dimAttr(v, dflt, max) { if (v && Lib.isArrayOrTypedArray(v)) return dflt; if (v > max) return max; return v; } } }); // node_modules/plotly.js/src/components/legend/draw.js var require_draw = __commonJS({ "node_modules/plotly.js/src/components/legend/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var Plots = require_plots(); var Registry = require_registry(); var Events = require_events2(); var dragElement = require_dragelement(); var Drawing = require_drawing(); var Color = require_color(); var svgTextUtils = require_svg_text_utils(); var handleClick = require_handle_click(); var constants = require_constants3(); var alignmentConstants = require_alignment(); var LINE_SPACING = alignmentConstants.LINE_SPACING; var FROM_TL = alignmentConstants.FROM_TL; var FROM_BR = alignmentConstants.FROM_BR; var getLegendData = require_get_legend_data(); var style = require_style(); var helpers = require_helpers3(); var MAIN_TITLE = 1; var LEGEND_PATTERN = /^legend[0-9]*$/; module2.exports = function draw(gd2, opts) { if (opts) { drawOne(gd2, opts); } else { var fullLayout = gd2._fullLayout; var newLegends = fullLayout._legends; var oldLegends = fullLayout._infolayer.selectAll('[class^="legend"]'); oldLegends.each(function() { var el = d3.select(this); var classes = el.attr("class"); var cls = classes.split(" ")[0]; if (cls.match(LEGEND_PATTERN) && newLegends.indexOf(cls) === -1) { el.remove(); } }); for (var i = 0; i < newLegends.length; i++) { var legendId = newLegends[i]; var legendObj = gd2._fullLayout[legendId]; drawOne(gd2, legendObj); } } }; function horizontalAlignTitle(titleEl, legendObj, bw) { if (legendObj.title.side !== "top center" && legendObj.title.side !== "top right") return; var font = legendObj.title.font; var lineHeight = font.size * LINE_SPACING; var titleOffset = 0; var textNode = titleEl.node(); var width = Drawing.bBox(textNode).width; if (legendObj.title.side === "top center") { titleOffset = 0.5 * (legendObj._width - 2 * bw - 2 * constants.titlePad - width); } else if (legendObj.title.side === "top right") { titleOffset = legendObj._width - 2 * bw - 2 * constants.titlePad - width; } svgTextUtils.positionText( titleEl, bw + constants.titlePad + titleOffset, bw + lineHeight ); } function drawOne(gd2, opts) { var legendObj = opts || {}; var fullLayout = gd2._fullLayout; var legendId = getId(legendObj); var clipId, layer; var inHover = legendObj._inHover; if (inHover) { layer = legendObj.layer; clipId = "hover"; } else { layer = fullLayout._infolayer; clipId = legendId; } if (!layer) return; clipId += fullLayout._uid; if (!gd2._legendMouseDownTime) gd2._legendMouseDownTime = 0; var legendData; if (!inHover) { var calcdata = (gd2.calcdata || []).slice(); var shapes = fullLayout.shapes; for (var i = 0; i < shapes.length; i++) { var shape = shapes[i]; if (!shape.showlegend) continue; var shapeLegend = { _isShape: true, _fullInput: shape, index: shape._index, name: shape.name || shape.label.text || "shape " + shape._index, legend: shape.legend, legendgroup: shape.legendgroup, legendgrouptitle: shape.legendgrouptitle, legendrank: shape.legendrank, legendwidth: shape.legendwidth, showlegend: shape.showlegend, visible: shape.visible, opacity: shape.opacity, mode: shape.type === "line" ? "lines" : "markers", line: shape.line, marker: { line: shape.line, color: shape.fillcolor, size: 12, symbol: shape.type === "rect" ? "square" : shape.type === "circle" ? "circle" : ( // case of path "hexagon2" ) } }; calcdata.push([{ trace: shapeLegend }]); } legendData = fullLayout.showlegend && getLegendData(calcdata, legendObj, fullLayout._legends.length > 1); } else { if (!legendObj.entries) return; legendData = getLegendData(legendObj.entries, legendObj); } var hiddenSlices = fullLayout.hiddenlabels || []; if (!inHover && (!fullLayout.showlegend || !legendData.length)) { layer.selectAll("." + legendId).remove(); fullLayout._topdefs.select("#" + clipId).remove(); return Plots.autoMargin(gd2, legendId); } var legend = Lib.ensureSingle(layer, "g", legendId, function(s) { if (!inHover) s.attr("pointer-events", "all"); }); var clipPath = Lib.ensureSingleById(fullLayout._topdefs, "clipPath", clipId, function(s) { s.append("rect"); }); var bg2 = Lib.ensureSingle(legend, "rect", "bg", function(s) { s.attr("shape-rendering", "crispEdges"); }); bg2.call(Color.stroke, legendObj.bordercolor).call(Color.fill, legendObj.bgcolor).style("stroke-width", legendObj.borderwidth + "px"); var scrollBox = Lib.ensureSingle(legend, "g", "scrollbox"); var title = legendObj.title; legendObj._titleWidth = 0; legendObj._titleHeight = 0; var titleEl; if (title.text) { titleEl = Lib.ensureSingle(scrollBox, "text", legendId + "titletext"); titleEl.attr("text-anchor", "start").call(Drawing.font, title.font).text(title.text); textLayout(titleEl, scrollBox, gd2, legendObj, MAIN_TITLE); } else { scrollBox.selectAll("." + legendId + "titletext").remove(); } var scrollBar = Lib.ensureSingle(legend, "rect", "scrollbar", function(s) { s.attr(constants.scrollBarEnterAttrs).call(Color.fill, constants.scrollBarColor); }); var groups = scrollBox.selectAll("g.groups").data(legendData); groups.enter().append("g").attr("class", "groups"); groups.exit().remove(); var traces = groups.selectAll("g.traces").data(Lib.identity); traces.enter().append("g").attr("class", "traces"); traces.exit().remove(); traces.style("opacity", function(d) { var trace = d[0].trace; if (Registry.traceIs(trace, "pie-like")) { return hiddenSlices.indexOf(d[0].label) !== -1 ? 0.5 : 1; } else { return trace.visible === "legendonly" ? 0.5 : 1; } }).each(function() { d3.select(this).call(drawTexts, gd2, legendObj); }).call(style, gd2, legendObj).each(function() { if (!inHover) d3.select(this).call(setupTraceToggle, gd2, legendId); }); Lib.syncOrAsync([ Plots.previousPromises, function() { return computeLegendDimensions(gd2, groups, traces, legendObj); }, function() { var gs2 = fullLayout._size; var bw = legendObj.borderwidth; var isPaperX = legendObj.xref === "paper"; var isPaperY = legendObj.yref === "paper"; if (title.text) { horizontalAlignTitle(titleEl, legendObj, bw); } if (!inHover) { var lx, ly; if (isPaperX) { lx = gs2.l + gs2.w * legendObj.x - FROM_TL[getXanchor(legendObj)] * legendObj._width; } else { lx = fullLayout.width * legendObj.x - FROM_TL[getXanchor(legendObj)] * legendObj._width; } if (isPaperY) { ly = gs2.t + gs2.h * (1 - legendObj.y) - FROM_TL[getYanchor(legendObj)] * legendObj._effHeight; } else { ly = fullLayout.height * (1 - legendObj.y) - FROM_TL[getYanchor(legendObj)] * legendObj._effHeight; } var expMargin = expandMargin(gd2, legendId, lx, ly); if (expMargin) return; if (fullLayout.margin.autoexpand) { var lx0 = lx; var ly0 = ly; lx = isPaperX ? Lib.constrain(lx, 0, fullLayout.width - legendObj._width) : lx0; ly = isPaperY ? Lib.constrain(ly, 0, fullLayout.height - legendObj._effHeight) : ly0; if (lx !== lx0) { Lib.log("Constrain " + legendId + ".x to make legend fit inside graph"); } if (ly !== ly0) { Lib.log("Constrain " + legendId + ".y to make legend fit inside graph"); } } Drawing.setTranslate(legend, lx, ly); } scrollBar.on(".drag", null); legend.on("wheel", null); if (inHover || legendObj._height <= legendObj._maxHeight || gd2._context.staticPlot) { var height = legendObj._effHeight; if (inHover) height = legendObj._height; bg2.attr({ width: legendObj._width - bw, height: height - bw, x: bw / 2, y: bw / 2 }); Drawing.setTranslate(scrollBox, 0, 0); clipPath.select("rect").attr({ width: legendObj._width - 2 * bw, height: height - 2 * bw, x: bw, y: bw }); Drawing.setClipUrl(scrollBox, clipId, gd2); Drawing.setRect(scrollBar, 0, 0, 0, 0); delete legendObj._scrollY; } else { var scrollBarHeight = Math.max( constants.scrollBarMinHeight, legendObj._effHeight * legendObj._effHeight / legendObj._height ); var scrollBarYMax = legendObj._effHeight - scrollBarHeight - 2 * constants.scrollBarMargin; var scrollBoxYMax = legendObj._height - legendObj._effHeight; var scrollRatio = scrollBarYMax / scrollBoxYMax; var scrollBoxY = Math.min(legendObj._scrollY || 0, scrollBoxYMax); bg2.attr({ width: legendObj._width - 2 * bw + constants.scrollBarWidth + constants.scrollBarMargin, height: legendObj._effHeight - bw, x: bw / 2, y: bw / 2 }); clipPath.select("rect").attr({ width: legendObj._width - 2 * bw + constants.scrollBarWidth + constants.scrollBarMargin, height: legendObj._effHeight - 2 * bw, x: bw, y: bw + scrollBoxY }); Drawing.setClipUrl(scrollBox, clipId, gd2); scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); legend.on("wheel", function() { scrollBoxY = Lib.constrain( legendObj._scrollY + d3.event.deltaY / scrollBarYMax * scrollBoxYMax, 0, scrollBoxYMax ); scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); if (scrollBoxY !== 0 && scrollBoxY !== scrollBoxYMax) { d3.event.preventDefault(); } }); var eventY0, eventY1, scrollBoxY0; var getScrollBarDragY = function(scrollBoxY02, eventY02, eventY12) { var y = (eventY12 - eventY02) / scrollRatio + scrollBoxY02; return Lib.constrain(y, 0, scrollBoxYMax); }; var getNaturalDragY = function(scrollBoxY02, eventY02, eventY12) { var y = (eventY02 - eventY12) / scrollRatio + scrollBoxY02; return Lib.constrain(y, 0, scrollBoxYMax); }; var scrollBarDrag = d3.behavior.drag().on("dragstart", function() { var e = d3.event.sourceEvent; if (e.type === "touchstart") { eventY0 = e.changedTouches[0].clientY; } else { eventY0 = e.clientY; } scrollBoxY0 = scrollBoxY; }).on("drag", function() { var e = d3.event.sourceEvent; if (e.buttons === 2 || e.ctrlKey) return; if (e.type === "touchmove") { eventY1 = e.changedTouches[0].clientY; } else { eventY1 = e.clientY; } scrollBoxY = getScrollBarDragY(scrollBoxY0, eventY0, eventY1); scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); }); scrollBar.call(scrollBarDrag); var scrollBoxTouchDrag = d3.behavior.drag().on("dragstart", function() { var e = d3.event.sourceEvent; if (e.type === "touchstart") { eventY0 = e.changedTouches[0].clientY; scrollBoxY0 = scrollBoxY; } }).on("drag", function() { var e = d3.event.sourceEvent; if (e.type === "touchmove") { eventY1 = e.changedTouches[0].clientY; scrollBoxY = getNaturalDragY(scrollBoxY0, eventY0, eventY1); scrollHandler(scrollBoxY, scrollBarHeight, scrollRatio); } }); scrollBox.call(scrollBoxTouchDrag); } function scrollHandler(scrollBoxY2, scrollBarHeight2, scrollRatio2) { legendObj._scrollY = gd2._fullLayout[legendId]._scrollY = scrollBoxY2; Drawing.setTranslate(scrollBox, 0, -scrollBoxY2); Drawing.setRect( scrollBar, legendObj._width, constants.scrollBarMargin + scrollBoxY2 * scrollRatio2, constants.scrollBarWidth, scrollBarHeight2 ); clipPath.select("rect").attr("y", bw + scrollBoxY2); } if (gd2._context.edits.legendPosition) { var xf2, yf2, x02, y02; legend.classed("cursor-move", true); dragElement.init({ element: legend.node(), gd: gd2, prepFn: function(e) { if (e.target === scrollBar.node()) { return; } var transform = Drawing.getTranslate(legend); x02 = transform.x; y02 = transform.y; }, moveFn: function(dx, dy) { if (x02 !== void 0 && y02 !== void 0) { var newX = x02 + dx; var newY = y02 + dy; Drawing.setTranslate(legend, newX, newY); xf2 = dragElement.align(newX, legendObj._width, gs2.l, gs2.l + gs2.w, legendObj.xanchor); yf2 = dragElement.align(newY + legendObj._height, -legendObj._height, gs2.t + gs2.h, gs2.t, legendObj.yanchor); } }, doneFn: function() { if (xf2 !== void 0 && yf2 !== void 0) { var obj = {}; obj[legendId + ".x"] = xf2; obj[legendId + ".y"] = yf2; Registry.call("_guiRelayout", gd2, obj); } }, clickFn: function(numClicks, e) { var clickedTrace = layer.selectAll("g.traces").filter(function() { var bbox = this.getBoundingClientRect(); return e.clientX >= bbox.left && e.clientX <= bbox.right && e.clientY >= bbox.top && e.clientY <= bbox.bottom; }); if (clickedTrace.size() > 0) { clickOrDoubleClick(gd2, legend, clickedTrace, numClicks, e); } } }); } } ], gd2); } function getTraceWidth(d, legendObj, textGap) { var legendItem = d[0]; var legendWidth = legendItem.width; var mode = legendObj.entrywidthmode; var traceLegendWidth = legendItem.trace.legendwidth || legendObj.entrywidth; if (mode === "fraction") return legendObj._maxWidth * traceLegendWidth; return textGap + (traceLegendWidth || legendWidth); } function clickOrDoubleClick(gd2, legend, legendItem, numClicks, evt) { var trace = legendItem.data()[0][0].trace; var evtData = { event: evt, node: legendItem.node(), curveNumber: trace.index, expandedIndex: trace._expandedIndex, data: gd2.data, layout: gd2.layout, frames: gd2._transitionData._frames, config: gd2._context, fullData: gd2._fullData, fullLayout: gd2._fullLayout }; if (trace._group) { evtData.group = trace._group; } if (Registry.traceIs(trace, "pie-like")) { evtData.label = legendItem.datum()[0].label; } var clickVal = Events.triggerHandler(gd2, "plotly_legendclick", evtData); if (numClicks === 1) { if (clickVal === false) return; legend._clickTimeout = setTimeout(function() { if (!gd2._fullLayout) return; handleClick(legendItem, gd2, numClicks); }, gd2._context.doubleClickDelay); } else if (numClicks === 2) { if (legend._clickTimeout) clearTimeout(legend._clickTimeout); gd2._legendMouseDownTime = 0; var dblClickVal = Events.triggerHandler(gd2, "plotly_legenddoubleclick", evtData); if (dblClickVal !== false && clickVal !== false) handleClick(legendItem, gd2, numClicks); } } function drawTexts(g, gd2, legendObj) { var legendId = getId(legendObj); var legendItem = g.data()[0][0]; var trace = legendItem.trace; var isPieLike = Registry.traceIs(trace, "pie-like"); var isEditable = !legendObj._inHover && gd2._context.edits.legendText && !isPieLike; var maxNameLength = legendObj._maxNameLength; var name, font; if (legendItem.groupTitle) { name = legendItem.groupTitle.text; font = legendItem.groupTitle.font; } else { font = legendObj.font; if (!legendObj.entries) { name = isPieLike ? legendItem.label : trace.name; if (trace._meta) { name = Lib.templateString(name, trace._meta); } } else { name = legendItem.text; } } var textEl = Lib.ensureSingle(g, "text", legendId + "text"); textEl.attr("text-anchor", "start").call(Drawing.font, font).text(isEditable ? ensureLength(name, maxNameLength) : name); var textGap = legendObj.indentation + legendObj.itemwidth + constants.itemGap * 2; svgTextUtils.positionText(textEl, textGap, 0); if (isEditable) { textEl.call(svgTextUtils.makeEditable, { gd: gd2, text: name }).call(textLayout, g, gd2, legendObj).on("edit", function(newName) { this.text(ensureLength(newName, maxNameLength)).call(textLayout, g, gd2, legendObj); var fullInput = legendItem.trace._fullInput || {}; var update = {}; if (Registry.hasTransform(fullInput, "groupby")) { var groupbyIndices = Registry.getTransformIndices(fullInput, "groupby"); var _index = groupbyIndices[groupbyIndices.length - 1]; var kcont = Lib.keyedContainer(fullInput, "transforms[" + _index + "].styles", "target", "value.name"); kcont.set(legendItem.trace._group, newName); update = kcont.constructUpdate(); } else { update.name = newName; } if (fullInput._isShape) { return Registry.call("_guiRelayout", gd2, "shapes[" + trace.index + "].name", update.name); } else { return Registry.call("_guiRestyle", gd2, update, trace.index); } }); } else { textLayout(textEl, g, gd2, legendObj); } } function ensureLength(str, maxLength) { var targetLength = Math.max(4, maxLength); if (str && str.trim().length >= targetLength / 2) return str; str = str || ""; for (var i = targetLength - str.length; i > 0; i--) str += " "; return str; } function setupTraceToggle(g, gd2, legendId) { var doubleClickDelay = gd2._context.doubleClickDelay; var newMouseDownTime; var numClicks = 1; var traceToggle = Lib.ensureSingle(g, "rect", legendId + "toggle", function(s) { if (!gd2._context.staticPlot) { s.style("cursor", "pointer").attr("pointer-events", "all"); } s.call(Color.fill, "rgba(0,0,0,0)"); }); if (gd2._context.staticPlot) return; traceToggle.on("mousedown", function() { newMouseDownTime = (/* @__PURE__ */ new Date()).getTime(); if (newMouseDownTime - gd2._legendMouseDownTime < doubleClickDelay) { numClicks += 1; } else { numClicks = 1; gd2._legendMouseDownTime = newMouseDownTime; } }); traceToggle.on("mouseup", function() { if (gd2._dragged || gd2._editing) return; var legend = gd2._fullLayout[legendId]; if ((/* @__PURE__ */ new Date()).getTime() - gd2._legendMouseDownTime > doubleClickDelay) { numClicks = Math.max(numClicks - 1, 1); } clickOrDoubleClick(gd2, legend, g, numClicks, d3.event); }); } function textLayout(s, g, gd2, legendObj, aTitle) { if (legendObj._inHover) s.attr("data-notex", true); svgTextUtils.convertToTspans(s, gd2, function() { computeTextDimensions(g, gd2, legendObj, aTitle); }); } function computeTextDimensions(g, gd2, legendObj, aTitle) { var legendItem = g.data()[0][0]; if (!legendObj._inHover && legendItem && !legendItem.trace.showlegend) { g.remove(); return; } var mathjaxGroup = g.select("g[class*=math-group]"); var mathjaxNode = mathjaxGroup.node(); var legendId = getId(legendObj); if (!legendObj) { legendObj = gd2._fullLayout[legendId]; } var bw = legendObj.borderwidth; var font; if (aTitle === MAIN_TITLE) { font = legendObj.title.font; } else if (legendItem.groupTitle) { font = legendItem.groupTitle.font; } else { font = legendObj.font; } var lineHeight = font.size * LINE_SPACING; var height, width; if (mathjaxNode) { var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; if (aTitle === MAIN_TITLE) { Drawing.setTranslate(mathjaxGroup, bw, bw + height * 0.75); } else { Drawing.setTranslate(mathjaxGroup, 0, height * 0.25); } } else { var cls = "." + legendId + (aTitle === MAIN_TITLE ? "title" : "") + "text"; var textEl = g.select(cls); var textLines = svgTextUtils.lineCount(textEl); var textNode = textEl.node(); height = lineHeight * textLines; width = textNode ? Drawing.bBox(textNode).width : 0; if (aTitle === MAIN_TITLE) { if (legendObj.title.side === "left") { width += constants.itemGap * 2; } svgTextUtils.positionText( textEl, bw + constants.titlePad, bw + lineHeight ); } else { var x = constants.itemGap * 2 + legendObj.indentation + legendObj.itemwidth; if (legendItem.groupTitle) { x = constants.itemGap; width -= legendObj.indentation + legendObj.itemwidth; } svgTextUtils.positionText( textEl, x, -lineHeight * ((textLines - 1) / 2 - 0.3) ); } } if (aTitle === MAIN_TITLE) { legendObj._titleWidth = width; legendObj._titleHeight = height; } else { legendItem.lineHeight = lineHeight; legendItem.height = Math.max(height, 16) + 3; legendItem.width = width; } } function getTitleSize(legendObj) { var w = 0; var h = 0; var side = legendObj.title.side; if (side) { if (side.indexOf("left") !== -1) { w = legendObj._titleWidth; } if (side.indexOf("top") !== -1) { h = legendObj._titleHeight; } } return [w, h]; } function computeLegendDimensions(gd2, groups, traces, legendObj) { var fullLayout = gd2._fullLayout; var legendId = getId(legendObj); if (!legendObj) { legendObj = fullLayout[legendId]; } var gs2 = fullLayout._size; var isVertical = helpers.isVertical(legendObj); var isGrouped = helpers.isGrouped(legendObj); var isFraction = legendObj.entrywidthmode === "fraction"; var bw = legendObj.borderwidth; var bw2 = 2 * bw; var itemGap = constants.itemGap; var textGap = legendObj.indentation + legendObj.itemwidth + itemGap * 2; var endPad = 2 * (bw + itemGap); var yanchor = getYanchor(legendObj); var isBelowPlotArea = legendObj.y < 0 || legendObj.y === 0 && yanchor === "top"; var isAbovePlotArea = legendObj.y > 1 || legendObj.y === 1 && yanchor === "bottom"; var traceGroupGap = legendObj.tracegroupgap; var legendGroupWidths = {}; legendObj._maxHeight = Math.max( isBelowPlotArea || isAbovePlotArea ? fullLayout.height / 2 : gs2.h, 30 ); var toggleRectWidth = 0; legendObj._width = 0; legendObj._height = 0; var titleSize = getTitleSize(legendObj); if (isVertical) { traces.each(function(d) { var h = d[0].height; Drawing.setTranslate( this, bw + titleSize[0], bw + titleSize[1] + legendObj._height + h / 2 + itemGap ); legendObj._height += h; legendObj._width = Math.max(legendObj._width, d[0].width); }); toggleRectWidth = textGap + legendObj._width; legendObj._width += itemGap + textGap + bw2; legendObj._height += endPad; if (isGrouped) { groups.each(function(d, i) { Drawing.setTranslate(this, 0, i * legendObj.tracegroupgap); }); legendObj._height += (legendObj._lgroupsLength - 1) * legendObj.tracegroupgap; } } else { var xanchor = getXanchor(legendObj); var isLeftOfPlotArea = legendObj.x < 0 || legendObj.x === 0 && xanchor === "right"; var isRightOfPlotArea = legendObj.x > 1 || legendObj.x === 1 && xanchor === "left"; var isBeyondPlotAreaY = isAbovePlotArea || isBelowPlotArea; var hw = fullLayout.width / 2; legendObj._maxWidth = Math.max( isLeftOfPlotArea ? isBeyondPlotAreaY && xanchor === "left" ? gs2.l + gs2.w : hw : isRightOfPlotArea ? isBeyondPlotAreaY && xanchor === "right" ? gs2.r + gs2.w : hw : gs2.w, 2 * textGap ); var maxItemWidth = 0; var combinedItemWidth = 0; traces.each(function(d) { var w = getTraceWidth(d, legendObj, textGap); maxItemWidth = Math.max(maxItemWidth, w); combinedItemWidth += w; }); toggleRectWidth = null; var maxRowWidth = 0; if (isGrouped) { var maxGroupHeightInRow = 0; var groupOffsetX = 0; var groupOffsetY = 0; groups.each(function() { var maxWidthInGroup = 0; var offsetY2 = 0; d3.select(this).selectAll("g.traces").each(function(d) { var w = getTraceWidth(d, legendObj, textGap); var h = d[0].height; Drawing.setTranslate( this, titleSize[0], titleSize[1] + bw + itemGap + h / 2 + offsetY2 ); offsetY2 += h; maxWidthInGroup = Math.max(maxWidthInGroup, w); legendGroupWidths[d[0].trace.legendgroup] = maxWidthInGroup; }); var next = maxWidthInGroup + itemGap; if ( // not on the first column already groupOffsetX > 0 && // goes beyound limit next + bw + groupOffsetX > legendObj._maxWidth ) { maxRowWidth = Math.max(maxRowWidth, groupOffsetX); groupOffsetX = 0; groupOffsetY += maxGroupHeightInRow + traceGroupGap; maxGroupHeightInRow = offsetY2; } else { maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY2); } Drawing.setTranslate(this, groupOffsetX, groupOffsetY); groupOffsetX += next; }); legendObj._width = Math.max(maxRowWidth, groupOffsetX) + bw; legendObj._height = groupOffsetY + maxGroupHeightInRow + endPad; } else { var nTraces = traces.size(); var oneRowLegend = combinedItemWidth + bw2 + (nTraces - 1) * itemGap < legendObj._maxWidth; var maxItemHeightInRow = 0; var offsetX = 0; var offsetY = 0; var rowWidth = 0; traces.each(function(d) { var h = d[0].height; var w = getTraceWidth(d, legendObj, textGap, isGrouped); var next = oneRowLegend ? w : maxItemWidth; if (!isFraction) { next += itemGap; } if (next + bw + offsetX - itemGap >= legendObj._maxWidth) { maxRowWidth = Math.max(maxRowWidth, rowWidth); offsetX = 0; offsetY += maxItemHeightInRow; legendObj._height += maxItemHeightInRow; maxItemHeightInRow = 0; } Drawing.setTranslate( this, titleSize[0] + bw + offsetX, titleSize[1] + bw + offsetY + h / 2 + itemGap ); rowWidth = offsetX + w + itemGap; offsetX += next; maxItemHeightInRow = Math.max(maxItemHeightInRow, h); }); if (oneRowLegend) { legendObj._width = offsetX + bw2; legendObj._height = maxItemHeightInRow + endPad; } else { legendObj._width = Math.max(maxRowWidth, rowWidth) + bw2; legendObj._height += maxItemHeightInRow + endPad; } } } legendObj._width = Math.ceil( Math.max( legendObj._width + titleSize[0], legendObj._titleWidth + 2 * (bw + constants.titlePad) ) ); legendObj._height = Math.ceil( Math.max( legendObj._height + titleSize[1], legendObj._titleHeight + 2 * (bw + constants.itemGap) ) ); legendObj._effHeight = Math.min(legendObj._height, legendObj._maxHeight); var edits = gd2._context.edits; var isEditable = edits.legendText || edits.legendPosition; traces.each(function(d) { var traceToggle = d3.select(this).select("." + legendId + "toggle"); var h = d[0].height; var legendgroup = d[0].trace.legendgroup; var traceWidth = getTraceWidth(d, legendObj, textGap); if (isGrouped && legendgroup !== "") { traceWidth = legendGroupWidths[legendgroup]; } var w = isEditable ? textGap : toggleRectWidth || traceWidth; if (!isVertical && !isFraction) { w += itemGap / 2; } Drawing.setRect(traceToggle, 0, -h / 2, w, h); }); } function expandMargin(gd2, legendId, lx, ly) { var fullLayout = gd2._fullLayout; var legendObj = fullLayout[legendId]; var xanchor = getXanchor(legendObj); var yanchor = getYanchor(legendObj); var isPaperX = legendObj.xref === "paper"; var isPaperY = legendObj.yref === "paper"; gd2._fullLayout._reservedMargin[legendId] = {}; var sideY = legendObj.y < 0.5 ? "b" : "t"; var sideX = legendObj.x < 0.5 ? "l" : "r"; var possibleReservedMargins = { r: fullLayout.width - lx, l: lx + legendObj._width, b: fullLayout.height - ly, t: ly + legendObj._effHeight }; if (isPaperX && isPaperY) { return Plots.autoMargin(gd2, legendId, { x: legendObj.x, y: legendObj.y, l: legendObj._width * FROM_TL[xanchor], r: legendObj._width * FROM_BR[xanchor], b: legendObj._effHeight * FROM_BR[yanchor], t: legendObj._effHeight * FROM_TL[yanchor] }); } else if (isPaperX) { gd2._fullLayout._reservedMargin[legendId][sideY] = possibleReservedMargins[sideY]; } else if (isPaperY) { gd2._fullLayout._reservedMargin[legendId][sideX] = possibleReservedMargins[sideX]; } else { if (legendObj.orientation === "v") { gd2._fullLayout._reservedMargin[legendId][sideX] = possibleReservedMargins[sideX]; } else { gd2._fullLayout._reservedMargin[legendId][sideY] = possibleReservedMargins[sideY]; } } } function getXanchor(legendObj) { return Lib.isRightAnchor(legendObj) ? "right" : Lib.isCenterAnchor(legendObj) ? "center" : "left"; } function getYanchor(legendObj) { return Lib.isBottomAnchor(legendObj) ? "bottom" : Lib.isMiddleAnchor(legendObj) ? "middle" : "top"; } function getId(legendObj) { return legendObj._id || "legend"; } } }); // node_modules/plotly.js/src/components/fx/hover.js var require_hover = __commonJS({ "node_modules/plotly.js/src/components/fx/hover.js"(exports2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var tinycolor = require_tinycolor(); var Lib = require_lib(); var pushUnique = Lib.pushUnique; var strTranslate = Lib.strTranslate; var strRotate = Lib.strRotate; var Events = require_events2(); var svgTextUtils = require_svg_text_utils(); var overrideCursor = require_override_cursor(); var Drawing = require_drawing(); var Color = require_color(); var dragElement = require_dragelement(); var Axes = require_axes(); var zindexSeparator = require_constants2().zindexSeparator; var Registry = require_registry(); var helpers = require_helpers2(); var constants = require_constants(); var legendSupplyDefaults = require_defaults3(); var legendDraw = require_draw(); var YANGLE = constants.YANGLE; var YA_RADIANS = Math.PI * YANGLE / 180; var YFACTOR = 1 / Math.sin(YA_RADIANS); var YSHIFTX = Math.cos(YA_RADIANS); var YSHIFTY = Math.sin(YA_RADIANS); var HOVERARROWSIZE = constants.HOVERARROWSIZE; var HOVERTEXTPAD = constants.HOVERTEXTPAD; var multipleHoverPoints = { box: true, ohlc: true, violin: true, candlestick: true }; var cartesianScatterPoints = { scatter: true, scattergl: true, splom: true }; function distanceSort(a, b) { return a.distance - b.distance; } exports2.hover = function hover(gd2, evt, subplot, noHoverEvent) { gd2 = Lib.getGraphDiv(gd2); var eventTarget = evt.target; Lib.throttle( gd2._fullLayout._uid + constants.HOVERID, constants.HOVERMINTIME, function() { _hover(gd2, evt, subplot, noHoverEvent, eventTarget); } ); }; exports2.loneHover = function loneHover(hoverItems, opts) { var multiHover = true; if (!Array.isArray(hoverItems)) { multiHover = false; hoverItems = [hoverItems]; } var gd2 = opts.gd; var gTop = getTopOffset(gd2); var gLeft = getLeftOffset(gd2); var pointsData = hoverItems.map(function(hoverItem) { var _x0 = hoverItem._x0 || hoverItem.x0 || hoverItem.x || 0; var _x1 = hoverItem._x1 || hoverItem.x1 || hoverItem.x || 0; var _y0 = hoverItem._y0 || hoverItem.y0 || hoverItem.y || 0; var _y1 = hoverItem._y1 || hoverItem.y1 || hoverItem.y || 0; var eventData = hoverItem.eventData; if (eventData) { var x02 = Math.min(_x0, _x1); var x12 = Math.max(_x0, _x1); var y02 = Math.min(_y0, _y1); var y12 = Math.max(_y0, _y1); var trace = hoverItem.trace; if (Registry.traceIs(trace, "gl3d")) { var container = gd2._fullLayout[trace.scene]._scene.container; var dx = container.offsetLeft; var dy = container.offsetTop; x02 += dx; x12 += dx; y02 += dy; y12 += dy; } eventData.bbox = { x0: x02 + gLeft, x1: x12 + gLeft, y0: y02 + gTop, y1: y12 + gTop }; if (opts.inOut_bbox) { opts.inOut_bbox.push(eventData.bbox); } } else { eventData = false; } return { color: hoverItem.color || Color.defaultLine, x0: hoverItem.x0 || hoverItem.x || 0, x1: hoverItem.x1 || hoverItem.x || 0, y0: hoverItem.y0 || hoverItem.y || 0, y1: hoverItem.y1 || hoverItem.y || 0, xLabel: hoverItem.xLabel, yLabel: hoverItem.yLabel, zLabel: hoverItem.zLabel, text: hoverItem.text, name: hoverItem.name, idealAlign: hoverItem.idealAlign, // optional extra bits of styling borderColor: hoverItem.borderColor, fontFamily: hoverItem.fontFamily, fontSize: hoverItem.fontSize, fontColor: hoverItem.fontColor, fontWeight: hoverItem.fontWeight, fontStyle: hoverItem.fontStyle, fontVariant: hoverItem.fontVariant, nameLength: hoverItem.nameLength, textAlign: hoverItem.textAlign, // filler to make createHoverText happy trace: hoverItem.trace || { index: 0, hoverinfo: "" }, xa: { _offset: 0 }, ya: { _offset: 0 }, index: 0, hovertemplate: hoverItem.hovertemplate || false, hovertemplateLabels: hoverItem.hovertemplateLabels || false, eventData }; }); var rotateLabels = false; var hoverText = createHoverText(pointsData, { gd: gd2, hovermode: "closest", rotateLabels, bgColor: opts.bgColor || Color.background, container: d3.select(opts.container), outerContainer: opts.outerContainer || opts.container }); var hoverLabel = hoverText.hoverLabels; var tooltipSpacing = 5; var lastBottomY = 0; var anchor = 0; hoverLabel.sort(function(a, b) { return a.y0 - b.y0; }).each(function(d, i) { var topY = d.y0 - d.by / 2; if (topY - tooltipSpacing < lastBottomY) { d.offset = lastBottomY - topY + tooltipSpacing; } else { d.offset = 0; } lastBottomY = topY + d.by + d.offset; if (i === opts.anchorIndex || 0) anchor = d.offset; }).each(function(d) { d.offset -= anchor; }); var scaleX = gd2._fullLayout._invScaleX; var scaleY = gd2._fullLayout._invScaleY; alignHoverText(hoverLabel, rotateLabels, scaleX, scaleY); return multiHover ? hoverLabel : hoverLabel.node(); }; function _hover(gd2, evt, subplot, noHoverEvent, eventTarget) { if (!subplot) subplot = "xy"; if (typeof subplot === "string") { subplot = subplot.split(zindexSeparator)[0]; } var subplots = Array.isArray(subplot) ? subplot : [subplot]; var spId; var fullLayout = gd2._fullLayout; var hoversubplots = fullLayout.hoversubplots; var plots = fullLayout._plots || []; var plotinfo = plots[subplot]; var hasCartesian = fullLayout._has("cartesian"); var hovermode = evt.hovermode || fullLayout.hovermode; var hovermodeHasX = (hovermode || "").charAt(0) === "x"; var hovermodeHasY = (hovermode || "").charAt(0) === "y"; var firstXaxis; var firstYaxis; if (hasCartesian && (hovermodeHasX || hovermodeHasY) && hoversubplots === "axis") { var subplotsLength = subplots.length; for (var p = 0; p < subplotsLength; p++) { spId = subplots[p]; if (plots[spId]) { firstXaxis = Axes.getFromId(gd2, spId, "x"); firstYaxis = Axes.getFromId(gd2, spId, "y"); var subplotsWith = (hovermodeHasX ? firstXaxis : firstYaxis)._subplotsWith; if (subplotsWith && subplotsWith.length) { for (var q = 0; q < subplotsWith.length; q++) { pushUnique(subplots, subplotsWith[q]); } } } } } if (plotinfo && hoversubplots !== "single") { var overlayedSubplots = plotinfo.overlays.map(function(pi2) { return pi2.id; }); subplots = subplots.concat(overlayedSubplots); } var len = subplots.length; var xaArray = new Array(len); var yaArray = new Array(len); var supportsCompare = false; for (var i = 0; i < len; i++) { spId = subplots[i]; if (plots[spId]) { supportsCompare = true; xaArray[i] = plots[spId].xaxis; yaArray[i] = plots[spId].yaxis; } else if (fullLayout[spId] && fullLayout[spId]._subplot) { var _subplot = fullLayout[spId]._subplot; xaArray[i] = _subplot.xaxis; yaArray[i] = _subplot.yaxis; } else { Lib.warn("Unrecognized subplot: " + spId); return; } } if (hovermode && !supportsCompare) hovermode = "closest"; if (["x", "y", "closest", "x unified", "y unified"].indexOf(hovermode) === -1 || !gd2.calcdata || gd2.querySelector(".zoombox") || gd2._dragging) { return dragElement.unhoverRaw(gd2, evt); } var hoverdistance = fullLayout.hoverdistance; if (hoverdistance === -1) hoverdistance = Infinity; var spikedistance = fullLayout.spikedistance; if (spikedistance === -1) spikedistance = Infinity; var hoverData = []; var searchData = []; var xvalArray, yvalArray; var itemnum, curvenum, cd2, trace, subplotId, subploti, _mode, xval, yval, pointData, closedataPreviousLength; var spikePoints = { hLinePoint: null, vLinePoint: null }; var hasOneHorizontalTrace = false; if (Array.isArray(evt)) { hovermode = "array"; for (itemnum = 0; itemnum < evt.length; itemnum++) { cd2 = gd2.calcdata[evt[itemnum].curveNumber || 0]; if (cd2) { trace = cd2[0].trace; if (cd2[0].trace.hoverinfo !== "skip") { searchData.push(cd2); if (trace.orientation === "h") { hasOneHorizontalTrace = true; } } } } } else { var zorderedCalcdata = gd2.calcdata.slice(); zorderedCalcdata.sort(function(a, b) { var aZorder = a[0].trace.zorder || 0; var bZorder = b[0].trace.zorder || 0; return aZorder - bZorder; }); for (curvenum = 0; curvenum < zorderedCalcdata.length; curvenum++) { cd2 = zorderedCalcdata[curvenum]; trace = cd2[0].trace; if (trace.hoverinfo !== "skip" && helpers.isTraceInSubplots(trace, subplots)) { searchData.push(cd2); if (trace.orientation === "h") { hasOneHorizontalTrace = true; } } } var hasUserCalledHover = !eventTarget; var xpx, ypx; if (hasUserCalledHover) { if ("xpx" in evt) xpx = evt.xpx; else xpx = xaArray[0]._length / 2; if ("ypx" in evt) ypx = evt.ypx; else ypx = yaArray[0]._length / 2; } else { if (Events.triggerHandler(gd2, "plotly_beforehover", evt) === false) { return; } var dbb = eventTarget.getBoundingClientRect(); xpx = evt.clientX - dbb.left; ypx = evt.clientY - dbb.top; fullLayout._calcInverseTransform(gd2); var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(xpx, ypx); xpx = transformedCoords[0]; ypx = transformedCoords[1]; if (xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) { return dragElement.unhoverRaw(gd2, evt); } } evt.pointerX = xpx + xaArray[0]._offset; evt.pointerY = ypx + yaArray[0]._offset; if ("xval" in evt) xvalArray = helpers.flat(subplots, evt.xval); else xvalArray = helpers.p2c(xaArray, xpx); if ("yval" in evt) yvalArray = helpers.flat(subplots, evt.yval); else yvalArray = helpers.p2c(yaArray, ypx); if (!isNumeric(xvalArray[0]) || !isNumeric(yvalArray[0])) { Lib.warn("Fx.hover failed", evt, gd2); return dragElement.unhoverRaw(gd2, evt); } } var distance = Infinity; function findHoverPoints(customXVal, customYVal) { for (curvenum = 0; curvenum < searchData.length; curvenum++) { cd2 = searchData[curvenum]; if (!cd2 || !cd2[0] || !cd2[0].trace) continue; trace = cd2[0].trace; if (trace.visible !== true || trace._length === 0) continue; if (["carpet", "contourcarpet"].indexOf(trace._module.name) !== -1) continue; _mode = hovermode; if (helpers.isUnifiedHover(_mode)) { _mode = _mode.charAt(0); } if (trace.type === "splom") { subploti = 0; subplotId = subplots[subploti]; } else { subplotId = helpers.getSubplot(trace); subploti = subplots.indexOf(subplotId); } pointData = { // trace properties cd: cd2, trace, xa: xaArray[subploti], ya: yaArray[subploti], // max distances for hover and spikes - for points that want to show but do not // want to override other points, set distance/spikeDistance equal to max*Distance // and it will not get filtered out but it will be guaranteed to have a greater // distance than any point that calculated a real distance. maxHoverDistance: hoverdistance, maxSpikeDistance: spikedistance, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, hoverdistance), // pixel distance or pseudo-distance // distance/pseudo-distance for spikes. This distance should always be calculated // as if in "closest" mode, and should only be set if this point should // generate a spike. spikeDistance: Infinity, // in some cases the spikes have different positioning from the hover label // they don't need x0/x1, just one position xSpike: void 0, ySpike: void 0, // where and how to display the hover label color: Color.defaultLine, // trace color name: trace.name, x0: void 0, x1: void 0, y0: void 0, y1: void 0, xLabelVal: void 0, yLabelVal: void 0, zLabelVal: void 0, text: void 0 }; if (fullLayout[subplotId]) { pointData.subplot = fullLayout[subplotId]._subplot; } if (fullLayout._splomScenes && fullLayout._splomScenes[trace.uid]) { pointData.scene = fullLayout._splomScenes[trace.uid]; } if (_mode === "array") { var selection = evt[curvenum]; if ("pointNumber" in selection) { pointData.index = selection.pointNumber; _mode = "closest"; } else { _mode = ""; if ("xval" in selection) { xval = selection.xval; _mode = "x"; } if ("yval" in selection) { yval = selection.yval; _mode = _mode ? "closest" : "y"; } } } else if (customXVal !== void 0 && customYVal !== void 0) { xval = customXVal; yval = customYVal; } else { xval = xvalArray[subploti]; yval = yvalArray[subploti]; } closedataPreviousLength = hoverData.length; if (hoverdistance !== 0) { if (trace._module && trace._module.hoverPoints) { var newPoints = trace._module.hoverPoints(pointData, xval, yval, _mode, { finiteRange: true, hoverLayer: fullLayout._hoverlayer, // options for splom when hovering on same axis hoversubplots, gd: gd2 }); if (newPoints) { var newPoint; for (var newPointNum = 0; newPointNum < newPoints.length; newPointNum++) { newPoint = newPoints[newPointNum]; if (isNumeric(newPoint.x0) && isNumeric(newPoint.y0)) { hoverData.push(cleanPoint(newPoint, hovermode)); } } } } else { Lib.log("Unrecognized trace type in hover:", trace); } } if (hovermode === "closest" && hoverData.length > closedataPreviousLength) { hoverData.splice(0, closedataPreviousLength); distance = hoverData[0].distance; } if (hasCartesian && spikedistance !== 0) { if (hoverData.length === 0) { pointData.distance = spikedistance; pointData.index = false; var closestPoints = trace._module.hoverPoints(pointData, xval, yval, "closest", { hoverLayer: fullLayout._hoverlayer }); if (closestPoints) { closestPoints = closestPoints.filter(function(point) { return point.spikeDistance <= spikedistance; }); } if (closestPoints && closestPoints.length) { var tmpPoint; var closestVPoints = closestPoints.filter(function(point) { return point.xa.showspikes && point.xa.spikesnap !== "hovered data"; }); if (closestVPoints.length) { var closestVPt = closestVPoints[0]; if (isNumeric(closestVPt.x0) && isNumeric(closestVPt.y0)) { tmpPoint = fillSpikePoint(closestVPt); if (!spikePoints.vLinePoint || spikePoints.vLinePoint.spikeDistance > tmpPoint.spikeDistance) { spikePoints.vLinePoint = tmpPoint; } } } var closestHPoints = closestPoints.filter(function(point) { return point.ya.showspikes && point.ya.spikesnap !== "hovered data"; }); if (closestHPoints.length) { var closestHPt = closestHPoints[0]; if (isNumeric(closestHPt.x0) && isNumeric(closestHPt.y0)) { tmpPoint = fillSpikePoint(closestHPt); if (!spikePoints.hLinePoint || spikePoints.hLinePoint.spikeDistance > tmpPoint.spikeDistance) { spikePoints.hLinePoint = tmpPoint; } } } } } } } } findHoverPoints(); function selectClosestPoint(pointsData, spikedistance2, spikeOnWinning2) { var resultPoint = null; var minDistance = Infinity; var thisSpikeDistance; for (var i2 = 0; i2 < pointsData.length; i2++) { if (firstXaxis && firstXaxis._id !== pointsData[i2].xa._id) continue; if (firstYaxis && firstYaxis._id !== pointsData[i2].ya._id) continue; thisSpikeDistance = pointsData[i2].spikeDistance; if (spikeOnWinning2 && i2 === 0) thisSpikeDistance = -Infinity; if (thisSpikeDistance <= minDistance && thisSpikeDistance <= spikedistance2) { resultPoint = pointsData[i2]; minDistance = thisSpikeDistance; } } return resultPoint; } function fillSpikePoint(point) { if (!point) return null; return { xa: point.xa, ya: point.ya, x: point.xSpike !== void 0 ? point.xSpike : (point.x0 + point.x1) / 2, y: point.ySpike !== void 0 ? point.ySpike : (point.y0 + point.y1) / 2, distance: point.distance, spikeDistance: point.spikeDistance, curveNumber: point.trace.index, color: point.color, pointNumber: point.index }; } var spikelineOpts = { fullLayout, container: fullLayout._hoverlayer, event: evt }; var oldspikepoints = gd2._spikepoints; var newspikepoints = { vLinePoint: spikePoints.vLinePoint, hLinePoint: spikePoints.hLinePoint }; gd2._spikepoints = newspikepoints; var sortHoverData = function() { var hoverDataInSubplot = hoverData.filter(function(a) { return firstXaxis && firstXaxis._id === a.xa._id && (firstYaxis && firstYaxis._id === a.ya._id); }); var hoverDataOutSubplot = hoverData.filter(function(a) { return !(firstXaxis && firstXaxis._id === a.xa._id && (firstYaxis && firstYaxis._id === a.ya._id)); }); hoverDataInSubplot.sort(distanceSort); hoverDataOutSubplot.sort(distanceSort); hoverData = hoverDataInSubplot.concat(hoverDataOutSubplot); hoverData = orderRangePoints(hoverData, hovermode); }; sortHoverData(); var axLetter = hovermode.charAt(0); var spikeOnWinning = (axLetter === "x" || axLetter === "y") && hoverData[0] && cartesianScatterPoints[hoverData[0].trace.type]; if (hasCartesian && spikedistance !== 0) { if (hoverData.length !== 0) { var tmpHPointData = hoverData.filter(function(point) { return point.ya.showspikes; }); var tmpHPoint = selectClosestPoint(tmpHPointData, spikedistance, spikeOnWinning); spikePoints.hLinePoint = fillSpikePoint(tmpHPoint); var tmpVPointData = hoverData.filter(function(point) { return point.xa.showspikes; }); var tmpVPoint = selectClosestPoint(tmpVPointData, spikedistance, spikeOnWinning); spikePoints.vLinePoint = fillSpikePoint(tmpVPoint); } } if (hoverData.length === 0) { var result = dragElement.unhoverRaw(gd2, evt); if (hasCartesian && (spikePoints.hLinePoint !== null || spikePoints.vLinePoint !== null)) { if (spikesChanged(oldspikepoints)) { createSpikelines(gd2, spikePoints, spikelineOpts); } } return result; } if (hasCartesian) { if (spikesChanged(oldspikepoints)) { createSpikelines(gd2, spikePoints, spikelineOpts); } } if (helpers.isXYhover(_mode) && hoverData[0].length !== 0 && hoverData[0].trace.type !== "splom") { var winningPoint = hoverData[0]; if (multipleHoverPoints[winningPoint.trace.type]) { hoverData = hoverData.filter(function(d) { return d.trace.index === winningPoint.trace.index; }); } else { hoverData = [winningPoint]; } var initLen = hoverData.length; var winX = getCoord("x", winningPoint, fullLayout); var winY = getCoord("y", winningPoint, fullLayout); findHoverPoints(winX, winY); var finalPoints = []; var seen = {}; var id2 = 0; var insert = function(newHd) { var key = multipleHoverPoints[newHd.trace.type] ? hoverDataKey(newHd) : newHd.trace.index; if (!seen[key]) { id2++; seen[key] = id2; finalPoints.push(newHd); } else { var oldId = seen[key] - 1; var oldHd = finalPoints[oldId]; if (oldId > 0 && Math.abs(newHd.distance) < Math.abs(oldHd.distance)) { finalPoints[oldId] = newHd; } } }; var k; for (k = 0; k < initLen; k++) { insert(hoverData[k]); } for (k = hoverData.length - 1; k > initLen - 1; k--) { insert(hoverData[k]); } hoverData = finalPoints; sortHoverData(); } var oldhoverdata = gd2._hoverdata; var newhoverdata = []; var gTop = getTopOffset(gd2); var gLeft = getLeftOffset(gd2); for (itemnum = 0; itemnum < hoverData.length; itemnum++) { var pt2 = hoverData[itemnum]; var eventData = helpers.makeEventData(pt2, pt2.trace, pt2.cd); if (pt2.hovertemplate !== false) { var ht2 = false; if (pt2.cd[pt2.index] && pt2.cd[pt2.index].ht) { ht2 = pt2.cd[pt2.index].ht; } pt2.hovertemplate = ht2 || pt2.trace.hovertemplate || false; } if (pt2.xa && pt2.ya) { var _x0 = pt2.x0 + pt2.xa._offset; var _x1 = pt2.x1 + pt2.xa._offset; var _y0 = pt2.y0 + pt2.ya._offset; var _y1 = pt2.y1 + pt2.ya._offset; var x02 = Math.min(_x0, _x1); var x12 = Math.max(_x0, _x1); var y02 = Math.min(_y0, _y1); var y12 = Math.max(_y0, _y1); eventData.bbox = { x0: x02 + gLeft, x1: x12 + gLeft, y0: y02 + gTop, y1: y12 + gTop }; } pt2.eventData = [eventData]; newhoverdata.push(eventData); } gd2._hoverdata = newhoverdata; var rotateLabels = hovermode === "y" && (searchData.length > 1 || hoverData.length > 1) || hovermode === "closest" && hasOneHorizontalTrace && hoverData.length > 1; var bgColor = Color.combine( fullLayout.plot_bgcolor || Color.background, fullLayout.paper_bgcolor ); var hoverText = createHoverText(hoverData, { gd: gd2, hovermode, rotateLabels, bgColor, container: fullLayout._hoverlayer, outerContainer: fullLayout._paper.node(), commonLabelOpts: fullLayout.hoverlabel, hoverdistance: fullLayout.hoverdistance }); var hoverLabels = hoverText.hoverLabels; if (!helpers.isUnifiedHover(hovermode)) { hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, hoverText.commonLabelBoundingBox); alignHoverText(hoverLabels, rotateLabels, fullLayout._invScaleX, fullLayout._invScaleY); } if (eventTarget && eventTarget.tagName) { var hasClickToShow = Registry.getComponentMethod("annotations", "hasClickToShow")(gd2, newhoverdata); overrideCursor(d3.select(eventTarget), hasClickToShow ? "pointer" : ""); } if (!eventTarget || noHoverEvent || !hoverChanged(gd2, evt, oldhoverdata)) return; if (oldhoverdata) { gd2.emit("plotly_unhover", { event: evt, points: oldhoverdata }); } gd2.emit("plotly_hover", { event: evt, points: gd2._hoverdata, xaxes: xaArray, yaxes: yaArray, xvals: xvalArray, yvals: yvalArray }); } function hoverDataKey(d) { return [d.trace.index, d.index, d.x0, d.y0, d.name, d.attr, d.xa ? d.xa._id : "", d.ya ? d.ya._id : ""].join(","); } var EXTRA_STRING_REGEX = /([\s\S]*)<\/extra>/; function createHoverText(hoverData, opts) { var gd2 = opts.gd; var fullLayout = gd2._fullLayout; var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; var container = opts.container; var outerContainer = opts.outerContainer; var commonLabelOpts = opts.commonLabelOpts || {}; if (hoverData.length === 0) return [[]]; var fontFamily = opts.fontFamily || constants.HOVERFONT; var fontSize = opts.fontSize || constants.HOVERFONTSIZE; var fontWeight = opts.fontWeight || fullLayout.font.weight; var fontStyle = opts.fontStyle || fullLayout.font.style; var fontVariant = opts.fontVariant || fullLayout.font.variant; var fontTextcase = opts.fontTextcase || fullLayout.font.textcase; var fontLineposition = opts.fontLineposition || fullLayout.font.lineposition; var fontShadow = opts.fontShadow || fullLayout.font.shadow; var c02 = hoverData[0]; var xa2 = c02.xa; var ya2 = c02.ya; var axLetter = hovermode.charAt(0); var axLabel = axLetter + "Label"; var t03 = c02[axLabel]; if (t03 === void 0 && xa2.type === "multicategory") { for (var q = 0; q < hoverData.length; q++) { t03 = hoverData[q][axLabel]; if (t03 !== void 0) break; } } var outerContainerBB = getBoundingClientRect(gd2, outerContainer); var outerTop = outerContainerBB.top; var outerWidth = outerContainerBB.width; var outerHeight = outerContainerBB.height; var showCommonLabel = t03 !== void 0 && c02.distance <= opts.hoverdistance && (hovermode === "x" || hovermode === "y"); if (showCommonLabel) { var allHaveZ = true; var i, traceHoverinfo; for (i = 0; i < hoverData.length; i++) { if (allHaveZ && hoverData[i].zLabel === void 0) allHaveZ = false; traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; if (traceHoverinfo) { var parts = Array.isArray(traceHoverinfo) ? traceHoverinfo : traceHoverinfo.split("+"); if (parts.indexOf("all") === -1 && parts.indexOf(hovermode) === -1) { showCommonLabel = false; break; } } } if (allHaveZ) showCommonLabel = false; } var commonLabel = container.selectAll("g.axistext").data(showCommonLabel ? [0] : []); commonLabel.enter().append("g").classed("axistext", true); commonLabel.exit().remove(); var commonLabelRect = { minX: 0, maxX: 0, minY: 0, maxY: 0 }; commonLabel.each(function() { var label = d3.select(this); var lpath = Lib.ensureSingle(label, "path", "", function(s) { s.style({ "stroke-width": "1px" }); }); var ltext = Lib.ensureSingle(label, "text", "", function(s) { s.attr("data-notex", 1); }); var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine; var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor); var contrastColor = Color.contrast(commonBgColor); var commonLabelOptsFont = commonLabelOpts.font; var commonLabelFont = { weight: commonLabelOptsFont.weight || fontWeight, style: commonLabelOptsFont.style || fontStyle, variant: commonLabelOptsFont.variant || fontVariant, textcase: commonLabelOptsFont.textcase || fontTextcase, lineposition: commonLabelOptsFont.lineposition || fontLineposition, shadow: commonLabelOptsFont.shadow || fontShadow, family: commonLabelOptsFont.family || fontFamily, size: commonLabelOptsFont.size || fontSize, color: commonLabelOptsFont.color || contrastColor }; lpath.style({ fill: commonBgColor, stroke: commonStroke }); ltext.text(t03).call(Drawing.font, commonLabelFont).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd2); label.attr("transform", ""); var tbb2 = getBoundingClientRect(gd2, ltext.node()); var lx2, ly2; if (hovermode === "x") { var topsign = xa2.side === "top" ? "-" : ""; ltext.attr("text-anchor", "middle").call(svgTextUtils.positionText, 0, xa2.side === "top" ? outerTop - tbb2.bottom - HOVERARROWSIZE - HOVERTEXTPAD : outerTop - tbb2.top + HOVERARROWSIZE + HOVERTEXTPAD); lx2 = xa2._offset + (c02.x0 + c02.x1) / 2; ly2 = ya2._offset + (xa2.side === "top" ? 0 : ya2._length); var halfWidth = tbb2.width / 2 + HOVERTEXTPAD; var tooltipMidX = lx2; if (lx2 < halfWidth) { tooltipMidX = halfWidth; } else if (lx2 > fullLayout.width - halfWidth) { tooltipMidX = fullLayout.width - halfWidth; } lpath.attr("d", "M" + (lx2 - tooltipMidX) + ",0L" + (lx2 - tooltipMidX + HOVERARROWSIZE) + "," + topsign + HOVERARROWSIZE + "H" + halfWidth + "v" + topsign + (HOVERTEXTPAD * 2 + tbb2.height) + "H" + -halfWidth + "V" + topsign + HOVERARROWSIZE + "H" + (lx2 - tooltipMidX - HOVERARROWSIZE) + "Z"); lx2 = tooltipMidX; commonLabelRect.minX = lx2 - halfWidth; commonLabelRect.maxX = lx2 + halfWidth; if (xa2.side === "top") { commonLabelRect.minY = ly2 - (HOVERTEXTPAD * 2 + tbb2.height); commonLabelRect.maxY = ly2 - HOVERTEXTPAD; } else { commonLabelRect.minY = ly2 + HOVERTEXTPAD; commonLabelRect.maxY = ly2 + (HOVERTEXTPAD * 2 + tbb2.height); } } else { var anchor; var sgn; var leftsign; if (ya2.side === "right") { anchor = "start"; sgn = 1; leftsign = ""; lx2 = xa2._offset + xa2._length; } else { anchor = "end"; sgn = -1; leftsign = "-"; lx2 = xa2._offset; } ly2 = ya2._offset + (c02.y0 + c02.y1) / 2; ltext.attr("text-anchor", anchor); lpath.attr("d", "M0,0L" + leftsign + HOVERARROWSIZE + "," + HOVERARROWSIZE + "V" + (HOVERTEXTPAD + tbb2.height / 2) + "h" + leftsign + (HOVERTEXTPAD * 2 + tbb2.width) + "V-" + (HOVERTEXTPAD + tbb2.height / 2) + "H" + leftsign + HOVERARROWSIZE + "V-" + HOVERARROWSIZE + "Z"); commonLabelRect.minY = ly2 - (HOVERTEXTPAD + tbb2.height / 2); commonLabelRect.maxY = ly2 + (HOVERTEXTPAD + tbb2.height / 2); if (ya2.side === "right") { commonLabelRect.minX = lx2 + HOVERARROWSIZE; commonLabelRect.maxX = lx2 + HOVERARROWSIZE + (HOVERTEXTPAD * 2 + tbb2.width); } else { commonLabelRect.minX = lx2 - HOVERARROWSIZE - (HOVERTEXTPAD * 2 + tbb2.width); commonLabelRect.maxX = lx2 - HOVERARROWSIZE; } var halfHeight = tbb2.height / 2; var lty = outerTop - tbb2.top - halfHeight; var clipId = "clip" + fullLayout._uid + "commonlabel" + ya2._id; var clipPath; if (lx2 < tbb2.width + 2 * HOVERTEXTPAD + HOVERARROWSIZE) { clipPath = "M-" + (HOVERARROWSIZE + HOVERTEXTPAD) + "-" + halfHeight + "h-" + (tbb2.width - HOVERTEXTPAD) + "V" + halfHeight + "h" + (tbb2.width - HOVERTEXTPAD) + "Z"; var ltx = tbb2.width - lx2 + HOVERTEXTPAD; svgTextUtils.positionText(ltext, ltx, lty); if (anchor === "end") { ltext.selectAll("tspan").each(function() { var s = d3.select(this); var dummy = Drawing.tester.append("text").text(s.text()).call(Drawing.font, commonLabelFont); var dummyBB = getBoundingClientRect(gd2, dummy.node()); if (Math.round(dummyBB.width) < Math.round(tbb2.width)) { s.attr("x", ltx - dummyBB.width); } dummy.remove(); }); } } else { svgTextUtils.positionText(ltext, sgn * (HOVERTEXTPAD + HOVERARROWSIZE), lty); clipPath = null; } var textClip = fullLayout._topclips.selectAll("#" + clipId).data(clipPath ? [0] : []); textClip.enter().append("clipPath").attr("id", clipId).append("path"); textClip.exit().remove(); textClip.select("path").attr("d", clipPath); Drawing.setClipUrl(ltext, clipPath ? clipId : null, gd2); } label.attr("transform", strTranslate(lx2, ly2)); }); if (helpers.isUnifiedHover(hovermode)) { container.selectAll("g.hovertext").remove(); var groupedHoverData = hoverData.filter(function(data) { return data.hoverinfo !== "none"; }); if (groupedHoverData.length === 0) return []; var hoverlabel = fullLayout.hoverlabel; var font = hoverlabel.font; var mockLayoutIn = { showlegend: true, legend: { title: { text: t03, font }, font, bgcolor: hoverlabel.bgcolor, bordercolor: hoverlabel.bordercolor, borderwidth: 1, tracegroupgap: 7, traceorder: fullLayout.legend ? fullLayout.legend.traceorder : void 0, orientation: "v" } }; var mockLayoutOut = { font }; legendSupplyDefaults(mockLayoutIn, mockLayoutOut, gd2._fullData); var mockLegend = mockLayoutOut.legend; mockLegend.entries = []; for (var j = 0; j < groupedHoverData.length; j++) { var pt2 = groupedHoverData[j]; if (pt2.hoverinfo === "none") continue; var texts = getHoverLabelText(pt2, true, hovermode, fullLayout, t03); var text = texts[0]; var name = texts[1]; pt2.name = name; if (name !== "") { pt2.text = name + " : " + text; } else { pt2.text = text; } var cd2 = pt2.cd[pt2.index]; if (cd2) { if (cd2.mc) pt2.mc = cd2.mc; if (cd2.mcc) pt2.mc = cd2.mcc; if (cd2.mlc) pt2.mlc = cd2.mlc; if (cd2.mlcc) pt2.mlc = cd2.mlcc; if (cd2.mlw) pt2.mlw = cd2.mlw; if (cd2.mrc) pt2.mrc = cd2.mrc; if (cd2.dir) pt2.dir = cd2.dir; } pt2._distinct = true; mockLegend.entries.push([pt2]); } mockLegend.entries.sort(function(a, b) { return a[0].trace.index - b[0].trace.index; }); mockLegend.layer = container; mockLegend._inHover = true; mockLegend._groupTitleFont = hoverlabel.grouptitlefont; legendDraw(gd2, mockLegend); var legendContainer = container.select("g.legend"); var tbb = getBoundingClientRect(gd2, legendContainer.node()); var tWidth = tbb.width + 2 * HOVERTEXTPAD; var tHeight = tbb.height + 2 * HOVERTEXTPAD; var winningPoint = groupedHoverData[0]; var avgX = (winningPoint.x0 + winningPoint.x1) / 2; var avgY = (winningPoint.y0 + winningPoint.y1) / 2; var pointWon = !(Registry.traceIs(winningPoint.trace, "bar-like") || Registry.traceIs(winningPoint.trace, "box-violin")); var lyBottom, lyTop; if (axLetter === "y") { if (pointWon) { lyTop = avgY - HOVERTEXTPAD; lyBottom = avgY + HOVERTEXTPAD; } else { lyTop = Math.min.apply(null, groupedHoverData.map(function(c) { return Math.min(c.y0, c.y1); })); lyBottom = Math.max.apply(null, groupedHoverData.map(function(c) { return Math.max(c.y0, c.y1); })); } } else { lyTop = lyBottom = Lib.mean(groupedHoverData.map(function(c) { return (c.y0 + c.y1) / 2; })) - tHeight / 2; } var lxRight, lxLeft; if (axLetter === "x") { if (pointWon) { lxRight = avgX + HOVERTEXTPAD; lxLeft = avgX - HOVERTEXTPAD; } else { lxRight = Math.max.apply(null, groupedHoverData.map(function(c) { return Math.max(c.x0, c.x1); })); lxLeft = Math.min.apply(null, groupedHoverData.map(function(c) { return Math.min(c.x0, c.x1); })); } } else { lxRight = lxLeft = Lib.mean(groupedHoverData.map(function(c) { return (c.x0 + c.x1) / 2; })) - tWidth / 2; } var xOffset = xa2._offset; var yOffset = ya2._offset; lyBottom += yOffset; lxRight += xOffset; lxLeft += xOffset - tWidth; lyTop += yOffset - tHeight; var lx, ly; if (lxRight + tWidth < outerWidth && lxRight >= 0) { lx = lxRight; } else if (lxLeft + tWidth < outerWidth && lxLeft >= 0) { lx = lxLeft; } else if (xOffset + tWidth < outerWidth) { lx = xOffset; } else { if (lxRight - avgX < avgX - lxLeft + tWidth) { lx = outerWidth - tWidth; } else { lx = 0; } } lx += HOVERTEXTPAD; if (lyBottom + tHeight < outerHeight && lyBottom >= 0) { ly = lyBottom; } else if (lyTop + tHeight < outerHeight && lyTop >= 0) { ly = lyTop; } else if (yOffset + tHeight < outerHeight) { ly = yOffset; } else { if (lyBottom - avgY < avgY - lyTop + tHeight) { ly = outerHeight - tHeight; } else { ly = 0; } } ly += HOVERTEXTPAD; legendContainer.attr("transform", strTranslate(lx - 1, ly - 1)); return legendContainer; } var hoverLabels = container.selectAll("g.hovertext").data(hoverData, function(d) { return hoverDataKey(d); }); hoverLabels.enter().append("g").classed("hovertext", true).each(function() { var g = d3.select(this); g.append("rect").call(Color.fill, Color.addOpacity(bgColor, 0.8)); g.append("text").classed("name", true); g.append("path").style("stroke-width", "1px"); g.append("text").classed("nums", true).call(Drawing.font, { weight: fontWeight, style: fontStyle, variant: fontVariant, textcase: fontTextcase, lineposition: fontLineposition, shadow: fontShadow, family: fontFamily, size: fontSize }); }); hoverLabels.exit().remove(); hoverLabels.each(function(d) { var g = d3.select(this).attr("transform", ""); var dColor = d.color; if (Array.isArray(dColor)) { dColor = dColor[d.eventData[0].pointNumber]; } var color0 = d.bgcolor || dColor; var numsColor = Color.combine( Color.opacity(color0) ? color0 : Color.defaultLine, bgColor ); var nameColor = Color.combine( Color.opacity(dColor) ? dColor : Color.defaultLine, bgColor ); var contrastColor = d.borderColor || Color.contrast(numsColor); var texts2 = getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t03, g); var text2 = texts2[0]; var name2 = texts2[1]; var tx = g.select("text.nums").call(Drawing.font, { family: d.fontFamily || fontFamily, size: d.fontSize || fontSize, color: d.fontColor || contrastColor, weight: d.fontWeight || fontWeight, style: d.fontStyle || fontStyle, variant: d.fontVariant || fontVariant, textcase: d.fontTextcase || fontTextcase, lineposition: d.fontLineposition || fontLineposition, shadow: d.fontShadow || fontShadow }).text(text2).attr("data-notex", 1).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd2); var tx2 = g.select("text.name"); var tx2width = 0; var tx2height = 0; if (name2 && name2 !== text2) { tx2.call(Drawing.font, { family: d.fontFamily || fontFamily, size: d.fontSize || fontSize, color: nameColor, weight: d.fontWeight || fontWeight, style: d.fontStyle || fontStyle, variant: d.fontVariant || fontVariant, textcase: d.fontTextcase || fontTextcase, lineposition: d.fontLineposition || fontLineposition, shadow: d.fontShadow || fontShadow }).text(name2).attr("data-notex", 1).call(svgTextUtils.positionText, 0, 0).call(svgTextUtils.convertToTspans, gd2); var t2bb = getBoundingClientRect(gd2, tx2.node()); tx2width = t2bb.width + 2 * HOVERTEXTPAD; tx2height = t2bb.height + 2 * HOVERTEXTPAD; } else { tx2.remove(); g.select("rect").remove(); } g.select("path").style({ fill: numsColor, stroke: contrastColor }); var htx = d.xa._offset + (d.x0 + d.x1) / 2; var hty = d.ya._offset + (d.y0 + d.y1) / 2; var dx = Math.abs(d.x1 - d.x0); var dy = Math.abs(d.y1 - d.y0); var tbb2 = getBoundingClientRect(gd2, tx.node()); var tbbWidth = tbb2.width / fullLayout._invScaleX; var tbbHeight = tbb2.height / fullLayout._invScaleY; d.ty0 = (outerTop - tbb2.top) / fullLayout._invScaleY; d.bx = tbbWidth + 2 * HOVERTEXTPAD; d.by = Math.max(tbbHeight + 2 * HOVERTEXTPAD, tx2height); d.anchor = "start"; d.txwidth = tbbWidth; d.tx2width = tx2width; d.offset = 0; var txTotalWidth = (tbbWidth + HOVERARROWSIZE + HOVERTEXTPAD + tx2width) * fullLayout._invScaleX; var anchorStartOK, anchorEndOK; if (rotateLabels) { d.pos = htx; anchorStartOK = hty + dy / 2 + txTotalWidth <= outerHeight; anchorEndOK = hty - dy / 2 - txTotalWidth >= 0; if ((d.idealAlign === "top" || !anchorStartOK) && anchorEndOK) { hty -= dy / 2; d.anchor = "end"; } else if (anchorStartOK) { hty += dy / 2; d.anchor = "start"; } else { d.anchor = "middle"; } d.crossPos = hty; } else { d.pos = hty; anchorStartOK = htx + dx / 2 + txTotalWidth <= outerWidth; anchorEndOK = htx - dx / 2 - txTotalWidth >= 0; if ((d.idealAlign === "left" || !anchorStartOK) && anchorEndOK) { htx -= dx / 2; d.anchor = "end"; } else if (anchorStartOK) { htx += dx / 2; d.anchor = "start"; } else { d.anchor = "middle"; var txHalfWidth = txTotalWidth / 2; var overflowR = htx + txHalfWidth - outerWidth; var overflowL = htx - txHalfWidth; if (overflowR > 0) htx -= overflowR; if (overflowL < 0) htx += -overflowL; } d.crossPos = htx; } tx.attr("text-anchor", d.anchor); if (tx2width) tx2.attr("text-anchor", d.anchor); g.attr("transform", strTranslate(htx, hty) + (rotateLabels ? strRotate(YANGLE) : "")); }); return { hoverLabels, commonLabelBoundingBox: commonLabelRect }; } function getHoverLabelText(d, showCommonLabel, hovermode, fullLayout, t03, g) { var name = ""; var text = ""; if (d.nameOverride !== void 0) d.name = d.nameOverride; if (d.name) { if (d.trace._meta) { d.name = Lib.templateString(d.name, d.trace._meta); } name = plainText(d.name, d.nameLength); } var h02 = hovermode.charAt(0); var h12 = h02 === "x" ? "y" : "x"; if (d.zLabel !== void 0) { if (d.xLabel !== void 0) text += "x: " + d.xLabel + "
"; if (d.yLabel !== void 0) text += "y: " + d.yLabel + "
"; if (d.trace.type !== "choropleth" && d.trace.type !== "choroplethmapbox" && d.trace.type !== "choroplethmap") { text += (text ? "z: " : "") + d.zLabel; } } else if (showCommonLabel && d[h02 + "Label"] === t03) { text = d[h12 + "Label"] || ""; } else if (d.xLabel === void 0) { if (d.yLabel !== void 0 && d.trace.type !== "scattercarpet") { text = d.yLabel; } } else if (d.yLabel === void 0) text = d.xLabel; else text = "(" + d.xLabel + ", " + d.yLabel + ")"; if ((d.text || d.text === 0) && !Array.isArray(d.text)) { text += (text ? "
" : "") + d.text; } if (d.extraText !== void 0) text += (text ? "
" : "") + d.extraText; if (g && text === "" && !d.hovertemplate) { if (name === "") g.remove(); text = name; } var hovertemplate = d.hovertemplate || false; if (hovertemplate) { var labels = d.hovertemplateLabels || d; if (d[h02 + "Label"] !== t03) { labels[h02 + "other"] = labels[h02 + "Val"]; labels[h02 + "otherLabel"] = labels[h02 + "Label"]; } text = Lib.hovertemplateString( hovertemplate, labels, fullLayout._d3locale, d.eventData[0] || {}, d.trace._meta ); text = text.replace(EXTRA_STRING_REGEX, function(match, extra) { name = plainText(extra, d.nameLength); return ""; }); } return [text, name]; } function hoverAvoidOverlaps(hoverLabels, rotateLabels, fullLayout, commonLabelBoundingBox) { var axKey = rotateLabels ? "xa" : "ya"; var crossAxKey = rotateLabels ? "ya" : "xa"; var nummoves = 0; var axSign = 1; var nLabels = hoverLabels.size(); var pointgroups = new Array(nLabels); var k = 0; var axisLabelMinX = commonLabelBoundingBox.minX; var axisLabelMaxX = commonLabelBoundingBox.maxX; var axisLabelMinY = commonLabelBoundingBox.minY; var axisLabelMaxY = commonLabelBoundingBox.maxY; var pX = function(x) { return x * fullLayout._invScaleX; }; var pY = function(y) { return y * fullLayout._invScaleY; }; hoverLabels.each(function(d) { var ax = d[axKey]; var crossAx = d[crossAxKey]; var axIsX = ax._id.charAt(0) === "x"; var rng = ax.range; if (k === 0 && rng && rng[0] > rng[1] !== axIsX) { axSign = -1; } var pmin = 0; var pmax = axIsX ? fullLayout.width : fullLayout.height; if (fullLayout.hovermode === "x" || fullLayout.hovermode === "y") { var offsets = getHoverLabelOffsets(d, rotateLabels); var anchor = d.anchor; var horzSign = anchor === "end" ? -1 : 1; var labelMin; var labelMax; if (anchor === "middle") { labelMin = d.crossPos + (axIsX ? pY(offsets.y - d.by / 2) : pX(d.bx / 2 + d.tx2width / 2)); labelMax = labelMin + (axIsX ? pY(d.by) : pX(d.bx)); } else { if (axIsX) { labelMin = d.crossPos + pY(HOVERARROWSIZE + offsets.y) - pY(d.by / 2 - HOVERARROWSIZE); labelMax = labelMin + pY(d.by); } else { var startX = pX(horzSign * HOVERARROWSIZE + offsets.x); var endX = startX + pX(horzSign * d.bx); labelMin = d.crossPos + Math.min(startX, endX); labelMax = d.crossPos + Math.max(startX, endX); } } if (axIsX) { if (axisLabelMinY !== void 0 && axisLabelMaxY !== void 0 && Math.min(labelMax, axisLabelMaxY) - Math.max(labelMin, axisLabelMinY) > 1) { if (crossAx.side === "left") { pmin = crossAx._mainLinePosition; pmax = fullLayout.width; } else { pmax = crossAx._mainLinePosition; } } } else { if (axisLabelMinX !== void 0 && axisLabelMaxX !== void 0 && Math.min(labelMax, axisLabelMaxX) - Math.max(labelMin, axisLabelMinX) > 1) { if (crossAx.side === "top") { pmin = crossAx._mainLinePosition; pmax = fullLayout.height; } else { pmax = crossAx._mainLinePosition; } } } } pointgroups[k++] = [{ datum: d, traceIndex: d.trace.index, dp: 0, pos: d.pos, posref: d.posref, size: d.by * (axIsX ? YFACTOR : 1) / 2, pmin, pmax }]; }); pointgroups.sort(function(a, b) { return a[0].posref - b[0].posref || // for equal positions, sort trace indices increasing or decreasing // depending on whether the axis is reversed or not... so stacked // traces will generally keep their order even if one trace adds // nothing to the stack. axSign * (b[0].traceIndex - a[0].traceIndex); }); var donepositioning, topOverlap, bottomOverlap, i, j, pti, sumdp; function constrainGroup(grp2) { var minPt = grp2[0]; var maxPt = grp2[grp2.length - 1]; topOverlap = minPt.pmin - minPt.pos - minPt.dp + minPt.size; bottomOverlap = maxPt.pos + maxPt.dp + maxPt.size - minPt.pmax; if (topOverlap > 0.01) { for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp += topOverlap; donepositioning = false; } if (bottomOverlap < 0.01) return; if (topOverlap < -0.01) { for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp -= bottomOverlap; donepositioning = false; } if (!donepositioning) return; var deleteCount = 0; for (i = 0; i < grp2.length; i++) { pti = grp2[i]; if (pti.pos + pti.dp + pti.size > minPt.pmax) deleteCount++; } for (i = grp2.length - 1; i >= 0; i--) { if (deleteCount <= 0) break; pti = grp2[i]; if (pti.pos > minPt.pmax - 1) { pti.del = true; deleteCount--; } } for (i = 0; i < grp2.length; i++) { if (deleteCount <= 0) break; pti = grp2[i]; if (pti.pos < minPt.pmin + 1) { pti.del = true; deleteCount--; bottomOverlap = pti.size * 2; for (j = grp2.length - 1; j >= 0; j--) grp2[j].dp -= bottomOverlap; } } for (i = grp2.length - 1; i >= 0; i--) { if (deleteCount <= 0) break; pti = grp2[i]; if (pti.pos + pti.dp + pti.size > minPt.pmax) { pti.del = true; deleteCount--; } } } while (!donepositioning && nummoves <= nLabels) { nummoves++; donepositioning = true; i = 0; while (i < pointgroups.length - 1) { var g02 = pointgroups[i]; var g12 = pointgroups[i + 1]; var p02 = g02[g02.length - 1]; var p12 = g12[0]; topOverlap = p02.pos + p02.dp + p02.size - p12.pos - p12.dp + p12.size; if (topOverlap > 0.01) { for (j = g12.length - 1; j >= 0; j--) g12[j].dp += topOverlap; g02.push.apply(g02, g12); pointgroups.splice(i + 1, 1); sumdp = 0; for (j = g02.length - 1; j >= 0; j--) sumdp += g02[j].dp; bottomOverlap = sumdp / g02.length; for (j = g02.length - 1; j >= 0; j--) g02[j].dp -= bottomOverlap; donepositioning = false; } else i++; } pointgroups.forEach(constrainGroup); } for (i = pointgroups.length - 1; i >= 0; i--) { var grp = pointgroups[i]; for (j = grp.length - 1; j >= 0; j--) { var pt2 = grp[j]; var hoverPt = pt2.datum; hoverPt.offset = pt2.dp; hoverPt.del = pt2.del; } } } function getHoverLabelOffsets(hoverLabel, rotateLabels) { var offsetX = 0; var offsetY = hoverLabel.offset; if (rotateLabels) { offsetY *= -YSHIFTY; offsetX = hoverLabel.offset * YSHIFTX; } return { x: offsetX, y: offsetY }; } function getTextShiftX(hoverLabel) { var alignShift = { start: 1, end: -1, middle: 0 }[hoverLabel.anchor]; var textShiftX = alignShift * (HOVERARROWSIZE + HOVERTEXTPAD); var text2ShiftX = textShiftX + alignShift * (hoverLabel.txwidth + HOVERTEXTPAD); var isMiddle = hoverLabel.anchor === "middle"; if (isMiddle) { textShiftX -= hoverLabel.tx2width / 2; text2ShiftX += hoverLabel.txwidth / 2 + HOVERTEXTPAD; } return { alignShift, textShiftX, text2ShiftX }; } function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) { var pX = function(x) { return x * scaleX; }; var pY = function(y) { return y * scaleY; }; hoverLabels.each(function(d) { var g = d3.select(this); if (d.del) return g.remove(); var tx = g.select("text.nums"); var anchor = d.anchor; var horzSign = anchor === "end" ? -1 : 1; var shiftX = getTextShiftX(d); var offsets = getHoverLabelOffsets(d, rotateLabels); var offsetX = offsets.x; var offsetY = offsets.y; var isMiddle = anchor === "middle"; g.select("path").attr("d", isMiddle ? ( // middle aligned: rect centered on data "M-" + pX(d.bx / 2 + d.tx2width / 2) + "," + pY(offsetY - d.by / 2) + "h" + pX(d.bx) + "v" + pY(d.by) + "h-" + pX(d.bx) + "Z" ) : ( // left or right aligned: side rect with arrow to data "M0,0L" + pX(horzSign * HOVERARROWSIZE + offsetX) + "," + pY(HOVERARROWSIZE + offsetY) + "v" + pY(d.by / 2 - HOVERARROWSIZE) + "h" + pX(horzSign * d.bx) + "v-" + pY(d.by) + "H" + pX(horzSign * HOVERARROWSIZE + offsetX) + "V" + pY(offsetY - HOVERARROWSIZE) + "Z" )); var posX = offsetX + shiftX.textShiftX; var posY = offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD; var textAlign = d.textAlign || "auto"; if (textAlign !== "auto") { if (textAlign === "left" && anchor !== "start") { tx.attr("text-anchor", "start"); posX = isMiddle ? -d.bx / 2 - d.tx2width / 2 + HOVERTEXTPAD : -d.bx - HOVERTEXTPAD; } else if (textAlign === "right" && anchor !== "end") { tx.attr("text-anchor", "end"); posX = isMiddle ? d.bx / 2 - d.tx2width / 2 - HOVERTEXTPAD : d.bx + HOVERTEXTPAD; } } tx.call(svgTextUtils.positionText, pX(posX), pY(posY)); if (d.tx2width) { g.select("text.name").call( svgTextUtils.positionText, pX(shiftX.text2ShiftX + shiftX.alignShift * HOVERTEXTPAD + offsetX), pY(offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) ); g.select("rect").call( Drawing.setRect, pX(shiftX.text2ShiftX + (shiftX.alignShift - 1) * d.tx2width / 2 + offsetX), pY(offsetY - d.by / 2 - 1), pX(d.tx2width), pY(d.by + 2) ); } }); } function cleanPoint(d, hovermode) { var index = d.index; var trace = d.trace || {}; var cd0 = d.cd[0]; var cd2 = d.cd[index] || {}; function pass(v) { return v || isNumeric(v) && v === 0; } var getVal = Array.isArray(index) ? function(calcKey, traceKey) { var v = Lib.castOption(cd0, index, calcKey); return pass(v) ? v : Lib.extractOption({}, trace, "", traceKey); } : function(calcKey, traceKey) { return Lib.extractOption(cd2, trace, calcKey, traceKey); }; function fill(key, calcKey, traceKey) { var val = getVal(calcKey, traceKey); if (pass(val)) d[key] = val; } fill("hoverinfo", "hi", "hoverinfo"); fill("bgcolor", "hbg", "hoverlabel.bgcolor"); fill("borderColor", "hbc", "hoverlabel.bordercolor"); fill("fontFamily", "htf", "hoverlabel.font.family"); fill("fontSize", "hts", "hoverlabel.font.size"); fill("fontColor", "htc", "hoverlabel.font.color"); fill("fontWeight", "htw", "hoverlabel.font.weight"); fill("fontStyle", "hty", "hoverlabel.font.style"); fill("fontVariant", "htv", "hoverlabel.font.variant"); fill("nameLength", "hnl", "hoverlabel.namelength"); fill("textAlign", "hta", "hoverlabel.align"); d.posref = hovermode === "y" || hovermode === "closest" && trace.orientation === "h" ? d.xa._offset + (d.x0 + d.x1) / 2 : d.ya._offset + (d.y0 + d.y1) / 2; d.x0 = Lib.constrain(d.x0, 0, d.xa._length); d.x1 = Lib.constrain(d.x1, 0, d.xa._length); d.y0 = Lib.constrain(d.y0, 0, d.ya._length); d.y1 = Lib.constrain(d.y1, 0, d.ya._length); if (d.xLabelVal !== void 0) { d.xLabel = "xLabel" in d ? d.xLabel : Axes.hoverLabelText(d.xa, d.xLabelVal, trace.xhoverformat); d.xVal = d.xa.c2d(d.xLabelVal); } if (d.yLabelVal !== void 0) { d.yLabel = "yLabel" in d ? d.yLabel : Axes.hoverLabelText(d.ya, d.yLabelVal, trace.yhoverformat); d.yVal = d.ya.c2d(d.yLabelVal); } if (d.zLabelVal !== void 0 && d.zLabel === void 0) { d.zLabel = String(d.zLabelVal); } if (!isNaN(d.xerr) && !(d.xa.type === "log" && d.xerr <= 0)) { var xeText = Axes.tickText(d.xa, d.xa.c2l(d.xerr), "hover").text; if (d.xerrneg !== void 0) { d.xLabel += " +" + xeText + " / -" + Axes.tickText(d.xa, d.xa.c2l(d.xerrneg), "hover").text; } else d.xLabel += " ± " + xeText; if (hovermode === "x") d.distance += 1; } if (!isNaN(d.yerr) && !(d.ya.type === "log" && d.yerr <= 0)) { var yeText = Axes.tickText(d.ya, d.ya.c2l(d.yerr), "hover").text; if (d.yerrneg !== void 0) { d.yLabel += " +" + yeText + " / -" + Axes.tickText(d.ya, d.ya.c2l(d.yerrneg), "hover").text; } else d.yLabel += " ± " + yeText; if (hovermode === "y") d.distance += 1; } var infomode = d.hoverinfo || d.trace.hoverinfo; if (infomode && infomode !== "all") { infomode = Array.isArray(infomode) ? infomode : infomode.split("+"); if (infomode.indexOf("x") === -1) d.xLabel = void 0; if (infomode.indexOf("y") === -1) d.yLabel = void 0; if (infomode.indexOf("z") === -1) d.zLabel = void 0; if (infomode.indexOf("text") === -1) d.text = void 0; if (infomode.indexOf("name") === -1) d.name = void 0; } return d; } function createSpikelines(gd2, closestPoints, opts) { var container = opts.container; var fullLayout = opts.fullLayout; var gs2 = fullLayout._size; var evt = opts.event; var showY = !!closestPoints.hLinePoint; var showX = !!closestPoints.vLinePoint; var xa2, ya2; container.selectAll(".spikeline").remove(); if (!(showX || showY)) return; var contrastColor = Color.combine(fullLayout.plot_bgcolor, fullLayout.paper_bgcolor); if (showY) { var hLinePoint = closestPoints.hLinePoint; var hLinePointX, hLinePointY; xa2 = hLinePoint && hLinePoint.xa; ya2 = hLinePoint && hLinePoint.ya; var ySnap = ya2.spikesnap; if (ySnap === "cursor") { hLinePointX = evt.pointerX; hLinePointY = evt.pointerY; } else { hLinePointX = xa2._offset + hLinePoint.x; hLinePointY = ya2._offset + hLinePoint.y; } var dfltHLineColor = tinycolor.readability(hLinePoint.color, contrastColor) < 1.5 ? Color.contrast(contrastColor) : hLinePoint.color; var yMode = ya2.spikemode; var yThickness = ya2.spikethickness; var yColor = ya2.spikecolor || dfltHLineColor; var xEdge = Axes.getPxPosition(gd2, ya2); var xBase, xEndSpike; if (yMode.indexOf("toaxis") !== -1 || yMode.indexOf("across") !== -1) { if (yMode.indexOf("toaxis") !== -1) { xBase = xEdge; xEndSpike = hLinePointX; } if (yMode.indexOf("across") !== -1) { var xAcross0 = ya2._counterDomainMin; var xAcross1 = ya2._counterDomainMax; if (ya2.anchor === "free") { xAcross0 = Math.min(xAcross0, ya2.position); xAcross1 = Math.max(xAcross1, ya2.position); } xBase = gs2.l + xAcross0 * gs2.w; xEndSpike = gs2.l + xAcross1 * gs2.w; } container.insert("line", ":first-child").attr({ x1: xBase, x2: xEndSpike, y1: hLinePointY, y2: hLinePointY, "stroke-width": yThickness, stroke: yColor, "stroke-dasharray": Drawing.dashStyle(ya2.spikedash, yThickness) }).classed("spikeline", true).classed("crisp", true); container.insert("line", ":first-child").attr({ x1: xBase, x2: xEndSpike, y1: hLinePointY, y2: hLinePointY, "stroke-width": yThickness + 2, stroke: contrastColor }).classed("spikeline", true).classed("crisp", true); } if (yMode.indexOf("marker") !== -1) { container.insert("circle", ":first-child").attr({ cx: xEdge + (ya2.side !== "right" ? yThickness : -yThickness), cy: hLinePointY, r: yThickness, fill: yColor }).classed("spikeline", true); } } if (showX) { var vLinePoint = closestPoints.vLinePoint; var vLinePointX, vLinePointY; xa2 = vLinePoint && vLinePoint.xa; ya2 = vLinePoint && vLinePoint.ya; var xSnap = xa2.spikesnap; if (xSnap === "cursor") { vLinePointX = evt.pointerX; vLinePointY = evt.pointerY; } else { vLinePointX = xa2._offset + vLinePoint.x; vLinePointY = ya2._offset + vLinePoint.y; } var dfltVLineColor = tinycolor.readability(vLinePoint.color, contrastColor) < 1.5 ? Color.contrast(contrastColor) : vLinePoint.color; var xMode = xa2.spikemode; var xThickness = xa2.spikethickness; var xColor = xa2.spikecolor || dfltVLineColor; var yEdge = Axes.getPxPosition(gd2, xa2); var yBase, yEndSpike; if (xMode.indexOf("toaxis") !== -1 || xMode.indexOf("across") !== -1) { if (xMode.indexOf("toaxis") !== -1) { yBase = yEdge; yEndSpike = vLinePointY; } if (xMode.indexOf("across") !== -1) { var yAcross0 = xa2._counterDomainMin; var yAcross1 = xa2._counterDomainMax; if (xa2.anchor === "free") { yAcross0 = Math.min(yAcross0, xa2.position); yAcross1 = Math.max(yAcross1, xa2.position); } yBase = gs2.t + (1 - yAcross1) * gs2.h; yEndSpike = gs2.t + (1 - yAcross0) * gs2.h; } container.insert("line", ":first-child").attr({ x1: vLinePointX, x2: vLinePointX, y1: yBase, y2: yEndSpike, "stroke-width": xThickness, stroke: xColor, "stroke-dasharray": Drawing.dashStyle(xa2.spikedash, xThickness) }).classed("spikeline", true).classed("crisp", true); container.insert("line", ":first-child").attr({ x1: vLinePointX, x2: vLinePointX, y1: yBase, y2: yEndSpike, "stroke-width": xThickness + 2, stroke: contrastColor }).classed("spikeline", true).classed("crisp", true); } if (xMode.indexOf("marker") !== -1) { container.insert("circle", ":first-child").attr({ cx: vLinePointX, cy: yEdge - (xa2.side !== "top" ? xThickness : -xThickness), r: xThickness, fill: xColor }).classed("spikeline", true); } } } function hoverChanged(gd2, evt, oldhoverdata) { if (!oldhoverdata || oldhoverdata.length !== gd2._hoverdata.length) return true; for (var i = oldhoverdata.length - 1; i >= 0; i--) { var oldPt = oldhoverdata[i]; var newPt = gd2._hoverdata[i]; if (oldPt.curveNumber !== newPt.curveNumber || String(oldPt.pointNumber) !== String(newPt.pointNumber) || String(oldPt.pointNumbers) !== String(newPt.pointNumbers)) { return true; } } return false; } function spikesChanged(gd2, oldspikepoints) { if (!oldspikepoints) return true; if (oldspikepoints.vLinePoint !== gd2._spikepoints.vLinePoint || oldspikepoints.hLinePoint !== gd2._spikepoints.hLinePoint) return true; return false; } function plainText(s, len) { return svgTextUtils.plainText(s || "", { len, allowedTags: ["br", "sub", "sup", "b", "i", "em", "s", "u"] }); } function orderRangePoints(hoverData, hovermode) { var axLetter = hovermode.charAt(0); var first = []; var second2 = []; var last = []; for (var i = 0; i < hoverData.length; i++) { var d = hoverData[i]; if (Registry.traceIs(d.trace, "bar-like") || Registry.traceIs(d.trace, "box-violin")) { last.push(d); } else if (d.trace[axLetter + "period"]) { second2.push(d); } else { first.push(d); } } return first.concat(second2).concat(last); } function getCoord(axLetter, winningPoint, fullLayout) { var ax = winningPoint[axLetter + "a"]; var val = winningPoint[axLetter + "Val"]; var cd0 = winningPoint.cd[0]; if (ax.type === "category" || ax.type === "multicategory") val = ax._categoriesMap[val]; else if (ax.type === "date") { var periodalignment = winningPoint.trace[axLetter + "periodalignment"]; if (periodalignment) { var d = winningPoint.cd[winningPoint.index]; var start = d[axLetter + "Start"]; if (start === void 0) start = d[axLetter]; var end = d[axLetter + "End"]; if (end === void 0) end = d[axLetter]; var diff = end - start; if (periodalignment === "end") { val += diff; } else if (periodalignment === "middle") { val += diff / 2; } } val = ax.d2c(val); } if (cd0 && cd0.t && cd0.t.posLetter === ax._id) { if (fullLayout.boxmode === "group" || fullLayout.violinmode === "group") { val += cd0.t.dPos; } } return val; } function getTopOffset(gd2) { return gd2.offsetTop + gd2.clientTop; } function getLeftOffset(gd2) { return gd2.offsetLeft + gd2.clientLeft; } function getBoundingClientRect(gd2, node) { var fullLayout = gd2._fullLayout; var rect = node.getBoundingClientRect(); var x02 = rect.left; var y02 = rect.top; var x12 = x02 + rect.width; var y12 = y02 + rect.height; var A = Lib.apply3DTransform(fullLayout._invTransform)(x02, y02); var B = Lib.apply3DTransform(fullLayout._invTransform)(x12, y12); var Ax = A[0]; var Ay = A[1]; var Bx = B[0]; var By = B[1]; return { x: Ax, y: Ay, width: Bx - Ax, height: By - Ay, top: Math.min(Ay, By), left: Math.min(Ax, Bx), right: Math.max(Ax, Bx), bottom: Math.max(Ay, By) }; } } }); // node_modules/plotly.js/src/components/fx/hoverlabel_defaults.js var require_hoverlabel_defaults = __commonJS({ "node_modules/plotly.js/src/components/fx/hoverlabel_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Color = require_color(); var isUnifiedHover = require_helpers2().isUnifiedHover; module2.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts) { opts = opts || {}; var hasLegend = contOut.legend; function inheritFontAttr(attr) { if (!opts.font[attr]) { opts.font[attr] = hasLegend ? contOut.legend.font[attr] : contOut.font[attr]; } } if (contOut && isUnifiedHover(contOut.hovermode)) { if (!opts.font) opts.font = {}; inheritFontAttr("size"); inheritFontAttr("family"); inheritFontAttr("color"); inheritFontAttr("weight"); inheritFontAttr("style"); inheritFontAttr("variant"); if (hasLegend) { if (!opts.bgcolor) opts.bgcolor = Color.combine(contOut.legend.bgcolor, contOut.paper_bgcolor); if (!opts.bordercolor) opts.bordercolor = contOut.legend.bordercolor; } else { if (!opts.bgcolor) opts.bgcolor = contOut.paper_bgcolor; } } coerce("hoverlabel.bgcolor", opts.bgcolor); coerce("hoverlabel.bordercolor", opts.bordercolor); coerce("hoverlabel.namelength", opts.namelength); Lib.coerceFont(coerce, "hoverlabel.font", opts.font); coerce("hoverlabel.align", opts.align); }; } }); // node_modules/plotly.js/src/components/fx/layout_global_defaults.js var require_layout_global_defaults = __commonJS({ "node_modules/plotly.js/src/components/fx/layout_global_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var handleHoverLabelDefaults = require_hoverlabel_defaults(); var layoutAttributes = require_layout_attributes(); module2.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; } }); // node_modules/plotly.js/src/components/fx/defaults.js var require_defaults4 = __commonJS({ "node_modules/plotly.js/src/components/fx/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var attributes = require_attributes(); var handleHoverLabelDefaults = require_hoverlabel_defaults(); module2.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } var opts = Lib.extendFlat({}, layout.hoverlabel); if (traceOut.hovertemplate) opts.namelength = -1; handleHoverLabelDefaults(traceIn, traceOut, coerce, opts); }; } }); // node_modules/plotly.js/src/components/fx/hovermode_defaults.js var require_hovermode_defaults = __commonJS({ "node_modules/plotly.js/src/components/fx/hovermode_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var layoutAttributes = require_layout_attributes(); module2.exports = function handleHoverModeDefaults(layoutIn, layoutOut) { function coerce(attr, dflt) { if (layoutOut[attr] !== void 0) return layoutOut[attr]; return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } coerce("clickmode"); coerce("hoversubplots"); return coerce("hovermode"); }; } }); // node_modules/plotly.js/src/components/fx/layout_defaults.js var require_layout_defaults2 = __commonJS({ "node_modules/plotly.js/src/components/fx/layout_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var layoutAttributes = require_layout_attributes(); var handleHoverModeDefaults = require_hovermode_defaults(); var handleHoverLabelDefaults = require_hoverlabel_defaults(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } var hoverMode = handleHoverModeDefaults(layoutIn, layoutOut); if (hoverMode) { coerce("hoverdistance"); coerce("spikedistance"); } var dragMode = coerce("dragmode"); if (dragMode === "select") coerce("selectdirection"); var hasMapbox = layoutOut._has("mapbox"); var hasMap = layoutOut._has("map"); var hasGeo = layoutOut._has("geo"); var len = layoutOut._basePlotModules.length; if (layoutOut.dragmode === "zoom" && ((hasMapbox || hasMap || hasGeo) && len === 1 || (hasMapbox || hasMap) && hasGeo && len === 2)) { layoutOut.dragmode = "pan"; } handleHoverLabelDefaults(layoutIn, layoutOut, coerce); Lib.coerceFont(coerce, "hoverlabel.grouptitlefont", layoutOut.hoverlabel.font); }; } }); // node_modules/plotly.js/src/components/fx/calc.js var require_calc2 = __commonJS({ "node_modules/plotly.js/src/components/fx/calc.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Registry = require_registry(); module2.exports = function calc(gd2) { var calcdata = gd2.calcdata; var fullLayout = gd2._fullLayout; function makeCoerceHoverInfo(trace2) { return function(val) { return Lib.coerceHoverinfo({ hoverinfo: val }, { _module: trace2._module }, fullLayout); }; } for (var i = 0; i < calcdata.length; i++) { var cd2 = calcdata[i]; var trace = cd2[0].trace; if (Registry.traceIs(trace, "pie-like")) continue; var fillFn = Registry.traceIs(trace, "2dMap") ? paste : Lib.fillArray; fillFn(trace.hoverinfo, cd2, "hi", makeCoerceHoverInfo(trace)); if (trace.hovertemplate) fillFn(trace.hovertemplate, cd2, "ht"); if (!trace.hoverlabel) continue; fillFn(trace.hoverlabel.bgcolor, cd2, "hbg"); fillFn(trace.hoverlabel.bordercolor, cd2, "hbc"); fillFn(trace.hoverlabel.font.size, cd2, "hts"); fillFn(trace.hoverlabel.font.color, cd2, "htc"); fillFn(trace.hoverlabel.font.family, cd2, "htf"); fillFn(trace.hoverlabel.font.weight, cd2, "htw"); fillFn(trace.hoverlabel.font.style, cd2, "hty"); fillFn(trace.hoverlabel.font.variant, cd2, "htv"); fillFn(trace.hoverlabel.namelength, cd2, "hnl"); fillFn(trace.hoverlabel.align, cd2, "hta"); } }; function paste(traceAttr, cd2, cdAttr, fn) { fn = fn || Lib.identity; if (Array.isArray(traceAttr)) { cd2[0][cdAttr] = fn(traceAttr); } } } }); // node_modules/plotly.js/src/components/fx/click.js var require_click = __commonJS({ "node_modules/plotly.js/src/components/fx/click.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var hover = require_hover().hover; module2.exports = function click(gd2, evt, subplot) { var annotationsDone = Registry.getComponentMethod("annotations", "onClick")(gd2, gd2._hoverdata); if (subplot !== void 0) { hover(gd2, evt, subplot, true); } function emitClick() { gd2.emit("plotly_click", { points: gd2._hoverdata, event: evt }); } if (gd2._hoverdata && evt && evt.target) { if (annotationsDone && annotationsDone.then) { annotationsDone.then(emitClick); } else emitClick(); if (evt.stopImmediatePropagation) evt.stopImmediatePropagation(); } }; } }); // node_modules/plotly.js/src/components/fx/index.js var require_fx = __commonJS({ "node_modules/plotly.js/src/components/fx/index.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var dragElement = require_dragelement(); var helpers = require_helpers2(); var layoutAttributes = require_layout_attributes(); var hoverModule = require_hover(); module2.exports = { moduleType: "component", name: "fx", constants: require_constants(), schema: { layout: layoutAttributes }, attributes: require_attributes(), layoutAttributes, supplyLayoutGlobalDefaults: require_layout_global_defaults(), supplyDefaults: require_defaults4(), supplyLayoutDefaults: require_layout_defaults2(), calc: require_calc2(), getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, quadrature: helpers.quadrature, appendArrayPointValue: helpers.appendArrayPointValue, castHoverOption, castHoverinfo, hover: hoverModule.hover, unhover: dragElement.unhover, loneHover: hoverModule.loneHover, loneUnhover, click: require_click() }; function loneUnhover(containerOrSelection) { var selection = Lib.isD3Selection(containerOrSelection) ? containerOrSelection : d3.select(containerOrSelection); selection.selectAll("g.hovertext").remove(); selection.selectAll(".spikeline").remove(); } function castHoverOption(trace, ptNumber, attr) { return Lib.castOption(trace, ptNumber, "hoverlabel." + attr); } function castHoverinfo(trace, fullLayout, ptNumber) { function _coerce(val) { return Lib.coerceHoverinfo({ hoverinfo: val }, { _module: trace._module }, fullLayout); } return Lib.castOption(trace, ptNumber, "hoverinfo", _coerce); } } }); // node_modules/plotly.js/src/components/dragelement/helpers.js var require_helpers5 = __commonJS({ "node_modules/plotly.js/src/components/dragelement/helpers.js"(exports2) { "use strict"; exports2.selectMode = function(dragmode) { return dragmode === "lasso" || dragmode === "select"; }; exports2.drawMode = function(dragmode) { return dragmode === "drawclosedpath" || dragmode === "drawopenpath" || dragmode === "drawline" || dragmode === "drawrect" || dragmode === "drawcircle"; }; exports2.openMode = function(dragmode) { return dragmode === "drawline" || dragmode === "drawopenpath"; }; exports2.rectMode = function(dragmode) { return dragmode === "select" || dragmode === "drawline" || dragmode === "drawrect" || dragmode === "drawcircle"; }; exports2.freeMode = function(dragmode) { return dragmode === "lasso" || dragmode === "drawclosedpath" || dragmode === "drawopenpath"; }; exports2.selectingOrDrawing = function(dragmode) { return exports2.freeMode(dragmode) || exports2.rectMode(dragmode); }; } }); // node_modules/plotly.js/src/lib/clear_gl_canvases.js var require_clear_gl_canvases = __commonJS({ "node_modules/plotly.js/src/lib/clear_gl_canvases.js"(exports2, module2) { "use strict"; module2.exports = function clearGlCanvases(gd2) { var fullLayout = gd2._fullLayout; if (fullLayout._glcanvas && fullLayout._glcanvas.size()) { fullLayout._glcanvas.each(function(d) { if (d.regl) d.regl.clear({ color: true, depth: true }); }); } }; } }); // node_modules/plotly.js/src/fonts/ploticon.js var require_ploticon = __commonJS({ "node_modules/plotly.js/src/fonts/ploticon.js"(exports2, module2) { "use strict"; module2.exports = { undo: { width: 857.1, height: 1e3, path: "m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z", transform: "matrix(1 0 0 -1 0 850)" }, home: { width: 928.6, height: 1e3, path: "m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z", transform: "matrix(1 0 0 -1 0 850)" }, "camera-retro": { width: 1e3, height: 1e3, path: "m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z", transform: "matrix(1 0 0 -1 0 850)" }, zoombox: { width: 1e3, height: 1e3, path: "m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z", transform: "matrix(1 0 0 -1 0 850)" }, pan: { width: 1e3, height: 1e3, path: "m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z", transform: "matrix(1 0 0 -1 0 850)" }, zoom_plus: { width: 875, height: 1e3, path: "m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z", transform: "matrix(1 0 0 -1 0 850)" }, zoom_minus: { width: 875, height: 1e3, path: "m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z", transform: "matrix(1 0 0 -1 0 850)" }, autoscale: { width: 1e3, height: 1e3, path: "m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z", transform: "matrix(1 0 0 -1 0 850)" }, tooltip_basic: { width: 1500, height: 1e3, path: "m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z", transform: "matrix(1 0 0 -1 0 850)" }, tooltip_compare: { width: 1125, height: 1e3, path: "m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z", transform: "matrix(1 0 0 -1 0 850)" }, plotlylogo: { width: 1542, height: 1e3, path: "m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z", transform: "matrix(1 0 0 -1 0 850)" }, "z-axis": { width: 1e3, height: 1e3, path: "m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z", transform: "matrix(1 0 0 -1 0 850)" }, "3d_rotate": { width: 1e3, height: 1e3, path: "m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z", transform: "matrix(1 0 0 -1 0 850)" }, camera: { width: 1e3, height: 1e3, path: "m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z", transform: "matrix(1 0 0 -1 0 850)" }, movie: { width: 1e3, height: 1e3, path: "m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z", transform: "matrix(1 0 0 -1 0 850)" }, question: { width: 857.1, height: 1e3, path: "m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z", transform: "matrix(1 0 0 -1 0 850)" }, disk: { width: 857.1, height: 1e3, path: "m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z", transform: "matrix(1 0 0 -1 0 850)" }, drawopenpath: { width: 70, height: 70, path: "M33.21,85.65a7.31,7.31,0,0,1-2.59-.48c-8.16-3.11-9.27-19.8-9.88-41.3-.1-3.58-.19-6.68-.35-9-.15-2.1-.67-3.48-1.43-3.79-2.13-.88-7.91,2.32-12,5.86L3,32.38c1.87-1.64,11.55-9.66,18.27-6.9,2.13.87,4.75,3.14,5.17,9,.17,2.43.26,5.59.36,9.25a224.17,224.17,0,0,0,1.5,23.4c1.54,10.76,4,12.22,4.48,12.4.84.32,2.79-.46,5.76-3.59L43,80.07C41.53,81.57,37.68,85.64,33.21,85.65ZM74.81,69a11.34,11.34,0,0,0,6.09-6.72L87.26,44.5,74.72,32,56.9,38.35c-2.37.86-5.57,3.42-6.61,6L38.65,72.14l8.42,8.43ZM55,46.27a7.91,7.91,0,0,1,3.64-3.17l14.8-5.3,8,8L76.11,60.6l-.06.19a6.37,6.37,0,0,1-3,3.43L48.25,74.59,44.62,71Zm16.57,7.82A6.9,6.9,0,1,0,64.64,61,6.91,6.91,0,0,0,71.54,54.09Zm-4.05,0a2.85,2.85,0,1,1-2.85-2.85A2.86,2.86,0,0,1,67.49,54.09Zm-4.13,5.22L60.5,56.45,44.26,72.7l2.86,2.86ZM97.83,35.67,84.14,22l-8.57,8.57L89.26,44.24Zm-13.69-8,8,8-2.85,2.85-8-8Z", transform: "matrix(1 0 0 1 -15 -15)" }, drawclosedpath: { width: 90, height: 90, path: "M88.41,21.12a26.56,26.56,0,0,0-36.18,0l-2.07,2-2.07-2a26.57,26.57,0,0,0-36.18,0,23.74,23.74,0,0,0,0,34.8L48,90.12a3.22,3.22,0,0,0,4.42,0l36-34.21a23.73,23.73,0,0,0,0-34.79ZM84,51.24,50.16,83.35,16.35,51.25a17.28,17.28,0,0,1,0-25.47,20,20,0,0,1,27.3,0l4.29,4.07a3.23,3.23,0,0,0,4.44,0l4.29-4.07a20,20,0,0,1,27.3,0,17.27,17.27,0,0,1,0,25.46ZM66.76,47.68h-33v6.91h33ZM53.35,35H46.44V68h6.91Z", transform: "matrix(1 0 0 1 -5 -5)" }, lasso: { width: 1031, height: 1e3, path: "m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z", transform: "matrix(1 0 0 -1 0 850)" }, selectbox: { width: 1e3, height: 1e3, path: "m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z", transform: "matrix(1 0 0 -1 0 850)" }, drawline: { width: 70, height: 70, path: "M60.64,62.3a11.29,11.29,0,0,0,6.09-6.72l6.35-17.72L60.54,25.31l-17.82,6.4c-2.36.86-5.57,3.41-6.6,6L24.48,65.5l8.42,8.42ZM40.79,39.63a7.89,7.89,0,0,1,3.65-3.17l14.79-5.31,8,8L61.94,54l-.06.19a6.44,6.44,0,0,1-3,3.43L34.07,68l-3.62-3.63Zm16.57,7.81a6.9,6.9,0,1,0-6.89,6.9A6.9,6.9,0,0,0,57.36,47.44Zm-4,0a2.86,2.86,0,1,1-2.85-2.85A2.86,2.86,0,0,1,53.32,47.44Zm-4.13,5.22L46.33,49.8,30.08,66.05l2.86,2.86ZM83.65,29,70,15.34,61.4,23.9,75.09,37.59ZM70,21.06l8,8-2.84,2.85-8-8ZM87,80.49H10.67V87H87Z", transform: "matrix(1 0 0 1 -15 -15)" }, drawrect: { width: 80, height: 80, path: "M78,22V79H21V22H78m9-9H12V88H87V13ZM68,46.22H31V54H68ZM53,32H45.22V69H53Z", transform: "matrix(1 0 0 1 -10 -10)" }, drawcircle: { width: 80, height: 80, path: "M50,84.72C26.84,84.72,8,69.28,8,50.3S26.84,15.87,50,15.87,92,31.31,92,50.3,73.16,84.72,50,84.72Zm0-60.59c-18.6,0-33.74,11.74-33.74,26.17S31.4,76.46,50,76.46,83.74,64.72,83.74,50.3,68.6,24.13,50,24.13Zm17.15,22h-34v7.11h34Zm-13.8-13H46.24v34h7.11Z", transform: "matrix(1 0 0 1 -10 -10)" }, eraseshape: { width: 80, height: 80, path: "M82.77,78H31.85L6,49.57,31.85,21.14H82.77a8.72,8.72,0,0,1,8.65,8.77V69.24A8.72,8.72,0,0,1,82.77,78ZM35.46,69.84H82.77a.57.57,0,0,0,.49-.6V29.91a.57.57,0,0,0-.49-.61H35.46L17,49.57Zm32.68-34.7-24,24,5,5,24-24Zm-19,.53-5,5,24,24,5-5Z", transform: "matrix(1 0 0 1 -10 -10)" }, spikeline: { width: 1e3, height: 1e3, path: "M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z", transform: "matrix(1.5 0 0 -1.5 0 850)" }, pencil: { width: 1792, height: 1792, path: "M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z", transform: "matrix(1 0 0 1 0 1)" }, newplotlylogo: { name: "newplotlylogo", svg: [ "", "", " ", "", " plotly-logomark", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "" ].join("") } }; } }); // node_modules/plotly.js/src/components/shapes/draw_newshape/constants.js var require_constants4 = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw_newshape/constants.js"(exports2, module2) { "use strict"; var CIRCLE_SIDES = 32; module2.exports = { CIRCLE_SIDES, i000: 0, i090: CIRCLE_SIDES / 4, i180: CIRCLE_SIDES / 2, i270: CIRCLE_SIDES / 4 * 3, cos45: Math.cos(Math.PI / 4), sin45: Math.sin(Math.PI / 4), SQRT2: Math.sqrt(2) }; } }); // node_modules/plotly.js/src/components/selections/helpers.js var require_helpers6 = __commonJS({ "node_modules/plotly.js/src/components/selections/helpers.js"(exports2, module2) { "use strict"; var strTranslate = require_lib().strTranslate; function p2r(ax, v) { switch (ax.type) { case "log": return ax.p2d(v); case "date": return ax.p2r(v, 0, ax.calendar); default: return ax.p2r(v); } } function r2p(ax, v) { switch (ax.type) { case "log": return ax.d2p(v); case "date": return ax.r2p(v, 0, ax.calendar); default: return ax.r2p(v); } } function axValue(ax) { var index = ax._id.charAt(0) === "y" ? 1 : 0; return function(v) { return p2r(ax, v[index]); }; } function getTransform(plotinfo) { return strTranslate( plotinfo.xaxis._offset, plotinfo.yaxis._offset ); } module2.exports = { p2r, r2p, axValue, getTransform }; } }); // node_modules/plotly.js/src/components/shapes/draw_newshape/helpers.js var require_helpers7 = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw_newshape/helpers.js"(exports2) { "use strict"; var parseSvgPath = require_parse_svg_path(); var constants = require_constants4(); var CIRCLE_SIDES = constants.CIRCLE_SIDES; var SQRT2 = constants.SQRT2; var cartesianHelpers = require_helpers6(); var p2r = cartesianHelpers.p2r; var r2p = cartesianHelpers.r2p; var iC = [0, 3, 4, 5, 6, 1, 2]; var iQS = [0, 3, 4, 1, 2]; exports2.writePaths = function(polygons) { var nI = polygons.length; if (!nI) return "M0,0Z"; var str = ""; for (var i = 0; i < nI; i++) { var nJ = polygons[i].length; for (var j = 0; j < nJ; j++) { var w = polygons[i][j][0]; if (w === "Z") { str += "Z"; } else { var nK = polygons[i][j].length; for (var k = 0; k < nK; k++) { var realK = k; if (w === "Q" || w === "S") { realK = iQS[k]; } else if (w === "C") { realK = iC[k]; } str += polygons[i][j][realK]; if (k > 0 && k < nK - 1) { str += ","; } } } } } return str; }; exports2.readPaths = function(str, gd2, plotinfo, isActiveShape) { var cmd = parseSvgPath(str); var polys = []; var n = -1; var newPoly = function() { n++; polys[n] = []; }; var k; var x = 0; var y = 0; var initX; var initY; var recStart = function() { initX = x; initY = y; }; recStart(); for (var i = 0; i < cmd.length; i++) { var newPos = []; var x12, x2, y12, y2; var c = cmd[i][0]; var w = c; switch (c) { case "M": newPoly(); x = +cmd[i][1]; y = +cmd[i][2]; newPos.push([w, x, y]); recStart(); break; case "Q": case "S": x12 = +cmd[i][1]; y12 = +cmd[i][2]; x = +cmd[i][3]; y = +cmd[i][4]; newPos.push([w, x, y, x12, y12]); break; case "C": x12 = +cmd[i][1]; y12 = +cmd[i][2]; x2 = +cmd[i][3]; y2 = +cmd[i][4]; x = +cmd[i][5]; y = +cmd[i][6]; newPos.push([w, x, y, x12, y12, x2, y2]); break; case "T": case "L": x = +cmd[i][1]; y = +cmd[i][2]; newPos.push([w, x, y]); break; case "H": w = "L"; x = +cmd[i][1]; newPos.push([w, x, y]); break; case "V": w = "L"; y = +cmd[i][1]; newPos.push([w, x, y]); break; case "A": w = "L"; var rx = +cmd[i][1]; var ry = +cmd[i][2]; if (!+cmd[i][4]) { rx = -rx; ry = -ry; } var cenX = x - rx; var cenY = y; for (k = 1; k <= CIRCLE_SIDES / 2; k++) { var t = 2 * Math.PI * k / CIRCLE_SIDES; newPos.push([ w, cenX + rx * Math.cos(t), cenY + ry * Math.sin(t) ]); } break; case "Z": if (x !== initX || y !== initY) { x = initX; y = initY; newPos.push([w, x, y]); } break; } var domain = (plotinfo || {}).domain; var size = gd2._fullLayout._size; var xPixelSized = plotinfo && plotinfo.xsizemode === "pixel"; var yPixelSized = plotinfo && plotinfo.ysizemode === "pixel"; var noOffset = isActiveShape === false; for (var j = 0; j < newPos.length; j++) { for (k = 0; k + 2 < 7; k += 2) { var _x = newPos[j][k + 1]; var _y = newPos[j][k + 2]; if (_x === void 0 || _y === void 0) continue; x = _x; y = _y; if (plotinfo) { if (plotinfo.xaxis && plotinfo.xaxis.p2r) { if (noOffset) _x -= plotinfo.xaxis._offset; if (xPixelSized) { _x = r2p(plotinfo.xaxis, plotinfo.xanchor) + _x; } else { _x = p2r(plotinfo.xaxis, _x); } } else { if (noOffset) _x -= size.l; if (domain) _x = domain.x[0] + _x / size.w; else _x = _x / size.w; } if (plotinfo.yaxis && plotinfo.yaxis.p2r) { if (noOffset) _y -= plotinfo.yaxis._offset; if (yPixelSized) { _y = r2p(plotinfo.yaxis, plotinfo.yanchor) - _y; } else { _y = p2r(plotinfo.yaxis, _y); } } else { if (noOffset) _y -= size.t; if (domain) _y = domain.y[1] - _y / size.h; else _y = 1 - _y / size.h; } } newPos[j][k + 1] = _x; newPos[j][k + 2] = _y; } polys[n].push( newPos[j].slice() ); } } return polys; }; function almostEq(a, b) { return Math.abs(a - b) <= 1e-6; } function dist(a, b) { var dx = b[1] - a[1]; var dy = b[2] - a[2]; return Math.sqrt( dx * dx + dy * dy ); } exports2.pointsOnRectangle = function(cell) { var len = cell.length; if (len !== 5) return false; for (var j = 1; j < 3; j++) { var e01 = cell[0][j] - cell[1][j]; var e32 = cell[3][j] - cell[2][j]; if (!almostEq(e01, e32)) return false; var e03 = cell[0][j] - cell[3][j]; var e12 = cell[1][j] - cell[2][j]; if (!almostEq(e03, e12)) return false; } if (!almostEq(cell[0][1], cell[1][1]) && !almostEq(cell[0][1], cell[3][1])) return false; return !!(dist(cell[0], cell[1]) * dist(cell[0], cell[3])); }; exports2.pointsOnEllipse = function(cell) { var len = cell.length; if (len !== CIRCLE_SIDES + 1) return false; len = CIRCLE_SIDES; for (var i = 0; i < len; i++) { var k = (len * 2 - i) % len; var k2 = (len / 2 + k) % len; var i2 = (len / 2 + i) % len; if (!almostEq( dist(cell[i], cell[i2]), dist(cell[k], cell[k2]) )) return false; } return true; }; exports2.handleEllipse = function(isEllipse, start, end) { if (!isEllipse) return [start, end]; var pos = exports2.ellipseOver({ x0: start[0], y0: start[1], x1: end[0], y1: end[1] }); var cx = (pos.x1 + pos.x0) / 2; var cy = (pos.y1 + pos.y0) / 2; var rx = (pos.x1 - pos.x0) / 2; var ry = (pos.y1 - pos.y0) / 2; if (!rx) rx = ry = ry / SQRT2; if (!ry) ry = rx = rx / SQRT2; var cell = []; for (var i = 0; i < CIRCLE_SIDES; i++) { var t = i * 2 * Math.PI / CIRCLE_SIDES; cell.push([ cx + rx * Math.cos(t), cy + ry * Math.sin(t) ]); } return cell; }; exports2.ellipseOver = function(pos) { var x02 = pos.x0; var y02 = pos.y0; var x12 = pos.x1; var y12 = pos.y1; var dx = x12 - x02; var dy = y12 - y02; x02 -= dx; y02 -= dy; var cx = (x02 + x12) / 2; var cy = (y02 + y12) / 2; var scale = SQRT2; dx *= scale; dy *= scale; return { x0: cx - dx, y0: cy - dy, x1: cx + dx, y1: cy + dy }; }; exports2.fixDatesForPaths = function(polygons, xaxis, yaxis) { var xIsDate = xaxis.type === "date"; var yIsDate = yaxis.type === "date"; if (!xIsDate && !yIsDate) return polygons; for (var i = 0; i < polygons.length; i++) { for (var j = 0; j < polygons[i].length; j++) { for (var k = 0; k + 2 < polygons[i][j].length; k += 2) { if (xIsDate) polygons[i][j][k + 1] = polygons[i][j][k + 1].replace(" ", "_"); if (yIsDate) polygons[i][j][k + 2] = polygons[i][j][k + 2].replace(" ", "_"); } } } return polygons; }; } }); // node_modules/plotly.js/src/components/shapes/draw_newshape/newshapes.js var require_newshapes = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw_newshape/newshapes.js"(exports2, module2) { "use strict"; var dragHelpers = require_helpers5(); var drawMode = dragHelpers.drawMode; var openMode = dragHelpers.openMode; var constants = require_constants4(); var i000 = constants.i000; var i090 = constants.i090; var i180 = constants.i180; var i270 = constants.i270; var cos45 = constants.cos45; var sin45 = constants.sin45; var cartesianHelpers = require_helpers6(); var p2r = cartesianHelpers.p2r; var r2p = cartesianHelpers.r2p; var handleOutline = require_handle_outline(); var clearOutline = handleOutline.clearOutline; var helpers = require_helpers7(); var readPaths = helpers.readPaths; var writePaths = helpers.writePaths; var ellipseOver = helpers.ellipseOver; var fixDatesForPaths = helpers.fixDatesForPaths; function newShapes(outlines, dragOptions) { if (!outlines.length) return; var e = outlines[0][0]; if (!e) return; var gd2 = dragOptions.gd; var isActiveShape = dragOptions.isActiveShape; var dragmode = dragOptions.dragmode; var shapes = (gd2.layout || {}).shapes || []; if (!drawMode(dragmode) && isActiveShape !== void 0) { var id2 = gd2._fullLayout._activeShapeIndex; if (id2 < shapes.length) { switch (gd2._fullLayout.shapes[id2].type) { case "rect": dragmode = "drawrect"; break; case "circle": dragmode = "drawcircle"; break; case "line": dragmode = "drawline"; break; case "path": var path = shapes[id2].path || ""; if (path[path.length - 1] === "Z") { dragmode = "drawclosedpath"; } else { dragmode = "drawopenpath"; } break; } } } var newShape = createShapeObj(outlines, dragOptions, dragmode); clearOutline(gd2); var editHelpers = dragOptions.editHelpers; var modifyItem = (editHelpers || {}).modifyItem; var allShapes = []; for (var q = 0; q < shapes.length; q++) { var beforeEdit = gd2._fullLayout.shapes[q]; allShapes[q] = beforeEdit._input; if (isActiveShape !== void 0 && q === gd2._fullLayout._activeShapeIndex) { var afterEdit = newShape; switch (beforeEdit.type) { case "line": case "rect": case "circle": modifyItem("x0", afterEdit.x0 - (beforeEdit.x0shift || 0)); modifyItem("x1", afterEdit.x1 - (beforeEdit.x1shift || 0)); modifyItem("y0", afterEdit.y0 - (beforeEdit.y0shift || 0)); modifyItem("y1", afterEdit.y1 - (beforeEdit.y1shift || 0)); break; case "path": modifyItem("path", afterEdit.path); break; } } } if (isActiveShape === void 0) { allShapes.push(newShape); return allShapes; } return editHelpers ? editHelpers.getUpdateObj() : {}; } function createShapeObj(outlines, dragOptions, dragmode) { var e = outlines[0][0]; var gd2 = dragOptions.gd; var d = e.getAttribute("d"); var newStyle = gd2._fullLayout.newshape; var plotinfo = dragOptions.plotinfo; var isActiveShape = dragOptions.isActiveShape; var xaxis = plotinfo.xaxis; var yaxis = plotinfo.yaxis; var xPaper = !!plotinfo.domain || !plotinfo.xaxis; var yPaper = !!plotinfo.domain || !plotinfo.yaxis; var isOpenMode = openMode(dragmode); var polygons = readPaths(d, gd2, plotinfo, isActiveShape); var newShape = { editable: true, visible: newStyle.visible, name: newStyle.name, showlegend: newStyle.showlegend, legend: newStyle.legend, legendwidth: newStyle.legendwidth, legendgroup: newStyle.legendgroup, legendgrouptitle: { text: newStyle.legendgrouptitle.text, font: newStyle.legendgrouptitle.font }, legendrank: newStyle.legendrank, label: newStyle.label, xref: xPaper ? "paper" : xaxis._id, yref: yPaper ? "paper" : yaxis._id, layer: newStyle.layer, opacity: newStyle.opacity, line: { color: newStyle.line.color, width: newStyle.line.width, dash: newStyle.line.dash } }; if (!isOpenMode) { newShape.fillcolor = newStyle.fillcolor; newShape.fillrule = newStyle.fillrule; } var cell; if (polygons.length === 1) cell = polygons[0]; if (cell && cell.length === 5 && // ensure we only have 4 corners for a rect dragmode === "drawrect") { newShape.type = "rect"; newShape.x0 = cell[0][1]; newShape.y0 = cell[0][2]; newShape.x1 = cell[2][1]; newShape.y1 = cell[2][2]; } else if (cell && dragmode === "drawline") { newShape.type = "line"; newShape.x0 = cell[0][1]; newShape.y0 = cell[0][2]; newShape.x1 = cell[1][1]; newShape.y1 = cell[1][2]; } else if (cell && dragmode === "drawcircle") { newShape.type = "circle"; var xA = cell[i000][1]; var xB = cell[i090][1]; var xC = cell[i180][1]; var xD = cell[i270][1]; var yA = cell[i000][2]; var yB = cell[i090][2]; var yC = cell[i180][2]; var yD = cell[i270][2]; var xDateOrLog = plotinfo.xaxis && (plotinfo.xaxis.type === "date" || plotinfo.xaxis.type === "log"); var yDateOrLog = plotinfo.yaxis && (plotinfo.yaxis.type === "date" || plotinfo.yaxis.type === "log"); if (xDateOrLog) { xA = r2p(plotinfo.xaxis, xA); xB = r2p(plotinfo.xaxis, xB); xC = r2p(plotinfo.xaxis, xC); xD = r2p(plotinfo.xaxis, xD); } if (yDateOrLog) { yA = r2p(plotinfo.yaxis, yA); yB = r2p(plotinfo.yaxis, yB); yC = r2p(plotinfo.yaxis, yC); yD = r2p(plotinfo.yaxis, yD); } var x02 = (xB + xD) / 2; var y02 = (yA + yC) / 2; var rx = (xD - xB + xC - xA) / 2; var ry = (yD - yB + yC - yA) / 2; var pos = ellipseOver({ x0: x02, y0: y02, x1: x02 + rx * cos45, y1: y02 + ry * sin45 }); if (xDateOrLog) { pos.x0 = p2r(plotinfo.xaxis, pos.x0); pos.x1 = p2r(plotinfo.xaxis, pos.x1); } if (yDateOrLog) { pos.y0 = p2r(plotinfo.yaxis, pos.y0); pos.y1 = p2r(plotinfo.yaxis, pos.y1); } newShape.x0 = pos.x0; newShape.y0 = pos.y0; newShape.x1 = pos.x1; newShape.y1 = pos.y1; } else { newShape.type = "path"; if (xaxis && yaxis) fixDatesForPaths(polygons, xaxis, yaxis); newShape.path = writePaths(polygons); cell = null; } return newShape; } module2.exports = { newShapes, createShapeObj }; } }); // node_modules/plotly.js/src/components/selections/draw_newselection/newselections.js var require_newselections = __commonJS({ "node_modules/plotly.js/src/components/selections/draw_newselection/newselections.js"(exports2, module2) { "use strict"; var dragHelpers = require_helpers5(); var selectMode = dragHelpers.selectMode; var handleOutline = require_handle_outline(); var clearOutline = handleOutline.clearOutline; var helpers = require_helpers7(); var readPaths = helpers.readPaths; var writePaths = helpers.writePaths; var fixDatesForPaths = helpers.fixDatesForPaths; module2.exports = function newSelections(outlines, dragOptions) { if (!outlines.length) return; var e = outlines[0][0]; if (!e) return; var d = e.getAttribute("d"); var gd2 = dragOptions.gd; var newStyle = gd2._fullLayout.newselection; var plotinfo = dragOptions.plotinfo; var xaxis = plotinfo.xaxis; var yaxis = plotinfo.yaxis; var isActiveSelection = dragOptions.isActiveSelection; var dragmode = dragOptions.dragmode; var selections = (gd2.layout || {}).selections || []; if (!selectMode(dragmode) && isActiveSelection !== void 0) { var id2 = gd2._fullLayout._activeSelectionIndex; if (id2 < selections.length) { switch (gd2._fullLayout.selections[id2].type) { case "rect": dragmode = "select"; break; case "path": dragmode = "lasso"; break; } } } var polygons = readPaths(d, gd2, plotinfo, isActiveSelection); var newSelection = { xref: xaxis._id, yref: yaxis._id, opacity: newStyle.opacity, line: { color: newStyle.line.color, width: newStyle.line.width, dash: newStyle.line.dash } }; var cell; if (polygons.length === 1) cell = polygons[0]; if (cell && cell.length === 5 && // ensure we only have 4 corners for a rect dragmode === "select") { newSelection.type = "rect"; newSelection.x0 = cell[0][1]; newSelection.y0 = cell[0][2]; newSelection.x1 = cell[2][1]; newSelection.y1 = cell[2][2]; } else { newSelection.type = "path"; if (xaxis && yaxis) fixDatesForPaths(polygons, xaxis, yaxis); newSelection.path = writePaths(polygons); cell = null; } clearOutline(gd2); var editHelpers = dragOptions.editHelpers; var modifyItem = (editHelpers || {}).modifyItem; var allSelections = []; for (var q = 0; q < selections.length; q++) { var beforeEdit = gd2._fullLayout.selections[q]; if (!beforeEdit) { allSelections[q] = beforeEdit; continue; } allSelections[q] = beforeEdit._input; if (isActiveSelection !== void 0 && q === gd2._fullLayout._activeSelectionIndex) { var afterEdit = newSelection; switch (beforeEdit.type) { case "rect": modifyItem("x0", afterEdit.x0); modifyItem("x1", afterEdit.x1); modifyItem("y0", afterEdit.y0); modifyItem("y1", afterEdit.y1); break; case "path": modifyItem("path", afterEdit.path); break; } } } if (isActiveSelection === void 0) { allSelections.push(newSelection); return allSelections; } return editHelpers ? editHelpers.getUpdateObj() : {}; }; } }); // node_modules/plotly.js/src/components/shapes/constants.js var require_constants5 = __commonJS({ "node_modules/plotly.js/src/components/shapes/constants.js"(exports2, module2) { "use strict"; module2.exports = { segmentRE: /[MLHVQCTSZ][^MLHVQCTSZ]*/g, paramRE: /[^\s,]+/g, // which numbers in each path segment are x (or y) values // drawn is which param is a drawn point, as opposed to a // control point (which doesn't count toward autorange. // TODO: this means curved paths could extend beyond the // autorange bounds. This is a bit tricky to get right // unless we revert to bounding boxes, but perhaps there's // a calculation we could do...) paramIsX: { M: { 0: true, drawn: 0 }, L: { 0: true, drawn: 0 }, H: { 0: true, drawn: 0 }, V: {}, Q: { 0: true, 2: true, drawn: 2 }, C: { 0: true, 2: true, 4: true, drawn: 4 }, T: { 0: true, drawn: 0 }, S: { 0: true, 2: true, drawn: 2 }, // A: {0: true, 5: true}, Z: {} }, paramIsY: { M: { 1: true, drawn: 1 }, L: { 1: true, drawn: 1 }, H: {}, V: { 0: true, drawn: 0 }, Q: { 1: true, 3: true, drawn: 3 }, C: { 1: true, 3: true, 5: true, drawn: 5 }, T: { 1: true, drawn: 1 }, S: { 1: true, 3: true, drawn: 5 }, // A: {1: true, 6: true}, Z: {} }, numParams: { M: 2, L: 2, H: 1, V: 1, Q: 4, C: 6, T: 2, S: 4, // A: 7, Z: 0 } }; } }); // node_modules/plotly.js/src/components/shapes/helpers.js var require_helpers8 = __commonJS({ "node_modules/plotly.js/src/components/shapes/helpers.js"(exports2) { "use strict"; var constants = require_constants5(); var Lib = require_lib(); var Axes = require_axes(); exports2.rangeToShapePosition = function(ax) { return ax.type === "log" ? ax.r2d : function(v) { return v; }; }; exports2.shapePositionToRange = function(ax) { return ax.type === "log" ? ax.d2r : function(v) { return v; }; }; exports2.decodeDate = function(convertToPx) { return function(v) { if (v.replace) v = v.replace("_", " "); return convertToPx(v); }; }; exports2.encodeDate = function(convertToDate) { return function(v) { return convertToDate(v).replace(" ", "_"); }; }; exports2.extractPathCoords = function(path, paramsToUse, isRaw) { var extractedCoordinates = []; var segments = path.match(constants.segmentRE); segments.forEach(function(segment) { var relevantParamIdx = paramsToUse[segment.charAt(0)].drawn; if (relevantParamIdx === void 0) return; var params = segment.substr(1).match(constants.paramRE); if (!params || params.length < relevantParamIdx) return; var str = params[relevantParamIdx]; var pos = isRaw ? str : Lib.cleanNumber(str); extractedCoordinates.push(pos); }); return extractedCoordinates; }; exports2.getDataToPixel = function(gd2, axis, shift, isVertical, refType) { var gs2 = gd2._fullLayout._size; var dataToPixel; if (axis) { if (refType === "domain") { dataToPixel = function(v) { return axis._length * (isVertical ? 1 - v : v) + axis._offset; }; } else { var d2r = exports2.shapePositionToRange(axis); dataToPixel = function(v) { var shiftPixels = getPixelShift(axis, shift); return axis._offset + axis.r2p(d2r(v, true)) + shiftPixels; }; if (axis.type === "date") dataToPixel = exports2.decodeDate(dataToPixel); } } else if (isVertical) { dataToPixel = function(v) { return gs2.t + gs2.h * (1 - v); }; } else { dataToPixel = function(v) { return gs2.l + gs2.w * v; }; } return dataToPixel; }; exports2.getPixelToData = function(gd2, axis, isVertical, opt) { var gs2 = gd2._fullLayout._size; var pixelToData; if (axis) { if (opt === "domain") { pixelToData = function(p) { var q = (p - axis._offset) / axis._length; return isVertical ? 1 - q : q; }; } else { var r2d = exports2.rangeToShapePosition(axis); pixelToData = function(p) { return r2d(axis.p2r(p - axis._offset)); }; } } else if (isVertical) { pixelToData = function(p) { return 1 - (p - gs2.t) / gs2.h; }; } else { pixelToData = function(p) { return (p - gs2.l) / gs2.w; }; } return pixelToData; }; exports2.roundPositionForSharpStrokeRendering = function(pos, strokeWidth) { var strokeWidthIsOdd = Math.round(strokeWidth % 2) === 1; var posValAsInt = Math.round(pos); return strokeWidthIsOdd ? posValAsInt + 0.5 : posValAsInt; }; exports2.makeShapesOptionsAndPlotinfo = function(gd2, index) { var options = gd2._fullLayout.shapes[index] || {}; var plotinfo = gd2._fullLayout._plots[options.xref + options.yref]; var hasPlotinfo = !!plotinfo; if (hasPlotinfo) { plotinfo._hadPlotinfo = true; } else { plotinfo = {}; if (options.xref && options.xref !== "paper") plotinfo.xaxis = gd2._fullLayout[options.xref + "axis"]; if (options.yref && options.yref !== "paper") plotinfo.yaxis = gd2._fullLayout[options.yref + "axis"]; } plotinfo.xsizemode = options.xsizemode; plotinfo.ysizemode = options.ysizemode; plotinfo.xanchor = options.xanchor; plotinfo.yanchor = options.yanchor; return { options, plotinfo }; }; exports2.makeSelectionsOptionsAndPlotinfo = function(gd2, index) { var options = gd2._fullLayout.selections[index] || {}; var plotinfo = gd2._fullLayout._plots[options.xref + options.yref]; var hasPlotinfo = !!plotinfo; if (hasPlotinfo) { plotinfo._hadPlotinfo = true; } else { plotinfo = {}; if (options.xref) plotinfo.xaxis = gd2._fullLayout[options.xref + "axis"]; if (options.yref) plotinfo.yaxis = gd2._fullLayout[options.yref + "axis"]; } return { options, plotinfo }; }; exports2.getPathString = function(gd2, options) { var type = options.type; var xRefType = Axes.getRefType(options.xref); var yRefType = Axes.getRefType(options.yref); var xa2 = Axes.getFromId(gd2, options.xref); var ya2 = Axes.getFromId(gd2, options.yref); var gs2 = gd2._fullLayout._size; var x2r, x2p, y2r, y2p; var xShiftStart = getPixelShift(xa2, options.x0shift); var xShiftEnd = getPixelShift(xa2, options.x1shift); var yShiftStart = getPixelShift(ya2, options.y0shift); var yShiftEnd = getPixelShift(ya2, options.y1shift); var x02, x12, y02, y12; if (xa2) { if (xRefType === "domain") { x2p = function(v) { return xa2._offset + xa2._length * v; }; } else { x2r = exports2.shapePositionToRange(xa2); x2p = function(v) { return xa2._offset + xa2.r2p(x2r(v, true)); }; } } else { x2p = function(v) { return gs2.l + gs2.w * v; }; } if (ya2) { if (yRefType === "domain") { y2p = function(v) { return ya2._offset + ya2._length * (1 - v); }; } else { y2r = exports2.shapePositionToRange(ya2); y2p = function(v) { return ya2._offset + ya2.r2p(y2r(v, true)); }; } } else { y2p = function(v) { return gs2.t + gs2.h * (1 - v); }; } if (type === "path") { if (xa2 && xa2.type === "date") x2p = exports2.decodeDate(x2p); if (ya2 && ya2.type === "date") y2p = exports2.decodeDate(y2p); return convertPath(options, x2p, y2p); } if (options.xsizemode === "pixel") { var xAnchorPos = x2p(options.xanchor); x02 = xAnchorPos + options.x0 + xShiftStart; x12 = xAnchorPos + options.x1 + xShiftEnd; } else { x02 = x2p(options.x0) + xShiftStart; x12 = x2p(options.x1) + xShiftEnd; } if (options.ysizemode === "pixel") { var yAnchorPos = y2p(options.yanchor); y02 = yAnchorPos - options.y0 + yShiftStart; y12 = yAnchorPos - options.y1 + yShiftEnd; } else { y02 = y2p(options.y0) + yShiftStart; y12 = y2p(options.y1) + yShiftEnd; } if (type === "line") return "M" + x02 + "," + y02 + "L" + x12 + "," + y12; if (type === "rect") return "M" + x02 + "," + y02 + "H" + x12 + "V" + y12 + "H" + x02 + "Z"; var cx = (x02 + x12) / 2; var cy = (y02 + y12) / 2; var rx = Math.abs(cx - x02); var ry = Math.abs(cy - y02); var rArc = "A" + rx + "," + ry; var rightPt = cx + rx + "," + cy; var topPt = cx + "," + (cy - ry); return "M" + rightPt + rArc + " 0 1,1 " + topPt + rArc + " 0 0,1 " + rightPt + "Z"; }; function convertPath(options, x2p, y2p) { var pathIn = options.path; var xSizemode = options.xsizemode; var ySizemode = options.ysizemode; var xAnchor = options.xanchor; var yAnchor = options.yanchor; return pathIn.replace(constants.segmentRE, function(segment) { var paramNumber = 0; var segmentType = segment.charAt(0); var xParams = constants.paramIsX[segmentType]; var yParams = constants.paramIsY[segmentType]; var nParams = constants.numParams[segmentType]; var paramString = segment.substr(1).replace(constants.paramRE, function(param) { if (xParams[paramNumber]) { if (xSizemode === "pixel") param = x2p(xAnchor) + Number(param); else param = x2p(param); } else if (yParams[paramNumber]) { if (ySizemode === "pixel") param = y2p(yAnchor) - Number(param); else param = y2p(param); } paramNumber++; if (paramNumber > nParams) param = "X"; return param; }); if (paramNumber > nParams) { paramString = paramString.replace(/[\s,]*X.*/, ""); Lib.log("Ignoring extra params in segment " + segment); } return segmentType + paramString; }); } function getPixelShift(axis, shift) { shift = shift || 0; var shiftPixels = 0; if (shift && axis && (axis.type === "category" || axis.type === "multicategory")) { shiftPixels = (axis.r2p(1) - axis.r2p(0)) * shift; } return shiftPixels; } } }); // node_modules/plotly.js/src/components/shapes/display_labels.js var require_display_labels = __commonJS({ "node_modules/plotly.js/src/components/shapes/display_labels.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var svgTextUtils = require_svg_text_utils(); var Drawing = require_drawing(); var readPaths = require_helpers7().readPaths; var helpers = require_helpers8(); var getPathString = helpers.getPathString; var shapeLabelTexttemplateVars = require_label_texttemplate(); var FROM_TL = require_alignment().FROM_TL; module2.exports = function drawLabel(gd2, index, options, shapeGroup) { shapeGroup.selectAll(".shape-label").remove(); if (!(options.label.text || options.label.texttemplate)) return; var text; if (options.label.texttemplate) { var templateValues = {}; if (options.type !== "path") { var _xa = Axes.getFromId(gd2, options.xref); var _ya = Axes.getFromId(gd2, options.yref); for (var key in shapeLabelTexttemplateVars) { var val = shapeLabelTexttemplateVars[key](options, _xa, _ya); if (val !== void 0) templateValues[key] = val; } } text = Lib.texttemplateStringForShapes( options.label.texttemplate, {}, gd2._fullLayout._d3locale, templateValues ); } else { text = options.label.text; } var labelGroupAttrs = { "data-index": index }; var font = options.label.font; var labelTextAttrs = { "data-notex": 1 }; var labelGroup = shapeGroup.append("g").attr(labelGroupAttrs).classed("shape-label", true); var labelText = labelGroup.append("text").attr(labelTextAttrs).classed("shape-label-text", true).text(text); var shapex0, shapex1, shapey0, shapey1; if (options.path) { var d = getPathString(gd2, options); var polygons = readPaths(d, gd2); shapex0 = Infinity; shapey0 = Infinity; shapex1 = -Infinity; shapey1 = -Infinity; for (var i = 0; i < polygons.length; i++) { for (var j = 0; j < polygons[i].length; j++) { var p = polygons[i][j]; for (var k = 1; k < p.length; k += 2) { var _x = p[k]; var _y = p[k + 1]; shapex0 = Math.min(shapex0, _x); shapex1 = Math.max(shapex1, _x); shapey0 = Math.min(shapey0, _y); shapey1 = Math.max(shapey1, _y); } } } } else { var xa2 = Axes.getFromId(gd2, options.xref); var xShiftStart = options.x0shift; var xShiftEnd = options.x1shift; var xRefType = Axes.getRefType(options.xref); var ya2 = Axes.getFromId(gd2, options.yref); var yShiftStart = options.y0shift; var yShiftEnd = options.y1shift; var yRefType = Axes.getRefType(options.yref); var x2p = function(v, shift) { var dataToPixel = helpers.getDataToPixel(gd2, xa2, shift, false, xRefType); return dataToPixel(v); }; var y2p = function(v, shift) { var dataToPixel = helpers.getDataToPixel(gd2, ya2, shift, true, yRefType); return dataToPixel(v); }; shapex0 = x2p(options.x0, xShiftStart); shapex1 = x2p(options.x1, xShiftEnd); shapey0 = y2p(options.y0, yShiftStart); shapey1 = y2p(options.y1, yShiftEnd); } var textangle = options.label.textangle; if (textangle === "auto") { if (options.type === "line") { textangle = calcTextAngle(shapex0, shapey0, shapex1, shapey1); } else { textangle = 0; } } labelText.call(function(s) { s.call(Drawing.font, font).attr({}); svgTextUtils.convertToTspans(s, gd2); return s; }); var textBB = Drawing.bBox(labelText.node()); var textPos = calcTextPosition(shapex0, shapey0, shapex1, shapey1, options, textangle, textBB); var textx = textPos.textx; var texty = textPos.texty; var xanchor = textPos.xanchor; labelText.attr({ "text-anchor": { left: "start", center: "middle", right: "end" }[xanchor], y: texty, x: textx, transform: "rotate(" + textangle + "," + textx + "," + texty + ")" }).call(svgTextUtils.positionText, textx, texty); }; function calcTextAngle(shapex0, shapey0, shapex1, shapey1) { var dy, dx; dx = Math.abs(shapex1 - shapex0); if (shapex1 >= shapex0) { dy = shapey0 - shapey1; } else { dy = shapey1 - shapey0; } return -180 / Math.PI * Math.atan2(dy, dx); } function calcTextPosition(shapex0, shapey0, shapex1, shapey1, shapeOptions, actualTextAngle, textBB) { var textPosition = shapeOptions.label.textposition; var textAngle = shapeOptions.label.textangle; var textPadding = shapeOptions.label.padding; var shapeType = shapeOptions.type; var textAngleRad = Math.PI / 180 * actualTextAngle; var sinA = Math.sin(textAngleRad); var cosA = Math.cos(textAngleRad); var xanchor = shapeOptions.label.xanchor; var yanchor = shapeOptions.label.yanchor; var textx, texty, paddingX, paddingY; if (shapeType === "line") { if (textPosition === "start") { textx = shapex0; texty = shapey0; } else if (textPosition === "end") { textx = shapex1; texty = shapey1; } else { textx = (shapex0 + shapex1) / 2; texty = (shapey0 + shapey1) / 2; } if (xanchor === "auto") { if (textPosition === "start") { if (textAngle === "auto") { if (shapex1 > shapex0) xanchor = "left"; else if (shapex1 < shapex0) xanchor = "right"; else xanchor = "center"; } else { if (shapex1 > shapex0) xanchor = "right"; else if (shapex1 < shapex0) xanchor = "left"; else xanchor = "center"; } } else if (textPosition === "end") { if (textAngle === "auto") { if (shapex1 > shapex0) xanchor = "right"; else if (shapex1 < shapex0) xanchor = "left"; else xanchor = "center"; } else { if (shapex1 > shapex0) xanchor = "left"; else if (shapex1 < shapex0) xanchor = "right"; else xanchor = "center"; } } else { xanchor = "center"; } } var paddingConstantsX = { left: 1, center: 0, right: -1 }; var paddingConstantsY = { bottom: -1, middle: 0, top: 1 }; if (textAngle === "auto") { var paddingDirection = paddingConstantsY[yanchor]; paddingX = -textPadding * sinA * paddingDirection; paddingY = textPadding * cosA * paddingDirection; } else { var paddingDirectionX = paddingConstantsX[xanchor]; var paddingDirectionY = paddingConstantsY[yanchor]; paddingX = textPadding * paddingDirectionX; paddingY = textPadding * paddingDirectionY; } textx = textx + paddingX; texty = texty + paddingY; } else { paddingX = textPadding + 3; if (textPosition.indexOf("right") !== -1) { textx = Math.max(shapex0, shapex1) - paddingX; if (xanchor === "auto") xanchor = "right"; } else if (textPosition.indexOf("left") !== -1) { textx = Math.min(shapex0, shapex1) + paddingX; if (xanchor === "auto") xanchor = "left"; } else { textx = (shapex0 + shapex1) / 2; if (xanchor === "auto") xanchor = "center"; } if (textPosition.indexOf("top") !== -1) { texty = Math.min(shapey0, shapey1); } else if (textPosition.indexOf("bottom") !== -1) { texty = Math.max(shapey0, shapey1); } else { texty = (shapey0 + shapey1) / 2; } paddingY = textPadding; if (yanchor === "bottom") { texty = texty - paddingY; } else if (yanchor === "top") { texty = texty + paddingY; } } var shiftFraction = FROM_TL[yanchor]; var baselineAdjust = shapeOptions.label.font.size; var textHeight = textBB.height; var xshift = (textHeight * shiftFraction - baselineAdjust) * sinA; var yshift = -(textHeight * shiftFraction - baselineAdjust) * cosA; return { textx: textx + xshift, texty: texty + yshift, xanchor }; } } }); // node_modules/plotly.js/src/components/shapes/display_outlines.js var require_display_outlines = __commonJS({ "node_modules/plotly.js/src/components/shapes/display_outlines.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var strTranslate = Lib.strTranslate; var dragElement = require_dragelement(); var dragHelpers = require_helpers5(); var drawMode = dragHelpers.drawMode; var selectMode = dragHelpers.selectMode; var Registry = require_registry(); var Color = require_color(); var constants = require_constants4(); var i000 = constants.i000; var i090 = constants.i090; var i180 = constants.i180; var i270 = constants.i270; var handleOutline = require_handle_outline(); var clearOutlineControllers = handleOutline.clearOutlineControllers; var helpers = require_helpers7(); var pointsOnRectangle = helpers.pointsOnRectangle; var pointsOnEllipse = helpers.pointsOnEllipse; var writePaths = helpers.writePaths; var newShapes = require_newshapes().newShapes; var createShapeObj = require_newshapes().createShapeObj; var newSelections = require_newselections(); var drawLabel = require_display_labels(); module2.exports = function displayOutlines(polygons, outlines, dragOptions, nCalls) { if (!nCalls) nCalls = 0; var gd2 = dragOptions.gd; function redraw() { displayOutlines(polygons, outlines, dragOptions, nCalls++); if (pointsOnEllipse(polygons[0]) || dragOptions.hasText) { update({ redrawing: true }); } } function update(opts) { var updateObject = {}; if (dragOptions.isActiveShape !== void 0) { dragOptions.isActiveShape = false; updateObject = newShapes(outlines, dragOptions); } if (dragOptions.isActiveSelection !== void 0) { dragOptions.isActiveSelection = false; updateObject = newSelections(outlines, dragOptions); gd2._fullLayout._reselect = true; } if (Object.keys(updateObject).length) { Registry.call((opts || {}).redrawing ? "relayout" : "_guiRelayout", gd2, updateObject); } } var fullLayout = gd2._fullLayout; var zoomLayer = fullLayout._zoomlayer; var dragmode = dragOptions.dragmode; var isDrawMode = drawMode(dragmode); var isSelectMode = selectMode(dragmode); if (isDrawMode || isSelectMode) { gd2._fullLayout._outlining = true; } clearOutlineControllers(gd2); outlines.attr("d", writePaths(polygons)); var vertexDragOptions; var groupDragOptions; var indexI; var indexJ; var copyPolygons; if (!nCalls && (dragOptions.isActiveShape || dragOptions.isActiveSelection)) { copyPolygons = recordPositions([], polygons); var g = zoomLayer.append("g").attr("class", "outline-controllers"); addVertexControllers(g); addGroupControllers(); } if (isDrawMode && dragOptions.hasText) { var shapeGroup = zoomLayer.select(".label-temp"); var shapeOptions = createShapeObj(outlines, dragOptions, dragOptions.dragmode); drawLabel(gd2, "label-temp", shapeOptions, shapeGroup); } function startDragVertex(evt) { indexI = +evt.srcElement.getAttribute("data-i"); indexJ = +evt.srcElement.getAttribute("data-j"); vertexDragOptions[indexI][indexJ].moveFn = moveVertexController; } function moveVertexController(dx, dy) { if (!polygons.length) return; var x02 = copyPolygons[indexI][indexJ][1]; var y02 = copyPolygons[indexI][indexJ][2]; var cell = polygons[indexI]; var len = cell.length; if (pointsOnRectangle(cell)) { var _dx = dx; var _dy = dy; if (dragOptions.isActiveSelection) { var nextPoint = getNextPoint(cell, indexJ); if (nextPoint[1] === cell[indexJ][1]) { _dy = 0; } else { _dx = 0; } } for (var q = 0; q < len; q++) { if (q === indexJ) continue; var pos = cell[q]; if (pos[1] === cell[indexJ][1]) { pos[1] = x02 + _dx; } if (pos[2] === cell[indexJ][2]) { pos[2] = y02 + _dy; } } cell[indexJ][1] = x02 + _dx; cell[indexJ][2] = y02 + _dy; if (!pointsOnRectangle(cell)) { for (var j = 0; j < len; j++) { for (var k = 0; k < cell[j].length; k++) { cell[j][k] = copyPolygons[indexI][j][k]; } } } } else { cell[indexJ][1] = x02 + dx; cell[indexJ][2] = y02 + dy; } redraw(); } function endDragVertexController() { update(); } function removeVertex() { if (!polygons.length) return; if (!polygons[indexI]) return; if (!polygons[indexI].length) return; var newPolygon = []; for (var j = 0; j < polygons[indexI].length; j++) { if (j !== indexJ) { newPolygon.push( polygons[indexI][j] ); } } if (newPolygon.length > 1 && !(newPolygon.length === 2 && newPolygon[1][0] === "Z")) { if (indexJ === 0) { newPolygon[0][0] = "M"; } polygons[indexI] = newPolygon; redraw(); update(); } } function clickVertexController(numClicks, evt) { if (numClicks === 2) { indexI = +evt.srcElement.getAttribute("data-i"); indexJ = +evt.srcElement.getAttribute("data-j"); var cell = polygons[indexI]; if (!pointsOnRectangle(cell) && !pointsOnEllipse(cell)) { removeVertex(); } } } function addVertexControllers(g2) { vertexDragOptions = []; for (var i = 0; i < polygons.length; i++) { var cell = polygons[i]; var onRect = pointsOnRectangle(cell); var onEllipse = !onRect && pointsOnEllipse(cell); vertexDragOptions[i] = []; var len = cell.length; for (var j = 0; j < len; j++) { if (cell[j][0] === "Z") continue; if (onEllipse && j !== i000 && j !== i090 && j !== i180 && j !== i270) { continue; } var rectSelection = onRect && dragOptions.isActiveSelection; var nextPoint; if (rectSelection) nextPoint = getNextPoint(cell, j); var x = cell[j][1]; var y = cell[j][2]; var vertex = g2.append(rectSelection ? "rect" : "circle").attr("data-i", i).attr("data-j", j).style({ fill: Color.background, stroke: Color.defaultLine, "stroke-width": 1, "shape-rendering": "crispEdges" }); if (rectSelection) { var dx = nextPoint[1] - x; var dy = nextPoint[2] - y; var width = dy ? 5 : Math.max(Math.min(25, Math.abs(dx) - 5), 5); var height = dx ? 5 : Math.max(Math.min(25, Math.abs(dy) - 5), 5); vertex.classed(dy ? "cursor-ew-resize" : "cursor-ns-resize", true).attr("width", width).attr("height", height).attr("x", x - width / 2).attr("y", y - height / 2).attr("transform", strTranslate(dx / 2, dy / 2)); } else { vertex.classed("cursor-grab", true).attr("r", 5).attr("cx", x).attr("cy", y); } vertexDragOptions[i][j] = { element: vertex.node(), gd: gd2, prepFn: startDragVertex, doneFn: endDragVertexController, clickFn: clickVertexController }; dragElement.init(vertexDragOptions[i][j]); } } } function moveGroup(dx, dy) { if (!polygons.length) return; for (var i = 0; i < polygons.length; i++) { for (var j = 0; j < polygons[i].length; j++) { for (var k = 0; k + 2 < polygons[i][j].length; k += 2) { polygons[i][j][k + 1] = copyPolygons[i][j][k + 1] + dx; polygons[i][j][k + 2] = copyPolygons[i][j][k + 2] + dy; } } } } function moveGroupController(dx, dy) { moveGroup(dx, dy); redraw(); } function startDragGroupController(evt) { indexI = +evt.srcElement.getAttribute("data-i"); if (!indexI) indexI = 0; groupDragOptions[indexI].moveFn = moveGroupController; } function endDragGroupController() { update(); } function clickGroupController(numClicks) { if (numClicks === 2) { eraseActiveSelection(gd2); } } function addGroupControllers() { groupDragOptions = []; if (!polygons.length) return; var i = 0; groupDragOptions[i] = { element: outlines[0][0], gd: gd2, prepFn: startDragGroupController, doneFn: endDragGroupController, clickFn: clickGroupController }; dragElement.init(groupDragOptions[i]); } }; function recordPositions(polygonsOut, polygonsIn) { for (var i = 0; i < polygonsIn.length; i++) { var cell = polygonsIn[i]; polygonsOut[i] = []; for (var j = 0; j < cell.length; j++) { polygonsOut[i][j] = []; for (var k = 0; k < cell[j].length; k++) { polygonsOut[i][j][k] = cell[j][k]; } } } return polygonsOut; } function getNextPoint(cell, j) { var x = cell[j][1]; var y = cell[j][2]; var len = cell.length; var nextJ, nextX, nextY; nextJ = (j + 1) % len; nextX = cell[nextJ][1]; nextY = cell[nextJ][2]; if (nextX === x && nextY === y) { nextJ = (j + 2) % len; nextX = cell[nextJ][1]; nextY = cell[nextJ][2]; } return [nextJ, nextX, nextY]; } function eraseActiveSelection(gd2) { if (!selectMode(gd2._fullLayout.dragmode)) return; clearOutlineControllers(gd2); var id2 = gd2._fullLayout._activeSelectionIndex; var selections = (gd2.layout || {}).selections || []; if (id2 < selections.length) { var list = []; for (var q = 0; q < selections.length; q++) { if (q !== id2) { list.push(selections[q]); } } delete gd2._fullLayout._activeSelectionIndex; var erasedSelection = gd2._fullLayout.selections[id2]; gd2._fullLayout._deselect = { xref: erasedSelection.xref, yref: erasedSelection.yref }; Registry.call("_guiRelayout", gd2, { selections: list }); } } } }); // node_modules/plotly.js/src/components/shapes/draw.js var require_draw2 = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Lib = require_lib(); var Axes = require_axes(); var readPaths = require_helpers7().readPaths; var displayOutlines = require_display_outlines(); var drawLabel = require_display_labels(); var clearOutlineControllers = require_handle_outline().clearOutlineControllers; var Color = require_color(); var Drawing = require_drawing(); var arrayEditor = require_plot_template().arrayEditor; var dragElement = require_dragelement(); var setCursor = require_setcursor(); var constants = require_constants5(); var helpers = require_helpers8(); var getPathString = helpers.getPathString; module2.exports = { draw, drawOne, eraseActiveShape, drawLabel }; function draw(gd2) { var fullLayout = gd2._fullLayout; fullLayout._shapeUpperLayer.selectAll("path").remove(); fullLayout._shapeLowerLayer.selectAll("path").remove(); fullLayout._shapeUpperLayer.selectAll("text").remove(); fullLayout._shapeLowerLayer.selectAll("text").remove(); for (var k in fullLayout._plots) { var shapelayer = fullLayout._plots[k].shapelayer; if (shapelayer) { shapelayer.selectAll("path").remove(); shapelayer.selectAll("text").remove(); } } for (var i = 0; i < fullLayout.shapes.length; i++) { if (fullLayout.shapes[i].visible === true) { drawOne(gd2, i); } } } function shouldSkipEdits(gd2) { return !!gd2._fullLayout._outlining; } function couldHaveActiveShape(gd2) { return !gd2._context.edits.shapePosition; } function drawOne(gd2, index) { gd2._fullLayout._paperdiv.selectAll('.shapelayer [data-index="' + index + '"]').remove(); var o = helpers.makeShapesOptionsAndPlotinfo(gd2, index); var options = o.options; var plotinfo = o.plotinfo; if (!options._input || options.visible !== true) return; if (options.layer === "above") { drawShape(gd2._fullLayout._shapeUpperLayer); } else if (options.xref === "paper" || options.yref === "paper") { drawShape(gd2._fullLayout._shapeLowerLayer); } else if (options.layer === "between") { drawShape(plotinfo.shapelayerBetween); } else { if (plotinfo._hadPlotinfo) { var mainPlot = plotinfo.mainplotinfo || plotinfo; drawShape(mainPlot.shapelayer); } else { drawShape(gd2._fullLayout._shapeLowerLayer); } } function drawShape(shapeLayer) { var d = getPathString(gd2, options); var attrs = { "data-index": index, "fill-rule": options.fillrule, d }; var opacity = options.opacity; var fillColor = options.fillcolor; var lineColor = options.line.width ? options.line.color : "rgba(0,0,0,0)"; var lineWidth = options.line.width; var lineDash = options.line.dash; if (!lineWidth && options.editable === true) { lineWidth = 5; lineDash = "solid"; } var isOpen = d[d.length - 1] !== "Z"; var isActiveShape = couldHaveActiveShape(gd2) && options.editable && gd2._fullLayout._activeShapeIndex === index; if (isActiveShape) { fillColor = isOpen ? "rgba(0,0,0,0)" : gd2._fullLayout.activeshape.fillcolor; opacity = gd2._fullLayout.activeshape.opacity; } var shapeGroup = shapeLayer.append("g").classed("shape-group", true).attr({ "data-index": index }); var path = shapeGroup.append("path").attr(attrs).style("opacity", opacity).call(Color.stroke, lineColor).call(Color.fill, fillColor).call(Drawing.dashLine, lineDash, lineWidth); setClipPath(shapeGroup, gd2, options); drawLabel(gd2, index, options, shapeGroup); var editHelpers; if (isActiveShape || gd2._context.edits.shapePosition) editHelpers = arrayEditor(gd2.layout, "shapes", options); if (isActiveShape) { path.style({ cursor: "move" }); var dragOptions = { element: path.node(), plotinfo, gd: gd2, editHelpers, hasText: options.label.text || options.label.texttemplate, isActiveShape: true // i.e. to enable controllers }; var polygons = readPaths(d, gd2); displayOutlines(polygons, path, dragOptions); } else { if (gd2._context.edits.shapePosition) { setupDragElement(gd2, path, options, index, shapeLayer, editHelpers); } else if (options.editable === true) { path.style( "pointer-events", isOpen || Color.opacity(fillColor) * opacity <= 0.5 ? "stroke" : "all" ); } } path.node().addEventListener("click", function() { return activateShape(gd2, path); }); } } function setClipPath(shapePath, gd2, shapeOptions) { var clipAxes = (shapeOptions.xref + shapeOptions.yref).replace(/paper/g, "").replace(/[xyz][1-9]* *domain/g, ""); Drawing.setClipUrl( shapePath, clipAxes ? "clip" + gd2._fullLayout._uid + clipAxes : null, gd2 ); } function setupDragElement(gd2, shapePath, shapeOptions, index, shapeLayer, editHelpers) { var MINWIDTH = 10; var MINHEIGHT = 10; var xPixelSized = shapeOptions.xsizemode === "pixel"; var yPixelSized = shapeOptions.ysizemode === "pixel"; var isLine = shapeOptions.type === "line"; var isPath = shapeOptions.type === "path"; var modifyItem = editHelpers.modifyItem; var x02, y02, x12, y12, xAnchor, yAnchor; var n02, s02, w02, e02, optN, optS, optW, optE; var pathIn; var shapeGroup = d3.select(shapePath.node().parentNode); var xa2 = Axes.getFromId(gd2, shapeOptions.xref); var xRefType = Axes.getRefType(shapeOptions.xref); var ya2 = Axes.getFromId(gd2, shapeOptions.yref); var yRefType = Axes.getRefType(shapeOptions.yref); var shiftXStart = shapeOptions.x0shift; var shiftXEnd = shapeOptions.x1shift; var shiftYStart = shapeOptions.y0shift; var shiftYEnd = shapeOptions.y1shift; var x2p = function(v, shift) { var dataToPixel = helpers.getDataToPixel(gd2, xa2, shift, false, xRefType); return dataToPixel(v); }; var y2p = function(v, shift) { var dataToPixel = helpers.getDataToPixel(gd2, ya2, shift, true, yRefType); return dataToPixel(v); }; var p2x = helpers.getPixelToData(gd2, xa2, false, xRefType); var p2y = helpers.getPixelToData(gd2, ya2, true, yRefType); var sensoryElement = obtainSensoryElement(); var dragOptions = { element: sensoryElement.node(), gd: gd2, prepFn: startDrag, doneFn: endDrag, clickFn: abortDrag }; var dragMode; dragElement.init(dragOptions); sensoryElement.node().onmousemove = updateDragMode; function obtainSensoryElement() { return isLine ? createLineDragHandles() : shapePath; } function createLineDragHandles() { var minSensoryWidth = 10; var sensoryWidth = Math.max(shapeOptions.line.width, minSensoryWidth); var g = shapeLayer.append("g").attr("data-index", index).attr("drag-helper", true); g.append("path").attr("d", shapePath.attr("d")).style({ cursor: "move", "stroke-width": sensoryWidth, "stroke-opacity": "0" // ensure not visible }); var circleStyle = { "fill-opacity": "0" // ensure not visible }; var circleRadius = Math.max(sensoryWidth / 2, minSensoryWidth); g.append("circle").attr({ "data-line-point": "start-point", cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x0 : x2p(shapeOptions.x0, shiftXStart), cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y0 : y2p(shapeOptions.y0, shiftYStart), r: circleRadius }).style(circleStyle).classed("cursor-grab", true); g.append("circle").attr({ "data-line-point": "end-point", cx: xPixelSized ? x2p(shapeOptions.xanchor) + shapeOptions.x1 : x2p(shapeOptions.x1, shiftXEnd), cy: yPixelSized ? y2p(shapeOptions.yanchor) - shapeOptions.y1 : y2p(shapeOptions.y1, shiftYEnd), r: circleRadius }).style(circleStyle).classed("cursor-grab", true); return g; } function updateDragMode(evt) { if (shouldSkipEdits(gd2)) { dragMode = null; return; } if (isLine) { if (evt.target.tagName === "path") { dragMode = "move"; } else { dragMode = evt.target.attributes["data-line-point"].value === "start-point" ? "resize-over-start-point" : "resize-over-end-point"; } } else { var dragBBox = dragOptions.element.getBoundingClientRect(); var w = dragBBox.right - dragBBox.left; var h = dragBBox.bottom - dragBBox.top; var x = evt.clientX - dragBBox.left; var y = evt.clientY - dragBBox.top; var cursor = !isPath && w > MINWIDTH && h > MINHEIGHT && !evt.shiftKey ? dragElement.getCursor(x / w, 1 - y / h) : "move"; setCursor(shapePath, cursor); dragMode = cursor.split("-")[0]; } } function startDrag(evt) { if (shouldSkipEdits(gd2)) return; if (xPixelSized) { xAnchor = x2p(shapeOptions.xanchor); } if (yPixelSized) { yAnchor = y2p(shapeOptions.yanchor); } if (shapeOptions.type === "path") { pathIn = shapeOptions.path; } else { x02 = xPixelSized ? shapeOptions.x0 : x2p(shapeOptions.x0); y02 = yPixelSized ? shapeOptions.y0 : y2p(shapeOptions.y0); x12 = xPixelSized ? shapeOptions.x1 : x2p(shapeOptions.x1); y12 = yPixelSized ? shapeOptions.y1 : y2p(shapeOptions.y1); } if (x02 < x12) { w02 = x02; optW = "x0"; e02 = x12; optE = "x1"; } else { w02 = x12; optW = "x1"; e02 = x02; optE = "x0"; } if (!yPixelSized && y02 < y12 || yPixelSized && y02 > y12) { n02 = y02; optN = "y0"; s02 = y12; optS = "y1"; } else { n02 = y12; optN = "y1"; s02 = y02; optS = "y0"; } updateDragMode(evt); renderVisualCues(shapeLayer, shapeOptions); deactivateClipPathTemporarily(shapePath, shapeOptions, gd2); dragOptions.moveFn = dragMode === "move" ? moveShape : resizeShape; dragOptions.altKey = evt.altKey; } function endDrag() { if (shouldSkipEdits(gd2)) return; setCursor(shapePath); removeVisualCues(shapeLayer); setClipPath(shapePath, gd2, shapeOptions); Registry.call("_guiRelayout", gd2, editHelpers.getUpdateObj()); } function abortDrag() { if (shouldSkipEdits(gd2)) return; removeVisualCues(shapeLayer); } function moveShape(dx, dy) { if (shapeOptions.type === "path") { var noOp = function(coord) { return coord; }; var moveX = noOp; var moveY = noOp; if (xPixelSized) { modifyItem("xanchor", shapeOptions.xanchor = p2x(xAnchor + dx)); } else { moveX = function moveX2(x) { return p2x(x2p(x) + dx); }; if (xa2 && xa2.type === "date") moveX = helpers.encodeDate(moveX); } if (yPixelSized) { modifyItem("yanchor", shapeOptions.yanchor = p2y(yAnchor + dy)); } else { moveY = function moveY2(y) { return p2y(y2p(y) + dy); }; if (ya2 && ya2.type === "date") moveY = helpers.encodeDate(moveY); } modifyItem("path", shapeOptions.path = movePath(pathIn, moveX, moveY)); } else { if (xPixelSized) { modifyItem("xanchor", shapeOptions.xanchor = p2x(xAnchor + dx)); } else { modifyItem("x0", shapeOptions.x0 = p2x(x02 + dx)); modifyItem("x1", shapeOptions.x1 = p2x(x12 + dx)); } if (yPixelSized) { modifyItem("yanchor", shapeOptions.yanchor = p2y(yAnchor + dy)); } else { modifyItem("y0", shapeOptions.y0 = p2y(y02 + dy)); modifyItem("y1", shapeOptions.y1 = p2y(y12 + dy)); } } shapePath.attr("d", getPathString(gd2, shapeOptions)); renderVisualCues(shapeLayer, shapeOptions); drawLabel(gd2, index, shapeOptions, shapeGroup); } function resizeShape(dx, dy) { if (isPath) { var noOp = function(coord) { return coord; }; var moveX = noOp; var moveY = noOp; if (xPixelSized) { modifyItem("xanchor", shapeOptions.xanchor = p2x(xAnchor + dx)); } else { moveX = function moveX2(x) { return p2x(x2p(x) + dx); }; if (xa2 && xa2.type === "date") moveX = helpers.encodeDate(moveX); } if (yPixelSized) { modifyItem("yanchor", shapeOptions.yanchor = p2y(yAnchor + dy)); } else { moveY = function moveY2(y) { return p2y(y2p(y) + dy); }; if (ya2 && ya2.type === "date") moveY = helpers.encodeDate(moveY); } modifyItem("path", shapeOptions.path = movePath(pathIn, moveX, moveY)); } else if (isLine) { if (dragMode === "resize-over-start-point") { var newX0 = x02 + dx; var newY0 = yPixelSized ? y02 - dy : y02 + dy; modifyItem("x0", shapeOptions.x0 = xPixelSized ? newX0 : p2x(newX0)); modifyItem("y0", shapeOptions.y0 = yPixelSized ? newY0 : p2y(newY0)); } else if (dragMode === "resize-over-end-point") { var newX1 = x12 + dx; var newY1 = yPixelSized ? y12 - dy : y12 + dy; modifyItem("x1", shapeOptions.x1 = xPixelSized ? newX1 : p2x(newX1)); modifyItem("y1", shapeOptions.y1 = yPixelSized ? newY1 : p2y(newY1)); } } else { var has = function(str) { return dragMode.indexOf(str) !== -1; }; var hasN = has("n"); var hasS = has("s"); var hasW = has("w"); var hasE = has("e"); var newN = hasN ? n02 + dy : n02; var newS = hasS ? s02 + dy : s02; var newW = hasW ? w02 + dx : w02; var newE = hasE ? e02 + dx : e02; if (yPixelSized) { if (hasN) newN = n02 - dy; if (hasS) newS = s02 - dy; } if (!yPixelSized && newS - newN > MINHEIGHT || yPixelSized && newN - newS > MINHEIGHT) { modifyItem(optN, shapeOptions[optN] = yPixelSized ? newN : p2y(newN)); modifyItem(optS, shapeOptions[optS] = yPixelSized ? newS : p2y(newS)); } if (newE - newW > MINWIDTH) { modifyItem(optW, shapeOptions[optW] = xPixelSized ? newW : p2x(newW)); modifyItem(optE, shapeOptions[optE] = xPixelSized ? newE : p2x(newE)); } } shapePath.attr("d", getPathString(gd2, shapeOptions)); renderVisualCues(shapeLayer, shapeOptions); drawLabel(gd2, index, shapeOptions, shapeGroup); } function renderVisualCues(shapeLayer2, shapeOptions2) { if (xPixelSized || yPixelSized) { renderAnchor(); } function renderAnchor() { var isNotPath = shapeOptions2.type !== "path"; var visualCues = shapeLayer2.selectAll(".visual-cue").data([0]); var strokeWidth = 1; visualCues.enter().append("path").attr({ fill: "#fff", "fill-rule": "evenodd", stroke: "#000", "stroke-width": strokeWidth }).classed("visual-cue", true); var posX = x2p( xPixelSized ? shapeOptions2.xanchor : Lib.midRange( isNotPath ? [shapeOptions2.x0, shapeOptions2.x1] : helpers.extractPathCoords(shapeOptions2.path, constants.paramIsX) ) ); var posY = y2p( yPixelSized ? shapeOptions2.yanchor : Lib.midRange( isNotPath ? [shapeOptions2.y0, shapeOptions2.y1] : helpers.extractPathCoords(shapeOptions2.path, constants.paramIsY) ) ); posX = helpers.roundPositionForSharpStrokeRendering(posX, strokeWidth); posY = helpers.roundPositionForSharpStrokeRendering(posY, strokeWidth); if (xPixelSized && yPixelSized) { var crossPath = "M" + (posX - 1 - strokeWidth) + "," + (posY - 1 - strokeWidth) + "h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z"; visualCues.attr("d", crossPath); } else if (xPixelSized) { var vBarPath = "M" + (posX - 1 - strokeWidth) + "," + (posY - 9 - strokeWidth) + "v18 h2 v-18 Z"; visualCues.attr("d", vBarPath); } else { var hBarPath = "M" + (posX - 9 - strokeWidth) + "," + (posY - 1 - strokeWidth) + "h18 v2 h-18 Z"; visualCues.attr("d", hBarPath); } } } function removeVisualCues(shapeLayer2) { shapeLayer2.selectAll(".visual-cue").remove(); } function deactivateClipPathTemporarily(shapePath2, shapeOptions2, gd3) { var xref = shapeOptions2.xref; var yref = shapeOptions2.yref; var xa3 = Axes.getFromId(gd3, xref); var ya3 = Axes.getFromId(gd3, yref); var clipAxes = ""; if (xref !== "paper" && !xa3.autorange) clipAxes += xref; if (yref !== "paper" && !ya3.autorange) clipAxes += yref; Drawing.setClipUrl( shapePath2, clipAxes ? "clip" + gd3._fullLayout._uid + clipAxes : null, gd3 ); } } function movePath(pathIn, moveX, moveY) { return pathIn.replace(constants.segmentRE, function(segment) { var paramNumber = 0; var segmentType = segment.charAt(0); var xParams = constants.paramIsX[segmentType]; var yParams = constants.paramIsY[segmentType]; var nParams = constants.numParams[segmentType]; var paramString = segment.substr(1).replace(constants.paramRE, function(param) { if (paramNumber >= nParams) return param; if (xParams[paramNumber]) param = moveX(param); else if (yParams[paramNumber]) param = moveY(param); paramNumber++; return param; }); return segmentType + paramString; }); } function activateShape(gd2, path) { if (!couldHaveActiveShape(gd2)) return; var element = path.node(); var id2 = +element.getAttribute("data-index"); if (id2 >= 0) { if (id2 === gd2._fullLayout._activeShapeIndex) { deactivateShape(gd2); return; } gd2._fullLayout._activeShapeIndex = id2; gd2._fullLayout._deactivateShape = deactivateShape; draw(gd2); } } function deactivateShape(gd2) { if (!couldHaveActiveShape(gd2)) return; var id2 = gd2._fullLayout._activeShapeIndex; if (id2 >= 0) { clearOutlineControllers(gd2); delete gd2._fullLayout._activeShapeIndex; draw(gd2); } } function eraseActiveShape(gd2) { if (!couldHaveActiveShape(gd2)) return; clearOutlineControllers(gd2); var id2 = gd2._fullLayout._activeShapeIndex; var shapes = (gd2.layout || {}).shapes || []; if (id2 < shapes.length) { var list = []; for (var q = 0; q < shapes.length; q++) { if (q !== id2) { list.push(shapes[q]); } } delete gd2._fullLayout._activeShapeIndex; return Registry.call("_guiRelayout", gd2, { shapes: list }); } } } }); // node_modules/plotly.js/src/components/modebar/buttons.js var require_buttons = __commonJS({ "node_modules/plotly.js/src/components/modebar/buttons.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Plots = require_plots(); var axisIds = require_axis_ids(); var Icons = require_ploticon(); var eraseActiveShape = require_draw2().eraseActiveShape; var Lib = require_lib(); var _ = Lib._; var modeBarButtons = module2.exports = {}; modeBarButtons.toImage = { name: "toImage", title: function(gd2) { var opts = gd2._context.toImageButtonOptions || {}; var format2 = opts.format || "png"; return format2 === "png" ? _(gd2, "Download plot as a png") : ( // legacy text _(gd2, "Download plot") ); }, icon: Icons.camera, click: function(gd2) { var toImageButtonOptions = gd2._context.toImageButtonOptions; var opts = { format: toImageButtonOptions.format || "png" }; Lib.notifier(_(gd2, "Taking snapshot - this may take a few seconds"), "long"); if (opts.format !== "svg" && Lib.isIE()) { Lib.notifier(_(gd2, "IE only supports svg. Changing format to svg."), "long"); opts.format = "svg"; } ["filename", "width", "height", "scale"].forEach(function(key) { if (key in toImageButtonOptions) { opts[key] = toImageButtonOptions[key]; } }); Registry.call("downloadImage", gd2, opts).then(function(filename) { Lib.notifier(_(gd2, "Snapshot succeeded") + " - " + filename, "long"); }).catch(function() { Lib.notifier(_(gd2, "Sorry, there was a problem downloading your snapshot!"), "long"); }); } }; modeBarButtons.sendDataToCloud = { name: "sendDataToCloud", title: function(gd2) { return _(gd2, "Edit in Chart Studio"); }, icon: Icons.disk, click: function(gd2) { Plots.sendDataToCloud(gd2); } }; modeBarButtons.editInChartStudio = { name: "editInChartStudio", title: function(gd2) { return _(gd2, "Edit in Chart Studio"); }, icon: Icons.pencil, click: function(gd2) { Plots.sendDataToCloud(gd2); } }; modeBarButtons.zoom2d = { name: "zoom2d", _cat: "zoom", title: function(gd2) { return _(gd2, "Zoom"); }, attr: "dragmode", val: "zoom", icon: Icons.zoombox, click: handleCartesian }; modeBarButtons.pan2d = { name: "pan2d", _cat: "pan", title: function(gd2) { return _(gd2, "Pan"); }, attr: "dragmode", val: "pan", icon: Icons.pan, click: handleCartesian }; modeBarButtons.select2d = { name: "select2d", _cat: "select", title: function(gd2) { return _(gd2, "Box Select"); }, attr: "dragmode", val: "select", icon: Icons.selectbox, click: handleCartesian }; modeBarButtons.lasso2d = { name: "lasso2d", _cat: "lasso", title: function(gd2) { return _(gd2, "Lasso Select"); }, attr: "dragmode", val: "lasso", icon: Icons.lasso, click: handleCartesian }; modeBarButtons.drawclosedpath = { name: "drawclosedpath", title: function(gd2) { return _(gd2, "Draw closed freeform"); }, attr: "dragmode", val: "drawclosedpath", icon: Icons.drawclosedpath, click: handleCartesian }; modeBarButtons.drawopenpath = { name: "drawopenpath", title: function(gd2) { return _(gd2, "Draw open freeform"); }, attr: "dragmode", val: "drawopenpath", icon: Icons.drawopenpath, click: handleCartesian }; modeBarButtons.drawline = { name: "drawline", title: function(gd2) { return _(gd2, "Draw line"); }, attr: "dragmode", val: "drawline", icon: Icons.drawline, click: handleCartesian }; modeBarButtons.drawrect = { name: "drawrect", title: function(gd2) { return _(gd2, "Draw rectangle"); }, attr: "dragmode", val: "drawrect", icon: Icons.drawrect, click: handleCartesian }; modeBarButtons.drawcircle = { name: "drawcircle", title: function(gd2) { return _(gd2, "Draw circle"); }, attr: "dragmode", val: "drawcircle", icon: Icons.drawcircle, click: handleCartesian }; modeBarButtons.eraseshape = { name: "eraseshape", title: function(gd2) { return _(gd2, "Erase active shape"); }, icon: Icons.eraseshape, click: eraseActiveShape }; modeBarButtons.zoomIn2d = { name: "zoomIn2d", _cat: "zoomin", title: function(gd2) { return _(gd2, "Zoom in"); }, attr: "zoom", val: "in", icon: Icons.zoom_plus, click: handleCartesian }; modeBarButtons.zoomOut2d = { name: "zoomOut2d", _cat: "zoomout", title: function(gd2) { return _(gd2, "Zoom out"); }, attr: "zoom", val: "out", icon: Icons.zoom_minus, click: handleCartesian }; modeBarButtons.autoScale2d = { name: "autoScale2d", _cat: "autoscale", title: function(gd2) { return _(gd2, "Autoscale"); }, attr: "zoom", val: "auto", icon: Icons.autoscale, click: handleCartesian }; modeBarButtons.resetScale2d = { name: "resetScale2d", _cat: "resetscale", title: function(gd2) { return _(gd2, "Reset axes"); }, attr: "zoom", val: "reset", icon: Icons.home, click: handleCartesian }; modeBarButtons.hoverClosestCartesian = { name: "hoverClosestCartesian", _cat: "hoverclosest", title: function(gd2) { return _(gd2, "Show closest data on hover"); }, attr: "hovermode", val: "closest", icon: Icons.tooltip_basic, gravity: "ne", click: handleCartesian }; modeBarButtons.hoverCompareCartesian = { name: "hoverCompareCartesian", _cat: "hoverCompare", title: function(gd2) { return _(gd2, "Compare data on hover"); }, attr: "hovermode", val: function(gd2) { return gd2._fullLayout._isHoriz ? "y" : "x"; }, icon: Icons.tooltip_compare, gravity: "ne", click: handleCartesian }; function handleCartesian(gd2, ev2) { var button = ev2.currentTarget; var astr = button.getAttribute("data-attr"); var val = button.getAttribute("data-val") || true; var fullLayout = gd2._fullLayout; var aobj = {}; var axList = axisIds.list(gd2, null, true); var allSpikesEnabled = fullLayout._cartesianSpikesEnabled; var ax, i; if (astr === "zoom") { var mag = val === "in" ? 0.5 : 2; var r02 = (1 + mag) / 2; var r12 = (1 - mag) / 2; var axName; for (i = 0; i < axList.length; i++) { ax = axList[i]; if (!ax.fixedrange) { axName = ax._name; if (val === "auto") { aobj[axName + ".autorange"] = true; } else if (val === "reset") { if (ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0) { aobj[axName + ".autorange"] = true; } else if (ax._rangeInitial0 === void 0) { aobj[axName + ".autorange"] = ax._autorangeInitial; aobj[axName + ".range"] = [null, ax._rangeInitial1]; } else if (ax._rangeInitial1 === void 0) { aobj[axName + ".range"] = [ax._rangeInitial0, null]; aobj[axName + ".autorange"] = ax._autorangeInitial; } else { aobj[axName + ".range"] = [ax._rangeInitial0, ax._rangeInitial1]; } if (ax._showSpikeInitial !== void 0) { aobj[axName + ".showspikes"] = ax._showSpikeInitial; if (allSpikesEnabled === "on" && !ax._showSpikeInitial) { allSpikesEnabled = "off"; } } } else { var rangeNow = [ ax.r2l(ax.range[0]), ax.r2l(ax.range[1]) ]; var rangeNew = [ r02 * rangeNow[0] + r12 * rangeNow[1], r02 * rangeNow[1] + r12 * rangeNow[0] ]; aobj[axName + ".range[0]"] = ax.l2r(rangeNew[0]); aobj[axName + ".range[1]"] = ax.l2r(rangeNew[1]); } } } } else { if (astr === "hovermode" && (val === "x" || val === "y")) { val = fullLayout._isHoriz ? "y" : "x"; button.setAttribute("data-val", val); } aobj[astr] = val; } fullLayout._cartesianSpikesEnabled = allSpikesEnabled; Registry.call("_guiRelayout", gd2, aobj); } modeBarButtons.zoom3d = { name: "zoom3d", _cat: "zoom", title: function(gd2) { return _(gd2, "Zoom"); }, attr: "scene.dragmode", val: "zoom", icon: Icons.zoombox, click: handleDrag3d }; modeBarButtons.pan3d = { name: "pan3d", _cat: "pan", title: function(gd2) { return _(gd2, "Pan"); }, attr: "scene.dragmode", val: "pan", icon: Icons.pan, click: handleDrag3d }; modeBarButtons.orbitRotation = { name: "orbitRotation", title: function(gd2) { return _(gd2, "Orbital rotation"); }, attr: "scene.dragmode", val: "orbit", icon: Icons["3d_rotate"], click: handleDrag3d }; modeBarButtons.tableRotation = { name: "tableRotation", title: function(gd2) { return _(gd2, "Turntable rotation"); }, attr: "scene.dragmode", val: "turntable", icon: Icons["z-axis"], click: handleDrag3d }; function handleDrag3d(gd2, ev2) { var button = ev2.currentTarget; var attr = button.getAttribute("data-attr"); var val = button.getAttribute("data-val") || true; var sceneIds = gd2._fullLayout._subplots.gl3d || []; var layoutUpdate = {}; var parts = attr.split("."); for (var i = 0; i < sceneIds.length; i++) { layoutUpdate[sceneIds[i] + "." + parts[1]] = val; } var val2d = val === "pan" ? val : "zoom"; layoutUpdate.dragmode = val2d; Registry.call("_guiRelayout", gd2, layoutUpdate); } modeBarButtons.resetCameraDefault3d = { name: "resetCameraDefault3d", _cat: "resetCameraDefault", title: function(gd2) { return _(gd2, "Reset camera to default"); }, attr: "resetDefault", icon: Icons.home, click: handleCamera3d }; modeBarButtons.resetCameraLastSave3d = { name: "resetCameraLastSave3d", _cat: "resetCameraLastSave", title: function(gd2) { return _(gd2, "Reset camera to last save"); }, attr: "resetLastSave", icon: Icons.movie, click: handleCamera3d }; function handleCamera3d(gd2, ev2) { var button = ev2.currentTarget; var attr = button.getAttribute("data-attr"); var resetLastSave = attr === "resetLastSave"; var resetDefault = attr === "resetDefault"; var fullLayout = gd2._fullLayout; var sceneIds = fullLayout._subplots.gl3d || []; var aobj = {}; for (var i = 0; i < sceneIds.length; i++) { var sceneId = sceneIds[i]; var camera = sceneId + ".camera"; var aspectratio = sceneId + ".aspectratio"; var aspectmode = sceneId + ".aspectmode"; var scene = fullLayout[sceneId]._scene; var didUpdate; if (resetLastSave) { aobj[camera + ".up"] = scene.viewInitial.up; aobj[camera + ".eye"] = scene.viewInitial.eye; aobj[camera + ".center"] = scene.viewInitial.center; didUpdate = true; } else if (resetDefault) { aobj[camera + ".up"] = null; aobj[camera + ".eye"] = null; aobj[camera + ".center"] = null; didUpdate = true; } if (didUpdate) { aobj[aspectratio + ".x"] = scene.viewInitial.aspectratio.x; aobj[aspectratio + ".y"] = scene.viewInitial.aspectratio.y; aobj[aspectratio + ".z"] = scene.viewInitial.aspectratio.z; aobj[aspectmode] = scene.viewInitial.aspectmode; } } Registry.call("_guiRelayout", gd2, aobj); } modeBarButtons.hoverClosest3d = { name: "hoverClosest3d", _cat: "hoverclosest", title: function(gd2) { return _(gd2, "Toggle show closest data on hover"); }, attr: "hovermode", val: null, toggle: true, icon: Icons.tooltip_basic, gravity: "ne", click: handleHover3d }; function getNextHover3d(gd2, ev2) { var button = ev2.currentTarget; var val = button._previousVal; var fullLayout = gd2._fullLayout; var sceneIds = fullLayout._subplots.gl3d || []; var axes = ["xaxis", "yaxis", "zaxis"]; var currentSpikes = {}; var layoutUpdate = {}; if (val) { layoutUpdate = val; button._previousVal = null; } else { for (var i = 0; i < sceneIds.length; i++) { var sceneId = sceneIds[i]; var sceneLayout = fullLayout[sceneId]; var hovermodeAStr = sceneId + ".hovermode"; currentSpikes[hovermodeAStr] = sceneLayout.hovermode; layoutUpdate[hovermodeAStr] = false; for (var j = 0; j < 3; j++) { var axis = axes[j]; var spikeAStr = sceneId + "." + axis + ".showspikes"; layoutUpdate[spikeAStr] = false; currentSpikes[spikeAStr] = sceneLayout[axis].showspikes; } } button._previousVal = currentSpikes; } return layoutUpdate; } function handleHover3d(gd2, ev2) { var layoutUpdate = getNextHover3d(gd2, ev2); Registry.call("_guiRelayout", gd2, layoutUpdate); } modeBarButtons.zoomInGeo = { name: "zoomInGeo", _cat: "zoomin", title: function(gd2) { return _(gd2, "Zoom in"); }, attr: "zoom", val: "in", icon: Icons.zoom_plus, click: handleGeo }; modeBarButtons.zoomOutGeo = { name: "zoomOutGeo", _cat: "zoomout", title: function(gd2) { return _(gd2, "Zoom out"); }, attr: "zoom", val: "out", icon: Icons.zoom_minus, click: handleGeo }; modeBarButtons.resetGeo = { name: "resetGeo", _cat: "reset", title: function(gd2) { return _(gd2, "Reset"); }, attr: "reset", val: null, icon: Icons.autoscale, click: handleGeo }; modeBarButtons.hoverClosestGeo = { name: "hoverClosestGeo", _cat: "hoverclosest", title: function(gd2) { return _(gd2, "Toggle show closest data on hover"); }, attr: "hovermode", val: null, toggle: true, icon: Icons.tooltip_basic, gravity: "ne", click: toggleHover }; function handleGeo(gd2, ev2) { var button = ev2.currentTarget; var attr = button.getAttribute("data-attr"); var val = button.getAttribute("data-val") || true; var fullLayout = gd2._fullLayout; var geoIds = fullLayout._subplots.geo || []; for (var i = 0; i < geoIds.length; i++) { var id2 = geoIds[i]; var geoLayout = fullLayout[id2]; if (attr === "zoom") { var scale = geoLayout.projection.scale; var newScale = val === "in" ? 2 * scale : 0.5 * scale; Registry.call("_guiRelayout", gd2, id2 + ".projection.scale", newScale); } } if (attr === "reset") { resetView(gd2, "geo"); } } modeBarButtons.hoverClosestGl2d = { name: "hoverClosestGl2d", _cat: "hoverclosest", title: function(gd2) { return _(gd2, "Toggle show closest data on hover"); }, attr: "hovermode", val: null, toggle: true, icon: Icons.tooltip_basic, gravity: "ne", click: toggleHover }; modeBarButtons.hoverClosestPie = { name: "hoverClosestPie", _cat: "hoverclosest", title: function(gd2) { return _(gd2, "Toggle show closest data on hover"); }, attr: "hovermode", val: "closest", icon: Icons.tooltip_basic, gravity: "ne", click: toggleHover }; function getNextHover(gd2) { var fullLayout = gd2._fullLayout; if (fullLayout.hovermode) return false; if (fullLayout._has("cartesian")) { return fullLayout._isHoriz ? "y" : "x"; } return "closest"; } function toggleHover(gd2) { var newHover = getNextHover(gd2); Registry.call("_guiRelayout", gd2, "hovermode", newHover); } modeBarButtons.resetViewSankey = { name: "resetSankeyGroup", title: function(gd2) { return _(gd2, "Reset view"); }, icon: Icons.home, click: function(gd2) { var aObj = { "node.groups": [], "node.x": [], "node.y": [] }; for (var i = 0; i < gd2._fullData.length; i++) { var viewInitial = gd2._fullData[i]._viewInitial; aObj["node.groups"].push(viewInitial.node.groups.slice()); aObj["node.x"].push(viewInitial.node.x.slice()); aObj["node.y"].push(viewInitial.node.y.slice()); } Registry.call("restyle", gd2, aObj); } }; modeBarButtons.toggleHover = { name: "toggleHover", title: function(gd2) { return _(gd2, "Toggle show closest data on hover"); }, attr: "hovermode", val: null, toggle: true, icon: Icons.tooltip_basic, gravity: "ne", click: function(gd2, ev2) { var layoutUpdate = getNextHover3d(gd2, ev2); layoutUpdate.hovermode = getNextHover(gd2); Registry.call("_guiRelayout", gd2, layoutUpdate); } }; modeBarButtons.resetViews = { name: "resetViews", title: function(gd2) { return _(gd2, "Reset views"); }, icon: Icons.home, click: function(gd2, ev2) { var button = ev2.currentTarget; button.setAttribute("data-attr", "zoom"); button.setAttribute("data-val", "reset"); handleCartesian(gd2, ev2); button.setAttribute("data-attr", "resetLastSave"); handleCamera3d(gd2, ev2); resetView(gd2, "geo"); resetView(gd2, "mapbox"); resetView(gd2, "map"); } }; modeBarButtons.toggleSpikelines = { name: "toggleSpikelines", title: function(gd2) { return _(gd2, "Toggle Spike Lines"); }, icon: Icons.spikeline, attr: "_cartesianSpikesEnabled", val: "on", click: function(gd2) { var fullLayout = gd2._fullLayout; var allSpikesEnabled = fullLayout._cartesianSpikesEnabled; fullLayout._cartesianSpikesEnabled = allSpikesEnabled === "on" ? "off" : "on"; Registry.call("_guiRelayout", gd2, setSpikelineVisibility(gd2)); } }; function setSpikelineVisibility(gd2) { var fullLayout = gd2._fullLayout; var areSpikesOn = fullLayout._cartesianSpikesEnabled === "on"; var axList = axisIds.list(gd2, null, true); var aobj = {}; for (var i = 0; i < axList.length; i++) { var ax = axList[i]; aobj[ax._name + ".showspikes"] = areSpikesOn ? true : ax._showSpikeInitial; } return aobj; } modeBarButtons.resetViewMapbox = { name: "resetViewMapbox", _cat: "resetView", title: function(gd2) { return _(gd2, "Reset view"); }, attr: "reset", icon: Icons.home, click: function(gd2) { resetView(gd2, "mapbox"); } }; modeBarButtons.resetViewMap = { name: "resetViewMap", _cat: "resetView", title: function(gd2) { return _(gd2, "Reset view"); }, attr: "reset", icon: Icons.home, click: function(gd2) { resetView(gd2, "map"); } }; modeBarButtons.zoomInMapbox = { name: "zoomInMapbox", _cat: "zoomin", title: function(gd2) { return _(gd2, "Zoom in"); }, attr: "zoom", val: "in", icon: Icons.zoom_plus, click: handleMapboxZoom }; modeBarButtons.zoomInMap = { name: "zoomInMap", _cat: "zoomin", title: function(gd2) { return _(gd2, "Zoom in"); }, attr: "zoom", val: "in", icon: Icons.zoom_plus, click: handleMapZoom }; modeBarButtons.zoomOutMapbox = { name: "zoomOutMapbox", _cat: "zoomout", title: function(gd2) { return _(gd2, "Zoom out"); }, attr: "zoom", val: "out", icon: Icons.zoom_minus, click: handleMapboxZoom }; modeBarButtons.zoomOutMap = { name: "zoomOutMap", _cat: "zoomout", title: function(gd2) { return _(gd2, "Zoom out"); }, attr: "zoom", val: "out", icon: Icons.zoom_minus, click: handleMapZoom }; function handleMapboxZoom(gd2, ev2) { _handleMapZoom(gd2, ev2, "mapbox"); } function handleMapZoom(gd2, ev2) { _handleMapZoom(gd2, ev2, "map"); } function _handleMapZoom(gd2, ev2, mapType) { var button = ev2.currentTarget; var val = button.getAttribute("data-val"); var fullLayout = gd2._fullLayout; var subplotIds = fullLayout._subplots[mapType] || []; var scalar = 1.05; var aObj = {}; for (var i = 0; i < subplotIds.length; i++) { var id2 = subplotIds[i]; var current = fullLayout[id2].zoom; var next = val === "in" ? scalar * current : current / scalar; aObj[id2 + ".zoom"] = next; } Registry.call("_guiRelayout", gd2, aObj); } function resetView(gd2, subplotType) { var fullLayout = gd2._fullLayout; var subplotIds = fullLayout._subplots[subplotType] || []; var aObj = {}; for (var i = 0; i < subplotIds.length; i++) { var id2 = subplotIds[i]; var subplotObj = fullLayout[id2]._subplot; var viewInitial = subplotObj.viewInitial; var viewKeys = Object.keys(viewInitial); for (var j = 0; j < viewKeys.length; j++) { var key = viewKeys[j]; aObj[id2 + "." + key] = viewInitial[key]; } } Registry.call("_guiRelayout", gd2, aObj); } } }); // node_modules/plotly.js/src/components/modebar/constants.js var require_constants6 = __commonJS({ "node_modules/plotly.js/src/components/modebar/constants.js"(exports2, module2) { "use strict"; var modeBarButtons = require_buttons(); var buttonList = Object.keys(modeBarButtons); var DRAW_MODES = [ "drawline", "drawopenpath", "drawclosedpath", "drawcircle", "drawrect", "eraseshape" ]; var backButtons = [ "v1hovermode", "hoverclosest", "hovercompare", "togglehover", "togglespikelines" ].concat(DRAW_MODES); var foreButtons = []; var addToForeButtons = function(b) { if (backButtons.indexOf(b._cat || b.name) !== -1) return; var name = b.name; var _cat = (b._cat || b.name).toLowerCase(); if (foreButtons.indexOf(name) === -1) foreButtons.push(name); if (foreButtons.indexOf(_cat) === -1) foreButtons.push(_cat); }; buttonList.forEach(function(k) { addToForeButtons(modeBarButtons[k]); }); foreButtons.sort(); module2.exports = { DRAW_MODES, backButtons, foreButtons }; } }); // node_modules/plotly.js/src/components/modebar/attributes.js var require_attributes10 = __commonJS({ "node_modules/plotly.js/src/components/modebar/attributes.js"(exports2, module2) { "use strict"; var constants = require_constants6(); module2.exports = { editType: "modebar", orientation: { valType: "enumerated", values: ["v", "h"], dflt: "h", editType: "modebar", description: "Sets the orientation of the modebar." }, bgcolor: { valType: "color", editType: "modebar", description: "Sets the background color of the modebar." }, color: { valType: "color", editType: "modebar", description: "Sets the color of the icons in the modebar." }, activecolor: { valType: "color", editType: "modebar", description: "Sets the color of the active or hovered on icons in the modebar." }, uirevision: { valType: "any", editType: "none", description: [ "Controls persistence of user-driven changes related to the modebar,", "including `hovermode`, `dragmode`, and `showspikes` at both the", "root level and inside subplots. Defaults to `layout.uirevision`." ].join(" ") }, add: { valType: "string", arrayOk: true, dflt: "", editType: "modebar", description: [ "Determines which predefined modebar buttons to add.", "Please note that these buttons will only be shown if they are", "compatible with all trace types used in a graph.", "Similar to `config.modeBarButtonsToAdd` option.", "This may include *" + constants.backButtons.join("*, *") + "*." ].join(" ") }, remove: { valType: "string", arrayOk: true, dflt: "", editType: "modebar", description: [ "Determines which predefined modebar buttons to remove.", "Similar to `config.modeBarButtonsToRemove` option.", "This may include *" + constants.foreButtons.join("*, *") + "*." ].join(" ") } }; } }); // node_modules/plotly.js/src/components/modebar/defaults.js var require_defaults5 = __commonJS({ "node_modules/plotly.js/src/components/modebar/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Color = require_color(); var Template = require_plot_template(); var attributes = require_attributes10(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { var containerIn = layoutIn.modebar || {}; var containerOut = Template.newContainer(layoutOut, "modebar"); function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); } coerce("orientation"); coerce("bgcolor", Color.addOpacity(layoutOut.paper_bgcolor, 0.5)); var defaultColor = Color.contrast(Color.rgb(layoutOut.modebar.bgcolor)); coerce("color", Color.addOpacity(defaultColor, 0.3)); coerce("activecolor", Color.addOpacity(defaultColor, 0.7)); coerce("uirevision", layoutOut.uirevision); coerce("add"); coerce("remove"); }; } }); // node_modules/plotly.js/src/components/modebar/modebar.js var require_modebar = __commonJS({ "node_modules/plotly.js/src/components/modebar/modebar.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Icons = require_ploticon(); var version = require_version().version; var Parser = new DOMParser(); function ModeBar(opts) { this.container = opts.container; this.element = document.createElement("div"); this.update(opts.graphInfo, opts.buttons); this.container.appendChild(this.element); } var proto = ModeBar.prototype; proto.update = function(graphInfo, buttons) { this.graphInfo = graphInfo; var context = this.graphInfo._context; var fullLayout = this.graphInfo._fullLayout; var modeBarId = "modebar-" + fullLayout._uid; this.element.setAttribute("id", modeBarId); this._uid = modeBarId; this.element.className = "modebar"; if (context.displayModeBar === "hover") this.element.className += " modebar--hover ease-bg"; if (fullLayout.modebar.orientation === "v") { this.element.className += " vertical"; buttons = buttons.reverse(); } var style = fullLayout.modebar; var bgSelector = context.displayModeBar === "hover" ? ".js-plotly-plot .plotly:hover " : ""; Lib.deleteRelatedStyleRule(modeBarId); Lib.addRelatedStyleRule(modeBarId, bgSelector + "#" + modeBarId + " .modebar-group", "background-color: " + style.bgcolor); Lib.addRelatedStyleRule(modeBarId, "#" + modeBarId + " .modebar-btn .icon path", "fill: " + style.color); Lib.addRelatedStyleRule(modeBarId, "#" + modeBarId + " .modebar-btn:hover .icon path", "fill: " + style.activecolor); Lib.addRelatedStyleRule(modeBarId, "#" + modeBarId + " .modebar-btn.active .icon path", "fill: " + style.activecolor); var needsNewButtons = !this.hasButtons(buttons); var needsNewLogo = this.hasLogo !== context.displaylogo; var needsNewLocale = this.locale !== context.locale; this.locale = context.locale; if (needsNewButtons || needsNewLogo || needsNewLocale) { this.removeAllButtons(); this.updateButtons(buttons); if (context.watermark || context.displaylogo) { var logoGroup = this.getLogo(); if (context.watermark) { logoGroup.className = logoGroup.className + " watermark"; } if (fullLayout.modebar.orientation === "v") { this.element.insertBefore(logoGroup, this.element.childNodes[0]); } else { this.element.appendChild(logoGroup); } this.hasLogo = true; } } this.updateActiveButton(); }; proto.updateButtons = function(buttons) { var _this = this; this.buttons = buttons; this.buttonElements = []; this.buttonsNames = []; this.buttons.forEach(function(buttonGroup) { var group = _this.createGroup(); buttonGroup.forEach(function(buttonConfig) { var buttonName = buttonConfig.name; if (!buttonName) { throw new Error("must provide button 'name' in button config"); } if (_this.buttonsNames.indexOf(buttonName) !== -1) { throw new Error("button name '" + buttonName + "' is taken"); } _this.buttonsNames.push(buttonName); var button = _this.createButton(buttonConfig); _this.buttonElements.push(button); group.appendChild(button); }); _this.element.appendChild(group); }); }; proto.createGroup = function() { var group = document.createElement("div"); group.className = "modebar-group"; return group; }; proto.createButton = function(config) { var _this = this; var button = document.createElement("a"); button.setAttribute("rel", "tooltip"); button.className = "modebar-btn"; var title = config.title; if (title === void 0) title = config.name; else if (typeof title === "function") title = title(this.graphInfo); if (title || title === 0) button.setAttribute("data-title", title); if (config.attr !== void 0) button.setAttribute("data-attr", config.attr); var val = config.val; if (val !== void 0) { if (typeof val === "function") val = val(this.graphInfo); button.setAttribute("data-val", val); } var click = config.click; if (typeof click !== "function") { throw new Error("must provide button 'click' function in button config"); } else { button.addEventListener("click", function(ev2) { config.click(_this.graphInfo, ev2); _this.updateActiveButton(ev2.currentTarget); }); } button.setAttribute("data-toggle", config.toggle || false); if (config.toggle) d3.select(button).classed("active", true); var icon = config.icon; if (typeof icon === "function") { button.appendChild(icon()); } else { button.appendChild(this.createIcon(icon || Icons.question)); } button.setAttribute("data-gravity", config.gravity || "n"); return button; }; proto.createIcon = function(thisIcon) { var iconHeight = isNumeric(thisIcon.height) ? Number(thisIcon.height) : thisIcon.ascent - thisIcon.descent; var svgNS = "http://www.w3.org/2000/svg"; var icon; if (thisIcon.path) { icon = document.createElementNS(svgNS, "svg"); icon.setAttribute("viewBox", [0, 0, thisIcon.width, iconHeight].join(" ")); icon.setAttribute("class", "icon"); var path = document.createElementNS(svgNS, "path"); path.setAttribute("d", thisIcon.path); if (thisIcon.transform) { path.setAttribute("transform", thisIcon.transform); } else if (thisIcon.ascent !== void 0) { path.setAttribute("transform", "matrix(1 0 0 -1 0 " + thisIcon.ascent + ")"); } icon.appendChild(path); } if (thisIcon.svg) { var svgDoc = Parser.parseFromString(thisIcon.svg, "application/xml"); icon = svgDoc.childNodes[0]; } icon.setAttribute("height", "1em"); icon.setAttribute("width", "1em"); return icon; }; proto.updateActiveButton = function(buttonClicked) { var fullLayout = this.graphInfo._fullLayout; var dataAttrClicked = buttonClicked !== void 0 ? buttonClicked.getAttribute("data-attr") : null; this.buttonElements.forEach(function(button) { var thisval = button.getAttribute("data-val") || true; var dataAttr = button.getAttribute("data-attr"); var isToggleButton = button.getAttribute("data-toggle") === "true"; var button3 = d3.select(button); if (isToggleButton) { if (dataAttr === dataAttrClicked) { button3.classed("active", !button3.classed("active")); } } else { var val = dataAttr === null ? dataAttr : Lib.nestedProperty(fullLayout, dataAttr).get(); button3.classed("active", val === thisval); } }); }; proto.hasButtons = function(buttons) { var currentButtons = this.buttons; if (!currentButtons) return false; if (buttons.length !== currentButtons.length) return false; for (var i = 0; i < buttons.length; ++i) { if (buttons[i].length !== currentButtons[i].length) return false; for (var j = 0; j < buttons[i].length; j++) { if (buttons[i][j].name !== currentButtons[i][j].name) return false; } } return true; }; function jsVersion(str) { return str + " (v" + version + ")"; } proto.getLogo = function() { var group = this.createGroup(); var a = document.createElement("a"); a.href = "https://plotly.com/"; a.target = "_blank"; a.setAttribute("data-title", jsVersion(Lib._(this.graphInfo, "Produced with Plotly.js"))); a.className = "modebar-btn plotlyjsicon modebar-btn--logo"; a.appendChild(this.createIcon(Icons.newplotlylogo)); group.appendChild(a); return group; }; proto.removeAllButtons = function() { while (this.element.firstChild) { this.element.removeChild(this.element.firstChild); } this.hasLogo = false; }; proto.destroy = function() { Lib.removeElement(this.container.querySelector(".modebar")); Lib.deleteRelatedStyleRule(this._uid); }; function createModeBar(gd2, buttons) { var fullLayout = gd2._fullLayout; var modeBar = new ModeBar({ graphInfo: gd2, container: fullLayout._modebardiv.node(), buttons }); if (fullLayout._privateplot) { d3.select(modeBar.element).append("span").classed("badge-private float--left", true).text("PRIVATE"); } return modeBar; } module2.exports = createModeBar; } }); // node_modules/plotly.js/src/components/modebar/manage.js var require_manage = __commonJS({ "node_modules/plotly.js/src/components/modebar/manage.js"(exports2, module2) { "use strict"; var axisIds = require_axis_ids(); var scatterSubTypes = require_subtypes(); var Registry = require_registry(); var isUnifiedHover = require_helpers2().isUnifiedHover; var createModeBar = require_modebar(); var modeBarButtons = require_buttons(); var DRAW_MODES = require_constants6().DRAW_MODES; var extendDeep = require_lib().extendDeep; module2.exports = function manageModeBar(gd2) { var fullLayout = gd2._fullLayout; var context = gd2._context; var modeBar = fullLayout._modeBar; if (!context.displayModeBar && !context.watermark) { if (modeBar) { modeBar.destroy(); delete fullLayout._modeBar; } return; } if (!Array.isArray(context.modeBarButtonsToRemove)) { throw new Error([ "*modeBarButtonsToRemove* configuration options", "must be an array." ].join(" ")); } if (!Array.isArray(context.modeBarButtonsToAdd)) { throw new Error([ "*modeBarButtonsToAdd* configuration options", "must be an array." ].join(" ")); } var customButtons = context.modeBarButtons; var buttonGroups; if (Array.isArray(customButtons) && customButtons.length) { buttonGroups = fillCustomButton(customButtons); } else if (!context.displayModeBar && context.watermark) { buttonGroups = []; } else { buttonGroups = getButtonGroups(gd2); } if (modeBar) modeBar.update(gd2, buttonGroups); else fullLayout._modeBar = createModeBar(gd2, buttonGroups); }; function getButtonGroups(gd2) { var fullLayout = gd2._fullLayout; var fullData = gd2._fullData; var context = gd2._context; function match(name, B) { if (typeof B === "string") { if (B.toLowerCase() === name.toLowerCase()) return true; } else { var v02 = B.name; var v12 = B._cat || B.name; if (v02 === name || v12 === name.toLowerCase()) return true; } return false; } var layoutAdd = fullLayout.modebar.add; if (typeof layoutAdd === "string") layoutAdd = [layoutAdd]; var layoutRemove = fullLayout.modebar.remove; if (typeof layoutRemove === "string") layoutRemove = [layoutRemove]; var buttonsToAdd = context.modeBarButtonsToAdd.concat( layoutAdd.filter(function(e) { for (var i2 = 0; i2 < context.modeBarButtonsToRemove.length; i2++) { if (match(e, context.modeBarButtonsToRemove[i2])) return false; } return true; }) ); var buttonsToRemove = context.modeBarButtonsToRemove.concat( layoutRemove.filter(function(e) { for (var i2 = 0; i2 < context.modeBarButtonsToAdd.length; i2++) { if (match(e, context.modeBarButtonsToAdd[i2])) return false; } return true; }) ); var hasCartesian = fullLayout._has("cartesian"); var hasGL3D = fullLayout._has("gl3d"); var hasGeo = fullLayout._has("geo"); var hasPie = fullLayout._has("pie"); var hasFunnelarea = fullLayout._has("funnelarea"); var hasGL2D = fullLayout._has("gl2d"); var hasTernary = fullLayout._has("ternary"); var hasMapbox = fullLayout._has("mapbox"); var hasMap = fullLayout._has("map"); var hasPolar = fullLayout._has("polar"); var hasSmith = fullLayout._has("smith"); var hasSankey = fullLayout._has("sankey"); var allAxesFixed = areAllAxesFixed(fullLayout); var hasUnifiedHoverLabel = isUnifiedHover(fullLayout.hovermode); var groups = []; function addGroup(newGroup) { if (!newGroup.length) return; var out = []; for (var i2 = 0; i2 < newGroup.length; i2++) { var name = newGroup[i2]; var B = modeBarButtons[name]; var v02 = B.name.toLowerCase(); var v12 = (B._cat || B.name).toLowerCase(); var found = false; for (var q = 0; q < buttonsToRemove.length; q++) { var t = buttonsToRemove[q].toLowerCase(); if (t === v02 || t === v12) { found = true; break; } } if (found) continue; out.push(modeBarButtons[name]); } groups.push(out); } var commonGroup = ["toImage"]; if (context.showEditInChartStudio) commonGroup.push("editInChartStudio"); else if (context.showSendToCloud) commonGroup.push("sendDataToCloud"); addGroup(commonGroup); var zoomGroup = []; var hoverGroup = []; var resetGroup = []; var dragModeGroup = []; if ((hasCartesian || hasGL2D || hasPie || hasFunnelarea || hasTernary) + hasGeo + hasGL3D + hasMapbox + hasMap + hasPolar + hasSmith > 1) { hoverGroup = ["toggleHover"]; resetGroup = ["resetViews"]; } else if (hasGeo) { zoomGroup = ["zoomInGeo", "zoomOutGeo"]; hoverGroup = ["hoverClosestGeo"]; resetGroup = ["resetGeo"]; } else if (hasGL3D) { hoverGroup = ["hoverClosest3d"]; resetGroup = ["resetCameraDefault3d", "resetCameraLastSave3d"]; } else if (hasMapbox) { zoomGroup = ["zoomInMapbox", "zoomOutMapbox"]; hoverGroup = ["toggleHover"]; resetGroup = ["resetViewMapbox"]; } else if (hasMap) { zoomGroup = ["zoomInMap", "zoomOutMap"]; hoverGroup = ["toggleHover"]; resetGroup = ["resetViewMap"]; } else if (hasGL2D) { hoverGroup = ["hoverClosestGl2d"]; } else if (hasPie) { hoverGroup = ["hoverClosestPie"]; } else if (hasSankey) { hoverGroup = ["hoverClosestCartesian", "hoverCompareCartesian"]; resetGroup = ["resetViewSankey"]; } else { hoverGroup = ["toggleHover"]; } if (hasCartesian) { hoverGroup.push("toggleSpikelines", "hoverClosestCartesian", "hoverCompareCartesian"); } if (hasNoHover(fullData) || hasUnifiedHoverLabel) { hoverGroup = []; } if ((hasCartesian || hasGL2D) && !allAxesFixed) { zoomGroup = ["zoomIn2d", "zoomOut2d", "autoScale2d"]; if (resetGroup[0] !== "resetViews") resetGroup = ["resetScale2d"]; } if (hasGL3D) { dragModeGroup = ["zoom3d", "pan3d", "orbitRotation", "tableRotation"]; } else if ((hasCartesian || hasGL2D) && !allAxesFixed || hasTernary) { dragModeGroup = ["zoom2d", "pan2d"]; } else if (hasMapbox || hasMap || hasGeo) { dragModeGroup = ["pan2d"]; } else if (hasPolar) { dragModeGroup = ["zoom2d"]; } if (isSelectable(fullData)) { dragModeGroup.push("select2d", "lasso2d"); } var enabledHoverGroup = []; var enableHover = function(a) { if (enabledHoverGroup.indexOf(a) !== -1) return; if (hoverGroup.indexOf(a) !== -1) { enabledHoverGroup.push(a); } }; if (Array.isArray(buttonsToAdd)) { var newList = []; for (var i = 0; i < buttonsToAdd.length; i++) { var b = buttonsToAdd[i]; if (typeof b === "string") { b = b.toLowerCase(); if (DRAW_MODES.indexOf(b) !== -1) { if (fullLayout._has("mapbox") || fullLayout._has("map") || // draw shapes in paper coordinate (could be improved in future to support data coordinate, when there is no pitch) fullLayout._has("cartesian")) { dragModeGroup.push(b); } } else if (b === "togglespikelines") { enableHover("toggleSpikelines"); } else if (b === "togglehover") { enableHover("toggleHover"); } else if (b === "hovercompare") { enableHover("hoverCompareCartesian"); } else if (b === "hoverclosest") { enableHover("hoverClosestCartesian"); enableHover("hoverClosestGeo"); enableHover("hoverClosest3d"); enableHover("hoverClosestGl2d"); enableHover("hoverClosestPie"); } else if (b === "v1hovermode") { enableHover("hoverClosestCartesian"); enableHover("hoverCompareCartesian"); enableHover("hoverClosestGeo"); enableHover("hoverClosest3d"); enableHover("hoverClosestGl2d"); enableHover("hoverClosestPie"); } } else newList.push(b); } buttonsToAdd = newList; } addGroup(dragModeGroup); addGroup(zoomGroup.concat(resetGroup)); addGroup(enabledHoverGroup); return appendButtonsToGroups(groups, buttonsToAdd); } function areAllAxesFixed(fullLayout) { var axList = axisIds.list({ _fullLayout: fullLayout }, null, true); for (var i = 0; i < axList.length; i++) { if (!axList[i].fixedrange) { return false; } } return true; } function isSelectable(fullData) { var selectable = false; for (var i = 0; i < fullData.length; i++) { if (selectable) break; var trace = fullData[i]; if (!trace._module || !trace._module.selectPoints) continue; if (Registry.traceIs(trace, "scatter-like")) { if (scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } } else if (Registry.traceIs(trace, "box-violin")) { if (trace.boxpoints === "all" || trace.points === "all") { selectable = true; } } else { selectable = true; } } return selectable; } function hasNoHover(fullData) { for (var i = 0; i < fullData.length; i++) { if (!Registry.traceIs(fullData[i], "noHover")) return false; } return true; } function appendButtonsToGroups(groups, buttons) { if (buttons.length) { if (Array.isArray(buttons[0])) { for (var i = 0; i < buttons.length; i++) { groups.push(buttons[i]); } } else groups.push(buttons); } return groups; } function fillCustomButton(originalModeBarButtons) { var customButtons = extendDeep([], originalModeBarButtons); for (var i = 0; i < customButtons.length; i++) { var buttonGroup = customButtons[i]; for (var j = 0; j < buttonGroup.length; j++) { var button = buttonGroup[j]; if (typeof button === "string") { if (modeBarButtons[button] !== void 0) { customButtons[i][j] = modeBarButtons[button]; } else { throw new Error([ "*modeBarButtons* configuration options", "invalid button name" ].join(" ")); } } } } return customButtons; } } }); // node_modules/plotly.js/src/components/modebar/index.js var require_modebar2 = __commonJS({ "node_modules/plotly.js/src/components/modebar/index.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "component", name: "modebar", layoutAttributes: require_attributes10(), supplyLayoutDefaults: require_defaults5(), manage: require_manage() }; } }); // node_modules/plotly.js/src/plots/cartesian/scale_zoom.js var require_scale_zoom = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/scale_zoom.js"(exports2, module2) { "use strict"; var FROM_BL = require_alignment().FROM_BL; module2.exports = function scaleZoom(ax, factor, centerFraction) { if (centerFraction === void 0) { centerFraction = FROM_BL[ax.constraintoward || "center"]; } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; ax.range = ax._input.range = [ ax.l2r(center + (rangeLinear[0] - center) * factor), ax.l2r(center + (rangeLinear[1] - center) * factor) ]; ax.setScale(); }; } }); // node_modules/plotly.js/src/plots/cartesian/constraints.js var require_constraints = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/constraints.js"(exports2) { "use strict"; var Lib = require_lib(); var autorange = require_autorange(); var id2name = require_axis_ids().id2name; var layoutAttributes = require_layout_attributes4(); var scaleZoom = require_scale_zoom(); var setConvert = require_set_convert(); var ALMOST_EQUAL = require_numerical().ALMOST_EQUAL; var FROM_BL = require_alignment().FROM_BL; exports2.handleDefaults = function(layoutIn, layoutOut, opts) { var axIds = opts.axIds; var axHasImage = opts.axHasImage; var constraintGroups = layoutOut._axisConstraintGroups = []; var matchGroups = layoutOut._axisMatchGroups = []; var i, group, axId, axName, axIn, axOut, attr, val; for (i = 0; i < axIds.length; i++) { axName = id2name(axIds[i]); axIn = layoutIn[axName]; axOut = layoutOut[axName]; handleOneAxDefaults(axIn, axOut, { axIds, layoutOut, hasImage: axHasImage[axName] }); } function stash(groups, stashAttr) { for (i = 0; i < groups.length; i++) { group = groups[i]; for (axId in group) { layoutOut[id2name(axId)][stashAttr] = group; } } } stash(matchGroups, "_matchGroup"); for (i = 0; i < constraintGroups.length; i++) { group = constraintGroups[i]; for (axId in group) { axOut = layoutOut[id2name(axId)]; if (axOut.fixedrange) { for (var axId2 in group) { var axName2 = id2name(axId2); if ((layoutIn[axName2] || {}).fixedrange === false) { Lib.warn( "fixedrange was specified as false for axis " + axName2 + " but was overridden because another axis in its constraint group has fixedrange true" ); } layoutOut[axName2].fixedrange = true; } break; } } } i = 0; while (i < constraintGroups.length) { group = constraintGroups[i]; for (axId in group) { axOut = layoutOut[id2name(axId)]; if (axOut._matchGroup && Object.keys(axOut._matchGroup).length === Object.keys(group).length) { constraintGroups.splice(i, 1); i--; } break; } i++; } stash(constraintGroups, "_constraintGroup"); var matchAttrs = [ "constrain", "range", "autorange", "rangemode", "rangebreaks", "categoryorder", "categoryarray" ]; var hasRange = false; var hasDayOfWeekBreaks = false; function setAttrVal() { val = axOut[attr]; if (attr === "rangebreaks") { hasDayOfWeekBreaks = axOut._hasDayOfWeekBreaks; } } for (i = 0; i < matchGroups.length; i++) { group = matchGroups[i]; for (var j = 0; j < matchAttrs.length; j++) { attr = matchAttrs[j]; val = null; var baseAx; for (axId in group) { axName = id2name(axId); axIn = layoutIn[axName]; axOut = layoutOut[axName]; if (!(attr in axOut)) { continue; } if (!axOut.matches) { baseAx = axOut; if (attr in axIn) { setAttrVal(); break; } } if (val === null && attr in axIn) { setAttrVal(); } } if (attr === "range" && val && axIn.range && axIn.range.length === 2 && axIn.range[0] !== null && axIn.range[1] !== null) { hasRange = true; } if (attr === "autorange" && val === null && hasRange) { val = false; } if (val === null && attr in baseAx) { val = baseAx[attr]; } if (val !== null) { for (axId in group) { axOut = layoutOut[id2name(axId)]; axOut[attr] = attr === "range" ? val.slice() : val; if (attr === "rangebreaks") { axOut._hasDayOfWeekBreaks = hasDayOfWeekBreaks; setConvert(axOut, layoutOut); } } } } } }; function handleOneAxDefaults(axIn, axOut, opts) { var axIds = opts.axIds; var layoutOut = opts.layoutOut; var hasImage = opts.hasImage; var constraintGroups = layoutOut._axisConstraintGroups; var matchGroups = layoutOut._axisMatchGroups; var axId = axOut._id; var axLetter = axId.charAt(0); var splomStash = ((layoutOut._splomAxes || {})[axLetter] || {})[axId] || {}; var thisID = axOut._id; var isX = thisID.charAt(0) === "x"; axOut._matchGroup = null; axOut._constraintGroup = null; function coerce(attr, dflt) { return Lib.coerce(axIn, axOut, layoutAttributes, attr, dflt); } coerce("constrain", hasImage ? "domain" : "range"); Lib.coerce(axIn, axOut, { constraintoward: { valType: "enumerated", values: isX ? ["left", "center", "right"] : ["bottom", "middle", "top"], dflt: isX ? "center" : "middle" } }, "constraintoward"); var thisType = axOut.type; var i, idi; var linkableAxes = []; for (i = 0; i < axIds.length; i++) { idi = axIds[i]; if (idi === thisID) continue; var axi = layoutOut[id2name(idi)]; if (axi.type === thisType) { linkableAxes.push(idi); } } var thisGroup = getConstraintGroup(constraintGroups, thisID); if (thisGroup) { var linkableAxesNoLoops = []; for (i = 0; i < linkableAxes.length; i++) { idi = linkableAxes[i]; if (!thisGroup[idi]) linkableAxesNoLoops.push(idi); } linkableAxes = linkableAxesNoLoops; } var canLink = linkableAxes.length; var matches, scaleanchor; if (canLink && (axIn.matches || splomStash.matches)) { matches = Lib.coerce(axIn, axOut, { matches: { valType: "enumerated", values: linkableAxes, dflt: linkableAxes.indexOf(splomStash.matches) !== -1 ? splomStash.matches : void 0 } }, "matches"); } var scaleanchorDflt = hasImage && !isX ? axOut.anchor : void 0; if (canLink && !matches && (axIn.scaleanchor || scaleanchorDflt)) { scaleanchor = Lib.coerce(axIn, axOut, { scaleanchor: { valType: "enumerated", values: linkableAxes.concat([false]) } }, "scaleanchor", scaleanchorDflt); } if (matches) { axOut._matchGroup = updateConstraintGroups(matchGroups, thisID, matches, 1); var matchedAx = layoutOut[id2name(matches)]; var matchRatio = extent(layoutOut, axOut) / extent(layoutOut, matchedAx); if (isX !== (matches.charAt(0) === "x")) { matchRatio = (isX ? "x" : "y") + matchRatio; } updateConstraintGroups(constraintGroups, thisID, matches, matchRatio); } else if (axIn.matches && axIds.indexOf(axIn.matches) !== -1) { Lib.warn("ignored " + axOut._name + '.matches: "' + axIn.matches + '" to avoid an infinite loop'); } if (scaleanchor) { var scaleratio = coerce("scaleratio"); if (!scaleratio) scaleratio = axOut.scaleratio = 1; updateConstraintGroups(constraintGroups, thisID, scaleanchor, scaleratio); } else if (axIn.scaleanchor && axIds.indexOf(axIn.scaleanchor) !== -1) { Lib.warn("ignored " + axOut._name + '.scaleanchor: "' + axIn.scaleanchor + '" to avoid either an infinite loop and possibly inconsistent scaleratios, or because this axis declares a *matches* constraint.'); } } function extent(layoutOut, ax) { var domain = ax.domain; if (!domain) { domain = layoutOut[id2name(ax.overlaying)].domain; } return domain[1] - domain[0]; } function getConstraintGroup(groups, thisID) { for (var i = 0; i < groups.length; i++) { if (groups[i][thisID]) { return groups[i]; } } return null; } function updateConstraintGroups(constraintGroups, thisID, thatID, scaleratio) { var i, j, groupi, keyj, thisGroupIndex; var thisGroup = getConstraintGroup(constraintGroups, thisID); if (thisGroup === null) { thisGroup = {}; thisGroup[thisID] = 1; thisGroupIndex = constraintGroups.length; constraintGroups.push(thisGroup); } else { thisGroupIndex = constraintGroups.indexOf(thisGroup); } var thisGroupKeys = Object.keys(thisGroup); for (i = 0; i < constraintGroups.length; i++) { groupi = constraintGroups[i]; if (i !== thisGroupIndex && groupi[thatID]) { var baseScale = groupi[thatID]; for (j = 0; j < thisGroupKeys.length; j++) { keyj = thisGroupKeys[j]; groupi[keyj] = multiplyScales(baseScale, multiplyScales(scaleratio, thisGroup[keyj])); } constraintGroups.splice(thisGroupIndex, 1); return; } } if (scaleratio !== 1) { for (j = 0; j < thisGroupKeys.length; j++) { var key = thisGroupKeys[j]; thisGroup[key] = multiplyScales(scaleratio, thisGroup[key]); } } thisGroup[thatID] = 1; } function multiplyScales(a, b) { var aPrefix = ""; var bPrefix = ""; var aLen, bLen; if (typeof a === "string") { aPrefix = a.match(/^[xy]*/)[0]; aLen = aPrefix.length; a = +a.substr(aLen); } if (typeof b === "string") { bPrefix = b.match(/^[xy]*/)[0]; bLen = bPrefix.length; b = +b.substr(bLen); } var c = a * b; if (!aLen && !bLen) { return c; } if (!aLen || !bLen || aPrefix.charAt(0) === bPrefix.charAt(0)) { return aPrefix + bPrefix + a * b; } if (aLen === bLen) { return c; } return (aLen > bLen ? aPrefix.substr(bLen) : bPrefix.substr(aLen)) + c; } function finalRatios(group, fullLayout) { var size = fullLayout._size; var yRatio = size.h / size.w; var out = {}; var keys = Object.keys(group); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var val = group[key]; if (typeof val === "string") { var prefix = val.match(/^[xy]*/)[0]; var pLen = prefix.length; val = +val.substr(pLen); var mult = prefix.charAt(0) === "y" ? yRatio : 1 / yRatio; for (var j = 0; j < pLen; j++) { val *= mult; } } out[key] = val; } return out; } exports2.enforce = function enforce(gd2) { var fullLayout = gd2._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups || []; var i, j, group, axisID, ax, normScale, mode, factor; for (i = 0; i < constraintGroups.length; i++) { group = finalRatios(constraintGroups[i], fullLayout); var axisIDs = Object.keys(group); var minScale = Infinity; var maxScale = 0; var matchScale = Infinity; var normScales = {}; var axes = {}; var hasAnyDomainConstraint = false; for (j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; if (ax._inputDomain) ax.domain = ax._inputDomain.slice(); else ax._inputDomain = ax.domain.slice(); if (!ax._inputRange) ax._inputRange = ax.range.slice(); ax.setScale(); normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); if (ax.constrain === "domain" || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); if (ax.constrain === "domain") hasAnyDomainConstraint = true; } if (minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; for (j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; ax = axes[axisID]; mode = ax.constrain; if (normScale !== matchScale || mode === "domain") { factor = normScale / matchScale; if (mode === "range") { scaleZoom(ax, factor); } else { var inputDomain = ax._inputDomain; var domainShrunk = (ax.domain[1] - ax.domain[0]) / (inputDomain[1] - inputDomain[0]); var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); factor /= domainShrunk; if (factor * rangeShrunk < 1) { ax.domain = ax._input.domain = inputDomain.slice(); scaleZoom(ax, factor); continue; } if (rangeShrunk < 1) { ax.range = ax._input.range = ax._inputRange.slice(); factor *= rangeShrunk; } if (ax.autorange) { var rl0 = ax.r2l(ax.range[0]); var rl1 = ax.r2l(ax.range[1]); var rangeCenter = (rl0 + rl1) / 2; var rangeMin = rangeCenter; var rangeMax = rangeCenter; var halfRange = Math.abs(rl1 - rangeCenter); var outerMin = rangeCenter - halfRange * factor * 1.0001; var outerMax = rangeCenter + halfRange * factor * 1.0001; var getPadMin = autorange.makePadFn(fullLayout, ax, 0); var getPadMax = autorange.makePadFn(fullLayout, ax, 1); updateDomain(ax, factor); var m = Math.abs(ax._m); var extremes = autorange.concatExtremes(gd2, ax); var minArray = extremes.min; var maxArray = extremes.max; var newVal; var k; for (k = 0; k < minArray.length; k++) { newVal = minArray[k].val - getPadMin(minArray[k]) / m; if (newVal > outerMin && newVal < rangeMin) { rangeMin = newVal; } } for (k = 0; k < maxArray.length; k++) { newVal = maxArray[k].val + getPadMax(maxArray[k]) / m; if (newVal < outerMax && newVal > rangeMax) { rangeMax = newVal; } } var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); factor /= domainExpand; rangeMin = ax.l2r(rangeMin); rangeMax = ax.l2r(rangeMax); ax.range = ax._input.range = rl0 < rl1 ? [rangeMin, rangeMax] : [rangeMax, rangeMin]; } updateDomain(ax, factor); } } } } }; exports2.getAxisGroup = function getAxisGroup(fullLayout, axId) { var matchGroups = fullLayout._axisMatchGroups; for (var i = 0; i < matchGroups.length; i++) { var group = matchGroups[i]; if (group[axId]) return "g" + i; } return axId; }; exports2.clean = function clean(gd2, ax) { if (ax._inputDomain) { var isConstrained = false; var axId = ax._id; var constraintGroups = gd2._fullLayout._axisConstraintGroups; for (var j = 0; j < constraintGroups.length; j++) { if (constraintGroups[j][axId]) { isConstrained = true; break; } } if (!isConstrained || ax.constrain !== "domain") { ax._input.domain = ax.domain = ax._inputDomain; delete ax._inputDomain; } } }; function updateDomain(ax, factor) { var inputDomain = ax._inputDomain; var centerFraction = FROM_BL[ax.constraintoward]; var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; ax.domain = ax._input.domain = [ center + (inputDomain[0] - center) / factor, center + (inputDomain[1] - center) / factor ]; ax.setScale(); } } }); // node_modules/plotly.js/src/plot_api/subroutines.js var require_subroutines = __commonJS({ "node_modules/plotly.js/src/plot_api/subroutines.js"(exports2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Plots = require_plots(); var Lib = require_lib(); var svgTextUtils = require_svg_text_utils(); var clearGlCanvases = require_clear_gl_canvases(); var Color = require_color(); var Drawing = require_drawing(); var Titles = require_titles(); var ModeBar = require_modebar2(); var Axes = require_axes(); var alignmentConstants = require_alignment(); var axisConstraints = require_constraints(); var enforceAxisConstraints = axisConstraints.enforce; var cleanAxisConstraints = axisConstraints.clean; var doAutoRange = require_autorange().doAutoRange; var SVG_TEXT_ANCHOR_START = "start"; var SVG_TEXT_ANCHOR_MIDDLE = "middle"; var SVG_TEXT_ANCHOR_END = "end"; var zindexSeparator = require_constants2().zindexSeparator; exports2.layoutStyles = function(gd2) { return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd2); }; function overlappingDomain(xDomain, yDomain, domains) { for (var i = 0; i < domains.length; i++) { var existingX = domains[i][0]; var existingY = domains[i][1]; if (existingX[0] >= xDomain[1] || existingX[1] <= xDomain[0]) { continue; } if (existingY[0] < yDomain[1] && existingY[1] > yDomain[0]) { return true; } } return false; } function lsInner(gd2) { var fullLayout = gd2._fullLayout; var gs2 = fullLayout._size; var pad2 = gs2.p; var axList = Axes.list(gd2, "", true); var i, subplot, plotinfo, ax, xa2, ya2; fullLayout._paperdiv.style({ width: gd2._context.responsive && fullLayout.autosize && !gd2._context._hasZeroWidth && !gd2.layout.width ? "100%" : fullLayout.width + "px", height: gd2._context.responsive && fullLayout.autosize && !gd2._context._hasZeroHeight && !gd2.layout.height ? "100%" : fullLayout.height + "px" }).selectAll(".main-svg").call(Drawing.setSize, fullLayout.width, fullLayout.height); gd2._context.setBackground(gd2, fullLayout.paper_bgcolor); exports2.drawMainTitle(gd2); ModeBar.manage(gd2); if (!fullLayout._has("cartesian")) { return Plots.previousPromises(gd2); } function getLinePosition(ax2, counterAx2, side) { var lwHalf = ax2._lw / 2; if (ax2._id.charAt(0) === "x") { if (!counterAx2) return gs2.t + gs2.h * (1 - (ax2.position || 0)) + lwHalf % 1; else if (side === "top") return counterAx2._offset - pad2 - lwHalf; return counterAx2._offset + counterAx2._length + pad2 + lwHalf; } if (!counterAx2) return gs2.l + gs2.w * (ax2.position || 0) + lwHalf % 1; else if (side === "right") return counterAx2._offset + counterAx2._length + pad2 + lwHalf; return counterAx2._offset - pad2 - lwHalf; } for (i = 0; i < axList.length; i++) { ax = axList[i]; var counterAx = ax._anchorAxis; ax._linepositions = {}; ax._lw = Drawing.crispRound(gd2, ax.linewidth, 1); ax._mainLinePosition = getLinePosition(ax, counterAx, ax.side); ax._mainMirrorPosition = ax.mirror && counterAx ? getLinePosition( ax, counterAx, alignmentConstants.OPPOSITE_SIDE[ax.side] ) : null; } var lowerBackgroundIDs = []; var backgroundIds = []; var lowerDomains = []; var noNeedForBg = Color.opacity(fullLayout.paper_bgcolor) === 1 && Color.opacity(fullLayout.plot_bgcolor) === 1 && fullLayout.paper_bgcolor === fullLayout.plot_bgcolor; for (subplot in fullLayout._plots) { plotinfo = fullLayout._plots[subplot]; if (plotinfo.mainplot) { if (plotinfo.bg) { plotinfo.bg.remove(); } plotinfo.bg = void 0; } else { var xDomain = plotinfo.xaxis.domain; var yDomain = plotinfo.yaxis.domain; var plotgroup = plotinfo.plotgroup; if (overlappingDomain(xDomain, yDomain, lowerDomains) && subplot.indexOf(zindexSeparator) === -1) { var pgNode = plotgroup.node(); var plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, "rect", "bg"); pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]); backgroundIds.push(subplot); } else { plotgroup.select("rect.bg").remove(); lowerDomains.push([xDomain, yDomain]); if (!noNeedForBg) { lowerBackgroundIDs.push(subplot); backgroundIds.push(subplot); } } } } var lowerBackgrounds = fullLayout._bgLayer.selectAll(".bg").data(lowerBackgroundIDs); lowerBackgrounds.enter().append("rect").classed("bg", true); lowerBackgrounds.exit().remove(); lowerBackgrounds.each(function(subplot2) { fullLayout._plots[subplot2].bg = d3.select(this); }); for (i = 0; i < backgroundIds.length; i++) { plotinfo = fullLayout._plots[backgroundIds[i]]; xa2 = plotinfo.xaxis; ya2 = plotinfo.yaxis; if (plotinfo.bg && xa2._offset !== void 0 && ya2._offset !== void 0) { plotinfo.bg.call( Drawing.setRect, xa2._offset - pad2, ya2._offset - pad2, xa2._length + 2 * pad2, ya2._length + 2 * pad2 ).call(Color.fill, fullLayout.plot_bgcolor).style("stroke-width", 0); } } if (!fullLayout._hasOnlyLargeSploms) { for (subplot in fullLayout._plots) { plotinfo = fullLayout._plots[subplot]; xa2 = plotinfo.xaxis; ya2 = plotinfo.yaxis; var clipId = plotinfo.clipId = "clip" + fullLayout._uid + subplot + "plot"; var plotClip = Lib.ensureSingleById(fullLayout._clips, "clipPath", clipId, function(s) { s.classed("plotclip", true).append("rect"); }); plotinfo.clipRect = plotClip.select("rect").attr({ width: xa2._length, height: ya2._length }); Drawing.setTranslate(plotinfo.plot, xa2._offset, ya2._offset); var plotClipId; var layerClipId; if (plotinfo._hasClipOnAxisFalse) { plotClipId = null; layerClipId = clipId; } else { plotClipId = clipId; layerClipId = null; } Drawing.setClipUrl(plotinfo.plot, plotClipId, gd2); plotinfo.layerClipId = layerClipId; } } var xLinesXLeft, xLinesXRight, xLinesYBottom, xLinesYTop, leftYLineWidth, rightYLineWidth; var yLinesYBottom, yLinesYTop, yLinesXLeft, yLinesXRight, connectYBottom, connectYTop; var extraSubplot; function xLinePath(y) { return "M" + xLinesXLeft + "," + y + "H" + xLinesXRight; } function xLinePathFree(y) { return "M" + xa2._offset + "," + y + "h" + xa2._length; } function yLinePath(x) { return "M" + x + "," + yLinesYTop + "V" + yLinesYBottom; } function yLinePathFree(x) { if (ya2._shift !== void 0) { x += ya2._shift; } return "M" + x + "," + ya2._offset + "v" + ya2._length; } function mainPath(ax2, pathFn, pathFnFree) { if (!ax2.showline || subplot !== ax2._mainSubplot) return ""; if (!ax2._anchorAxis) return pathFnFree(ax2._mainLinePosition); var out = pathFn(ax2._mainLinePosition); if (ax2.mirror) out += pathFn(ax2._mainMirrorPosition); return out; } for (subplot in fullLayout._plots) { plotinfo = fullLayout._plots[subplot]; xa2 = plotinfo.xaxis; ya2 = plotinfo.yaxis; var xPath = "M0,0"; if (shouldShowLinesOrTicks(xa2, subplot)) { leftYLineWidth = findCounterAxisLineWidth(xa2, "left", ya2, axList); xLinesXLeft = xa2._offset - (leftYLineWidth ? pad2 + leftYLineWidth : 0); rightYLineWidth = findCounterAxisLineWidth(xa2, "right", ya2, axList); xLinesXRight = xa2._offset + xa2._length + (rightYLineWidth ? pad2 + rightYLineWidth : 0); xLinesYBottom = getLinePosition(xa2, ya2, "bottom"); xLinesYTop = getLinePosition(xa2, ya2, "top"); extraSubplot = !xa2._anchorAxis || subplot !== xa2._mainSubplot; if (extraSubplot && (xa2.mirror === "allticks" || xa2.mirror === "all")) { xa2._linepositions[subplot] = [xLinesYBottom, xLinesYTop]; } xPath = mainPath(xa2, xLinePath, xLinePathFree); if (extraSubplot && xa2.showline && (xa2.mirror === "all" || xa2.mirror === "allticks")) { xPath += xLinePath(xLinesYBottom) + xLinePath(xLinesYTop); } plotinfo.xlines.style("stroke-width", xa2._lw + "px").call(Color.stroke, xa2.showline ? xa2.linecolor : "rgba(0,0,0,0)"); } plotinfo.xlines.attr("d", xPath); var yPath = "M0,0"; if (shouldShowLinesOrTicks(ya2, subplot)) { connectYBottom = findCounterAxisLineWidth(ya2, "bottom", xa2, axList); yLinesYBottom = ya2._offset + ya2._length + (connectYBottom ? pad2 : 0); connectYTop = findCounterAxisLineWidth(ya2, "top", xa2, axList); yLinesYTop = ya2._offset - (connectYTop ? pad2 : 0); yLinesXLeft = getLinePosition(ya2, xa2, "left"); yLinesXRight = getLinePosition(ya2, xa2, "right"); extraSubplot = !ya2._anchorAxis || subplot !== ya2._mainSubplot; if (extraSubplot && (ya2.mirror === "allticks" || ya2.mirror === "all")) { ya2._linepositions[subplot] = [yLinesXLeft, yLinesXRight]; } yPath = mainPath(ya2, yLinePath, yLinePathFree); if (extraSubplot && ya2.showline && (ya2.mirror === "all" || ya2.mirror === "allticks")) { yPath += yLinePath(yLinesXLeft) + yLinePath(yLinesXRight); } plotinfo.ylines.style("stroke-width", ya2._lw + "px").call(Color.stroke, ya2.showline ? ya2.linecolor : "rgba(0,0,0,0)"); } plotinfo.ylines.attr("d", yPath); } Axes.makeClipPaths(gd2); return Plots.previousPromises(gd2); } function shouldShowLinesOrTicks(ax, subplot) { return (ax.ticks || ax.showline) && (subplot === ax._mainSubplot || ax.mirror === "all" || ax.mirror === "allticks"); } function shouldShowLineThisSide(ax, side, counterAx) { if (!counterAx.showline || !counterAx._lw) return false; if (counterAx.mirror === "all" || counterAx.mirror === "allticks") return true; var anchorAx = counterAx._anchorAxis; if (!anchorAx) return false; var sideIndex = alignmentConstants.FROM_BL[side]; if (counterAx.side === side) { return anchorAx.domain[sideIndex] === ax.domain[sideIndex]; } return counterAx.mirror && anchorAx.domain[1 - sideIndex] === ax.domain[1 - sideIndex]; } function findCounterAxisLineWidth(ax, side, counterAx, axList) { if (shouldShowLineThisSide(ax, side, counterAx)) { return counterAx._lw; } for (var i = 0; i < axList.length; i++) { var axi = axList[i]; if (axi._mainAxis === counterAx._mainAxis && shouldShowLineThisSide(ax, side, axi)) { return axi._lw; } } return 0; } exports2.drawMainTitle = function(gd2) { var title = gd2._fullLayout.title; var fullLayout = gd2._fullLayout; var textAnchor = getMainTitleTextAnchor(fullLayout); var dy = getMainTitleDy(fullLayout); var y = getMainTitleY(fullLayout, dy); var x = getMainTitleX(fullLayout, textAnchor); Titles.draw(gd2, "gtitle", { propContainer: fullLayout, propName: "title.text", subtitlePropName: "title.subtitle.text", placeholder: fullLayout._dfltTitle.plot, subtitlePlaceholder: fullLayout._dfltTitle.subtitle, attributes: { x, y, "text-anchor": textAnchor, dy } }); if (title.text && title.automargin) { var titleObj = d3.selectAll(".gtitle"); var titleHeight = Drawing.bBox(d3.selectAll(".g-gtitle").node()).height; var pushMargin = needsMarginPush(gd2, title, titleHeight); if (pushMargin > 0) { applyTitleAutoMargin(gd2, y, pushMargin, titleHeight); titleObj.attr({ x, y, "text-anchor": textAnchor, dy: getMainTitleDyAdj(title.yanchor) }).call(svgTextUtils.positionText, x, y); var extraLines = (title.text.match(svgTextUtils.BR_TAG_ALL) || []).length; if (extraLines) { var delta = alignmentConstants.LINE_SPACING * extraLines + alignmentConstants.MID_SHIFT; if (title.y === 0) { delta = -delta; } titleObj.selectAll(".line").each(function() { var newDy = +this.getAttribute("dy").slice(0, -2) - delta + "em"; this.setAttribute("dy", newDy); }); } var subtitleObj = d3.selectAll(".gtitle-subtitle"); if (subtitleObj.node()) { var titleBB = titleObj.node().getBBox(); var titleBottom = titleBB.y + titleBB.height; var subtitleY = titleBottom + Titles.SUBTITLE_PADDING_EM * title.subtitle.font.size; subtitleObj.attr({ x, y: subtitleY, "text-anchor": textAnchor, dy: getMainTitleDyAdj(title.yanchor) }).call(svgTextUtils.positionText, x, subtitleY); } } } }; function isOutsideContainer(gd2, title, position, y, titleHeight) { var plotHeight = title.yref === "paper" ? gd2._fullLayout._size.h : gd2._fullLayout.height; var yPosTop = Lib.isTopAnchor(title) ? y : y - titleHeight; var yPosRel = position === "b" ? plotHeight - yPosTop : yPosTop; if (Lib.isTopAnchor(title) && position === "t" || Lib.isBottomAnchor(title) && position === "b") { return false; } else { return yPosRel < titleHeight; } } function containerPushVal(position, titleY, titleYanchor, height, titleDepth) { var push = 0; if (titleYanchor === "middle") { push += titleDepth / 2; } if (position === "t") { if (titleYanchor === "top") { push += titleDepth; } push += height - titleY * height; } else { if (titleYanchor === "bottom") { push += titleDepth; } push += titleY * height; } return push; } function needsMarginPush(gd2, title, titleHeight) { var titleY = title.y; var titleYanchor = title.yanchor; var position = titleY > 0.5 ? "t" : "b"; var curMargin = gd2._fullLayout.margin[position]; var pushMargin = 0; if (title.yref === "paper") { pushMargin = titleHeight + title.pad.t + title.pad.b; } else if (title.yref === "container") { pushMargin = containerPushVal(position, titleY, titleYanchor, gd2._fullLayout.height, titleHeight) + title.pad.t + title.pad.b; } if (pushMargin > curMargin) { return pushMargin; } return 0; } function applyTitleAutoMargin(gd2, y, pushMargin, titleHeight) { var titleID = "title.automargin"; var title = gd2._fullLayout.title; var position = title.y > 0.5 ? "t" : "b"; var push = { x: title.x, y: title.y, t: 0, b: 0 }; var reservedPush = {}; if (title.yref === "paper" && isOutsideContainer(gd2, title, position, y, titleHeight)) { push[position] = pushMargin; } else if (title.yref === "container") { reservedPush[position] = pushMargin; gd2._fullLayout._reservedMargin[titleID] = reservedPush; } Plots.allowAutoMargin(gd2, titleID); Plots.autoMargin(gd2, titleID, push); } function getMainTitleX(fullLayout, textAnchor) { var title = fullLayout.title; var gs2 = fullLayout._size; var hPadShift = 0; if (textAnchor === SVG_TEXT_ANCHOR_START) { hPadShift = title.pad.l; } else if (textAnchor === SVG_TEXT_ANCHOR_END) { hPadShift = -title.pad.r; } switch (title.xref) { case "paper": return gs2.l + gs2.w * title.x + hPadShift; case "container": default: return fullLayout.width * title.x + hPadShift; } } function getMainTitleY(fullLayout, dy) { var title = fullLayout.title; var gs2 = fullLayout._size; var vPadShift = 0; if (dy === "0em" || !dy) { vPadShift = -title.pad.b; } else if (dy === alignmentConstants.CAP_SHIFT + "em") { vPadShift = title.pad.t; } if (title.y === "auto") { return gs2.t / 2; } else { switch (title.yref) { case "paper": return gs2.t + gs2.h - gs2.h * title.y + vPadShift; case "container": default: return fullLayout.height - fullLayout.height * title.y + vPadShift; } } } function getMainTitleDyAdj(yanchor) { if (yanchor === "top") { return alignmentConstants.CAP_SHIFT + 0.3 + "em"; } else if (yanchor === "bottom") { return "-0.3em"; } else { return alignmentConstants.MID_SHIFT + "em"; } } function getMainTitleTextAnchor(fullLayout) { var title = fullLayout.title; var textAnchor = SVG_TEXT_ANCHOR_MIDDLE; if (Lib.isRightAnchor(title)) { textAnchor = SVG_TEXT_ANCHOR_END; } else if (Lib.isLeftAnchor(title)) { textAnchor = SVG_TEXT_ANCHOR_START; } return textAnchor; } function getMainTitleDy(fullLayout) { var title = fullLayout.title; var dy = "0em"; if (Lib.isTopAnchor(title)) { dy = alignmentConstants.CAP_SHIFT + "em"; } else if (Lib.isMiddleAnchor(title)) { dy = alignmentConstants.MID_SHIFT + "em"; } return dy; } exports2.doTraceStyle = function(gd2) { var calcdata = gd2.calcdata; var editStyleCalls = []; var i; for (i = 0; i < calcdata.length; i++) { var cd2 = calcdata[i]; var cd0 = cd2[0] || {}; var trace = cd0.trace || {}; var _module = trace._module || {}; var arraysToCalcdata = _module.arraysToCalcdata; if (arraysToCalcdata) arraysToCalcdata(cd2, trace); var editStyle = _module.editStyle; if (editStyle) editStyleCalls.push({ fn: editStyle, cd0 }); } if (editStyleCalls.length) { for (i = 0; i < editStyleCalls.length; i++) { var edit = editStyleCalls[i]; edit.fn(gd2, edit.cd0); } clearGlCanvases(gd2); exports2.redrawReglTraces(gd2); } Plots.style(gd2); Registry.getComponentMethod("legend", "draw")(gd2); return Plots.previousPromises(gd2); }; exports2.doColorBars = function(gd2) { Registry.getComponentMethod("colorbar", "draw")(gd2); return Plots.previousPromises(gd2); }; exports2.layoutReplot = function(gd2) { var layout = gd2.layout; gd2.layout = void 0; return Registry.call("_doPlot", gd2, "", layout); }; exports2.doLegend = function(gd2) { Registry.getComponentMethod("legend", "draw")(gd2); return Plots.previousPromises(gd2); }; exports2.doTicksRelayout = function(gd2) { Axes.draw(gd2, "redraw"); if (gd2._fullLayout._hasOnlyLargeSploms) { Registry.subplotsRegistry.splom.updateGrid(gd2); clearGlCanvases(gd2); exports2.redrawReglTraces(gd2); } exports2.drawMainTitle(gd2); return Plots.previousPromises(gd2); }; exports2.doModeBar = function(gd2) { var fullLayout = gd2._fullLayout; ModeBar.manage(gd2); for (var i = 0; i < fullLayout._basePlotModules.length; i++) { var updateFx = fullLayout._basePlotModules[i].updateFx; if (updateFx) updateFx(gd2); } return Plots.previousPromises(gd2); }; exports2.doCamera = function(gd2) { var fullLayout = gd2._fullLayout; var sceneIds = fullLayout._subplots.gl3d; for (var i = 0; i < sceneIds.length; i++) { var sceneLayout = fullLayout[sceneIds[i]]; var scene = sceneLayout._scene; scene.setViewport(sceneLayout); } }; exports2.drawData = function(gd2) { var fullLayout = gd2._fullLayout; clearGlCanvases(gd2); var basePlotModules = fullLayout._basePlotModules; for (var i = 0; i < basePlotModules.length; i++) { basePlotModules[i].plot(gd2); } exports2.redrawReglTraces(gd2); Plots.style(gd2); Registry.getComponentMethod("selections", "draw")(gd2); Registry.getComponentMethod("shapes", "draw")(gd2); Registry.getComponentMethod("annotations", "draw")(gd2); Registry.getComponentMethod("images", "draw")(gd2); fullLayout._replotting = false; return Plots.previousPromises(gd2); }; exports2.redrawReglTraces = function(gd2) { var fullLayout = gd2._fullLayout; if (fullLayout._has("regl")) { var fullData = gd2._fullData; var cartesianIds = []; var polarIds = []; var i, sp2; if (fullLayout._hasOnlyLargeSploms) { fullLayout._splomGrid.draw(); } for (i = 0; i < fullData.length; i++) { var trace = fullData[i]; if (trace.visible === true && trace._length !== 0) { if (trace.type === "splom") { fullLayout._splomScenes[trace.uid].draw(); } else if (trace.type === "scattergl") { Lib.pushUnique(cartesianIds, trace.xaxis + trace.yaxis); } else if (trace.type === "scatterpolargl") { Lib.pushUnique(polarIds, trace.subplot); } } } for (i = 0; i < cartesianIds.length; i++) { sp2 = fullLayout._plots[cartesianIds[i]]; if (sp2._scene) sp2._scene.draw(); } for (i = 0; i < polarIds.length; i++) { sp2 = fullLayout[polarIds[i]]._subplot; if (sp2._scene) sp2._scene.draw(); } } }; exports2.doAutoRangeAndConstraints = function(gd2) { var axList = Axes.list(gd2, "", true); var ax; var autoRangeDone = {}; for (var i = 0; i < axList.length; i++) { ax = axList[i]; if (!autoRangeDone[ax._id]) { autoRangeDone[ax._id] = 1; cleanAxisConstraints(gd2, ax); doAutoRange(gd2, ax); var matchGroup = ax._matchGroup; if (matchGroup) { for (var id2 in matchGroup) { var ax2 = Axes.getFromId(gd2, id2); doAutoRange(gd2, ax2, ax.range); autoRangeDone[id2] = 1; } } } } enforceAxisConstraints(gd2); }; exports2.finalDraw = function(gd2) { Registry.getComponentMethod("rangeslider", "draw")(gd2); Registry.getComponentMethod("rangeselector", "draw")(gd2); }; exports2.drawMarginPushers = function(gd2) { Registry.getComponentMethod("legend", "draw")(gd2); Registry.getComponentMethod("rangeselector", "draw")(gd2); Registry.getComponentMethod("sliders", "draw")(gd2); Registry.getComponentMethod("updatemenus", "draw")(gd2); Registry.getComponentMethod("colorbar", "draw")(gd2); }; } }); // node_modules/plotly.js/src/components/selections/draw.js var require_draw3 = __commonJS({ "node_modules/plotly.js/src/components/selections/draw.js"(exports2, module2) { "use strict"; var readPaths = require_helpers7().readPaths; var displayOutlines = require_display_outlines(); var clearOutlineControllers = require_handle_outline().clearOutlineControllers; var Color = require_color(); var Drawing = require_drawing(); var arrayEditor = require_plot_template().arrayEditor; var helpers = require_helpers8(); var getPathString = helpers.getPathString; module2.exports = { draw, drawOne, activateLastSelection }; function draw(gd2) { var fullLayout = gd2._fullLayout; clearOutlineControllers(gd2); fullLayout._selectionLayer.selectAll("path").remove(); for (var k in fullLayout._plots) { var selectionLayer = fullLayout._plots[k].selectionLayer; if (selectionLayer) selectionLayer.selectAll("path").remove(); } for (var i = 0; i < fullLayout.selections.length; i++) { drawOne(gd2, i); } } function couldHaveActiveSelection(gd2) { return gd2._context.editSelection; } function drawOne(gd2, index) { gd2._fullLayout._paperdiv.selectAll('.selectionlayer [data-index="' + index + '"]').remove(); var o = helpers.makeSelectionsOptionsAndPlotinfo(gd2, index); var options = o.options; var plotinfo = o.plotinfo; if (!options._input) return; drawSelection(gd2._fullLayout._selectionLayer); function drawSelection(selectionLayer) { var d = getPathString(gd2, options); var attrs = { "data-index": index, "fill-rule": "evenodd", d }; var opacity = options.opacity; var fillColor = "rgba(0,0,0,0)"; var lineColor = options.line.color || Color.contrast(gd2._fullLayout.plot_bgcolor); var lineWidth = options.line.width; var lineDash = options.line.dash; if (!lineWidth) { lineWidth = 5; lineDash = "solid"; } var isActiveSelection = couldHaveActiveSelection(gd2) && gd2._fullLayout._activeSelectionIndex === index; if (isActiveSelection) { fillColor = gd2._fullLayout.activeselection.fillcolor; opacity = gd2._fullLayout.activeselection.opacity; } var allPaths = []; for (var sensory = 1; sensory >= 0; sensory--) { var path = selectionLayer.append("path").attr(attrs).style("opacity", sensory ? 0.1 : opacity).call(Color.stroke, lineColor).call(Color.fill, fillColor).call( Drawing.dashLine, sensory ? "solid" : lineDash, sensory ? 4 + lineWidth : lineWidth ); setClipPath(path, gd2, options); if (isActiveSelection) { var editHelpers = arrayEditor(gd2.layout, "selections", options); path.style({ cursor: "move" }); var dragOptions = { element: path.node(), plotinfo, gd: gd2, editHelpers, isActiveSelection: true // i.e. to enable controllers }; var polygons = readPaths(d, gd2); displayOutlines(polygons, path, dragOptions); } else { path.style("pointer-events", sensory ? "all" : "none"); } allPaths[sensory] = path; } var forePath = allPaths[0]; var backPath = allPaths[1]; backPath.node().addEventListener("click", function() { return activateSelection(gd2, forePath); }); } } function setClipPath(selectionPath, gd2, selectionOptions) { var clipAxes = selectionOptions.xref + selectionOptions.yref; Drawing.setClipUrl( selectionPath, "clip" + gd2._fullLayout._uid + clipAxes, gd2 ); } function activateSelection(gd2, path) { if (!couldHaveActiveSelection(gd2)) return; var element = path.node(); var id2 = +element.getAttribute("data-index"); if (id2 >= 0) { if (id2 === gd2._fullLayout._activeSelectionIndex) { deactivateSelection(gd2); return; } gd2._fullLayout._activeSelectionIndex = id2; gd2._fullLayout._deactivateSelection = deactivateSelection; draw(gd2); } } function activateLastSelection(gd2) { if (!couldHaveActiveSelection(gd2)) return; var id2 = gd2._fullLayout.selections.length - 1; gd2._fullLayout._activeSelectionIndex = id2; gd2._fullLayout._deactivateSelection = deactivateSelection; draw(gd2); } function deactivateSelection(gd2) { if (!couldHaveActiveSelection(gd2)) return; var id2 = gd2._fullLayout._activeSelectionIndex; if (id2 >= 0) { clearOutlineControllers(gd2); delete gd2._fullLayout._activeSelectionIndex; draw(gd2); } } } }); // node_modules/polybooljs/lib/build-log.js var require_build_log = __commonJS({ "node_modules/polybooljs/lib/build-log.js"(exports2, module2) { function BuildLog() { var my; var nextSegmentId = 0; var curVert = false; function push(type, data) { my.list.push({ type, data: data ? JSON.parse(JSON.stringify(data)) : void 0 }); return my; } my = { list: [], segmentId: function() { return nextSegmentId++; }, checkIntersection: function(seg1, seg2) { return push("check", { seg1, seg2 }); }, segmentChop: function(seg, end) { push("div_seg", { seg, pt: end }); return push("chop", { seg, pt: end }); }, statusRemove: function(seg) { return push("pop_seg", { seg }); }, segmentUpdate: function(seg) { return push("seg_update", { seg }); }, segmentNew: function(seg, primary) { return push("new_seg", { seg, primary }); }, segmentRemove: function(seg) { return push("rem_seg", { seg }); }, tempStatus: function(seg, above, below) { return push("temp_status", { seg, above, below }); }, rewind: function(seg) { return push("rewind", { seg }); }, status: function(seg, above, below) { return push("status", { seg, above, below }); }, vert: function(x) { if (x === curVert) return my; curVert = x; return push("vert", { x }); }, log: function(data) { if (typeof data !== "string") data = JSON.stringify(data, false, " "); return push("log", { txt: data }); }, reset: function() { return push("reset"); }, selected: function(segs) { return push("selected", { segs }); }, chainStart: function(seg) { return push("chain_start", { seg }); }, chainRemoveHead: function(index, pt2) { return push("chain_rem_head", { index, pt: pt2 }); }, chainRemoveTail: function(index, pt2) { return push("chain_rem_tail", { index, pt: pt2 }); }, chainNew: function(pt1, pt2) { return push("chain_new", { pt1, pt2 }); }, chainMatch: function(index) { return push("chain_match", { index }); }, chainClose: function(index) { return push("chain_close", { index }); }, chainAddHead: function(index, pt2) { return push("chain_add_head", { index, pt: pt2 }); }, chainAddTail: function(index, pt2) { return push("chain_add_tail", { index, pt: pt2 }); }, chainConnect: function(index1, index2) { return push("chain_con", { index1, index2 }); }, chainReverse: function(index) { return push("chain_rev", { index }); }, chainJoin: function(index1, index2) { return push("chain_join", { index1, index2 }); }, done: function() { return push("done"); } }; return my; } module2.exports = BuildLog; } }); // node_modules/polybooljs/lib/epsilon.js var require_epsilon = __commonJS({ "node_modules/polybooljs/lib/epsilon.js"(exports2, module2) { function Epsilon(eps) { if (typeof eps !== "number") eps = 1e-10; var my = { epsilon: function(v) { if (typeof v === "number") eps = v; return eps; }, pointAboveOrOnLine: function(pt2, left, right) { var Ax = left[0]; var Ay = left[1]; var Bx = right[0]; var By = right[1]; var Cx = pt2[0]; var Cy = pt2[1]; return (Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax) >= -eps; }, pointBetween: function(p, left, right) { var d_py_ly = p[1] - left[1]; var d_rx_lx = right[0] - left[0]; var d_px_lx = p[0] - left[0]; var d_ry_ly = right[1] - left[1]; var dot = d_px_lx * d_rx_lx + d_py_ly * d_ry_ly; if (dot < eps) return false; var sqlen = d_rx_lx * d_rx_lx + d_ry_ly * d_ry_ly; if (dot - sqlen > -eps) return false; return true; }, pointsSameX: function(p12, p2) { return Math.abs(p12[0] - p2[0]) < eps; }, pointsSameY: function(p12, p2) { return Math.abs(p12[1] - p2[1]) < eps; }, pointsSame: function(p12, p2) { return my.pointsSameX(p12, p2) && my.pointsSameY(p12, p2); }, pointsCompare: function(p12, p2) { if (my.pointsSameX(p12, p2)) return my.pointsSameY(p12, p2) ? 0 : p12[1] < p2[1] ? -1 : 1; return p12[0] < p2[0] ? -1 : 1; }, pointsCollinear: function(pt1, pt2, pt3) { var dx1 = pt1[0] - pt2[0]; var dy1 = pt1[1] - pt2[1]; var dx2 = pt2[0] - pt3[0]; var dy2 = pt2[1] - pt3[1]; return Math.abs(dx1 * dy2 - dx2 * dy1) < eps; }, linesIntersect: function(a02, a12, b02, b12) { var adx = a12[0] - a02[0]; var ady = a12[1] - a02[1]; var bdx = b12[0] - b02[0]; var bdy = b12[1] - b02[1]; var axb = adx * bdy - ady * bdx; if (Math.abs(axb) < eps) return false; var dx = a02[0] - b02[0]; var dy = a02[1] - b02[1]; var A = (bdx * dy - bdy * dx) / axb; var B = (adx * dy - ady * dx) / axb; var ret = { alongA: 0, alongB: 0, pt: [ a02[0] + A * adx, a02[1] + A * ady ] }; if (A <= -eps) ret.alongA = -2; else if (A < eps) ret.alongA = -1; else if (A - 1 <= -eps) ret.alongA = 0; else if (A - 1 < eps) ret.alongA = 1; else ret.alongA = 2; if (B <= -eps) ret.alongB = -2; else if (B < eps) ret.alongB = -1; else if (B - 1 <= -eps) ret.alongB = 0; else if (B - 1 < eps) ret.alongB = 1; else ret.alongB = 2; return ret; }, pointInsideRegion: function(pt2, region) { var x = pt2[0]; var y = pt2[1]; var last_x = region[region.length - 1][0]; var last_y = region[region.length - 1][1]; var inside = false; for (var i = 0; i < region.length; i++) { var curr_x = region[i][0]; var curr_y = region[i][1]; if (curr_y - y > eps != last_y - y > eps && (last_x - curr_x) * (y - curr_y) / (last_y - curr_y) + curr_x - x > eps) inside = !inside; last_x = curr_x; last_y = curr_y; } return inside; } }; return my; } module2.exports = Epsilon; } }); // node_modules/polybooljs/lib/linked-list.js var require_linked_list = __commonJS({ "node_modules/polybooljs/lib/linked-list.js"(exports2, module2) { var LinkedList = { create: function() { var my = { root: { root: true, next: null }, exists: function(node) { if (node === null || node === my.root) return false; return true; }, isEmpty: function() { return my.root.next === null; }, getHead: function() { return my.root.next; }, insertBefore: function(node, check) { var last = my.root; var here = my.root.next; while (here !== null) { if (check(here)) { node.prev = here.prev; node.next = here; here.prev.next = node; here.prev = node; return; } last = here; here = here.next; } last.next = node; node.prev = last; node.next = null; }, findTransition: function(check) { var prev = my.root; var here = my.root.next; while (here !== null) { if (check(here)) break; prev = here; here = here.next; } return { before: prev === my.root ? null : prev, after: here, insert: function(node) { node.prev = prev; node.next = here; prev.next = node; if (here !== null) here.prev = node; return node; } }; } }; return my; }, node: function(data) { data.prev = null; data.next = null; data.remove = function() { data.prev.next = data.next; if (data.next) data.next.prev = data.prev; data.prev = null; data.next = null; }; return data; } }; module2.exports = LinkedList; } }); // node_modules/polybooljs/lib/intersecter.js var require_intersecter = __commonJS({ "node_modules/polybooljs/lib/intersecter.js"(exports2, module2) { var LinkedList = require_linked_list(); function Intersecter(selfIntersection, eps, buildLog) { function segmentNew(start, end) { return { id: buildLog ? buildLog.segmentId() : -1, start, end, myFill: { above: null, // is there fill above us? below: null // is there fill below us? }, otherFill: null }; } function segmentCopy(start, end, seg) { return { id: buildLog ? buildLog.segmentId() : -1, start, end, myFill: { above: seg.myFill.above, below: seg.myFill.below }, otherFill: null }; } var event_root = LinkedList.create(); function eventCompare(p1_isStart, p1_1, p1_2, p2_isStart, p2_1, p2_2) { var comp = eps.pointsCompare(p1_1, p2_1); if (comp !== 0) return comp; if (eps.pointsSame(p1_2, p2_2)) return 0; if (p1_isStart !== p2_isStart) return p1_isStart ? 1 : -1; return eps.pointAboveOrOnLine( p1_2, p2_isStart ? p2_1 : p2_2, // order matters p2_isStart ? p2_2 : p2_1 ) ? 1 : -1; } function eventAdd(ev2, other_pt) { event_root.insertBefore(ev2, function(here) { var comp = eventCompare( ev2.isStart, ev2.pt, other_pt, here.isStart, here.pt, here.other.pt ); return comp < 0; }); } function eventAddSegmentStart(seg, primary) { var ev_start = LinkedList.node({ isStart: true, pt: seg.start, seg, primary, other: null, status: null }); eventAdd(ev_start, seg.end); return ev_start; } function eventAddSegmentEnd(ev_start, seg, primary) { var ev_end = LinkedList.node({ isStart: false, pt: seg.end, seg, primary, other: ev_start, status: null }); ev_start.other = ev_end; eventAdd(ev_end, ev_start.pt); } function eventAddSegment(seg, primary) { var ev_start = eventAddSegmentStart(seg, primary); eventAddSegmentEnd(ev_start, seg, primary); return ev_start; } function eventUpdateEnd(ev2, end) { if (buildLog) buildLog.segmentChop(ev2.seg, end); ev2.other.remove(); ev2.seg.end = end; ev2.other.pt = end; eventAdd(ev2.other, ev2.pt); } function eventDivide(ev2, pt2) { var ns2 = segmentCopy(pt2, ev2.seg.end, ev2.seg); eventUpdateEnd(ev2, pt2); return eventAddSegment(ns2, ev2.primary); } function calculate(primaryPolyInverted, secondaryPolyInverted) { var status_root = LinkedList.create(); function statusCompare(ev1, ev22) { var a12 = ev1.seg.start; var a2 = ev1.seg.end; var b12 = ev22.seg.start; var b2 = ev22.seg.end; if (eps.pointsCollinear(a12, b12, b2)) { if (eps.pointsCollinear(a2, b12, b2)) return 1; return eps.pointAboveOrOnLine(a2, b12, b2) ? 1 : -1; } return eps.pointAboveOrOnLine(a12, b12, b2) ? 1 : -1; } function statusFindSurrounding(ev3) { return status_root.findTransition(function(here) { var comp = statusCompare(ev3, here.ev); return comp > 0; }); } function checkIntersection(ev1, ev22) { var seg1 = ev1.seg; var seg2 = ev22.seg; var a12 = seg1.start; var a2 = seg1.end; var b12 = seg2.start; var b2 = seg2.end; if (buildLog) buildLog.checkIntersection(seg1, seg2); var i = eps.linesIntersect(a12, a2, b12, b2); if (i === false) { if (!eps.pointsCollinear(a12, a2, b12)) return false; if (eps.pointsSame(a12, b2) || eps.pointsSame(a2, b12)) return false; var a1_equ_b1 = eps.pointsSame(a12, b12); var a2_equ_b2 = eps.pointsSame(a2, b2); if (a1_equ_b1 && a2_equ_b2) return ev22; var a1_between = !a1_equ_b1 && eps.pointBetween(a12, b12, b2); var a2_between = !a2_equ_b2 && eps.pointBetween(a2, b12, b2); if (a1_equ_b1) { if (a2_between) { eventDivide(ev22, a2); } else { eventDivide(ev1, b2); } return ev22; } else if (a1_between) { if (!a2_equ_b2) { if (a2_between) { eventDivide(ev22, a2); } else { eventDivide(ev1, b2); } } eventDivide(ev22, a12); } } else { if (i.alongA === 0) { if (i.alongB === -1) eventDivide(ev1, b12); else if (i.alongB === 0) eventDivide(ev1, i.pt); else if (i.alongB === 1) eventDivide(ev1, b2); } if (i.alongB === 0) { if (i.alongA === -1) eventDivide(ev22, a12); else if (i.alongA === 0) eventDivide(ev22, i.pt); else if (i.alongA === 1) eventDivide(ev22, a2); } } return false; } var segments = []; while (!event_root.isEmpty()) { var ev2 = event_root.getHead(); if (buildLog) buildLog.vert(ev2.pt[0]); if (ev2.isStart) { let checkBothIntersections2 = function() { if (above) { var eve2 = checkIntersection(ev2, above); if (eve2) return eve2; } if (below) return checkIntersection(ev2, below); return false; }; var checkBothIntersections = checkBothIntersections2; if (buildLog) buildLog.segmentNew(ev2.seg, ev2.primary); var surrounding = statusFindSurrounding(ev2); var above = surrounding.before ? surrounding.before.ev : null; var below = surrounding.after ? surrounding.after.ev : null; if (buildLog) { buildLog.tempStatus( ev2.seg, above ? above.seg : false, below ? below.seg : false ); } var eve = checkBothIntersections2(); if (eve) { if (selfIntersection) { var toggle; if (ev2.seg.myFill.below === null) toggle = true; else toggle = ev2.seg.myFill.above !== ev2.seg.myFill.below; if (toggle) eve.seg.myFill.above = !eve.seg.myFill.above; } else { eve.seg.otherFill = ev2.seg.myFill; } if (buildLog) buildLog.segmentUpdate(eve.seg); ev2.other.remove(); ev2.remove(); } if (event_root.getHead() !== ev2) { if (buildLog) buildLog.rewind(ev2.seg); continue; } if (selfIntersection) { var toggle; if (ev2.seg.myFill.below === null) toggle = true; else toggle = ev2.seg.myFill.above !== ev2.seg.myFill.below; if (!below) { ev2.seg.myFill.below = primaryPolyInverted; } else { ev2.seg.myFill.below = below.seg.myFill.above; } if (toggle) ev2.seg.myFill.above = !ev2.seg.myFill.below; else ev2.seg.myFill.above = ev2.seg.myFill.below; } else { if (ev2.seg.otherFill === null) { var inside; if (!below) { inside = ev2.primary ? secondaryPolyInverted : primaryPolyInverted; } else { if (ev2.primary === below.primary) inside = below.seg.otherFill.above; else inside = below.seg.myFill.above; } ev2.seg.otherFill = { above: inside, below: inside }; } } if (buildLog) { buildLog.status( ev2.seg, above ? above.seg : false, below ? below.seg : false ); } ev2.other.status = surrounding.insert(LinkedList.node({ ev: ev2 })); } else { var st2 = ev2.status; if (st2 === null) { throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large"); } if (status_root.exists(st2.prev) && status_root.exists(st2.next)) checkIntersection(st2.prev.ev, st2.next.ev); if (buildLog) buildLog.statusRemove(st2.ev.seg); st2.remove(); if (!ev2.primary) { var s = ev2.seg.myFill; ev2.seg.myFill = ev2.seg.otherFill; ev2.seg.otherFill = s; } segments.push(ev2.seg); } event_root.getHead().remove(); } if (buildLog) buildLog.done(); return segments; } if (!selfIntersection) { return { calculate: function(segments1, inverted1, segments2, inverted2) { segments1.forEach(function(seg) { eventAddSegment(segmentCopy(seg.start, seg.end, seg), true); }); segments2.forEach(function(seg) { eventAddSegment(segmentCopy(seg.start, seg.end, seg), false); }); return calculate(inverted1, inverted2); } }; } return { addRegion: function(region) { var pt1; var pt2 = region[region.length - 1]; for (var i = 0; i < region.length; i++) { pt1 = pt2; pt2 = region[i]; var forward = eps.pointsCompare(pt1, pt2); if (forward === 0) continue; eventAddSegment( segmentNew( forward < 0 ? pt1 : pt2, forward < 0 ? pt2 : pt1 ), true ); } }, calculate: function(inverted) { return calculate(inverted, false); } }; } module2.exports = Intersecter; } }); // node_modules/polybooljs/lib/segment-chainer.js var require_segment_chainer = __commonJS({ "node_modules/polybooljs/lib/segment-chainer.js"(exports2, module2) { function SegmentChainer(segments, eps, buildLog) { var chains = []; var regions = []; segments.forEach(function(seg) { var pt1 = seg.start; var pt2 = seg.end; if (eps.pointsSame(pt1, pt2)) { console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large"); return; } if (buildLog) buildLog.chainStart(seg); var first_match = { index: 0, matches_head: false, matches_pt1: false }; var second_match = { index: 0, matches_head: false, matches_pt1: false }; var next_match = first_match; function setMatch(index2, matches_head, matches_pt1) { next_match.index = index2; next_match.matches_head = matches_head; next_match.matches_pt1 = matches_pt1; if (next_match === first_match) { next_match = second_match; return false; } next_match = null; return true; } for (var i = 0; i < chains.length; i++) { var chain = chains[i]; var head = chain[0]; var head2 = chain[1]; var tail = chain[chain.length - 1]; var tail2 = chain[chain.length - 2]; if (eps.pointsSame(head, pt1)) { if (setMatch(i, true, true)) break; } else if (eps.pointsSame(head, pt2)) { if (setMatch(i, true, false)) break; } else if (eps.pointsSame(tail, pt1)) { if (setMatch(i, false, true)) break; } else if (eps.pointsSame(tail, pt2)) { if (setMatch(i, false, false)) break; } } if (next_match === first_match) { chains.push([pt1, pt2]); if (buildLog) buildLog.chainNew(pt1, pt2); return; } if (next_match === second_match) { if (buildLog) buildLog.chainMatch(first_match.index); var index = first_match.index; var pt3 = first_match.matches_pt1 ? pt2 : pt1; var addToHead = first_match.matches_head; var chain = chains[index]; var grow = addToHead ? chain[0] : chain[chain.length - 1]; var grow2 = addToHead ? chain[1] : chain[chain.length - 2]; var oppo = addToHead ? chain[chain.length - 1] : chain[0]; var oppo2 = addToHead ? chain[chain.length - 2] : chain[1]; if (eps.pointsCollinear(grow2, grow, pt3)) { if (addToHead) { if (buildLog) buildLog.chainRemoveHead(first_match.index, pt3); chain.shift(); } else { if (buildLog) buildLog.chainRemoveTail(first_match.index, pt3); chain.pop(); } grow = grow2; } if (eps.pointsSame(oppo, pt3)) { chains.splice(index, 1); if (eps.pointsCollinear(oppo2, oppo, grow)) { if (addToHead) { if (buildLog) buildLog.chainRemoveTail(first_match.index, grow); chain.pop(); } else { if (buildLog) buildLog.chainRemoveHead(first_match.index, grow); chain.shift(); } } if (buildLog) buildLog.chainClose(first_match.index); regions.push(chain); return; } if (addToHead) { if (buildLog) buildLog.chainAddHead(first_match.index, pt3); chain.unshift(pt3); } else { if (buildLog) buildLog.chainAddTail(first_match.index, pt3); chain.push(pt3); } return; } function reverseChain(index2) { if (buildLog) buildLog.chainReverse(index2); chains[index2].reverse(); } function appendChain(index1, index2) { var chain1 = chains[index1]; var chain2 = chains[index2]; var tail3 = chain1[chain1.length - 1]; var tail22 = chain1[chain1.length - 2]; var head3 = chain2[0]; var head22 = chain2[1]; if (eps.pointsCollinear(tail22, tail3, head3)) { if (buildLog) buildLog.chainRemoveTail(index1, tail3); chain1.pop(); tail3 = tail22; } if (eps.pointsCollinear(tail3, head3, head22)) { if (buildLog) buildLog.chainRemoveHead(index2, head3); chain2.shift(); } if (buildLog) buildLog.chainJoin(index1, index2); chains[index1] = chain1.concat(chain2); chains.splice(index2, 1); } var F = first_match.index; var S = second_match.index; if (buildLog) buildLog.chainConnect(F, S); var reverseF = chains[F].length < chains[S].length; if (first_match.matches_head) { if (second_match.matches_head) { if (reverseF) { reverseChain(F); appendChain(F, S); } else { reverseChain(S); appendChain(S, F); } } else { appendChain(S, F); } } else { if (second_match.matches_head) { appendChain(F, S); } else { if (reverseF) { reverseChain(F); appendChain(S, F); } else { reverseChain(S); appendChain(F, S); } } } }); return regions; } module2.exports = SegmentChainer; } }); // node_modules/polybooljs/lib/segment-selector.js var require_segment_selector = __commonJS({ "node_modules/polybooljs/lib/segment-selector.js"(exports2, module2) { function select(segments, selection, buildLog) { var result = []; segments.forEach(function(seg) { var index = (seg.myFill.above ? 8 : 0) + (seg.myFill.below ? 4 : 0) + (seg.otherFill && seg.otherFill.above ? 2 : 0) + (seg.otherFill && seg.otherFill.below ? 1 : 0); if (selection[index] !== 0) { result.push({ id: buildLog ? buildLog.segmentId() : -1, start: seg.start, end: seg.end, myFill: { above: selection[index] === 1, // 1 if filled above below: selection[index] === 2 // 2 if filled below }, otherFill: null }); } }); if (buildLog) buildLog.selected(result); return result; } var SegmentSelector = { union: function(segments, buildLog) { return select(segments, [ 0, 2, 1, 0, 2, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 ], buildLog); }, intersect: function(segments, buildLog) { return select(segments, [ 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 1, 1, 0, 2, 1, 0 ], buildLog); }, difference: function(segments, buildLog) { return select(segments, [ 0, 0, 0, 0, 2, 0, 2, 0, 1, 1, 0, 0, 0, 1, 2, 0 ], buildLog); }, differenceRev: function(segments, buildLog) { return select(segments, [ 0, 2, 1, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0, 0, 0, 0 ], buildLog); }, xor: function(segments, buildLog) { return select(segments, [ 0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0 ], buildLog); } }; module2.exports = SegmentSelector; } }); // node_modules/polybooljs/lib/geojson.js var require_geojson = __commonJS({ "node_modules/polybooljs/lib/geojson.js"(exports2, module2) { var GeoJSON = { // convert a GeoJSON object to a PolyBool polygon toPolygon: function(PolyBool, geojson) { function GeoPoly(coords) { if (coords.length <= 0) return PolyBool.segments({ inverted: false, regions: [] }); function LineString(ls2) { var reg = ls2.slice(0, ls2.length - 1); return PolyBool.segments({ inverted: false, regions: [reg] }); } var out2 = LineString(coords[0]); for (var i2 = 1; i2 < coords.length; i2++) out2 = PolyBool.selectDifference(PolyBool.combine(out2, LineString(coords[i2]))); return out2; } if (geojson.type === "Polygon") { return PolyBool.polygon(GeoPoly(geojson.coordinates)); } else if (geojson.type === "MultiPolygon") { var out = PolyBool.segments({ inverted: false, regions: [] }); for (var i = 0; i < geojson.coordinates.length; i++) out = PolyBool.selectUnion(PolyBool.combine(out, GeoPoly(geojson.coordinates[i]))); return PolyBool.polygon(out); } throw new Error("PolyBool: Cannot convert GeoJSON object to PolyBool polygon"); }, // convert a PolyBool polygon to a GeoJSON object fromPolygon: function(PolyBool, eps, poly) { poly = PolyBool.polygon(PolyBool.segments(poly)); function regionInsideRegion(r12, r2) { return eps.pointInsideRegion([ (r12[0][0] + r12[1][0]) * 0.5, (r12[0][1] + r12[1][1]) * 0.5 ], r2); } function newNode(region2) { return { region: region2, children: [] }; } var roots = newNode(null); function addChild(root, region2) { for (var i2 = 0; i2 < root.children.length; i2++) { var child = root.children[i2]; if (regionInsideRegion(region2, child.region)) { addChild(child, region2); return; } } var node = newNode(region2); for (var i2 = 0; i2 < root.children.length; i2++) { var child = root.children[i2]; if (regionInsideRegion(child.region, region2)) { node.children.push(child); root.children.splice(i2, 1); i2--; } } root.children.push(node); } for (var i = 0; i < poly.regions.length; i++) { var region = poly.regions[i]; if (region.length < 3) continue; addChild(roots, region); } function forceWinding(region2, clockwise) { var winding = 0; var last_x = region2[region2.length - 1][0]; var last_y = region2[region2.length - 1][1]; var copy = []; for (var i2 = 0; i2 < region2.length; i2++) { var curr_x = region2[i2][0]; var curr_y = region2[i2][1]; copy.push([curr_x, curr_y]); winding += curr_y * last_x - curr_x * last_y; last_x = curr_x; last_y = curr_y; } var isclockwise = winding < 0; if (isclockwise !== clockwise) copy.reverse(); copy.push([copy[0][0], copy[0][1]]); return copy; } var geopolys = []; function addExterior(node) { var poly2 = [forceWinding(node.region, false)]; geopolys.push(poly2); for (var i2 = 0; i2 < node.children.length; i2++) poly2.push(getInterior(node.children[i2])); } function getInterior(node) { for (var i2 = 0; i2 < node.children.length; i2++) addExterior(node.children[i2]); return forceWinding(node.region, true); } for (var i = 0; i < roots.children.length; i++) addExterior(roots.children[i]); if (geopolys.length <= 0) return { type: "Polygon", coordinates: [] }; if (geopolys.length == 1) return { type: "Polygon", coordinates: geopolys[0] }; return { // otherwise, use a GeoJSON MultiPolygon type: "MultiPolygon", coordinates: geopolys }; } }; module2.exports = GeoJSON; } }); // node_modules/polybooljs/index.js var require_polybooljs = __commonJS({ "node_modules/polybooljs/index.js"(exports2, module2) { var BuildLog = require_build_log(); var Epsilon = require_epsilon(); var Intersecter = require_intersecter(); var SegmentChainer = require_segment_chainer(); var SegmentSelector = require_segment_selector(); var GeoJSON = require_geojson(); var buildLog = false; var epsilon = Epsilon(); var PolyBool; PolyBool = { // getter/setter for buildLog buildLog: function(bl) { if (bl === true) buildLog = BuildLog(); else if (bl === false) buildLog = false; return buildLog === false ? false : buildLog.list; }, // getter/setter for epsilon epsilon: function(v) { return epsilon.epsilon(v); }, // core API segments: function(poly) { var i = Intersecter(true, epsilon, buildLog); poly.regions.forEach(i.addRegion); return { segments: i.calculate(poly.inverted), inverted: poly.inverted }; }, combine: function(segments1, segments2) { var i3 = Intersecter(false, epsilon, buildLog); return { combined: i3.calculate( segments1.segments, segments1.inverted, segments2.segments, segments2.inverted ), inverted1: segments1.inverted, inverted2: segments2.inverted }; }, selectUnion: function(combined) { return { segments: SegmentSelector.union(combined.combined, buildLog), inverted: combined.inverted1 || combined.inverted2 }; }, selectIntersect: function(combined) { return { segments: SegmentSelector.intersect(combined.combined, buildLog), inverted: combined.inverted1 && combined.inverted2 }; }, selectDifference: function(combined) { return { segments: SegmentSelector.difference(combined.combined, buildLog), inverted: combined.inverted1 && !combined.inverted2 }; }, selectDifferenceRev: function(combined) { return { segments: SegmentSelector.differenceRev(combined.combined, buildLog), inverted: !combined.inverted1 && combined.inverted2 }; }, selectXor: function(combined) { return { segments: SegmentSelector.xor(combined.combined, buildLog), inverted: combined.inverted1 !== combined.inverted2 }; }, polygon: function(segments) { return { regions: SegmentChainer(segments.segments, epsilon, buildLog), inverted: segments.inverted }; }, // GeoJSON converters polygonFromGeoJSON: function(geojson) { return GeoJSON.toPolygon(PolyBool, geojson); }, polygonToGeoJSON: function(poly) { return GeoJSON.fromPolygon(PolyBool, epsilon, poly); }, // helper functions for common operations union: function(poly1, poly2) { return operate(poly1, poly2, PolyBool.selectUnion); }, intersect: function(poly1, poly2) { return operate(poly1, poly2, PolyBool.selectIntersect); }, difference: function(poly1, poly2) { return operate(poly1, poly2, PolyBool.selectDifference); }, differenceRev: function(poly1, poly2) { return operate(poly1, poly2, PolyBool.selectDifferenceRev); }, xor: function(poly1, poly2) { return operate(poly1, poly2, PolyBool.selectXor); } }; function operate(poly1, poly2, selector) { var seg1 = PolyBool.segments(poly1); var seg2 = PolyBool.segments(poly2); var comb = PolyBool.combine(seg1, seg2); var seg3 = selector(comb); return PolyBool.polygon(seg3); } if (typeof window === "object") window.PolyBool = PolyBool; module2.exports = PolyBool; } }); // node_modules/point-in-polygon/nested.js var require_nested = __commonJS({ "node_modules/point-in-polygon/nested.js"(exports2, module2) { module2.exports = function pointInPolygonNested(point, vs2, start, end) { var x = point[0], y = point[1]; var inside = false; if (start === void 0) start = 0; if (end === void 0) end = vs2.length; var len = end - start; for (var i = 0, j = len - 1; i < len; j = i++) { var xi2 = vs2[i + start][0], yi2 = vs2[i + start][1]; var xj = vs2[j + start][0], yj = vs2[j + start][1]; var intersect = yi2 > y !== yj > y && x < (xj - xi2) * (y - yi2) / (yj - yi2) + xi2; if (intersect) inside = !inside; } return inside; }; } }); // node_modules/plotly.js/src/lib/polygon.js var require_polygon = __commonJS({ "node_modules/plotly.js/src/lib/polygon.js"(exports2, module2) { "use strict"; var dot = require_matrix().dot; var BADNUM = require_numerical().BADNUM; var polygon = module2.exports = {}; polygon.tester = function tester(ptsIn) { var pts = ptsIn.slice(); var xmin = pts[0][0]; var xmax = xmin; var ymin = pts[0][1]; var ymax = ymin; var i; if (pts[pts.length - 1][0] !== pts[0][0] || pts[pts.length - 1][1] !== pts[0][1]) { pts.push(pts[0]); } for (i = 1; i < pts.length; i++) { xmin = Math.min(xmin, pts[i][0]); xmax = Math.max(xmax, pts[i][0]); ymin = Math.min(ymin, pts[i][1]); ymax = Math.max(ymax, pts[i][1]); } var isRect = false; var rectFirstEdgeTest; if (pts.length === 5) { if (pts[0][0] === pts[1][0]) { if (pts[2][0] === pts[3][0] && pts[0][1] === pts[3][1] && pts[1][1] === pts[2][1]) { isRect = true; rectFirstEdgeTest = function(pt2) { return pt2[0] === pts[0][0]; }; } } else if (pts[0][1] === pts[1][1]) { if (pts[2][1] === pts[3][1] && pts[0][0] === pts[3][0] && pts[1][0] === pts[2][0]) { isRect = true; rectFirstEdgeTest = function(pt2) { return pt2[1] === pts[0][1]; }; } } } function rectContains(pt2, omitFirstEdge) { var x = pt2[0]; var y = pt2[1]; if (x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { return false; } if (omitFirstEdge && rectFirstEdgeTest(pt2)) return false; return true; } function contains(pt2, omitFirstEdge) { var x = pt2[0]; var y = pt2[1]; if (x === BADNUM || x < xmin || x > xmax || y === BADNUM || y < ymin || y > ymax) { return false; } var imax = pts.length; var x12 = pts[0][0]; var y12 = pts[0][1]; var crossings = 0; var i2; var x02; var y02; var xmini; var ycross; for (i2 = 1; i2 < imax; i2++) { x02 = x12; y02 = y12; x12 = pts[i2][0]; y12 = pts[i2][1]; xmini = Math.min(x02, x12); if (x < xmini || x > Math.max(x02, x12) || y > Math.max(y02, y12)) { continue; } else if (y < Math.min(y02, y12)) { if (x !== xmini) crossings++; } else { if (x12 === x02) ycross = y; else ycross = y02 + (x - x02) * (y12 - y02) / (x12 - x02); if (y === ycross) { if (i2 === 1 && omitFirstEdge) return false; return true; } if (y <= ycross && x !== xmini) crossings++; } } return crossings % 2 === 1; } var degenerate = true; var lastPt = pts[0]; for (i = 1; i < pts.length; i++) { if (lastPt[0] !== pts[i][0] || lastPt[1] !== pts[i][1]) { degenerate = false; break; } } return { xmin, xmax, ymin, ymax, pts, contains: isRect ? rectContains : contains, isRect, degenerate }; }; polygon.isSegmentBent = function isSegmentBent(pts, start, end, tolerance) { var startPt = pts[start]; var segment = [pts[end][0] - startPt[0], pts[end][1] - startPt[1]]; var segmentSquared = dot(segment, segment); var segmentLen = Math.sqrt(segmentSquared); var unitPerp = [-segment[1] / segmentLen, segment[0] / segmentLen]; var i; var part; var partParallel; for (i = start + 1; i < end; i++) { part = [pts[i][0] - startPt[0], pts[i][1] - startPt[1]]; partParallel = dot(part, segment); if (partParallel < 0 || partParallel > segmentSquared || Math.abs(dot(part, unitPerp)) > tolerance) return true; } return false; }; polygon.filter = function filter(pts, tolerance) { var ptsFiltered = [pts[0]]; var doneRawIndex = 0; var doneFilteredIndex = 0; function addPt(pt2) { pts.push(pt2); var prevFilterLen = ptsFiltered.length; var iLast = doneRawIndex; ptsFiltered.splice(doneFilteredIndex + 1); for (var i = iLast + 1; i < pts.length; i++) { if (i === pts.length - 1 || polygon.isSegmentBent(pts, iLast, i + 1, tolerance)) { ptsFiltered.push(pts[i]); if (ptsFiltered.length < prevFilterLen - 2) { doneRawIndex = i; doneFilteredIndex = ptsFiltered.length - 1; } iLast = i; } } } if (pts.length > 1) { var lastPt = pts.pop(); addPt(lastPt); } return { addPt, raw: pts, filtered: ptsFiltered }; }; } }); // node_modules/plotly.js/src/components/selections/constants.js var require_constants7 = __commonJS({ "node_modules/plotly.js/src/components/selections/constants.js"(exports2, module2) { "use strict"; module2.exports = { // max pixels off straight before a lasso select line counts as bent BENDPX: 1.5, // smallest dimension allowed for a select box MINSELECT: 12, // throttling limit (ms) for selectPoints calls SELECTDELAY: 100, // cache ID suffix for throttle SELECTID: "-select" }; } }); // node_modules/plotly.js/src/components/selections/select.js var require_select = __commonJS({ "node_modules/plotly.js/src/components/selections/select.js"(exports2, module2) { "use strict"; var polybool = require_polybooljs(); var pointInPolygon = require_nested(); var Registry = require_registry(); var dashStyle = require_drawing().dashStyle; var Color = require_color(); var Fx = require_fx(); var makeEventData = require_helpers2().makeEventData; var dragHelpers = require_helpers5(); var freeMode = dragHelpers.freeMode; var rectMode = dragHelpers.rectMode; var drawMode = dragHelpers.drawMode; var openMode = dragHelpers.openMode; var selectMode = dragHelpers.selectMode; var shapeHelpers = require_helpers8(); var shapeConstants = require_constants5(); var displayOutlines = require_display_outlines(); var clearOutline = require_handle_outline().clearOutline; var newShapeHelpers = require_helpers7(); var handleEllipse = newShapeHelpers.handleEllipse; var readPaths = newShapeHelpers.readPaths; var newShapes = require_newshapes().newShapes; var newSelections = require_newselections(); var activateLastSelection = require_draw3().activateLastSelection; var Lib = require_lib(); var ascending = Lib.sorterAsc; var libPolygon = require_polygon(); var throttle = require_throttle(); var getFromId = require_axis_ids().getFromId; var clearGlCanvases = require_clear_gl_canvases(); var redrawReglTraces = require_subroutines().redrawReglTraces; var constants = require_constants7(); var MINSELECT = constants.MINSELECT; var filteredPolygon = libPolygon.filter; var polygonTester = libPolygon.tester; var helpers = require_helpers6(); var p2r = helpers.p2r; var axValue = helpers.axValue; var getTransform = helpers.getTransform; function hasSubplot(dragOptions) { return dragOptions.subplot !== void 0; } function prepSelect(evt, startX, startY, dragOptions, mode) { var isCartesian = !hasSubplot(dragOptions); var isFreeMode = freeMode(mode); var isRectMode = rectMode(mode); var isOpenMode = openMode(mode); var isDrawMode = drawMode(mode); var isSelectMode = selectMode(mode); var isLine = mode === "drawline"; var isEllipse = mode === "drawcircle"; var isLineOrEllipse = isLine || isEllipse; var gd2 = dragOptions.gd; var fullLayout = gd2._fullLayout; var immediateSelect = isSelectMode && fullLayout.newselection.mode === "immediate" && isCartesian; var zoomLayer = fullLayout._zoomlayer; var dragBBox = dragOptions.element.getBoundingClientRect(); var plotinfo = dragOptions.plotinfo; var transform = getTransform(plotinfo); var x02 = startX - dragBBox.left; var y02 = startY - dragBBox.top; fullLayout._calcInverseTransform(gd2); var transformedCoords = Lib.apply3DTransform(fullLayout._invTransform)(x02, y02); x02 = transformedCoords[0]; y02 = transformedCoords[1]; var scaleX = fullLayout._invScaleX; var scaleY = fullLayout._invScaleY; var x12 = x02; var y12 = y02; var path0 = "M" + x02 + "," + y02; var xAxis = dragOptions.xaxes[0]; var yAxis = dragOptions.yaxes[0]; var pw = xAxis._length; var ph2 = yAxis._length; var subtract = evt.altKey && !(drawMode(mode) && isOpenMode); var filterPoly, selectionTesters, mergedPolygons, currentPolygon; var i, searchInfo, eventData; coerceSelectionsCache(evt, gd2, dragOptions); if (isFreeMode) { filterPoly = filteredPolygon([[x02, y02]], constants.BENDPX); } var outlines = zoomLayer.selectAll("path.select-outline-" + plotinfo.id).data([1]); var newStyle = isDrawMode ? fullLayout.newshape : fullLayout.newselection; if (isDrawMode) { dragOptions.hasText = newStyle.label.text || newStyle.label.texttemplate; } var fillC = isDrawMode && !isOpenMode ? newStyle.fillcolor : "rgba(0,0,0,0)"; var strokeC = newStyle.line.color || (isCartesian ? Color.contrast(gd2._fullLayout.plot_bgcolor) : "#7f7f7f"); outlines.enter().append("path").attr("class", "select-outline select-outline-" + plotinfo.id).style({ opacity: isDrawMode ? newStyle.opacity / 2 : 1, "stroke-dasharray": dashStyle(newStyle.line.dash, newStyle.line.width), "stroke-width": newStyle.line.width + "px", "shape-rendering": "crispEdges" }).call(Color.stroke, strokeC).call(Color.fill, fillC).attr("fill-rule", "evenodd").classed("cursor-move", isDrawMode ? true : false).attr("transform", transform).attr("d", path0 + "Z"); var corners = zoomLayer.append("path").attr("class", "zoombox-corners").style({ fill: Color.background, stroke: Color.defaultLine, "stroke-width": 1 }).attr("transform", transform).attr("d", "M0,0Z"); if (isDrawMode && dragOptions.hasText) { var shapeGroup = zoomLayer.select(".label-temp"); if (shapeGroup.empty()) { shapeGroup = zoomLayer.append("g").classed("label-temp", true).classed("select-outline", true).style({ opacity: 0.8 }); } } var throttleID = fullLayout._uid + constants.SELECTID; var selection = []; var searchTraces = determineSearchTraces( gd2, dragOptions.xaxes, dragOptions.yaxes, dragOptions.subplot ); if (immediateSelect && !evt.shiftKey) { dragOptions._clearSubplotSelections = function() { if (!isCartesian) return; var xRef = xAxis._id; var yRef = yAxis._id; deselectSubplot(gd2, xRef, yRef, searchTraces); var selections = (gd2.layout || {}).selections || []; var list = []; var selectionErased = false; for (var q = 0; q < selections.length; q++) { var s = fullLayout.selections[q]; if (s.xref !== xRef || s.yref !== yRef) { list.push(selections[q]); } else { selectionErased = true; } } if (selectionErased) { gd2._fullLayout._noEmitSelectedAtStart = true; Registry.call("_guiRelayout", gd2, { selections: list }); } }; } var fillRangeItems = getFillRangeItems(dragOptions); dragOptions.moveFn = function(dx0, dy0) { if (dragOptions._clearSubplotSelections) { dragOptions._clearSubplotSelections(); dragOptions._clearSubplotSelections = void 0; } x12 = Math.max(0, Math.min(pw, scaleX * dx0 + x02)); y12 = Math.max(0, Math.min(ph2, scaleY * dy0 + y02)); var dx = Math.abs(x12 - x02); var dy = Math.abs(y12 - y02); if (isRectMode) { var direction; var start, end; if (isSelectMode) { var q = fullLayout.selectdirection; if (q === "any") { if (dy < Math.min(dx * 0.6, MINSELECT)) { direction = "h"; } else if (dx < Math.min(dy * 0.6, MINSELECT)) { direction = "v"; } else { direction = "d"; } } else { direction = q; } switch (direction) { case "h": start = isEllipse ? ph2 / 2 : 0; end = ph2; break; case "v": start = isEllipse ? pw / 2 : 0; end = pw; break; } } if (isDrawMode) { switch (fullLayout.newshape.drawdirection) { case "vertical": direction = "h"; start = isEllipse ? ph2 / 2 : 0; end = ph2; break; case "horizontal": direction = "v"; start = isEllipse ? pw / 2 : 0; end = pw; break; case "ortho": if (dx < dy) { direction = "h"; start = y02; end = y12; } else { direction = "v"; start = x02; end = x12; } break; default: direction = "d"; } } if (direction === "h") { currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [x12, start], [x12, end]) : ( // using x1 instead of x0 allows adjusting the line while drawing [[x02, start], [x02, end], [x12, end], [x12, start]] ); currentPolygon.xmin = isLineOrEllipse ? x12 : Math.min(x02, x12); currentPolygon.xmax = isLineOrEllipse ? x12 : Math.max(x02, x12); currentPolygon.ymin = Math.min(start, end); currentPolygon.ymax = Math.max(start, end); corners.attr("d", "M" + currentPolygon.xmin + "," + (y02 - MINSELECT) + "h-4v" + 2 * MINSELECT + "h4ZM" + (currentPolygon.xmax - 1) + "," + (y02 - MINSELECT) + "h4v" + 2 * MINSELECT + "h-4Z"); } else if (direction === "v") { currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [start, y12], [end, y12]) : ( // using y1 instead of y0 allows adjusting the line while drawing [[start, y02], [start, y12], [end, y12], [end, y02]] ); currentPolygon.xmin = Math.min(start, end); currentPolygon.xmax = Math.max(start, end); currentPolygon.ymin = isLineOrEllipse ? y12 : Math.min(y02, y12); currentPolygon.ymax = isLineOrEllipse ? y12 : Math.max(y02, y12); corners.attr("d", "M" + (x02 - MINSELECT) + "," + currentPolygon.ymin + "v-4h" + 2 * MINSELECT + "v4ZM" + (x02 - MINSELECT) + "," + (currentPolygon.ymax - 1) + "v4h" + 2 * MINSELECT + "v-4Z"); } else if (direction === "d") { currentPolygon = isLineOrEllipse ? handleEllipse(isEllipse, [x02, y02], [x12, y12]) : [[x02, y02], [x02, y12], [x12, y12], [x12, y02]]; currentPolygon.xmin = Math.min(x02, x12); currentPolygon.xmax = Math.max(x02, x12); currentPolygon.ymin = Math.min(y02, y12); currentPolygon.ymax = Math.max(y02, y12); corners.attr("d", "M0,0Z"); } } else if (isFreeMode) { filterPoly.addPt([x12, y12]); currentPolygon = filterPoly.filtered; } if (dragOptions.selectionDefs && dragOptions.selectionDefs.length) { mergedPolygons = mergePolygons(dragOptions.mergedPolygons, currentPolygon, subtract); currentPolygon.subtract = subtract; selectionTesters = multiTester(dragOptions.selectionDefs.concat([currentPolygon])); } else { mergedPolygons = [currentPolygon]; selectionTesters = polygonTester(currentPolygon); } displayOutlines(convertPoly(mergedPolygons, isOpenMode), outlines, dragOptions); if (isSelectMode) { var _res = reselect(gd2, false); var extraPoints = _res.eventData ? _res.eventData.points.slice() : []; _res = reselect(gd2, false, selectionTesters, searchTraces, dragOptions); selectionTesters = _res.selectionTesters; eventData = _res.eventData; var poly; if (filterPoly) { poly = filterPoly.filtered; } else { poly = castMultiPolygon(mergedPolygons); } throttle.throttle( throttleID, constants.SELECTDELAY, function() { selection = _doSelect(selectionTesters, searchTraces); var newPoints = selection.slice(); for (var w = 0; w < extraPoints.length; w++) { var p = extraPoints[w]; var found = false; for (var u = 0; u < newPoints.length; u++) { if (newPoints[u].curveNumber === p.curveNumber && newPoints[u].pointNumber === p.pointNumber) { found = true; break; } } if (!found) newPoints.push(p); } if (newPoints.length) { if (!eventData) eventData = {}; eventData.points = newPoints; } fillRangeItems(eventData, poly); emitSelecting(gd2, eventData); } ); } }; dragOptions.clickFn = function(numClicks, evt2) { corners.remove(); if (gd2._fullLayout._activeShapeIndex >= 0) { gd2._fullLayout._deactivateShape(gd2); return; } if (isDrawMode) return; var clickmode = fullLayout.clickmode; throttle.done(throttleID).then(function() { throttle.clear(throttleID); if (numClicks === 2) { outlines.remove(); for (i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; searchInfo._module.selectPoints(searchInfo, false); } updateSelectedState(gd2, searchTraces); clearSelectionsCache(dragOptions); emitDeselect(gd2); if (searchTraces.length) { var clickedXaxis = searchTraces[0].xaxis; var clickedYaxis = searchTraces[0].yaxis; if (clickedXaxis && clickedYaxis) { var subSelections = []; var allSelections = gd2._fullLayout.selections; for (var k = 0; k < allSelections.length; k++) { var s = allSelections[k]; if (!s) continue; if (s.xref !== clickedXaxis._id || s.yref !== clickedYaxis._id) { subSelections.push(s); } } if (subSelections.length < allSelections.length) { gd2._fullLayout._noEmitSelectedAtStart = true; Registry.call("_guiRelayout", gd2, { selections: subSelections }); } } } } else { if (clickmode.indexOf("select") > -1) { selectOnClick( evt2, gd2, dragOptions.xaxes, dragOptions.yaxes, dragOptions.subplot, dragOptions, outlines ); } if (clickmode === "event") { emitSelected(gd2, void 0); } } Fx.click(gd2, evt2, plotinfo.id); }).catch(Lib.error); }; dragOptions.doneFn = function() { corners.remove(); throttle.done(throttleID).then(function() { throttle.clear(throttleID); if (!immediateSelect && currentPolygon && dragOptions.selectionDefs) { currentPolygon.subtract = subtract; dragOptions.selectionDefs.push(currentPolygon); dragOptions.mergedPolygons.length = 0; [].push.apply(dragOptions.mergedPolygons, mergedPolygons); } if (immediateSelect || isDrawMode) { clearSelectionsCache(dragOptions, immediateSelect); } if (dragOptions.doneFnCompleted) { dragOptions.doneFnCompleted(selection); } if (isSelectMode) { emitSelected(gd2, eventData); } }).catch(Lib.error); }; } function selectOnClick(evt, gd2, xAxes, yAxes, subplot, dragOptions, polygonOutlines) { var hoverData = gd2._hoverdata; var fullLayout = gd2._fullLayout; var clickmode = fullLayout.clickmode; var sendEvents = clickmode.indexOf("event") > -1; var selection = []; var searchTraces, searchInfo, currentSelectionDef, selectionTesters, traceSelection; var thisTracesSelection, pointOrBinSelected, subtract, eventData, i; if (isHoverDataSet(hoverData)) { coerceSelectionsCache(evt, gd2, dragOptions); searchTraces = determineSearchTraces(gd2, xAxes, yAxes, subplot); var clickedPtInfo = extractClickedPtInfo(hoverData, searchTraces); var isBinnedTrace = clickedPtInfo.pointNumbers.length > 0; if (isBinnedTrace ? isOnlyThisBinSelected(searchTraces, clickedPtInfo) : isOnlyOnePointSelected(searchTraces) && (pointOrBinSelected = isPointOrBinSelected(clickedPtInfo))) { if (polygonOutlines) polygonOutlines.remove(); for (i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; searchInfo._module.selectPoints(searchInfo, false); } updateSelectedState(gd2, searchTraces); clearSelectionsCache(dragOptions); if (sendEvents) { emitDeselect(gd2); } } else { subtract = evt.shiftKey && (pointOrBinSelected !== void 0 ? pointOrBinSelected : isPointOrBinSelected(clickedPtInfo)); currentSelectionDef = newPointSelectionDef(clickedPtInfo.pointNumber, clickedPtInfo.searchInfo, subtract); var allSelectionDefs = dragOptions.selectionDefs.concat([currentSelectionDef]); selectionTesters = multiTester(allSelectionDefs, selectionTesters); for (i = 0; i < searchTraces.length; i++) { traceSelection = searchTraces[i]._module.selectPoints(searchTraces[i], selectionTesters); thisTracesSelection = fillSelectionItem(traceSelection, searchTraces[i]); if (selection.length) { for (var j = 0; j < thisTracesSelection.length; j++) { selection.push(thisTracesSelection[j]); } } else selection = thisTracesSelection; } eventData = { points: selection }; updateSelectedState(gd2, searchTraces, eventData); if (currentSelectionDef && dragOptions) { dragOptions.selectionDefs.push(currentSelectionDef); } if (polygonOutlines) { var polygons = dragOptions.mergedPolygons; var isOpenMode = openMode(dragOptions.dragmode); displayOutlines(convertPoly(polygons, isOpenMode), polygonOutlines, dragOptions); } if (sendEvents) { emitSelected(gd2, eventData); } } } } function newPointSelectionDef(pointNumber, searchInfo, subtract) { return { pointNumber, searchInfo, subtract: !!subtract }; } function isPointSelectionDef(o) { return "pointNumber" in o && "searchInfo" in o; } function newPointNumTester(pointSelectionDef) { return { xmin: 0, xmax: 0, ymin: 0, ymax: 0, pts: [], contains: function(pt2, omitFirstEdge, pointNumber, searchInfo) { var idxWantedTrace = pointSelectionDef.searchInfo.cd[0].trace._expandedIndex; var idxActualTrace = searchInfo.cd[0].trace._expandedIndex; return idxActualTrace === idxWantedTrace && pointNumber === pointSelectionDef.pointNumber; }, isRect: false, degenerate: false, subtract: !!pointSelectionDef.subtract }; } function multiTester(list) { if (!list.length) return; var testers = []; var xmin = isPointSelectionDef(list[0]) ? 0 : list[0][0][0]; var xmax = xmin; var ymin = isPointSelectionDef(list[0]) ? 0 : list[0][0][1]; var ymax = ymin; for (var i = 0; i < list.length; i++) { if (isPointSelectionDef(list[i])) { testers.push(newPointNumTester(list[i])); } else { var tester = polygonTester(list[i]); tester.subtract = !!list[i].subtract; testers.push(tester); xmin = Math.min(xmin, tester.xmin); xmax = Math.max(xmax, tester.xmax); ymin = Math.min(ymin, tester.ymin); ymax = Math.max(ymax, tester.ymax); } } function contains(pt2, arg, pointNumber, searchInfo) { var contained = false; for (var i2 = 0; i2 < testers.length; i2++) { if (testers[i2].contains(pt2, arg, pointNumber, searchInfo)) { contained = !testers[i2].subtract; } } return contained; } return { xmin, xmax, ymin, ymax, pts: [], contains, isRect: false, degenerate: false }; } function coerceSelectionsCache(evt, gd2, dragOptions) { var fullLayout = gd2._fullLayout; var plotinfo = dragOptions.plotinfo; var dragmode = dragOptions.dragmode; var selectingOnSameSubplot = fullLayout._lastSelectedSubplot && fullLayout._lastSelectedSubplot === plotinfo.id; var hasModifierKey = (evt.shiftKey || evt.altKey) && !(drawMode(dragmode) && openMode(dragmode)); if (selectingOnSameSubplot && hasModifierKey && plotinfo.selection && plotinfo.selection.selectionDefs && !dragOptions.selectionDefs) { dragOptions.selectionDefs = plotinfo.selection.selectionDefs; dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons; } else if (!hasModifierKey || !plotinfo.selection) { clearSelectionsCache(dragOptions); } if (!selectingOnSameSubplot) { clearOutline(gd2); fullLayout._lastSelectedSubplot = plotinfo.id; } } function hasActiveShape(gd2) { return gd2._fullLayout._activeShapeIndex >= 0; } function hasActiveSelection(gd2) { return gd2._fullLayout._activeSelectionIndex >= 0; } function clearSelectionsCache(dragOptions, immediateSelect) { var dragmode = dragOptions.dragmode; var plotinfo = dragOptions.plotinfo; var gd2 = dragOptions.gd; if (hasActiveShape(gd2)) { gd2._fullLayout._deactivateShape(gd2); } if (hasActiveSelection(gd2)) { gd2._fullLayout._deactivateSelection(gd2); } var fullLayout = gd2._fullLayout; var zoomLayer = fullLayout._zoomlayer; var isDrawMode = drawMode(dragmode); var isSelectMode = selectMode(dragmode); if (isDrawMode || isSelectMode) { var outlines = zoomLayer.selectAll(".select-outline-" + plotinfo.id); if (outlines && gd2._fullLayout._outlining) { var shapes; if (isDrawMode) { shapes = newShapes(outlines, dragOptions); } if (shapes) { Registry.call("_guiRelayout", gd2, { shapes }); } var selections; if (isSelectMode && !hasSubplot(dragOptions)) { selections = newSelections(outlines, dragOptions); } if (selections) { gd2._fullLayout._noEmitSelectedAtStart = true; Registry.call("_guiRelayout", gd2, { selections }).then(function() { if (immediateSelect) { activateLastSelection(gd2); } }); } gd2._fullLayout._outlining = false; } } plotinfo.selection = {}; plotinfo.selection.selectionDefs = dragOptions.selectionDefs = []; plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = []; } function getAxId(ax) { return ax._id; } function determineSearchTraces(gd2, xAxes, yAxes, subplot) { if (!gd2.calcdata) return []; var searchTraces = []; var xAxisIds = xAxes.map(getAxId); var yAxisIds = yAxes.map(getAxId); var cd2, trace, i; for (i = 0; i < gd2.calcdata.length; i++) { cd2 = gd2.calcdata[i]; trace = cd2[0].trace; if (trace.visible !== true || !trace._module || !trace._module.selectPoints) continue; if (hasSubplot({ subplot }) && (trace.subplot === subplot || trace.geo === subplot)) { searchTraces.push(createSearchInfo(trace._module, cd2, xAxes[0], yAxes[0])); } else if (trace.type === "splom") { if (trace._xaxes[xAxisIds[0]] && trace._yaxes[yAxisIds[0]]) { var info = createSearchInfo(trace._module, cd2, xAxes[0], yAxes[0]); info.scene = gd2._fullLayout._splomScenes[trace.uid]; searchTraces.push(info); } } else if (trace.type === "sankey") { var sankeyInfo = createSearchInfo(trace._module, cd2, xAxes[0], yAxes[0]); searchTraces.push(sankeyInfo); } else { if (xAxisIds.indexOf(trace.xaxis) === -1 && (!trace._xA || !trace._xA.overlaying)) continue; if (yAxisIds.indexOf(trace.yaxis) === -1 && (!trace._yA || !trace._yA.overlaying)) continue; searchTraces.push(createSearchInfo( trace._module, cd2, getFromId(gd2, trace.xaxis), getFromId(gd2, trace.yaxis) )); } } return searchTraces; } function createSearchInfo(module3, calcData, xaxis, yaxis) { return { _module: module3, cd: calcData, xaxis, yaxis }; } function isHoverDataSet(hoverData) { return hoverData && Array.isArray(hoverData) && hoverData[0].hoverOnBox !== true; } function extractClickedPtInfo(hoverData, searchTraces) { var hoverDatum = hoverData[0]; var pointNumber = -1; var pointNumbers = []; var searchInfo, i; for (i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; if (hoverDatum.fullData._expandedIndex === searchInfo.cd[0].trace._expandedIndex) { if (hoverDatum.hoverOnBox === true) { break; } if (hoverDatum.pointNumber !== void 0) { pointNumber = hoverDatum.pointNumber; } else if (hoverDatum.binNumber !== void 0) { pointNumber = hoverDatum.binNumber; pointNumbers = hoverDatum.pointNumbers; } break; } } return { pointNumber, pointNumbers, searchInfo }; } function isPointOrBinSelected(clickedPtInfo) { var trace = clickedPtInfo.searchInfo.cd[0].trace; var ptNum = clickedPtInfo.pointNumber; var ptNums = clickedPtInfo.pointNumbers; var ptNumsSet = ptNums.length > 0; var ptNumToTest = ptNumsSet ? ptNums[0] : ptNum; return trace.selectedpoints ? trace.selectedpoints.indexOf(ptNumToTest) > -1 : false; } function isOnlyThisBinSelected(searchTraces, clickedPtInfo) { var tracesWithSelectedPts = []; var searchInfo, trace, isSameTrace, i; for (i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; if (searchInfo.cd[0].trace.selectedpoints && searchInfo.cd[0].trace.selectedpoints.length > 0) { tracesWithSelectedPts.push(searchInfo); } } if (tracesWithSelectedPts.length === 1) { isSameTrace = tracesWithSelectedPts[0] === clickedPtInfo.searchInfo; if (isSameTrace) { trace = clickedPtInfo.searchInfo.cd[0].trace; if (trace.selectedpoints.length === clickedPtInfo.pointNumbers.length) { for (i = 0; i < clickedPtInfo.pointNumbers.length; i++) { if (trace.selectedpoints.indexOf(clickedPtInfo.pointNumbers[i]) < 0) { return false; } } return true; } } } return false; } function isOnlyOnePointSelected(searchTraces) { var len = 0; var searchInfo, trace, i; for (i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; trace = searchInfo.cd[0].trace; if (trace.selectedpoints) { if (trace.selectedpoints.length > 1) return false; len += trace.selectedpoints.length; if (len > 1) return false; } } return len === 1; } function updateSelectedState(gd2, searchTraces, eventData) { var i; for (i = 0; i < searchTraces.length; i++) { var fullInputTrace = searchTraces[i].cd[0].trace._fullInput; var tracePreGUI = gd2._fullLayout._tracePreGUI[fullInputTrace.uid] || {}; if (tracePreGUI.selectedpoints === void 0) { tracePreGUI.selectedpoints = fullInputTrace._input.selectedpoints || null; } } var trace; if (eventData) { var pts = eventData.points || []; for (i = 0; i < searchTraces.length; i++) { trace = searchTraces[i].cd[0].trace; trace._input.selectedpoints = trace._fullInput.selectedpoints = []; if (trace._fullInput !== trace) trace.selectedpoints = []; } for (var k = 0; k < pts.length; k++) { var pt2 = pts[k]; var data = pt2.data; var fullData = pt2.fullData; var pointIndex = pt2.pointIndex; var pointIndices = pt2.pointIndices; if (pointIndices) { [].push.apply(data.selectedpoints, pointIndices); if (trace._fullInput !== trace) { [].push.apply(fullData.selectedpoints, pointIndices); } } else { data.selectedpoints.push(pointIndex); if (trace._fullInput !== trace) { fullData.selectedpoints.push(pointIndex); } } } } else { for (i = 0; i < searchTraces.length; i++) { trace = searchTraces[i].cd[0].trace; delete trace.selectedpoints; delete trace._input.selectedpoints; if (trace._fullInput !== trace) { delete trace._fullInput.selectedpoints; } } } updateReglSelectedState(gd2, searchTraces); } function updateReglSelectedState(gd2, searchTraces) { var hasRegl = false; for (var i = 0; i < searchTraces.length; i++) { var searchInfo = searchTraces[i]; var cd2 = searchInfo.cd; if (Registry.traceIs(cd2[0].trace, "regl")) { hasRegl = true; } var _module = searchInfo._module; var fn = _module.styleOnSelect || _module.style; if (fn) { fn(gd2, cd2, cd2[0].node3); if (cd2[0].nodeRangePlot3) fn(gd2, cd2, cd2[0].nodeRangePlot3); } } if (hasRegl) { clearGlCanvases(gd2); redrawReglTraces(gd2); } } function mergePolygons(list, poly, subtract) { var fn = subtract ? polybool.difference : polybool.union; var res = fn({ regions: list }, { regions: [poly] }); var allPolygons = res.regions.reverse(); for (var i = 0; i < allPolygons.length; i++) { var polygon = allPolygons[i]; polygon.subtract = getSubtract(polygon, allPolygons.slice(0, i)); } return allPolygons; } function fillSelectionItem(selection, searchInfo) { if (Array.isArray(selection)) { var cd2 = searchInfo.cd; var trace = searchInfo.cd[0].trace; for (var i = 0; i < selection.length; i++) { selection[i] = makeEventData(selection[i], trace, cd2); } } return selection; } function convertPoly(polygonsIn, isOpenMode) { var polygonsOut = []; for (var i = 0; i < polygonsIn.length; i++) { polygonsOut[i] = []; for (var j = 0; j < polygonsIn[i].length; j++) { polygonsOut[i][j] = []; polygonsOut[i][j][0] = j ? "L" : "M"; for (var k = 0; k < polygonsIn[i][j].length; k++) { polygonsOut[i][j].push( polygonsIn[i][j][k] ); } } if (!isOpenMode) { polygonsOut[i].push([ "Z", polygonsOut[i][0][1], // initial x polygonsOut[i][0][2] // initial y ]); } } return polygonsOut; } function _doSelect(selectionTesters, searchTraces) { var allSelections = []; var thisSelection; var traceSelections = []; var traceSelection; for (var i = 0; i < searchTraces.length; i++) { var searchInfo = searchTraces[i]; traceSelection = searchInfo._module.selectPoints(searchInfo, selectionTesters); traceSelections.push(traceSelection); thisSelection = fillSelectionItem(traceSelection, searchInfo); allSelections = allSelections.concat(thisSelection); } return allSelections; } function reselect(gd2, mayEmitSelected, selectionTesters, searchTraces, dragOptions) { var hadSearchTraces = !!searchTraces; var plotinfo, xRef, yRef; if (dragOptions) { plotinfo = dragOptions.plotinfo; xRef = dragOptions.xaxes[0]._id; yRef = dragOptions.yaxes[0]._id; } var allSelections = []; var allSearchTraces = []; var layoutPolygons = getLayoutPolygons(gd2); var fullLayout = gd2._fullLayout; if (plotinfo) { var zoomLayer = fullLayout._zoomlayer; var mode = fullLayout.dragmode; var isDrawMode = drawMode(mode); var isSelectMode = selectMode(mode); if (isDrawMode || isSelectMode) { var xaxis = getFromId(gd2, xRef, "x"); var yaxis = getFromId(gd2, yRef, "y"); if (xaxis && yaxis) { var outlines = zoomLayer.selectAll(".select-outline-" + plotinfo.id); if (outlines && gd2._fullLayout._outlining) { if (outlines.length) { var e = outlines[0][0]; var d = e.getAttribute("d"); var outlinePolys = readPaths(d, gd2, plotinfo); var draftPolygons = []; for (var u = 0; u < outlinePolys.length; u++) { var p = outlinePolys[u]; var polygon = []; for (var t = 0; t < p.length; t++) { polygon.push([ convert(xaxis, p[t][1]), convert(yaxis, p[t][2]) ]); } polygon.xref = xRef; polygon.yref = yRef; polygon.subtract = getSubtract(polygon, draftPolygons); draftPolygons.push(polygon); } layoutPolygons = layoutPolygons.concat(draftPolygons); } } } } } var subplots = xRef && yRef ? [xRef + yRef] : fullLayout._subplots.cartesian; epmtySplomSelectionBatch(gd2); var seenSplom = {}; for (var i = 0; i < subplots.length; i++) { var subplot = subplots[i]; var yAt = subplot.indexOf("y"); var _xRef = subplot.slice(0, yAt); var _yRef = subplot.slice(yAt); var _selectionTesters = xRef && yRef ? selectionTesters : void 0; _selectionTesters = addTester(layoutPolygons, _xRef, _yRef, _selectionTesters); if (_selectionTesters) { var _searchTraces = searchTraces; if (!hadSearchTraces) { var _xA = getFromId(gd2, _xRef, "x"); var _yA = getFromId(gd2, _yRef, "y"); _searchTraces = determineSearchTraces( gd2, [_xA], [_yA], subplot ); for (var w = 0; w < _searchTraces.length; w++) { var s = _searchTraces[w]; var cd0 = s.cd[0]; var trace = cd0.trace; if (s._module.name === "scattergl" && !cd0.t.xpx) { var x = trace.x; var y = trace.y; var len = trace._length; cd0.t.xpx = []; cd0.t.ypx = []; for (var j = 0; j < len; j++) { cd0.t.xpx[j] = _xA.c2p(x[j]); cd0.t.ypx[j] = _yA.c2p(y[j]); } } if (s._module.name === "splom") { if (!seenSplom[trace.uid]) { seenSplom[trace.uid] = true; } } } } var selection = _doSelect(_selectionTesters, _searchTraces); allSelections = allSelections.concat(selection); allSearchTraces = allSearchTraces.concat(_searchTraces); } } var eventData = { points: allSelections }; updateSelectedState(gd2, allSearchTraces, eventData); var clickmode = fullLayout.clickmode; var sendEvents = clickmode.indexOf("event") > -1 && mayEmitSelected; if (!plotinfo && // get called from plot_api & plots mayEmitSelected) { var activePolygons = getLayoutPolygons(gd2, true); if (activePolygons.length) { var xref = activePolygons[0].xref; var yref = activePolygons[0].yref; if (xref && yref) { var poly = castMultiPolygon(activePolygons); var fillRangeItems = makeFillRangeItems([ getFromId(gd2, xref, "x"), getFromId(gd2, yref, "y") ]); fillRangeItems(eventData, poly); } } if (gd2._fullLayout._noEmitSelectedAtStart) { gd2._fullLayout._noEmitSelectedAtStart = false; } else { if (sendEvents) emitSelected(gd2, eventData); } fullLayout._reselect = false; } if (!plotinfo && // get called from plot_api & plots fullLayout._deselect) { var deselect = fullLayout._deselect; xRef = deselect.xref; yRef = deselect.yref; if (!subplotSelected(xRef, yRef, allSearchTraces)) { deselectSubplot(gd2, xRef, yRef, searchTraces); } if (sendEvents) { if (eventData.points.length) { emitSelected(gd2, eventData); } else { emitDeselect(gd2); } } fullLayout._deselect = false; } return { eventData, selectionTesters }; } function epmtySplomSelectionBatch(gd2) { var cd2 = gd2.calcdata; if (!cd2) return; for (var i = 0; i < cd2.length; i++) { var cd0 = cd2[i][0]; var trace = cd0.trace; var splomScenes = gd2._fullLayout._splomScenes; if (splomScenes) { var scene = splomScenes[trace.uid]; if (scene) { scene.selectBatch = []; } } } } function subplotSelected(xRef, yRef, searchTraces) { for (var i = 0; i < searchTraces.length; i++) { var s = searchTraces[i]; if (s.xaxis && s.xaxis._id === xRef && (s.yaxis && s.yaxis._id === yRef)) { return true; } } return false; } function deselectSubplot(gd2, xRef, yRef, searchTraces) { searchTraces = determineSearchTraces( gd2, [getFromId(gd2, xRef, "x")], [getFromId(gd2, yRef, "y")], xRef + yRef ); for (var k = 0; k < searchTraces.length; k++) { var searchInfo = searchTraces[k]; searchInfo._module.selectPoints(searchInfo, false); } updateSelectedState(gd2, searchTraces); } function addTester(layoutPolygons, xRef, yRef, selectionTesters) { var mergedPolygons; for (var i = 0; i < layoutPolygons.length; i++) { var currentPolygon = layoutPolygons[i]; if (xRef !== currentPolygon.xref || yRef !== currentPolygon.yref) continue; if (mergedPolygons) { var subtract = !!currentPolygon.subtract; mergedPolygons = mergePolygons(mergedPolygons, currentPolygon, subtract); selectionTesters = multiTester(mergedPolygons); } else { mergedPolygons = [currentPolygon]; selectionTesters = polygonTester(currentPolygon); } } return selectionTesters; } function getLayoutPolygons(gd2, onlyActiveOnes) { var allPolygons = []; var fullLayout = gd2._fullLayout; var allSelections = fullLayout.selections; var len = allSelections.length; for (var i = 0; i < len; i++) { if (onlyActiveOnes && i !== fullLayout._activeSelectionIndex) continue; var selection = allSelections[i]; if (!selection) continue; var xref = selection.xref; var yref = selection.yref; var xaxis = getFromId(gd2, xref, "x"); var yaxis = getFromId(gd2, yref, "y"); var xmin, xmax, ymin, ymax; var polygon; if (selection.type === "rect") { polygon = []; var x02 = convert(xaxis, selection.x0); var x12 = convert(xaxis, selection.x1); var y02 = convert(yaxis, selection.y0); var y12 = convert(yaxis, selection.y1); polygon = [[x02, y02], [x02, y12], [x12, y12], [x12, y02]]; xmin = Math.min(x02, x12); xmax = Math.max(x02, x12); ymin = Math.min(y02, y12); ymax = Math.max(y02, y12); polygon.xmin = xmin; polygon.xmax = xmax; polygon.ymin = ymin; polygon.ymax = ymax; polygon.xref = xref; polygon.yref = yref; polygon.subtract = false; polygon.isRect = true; allPolygons.push(polygon); } else if (selection.type === "path") { var segments = selection.path.split("Z"); var multiPolygons = []; for (var j = 0; j < segments.length; j++) { var path = segments[j]; if (!path) continue; path += "Z"; var allX = shapeHelpers.extractPathCoords(path, shapeConstants.paramIsX, "raw"); var allY = shapeHelpers.extractPathCoords(path, shapeConstants.paramIsY, "raw"); xmin = Infinity; xmax = -Infinity; ymin = Infinity; ymax = -Infinity; polygon = []; for (var k = 0; k < allX.length; k++) { var x = convert(xaxis, allX[k]); var y = convert(yaxis, allY[k]); polygon.push([x, y]); xmin = Math.min(x, xmin); xmax = Math.max(x, xmax); ymin = Math.min(y, ymin); ymax = Math.max(y, ymax); } polygon.xmin = xmin; polygon.xmax = xmax; polygon.ymin = ymin; polygon.ymax = ymax; polygon.xref = xref; polygon.yref = yref; polygon.subtract = getSubtract(polygon, multiPolygons); multiPolygons.push(polygon); allPolygons.push(polygon); } } } return allPolygons; } function getSubtract(polygon, previousPolygons) { var subtract = false; for (var i = 0; i < previousPolygons.length; i++) { var previousPolygon = previousPolygons[i]; for (var k = 0; k < polygon.length; k++) { if (pointInPolygon(polygon[k], previousPolygon)) { subtract = !subtract; break; } } } return subtract; } function convert(ax, d) { if (ax.type === "date") d = d.replace("_", " "); return ax.type === "log" ? ax.c2p(d) : ax.r2p(d, null, ax.calendar); } function castMultiPolygon(allPolygons) { var len = allPolygons.length; var p = []; for (var i = 0; i < len; i++) { var polygon = allPolygons[i]; p = p.concat(polygon); p = p.concat([polygon[0]]); } return computeRectAndRanges(p); } function computeRectAndRanges(poly) { poly.isRect = poly.length === 5 && poly[0][0] === poly[4][0] && poly[0][1] === poly[4][1] && (poly[0][0] === poly[1][0] && poly[2][0] === poly[3][0] && poly[0][1] === poly[3][1] && poly[1][1] === poly[2][1]) || poly[0][1] === poly[1][1] && poly[2][1] === poly[3][1] && poly[0][0] === poly[3][0] && poly[1][0] === poly[2][0]; if (poly.isRect) { poly.xmin = Math.min(poly[0][0], poly[2][0]); poly.xmax = Math.max(poly[0][0], poly[2][0]); poly.ymin = Math.min(poly[0][1], poly[2][1]); poly.ymax = Math.max(poly[0][1], poly[2][1]); } return poly; } function makeFillRangeItems(allAxes) { return function(eventData, poly) { var range; var lassoPoints; for (var i = 0; i < allAxes.length; i++) { var ax = allAxes[i]; var id2 = ax._id; var axLetter = id2.charAt(0); if (poly.isRect) { if (!range) range = {}; var min = poly[axLetter + "min"]; var max = poly[axLetter + "max"]; if (min !== void 0 && max !== void 0) { range[id2] = [ p2r(ax, min), p2r(ax, max) ].sort(ascending); } } else { if (!lassoPoints) lassoPoints = {}; lassoPoints[id2] = poly.map(axValue(ax)); } } if (range) { eventData.range = range; } if (lassoPoints) { eventData.lassoPoints = lassoPoints; } }; } function getFillRangeItems(dragOptions) { var plotinfo = dragOptions.plotinfo; return plotinfo.fillRangeItems || // allow subplots (i.e. geo, mapbox, map, sankey) to override fillRangeItems routine makeFillRangeItems(dragOptions.xaxes.concat(dragOptions.yaxes)); } function emitSelecting(gd2, eventData) { gd2.emit("plotly_selecting", eventData); } function emitSelected(gd2, eventData) { if (eventData) { eventData.selections = (gd2.layout || {}).selections || []; } gd2.emit("plotly_selected", eventData); } function emitDeselect(gd2) { gd2.emit("plotly_deselect", null); } module2.exports = { reselect, prepSelect, clearOutline, clearSelectionsCache, selectOnClick }; } }); // node_modules/plotly.js/src/components/annotations/arrow_paths.js var require_arrow_paths = __commonJS({ "node_modules/plotly.js/src/components/annotations/arrow_paths.js"(exports2, module2) { "use strict"; module2.exports = [ // no arrow { path: "", backoff: 0 }, // wide with flat back { path: "M-2.4,-3V3L0.6,0Z", backoff: 0.6 }, // narrower with flat back { path: "M-3.7,-2.5V2.5L1.3,0Z", backoff: 1.3 }, // barbed { path: "M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z", backoff: 1.55 }, // wide line-drawn { path: "M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z", backoff: 1.6 }, // narrower line-drawn { path: "M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z", backoff: 2 }, // circle { path: "M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z", backoff: 0, noRotate: true }, // square { path: "M2,2V-2H-2V2Z", backoff: 0, noRotate: true } ]; } }); // node_modules/plotly.js/src/constants/axis_placeable_objects.js var require_axis_placeable_objects = __commonJS({ "node_modules/plotly.js/src/constants/axis_placeable_objects.js"(exports2, module2) { "use strict"; module2.exports = { axisRefDescription: function(axisname, lower, upper) { return [ "If set to a", axisname, "axis id (e.g. *" + axisname + "* or", "*" + axisname + "2*), the `" + axisname + "` position refers to a", axisname, "coordinate. If set to *paper*, the `" + axisname + "`", "position refers to the distance from the", lower, "of the plotting", "area in normalized coordinates where *0* (*1*) corresponds to the", lower, "(" + upper + "). If set to a", axisname, "axis ID followed by", "*domain* (separated by a space), the position behaves like for", "*paper*, but refers to the distance in fractions of the domain", "length from the", lower, "of the domain of that axis: e.g.,", "*" + axisname + "2 domain* refers to the domain of the second", axisname, " axis and a", axisname, "position of 0.5 refers to the", "point between the", lower, "and the", upper, "of the domain of the", "second", axisname, "axis." ].join(" "); } }; } }); // node_modules/plotly.js/src/components/annotations/attributes.js var require_attributes11 = __commonJS({ "node_modules/plotly.js/src/components/annotations/attributes.js"(exports2, module2) { "use strict"; var ARROWPATHS = require_arrow_paths(); var fontAttrs = require_font_attributes(); var cartesianConstants = require_constants2(); var templatedArray = require_plot_template().templatedArray; var axisPlaceableObjs = require_axis_placeable_objects(); function arrowAxisRefDescription(axis) { return [ "In order for absolute positioning of the arrow to work, *a" + axis + "ref* must be exactly the same as *" + axis + "ref*, otherwise *a" + axis + "ref* will revert to *pixel* (explained next).", "For relative positioning, *a" + axis + "ref* can be set to *pixel*,", "in which case the *a" + axis + "* value is specified in pixels", "relative to *" + axis + "*.", "Absolute positioning is useful", "for trendline annotations which should continue to indicate", "the correct trend when zoomed. Relative positioning is useful", "for specifying the text offset for an annotated point." ].join(" "); } function arrowCoordinateDescription(axis, lower, upper) { return [ "Sets the", axis, "component of the arrow tail about the arrow head.", "If `a" + axis + "ref` is `pixel`, a positive (negative)", "component corresponds to an arrow pointing", "from", upper, "to", lower, "(" + lower, "to", upper + ").", "If `a" + axis + "ref` is not `pixel` and is exactly the same as `" + axis + "ref`,", "this is an absolute value on that axis,", "like `" + axis + "`, specified in the same coordinates as `" + axis + "ref`." ].join(" "); } module2.exports = templatedArray("annotation", { visible: { valType: "boolean", dflt: true, editType: "calc+arraydraw", description: [ "Determines whether or not this annotation is visible." ].join(" ") }, text: { valType: "string", editType: "calc+arraydraw", description: [ "Sets the text associated with this annotation.", "Plotly uses a subset of HTML tags to do things like", "newline (
), bold (), italics (),", "hyperlinks (). Tags , , , , ", " are also supported." ].join(" ") }, textangle: { valType: "angle", dflt: 0, editType: "calc+arraydraw", description: [ "Sets the angle at which the `text` is drawn", "with respect to the horizontal." ].join(" ") }, font: fontAttrs({ editType: "calc+arraydraw", colorEditType: "arraydraw", description: "Sets the annotation text font." }), width: { valType: "number", min: 1, dflt: null, editType: "calc+arraydraw", description: [ "Sets an explicit width for the text box. null (default) lets the", "text set the box width. Wider text will be clipped.", "There is no automatic wrapping; use
to start a new line." ].join(" ") }, height: { valType: "number", min: 1, dflt: null, editType: "calc+arraydraw", description: [ "Sets an explicit height for the text box. null (default) lets the", "text set the box height. Taller text will be clipped." ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw", description: "Sets the opacity of the annotation (text + arrow)." }, align: { valType: "enumerated", values: ["left", "center", "right"], dflt: "center", editType: "arraydraw", description: [ "Sets the horizontal alignment of the `text` within the box.", "Has an effect only if `text` spans two or more lines", "(i.e. `text` contains one or more
HTML tags) or if an", "explicit width is set to override the text width." ].join(" ") }, valign: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "middle", editType: "arraydraw", description: [ "Sets the vertical alignment of the `text` within the box.", "Has an effect only if an explicit height is set to override", "the text height." ].join(" ") }, bgcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw", description: "Sets the background color of the annotation." }, bordercolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw", description: [ "Sets the color of the border enclosing the annotation `text`." ].join(" ") }, borderpad: { valType: "number", min: 0, dflt: 1, editType: "calc+arraydraw", description: [ "Sets the padding (in px) between the `text`", "and the enclosing border." ].join(" ") }, borderwidth: { valType: "number", min: 0, dflt: 1, editType: "calc+arraydraw", description: [ "Sets the width (in px) of the border enclosing", "the annotation `text`." ].join(" ") }, // arrow showarrow: { valType: "boolean", dflt: true, editType: "calc+arraydraw", description: [ "Determines whether or not the annotation is drawn with an arrow.", "If *true*, `text` is placed near the arrow's tail.", "If *false*, `text` lines up with the `x` and `y` provided." ].join(" ") }, arrowcolor: { valType: "color", editType: "arraydraw", description: "Sets the color of the annotation arrow." }, arrowhead: { valType: "integer", min: 0, max: ARROWPATHS.length, dflt: 1, editType: "arraydraw", description: "Sets the end annotation arrow head style." }, startarrowhead: { valType: "integer", min: 0, max: ARROWPATHS.length, dflt: 1, editType: "arraydraw", description: "Sets the start annotation arrow head style." }, arrowside: { valType: "flaglist", flags: ["end", "start"], extras: ["none"], dflt: "end", editType: "arraydraw", description: "Sets the annotation arrow head position." }, arrowsize: { valType: "number", min: 0.3, dflt: 1, editType: "calc+arraydraw", description: [ "Sets the size of the end annotation arrow head, relative to `arrowwidth`.", "A value of 1 (default) gives a head about 3x as wide as the line." ].join(" ") }, startarrowsize: { valType: "number", min: 0.3, dflt: 1, editType: "calc+arraydraw", description: [ "Sets the size of the start annotation arrow head, relative to `arrowwidth`.", "A value of 1 (default) gives a head about 3x as wide as the line." ].join(" ") }, arrowwidth: { valType: "number", min: 0.1, editType: "calc+arraydraw", description: "Sets the width (in px) of annotation arrow line." }, standoff: { valType: "number", min: 0, dflt: 0, editType: "calc+arraydraw", description: [ "Sets a distance, in pixels, to move the end arrowhead away from the", "position it is pointing at, for example to point at the edge of", "a marker independent of zoom. Note that this shortens the arrow", "from the `ax` / `ay` vector, in contrast to `xshift` / `yshift`", "which moves everything by this amount." ].join(" ") }, startstandoff: { valType: "number", min: 0, dflt: 0, editType: "calc+arraydraw", description: [ "Sets a distance, in pixels, to move the start arrowhead away from the", "position it is pointing at, for example to point at the edge of", "a marker independent of zoom. Note that this shortens the arrow", "from the `ax` / `ay` vector, in contrast to `xshift` / `yshift`", "which moves everything by this amount." ].join(" ") }, ax: { valType: "any", editType: "calc+arraydraw", description: [ arrowCoordinateDescription("x", "left", "right") ].join(" ") }, ay: { valType: "any", editType: "calc+arraydraw", description: [ arrowCoordinateDescription("y", "top", "bottom") ].join(" ") }, axref: { valType: "enumerated", dflt: "pixel", values: [ "pixel", cartesianConstants.idRegex.x.toString() ], editType: "calc", description: [ "Indicates in what coordinates the tail of the", "annotation (ax,ay) is specified.", axisPlaceableObjs.axisRefDescription("x", "left", "right"), arrowAxisRefDescription("x") ].join(" ") }, ayref: { valType: "enumerated", dflt: "pixel", values: [ "pixel", cartesianConstants.idRegex.y.toString() ], editType: "calc", description: [ "Indicates in what coordinates the tail of the", "annotation (ax,ay) is specified.", axisPlaceableObjs.axisRefDescription("y", "bottom", "top"), arrowAxisRefDescription("y") ].join(" ") }, // positioning xref: { valType: "enumerated", values: [ "paper", cartesianConstants.idRegex.x.toString() ], editType: "calc", description: [ "Sets the annotation's x coordinate axis.", axisPlaceableObjs.axisRefDescription("x", "left", "right") ].join(" ") }, x: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the annotation's x position.", "If the axis `type` is *log*, then you must take the", "log of your desired range.", "If the axis `type` is *date*, it should be date strings,", "like date data, though Date objects and unix milliseconds", "will be accepted and converted to strings.", "If the axis `type` is *category*, it should be numbers,", "using the scale where each category is assigned a serial", "number from zero in the order it appears." ].join(" ") }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "auto", editType: "calc+arraydraw", description: [ "Sets the text box's horizontal position anchor", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the annotation.", "For example, if `x` is set to 1, `xref` to *paper* and", "`xanchor` to *right* then the right-most portion of the", "annotation lines up with the right-most edge of the", "plotting area.", "If *auto*, the anchor is equivalent to *center* for", "data-referenced annotations or if there is an arrow,", "whereas for paper-referenced with no arrow, the anchor picked", "corresponds to the closest side." ].join(" ") }, xshift: { valType: "number", dflt: 0, editType: "calc+arraydraw", description: [ "Shifts the position of the whole annotation and arrow to the", "right (positive) or left (negative) by this many pixels." ].join(" ") }, yref: { valType: "enumerated", values: [ "paper", cartesianConstants.idRegex.y.toString() ], editType: "calc", description: [ "Sets the annotation's y coordinate axis.", axisPlaceableObjs.axisRefDescription("y", "bottom", "top") ].join(" ") }, y: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the annotation's y position.", "If the axis `type` is *log*, then you must take the", "log of your desired range.", "If the axis `type` is *date*, it should be date strings,", "like date data, though Date objects and unix milliseconds", "will be accepted and converted to strings.", "If the axis `type` is *category*, it should be numbers,", "using the scale where each category is assigned a serial", "number from zero in the order it appears." ].join(" ") }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "auto", editType: "calc+arraydraw", description: [ "Sets the text box's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the annotation.", "For example, if `y` is set to 1, `yref` to *paper* and", "`yanchor` to *top* then the top-most portion of the", "annotation lines up with the top-most edge of the", "plotting area.", "If *auto*, the anchor is equivalent to *middle* for", "data-referenced annotations or if there is an arrow,", "whereas for paper-referenced with no arrow, the anchor picked", "corresponds to the closest side." ].join(" ") }, yshift: { valType: "number", dflt: 0, editType: "calc+arraydraw", description: [ "Shifts the position of the whole annotation and arrow up", "(positive) or down (negative) by this many pixels." ].join(" ") }, clicktoshow: { valType: "enumerated", values: [false, "onoff", "onout"], dflt: false, editType: "arraydraw", description: [ "Makes this annotation respond to clicks on the plot.", "If you click a data point that exactly matches the `x` and `y`", "values of this annotation, and it is hidden (visible: false),", "it will appear. In *onoff* mode, you must click the same point", "again to make it disappear, so if you click multiple points,", "you can show multiple annotations. In *onout* mode, a click", "anywhere else in the plot (on another data point or not) will", "hide this annotation.", "If you need to show/hide this annotation in response to different", "`x` or `y` values, you can set `xclick` and/or `yclick`. This is", "useful for example to label the side of a bar. To label markers", "though, `standoff` is preferred over `xclick` and `yclick`." ].join(" ") }, xclick: { valType: "any", editType: "arraydraw", description: [ "Toggle this annotation when clicking a data point whose `x` value", "is `xclick` rather than the annotation's `x` value." ].join(" ") }, yclick: { valType: "any", editType: "arraydraw", description: [ "Toggle this annotation when clicking a data point whose `y` value", "is `yclick` rather than the annotation's `y` value." ].join(" ") }, hovertext: { valType: "string", editType: "arraydraw", description: [ "Sets text to appear when hovering over this annotation.", "If omitted or blank, no hover label will appear." ].join(" ") }, hoverlabel: { bgcolor: { valType: "color", editType: "arraydraw", description: [ "Sets the background color of the hover label.", "By default uses the annotation's `bgcolor` made opaque,", "or white if it was transparent." ].join(" ") }, bordercolor: { valType: "color", editType: "arraydraw", description: [ "Sets the border color of the hover label.", "By default uses either dark grey or white, for maximum", "contrast with `hoverlabel.bgcolor`." ].join(" ") }, font: fontAttrs({ editType: "arraydraw", description: [ "Sets the hover label text font.", "By default uses the global hover font and size,", "with color from `hoverlabel.bordercolor`." ].join(" ") }), editType: "arraydraw" }, captureevents: { valType: "boolean", editType: "arraydraw", description: [ "Determines whether the annotation text box captures mouse move", "and click events, or allows those events to pass through to data", "points in the plot that may be behind the annotation. By default", "`captureevents` is *false* unless `hovertext` is provided.", "If you use the event `plotly_clickannotation` without `hovertext`", "you must explicitly enable `captureevents`." ].join(" ") }, editType: "calc", _deprecated: { ref: { valType: "string", editType: "calc", description: [ "Obsolete. Set `xref` and `yref` separately instead." ].join(" ") } } }); } }); // node_modules/plotly.js/src/traces/scatter/constants.js var require_constants8 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/constants.js"(exports2, module2) { "use strict"; module2.exports = { PTS_LINESONLY: 20, // fixed parameters of clustering and clipping algorithms // fraction of clustering tolerance "so close we don't even consider it a new point" minTolerance: 0.2, // how fast does clustering tolerance increase as you get away from the visible region toleranceGrowth: 10, // number of viewport sizes away from the visible region // at which we clip all lines to the perimeter maxScreensAway: 20, eventDataKeys: [] }; } }); // node_modules/plotly.js/src/traces/scatter/fillcolor_attribute.js var require_fillcolor_attribute = __commonJS({ "node_modules/plotly.js/src/traces/scatter/fillcolor_attribute.js"(exports2, module2) { "use strict"; module2.exports = function makeFillcolorAttr(hasFillgradient) { return { valType: "color", editType: "style", anim: true, description: [ "Sets the fill color.", "Defaults to a half-transparent variant of the line color,", "marker color, or marker line color, whichever is available." + (hasFillgradient ? " If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any." : "") ].join(" ") }; }; } }); // node_modules/plotly.js/src/traces/scatter/attributes.js var require_attributes12 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/attributes.js"(exports2, module2) { "use strict"; var axisHoverFormat = require_axis_format_attributes().axisHoverFormat; var texttemplateAttrs = require_template_attributes().texttemplateAttrs; var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs; var colorScaleAttrs = require_attributes8(); var fontAttrs = require_font_attributes(); var dash = require_attributes4().dash; var pattern = require_attributes4().pattern; var Drawing = require_drawing(); var constants = require_constants8(); var extendFlat = require_extend().extendFlat; var makeFillcolorAttr = require_fillcolor_attribute(); function axisPeriod(axis) { return { valType: "any", dflt: 0, editType: "calc", description: [ "Only relevant when the axis `type` is *date*.", "Sets the period positioning in milliseconds or *M* on the " + axis + " axis.", "Special values in the form of *M* could be used to declare", "the number of months. In this case `n` must be a positive integer." ].join(" ") }; } function axisPeriod0(axis) { return { valType: "any", editType: "calc", description: [ "Only relevant when the axis `type` is *date*.", "Sets the base for period positioning in milliseconds or date string on the " + axis + " axis.", "When `" + axis + "period` is round number of weeks,", "the `" + axis + "period0` by default would be on a Sunday i.e. 2000-01-02,", "otherwise it would be at 2000-01-01." ].join(" ") }; } function axisPeriodAlignment(axis) { return { valType: "enumerated", values: [ "start", "middle", "end" ], dflt: "middle", editType: "calc", description: [ "Only relevant when the axis `type` is *date*.", "Sets the alignment of data points on the " + axis + " axis." ].join(" ") }; } module2.exports = { x: { valType: "data_array", editType: "calc+clearAxisTypes", anim: true, description: "Sets the x coordinates." }, x0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes", anim: true, description: [ "Alternate to `x`.", "Builds a linear space of x coordinates.", "Use with `dx`", "where `x0` is the starting coordinate and `dx` the step." ].join(" ") }, dx: { valType: "number", dflt: 1, editType: "calc", anim: true, description: [ "Sets the x coordinate step.", "See `x0` for more info." ].join(" ") }, y: { valType: "data_array", editType: "calc+clearAxisTypes", anim: true, description: "Sets the y coordinates." }, y0: { valType: "any", dflt: 0, editType: "calc+clearAxisTypes", anim: true, description: [ "Alternate to `y`.", "Builds a linear space of y coordinates.", "Use with `dy`", "where `y0` is the starting coordinate and `dy` the step." ].join(" ") }, dy: { valType: "number", dflt: 1, editType: "calc", anim: true, description: [ "Sets the y coordinate step.", "See `y0` for more info." ].join(" ") }, xperiod: axisPeriod("x"), yperiod: axisPeriod("y"), xperiod0: axisPeriod0("x0"), yperiod0: axisPeriod0("y0"), xperiodalignment: axisPeriodAlignment("x"), yperiodalignment: axisPeriodAlignment("y"), xhoverformat: axisHoverFormat("x"), yhoverformat: axisHoverFormat("y"), offsetgroup: { valType: "string", dflt: "", editType: "calc", description: [ "Set several traces linked to the same position axis", "or matching axes to the same", "offsetgroup where bars of the same position coordinate will line up." ].join(" ") }, alignmentgroup: { valType: "string", dflt: "", editType: "calc", description: [ "Set several traces linked to the same position axis", "or matching axes to the same", "alignmentgroup. This controls whether bars compute their positional", "range dependently or independently." ].join(" ") }, stackgroup: { valType: "string", dflt: "", editType: "calc", description: [ "Set several scatter traces (on the same subplot) to the same", "stackgroup in order to add their y values (or their x values if", "`orientation` is *h*). If blank or omitted this trace will not be", "stacked. Stacking also turns `fill` on by default, using *tonexty*", "(*tonextx*) if `orientation` is *h* (*v*) and sets the default", "`mode` to *lines* irrespective of point count.", "You can only stack on a numeric (linear or log) axis.", "Traces in a `stackgroup` will only fill to (or be filled to) other", "traces in the same group. With multiple `stackgroup`s or some", "traces stacked and some not, if fill-linked traces are not already", "consecutive, the later ones will be pushed down in the drawing order." ].join(" ") }, orientation: { valType: "enumerated", values: ["v", "h"], editType: "calc", description: [ "Only relevant in the following cases:", "1. when `scattermode` is set to *group*.", "2. when `stackgroup` is used, and only the first", "`orientation` found in the `stackgroup` will be used - including", "if `visible` is *legendonly* but not if it is `false`. Sets the", "stacking direction. With *v* (*h*), the y (x) values of subsequent", "traces are added. Also affects the default value of `fill`." ].join(" ") }, groupnorm: { valType: "enumerated", values: ["", "fraction", "percent"], dflt: "", editType: "calc", description: [ "Only relevant when `stackgroup` is used, and only the first", "`groupnorm` found in the `stackgroup` will be used - including", "if `visible` is *legendonly* but not if it is `false`.", "Sets the normalization for the sum of this `stackgroup`.", "With *fraction*, the value of each trace at each location is", "divided by the sum of all trace values at that location.", "*percent* is the same but multiplied by 100 to show percentages.", "If there are multiple subplots, or multiple `stackgroup`s on one", "subplot, each will be normalized within its own set." ].join(" ") }, stackgaps: { valType: "enumerated", values: ["infer zero", "interpolate"], dflt: "infer zero", editType: "calc", description: [ "Only relevant when `stackgroup` is used, and only the first", "`stackgaps` found in the `stackgroup` will be used - including", "if `visible` is *legendonly* but not if it is `false`.", "Determines how we handle locations at which other traces in this", "group have data but this one does not.", "With *infer zero* we insert a zero at these locations.", "With *interpolate* we linearly interpolate between existing", "values, and extrapolate a constant beyond the existing values." // TODO - implement interrupt mode // '*interrupt* omits this trace from the stack at this location by', // 'dropping abruptly, midway between the existing and missing locations.' ].join(" ") }, text: { valType: "string", dflt: "", arrayOk: true, editType: "calc", description: [ "Sets text elements associated with each (x,y) pair.", "If a single string, the same string appears over", "all the data points.", "If an array of string, the items are mapped in order to the", "this trace's (x,y) coordinates.", "If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,", "these elements will be seen in the hover labels." ].join(" ") }, texttemplate: texttemplateAttrs({}, {}), hovertext: { valType: "string", dflt: "", arrayOk: true, editType: "style", description: [ "Sets hover text elements associated with each (x,y) pair.", "If a single string, the same string appears over", "all the data points.", "If an array of string, the items are mapped in order to the", "this trace's (x,y) coordinates.", "To be seen, trace `hoverinfo` must contain a *text* flag." ].join(" ") }, mode: { valType: "flaglist", flags: ["lines", "markers", "text"], extras: ["none"], editType: "calc", description: [ "Determines the drawing mode for this scatter trace.", "If the provided `mode` includes *text* then the `text` elements", "appear at the coordinates. Otherwise, the `text` elements", "appear on hover.", "If there are less than " + constants.PTS_LINESONLY + " points", "and the trace is not stacked", "then the default is *lines+markers*. Otherwise, *lines*." ].join(" ") }, hoveron: { valType: "flaglist", flags: ["points", "fills"], editType: "style", description: [ "Do the hover effects highlight individual points (markers or", "line points) or do they highlight filled regions?", "If the fill is *toself* or *tonext* and there are no markers", "or text, then the default is *fills*, otherwise it is *points*." ].join(" ") }, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys }), line: { color: { valType: "color", editType: "style", anim: true, description: "Sets the line color." }, width: { valType: "number", min: 0, dflt: 2, editType: "style", anim: true, description: "Sets the line width (in px)." }, shape: { valType: "enumerated", values: ["linear", "spline", "hv", "vh", "hvh", "vhv"], dflt: "linear", editType: "plot", description: [ "Determines the line shape.", "With *spline* the lines are drawn using spline interpolation.", "The other available values correspond to step-wise line shapes." ].join(" ") }, smoothing: { valType: "number", min: 0, max: 1.3, dflt: 1, editType: "plot", description: [ "Has an effect only if `shape` is set to *spline*", "Sets the amount of smoothing.", "*0* corresponds to no smoothing (equivalent to a *linear* shape)." ].join(" ") }, dash: extendFlat({}, dash, { editType: "style" }), backoff: { // we want to have a similar option for the start of the line valType: "number", min: 0, dflt: "auto", arrayOk: true, editType: "plot", description: [ "Sets the line back off from the end point of the nth line segment (in px).", "This option is useful e.g. to avoid overlap with arrowhead markers.", "With *auto* the lines would trim before markers if `marker.angleref` is set to *previous*." ].join(" ") }, simplify: { valType: "boolean", dflt: true, editType: "plot", description: [ "Simplifies lines by removing nearly-collinear points. When transitioning", "lines, it may be desirable to disable this so that the number of points", "along the resulting SVG path is unaffected." ].join(" ") }, editType: "plot" }, connectgaps: { valType: "boolean", dflt: false, editType: "calc", description: [ "Determines whether or not gaps", "(i.e. {nan} or missing values)", "in the provided data arrays are connected." ].join(" ") }, cliponaxis: { valType: "boolean", dflt: true, editType: "plot", description: [ "Determines whether or not markers and text nodes", "are clipped about the subplot axes.", "To show markers and text nodes above axis lines and tick labels,", "make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*." ].join(" ") }, fill: { valType: "enumerated", values: ["none", "tozeroy", "tozerox", "tonexty", "tonextx", "toself", "tonext"], editType: "calc", description: [ "Sets the area to fill with a solid color.", "Defaults to *none* unless this trace is stacked, then it gets", "*tonexty* (*tonextx*) if `orientation` is *v* (*h*)", "Use with `fillcolor` if not *none*.", "*tozerox* and *tozeroy* fill to x=0 and y=0 respectively.", "*tonextx* and *tonexty* fill between the endpoints of this", "trace and the endpoints of the trace before it, connecting those", "endpoints with straight lines (to make a stacked area graph);", "if there is no trace before it, they behave like *tozerox* and", "*tozeroy*.", "*toself* connects the endpoints of the trace (or each segment", "of the trace if it has gaps) into a closed shape.", "*tonext* fills the space between two traces if one completely", "encloses the other (eg consecutive contour lines), and behaves like", "*toself* if there is no trace before it. *tonext* should not be", "used if one trace does not enclose the other.", "Traces in a `stackgroup` will only fill to (or be filled to) other", "traces in the same group. With multiple `stackgroup`s or some", "traces stacked and some not, if fill-linked traces are not already", "consecutive, the later ones will be pushed down in the drawing order." ].join(" ") }, fillcolor: makeFillcolorAttr(true), fillgradient: extendFlat({ type: { valType: "enumerated", values: ["radial", "horizontal", "vertical", "none"], dflt: "none", editType: "calc", description: [ "Sets the type/orientation of the color gradient for the fill.", "Defaults to *none*." ].join(" ") }, start: { valType: "number", editType: "calc", description: [ "Sets the gradient start value.", "It is given as the absolute position on the axis determined by", "the orientiation. E.g., if orientation is *horizontal*, the", "gradient will be horizontal and start from the x-position", "given by start. If omitted, the gradient starts at the lowest", "value of the trace along the respective axis.", "Ignored if orientation is *radial*." ].join(" ") }, stop: { valType: "number", editType: "calc", description: [ "Sets the gradient end value.", "It is given as the absolute position on the axis determined by", "the orientiation. E.g., if orientation is *horizontal*, the", "gradient will be horizontal and end at the x-position", "given by end. If omitted, the gradient ends at the highest", "value of the trace along the respective axis.", "Ignored if orientation is *radial*." ].join(" ") }, colorscale: { valType: "colorscale", editType: "style", description: [ "Sets the fill gradient colors as a color scale.", "The color scale is interpreted as a gradient", "applied in the direction specified by *orientation*,", "from the lowest to the highest value of the scatter", "plot along that axis, or from the center to the most", "distant point from it, if orientation is *radial*." ].join(" ") }, editType: "calc", description: [ "Sets a fill gradient.", "If not specified, the fillcolor is used instead." ].join(" ") }), fillpattern: pattern, marker: extendFlat( { symbol: { valType: "enumerated", values: Drawing.symbolList, dflt: "circle", arrayOk: true, editType: "style", description: [ "Sets the marker symbol type.", "Adding 100 is equivalent to appending *-open* to a symbol name.", "Adding 200 is equivalent to appending *-dot* to a symbol name.", "Adding 300 is equivalent to appending *-open-dot*", "or *dot-open* to a symbol name." ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, arrayOk: true, editType: "style", anim: true, description: "Sets the marker opacity." }, angle: { valType: "angle", dflt: 0, arrayOk: true, editType: "plot", anim: false, // TODO: possibly set to true in future description: [ "Sets the marker angle in respect to `angleref`." ].join(" ") }, angleref: { valType: "enumerated", values: ["previous", "up"], dflt: "up", editType: "plot", anim: false, description: [ "Sets the reference for marker angle.", "With *previous*, angle 0 points along the line from the previous point to this one.", "With *up*, angle 0 points toward the top of the screen." ].join(" ") }, standoff: { valType: "number", min: 0, dflt: 0, arrayOk: true, editType: "plot", anim: true, description: [ "Moves the marker away from the data point in the direction of `angle` (in px).", "This can be useful for example if you have another marker at this", "location and you want to point an arrowhead marker at it." ].join(" ") }, size: { valType: "number", min: 0, dflt: 6, arrayOk: true, editType: "calc", anim: true, description: "Sets the marker size (in px)." }, maxdisplayed: { valType: "number", min: 0, dflt: 0, editType: "plot", description: [ "Sets a maximum number of points to be drawn on the graph.", "*0* corresponds to no limit." ].join(" ") }, sizeref: { valType: "number", dflt: 1, editType: "calc", description: [ "Has an effect only if `marker.size` is set to a numerical array.", "Sets the scale factor used to determine the rendered size of", "marker points. Use with `sizemin` and `sizemode`." ].join(" ") }, sizemin: { valType: "number", min: 0, dflt: 0, editType: "calc", description: [ "Has an effect only if `marker.size` is set to a numerical array.", "Sets the minimum size (in px) of the rendered marker points." ].join(" ") }, sizemode: { valType: "enumerated", values: ["diameter", "area"], dflt: "diameter", editType: "calc", description: [ "Has an effect only if `marker.size` is set to a numerical array.", "Sets the rule for which the data in `size` is converted", "to pixels." ].join(" ") }, line: extendFlat( { width: { valType: "number", min: 0, arrayOk: true, editType: "style", anim: true, description: "Sets the width (in px) of the lines bounding the marker points." }, editType: "calc" }, colorScaleAttrs("marker.line", { anim: true }) ), gradient: { type: { valType: "enumerated", values: ["radial", "horizontal", "vertical", "none"], arrayOk: true, dflt: "none", editType: "calc", description: [ "Sets the type of gradient used to fill the markers" ].join(" ") }, color: { valType: "color", arrayOk: true, editType: "calc", description: [ "Sets the final color of the gradient fill:", "the center color for radial, the right for horizontal,", "or the bottom for vertical." ].join(" ") }, editType: "calc" }, editType: "calc" }, colorScaleAttrs("marker", { anim: true }) ), selected: { marker: { opacity: { valType: "number", min: 0, max: 1, editType: "style", description: "Sets the marker opacity of selected points." }, color: { valType: "color", editType: "style", description: "Sets the marker color of selected points." }, size: { valType: "number", min: 0, editType: "style", description: "Sets the marker size of selected points." }, editType: "style" }, textfont: { color: { valType: "color", editType: "style", description: "Sets the text font color of selected points." }, editType: "style" }, editType: "style" }, unselected: { marker: { opacity: { valType: "number", min: 0, max: 1, editType: "style", description: "Sets the marker opacity of unselected points, applied only when a selection exists." }, color: { valType: "color", editType: "style", description: "Sets the marker color of unselected points, applied only when a selection exists." }, size: { valType: "number", min: 0, editType: "style", description: "Sets the marker size of unselected points, applied only when a selection exists." }, editType: "style" }, textfont: { color: { valType: "color", editType: "style", description: "Sets the text font color of unselected points, applied only when a selection exists." }, editType: "style" }, editType: "style" }, textposition: { valType: "enumerated", values: [ "top left", "top center", "top right", "middle left", "middle center", "middle right", "bottom left", "bottom center", "bottom right" ], dflt: "middle center", arrayOk: true, editType: "calc", description: [ "Sets the positions of the `text` elements", "with respects to the (x,y) coordinates." ].join(" ") }, textfont: fontAttrs({ editType: "calc", colorEditType: "style", arrayOk: true, description: "Sets the text font." }), zorder: { valType: "integer", dflt: 0, editType: "plot", description: [ "Sets the layer on which this trace is displayed, relative to", "other SVG traces on the same subplot. SVG traces with higher `zorder`", "appear in front of those with lower `zorder`." ].join(" ") } }; } }); // node_modules/plotly.js/src/components/selections/attributes.js var require_attributes13 = __commonJS({ "node_modules/plotly.js/src/components/selections/attributes.js"(exports2, module2) { "use strict"; var annAttrs = require_attributes11(); var scatterLineAttrs = require_attributes12().line; var dash = require_attributes4().dash; var extendFlat = require_extend().extendFlat; var overrideAll = require_edit_types().overrideAll; var templatedArray = require_plot_template().templatedArray; var axisPlaceableObjs = require_axis_placeable_objects(); module2.exports = overrideAll(templatedArray("selection", { type: { valType: "enumerated", values: ["rect", "path"], description: [ "Specifies the selection type to be drawn.", "If *rect*, a rectangle is drawn linking", "(`x0`,`y0`), (`x1`,`y0`), (`x1`,`y1`) and (`x0`,`y1`).", "If *path*, draw a custom SVG path using `path`." ].join(" ") }, xref: extendFlat({}, annAttrs.xref, { description: [ "Sets the selection's x coordinate axis.", axisPlaceableObjs.axisRefDescription("x", "left", "right") ].join(" ") }), yref: extendFlat({}, annAttrs.yref, { description: [ "Sets the selection's x coordinate axis.", axisPlaceableObjs.axisRefDescription("y", "bottom", "top") ].join(" ") }), x0: { valType: "any", description: "Sets the selection's starting x position." }, x1: { valType: "any", description: "Sets the selection's end x position." }, y0: { valType: "any", description: "Sets the selection's starting y position." }, y1: { valType: "any", description: "Sets the selection's end y position." }, path: { valType: "string", editType: "arraydraw", description: [ "For `type` *path* - a valid SVG path similar to `shapes.path` in data coordinates.", "Allowed segments are: M, L and Z." ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, dflt: 0.7, editType: "arraydraw", description: "Sets the opacity of the selection." }, line: { color: scatterLineAttrs.color, width: extendFlat({}, scatterLineAttrs.width, { min: 1, dflt: 1 }), dash: extendFlat({}, dash, { dflt: "dot" }) } }), "arraydraw", "from-root"); } }); // node_modules/plotly.js/src/components/selections/defaults.js var require_defaults6 = __commonJS({ "node_modules/plotly.js/src/components/selections/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes13(); var helpers = require_helpers8(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, { name: "selections", handleItemDefaults: handleSelectionDefaults }); var selections = layoutOut.selections; for (var i = 0; i < selections.length; i++) { var selection = selections[i]; if (!selection) continue; if (selection.path === void 0) { if (selection.x0 === void 0 || selection.x1 === void 0 || selection.y0 === void 0 || selection.y1 === void 0) { layoutOut.selections[i] = null; } } } }; function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) { function coerce(attr, dflt) { return Lib.coerce(selectionIn, selectionOut, attributes, attr, dflt); } var path = coerce("path"); var dfltType = path ? "path" : "rect"; var selectionType = coerce("type", dfltType); var noPath = selectionType !== "path"; if (noPath) delete selectionOut.path; coerce("opacity"); coerce("line.color"); coerce("line.width"); coerce("line.dash"); var axLetters = ["x", "y"]; for (var i = 0; i < 2; i++) { var axLetter = axLetters[i]; var gdMock = { _fullLayout: fullLayout }; var ax; var pos2r; var r2pos; var axRef = Axes.coerceRef(selectionIn, selectionOut, gdMock, axLetter); ax = Axes.getFromId(gdMock, axRef); ax._selectionIndices.push(selectionOut._index); r2pos = helpers.rangeToShapePosition(ax); pos2r = helpers.shapePositionToRange(ax); if (noPath) { var attr0 = axLetter + "0"; var attr1 = axLetter + "1"; var in0 = selectionIn[attr0]; var in1 = selectionIn[attr1]; selectionIn[attr0] = pos2r(selectionIn[attr0], true); selectionIn[attr1] = pos2r(selectionIn[attr1], true); Axes.coercePosition(selectionOut, gdMock, coerce, axRef, attr0); Axes.coercePosition(selectionOut, gdMock, coerce, axRef, attr1); var p02 = selectionOut[attr0]; var p12 = selectionOut[attr1]; if (p02 !== void 0 && p12 !== void 0) { selectionOut[attr0] = r2pos(p02); selectionOut[attr1] = r2pos(p12); selectionIn[attr0] = in0; selectionIn[attr1] = in1; } } } if (noPath) { Lib.noneOrAll(selectionIn, selectionOut, ["x0", "x1", "y0", "y1"]); } } } }); // node_modules/plotly.js/src/components/selections/draw_newselection/defaults.js var require_defaults7 = __commonJS({ "node_modules/plotly.js/src/components/selections/draw_newselection/defaults.js"(exports2, module2) { "use strict"; module2.exports = function supplyDrawNewSelectionDefaults(layoutIn, layoutOut, coerce) { coerce("newselection.mode"); var newselectionLineWidth = coerce("newselection.line.width"); if (newselectionLineWidth) { coerce("newselection.line.color"); coerce("newselection.line.dash"); } coerce("activeselection.fillcolor"); coerce("activeselection.opacity"); }; } }); // node_modules/plotly.js/src/plots/cartesian/include_components.js var require_include_components = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/include_components.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var axisIds = require_axis_ids(); module2.exports = function makeIncludeComponents(containerArrayName) { return function includeComponents(layoutIn, layoutOut) { var array = layoutIn[containerArrayName]; if (!Array.isArray(array)) return; var Cartesian = Registry.subplotsRegistry.cartesian; var idRegex = Cartesian.idRegex; var subplots = layoutOut._subplots; var xaList = subplots.xaxis; var yaList = subplots.yaxis; var cartesianList = subplots.cartesian; var hasCartesianOrGL2D = layoutOut._has("cartesian") || layoutOut._has("gl2d"); for (var i = 0; i < array.length; i++) { var itemi = array[i]; if (!Lib.isPlainObject(itemi)) continue; var xref = axisIds.cleanId(itemi.xref, "x", false); var yref = axisIds.cleanId(itemi.yref, "y", false); var hasXref = idRegex.x.test(xref); var hasYref = idRegex.y.test(yref); if (hasXref || hasYref) { if (!hasCartesianOrGL2D) Lib.pushUnique(layoutOut._basePlotModules, Cartesian); var newAxis = false; if (hasXref && xaList.indexOf(xref) === -1) { xaList.push(xref); newAxis = true; } if (hasYref && yaList.indexOf(yref) === -1) { yaList.push(yref); newAxis = true; } if (newAxis && hasXref && hasYref) { cartesianList.push(xref + yref); } } } }; }; } }); // node_modules/plotly.js/src/components/selections/index.js var require_selections = __commonJS({ "node_modules/plotly.js/src/components/selections/index.js"(exports2, module2) { "use strict"; var drawModule = require_draw3(); var select = require_select(); module2.exports = { moduleType: "component", name: "selections", layoutAttributes: require_attributes13(), supplyLayoutDefaults: require_defaults6(), supplyDrawNewSelectionDefaults: require_defaults7(), includeBasePlot: require_include_components()("selections"), draw: drawModule.draw, drawOne: drawModule.drawOne, reselect: select.reselect, prepSelect: select.prepSelect, clearOutline: select.clearOutline, clearSelectionsCache: select.clearSelectionsCache, selectOnClick: select.selectOnClick }; } }); // node_modules/plotly.js/src/plots/cartesian/dragbox.js var require_dragbox = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/dragbox.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var numberFormat = Lib.numberFormat; var tinycolor = require_tinycolor(); var supportsPassive = require_has_passive_events(); var Registry = require_registry(); var strTranslate = Lib.strTranslate; var svgTextUtils = require_svg_text_utils(); var Color = require_color(); var Drawing = require_drawing(); var Fx = require_fx(); var Axes = require_axes(); var setCursor = require_setcursor(); var dragElement = require_dragelement(); var helpers = require_helpers5(); var selectingOrDrawing = helpers.selectingOrDrawing; var freeMode = helpers.freeMode; var FROM_TL = require_alignment().FROM_TL; var clearGlCanvases = require_clear_gl_canvases(); var redrawReglTraces = require_subroutines().redrawReglTraces; var Plots = require_plots(); var getFromId = require_axis_ids().getFromId; var prepSelect = require_selections().prepSelect; var clearOutline = require_selections().clearOutline; var selectOnClick = require_selections().selectOnClick; var scaleZoom = require_scale_zoom(); var constants = require_constants2(); var MINDRAG = constants.MINDRAG; var MINZOOM = constants.MINZOOM; var SHOWZOOMOUTTIP = true; function makeDragBox(gd2, plotinfo, x, y, w, h, ns2, ew) { var zoomlayer = gd2._fullLayout._zoomlayer; var isMainDrag = ns2 + ew === "nsew"; var singleEnd = (ns2 + ew).length === 1; var xa0, ya0; var xaHash, yaHash; var xaxes, yaxes; var xs2, ys2; var pw, ph2; var links; var matches; var xActive, yActive; var allFixedRanges; var editX, editY; var hasScatterGl, hasSplom, hasSVG; var updates; var scaleX; var scaleY; x += plotinfo.yaxis._shift; function recomputeAxisLists() { xa0 = plotinfo.xaxis; ya0 = plotinfo.yaxis; pw = xa0._length; ph2 = ya0._length; xs2 = xa0._offset; ys2 = ya0._offset; xaHash = {}; xaHash[xa0._id] = xa0; yaHash = {}; yaHash[ya0._id] = ya0; if (ns2 && ew) { var overlays = plotinfo.overlays; for (var i = 0; i < overlays.length; i++) { var xa2 = overlays[i].xaxis; xaHash[xa2._id] = xa2; var ya2 = overlays[i].yaxis; yaHash[ya2._id] = ya2; } } xaxes = hashValues(xaHash); yaxes = hashValues(yaHash); xActive = isDirectionActive(xaxes, ew); yActive = isDirectionActive(yaxes, ns2); allFixedRanges = !yActive && !xActive; matches = calcLinks(gd2, gd2._fullLayout._axisMatchGroups, xaHash, yaHash); links = calcLinks(gd2, gd2._fullLayout._axisConstraintGroups, xaHash, yaHash, matches); var spConstrained = links.isSubplotConstrained || matches.isSubplotConstrained; editX = ew || spConstrained; editY = ns2 || spConstrained; var fullLayout = gd2._fullLayout; hasScatterGl = fullLayout._has("scattergl"); hasSplom = fullLayout._has("splom"); hasSVG = fullLayout._has("svg"); } recomputeAxisLists(); var cursor = getDragCursor(yActive + xActive, gd2._fullLayout.dragmode, isMainDrag); var dragger = makeRectDragger(plotinfo, ns2 + ew + "drag", cursor, x, y, w, h); if (allFixedRanges && !isMainDrag) { dragger.onmousedown = null; dragger.style.pointerEvents = "none"; return dragger; } var dragOptions = { element: dragger, gd: gd2, plotinfo }; dragOptions.prepFn = function(e, startX, startY) { var dragModePrev = dragOptions.dragmode; var dragModeNow = gd2._fullLayout.dragmode; if (dragModeNow !== dragModePrev) { dragOptions.dragmode = dragModeNow; } recomputeAxisLists(); scaleX = gd2._fullLayout._invScaleX; scaleY = gd2._fullLayout._invScaleY; if (!allFixedRanges) { if (isMainDrag) { if (e.shiftKey) { if (dragModeNow === "pan") dragModeNow = "zoom"; else if (!selectingOrDrawing(dragModeNow)) dragModeNow = "pan"; } else if (e.ctrlKey) { dragModeNow = "pan"; } } else { dragModeNow = "pan"; } } if (freeMode(dragModeNow)) dragOptions.minDrag = 1; else dragOptions.minDrag = void 0; if (selectingOrDrawing(dragModeNow)) { dragOptions.xaxes = xaxes; dragOptions.yaxes = yaxes; prepSelect(e, startX, startY, dragOptions, dragModeNow); } else { dragOptions.clickFn = clickFn; if (selectingOrDrawing(dragModePrev)) { clearAndResetSelect(); } if (!allFixedRanges) { if (dragModeNow === "zoom") { dragOptions.moveFn = zoomMove; dragOptions.doneFn = zoomDone; dragOptions.minDrag = 1; zoomPrep(e, startX, startY); } else if (dragModeNow === "pan") { dragOptions.moveFn = plotDrag; dragOptions.doneFn = dragTail; } } } gd2._fullLayout._redrag = function() { var dragDataNow = gd2._dragdata; if (dragDataNow && dragDataNow.element === dragger) { var dragModeNow2 = gd2._fullLayout.dragmode; if (!selectingOrDrawing(dragModeNow2)) { recomputeAxisLists(); updateSubplots([0, 0, pw, ph2]); dragOptions.moveFn(dragDataNow.dx, dragDataNow.dy); } } }; }; function clearAndResetSelect() { dragOptions.plotinfo.selection = false; clearOutline(gd2); } function clickFn(numClicks, evt) { var gd3 = dragOptions.gd; if (gd3._fullLayout._activeShapeIndex >= 0) { gd3._fullLayout._deactivateShape(gd3); return; } var clickmode = gd3._fullLayout.clickmode; removeZoombox(gd3); if (numClicks === 2 && !singleEnd) doubleClick(); if (isMainDrag) { if (clickmode.indexOf("select") > -1) { selectOnClick(evt, gd3, xaxes, yaxes, plotinfo.id, dragOptions); } if (clickmode.indexOf("event") > -1) { Fx.click(gd3, evt, plotinfo.id); } } else if (numClicks === 1 && singleEnd) { var ax = ns2 ? ya0 : xa0; var end = ns2 === "s" || ew === "w" ? 0 : 1; var attrStr = ax._name + ".range[" + end + "]"; var initialText = getEndText(ax, end); var hAlign = "left"; var vAlign = "middle"; if (ax.fixedrange) return; if (ns2) { vAlign = ns2 === "n" ? "top" : "bottom"; if (ax.side === "right") hAlign = "right"; } else if (ew === "e") hAlign = "right"; if (gd3._context.showAxisRangeEntryBoxes) { d3.select(dragger).call(svgTextUtils.makeEditable, { gd: gd3, immediate: true, background: gd3._fullLayout.paper_bgcolor, text: String(initialText), fill: ax.tickfont ? ax.tickfont.color : "#444", horizontalAlign: hAlign, verticalAlign: vAlign }).on("edit", function(text) { var v = ax.d2r(text); if (v !== void 0) { Registry.call("_guiRelayout", gd3, attrStr, v); } }); } } } dragElement.init(dragOptions); var x02, y02; var box; var lum; var path0; var dimmed; var zoomMode; var zb; var corners; var zoomDragged; function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x02 = startX - dragBBox.left; y02 = startY - dragBBox.top; gd2._fullLayout._calcInverseTransform(gd2); var transformedCoords = Lib.apply3DTransform(gd2._fullLayout._invTransform)(x02, y02); x02 = transformedCoords[0]; y02 = transformedCoords[1]; box = { l: x02, r: x02, w: 0, t: y02, b: y02, h: 0 }; lum = gd2._hmpixcount ? gd2._hmlumcount / gd2._hmpixcount : tinycolor(gd2._fullLayout.plot_bgcolor).getLuminance(); path0 = "M0,0H" + pw + "V" + ph2 + "H0V0"; dimmed = false; zoomMode = "xy"; zoomDragged = false; zb = makeZoombox(zoomlayer, lum, xs2, ys2, path0); corners = makeCorners(zoomlayer, xs2, ys2); } function zoomMove(dx0, dy0) { if (gd2._transitioningWithDuration) { return false; } var x12 = Math.max(0, Math.min(pw, scaleX * dx0 + x02)); var y12 = Math.max(0, Math.min(ph2, scaleY * dy0 + y02)); var dx = Math.abs(x12 - x02); var dy = Math.abs(y12 - y02); box.l = Math.min(x02, x12); box.r = Math.max(x02, x12); box.t = Math.min(y02, y12); box.b = Math.max(y02, y12); function noZoom() { zoomMode = ""; box.r = box.l; box.t = box.b; corners.attr("d", "M0,0Z"); } if (links.isSubplotConstrained) { if (dx > MINZOOM || dy > MINZOOM) { zoomMode = "xy"; if (dx / pw > dy / ph2) { dy = dx * ph2 / pw; if (y02 > y12) box.t = y02 - dy; else box.b = y02 + dy; } else { dx = dy * pw / ph2; if (x02 > x12) box.l = x02 - dx; else box.r = x02 + dx; } corners.attr("d", xyCorners(box)); } else { noZoom(); } } else if (matches.isSubplotConstrained) { if (dx > MINZOOM || dy > MINZOOM) { zoomMode = "xy"; var r02 = Math.min(box.l / pw, (ph2 - box.b) / ph2); var r12 = Math.max(box.r / pw, (ph2 - box.t) / ph2); box.l = r02 * pw; box.r = r12 * pw; box.b = (1 - r02) * ph2; box.t = (1 - r12) * ph2; corners.attr("d", xyCorners(box)); } else { noZoom(); } } else if (!yActive || dy < Math.min(Math.max(dx * 0.6, MINDRAG), MINZOOM)) { if (dx < MINDRAG || !xActive) { noZoom(); } else { box.t = 0; box.b = ph2; zoomMode = "x"; corners.attr("d", xCorners(box, y02)); } } else if (!xActive || dx < Math.min(dy * 0.6, MINZOOM)) { box.l = 0; box.r = pw; zoomMode = "y"; corners.attr("d", yCorners(box, x02)); } else { zoomMode = "xy"; corners.attr("d", xyCorners(box)); } box.w = box.r - box.l; box.h = box.b - box.t; if (zoomMode) zoomDragged = true; gd2._dragged = zoomDragged; updateZoombox(zb, corners, box, path0, dimmed, lum); computeZoomUpdates(); gd2.emit("plotly_relayouting", updates); dimmed = true; } function computeZoomUpdates() { updates = {}; if (zoomMode === "xy" || zoomMode === "x") { zoomAxRanges(xaxes, box.l / pw, box.r / pw, updates, links.xaxes); updateMatchedAxRange("x", updates); } if (zoomMode === "xy" || zoomMode === "y") { zoomAxRanges(yaxes, (ph2 - box.b) / ph2, (ph2 - box.t) / ph2, updates, links.yaxes); updateMatchedAxRange("y", updates); } } function zoomDone() { computeZoomUpdates(); removeZoombox(gd2); dragTail(); showDoubleClickNotifier(gd2); } var scrollViewBox = [0, 0, pw, ph2]; var redrawTimer = null; var REDRAWDELAY = constants.REDRAWDELAY; var mainplot = plotinfo.mainplot ? gd2._fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { if (!gd2._context._scrollZoom.cartesian && !gd2._fullLayout._enablescrollzoom) { return; } clearAndResetSelect(); if (gd2._transitioningWithDuration) { e.preventDefault(); e.stopPropagation(); return; } recomputeAxisLists(); clearTimeout(redrawTimer); var wheelDelta = -e.deltaY; if (!isFinite(wheelDelta)) wheelDelta = e.wheelDelta / 10; if (!isFinite(wheelDelta)) { Lib.log("Did not find wheel motion attributes: ", e); return; } var zoom = Math.exp(-Math.min(Math.max(wheelDelta, -20), 20) / 200); var gbb = mainplot.draglayer.select(".nsewdrag").node().getBoundingClientRect(); var xfrac = (e.clientX - gbb.left) / gbb.width; var yfrac = (gbb.bottom - e.clientY) / gbb.height; var i; function zoomWheelOneAxis(ax, centerFraction, zoom2) { if (ax.fixedrange) return; var axRange = Lib.simpleMap(ax.range, ax.r2l); var v02 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction; function doZoom(v) { return ax.l2r(v02 + (v - v02) * zoom2); } ax.range = axRange.map(doZoom); } if (editX) { if (!ew) xfrac = 0.5; for (i = 0; i < xaxes.length; i++) { zoomWheelOneAxis(xaxes[i], xfrac, zoom); } updateMatchedAxRange("x"); scrollViewBox[2] *= zoom; scrollViewBox[0] += scrollViewBox[2] * xfrac * (1 / zoom - 1); } if (editY) { if (!ns2) yfrac = 0.5; for (i = 0; i < yaxes.length; i++) { zoomWheelOneAxis(yaxes[i], yfrac, zoom); } updateMatchedAxRange("y"); scrollViewBox[3] *= zoom; scrollViewBox[1] += scrollViewBox[3] * (1 - yfrac) * (1 / zoom - 1); } updateSubplots(scrollViewBox); ticksAndAnnotations(); gd2.emit("plotly_relayouting", updates); redrawTimer = setTimeout(function() { if (!gd2._fullLayout) return; scrollViewBox = [0, 0, pw, ph2]; dragTail(); }, REDRAWDELAY); e.preventDefault(); return; } if (ns2.length * ew.length !== 1) { attachWheelEventHandler(dragger, zoomWheel); } function plotDrag(dx, dy) { dx = dx * scaleX; dy = dy * scaleY; if (gd2._transitioningWithDuration) { return; } gd2._fullLayout._replotting = true; if (xActive === "ew" || yActive === "ns") { var spDx = xActive ? -dx : 0; var spDy = yActive ? -dy : 0; if (matches.isSubplotConstrained) { if (xActive && yActive) { var frac = (dx / pw - dy / ph2) / 2; dx = frac * pw; dy = -frac * ph2; spDx = -dx; spDy = -dy; } if (yActive) { spDx = -spDy * pw / ph2; } else { spDy = -spDx * ph2 / pw; } } if (xActive) { dragAxList(xaxes, dx); updateMatchedAxRange("x"); } if (yActive) { dragAxList(yaxes, dy); updateMatchedAxRange("y"); } updateSubplots([spDx, spDy, pw, ph2]); ticksAndAnnotations(); gd2.emit("plotly_relayouting", updates); return; } function dz(axArray, end, d) { var otherEnd = 1 - end; var movedAx; var newLinearizedEnd; for (var i2 = 0; i2 < axArray.length; i2++) { var axi = axArray[i2]; if (axi.fixedrange) continue; movedAx = axi; newLinearizedEnd = axi._rl[otherEnd] + (axi._rl[end] - axi._rl[otherEnd]) / dZoom(d / axi._length); var newEnd = axi.l2r(newLinearizedEnd); if (newEnd !== false && newEnd !== void 0) axi.range[end] = newEnd; } return movedAx._length * (movedAx._rl[end] - newLinearizedEnd) / (movedAx._rl[end] - movedAx._rl[otherEnd]); } var dxySign = xActive === "w" === (yActive === "n") ? 1 : -1; if (xActive && yActive && (links.isSubplotConstrained || matches.isSubplotConstrained)) { var dxyFraction = (dx / pw + dxySign * dy / ph2) / 2; dx = dxyFraction * pw; dy = dxySign * dxyFraction * ph2; } var xStart, yStart; if (xActive === "w") dx = dz(xaxes, 0, dx); else if (xActive === "e") dx = dz(xaxes, 1, -dx); else if (!xActive) dx = 0; if (yActive === "n") dy = dz(yaxes, 1, dy); else if (yActive === "s") dy = dz(yaxes, 0, -dy); else if (!yActive) dy = 0; xStart = xActive === "w" ? dx : 0; yStart = yActive === "n" ? dy : 0; if (links.isSubplotConstrained && !matches.isSubplotConstrained || // NW or SE on matching axes - create a symmetric zoom matches.isSubplotConstrained && xActive && yActive && dxySign > 0) { var i; if (matches.isSubplotConstrained || !xActive && yActive.length === 1) { for (i = 0; i < xaxes.length; i++) { xaxes[i].range = xaxes[i]._r.slice(); scaleZoom(xaxes[i], 1 - dy / ph2); } dx = dy * pw / ph2; xStart = dx / 2; } if (matches.isSubplotConstrained || !yActive && xActive.length === 1) { for (i = 0; i < yaxes.length; i++) { yaxes[i].range = yaxes[i]._r.slice(); scaleZoom(yaxes[i], 1 - dx / pw); } dy = dx * ph2 / pw; yStart = dy / 2; } } if (!matches.isSubplotConstrained || !yActive) { updateMatchedAxRange("x"); } if (!matches.isSubplotConstrained || !xActive) { updateMatchedAxRange("y"); } var xSize = pw - dx; var ySize = ph2 - dy; if (matches.isSubplotConstrained && !(xActive && yActive)) { if (xActive) { yStart = xStart ? 0 : dx * ph2 / pw; ySize = xSize * ph2 / pw; } else { xStart = yStart ? 0 : dy * pw / ph2; xSize = ySize * pw / ph2; } } updateSubplots([xStart, yStart, xSize, ySize]); ticksAndAnnotations(); gd2.emit("plotly_relayouting", updates); } function updateMatchedAxRange(axLetter, out) { var matchedAxes = matches.isSubplotConstrained ? { x: yaxes, y: xaxes }[axLetter] : matches[axLetter + "axes"]; var constrainedAxes = matches.isSubplotConstrained ? { x: xaxes, y: yaxes }[axLetter] : []; for (var i = 0; i < matchedAxes.length; i++) { var ax = matchedAxes[i]; var axId = ax._id; var axId2 = matches.xLinks[axId] || matches.yLinks[axId]; var ax2 = constrainedAxes[0] || xaHash[axId2] || yaHash[axId2]; if (ax2) { if (out) { out[ax._name + ".range[0]"] = out[ax2._name + ".range[0]"]; out[ax._name + ".range[1]"] = out[ax2._name + ".range[1]"]; } else { ax.range = ax2.range.slice(); } } } } function ticksAndAnnotations() { var activeAxIds = []; var i; function pushActiveAxIds(axList) { for (i = 0; i < axList.length; i++) { if (!axList[i].fixedrange) activeAxIds.push(axList[i]._id); } } function pushActiveAxIdsSynced(axList, axisType) { for (i = 0; i < axList.length; i++) { var axListI = axList[i]; var axListIType = axListI[axisType]; if (!axListI.fixedrange && axListIType.tickmode === "sync") activeAxIds.push(axListIType._id); } } if (editX) { pushActiveAxIds(xaxes); pushActiveAxIds(links.xaxes); pushActiveAxIds(matches.xaxes); pushActiveAxIdsSynced(plotinfo.overlays, "xaxis"); } if (editY) { pushActiveAxIds(yaxes); pushActiveAxIds(links.yaxes); pushActiveAxIds(matches.yaxes); pushActiveAxIdsSynced(plotinfo.overlays, "yaxis"); } updates = {}; for (i = 0; i < activeAxIds.length; i++) { var axId = activeAxIds[i]; var ax = getFromId(gd2, axId); Axes.drawOne(gd2, ax, { skipTitle: true }); updates[ax._name + ".range[0]"] = ax.range[0]; updates[ax._name + ".range[1]"] = ax.range[1]; } Axes.redrawComponents(gd2, activeAxIds); } function doubleClick() { if (gd2._transitioningWithDuration) return; var doubleClickConfig = gd2._context.doubleClick; var axList = []; if (xActive) axList = axList.concat(xaxes); if (yActive) axList = axList.concat(yaxes); if (matches.xaxes) axList = axList.concat(matches.xaxes); if (matches.yaxes) axList = axList.concat(matches.yaxes); var attrs = {}; var ax, i; if (doubleClickConfig === "reset+autosize") { doubleClickConfig = "autosize"; for (i = 0; i < axList.length; i++) { ax = axList[i]; var r02 = ax._rangeInitial0; var r12 = ax._rangeInitial1; var hasRangeInitial = r02 !== void 0 || r12 !== void 0; if (hasRangeInitial && (r02 !== void 0 && r02 !== ax.range[0] || r12 !== void 0 && r12 !== ax.range[1]) || !hasRangeInitial && ax.autorange !== true) { doubleClickConfig = "reset"; break; } } } if (doubleClickConfig === "autosize") { for (i = 0; i < axList.length; i++) { ax = axList[i]; if (!ax.fixedrange) attrs[ax._name + ".autorange"] = true; } } else if (doubleClickConfig === "reset") { if (xActive || links.isSubplotConstrained) axList = axList.concat(links.xaxes); if (yActive && !links.isSubplotConstrained) axList = axList.concat(links.yaxes); if (links.isSubplotConstrained) { if (!xActive) axList = axList.concat(xaxes); else if (!yActive) axList = axList.concat(yaxes); } for (i = 0; i < axList.length; i++) { ax = axList[i]; if (!ax.fixedrange) { var axName = ax._name; var autorangeInitial = ax._autorangeInitial; if (ax._rangeInitial0 === void 0 && ax._rangeInitial1 === void 0) { attrs[axName + ".autorange"] = true; } else if (ax._rangeInitial0 === void 0) { attrs[axName + ".autorange"] = autorangeInitial; attrs[axName + ".range"] = [null, ax._rangeInitial1]; } else if (ax._rangeInitial1 === void 0) { attrs[axName + ".range"] = [ax._rangeInitial0, null]; attrs[axName + ".autorange"] = autorangeInitial; } else { attrs[axName + ".range"] = [ax._rangeInitial0, ax._rangeInitial1]; } } } } gd2.emit("plotly_doubleclick", null); Registry.call("_guiRelayout", gd2, attrs); } function dragTail() { updateSubplots([0, 0, pw, ph2]); Lib.syncOrAsync([ Plots.previousPromises, function() { gd2._fullLayout._replotting = false; Registry.call("_guiRelayout", gd2, updates); } ], gd2); } function updateSubplots(viewBox) { var fullLayout = gd2._fullLayout; var plotinfos = fullLayout._plots; var subplots = fullLayout._subplots.cartesian; var i, sp2, xa2, ya2; if (hasSplom) { Registry.subplotsRegistry.splom.drag(gd2); } if (hasScatterGl) { for (i = 0; i < subplots.length; i++) { sp2 = plotinfos[subplots[i]]; xa2 = sp2.xaxis; ya2 = sp2.yaxis; if (sp2._scene) { if (xa2.limitRange) xa2.limitRange(); if (ya2.limitRange) ya2.limitRange(); var xrng = Lib.simpleMap(xa2.range, xa2.r2l); var yrng = Lib.simpleMap(ya2.range, ya2.r2l); sp2._scene.update({ range: [xrng[0], yrng[0], xrng[1], yrng[1]] }); } } } if (hasSplom || hasScatterGl) { clearGlCanvases(gd2); redrawReglTraces(gd2); } if (hasSVG) { var xScaleFactor = viewBox[2] / xa0._length; var yScaleFactor = viewBox[3] / ya0._length; for (i = 0; i < subplots.length; i++) { sp2 = plotinfos[subplots[i]]; xa2 = sp2.xaxis; ya2 = sp2.yaxis; var editX2 = (editX || matches.isSubplotConstrained) && !xa2.fixedrange && xaHash[xa2._id]; var editY2 = (editY || matches.isSubplotConstrained) && !ya2.fixedrange && yaHash[ya2._id]; var xScaleFactor2, yScaleFactor2; var clipDx, clipDy; if (editX2) { xScaleFactor2 = xScaleFactor; clipDx = ew || matches.isSubplotConstrained ? viewBox[0] : getShift(xa2, xScaleFactor2); } else if (matches.xaHash[xa2._id]) { xScaleFactor2 = xScaleFactor; clipDx = viewBox[0] * xa2._length / xa0._length; } else if (matches.yaHash[xa2._id]) { xScaleFactor2 = yScaleFactor; clipDx = yActive === "ns" ? -viewBox[1] * xa2._length / ya0._length : getShift(xa2, xScaleFactor2, { n: "top", s: "bottom" }[yActive]); } else { xScaleFactor2 = getLinkedScaleFactor(xa2, xScaleFactor, yScaleFactor); clipDx = scaleAndGetShift(xa2, xScaleFactor2); } if (xScaleFactor2 > 1 && (xa2.maxallowed !== void 0 && editX === (xa2.range[0] < xa2.range[1] ? "e" : "w") || xa2.minallowed !== void 0 && editX === (xa2.range[0] < xa2.range[1] ? "w" : "e"))) { xScaleFactor2 = 1; clipDx = 0; } if (editY2) { yScaleFactor2 = yScaleFactor; clipDy = ns2 || matches.isSubplotConstrained ? viewBox[1] : getShift(ya2, yScaleFactor2); } else if (matches.yaHash[ya2._id]) { yScaleFactor2 = yScaleFactor; clipDy = viewBox[1] * ya2._length / ya0._length; } else if (matches.xaHash[ya2._id]) { yScaleFactor2 = xScaleFactor; clipDy = xActive === "ew" ? -viewBox[0] * ya2._length / xa0._length : getShift(ya2, yScaleFactor2, { e: "right", w: "left" }[xActive]); } else { yScaleFactor2 = getLinkedScaleFactor(ya2, xScaleFactor, yScaleFactor); clipDy = scaleAndGetShift(ya2, yScaleFactor2); } if (yScaleFactor2 > 1 && (ya2.maxallowed !== void 0 && editY === (ya2.range[0] < ya2.range[1] ? "n" : "s") || ya2.minallowed !== void 0 && editY === (ya2.range[0] < ya2.range[1] ? "s" : "n"))) { yScaleFactor2 = 1; clipDy = 0; } if (!xScaleFactor2 && !yScaleFactor2) { continue; } if (!xScaleFactor2) xScaleFactor2 = 1; if (!yScaleFactor2) yScaleFactor2 = 1; var plotDx = xa2._offset - clipDx / xScaleFactor2; var plotDy = ya2._offset - clipDy / yScaleFactor2; sp2.clipRect.call(Drawing.setTranslate, clipDx, clipDy).call(Drawing.setScale, xScaleFactor2, yScaleFactor2); sp2.plot.call(Drawing.setTranslate, plotDx, plotDy).call(Drawing.setScale, 1 / xScaleFactor2, 1 / yScaleFactor2); if (xScaleFactor2 !== sp2.xScaleFactor || yScaleFactor2 !== sp2.yScaleFactor) { Drawing.setPointGroupScale(sp2.zoomScalePts, xScaleFactor2, yScaleFactor2); Drawing.setTextPointsScale(sp2.zoomScaleTxt, xScaleFactor2, yScaleFactor2); } Drawing.hideOutsideRangePoints(sp2.clipOnAxisFalseTraces, sp2); sp2.xScaleFactor = xScaleFactor2; sp2.yScaleFactor = yScaleFactor2; } } } function getLinkedScaleFactor(ax, xScaleFactor, yScaleFactor) { if (ax.fixedrange) return 0; if (editX && links.xaHash[ax._id]) { return xScaleFactor; } if (editY && (links.isSubplotConstrained ? links.xaHash : links.yaHash)[ax._id]) { return yScaleFactor; } return 0; } function scaleAndGetShift(ax, scaleFactor) { if (scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); return getShift(ax, scaleFactor); } return 0; } function getShift(ax, scaleFactor, from) { return ax._length * (1 - scaleFactor) * FROM_TL[from || ax.constraintoward || "middle"]; } return dragger; } function makeDragger(plotinfo, nodeName, dragClass, cursor) { var dragger3 = Lib.ensureSingle(plotinfo.draglayer, nodeName, dragClass, function(s) { s.classed("drag", true).style({ fill: "transparent", "stroke-width": 0 }).attr("data-subplot", plotinfo.id); }); dragger3.call(setCursor, cursor); return dragger3.node(); } function makeRectDragger(plotinfo, dragClass, cursor, x, y, w, h) { var dragger = makeDragger(plotinfo, "rect", dragClass, cursor); d3.select(dragger).call(Drawing.setRect, x, y, w, h); return dragger; } function isDirectionActive(axList, activeVal) { for (var i = 0; i < axList.length; i++) { if (!axList[i].fixedrange) return activeVal; } return ""; } function getEndText(ax, end) { var initialVal = ax.range[end]; var diff = Math.abs(initialVal - ax.range[1 - end]); var dig; if (ax.type === "date") { return initialVal; } else if (ax.type === "log") { dig = Math.ceil(Math.max(0, -Math.log(diff) / Math.LN10)) + 3; return numberFormat("." + dig + "g")(Math.pow(10, initialVal)); } else { dig = Math.floor(Math.log(Math.abs(initialVal)) / Math.LN10) - Math.floor(Math.log(diff) / Math.LN10) + 4; return numberFormat("." + String(dig) + "g")(initialVal); } } function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { for (var i = 0; i < axList.length; i++) { var axi = axList[i]; if (axi.fixedrange) continue; if (axi.rangebreaks) { var isY = axi._id.charAt(0) === "y"; var r0F = isY ? 1 - r0Fraction : r0Fraction; var r1F = isY ? 1 - r1Fraction : r1Fraction; updates[axi._name + ".range[0]"] = axi.l2r(axi.p2l(r0F * axi._length)); updates[axi._name + ".range[1]"] = axi.l2r(axi.p2l(r1F * axi._length)); } else { var axRangeLinear0 = axi._rl[0]; var axRangeLinearSpan = axi._rl[1] - axRangeLinear0; updates[axi._name + ".range[0]"] = axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction); updates[axi._name + ".range[1]"] = axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction); } } if (linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates, []); } } function dragAxList(axList, pix) { for (var i = 0; i < axList.length; i++) { var axi = axList[i]; if (!axi.fixedrange) { if (axi.rangebreaks) { var p02 = 0; var p12 = axi._length; var d02 = axi.p2l(p02 + pix) - axi.p2l(p02); var d12 = axi.p2l(p12 + pix) - axi.p2l(p12); var delta = (d02 + d12) / 2; axi.range = [ axi.l2r(axi._rl[0] - delta), axi.l2r(axi._rl[1] - delta) ]; } else { axi.range = [ axi.l2r(axi._rl[0] - pix / axi._m), axi.l2r(axi._rl[1] - pix / axi._m) ]; } if (axi.limitRange) axi.limitRange(); } } } function dZoom(d) { return 1 - (d >= 0 ? Math.min(d, 0.9) : 1 / (1 / Math.max(d, -0.3) + 3.222)); } function getDragCursor(nsew, dragmode, isMainDrag) { if (!nsew) return "pointer"; if (nsew === "nsew") { if (isMainDrag) return ""; if (dragmode === "pan") return "move"; return "crosshair"; } return nsew.toLowerCase() + "-resize"; } function makeZoombox(zoomlayer, lum, xs2, ys2, path0) { return zoomlayer.append("path").attr("class", "zoombox").style({ fill: lum > 0.2 ? "rgba(0,0,0,0)" : "rgba(255,255,255,0)", "stroke-width": 0 }).attr("transform", strTranslate(xs2, ys2)).attr("d", path0 + "Z"); } function makeCorners(zoomlayer, xs2, ys2) { return zoomlayer.append("path").attr("class", "zoombox-corners").style({ fill: Color.background, stroke: Color.defaultLine, "stroke-width": 1, opacity: 0 }).attr("transform", strTranslate(xs2, ys2)).attr("d", "M0,0Z"); } function updateZoombox(zb, corners, box, path0, dimmed, lum) { zb.attr( "d", path0 + "M" + box.l + "," + box.t + "v" + box.h + "h" + box.w + "v-" + box.h + "h-" + box.w + "Z" ); transitionZoombox(zb, corners, dimmed, lum); } function transitionZoombox(zb, corners, dimmed, lum) { if (!dimmed) { zb.transition().style("fill", lum > 0.2 ? "rgba(0,0,0,0.4)" : "rgba(255,255,255,0.3)").duration(200); corners.transition().style("opacity", 1).duration(200); } } function removeZoombox(gd2) { d3.select(gd2).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove(); } function showDoubleClickNotifier(gd2) { if (SHOWZOOMOUTTIP && gd2.data && gd2._context.showTips) { Lib.notifier(Lib._(gd2, "Double-click to zoom back out"), "long"); SHOWZOOMOUTTIP = false; } } function xCorners(box, y02) { return "M" + (box.l - 0.5) + "," + (y02 - MINZOOM - 0.5) + "h-3v" + (2 * MINZOOM + 1) + "h3ZM" + (box.r + 0.5) + "," + (y02 - MINZOOM - 0.5) + "h3v" + (2 * MINZOOM + 1) + "h-3Z"; } function yCorners(box, x02) { return "M" + (x02 - MINZOOM - 0.5) + "," + (box.t - 0.5) + "v-3h" + (2 * MINZOOM + 1) + "v3ZM" + (x02 - MINZOOM - 0.5) + "," + (box.b + 0.5) + "v3h" + (2 * MINZOOM + 1) + "v-3Z"; } function xyCorners(box) { var clen = Math.floor(Math.min(box.b - box.t, box.r - box.l, MINZOOM) / 2); return "M" + (box.l - 3.5) + "," + (box.t - 0.5 + clen) + "h3v" + -clen + "h" + clen + "v-3h-" + (clen + 3) + "ZM" + (box.r + 3.5) + "," + (box.t - 0.5 + clen) + "h-3v" + -clen + "h" + -clen + "v-3h" + (clen + 3) + "ZM" + (box.r + 3.5) + "," + (box.b + 0.5 - clen) + "h-3v" + clen + "h" + -clen + "v3h" + (clen + 3) + "ZM" + (box.l - 3.5) + "," + (box.b + 0.5 - clen) + "h3v" + clen + "h" + clen + "v3h-" + (clen + 3) + "Z"; } function calcLinks(gd2, groups, xaHash, yaHash, exclude) { var isSubplotConstrained = false; var xLinks = {}; var yLinks = {}; var xID, yID, xLinkID, yLinkID; var xExclude = (exclude || {}).xaHash; var yExclude = (exclude || {}).yaHash; for (var i = 0; i < groups.length; i++) { var group = groups[i]; for (xID in xaHash) { if (group[xID]) { for (xLinkID in group) { if (!(exclude && (xExclude[xLinkID] || yExclude[xLinkID])) && !(xLinkID.charAt(0) === "x" ? xaHash : yaHash)[xLinkID]) { xLinks[xLinkID] = xID; } } for (yID in yaHash) { if (!(exclude && (xExclude[yID] || yExclude[yID])) && group[yID]) { isSubplotConstrained = true; } } } } for (yID in yaHash) { if (group[yID]) { for (yLinkID in group) { if (!(exclude && (xExclude[yLinkID] || yExclude[yLinkID])) && !(yLinkID.charAt(0) === "x" ? xaHash : yaHash)[yLinkID]) { yLinks[yLinkID] = yID; } } } } } if (isSubplotConstrained) { Lib.extendFlat(xLinks, yLinks); yLinks = {}; } var xaHashLinked = {}; var xaxesLinked = []; for (xLinkID in xLinks) { var xa2 = getFromId(gd2, xLinkID); xaxesLinked.push(xa2); xaHashLinked[xa2._id] = xa2; } var yaHashLinked = {}; var yaxesLinked = []; for (yLinkID in yLinks) { var ya2 = getFromId(gd2, yLinkID); yaxesLinked.push(ya2); yaHashLinked[ya2._id] = ya2; } return { xaHash: xaHashLinked, yaHash: yaHashLinked, xaxes: xaxesLinked, yaxes: yaxesLinked, xLinks, yLinks, isSubplotConstrained }; } function attachWheelEventHandler(element, handler) { if (!supportsPassive) { if (element.onwheel !== void 0) element.onwheel = handler; else if (element.onmousewheel !== void 0) element.onmousewheel = handler; else if (!element.isAddedWheelEvent) { element.isAddedWheelEvent = true; element.addEventListener("wheel", handler, { passive: false }); } } else { var wheelEventName = element.onwheel !== void 0 ? "wheel" : "mousewheel"; if (element._onwheel) { element.removeEventListener(wheelEventName, element._onwheel); } element._onwheel = handler; element.addEventListener(wheelEventName, handler, { passive: false }); } } function hashValues(hash) { var out = []; for (var k in hash) out.push(hash[k]); return out; } module2.exports = { makeDragBox, makeDragger, makeRectDragger, makeZoombox, makeCorners, updateZoombox, xyCorners, transitionZoombox, removeZoombox, showDoubleClickNotifier, attachWheelEventHandler }; } }); // node_modules/plotly.js/src/plots/cartesian/graph_interact.js var require_graph_interact = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/graph_interact.js"(exports2) { "use strict"; var d3 = require_d3(); var Fx = require_fx(); var dragElement = require_dragelement(); var setCursor = require_setcursor(); var makeDragBox = require_dragbox().makeDragBox; var DRAGGERSIZE = require_constants2().DRAGGERSIZE; exports2.initInteractions = function initInteractions(gd2) { var fullLayout = gd2._fullLayout; if (gd2._context.staticPlot) { d3.select(gd2).selectAll(".drag").remove(); return; } if (!fullLayout._has("cartesian") && !fullLayout._has("splom")) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { if ((fullLayout._plots[a].mainplot && true) === (fullLayout._plots[b].mainplot && true)) { var aParts = a.split("y"); var bParts = b.split("y"); return aParts[0] === bParts[0] ? Number(aParts[1] || 1) - Number(bParts[1] || 1) : Number(aParts[0] || 1) - Number(bParts[0] || 1); } return fullLayout._plots[a].mainplot ? 1 : -1; }); subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; if (!plotinfo.mainplot) { var maindrag = makeDragBox( gd2, plotinfo, xa2._offset, ya2._offset, xa2._length, ya2._length, "ns", "ew" ); maindrag.onmousemove = function(evt) { gd2._fullLayout._rehover = function() { if (gd2._fullLayout._hoversubplot === subplot && gd2._fullLayout._plots[subplot]) { Fx.hover(gd2, evt, subplot); } }; Fx.hover(gd2, evt, subplot); gd2._fullLayout._lasthover = maindrag; gd2._fullLayout._hoversubplot = subplot; }; maindrag.onmouseout = function(evt) { if (gd2._dragging) return; gd2._fullLayout._hoversubplot = null; dragElement.unhover(gd2, evt); }; if (gd2._context.showAxisDragHandles) { makeDragBox( gd2, plotinfo, xa2._offset - DRAGGERSIZE, ya2._offset - DRAGGERSIZE, DRAGGERSIZE, DRAGGERSIZE, "n", "w" ); makeDragBox( gd2, plotinfo, xa2._offset + xa2._length, ya2._offset - DRAGGERSIZE, DRAGGERSIZE, DRAGGERSIZE, "n", "e" ); makeDragBox( gd2, plotinfo, xa2._offset - DRAGGERSIZE, ya2._offset + ya2._length, DRAGGERSIZE, DRAGGERSIZE, "s", "w" ); makeDragBox( gd2, plotinfo, xa2._offset + xa2._length, ya2._offset + ya2._length, DRAGGERSIZE, DRAGGERSIZE, "s", "e" ); } } if (gd2._context.showAxisDragHandles) { if (subplot === xa2._mainSubplot) { var y02 = xa2._mainLinePosition; if (xa2.side === "top") y02 -= DRAGGERSIZE; makeDragBox( gd2, plotinfo, xa2._offset + xa2._length * 0.1, y02, xa2._length * 0.8, DRAGGERSIZE, "", "ew" ); makeDragBox( gd2, plotinfo, xa2._offset, y02, xa2._length * 0.1, DRAGGERSIZE, "", "w" ); makeDragBox( gd2, plotinfo, xa2._offset + xa2._length * 0.9, y02, xa2._length * 0.1, DRAGGERSIZE, "", "e" ); } if (subplot === ya2._mainSubplot) { var x02 = ya2._mainLinePosition; if (ya2.side !== "right") x02 -= DRAGGERSIZE; makeDragBox( gd2, plotinfo, x02, ya2._offset + ya2._length * 0.1, DRAGGERSIZE, ya2._length * 0.8, "ns", "" ); makeDragBox( gd2, plotinfo, x02, ya2._offset + ya2._length * 0.9, DRAGGERSIZE, ya2._length * 0.1, "s", "" ); makeDragBox( gd2, plotinfo, x02, ya2._offset, DRAGGERSIZE, ya2._length * 0.1, "n", "" ); } } }); var hoverLayer = fullLayout._hoverlayer.node(); hoverLayer.onmousemove = function(evt) { evt.target = gd2._fullLayout._lasthover; Fx.hover(gd2, evt, fullLayout._hoversubplot); }; hoverLayer.onclick = function(evt) { evt.target = gd2._fullLayout._lasthover; Fx.click(gd2, evt); }; hoverLayer.onmousedown = function(evt) { gd2._fullLayout._lasthover.onmousedown(evt); }; exports2.updateFx(gd2); }; exports2.updateFx = function(gd2) { var fullLayout = gd2._fullLayout; var cursor = fullLayout.dragmode === "pan" ? "move" : "crosshair"; setCursor(fullLayout._draggers, cursor); }; } }); // node_modules/plotly.js/src/plot_api/container_array_match.js var require_container_array_match = __commonJS({ "node_modules/plotly.js/src/plot_api/container_array_match.js"(exports2, module2) { "use strict"; var Registry = require_registry(); module2.exports = function containerArrayMatch(astr) { var rootContainers = Registry.layoutArrayContainers; var regexpContainers = Registry.layoutArrayRegexes; var rootPart = astr.split("[")[0]; var arrayStr; var match; for (var i = 0; i < regexpContainers.length; i++) { match = astr.match(regexpContainers[i]); if (match && match.index === 0) { arrayStr = match[0]; break; } } if (!arrayStr) arrayStr = rootContainers[rootContainers.indexOf(rootPart)]; if (!arrayStr) return false; var tail = astr.substr(arrayStr.length); if (!tail) return { array: arrayStr, index: "", property: "" }; match = tail.match(/^\[(0|[1-9][0-9]*)\](\.(.+))?$/); if (!match) return false; return { array: arrayStr, index: Number(match[1]), property: match[3] || "" }; }; } }); // node_modules/plotly.js/src/plot_api/manage_arrays.js var require_manage_arrays = __commonJS({ "node_modules/plotly.js/src/plot_api/manage_arrays.js"(exports2) { "use strict"; var isPlainObject = require_is_plain_object(); var noop = require_noop(); var Loggers = require_loggers(); var sorterAsc = require_search().sorterAsc; var Registry = require_registry(); exports2.containerArrayMatch = require_container_array_match(); var isAddVal = exports2.isAddVal = function isAddVal2(val) { return val === "add" || isPlainObject(val); }; var isRemoveVal = exports2.isRemoveVal = function isRemoveVal2(val) { return val === null || val === "remove"; }; exports2.applyContainerArrayChanges = function applyContainerArrayChanges(gd2, np2, edits, flags, _nestedProperty) { var componentType = np2.astr; var supplyComponentDefaults = Registry.getComponentMethod(componentType, "supplyLayoutDefaults"); var draw = Registry.getComponentMethod(componentType, "draw"); var drawOne = Registry.getComponentMethod(componentType, "drawOne"); var replotLater = flags.replot || flags.recalc || supplyComponentDefaults === noop || draw === noop; var layout = gd2.layout; var fullLayout = gd2._fullLayout; if (edits[""]) { if (Object.keys(edits).length > 1) { Loggers.warn( "Full array edits are incompatible with other edits", componentType ); } var fullVal = edits[""][""]; if (isRemoveVal(fullVal)) np2.set(null); else if (Array.isArray(fullVal)) np2.set(fullVal); else { Loggers.warn("Unrecognized full array edit value", componentType, fullVal); return true; } if (replotLater) return false; supplyComponentDefaults(layout, fullLayout); draw(gd2); return true; } var componentNums = Object.keys(edits).map(Number).sort(sorterAsc); var componentArrayIn = np2.get(); var componentArray = componentArrayIn || []; var componentArrayFull = _nestedProperty(fullLayout, componentType).get(); var deletes = []; var firstIndexChange = -1; var maxIndex = componentArray.length; var i; var j; var componentNum; var objEdits; var objKeys; var objVal; var adding, prefix; for (i = 0; i < componentNums.length; i++) { componentNum = componentNums[i]; objEdits = edits[componentNum]; objKeys = Object.keys(objEdits); objVal = objEdits[""], adding = isAddVal(objVal); if (componentNum < 0 || componentNum > componentArray.length - (adding ? 0 : 1)) { Loggers.warn("index out of range", componentType, componentNum); continue; } if (objVal !== void 0) { if (objKeys.length > 1) { Loggers.warn( "Insertion & removal are incompatible with edits to the same index.", componentType, componentNum ); } if (isRemoveVal(objVal)) { deletes.push(componentNum); } else if (adding) { if (objVal === "add") objVal = {}; componentArray.splice(componentNum, 0, objVal); if (componentArrayFull) componentArrayFull.splice(componentNum, 0, {}); } else { Loggers.warn( "Unrecognized full object edit value", componentType, componentNum, objVal ); } if (firstIndexChange === -1) firstIndexChange = componentNum; } else { for (j = 0; j < objKeys.length; j++) { prefix = componentType + "[" + componentNum + "]."; _nestedProperty(componentArray[componentNum], objKeys[j], prefix).set(objEdits[objKeys[j]]); } } } for (i = deletes.length - 1; i >= 0; i--) { componentArray.splice(deletes[i], 1); if (componentArrayFull) componentArrayFull.splice(deletes[i], 1); } if (!componentArray.length) np2.set(null); else if (!componentArrayIn) np2.set(componentArray); if (replotLater) return false; supplyComponentDefaults(layout, fullLayout); if (drawOne !== noop) { var indicesToDraw; if (firstIndexChange === -1) { indicesToDraw = componentNums; } else { maxIndex = Math.max(componentArray.length, maxIndex); indicesToDraw = []; for (i = 0; i < componentNums.length; i++) { componentNum = componentNums[i]; if (componentNum >= firstIndexChange) break; indicesToDraw.push(componentNum); } for (i = firstIndexChange; i < maxIndex; i++) { indicesToDraw.push(i); } } for (i = 0; i < indicesToDraw.length; i++) { drawOne(gd2, indicesToDraw[i]); } } else draw(gd2); return true; }; } }); // node_modules/plotly.js/src/plot_api/helpers.js var require_helpers9 = __commonJS({ "node_modules/plotly.js/src/plot_api/helpers.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var m4FromQuat = require_fromQuat(); var Registry = require_registry(); var Lib = require_lib(); var Plots = require_plots(); var AxisIds = require_axis_ids(); var Color = require_color(); var cleanId = AxisIds.cleanId; var getFromTrace = AxisIds.getFromTrace; var traceIs = Registry.traceIs; exports2.clearPromiseQueue = function(gd2) { if (Array.isArray(gd2._promises) && gd2._promises.length > 0) { Lib.log("Clearing previous rejected promises from queue."); } gd2._promises = []; }; exports2.cleanLayout = function(layout) { var i, j; if (!layout) layout = {}; if (layout.xaxis1) { if (!layout.xaxis) layout.xaxis = layout.xaxis1; delete layout.xaxis1; } if (layout.yaxis1) { if (!layout.yaxis) layout.yaxis = layout.yaxis1; delete layout.yaxis1; } if (layout.scene1) { if (!layout.scene) layout.scene = layout.scene1; delete layout.scene1; } var axisAttrRegex = (Plots.subplotsRegistry.cartesian || {}).attrRegex; var polarAttrRegex = (Plots.subplotsRegistry.polar || {}).attrRegex; var ternaryAttrRegex = (Plots.subplotsRegistry.ternary || {}).attrRegex; var sceneAttrRegex = (Plots.subplotsRegistry.gl3d || {}).attrRegex; var keys = Object.keys(layout); for (i = 0; i < keys.length; i++) { var key = keys[i]; if (axisAttrRegex && axisAttrRegex.test(key)) { var ax = layout[key]; if (ax.anchor && ax.anchor !== "free") { ax.anchor = cleanId(ax.anchor); } if (ax.overlaying) ax.overlaying = cleanId(ax.overlaying); if (!ax.type) { if (ax.isdate) ax.type = "date"; else if (ax.islog) ax.type = "log"; else if (ax.isdate === false && ax.islog === false) ax.type = "linear"; } if (ax.autorange === "withzero" || ax.autorange === "tozero") { ax.autorange = true; ax.rangemode = "tozero"; } if (ax.insiderange) delete ax.range; delete ax.islog; delete ax.isdate; delete ax.categories; if (emptyContainer(ax, "domain")) delete ax.domain; if (ax.autotick !== void 0) { if (ax.tickmode === void 0) { ax.tickmode = ax.autotick ? "auto" : "linear"; } delete ax.autotick; } cleanTitle(ax); } else if (polarAttrRegex && polarAttrRegex.test(key)) { var polar = layout[key]; cleanTitle(polar.radialaxis); } else if (ternaryAttrRegex && ternaryAttrRegex.test(key)) { var ternary = layout[key]; cleanTitle(ternary.aaxis); cleanTitle(ternary.baxis); cleanTitle(ternary.caxis); } else if (sceneAttrRegex && sceneAttrRegex.test(key)) { var scene = layout[key]; var cameraposition = scene.cameraposition; if (Array.isArray(cameraposition) && cameraposition[0].length === 4) { var rotation = cameraposition[0]; var center = cameraposition[1]; var radius = cameraposition[2]; var mat = m4FromQuat([], rotation); var eye = []; for (j = 0; j < 3; ++j) { eye[j] = center[j] + radius * mat[2 + 4 * j]; } scene.camera = { eye: { x: eye[0], y: eye[1], z: eye[2] }, center: { x: center[0], y: center[1], z: center[2] }, up: { x: 0, y: 0, z: 1 } // we just ignore calculating camera z up in this case }; delete scene.cameraposition; } cleanTitle(scene.xaxis); cleanTitle(scene.yaxis); cleanTitle(scene.zaxis); } } var annotationsLen = Array.isArray(layout.annotations) ? layout.annotations.length : 0; for (i = 0; i < annotationsLen; i++) { var ann = layout.annotations[i]; if (!Lib.isPlainObject(ann)) continue; if (ann.ref) { if (ann.ref === "paper") { ann.xref = "paper"; ann.yref = "paper"; } else if (ann.ref === "data") { ann.xref = "x"; ann.yref = "y"; } delete ann.ref; } cleanAxRef(ann, "xref"); cleanAxRef(ann, "yref"); } var shapesLen = Array.isArray(layout.shapes) ? layout.shapes.length : 0; for (i = 0; i < shapesLen; i++) { var shape = layout.shapes[i]; if (!Lib.isPlainObject(shape)) continue; cleanAxRef(shape, "xref"); cleanAxRef(shape, "yref"); } var imagesLen = Array.isArray(layout.images) ? layout.images.length : 0; for (i = 0; i < imagesLen; i++) { var image = layout.images[i]; if (!Lib.isPlainObject(image)) continue; cleanAxRef(image, "xref"); cleanAxRef(image, "yref"); } var legend = layout.legend; if (legend) { if (legend.x > 3) { legend.x = 1.02; legend.xanchor = "left"; } else if (legend.x < -2) { legend.x = -0.02; legend.xanchor = "right"; } if (legend.y > 3) { legend.y = 1.02; legend.yanchor = "bottom"; } else if (legend.y < -2) { legend.y = -0.02; legend.yanchor = "top"; } } cleanTitle(layout); if (layout.dragmode === "rotate") layout.dragmode = "orbit"; Color.clean(layout); if (layout.template && layout.template.layout) { exports2.cleanLayout(layout.template.layout); } return layout; }; function cleanAxRef(container, attr) { var valIn = container[attr]; var axLetter = attr.charAt(0); if (valIn && valIn !== "paper") { container[attr] = cleanId(valIn, axLetter, true); } } function cleanTitle(titleContainer) { if (titleContainer) { if (typeof titleContainer.title === "string" || typeof titleContainer.title === "number") { titleContainer.title = { text: titleContainer.title }; } rewireAttr("titlefont", "font"); rewireAttr("titleposition", "position"); rewireAttr("titleside", "side"); rewireAttr("titleoffset", "offset"); } function rewireAttr(oldAttrName, newAttrName) { var oldAttrSet = titleContainer[oldAttrName]; var newAttrSet = titleContainer.title && titleContainer.title[newAttrName]; if (oldAttrSet && !newAttrSet) { if (!titleContainer.title) { titleContainer.title = {}; } titleContainer.title[newAttrName] = titleContainer[oldAttrName]; delete titleContainer[oldAttrName]; } } } exports2.cleanData = function(data) { for (var tracei = 0; tracei < data.length; tracei++) { var trace = data[tracei]; var i; if (trace.type === "histogramy" && "xbins" in trace && !("ybins" in trace)) { trace.ybins = trace.xbins; delete trace.xbins; } if (trace.error_y && "opacity" in trace.error_y) { var dc2 = Color.defaults; var yeColor = trace.error_y.color || (traceIs(trace, "bar") ? Color.defaultLine : dc2[tracei % dc2.length]); trace.error_y.color = Color.addOpacity( Color.rgb(yeColor), Color.opacity(yeColor) * trace.error_y.opacity ); delete trace.error_y.opacity; } if ("bardir" in trace) { if (trace.bardir === "h" && (traceIs(trace, "bar") || trace.type.substr(0, 9) === "histogram")) { trace.orientation = "h"; exports2.swapXYData(trace); } delete trace.bardir; } if (trace.type === "histogramy") exports2.swapXYData(trace); if (trace.type === "histogramx" || trace.type === "histogramy") { trace.type = "histogram"; } if ("scl" in trace && !("colorscale" in trace)) { trace.colorscale = trace.scl; delete trace.scl; } if ("reversescl" in trace && !("reversescale" in trace)) { trace.reversescale = trace.reversescl; delete trace.reversescl; } if (trace.xaxis) trace.xaxis = cleanId(trace.xaxis, "x"); if (trace.yaxis) trace.yaxis = cleanId(trace.yaxis, "y"); if (traceIs(trace, "gl3d") && trace.scene) { trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene); } if (!traceIs(trace, "pie-like") && !traceIs(trace, "bar-like")) { if (Array.isArray(trace.textposition)) { for (i = 0; i < trace.textposition.length; i++) { trace.textposition[i] = cleanTextPosition(trace.textposition[i]); } } else if (trace.textposition) { trace.textposition = cleanTextPosition(trace.textposition); } } var _module = Registry.getModule(trace); if (_module && _module.colorbar) { var containerName = _module.colorbar.container; var container = containerName ? trace[containerName] : trace; if (container && container.colorscale) { if (container.colorscale === "YIGnBu") container.colorscale = "YlGnBu"; if (container.colorscale === "YIOrRd") container.colorscale = "YlOrRd"; } } if (trace.type === "surface" && Lib.isPlainObject(trace.contours)) { var dims = ["x", "y", "z"]; for (i = 0; i < dims.length; i++) { var opts = trace.contours[dims[i]]; if (!Lib.isPlainObject(opts)) continue; if (opts.highlightColor) { opts.highlightcolor = opts.highlightColor; delete opts.highlightColor; } if (opts.highlightWidth) { opts.highlightwidth = opts.highlightWidth; delete opts.highlightWidth; } } } if (trace.type === "candlestick" || trace.type === "ohlc") { var increasingShowlegend = (trace.increasing || {}).showlegend !== false; var decreasingShowlegend = (trace.decreasing || {}).showlegend !== false; var increasingName = cleanFinanceDir(trace.increasing); var decreasingName = cleanFinanceDir(trace.decreasing); if (increasingName !== false && decreasingName !== false) { var newName = commonPrefix( increasingName, decreasingName, increasingShowlegend, decreasingShowlegend ); if (newName) trace.name = newName; } else if ((increasingName || decreasingName) && !trace.name) { trace.name = increasingName || decreasingName; } } if (Array.isArray(trace.transforms)) { var transforms = trace.transforms; for (i = 0; i < transforms.length; i++) { var transform = transforms[i]; if (!Lib.isPlainObject(transform)) continue; switch (transform.type) { case "filter": if (transform.filtersrc) { transform.target = transform.filtersrc; delete transform.filtersrc; } if (transform.calendar) { if (!transform.valuecalendar) { transform.valuecalendar = transform.calendar; } delete transform.calendar; } break; case "groupby": transform.styles = transform.styles || transform.style; if (transform.styles && !Array.isArray(transform.styles)) { var prevStyles = transform.styles; var styleKeys = Object.keys(prevStyles); transform.styles = []; for (var j = 0; j < styleKeys.length; j++) { transform.styles.push({ target: styleKeys[j], value: prevStyles[styleKeys[j]] }); } } break; } } } if (emptyContainer(trace, "line")) delete trace.line; if ("marker" in trace) { if (emptyContainer(trace.marker, "line")) delete trace.marker.line; if (emptyContainer(trace, "marker")) delete trace.marker; } Color.clean(trace); if (trace.autobinx) { delete trace.autobinx; delete trace.xbins; } if (trace.autobiny) { delete trace.autobiny; delete trace.ybins; } cleanTitle(trace); if (trace.colorbar) cleanTitle(trace.colorbar); if (trace.marker && trace.marker.colorbar) cleanTitle(trace.marker.colorbar); if (trace.line && trace.line.colorbar) cleanTitle(trace.line.colorbar); if (trace.aaxis) cleanTitle(trace.aaxis); if (trace.baxis) cleanTitle(trace.baxis); } }; function cleanFinanceDir(dirContainer) { if (!Lib.isPlainObject(dirContainer)) return false; var dirName = dirContainer.name; delete dirContainer.name; delete dirContainer.showlegend; return (typeof dirName === "string" || typeof dirName === "number") && String(dirName); } function commonPrefix(name1, name2, show1, show2) { if (show1 && !show2) return name1; if (show2 && !show1) return name2; if (!name1.trim()) return name2; if (!name2.trim()) return name1; var minLen = Math.min(name1.length, name2.length); var i; for (i = 0; i < minLen; i++) { if (name1.charAt(i) !== name2.charAt(i)) break; } var out = name1.substr(0, i); return out.trim(); } function cleanTextPosition(textposition) { var posY = "middle"; var posX = "center"; if (typeof textposition === "string") { if (textposition.indexOf("top") !== -1) posY = "top"; else if (textposition.indexOf("bottom") !== -1) posY = "bottom"; if (textposition.indexOf("left") !== -1) posX = "left"; else if (textposition.indexOf("right") !== -1) posX = "right"; } return posY + " " + posX; } function emptyContainer(outer, innerStr) { return innerStr in outer && typeof outer[innerStr] === "object" && Object.keys(outer[innerStr]).length === 0; } exports2.swapXYData = function(trace) { var i; Lib.swapAttrs(trace, ["?", "?0", "d?", "?bins", "nbins?", "autobin?", "?src", "error_?"]); if (Array.isArray(trace.z) && Array.isArray(trace.z[0])) { if (trace.transpose) delete trace.transpose; else trace.transpose = true; } if (trace.error_x && trace.error_y) { var errorY = trace.error_y; var copyYstyle = "copy_ystyle" in errorY ? errorY.copy_ystyle : !(errorY.color || errorY.thickness || errorY.width); Lib.swapAttrs(trace, ["error_?.copy_ystyle"]); if (copyYstyle) { Lib.swapAttrs(trace, ["error_?.color", "error_?.thickness", "error_?.width"]); } } if (typeof trace.hoverinfo === "string") { var hoverInfoParts = trace.hoverinfo.split("+"); for (i = 0; i < hoverInfoParts.length; i++) { if (hoverInfoParts[i] === "x") hoverInfoParts[i] = "y"; else if (hoverInfoParts[i] === "y") hoverInfoParts[i] = "x"; } trace.hoverinfo = hoverInfoParts.join("+"); } }; exports2.coerceTraceIndices = function(gd2, traceIndices) { if (isNumeric(traceIndices)) { return [traceIndices]; } else if (!Array.isArray(traceIndices) || !traceIndices.length) { return gd2.data.map(function(_, i2) { return i2; }); } else if (Array.isArray(traceIndices)) { var traceIndicesOut = []; for (var i = 0; i < traceIndices.length; i++) { if (Lib.isIndex(traceIndices[i], gd2.data.length)) { traceIndicesOut.push(traceIndices[i]); } else { Lib.warn("trace index (", traceIndices[i], ") is not a number or is out of bounds"); } } return traceIndicesOut; } return traceIndices; }; exports2.manageArrayContainers = function(np2, newVal, undoit) { var obj = np2.obj; var parts = np2.parts; var pLength = parts.length; var pLast = parts[pLength - 1]; var pLastIsNumber = isNumeric(pLast); if (pLastIsNumber && newVal === null) { var contPath = parts.slice(0, pLength - 1).join("."); var cont = Lib.nestedProperty(obj, contPath).get(); cont.splice(pLast, 1); } else if (pLastIsNumber && np2.get() === void 0) { if (np2.get() === void 0) undoit[np2.astr] = null; np2.set(newVal); } else { np2.set(newVal); } }; var ATTR_TAIL_RE = /(\.[^\[\]\.]+|\[[^\[\]\.]+\])$/; function getParent(attr) { var tail = attr.search(ATTR_TAIL_RE); if (tail > 0) return attr.substr(0, tail); } exports2.hasParent = function(aobj, attr) { var attrParent = getParent(attr); while (attrParent) { if (attrParent in aobj) return true; attrParent = getParent(attrParent); } return false; }; var axLetters = ["x", "y", "z"]; exports2.clearAxisTypes = function(gd2, traces, layoutUpdate) { for (var i = 0; i < traces.length; i++) { var trace = gd2._fullData[i]; for (var j = 0; j < 3; j++) { var ax = getFromTrace(gd2, trace, axLetters[j]); if (ax && ax.type !== "log") { var axAttr = ax._name; var sceneName = ax._id.substr(1); if (sceneName.substr(0, 5) === "scene") { if (layoutUpdate[sceneName] !== void 0) continue; axAttr = sceneName + "." + axAttr; } var typeAttr = axAttr + ".type"; if (layoutUpdate[axAttr] === void 0 && layoutUpdate[typeAttr] === void 0) { Lib.nestedProperty(gd2.layout, typeAttr).set(null); } } } } }; } }); // node_modules/plotly.js/src/plot_api/plot_api.js var require_plot_api = __commonJS({ "node_modules/plotly.js/src/plot_api/plot_api.js"(exports2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var hasHover = require_has_hover(); var Lib = require_lib(); var nestedProperty = Lib.nestedProperty; var Events = require_events2(); var Queue = require_queue(); var Registry = require_registry(); var PlotSchema = require_plot_schema(); var Plots = require_plots(); var Axes = require_axes(); var handleRangeDefaults = require_range_defaults(); var cartesianLayoutAttributes = require_layout_attributes4(); var Drawing = require_drawing(); var Color = require_color(); var initInteractions = require_graph_interact().initInteractions; var xmlnsNamespaces = require_xmlns_namespaces(); var clearOutline = require_selections().clearOutline; var dfltConfig = require_plot_config().dfltConfig; var manageArrays = require_manage_arrays(); var helpers = require_helpers9(); var subroutines = require_subroutines(); var editTypes = require_edit_types(); var AX_NAME_PATTERN = require_constants2().AX_NAME_PATTERN; var numericNameWarningCount = 0; var numericNameWarningCountLimit = 5; function _doPlot(gd2, data, layout, config) { var frames; gd2 = Lib.getGraphDiv(gd2); Events.init(gd2); if (Lib.isPlainObject(data)) { var obj = data; data = obj.data; layout = obj.layout; config = obj.config; frames = obj.frames; } var okToPlot = Events.triggerHandler(gd2, "plotly_beforeplot", [data, layout, config]); if (okToPlot === false) return Promise.reject(); if (!data && !layout && !Lib.isPlotDiv(gd2)) { Lib.warn("Calling _doPlot as if redrawing but this container doesn't yet have a plot.", gd2); } function addFrames2() { if (frames) { return exports2.addFrames(gd2, frames); } } setPlotContext(gd2, config); if (!layout) layout = {}; d3.select(gd2).classed("js-plotly-plot", true); Drawing.makeTester(); if (!Array.isArray(gd2._promises)) gd2._promises = []; var graphWasEmpty = (gd2.data || []).length === 0 && Array.isArray(data); if (Array.isArray(data)) { helpers.cleanData(data); if (graphWasEmpty) gd2.data = data; else gd2.data.push.apply(gd2.data, data); gd2.empty = false; } if (!gd2.layout || graphWasEmpty) { gd2.layout = helpers.cleanLayout(layout); } Plots.supplyDefaults(gd2); var fullLayout = gd2._fullLayout; var hasCartesian = fullLayout._has("cartesian"); fullLayout._replotting = true; if (graphWasEmpty || fullLayout._shouldCreateBgLayer) { makePlotFramework(gd2); if (fullLayout._shouldCreateBgLayer) { delete fullLayout._shouldCreateBgLayer; } } Drawing.initGradients(gd2); Drawing.initPatterns(gd2); if (graphWasEmpty) Axes.saveShowSpikeInitial(gd2); var recalc = !gd2.calcdata || gd2.calcdata.length !== (gd2._fullData || []).length; if (recalc) Plots.doCalcdata(gd2); for (var i = 0; i < gd2.calcdata.length; i++) { gd2.calcdata[i][0].trace = gd2._fullData[i]; } if (gd2._context.responsive) { if (!gd2._responsiveChartHandler) { gd2._responsiveChartHandler = function() { if (!Lib.isHidden(gd2)) Plots.resize(gd2); }; window.addEventListener("resize", gd2._responsiveChartHandler); } } else { Lib.clearResponsive(gd2); } var oldMargins = Lib.extendFlat({}, fullLayout._size); var drawFrameworkCalls = 0; function drawFramework() { var basePlotModules = fullLayout._basePlotModules; for (var i2 = 0; i2 < basePlotModules.length; i2++) { if (basePlotModules[i2].drawFramework) { basePlotModules[i2].drawFramework(gd2); } } if (!fullLayout._glcanvas && fullLayout._has("gl")) { fullLayout._glcanvas = fullLayout._glcontainer.selectAll(".gl-canvas").data([{ key: "contextLayer", context: true, pick: false }, { key: "focusLayer", context: false, pick: false }, { key: "pickLayer", context: false, pick: true }], function(d) { return d.key; }); fullLayout._glcanvas.enter().append("canvas").attr("class", function(d) { return "gl-canvas gl-canvas-" + d.key.replace("Layer", ""); }).style({ position: "absolute", top: 0, left: 0, overflow: "visible", "pointer-events": "none" }); } var plotGlPixelRatio = gd2._context.plotGlPixelRatio; if (fullLayout._glcanvas) { fullLayout._glcanvas.attr("width", fullLayout.width * plotGlPixelRatio).attr("height", fullLayout.height * plotGlPixelRatio).style("width", fullLayout.width + "px").style("height", fullLayout.height + "px"); var regl = fullLayout._glcanvas.data()[0].regl; if (regl) { if (Math.floor(fullLayout.width * plotGlPixelRatio) !== regl._gl.drawingBufferWidth || Math.floor(fullLayout.height * plotGlPixelRatio) !== regl._gl.drawingBufferHeight) { var msg = "WebGL context buffer and canvas dimensions do not match due to browser/WebGL bug."; if (drawFrameworkCalls) { Lib.error(msg); } else { Lib.log(msg + " Clearing graph and plotting again."); Plots.cleanPlot([], {}, gd2._fullData, fullLayout); Plots.supplyDefaults(gd2); fullLayout = gd2._fullLayout; Plots.doCalcdata(gd2); drawFrameworkCalls++; return drawFramework(); } } } } if (fullLayout.modebar.orientation === "h") { fullLayout._modebardiv.style("height", null).style("width", "100%"); } else { fullLayout._modebardiv.style("width", null).style("height", fullLayout.height + "px"); } return Plots.previousPromises(gd2); } function marginPushers() { Plots.clearAutoMarginIds(gd2); subroutines.drawMarginPushers(gd2); Axes.allowAutoMargin(gd2); if (gd2._fullLayout.title.text && gd2._fullLayout.title.automargin) Plots.allowAutoMargin(gd2, "title.automargin"); if (fullLayout._has("pie")) { var fullData = gd2._fullData; for (var i2 = 0; i2 < fullData.length; i2++) { var trace = fullData[i2]; if (trace.type === "pie" && trace.automargin) { Plots.allowAutoMargin(gd2, "pie." + trace.uid + ".automargin"); } } } Plots.doAutoMargin(gd2); return Plots.previousPromises(gd2); } function marginPushersAgain() { if (!Plots.didMarginChange(oldMargins, fullLayout._size)) return; return Lib.syncOrAsync([ marginPushers, subroutines.layoutStyles ], gd2); } function positionAndAutorange() { if (!recalc) { doAutoRangeAndConstraints(); return; } return Lib.syncOrAsync([ Registry.getComponentMethod("shapes", "calcAutorange"), Registry.getComponentMethod("annotations", "calcAutorange"), doAutoRangeAndConstraints ], gd2); } function doAutoRangeAndConstraints() { if (gd2._transitioning) return; subroutines.doAutoRangeAndConstraints(gd2); if (graphWasEmpty) Axes.saveRangeInitial(gd2); Registry.getComponentMethod("rangeslider", "calcAutorange")(gd2); } function drawAxes() { return Axes.draw(gd2, graphWasEmpty ? "" : "redraw"); } var seq = [ Plots.previousPromises, addFrames2, drawFramework, marginPushers, marginPushersAgain ]; if (hasCartesian) seq.push(positionAndAutorange); seq.push(subroutines.layoutStyles); if (hasCartesian) { seq.push( drawAxes, function insideTickLabelsAutorange(gd3) { var insideTickLabelsUpdaterange = gd3._fullLayout._insideTickLabelsUpdaterange; if (insideTickLabelsUpdaterange) { gd3._fullLayout._insideTickLabelsUpdaterange = void 0; return relayout(gd3, insideTickLabelsUpdaterange).then(function() { Axes.saveRangeInitial(gd3, true); }); } } ); } seq.push( subroutines.drawData, subroutines.finalDraw, initInteractions, Plots.addLinks, Plots.rehover, Plots.redrag, Plots.reselect, // TODO: doAutoMargin is only needed here for axis automargin, which // happens outside of marginPushers where all the other automargins are // calculated. Would be much better to separate margin calculations from // component drawing - see https://github.com/plotly/plotly.js/issues/2704 Plots.doAutoMargin, Plots.previousPromises ); var plotDone = Lib.syncOrAsync(seq, gd2); if (!plotDone || !plotDone.then) plotDone = Promise.resolve(); return plotDone.then(function() { emitAfterPlot(gd2); return gd2; }); } function emitAfterPlot(gd2) { var fullLayout = gd2._fullLayout; if (fullLayout._redrawFromAutoMarginCount) { fullLayout._redrawFromAutoMarginCount--; } else { gd2.emit("plotly_afterplot"); } } function setPlotConfig(obj) { return Lib.extendFlat(dfltConfig, obj); } function setBackground(gd2, bgColor) { try { gd2._fullLayout._paper.style("background", bgColor); } catch (e) { Lib.error(e); } } function opaqueSetBackground(gd2, bgColor) { var blend = Color.combine(bgColor, "white"); setBackground(gd2, blend); } function setPlotContext(gd2, config) { if (!gd2._context) { gd2._context = Lib.extendDeep({}, dfltConfig); var base = d3.select("base"); gd2._context._baseUrl = base.size() && base.attr("href") ? window.location.href.split("#")[0] : ""; } var context = gd2._context; var i, keys, key; if (config) { keys = Object.keys(config); for (i = 0; i < keys.length; i++) { key = keys[i]; if (key === "editable" || key === "edits") continue; if (key in context) { if (key === "setBackground" && config[key] === "opaque") { context[key] = opaqueSetBackground; } else { context[key] = config[key]; } } } if (config.plot3dPixelRatio && !context.plotGlPixelRatio) { context.plotGlPixelRatio = context.plot3dPixelRatio; } var editable = config.editable; if (editable !== void 0) { context.editable = editable; keys = Object.keys(context.edits); for (i = 0; i < keys.length; i++) { context.edits[keys[i]] = editable; } } if (config.edits) { keys = Object.keys(config.edits); for (i = 0; i < keys.length; i++) { key = keys[i]; if (key in context.edits) { context.edits[key] = config.edits[key]; } } } context._exportedPlot = config._exportedPlot; } if (context.staticPlot) { context.editable = false; context.edits = {}; context.autosizable = false; context.scrollZoom = false; context.doubleClick = false; context.showTips = false; context.showLink = false; context.displayModeBar = false; } if (context.displayModeBar === "hover" && !hasHover) { context.displayModeBar = true; } if (context.setBackground === "transparent" || typeof context.setBackground !== "function") { context.setBackground = setBackground; } context._hasZeroHeight = context._hasZeroHeight || gd2.clientHeight === 0; context._hasZeroWidth = context._hasZeroWidth || gd2.clientWidth === 0; var szIn = context.scrollZoom; var szOut = context._scrollZoom = {}; if (szIn === true) { szOut.cartesian = 1; szOut.gl3d = 1; szOut.geo = 1; szOut.mapbox = 1; szOut.map = 1; } else if (typeof szIn === "string") { var parts = szIn.split("+"); for (i = 0; i < parts.length; i++) { szOut[parts[i]] = 1; } } else if (szIn !== false) { szOut.gl3d = 1; szOut.geo = 1; szOut.mapbox = 1; szOut.map = 1; } } function redraw(gd2) { gd2 = Lib.getGraphDiv(gd2); if (!Lib.isPlotDiv(gd2)) { throw new Error("This element is not a Plotly plot: " + gd2); } helpers.cleanData(gd2.data); helpers.cleanLayout(gd2.layout); gd2.calcdata = void 0; return exports2._doPlot(gd2).then(function() { gd2.emit("plotly_redraw"); return gd2; }); } function newPlot(gd2, data, layout, config) { gd2 = Lib.getGraphDiv(gd2); Plots.cleanPlot([], {}, gd2._fullData || [], gd2._fullLayout || {}); Plots.purge(gd2); return exports2._doPlot(gd2, data, layout, config); } function positivifyIndices(indices, maxIndex) { var parentLength = maxIndex + 1; var positiveIndices = []; var i; var index; for (i = 0; i < indices.length; i++) { index = indices[i]; if (index < 0) { positiveIndices.push(parentLength + index); } else { positiveIndices.push(index); } } return positiveIndices; } function assertIndexArray(gd2, indices, arrayName) { var i, index; for (i = 0; i < indices.length; i++) { index = indices[i]; if (index !== parseInt(index, 10)) { throw new Error("all values in " + arrayName + " must be integers"); } if (index >= gd2.data.length || index < -gd2.data.length) { throw new Error(arrayName + " must be valid indices for gd.data."); } if (indices.indexOf(index, i + 1) > -1 || index >= 0 && indices.indexOf(-gd2.data.length + index) > -1 || index < 0 && indices.indexOf(gd2.data.length + index) > -1) { throw new Error("each index in " + arrayName + " must be unique."); } } } function checkMoveTracesArgs(gd2, currentIndices, newIndices) { if (!Array.isArray(gd2.data)) { throw new Error("gd.data must be an array."); } if (typeof currentIndices === "undefined") { throw new Error("currentIndices is a required argument."); } else if (!Array.isArray(currentIndices)) { currentIndices = [currentIndices]; } assertIndexArray(gd2, currentIndices, "currentIndices"); if (typeof newIndices !== "undefined" && !Array.isArray(newIndices)) { newIndices = [newIndices]; } if (typeof newIndices !== "undefined") { assertIndexArray(gd2, newIndices, "newIndices"); } if (typeof newIndices !== "undefined" && currentIndices.length !== newIndices.length) { throw new Error("current and new indices must be of equal length."); } } function checkAddTracesArgs(gd2, traces, newIndices) { var i, value; if (!Array.isArray(gd2.data)) { throw new Error("gd.data must be an array."); } if (typeof traces === "undefined") { throw new Error("traces must be defined."); } if (!Array.isArray(traces)) { traces = [traces]; } for (i = 0; i < traces.length; i++) { value = traces[i]; if (typeof value !== "object" || (Array.isArray(value) || value === null)) { throw new Error("all values in traces array must be non-array objects"); } } if (typeof newIndices !== "undefined" && !Array.isArray(newIndices)) { newIndices = [newIndices]; } if (typeof newIndices !== "undefined" && newIndices.length !== traces.length) { throw new Error( "if indices is specified, traces.length must equal indices.length" ); } } function assertExtendTracesArgs(gd2, update2, indices, maxPoints) { var maxPointsIsObject = Lib.isPlainObject(maxPoints); if (!Array.isArray(gd2.data)) { throw new Error("gd.data must be an array"); } if (!Lib.isPlainObject(update2)) { throw new Error("update must be a key:value object"); } if (typeof indices === "undefined") { throw new Error("indices must be an integer or array of integers"); } assertIndexArray(gd2, indices, "indices"); for (var key in update2) { if (!Array.isArray(update2[key]) || update2[key].length !== indices.length) { throw new Error("attribute " + key + " must be an array of length equal to indices array length"); } if (maxPointsIsObject && (!(key in maxPoints) || !Array.isArray(maxPoints[key]) || maxPoints[key].length !== update2[key].length)) { throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object"); } } } function getExtendProperties(gd2, update2, indices, maxPoints) { var maxPointsIsObject = Lib.isPlainObject(maxPoints); var updateProps = []; var trace, target, prop, insert, maxp; if (!Array.isArray(indices)) indices = [indices]; indices = positivifyIndices(indices, gd2.data.length - 1); for (var key in update2) { for (var j = 0; j < indices.length; j++) { trace = gd2.data[indices[j]]; prop = nestedProperty(trace, key); target = prop.get(); insert = update2[key][j]; if (!Lib.isArrayOrTypedArray(insert)) { throw new Error("attribute: " + key + " index: " + j + " must be an array"); } if (!Lib.isArrayOrTypedArray(target)) { throw new Error("cannot extend missing or non-array attribute: " + key); } if (target.constructor !== insert.constructor) { throw new Error("cannot extend array with an array of a different type: " + key); } maxp = maxPointsIsObject ? maxPoints[key][j] : maxPoints; if (!isNumeric(maxp)) maxp = -1; updateProps.push({ prop, target, insert, maxp: Math.floor(maxp) }); } } return updateProps; } function spliceTraces(gd2, update2, indices, maxPoints, updateArray) { assertExtendTracesArgs(gd2, update2, indices, maxPoints); var updateProps = getExtendProperties(gd2, update2, indices, maxPoints); var undoUpdate = {}; var undoPoints = {}; for (var i = 0; i < updateProps.length; i++) { var prop = updateProps[i].prop; var maxp = updateProps[i].maxp; var out = updateArray(updateProps[i].target, updateProps[i].insert, maxp); prop.set(out[0]); if (!Array.isArray(undoUpdate[prop.astr])) undoUpdate[prop.astr] = []; undoUpdate[prop.astr].push(out[1]); if (!Array.isArray(undoPoints[prop.astr])) undoPoints[prop.astr] = []; undoPoints[prop.astr].push(updateProps[i].target.length); } return { update: undoUpdate, maxPoints: undoPoints }; } function concatTypedArray(arr0, arr1) { var arr2 = new arr0.constructor(arr0.length + arr1.length); arr2.set(arr0); arr2.set(arr1, arr0.length); return arr2; } function extendTraces(gd2, update2, indices, maxPoints) { gd2 = Lib.getGraphDiv(gd2); function updateArray(target, insert, maxp) { var newArray, remainder; if (Lib.isTypedArray(target)) { if (maxp < 0) { var none = new target.constructor(0); var both = concatTypedArray(target, insert); if (maxp < 0) { newArray = both; remainder = none; } else { newArray = none; remainder = both; } } else { newArray = new target.constructor(maxp); remainder = new target.constructor(target.length + insert.length - maxp); if (maxp === insert.length) { newArray.set(insert); remainder.set(target); } else if (maxp < insert.length) { var numberOfItemsFromInsert = insert.length - maxp; newArray.set(insert.subarray(numberOfItemsFromInsert)); remainder.set(target); remainder.set(insert.subarray(0, numberOfItemsFromInsert), target.length); } else { var numberOfItemsFromTarget = maxp - insert.length; var targetBegin = target.length - numberOfItemsFromTarget; newArray.set(target.subarray(targetBegin)); newArray.set(insert, numberOfItemsFromTarget); remainder.set(target.subarray(0, targetBegin)); } } } else { newArray = target.concat(insert); remainder = maxp >= 0 && maxp < newArray.length ? newArray.splice(0, newArray.length - maxp) : []; } return [newArray, remainder]; } var undo = spliceTraces(gd2, update2, indices, maxPoints, updateArray); var promise = exports2.redraw(gd2); var undoArgs = [gd2, undo.update, indices, undo.maxPoints]; Queue.add(gd2, exports2.prependTraces, undoArgs, extendTraces, arguments); return promise; } function prependTraces(gd2, update2, indices, maxPoints) { gd2 = Lib.getGraphDiv(gd2); function updateArray(target, insert, maxp) { var newArray, remainder; if (Lib.isTypedArray(target)) { if (maxp <= 0) { var none = new target.constructor(0); var both = concatTypedArray(insert, target); if (maxp < 0) { newArray = both; remainder = none; } else { newArray = none; remainder = both; } } else { newArray = new target.constructor(maxp); remainder = new target.constructor(target.length + insert.length - maxp); if (maxp === insert.length) { newArray.set(insert); remainder.set(target); } else if (maxp < insert.length) { var numberOfItemsFromInsert = insert.length - maxp; newArray.set(insert.subarray(0, numberOfItemsFromInsert)); remainder.set(insert.subarray(numberOfItemsFromInsert)); remainder.set(target, numberOfItemsFromInsert); } else { var numberOfItemsFromTarget = maxp - insert.length; newArray.set(insert); newArray.set(target.subarray(0, numberOfItemsFromTarget), insert.length); remainder.set(target.subarray(numberOfItemsFromTarget)); } } } else { newArray = insert.concat(target); remainder = maxp >= 0 && maxp < newArray.length ? newArray.splice(maxp, newArray.length) : []; } return [newArray, remainder]; } var undo = spliceTraces(gd2, update2, indices, maxPoints, updateArray); var promise = exports2.redraw(gd2); var undoArgs = [gd2, undo.update, indices, undo.maxPoints]; Queue.add(gd2, exports2.extendTraces, undoArgs, prependTraces, arguments); return promise; } function addTraces(gd2, traces, newIndices) { gd2 = Lib.getGraphDiv(gd2); var currentIndices = []; var undoFunc = exports2.deleteTraces; var redoFunc = addTraces; var undoArgs = [gd2, currentIndices]; var redoArgs = [gd2, traces]; var i; var promise; checkAddTracesArgs(gd2, traces, newIndices); if (!Array.isArray(traces)) { traces = [traces]; } traces = traces.map(function(trace) { return Lib.extendFlat({}, trace); }); helpers.cleanData(traces); for (i = 0; i < traces.length; i++) { gd2.data.push(traces[i]); } for (i = 0; i < traces.length; i++) { currentIndices.push(-traces.length + i); } if (typeof newIndices === "undefined") { promise = exports2.redraw(gd2); Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); return promise; } if (!Array.isArray(newIndices)) { newIndices = [newIndices]; } try { checkMoveTracesArgs(gd2, currentIndices, newIndices); } catch (error) { gd2.data.splice(gd2.data.length - traces.length, traces.length); throw error; } Queue.startSequence(gd2); Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); promise = exports2.moveTraces(gd2, currentIndices, newIndices); Queue.stopSequence(gd2); return promise; } function deleteTraces(gd2, indices) { gd2 = Lib.getGraphDiv(gd2); var traces = []; var undoFunc = exports2.addTraces; var redoFunc = deleteTraces; var undoArgs = [gd2, traces, indices]; var redoArgs = [gd2, indices]; var i; var deletedTrace; if (typeof indices === "undefined") { throw new Error("indices must be an integer or array of integers."); } else if (!Array.isArray(indices)) { indices = [indices]; } assertIndexArray(gd2, indices, "indices"); indices = positivifyIndices(indices, gd2.data.length - 1); indices.sort(Lib.sorterDes); for (i = 0; i < indices.length; i += 1) { deletedTrace = gd2.data.splice(indices[i], 1)[0]; traces.push(deletedTrace); } var promise = exports2.redraw(gd2); Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); return promise; } function moveTraces(gd2, currentIndices, newIndices) { gd2 = Lib.getGraphDiv(gd2); var newData = []; var movingTraceMap = []; var undoFunc = moveTraces; var redoFunc = moveTraces; var undoArgs = [gd2, newIndices, currentIndices]; var redoArgs = [gd2, currentIndices, newIndices]; var i; checkMoveTracesArgs(gd2, currentIndices, newIndices); currentIndices = Array.isArray(currentIndices) ? currentIndices : [currentIndices]; if (typeof newIndices === "undefined") { newIndices = []; for (i = 0; i < currentIndices.length; i++) { newIndices.push(-currentIndices.length + i); } } newIndices = Array.isArray(newIndices) ? newIndices : [newIndices]; currentIndices = positivifyIndices(currentIndices, gd2.data.length - 1); newIndices = positivifyIndices(newIndices, gd2.data.length - 1); for (i = 0; i < gd2.data.length; i++) { if (currentIndices.indexOf(i) === -1) { newData.push(gd2.data[i]); } } for (i = 0; i < currentIndices.length; i++) { movingTraceMap.push({ newIndex: newIndices[i], trace: gd2.data[currentIndices[i]] }); } movingTraceMap.sort(function(a, b) { return a.newIndex - b.newIndex; }); for (i = 0; i < movingTraceMap.length; i += 1) { newData.splice(movingTraceMap[i].newIndex, 0, movingTraceMap[i].trace); } gd2.data = newData; var promise = exports2.redraw(gd2); Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); return promise; } function restyle(gd2, astr, val, _traces) { gd2 = Lib.getGraphDiv(gd2); helpers.clearPromiseQueue(gd2); var aobj = {}; if (typeof astr === "string") aobj[astr] = val; else if (Lib.isPlainObject(astr)) { aobj = Lib.extendFlat({}, astr); if (_traces === void 0) _traces = val; } else { Lib.warn("Restyle fail.", astr, val, _traces); return Promise.reject(); } if (Object.keys(aobj).length) gd2.changed = true; var traces = helpers.coerceTraceIndices(gd2, _traces); var specs = _restyle(gd2, aobj, traces); var flags = specs.flags; if (flags.calc) gd2.calcdata = void 0; if (flags.clearAxisTypes) helpers.clearAxisTypes(gd2, traces, {}); var seq = []; if (flags.fullReplot) { seq.push(exports2._doPlot); } else { seq.push(Plots.previousPromises); Plots.supplyDefaults(gd2); if (flags.markerSize) { Plots.doCalcdata(gd2); addAxRangeSequence(seq); } if (flags.style) seq.push(subroutines.doTraceStyle); if (flags.colorbars) seq.push(subroutines.doColorBars); seq.push(emitAfterPlot); } seq.push( Plots.rehover, Plots.redrag, Plots.reselect ); Queue.add( gd2, restyle, [gd2, specs.undoit, specs.traces], restyle, [gd2, specs.redoit, specs.traces] ); var plotDone = Lib.syncOrAsync(seq, gd2); if (!plotDone || !plotDone.then) plotDone = Promise.resolve(); return plotDone.then(function() { gd2.emit("plotly_restyle", specs.eventData); return gd2; }); } function undefinedToNull(val) { if (val === void 0) return null; return val; } function makeNP(preGUI, guiEditFlag) { if (!guiEditFlag) return nestedProperty; return function(container, attr, prefix) { var np2 = nestedProperty(container, attr); var npSet = np2.set; np2.set = function(val) { var fullAttr = (prefix || "") + attr; storeCurrent(fullAttr, np2.get(), val, preGUI); npSet(val); }; return np2; }; } function storeCurrent(attr, val, newVal, preGUI) { if (Array.isArray(val) || Array.isArray(newVal)) { var arrayVal = Array.isArray(val) ? val : []; var arrayNew = Array.isArray(newVal) ? newVal : []; var maxLen = Math.max(arrayVal.length, arrayNew.length); for (var i = 0; i < maxLen; i++) { storeCurrent(attr + "[" + i + "]", arrayVal[i], arrayNew[i], preGUI); } } else if (Lib.isPlainObject(val) || Lib.isPlainObject(newVal)) { var objVal = Lib.isPlainObject(val) ? val : {}; var objNew = Lib.isPlainObject(newVal) ? newVal : {}; var objBoth = Lib.extendFlat({}, objVal, objNew); for (var key in objBoth) { storeCurrent(attr + "." + key, objVal[key], objNew[key], preGUI); } } else if (preGUI[attr] === void 0) { preGUI[attr] = undefinedToNull(val); } } function _storeDirectGUIEdit(container, preGUI, edits) { for (var attr in edits) { var np2 = nestedProperty(container, attr); storeCurrent(attr, np2.get(), edits[attr], preGUI); } } function _restyle(gd2, aobj, traces) { var fullLayout = gd2._fullLayout; var fullData = gd2._fullData; var data = gd2.data; var guiEditFlag = fullLayout._guiEditing; var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag); var eventData = Lib.extendDeepAll({}, aobj); var i; cleanDeprecatedAttributeKeys(aobj); var flags = editTypes.traceFlags(); var redoit = {}; var undoit = {}; var axlist; function a02() { return traces.map(function() { return void 0; }); } function addToAxlist(axid) { var axName = Axes.id2name(axid); if (axlist.indexOf(axName) === -1) axlist.push(axName); } function autorangeAttr(axName) { return "LAYOUT" + axName + ".autorange"; } function rangeAttr(axName) { return "LAYOUT" + axName + ".range"; } function getFullTrace(traceIndex) { for (var j = traceIndex; j < fullData.length; j++) { if (fullData[j]._input === data[traceIndex]) return fullData[j]; } } function doextra(attr, val, i2) { if (Array.isArray(attr)) { attr.forEach(function(a) { doextra(a, val, i2); }); return; } if (attr in aobj || helpers.hasParent(aobj, attr)) return; var extraparam; if (attr.substr(0, 6) === "LAYOUT") { extraparam = layoutNP(gd2.layout, attr.replace("LAYOUT", "")); } else { var tracei = traces[i2]; var preGUI2 = fullLayout._tracePreGUI[getFullTrace(tracei)._fullInput.uid]; extraparam = makeNP(preGUI2, guiEditFlag)(data[tracei], attr); } if (!(attr in undoit)) { undoit[attr] = a02(); } if (undoit[attr][i2] === void 0) { undoit[attr][i2] = undefinedToNull(extraparam.get()); } if (val !== void 0) { extraparam.set(val); } } function allBins(binAttr) { return function(j) { return fullData[j][binAttr]; }; } function arrayBins(binAttr) { return function(vij, j) { return vij === false ? fullData[traces[j]][binAttr] : null; }; } for (var ai2 in aobj) { if (helpers.hasParent(aobj, ai2)) { throw new Error("cannot set " + ai2 + " and a parent attribute simultaneously"); } var vi2 = aobj[ai2]; var cont; var contFull; var param; var oldVal; var newVal; var valObject; if (ai2 === "autobinx" || ai2 === "autobiny") { ai2 = ai2.charAt(ai2.length - 1) + "bins"; if (Array.isArray(vi2)) vi2 = vi2.map(arrayBins(ai2)); else if (vi2 === false) vi2 = traces.map(allBins(ai2)); else vi2 = null; } redoit[ai2] = vi2; if (ai2.substr(0, 6) === "LAYOUT") { param = layoutNP(gd2.layout, ai2.replace("LAYOUT", "")); undoit[ai2] = [undefinedToNull(param.get())]; param.set(Array.isArray(vi2) ? vi2[0] : vi2); flags.calc = true; continue; } undoit[ai2] = a02(); for (i = 0; i < traces.length; i++) { cont = data[traces[i]]; contFull = getFullTrace(traces[i]); var preGUI = fullLayout._tracePreGUI[contFull._fullInput.uid]; param = makeNP(preGUI, guiEditFlag)(cont, ai2); oldVal = param.get(); newVal = Array.isArray(vi2) ? vi2[i % vi2.length] : vi2; if (newVal === void 0) continue; var finalPart = param.parts[param.parts.length - 1]; var prefix = ai2.substr(0, ai2.length - finalPart.length - 1); var prefixDot = prefix ? prefix + "." : ""; var innerContFull = prefix ? nestedProperty(contFull, prefix).get() : contFull; valObject = PlotSchema.getTraceValObject(contFull, param.parts); if (valObject && valObject.impliedEdits && newVal !== null) { for (var impliedKey in valObject.impliedEdits) { doextra(Lib.relativeAttr(ai2, impliedKey), valObject.impliedEdits[impliedKey], i); } } else if ((finalPart === "thicknessmode" || finalPart === "lenmode") && oldVal !== newVal && (newVal === "fraction" || newVal === "pixels") && innerContFull) { var gs2 = fullLayout._size; var orient = innerContFull.orient; var topOrBottom = orient === "top" || orient === "bottom"; if (finalPart === "thicknessmode") { var thicknorm = topOrBottom ? gs2.h : gs2.w; doextra(prefixDot + "thickness", innerContFull.thickness * (newVal === "fraction" ? 1 / thicknorm : thicknorm), i); } else { var lennorm = topOrBottom ? gs2.w : gs2.h; doextra(prefixDot + "len", innerContFull.len * (newVal === "fraction" ? 1 / lennorm : lennorm), i); } } else if (ai2 === "type" && (newVal === "pie" !== (oldVal === "pie") || newVal === "funnelarea" !== (oldVal === "funnelarea"))) { var labelsTo = "x"; var valuesTo = "y"; if ((newVal === "bar" || oldVal === "bar") && cont.orientation === "h") { labelsTo = "y"; valuesTo = "x"; } Lib.swapAttrs(cont, ["?", "?src"], "labels", labelsTo); Lib.swapAttrs(cont, ["d?", "?0"], "label", labelsTo); Lib.swapAttrs(cont, ["?", "?src"], "values", valuesTo); if (oldVal === "pie" || oldVal === "funnelarea") { nestedProperty(cont, "marker.color").set(nestedProperty(cont, "marker.colors").get()); fullLayout._pielayer.selectAll("g.trace").remove(); } else if (Registry.traceIs(cont, "cartesian")) { nestedProperty(cont, "marker.colors").set(nestedProperty(cont, "marker.color").get()); } } undoit[ai2][i] = undefinedToNull(oldVal); var swapAttrs = [ "swapxy", "swapxyaxes", "orientation", "orientationaxes" ]; if (swapAttrs.indexOf(ai2) !== -1) { if (ai2 === "orientation") { param.set(newVal); var defaultOrientation = cont.x && !cont.y ? "h" : "v"; if ((param.get() || defaultOrientation) === contFull.orientation) { continue; } } else if (ai2 === "orientationaxes") { cont.orientation = { v: "h", h: "v" }[contFull.orientation]; } helpers.swapXYData(cont); flags.calc = flags.clearAxisTypes = true; } else if (Plots.dataArrayContainers.indexOf(param.parts[0]) !== -1) { helpers.manageArrayContainers(param, newVal, undoit); flags.calc = true; } else { if (valObject) { if (valObject.arrayOk && !Registry.traceIs(contFull, "regl") && (Lib.isArrayOrTypedArray(newVal) || Lib.isArrayOrTypedArray(oldVal))) { flags.calc = true; } else editTypes.update(flags, valObject); } else { flags.calc = true; } param.set(newVal); } } if (["swapxyaxes", "orientationaxes"].indexOf(ai2) !== -1) { Axes.swap(gd2, traces); } if (ai2 === "orientationaxes") { var hovermode = nestedProperty(gd2.layout, "hovermode"); var h = hovermode.get(); if (h === "x") { hovermode.set("y"); } else if (h === "y") { hovermode.set("x"); } else if (h === "x unified") { hovermode.set("y unified"); } else if (h === "y unified") { hovermode.set("x unified"); } } if (["orientation", "type"].indexOf(ai2) !== -1) { axlist = []; for (i = 0; i < traces.length; i++) { var trace = data[traces[i]]; if (Registry.traceIs(trace, "cartesian")) { addToAxlist(trace.xaxis || "x"); addToAxlist(trace.yaxis || "y"); } } doextra(axlist.map(autorangeAttr), true, 0); doextra(axlist.map(rangeAttr), [0, 1], 0); } } if (flags.calc || flags.plot) { flags.fullReplot = true; } return { flags, undoit, redoit, traces, eventData: Lib.extendDeepNoArrays([], [eventData, traces]) }; } function cleanDeprecatedAttributeKeys(aobj) { var oldAxisTitleRegex = Lib.counterRegex("axis", ".title", false, false); var colorbarRegex = /colorbar\.title$/; var keys = Object.keys(aobj); var i, key, value; for (i = 0; i < keys.length; i++) { key = keys[i]; value = aobj[key]; if ((key === "title" || oldAxisTitleRegex.test(key) || colorbarRegex.test(key)) && (typeof value === "string" || typeof value === "number")) { replace(key, key.replace("title", "title.text")); } else if (key.indexOf("titlefont") > -1 && key.indexOf("grouptitlefont") === -1) { replace(key, key.replace("titlefont", "title.font")); } else if (key.indexOf("titleposition") > -1) { replace(key, key.replace("titleposition", "title.position")); } else if (key.indexOf("titleside") > -1) { replace(key, key.replace("titleside", "title.side")); } else if (key.indexOf("titleoffset") > -1) { replace(key, key.replace("titleoffset", "title.offset")); } } function replace(oldAttrStr, newAttrStr) { aobj[newAttrStr] = aobj[oldAttrStr]; delete aobj[oldAttrStr]; } } function relayout(gd2, astr, val) { gd2 = Lib.getGraphDiv(gd2); helpers.clearPromiseQueue(gd2); var aobj = {}; if (typeof astr === "string") { aobj[astr] = val; } else if (Lib.isPlainObject(astr)) { aobj = Lib.extendFlat({}, astr); } else { Lib.warn("Relayout fail.", astr, val); return Promise.reject(); } if (Object.keys(aobj).length) gd2.changed = true; var specs = _relayout(gd2, aobj); var flags = specs.flags; if (flags.calc) gd2.calcdata = void 0; var seq = [Plots.previousPromises]; if (flags.layoutReplot) { seq.push(subroutines.layoutReplot); } else if (Object.keys(aobj).length) { axRangeSupplyDefaultsByPass(gd2, flags, specs) || Plots.supplyDefaults(gd2); if (flags.legend) seq.push(subroutines.doLegend); if (flags.layoutstyle) seq.push(subroutines.layoutStyles); if (flags.axrange) addAxRangeSequence(seq, specs.rangesAltered); if (flags.ticks) seq.push(subroutines.doTicksRelayout); if (flags.modebar) seq.push(subroutines.doModeBar); if (flags.camera) seq.push(subroutines.doCamera); if (flags.colorbars) seq.push(subroutines.doColorBars); seq.push(emitAfterPlot); } seq.push( Plots.rehover, Plots.redrag, Plots.reselect ); Queue.add( gd2, relayout, [gd2, specs.undoit], relayout, [gd2, specs.redoit] ); var plotDone = Lib.syncOrAsync(seq, gd2); if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd2); return plotDone.then(function() { gd2.emit("plotly_relayout", specs.eventData); return gd2; }); } function axRangeSupplyDefaultsByPass(gd2, flags, specs) { var fullLayout = gd2._fullLayout; if (!flags.axrange) return false; for (var k in flags) { if (k !== "axrange" && flags[k]) return false; } var axIn, axOut; var coerce = function(attr, dflt) { return Lib.coerce(axIn, axOut, cartesianLayoutAttributes, attr, dflt); }; var options = {}; for (var axId in specs.rangesAltered) { var axName = Axes.id2name(axId); axIn = gd2.layout[axName]; axOut = fullLayout[axName]; handleRangeDefaults(axIn, axOut, coerce, options); if (axOut._matchGroup) { for (var axId2 in axOut._matchGroup) { if (axId2 !== axId) { var ax2 = fullLayout[Axes.id2name(axId2)]; ax2.autorange = axOut.autorange; ax2.range = axOut.range.slice(); ax2._input.range = axOut.range.slice(); } } } } return true; } function addAxRangeSequence(seq, rangesAltered) { var drawAxes = rangesAltered ? function(gd2) { var axIds = []; var skipTitle = true; for (var id2 in rangesAltered) { var ax = Axes.getFromId(gd2, id2); axIds.push(id2); if ((ax.ticklabelposition || "").indexOf("inside") !== -1) { if (ax._anchorAxis) { axIds.push(ax._anchorAxis._id); } } if (ax._matchGroup) { for (var id22 in ax._matchGroup) { if (!rangesAltered[id22]) { axIds.push(id22); } } } } return Axes.draw(gd2, axIds, { skipTitle }); } : function(gd2) { return Axes.draw(gd2, "redraw"); }; seq.push( clearOutline, subroutines.doAutoRangeAndConstraints, drawAxes, subroutines.drawData, subroutines.finalDraw ); } var AX_RANGE_RE = /^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/; var AX_AUTORANGE_RE = /^[xyz]axis[0-9]*\.autorange$/; var AX_DOMAIN_RE = /^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/; function _relayout(gd2, aobj) { var layout = gd2.layout; var fullLayout = gd2._fullLayout; var guiEditFlag = fullLayout._guiEditing; var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag); var keys = Object.keys(aobj); var axes = Axes.list(gd2); var eventData = Lib.extendDeepAll({}, aobj); var arrayEdits = {}; var arrayStr, i, j; cleanDeprecatedAttributeKeys(aobj); keys = Object.keys(aobj); for (i = 0; i < keys.length; i++) { if (keys[i].indexOf("allaxes") === 0) { for (j = 0; j < axes.length; j++) { var scene = axes[j]._id.substr(1); var axisAttr = scene.indexOf("scene") !== -1 ? scene + "." : ""; var newkey = keys[i].replace("allaxes", axisAttr + axes[j]._name); if (!aobj[newkey]) aobj[newkey] = aobj[keys[i]]; } delete aobj[keys[i]]; } } var flags = editTypes.layoutFlags(); var redoit = {}; var undoit = {}; function doextra(attr, val) { if (Array.isArray(attr)) { attr.forEach(function(a) { doextra(a, val); }); return; } if (attr in aobj || helpers.hasParent(aobj, attr)) return; var p2 = layoutNP(layout, attr); if (!(attr in undoit)) { undoit[attr] = undefinedToNull(p2.get()); } if (val !== void 0) p2.set(val); } var rangesAltered = {}; var ax; function recordAlteredAxis(pleafPlus2) { var axId2 = Axes.name2id(pleafPlus2.split(".")[0]); rangesAltered[axId2] = 1; return axId2; } for (var ai2 in aobj) { if (helpers.hasParent(aobj, ai2)) { throw new Error("cannot set " + ai2 + " and a parent attribute simultaneously"); } var p = layoutNP(layout, ai2); var vi2 = aobj[ai2]; var plen = p.parts.length; var pend = plen - 1; while (pend > 0 && typeof p.parts[pend] !== "string") pend--; var pleaf = p.parts[pend]; var pleafPlus = p.parts[pend - 1] + "." + pleaf; var ptrunk = p.parts.slice(0, pend).join("."); var parentIn = nestedProperty(gd2.layout, ptrunk).get(); var parentFull = nestedProperty(fullLayout, ptrunk).get(); var vOld = p.get(); if (vi2 === void 0) continue; redoit[ai2] = vi2; undoit[ai2] = pleaf === "reverse" ? vi2 : undefinedToNull(vOld); var valObject = PlotSchema.getLayoutValObject(fullLayout, p.parts); if (valObject && valObject.impliedEdits && vi2 !== null) { for (var impliedKey in valObject.impliedEdits) { doextra(Lib.relativeAttr(ai2, impliedKey), valObject.impliedEdits[impliedKey]); } } if (["width", "height"].indexOf(ai2) !== -1) { if (vi2) { doextra("autosize", null); var oppositeAttr = ai2 === "height" ? "width" : "height"; doextra(oppositeAttr, fullLayout[oppositeAttr]); } else { fullLayout[ai2] = gd2._initialAutoSize[ai2]; } } else if (ai2 === "autosize") { doextra("width", vi2 ? null : fullLayout.width); doextra("height", vi2 ? null : fullLayout.height); } else if (pleafPlus.match(AX_RANGE_RE)) { recordAlteredAxis(pleafPlus); nestedProperty(fullLayout, ptrunk + "._inputRange").set(null); } else if (pleafPlus.match(AX_AUTORANGE_RE)) { recordAlteredAxis(pleafPlus); nestedProperty(fullLayout, ptrunk + "._inputRange").set(null); var axFull = nestedProperty(fullLayout, ptrunk).get(); if (axFull._inputDomain) { axFull._input.domain = axFull._inputDomain.slice(); } } else if (pleafPlus.match(AX_DOMAIN_RE)) { nestedProperty(fullLayout, ptrunk + "._inputDomain").set(null); } if (pleaf === "type") { ax = parentIn; var toLog = parentFull.type === "linear" && vi2 === "log"; var fromLog = parentFull.type === "log" && vi2 === "linear"; if (toLog || fromLog) { if (!ax || !ax.range) { doextra(ptrunk + ".autorange", true); } else if (!parentFull.autorange) { var r02 = ax.range[0]; var r12 = ax.range[1]; if (toLog) { if (r02 <= 0 && r12 <= 0) { doextra(ptrunk + ".autorange", true); } if (r02 <= 0) r02 = r12 / 1e6; else if (r12 <= 0) r12 = r02 / 1e6; doextra(ptrunk + ".range[0]", Math.log(r02) / Math.LN10); doextra(ptrunk + ".range[1]", Math.log(r12) / Math.LN10); } else { doextra(ptrunk + ".range[0]", Math.pow(10, r02)); doextra(ptrunk + ".range[1]", Math.pow(10, r12)); } } else if (toLog) { ax.range = ax.range[1] > ax.range[0] ? [1, 2] : [2, 1]; } if (Array.isArray(fullLayout._subplots.polar) && fullLayout._subplots.polar.length && fullLayout[p.parts[0]] && p.parts[1] === "radialaxis") { delete fullLayout[p.parts[0]]._subplot.viewInitial["radialaxis.range"]; } Registry.getComponentMethod("annotations", "convertCoords")(gd2, parentFull, vi2, doextra); Registry.getComponentMethod("images", "convertCoords")(gd2, parentFull, vi2, doextra); } else { doextra(ptrunk + ".autorange", true); doextra(ptrunk + ".range", null); } nestedProperty(fullLayout, ptrunk + "._inputRange").set(null); } else if (pleaf.match(AX_NAME_PATTERN)) { var fullProp = nestedProperty(fullLayout, ai2).get(); var newType = (vi2 || {}).type; if (!newType || newType === "-") newType = "linear"; Registry.getComponentMethod("annotations", "convertCoords")(gd2, fullProp, newType, doextra); Registry.getComponentMethod("images", "convertCoords")(gd2, fullProp, newType, doextra); } var containerArrayMatch = manageArrays.containerArrayMatch(ai2); if (containerArrayMatch) { arrayStr = containerArrayMatch.array; i = containerArrayMatch.index; var propStr = containerArrayMatch.property; var updateValObject = valObject || { editType: "calc" }; if (i !== "" && propStr === "") { if (manageArrays.isAddVal(vi2)) { undoit[ai2] = null; } else if (manageArrays.isRemoveVal(vi2)) { undoit[ai2] = (nestedProperty(layout, arrayStr).get() || [])[i]; } else { Lib.warn("unrecognized full object value", aobj); } } editTypes.update(flags, updateValObject); if (!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {}; var objEdits = arrayEdits[arrayStr][i]; if (!objEdits) objEdits = arrayEdits[arrayStr][i] = {}; objEdits[propStr] = vi2; delete aobj[ai2]; } else if (pleaf === "reverse") { if (parentIn.range) parentIn.range.reverse(); else { doextra(ptrunk + ".autorange", true); parentIn.range = [1, 0]; } if (parentFull.autorange) flags.calc = true; else flags.plot = true; } else { if (ai2 === "dragmode" && (vi2 === false && vOld !== false || vi2 !== false && vOld === false)) { flags.plot = true; } else if (fullLayout._has("scatter-like") && fullLayout._has("regl") && (ai2 === "dragmode" && (vi2 === "lasso" || vi2 === "select") && !(vOld === "lasso" || vOld === "select"))) { flags.plot = true; } else if (fullLayout._has("gl2d")) { flags.plot = true; } else if (valObject) editTypes.update(flags, valObject); else flags.calc = true; p.set(vi2); } } for (arrayStr in arrayEdits) { var finished = manageArrays.applyContainerArrayChanges( gd2, layoutNP(layout, arrayStr), arrayEdits[arrayStr], flags, layoutNP ); if (!finished) flags.plot = true; } for (var axId in rangesAltered) { ax = Axes.getFromId(gd2, axId); var group = ax && ax._constraintGroup; if (group) { flags.calc = true; for (var groupAxId in group) { if (!rangesAltered[groupAxId]) { Axes.getFromId(gd2, groupAxId)._constraintShrinkable = true; } } } } if (updateAutosize(gd2) || aobj.height || aobj.width) flags.plot = true; var shapes = fullLayout.shapes; for (i = 0; i < shapes.length; i++) { if (shapes[i].showlegend) { flags.calc = true; break; } } if (flags.plot || flags.calc) { flags.layoutReplot = true; } return { flags, rangesAltered, undoit, redoit, eventData }; } function updateAutosize(gd2) { var fullLayout = gd2._fullLayout; var oldWidth = fullLayout.width; var oldHeight = fullLayout.height; if (gd2.layout.autosize) Plots.plotAutoSize(gd2, gd2.layout, fullLayout); return fullLayout.width !== oldWidth || fullLayout.height !== oldHeight; } function update(gd2, traceUpdate, layoutUpdate, _traces) { gd2 = Lib.getGraphDiv(gd2); helpers.clearPromiseQueue(gd2); if (!Lib.isPlainObject(traceUpdate)) traceUpdate = {}; if (!Lib.isPlainObject(layoutUpdate)) layoutUpdate = {}; if (Object.keys(traceUpdate).length) gd2.changed = true; if (Object.keys(layoutUpdate).length) gd2.changed = true; var traces = helpers.coerceTraceIndices(gd2, _traces); var restyleSpecs = _restyle(gd2, Lib.extendFlat({}, traceUpdate), traces); var restyleFlags = restyleSpecs.flags; var relayoutSpecs = _relayout(gd2, Lib.extendFlat({}, layoutUpdate)); var relayoutFlags = relayoutSpecs.flags; if (restyleFlags.calc || relayoutFlags.calc) gd2.calcdata = void 0; if (restyleFlags.clearAxisTypes) helpers.clearAxisTypes(gd2, traces, layoutUpdate); var seq = []; if (relayoutFlags.layoutReplot) { seq.push(subroutines.layoutReplot); } else if (restyleFlags.fullReplot) { seq.push(exports2._doPlot); } else { seq.push(Plots.previousPromises); axRangeSupplyDefaultsByPass(gd2, relayoutFlags, relayoutSpecs) || Plots.supplyDefaults(gd2); if (restyleFlags.style) seq.push(subroutines.doTraceStyle); if (restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars); if (relayoutFlags.legend) seq.push(subroutines.doLegend); if (relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles); if (relayoutFlags.axrange) addAxRangeSequence(seq, relayoutSpecs.rangesAltered); if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout); if (relayoutFlags.modebar) seq.push(subroutines.doModeBar); if (relayoutFlags.camera) seq.push(subroutines.doCamera); seq.push(emitAfterPlot); } seq.push( Plots.rehover, Plots.redrag, Plots.reselect ); Queue.add( gd2, update, [gd2, restyleSpecs.undoit, relayoutSpecs.undoit, restyleSpecs.traces], update, [gd2, restyleSpecs.redoit, relayoutSpecs.redoit, restyleSpecs.traces] ); var plotDone = Lib.syncOrAsync(seq, gd2); if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd2); return plotDone.then(function() { gd2.emit("plotly_update", { data: restyleSpecs.eventData, layout: relayoutSpecs.eventData }); return gd2; }); } function guiEdit(func) { return function wrappedEdit(gd2) { gd2._fullLayout._guiEditing = true; var p = func.apply(null, arguments); gd2._fullLayout._guiEditing = false; return p; }; } var layoutUIControlPatterns = [ { pattern: /^hiddenlabels/, attr: "legend.uirevision" }, { pattern: /^((x|y)axis\d*)\.((auto)?range|title\.text)/ }, // showspikes and modes include those nested inside scenes { pattern: /axis\d*\.showspikes$/, attr: "modebar.uirevision" }, { pattern: /(hover|drag)mode$/, attr: "modebar.uirevision" }, { pattern: /^(scene\d*)\.camera/ }, { pattern: /^(geo\d*)\.(projection|center|fitbounds)/ }, { pattern: /^(ternary\d*\.[abc]axis)\.(min|title\.text)$/ }, { pattern: /^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/ }, { pattern: /^(polar\d*\.angularaxis)\.rotation/ }, { pattern: /^(mapbox\d*)\.(center|zoom|bearing|pitch)/ }, { pattern: /^(map\d*)\.(center|zoom|bearing|pitch)/ }, { pattern: /^legend\.(x|y)$/, attr: "editrevision" }, { pattern: /^(shapes|annotations)/, attr: "editrevision" }, { pattern: /^title\.text$/, attr: "editrevision" } ]; var traceUIControlPatterns = [ { pattern: /^selectedpoints$/, attr: "selectionrevision" }, // "visible" includes trace.transforms[i].styles[j].value.visible { pattern: /(^|value\.)visible$/, attr: "legend.uirevision" }, { pattern: /^dimensions\[\d+\]\.constraintrange/ }, { pattern: /^node\.(x|y|groups)/ }, // for Sankey nodes { pattern: /^level$/ }, // for Sunburst, Treemap and Icicle traces // below this you must be in editable: true mode // TODO: I still put name and title with `trace.uirevision` // reasonable or should these be `editrevision`? // Also applies to axis titles up in the layout section // "name" also includes transform.styles { pattern: /(^|value\.)name$/ }, // including nested colorbar attributes (ie marker.colorbar) { pattern: /colorbar\.title\.text$/ }, { pattern: /colorbar\.(x|y)$/, attr: "editrevision" } ]; function findUIPattern(key, patternSpecs) { for (var i = 0; i < patternSpecs.length; i++) { var spec = patternSpecs[i]; var match = key.match(spec.pattern); if (match) { var head = match[1] || ""; return { head, tail: key.substr(head.length + 1), attr: spec.attr }; } } } function getNewRev(revAttr, container) { var newRev = nestedProperty(container, revAttr).get(); if (newRev !== void 0) return newRev; var parts = revAttr.split("."); parts.pop(); while (parts.length > 1) { parts.pop(); newRev = nestedProperty(container, parts.join(".") + ".uirevision").get(); if (newRev !== void 0) return newRev; } return container.uirevision; } function getFullTraceIndexFromUid(uid, fullData) { for (var i = 0; i < fullData.length; i++) { if (fullData[i]._fullInput.uid === uid) return i; } return -1; } function getTraceIndexFromUid(uid, data, tracei) { for (var i = 0; i < data.length; i++) { if (data[i].uid === uid) return i; } return !data[tracei] || data[tracei].uid ? -1 : tracei; } function valsMatch(v12, v2) { var v1IsObj = Lib.isPlainObject(v12); var v1IsArray = Array.isArray(v12); if (v1IsObj || v1IsArray) { return (v1IsObj && Lib.isPlainObject(v2) || v1IsArray && Array.isArray(v2)) && JSON.stringify(v12) === JSON.stringify(v2); } return v12 === v2; } function applyUIRevisions(data, layout, oldFullData, oldFullLayout) { var layoutPreGUI = oldFullLayout._preGUI; var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail; var bothInheritAutorange = []; var newAutorangeIn = {}; var newRangeAccepted = {}; for (key in layoutPreGUI) { match = findUIPattern(key, layoutUIControlPatterns); if (match) { head = match.head; tail = match.tail; revAttr = match.attr || head + ".uirevision"; oldRev = nestedProperty(oldFullLayout, revAttr).get(); newRev = oldRev && getNewRev(revAttr, layout); if (newRev && newRev === oldRev) { preGUIVal = layoutPreGUI[key]; if (preGUIVal === null) preGUIVal = void 0; newNP = nestedProperty(layout, key); newVal = newNP.get(); if (valsMatch(newVal, preGUIVal)) { if (newVal === void 0 && tail === "autorange") { bothInheritAutorange.push(head); } newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get())); continue; } else if (tail === "autorange" || tail.substr(0, 6) === "range[") { var pre0 = layoutPreGUI[head + ".range[0]"]; var pre1 = layoutPreGUI[head + ".range[1]"]; var preAuto = layoutPreGUI[head + ".autorange"]; if (preAuto || preAuto === null && pre0 === null && pre1 === null) { if (!(head in newAutorangeIn)) { var newContainer = nestedProperty(layout, head).get(); newAutorangeIn[head] = newContainer && (newContainer.autorange || newContainer.autorange !== false && (!newContainer.range || newContainer.range.length !== 2)); } if (newAutorangeIn[head]) { newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get())); continue; } } } } } else { Lib.warn("unrecognized GUI edit: " + key); } delete layoutPreGUI[key]; if (match && match.tail.substr(0, 6) === "range[") { newRangeAccepted[match.head] = 1; } } for (var i = 0; i < bothInheritAutorange.length; i++) { var axAttr = bothInheritAutorange[i]; if (newRangeAccepted[axAttr]) { var newAx = nestedProperty(layout, axAttr).get(); if (newAx) delete newAx.autorange; } } var allTracePreGUI = oldFullLayout._tracePreGUI; for (var uid in allTracePreGUI) { var tracePreGUI = allTracePreGUI[uid]; var newTrace = null; var fullInput; for (key in tracePreGUI) { if (!newTrace) { var fulli = getFullTraceIndexFromUid(uid, oldFullData); if (fulli < 0) { delete allTracePreGUI[uid]; break; } var fullTrace = oldFullData[fulli]; fullInput = fullTrace._fullInput; var newTracei = getTraceIndexFromUid(uid, data, fullInput.index); if (newTracei < 0) { delete allTracePreGUI[uid]; break; } newTrace = data[newTracei]; } match = findUIPattern(key, traceUIControlPatterns); if (match) { if (match.attr) { oldRev = nestedProperty(oldFullLayout, match.attr).get(); newRev = oldRev && getNewRev(match.attr, layout); } else { oldRev = fullInput.uirevision; newRev = newTrace.uirevision; if (newRev === void 0) newRev = layout.uirevision; } if (newRev && newRev === oldRev) { preGUIVal = tracePreGUI[key]; if (preGUIVal === null) preGUIVal = void 0; newNP = nestedProperty(newTrace, key); newVal = newNP.get(); if (valsMatch(newVal, preGUIVal)) { newNP.set(undefinedToNull(nestedProperty(fullInput, key).get())); continue; } } } else { Lib.warn("unrecognized GUI edit: " + key + " in trace uid " + uid); } delete tracePreGUI[key]; } } } function react(gd2, data, layout, config) { var frames, plotDone; function addFrames2() { return exports2.addFrames(gd2, frames); } gd2 = Lib.getGraphDiv(gd2); helpers.clearPromiseQueue(gd2); var oldFullData = gd2._fullData; var oldFullLayout = gd2._fullLayout; if (!Lib.isPlotDiv(gd2) || !oldFullData || !oldFullLayout) { plotDone = exports2.newPlot(gd2, data, layout, config); } else { if (Lib.isPlainObject(data)) { var obj = data; data = obj.data; layout = obj.layout; config = obj.config; frames = obj.frames; } var configChanged = false; if (config) { var oldConfig = Lib.extendDeep({}, gd2._context); gd2._context = void 0; setPlotContext(gd2, config); configChanged = diffConfig(oldConfig, gd2._context); } gd2.data = data || []; helpers.cleanData(gd2.data); gd2.layout = layout || {}; helpers.cleanLayout(gd2.layout); applyUIRevisions(gd2.data, gd2.layout, oldFullData, oldFullLayout); Plots.supplyDefaults(gd2, { skipUpdateCalc: true }); var newFullData = gd2._fullData; var newFullLayout = gd2._fullLayout; var immutable = newFullLayout.datarevision === void 0; var transition = newFullLayout.transition; var relayoutFlags = diffLayout(gd2, oldFullLayout, newFullLayout, immutable, transition); var newDataRevision = relayoutFlags.newDataRevision; var restyleFlags = diffData(gd2, oldFullData, newFullData, immutable, transition, newDataRevision); if (updateAutosize(gd2)) relayoutFlags.layoutReplot = true; if (restyleFlags.calc || relayoutFlags.calc) { gd2.calcdata = void 0; var allNames = Object.getOwnPropertyNames(newFullLayout); for (var q = 0; q < allNames.length; q++) { var name = allNames[q]; var start = name.substring(0, 5); if (start === "xaxis" || start === "yaxis") { var emptyCategories = newFullLayout[name]._emptyCategories; if (emptyCategories) emptyCategories(); } } } else { Plots.supplyDefaultsUpdateCalc(gd2.calcdata, newFullData); } var seq = []; if (frames) { gd2._transitionData = {}; Plots.createTransitionData(gd2); seq.push(addFrames2); } if (newFullLayout.transition && !configChanged && (restyleFlags.anim || relayoutFlags.anim)) { if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout); Plots.doCalcdata(gd2); subroutines.doAutoRangeAndConstraints(gd2); seq.push(function() { return Plots.transitionFromReact(gd2, restyleFlags, relayoutFlags, oldFullLayout); }); } else if (restyleFlags.fullReplot || relayoutFlags.layoutReplot || configChanged) { gd2._fullLayout._skipDefaults = true; seq.push(exports2._doPlot); } else { for (var componentType in relayoutFlags.arrays) { var indices = relayoutFlags.arrays[componentType]; if (indices.length) { var drawOne = Registry.getComponentMethod(componentType, "drawOne"); if (drawOne !== Lib.noop) { for (var i = 0; i < indices.length; i++) { drawOne(gd2, indices[i]); } } else { var draw = Registry.getComponentMethod(componentType, "draw"); if (draw === Lib.noop) { throw new Error("cannot draw components: " + componentType); } draw(gd2); } } } seq.push(Plots.previousPromises); if (restyleFlags.style) seq.push(subroutines.doTraceStyle); if (restyleFlags.colorbars || relayoutFlags.colorbars) seq.push(subroutines.doColorBars); if (relayoutFlags.legend) seq.push(subroutines.doLegend); if (relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles); if (relayoutFlags.axrange) addAxRangeSequence(seq); if (relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout); if (relayoutFlags.modebar) seq.push(subroutines.doModeBar); if (relayoutFlags.camera) seq.push(subroutines.doCamera); seq.push(emitAfterPlot); } seq.push( Plots.rehover, Plots.redrag, Plots.reselect ); plotDone = Lib.syncOrAsync(seq, gd2); if (!plotDone || !plotDone.then) plotDone = Promise.resolve(gd2); } return plotDone.then(function() { gd2.emit("plotly_react", { data, layout }); return gd2; }); } function diffData(gd2, oldFullData, newFullData, immutable, transition, newDataRevision) { var sameTraceLength = oldFullData.length === newFullData.length; if (!transition && !sameTraceLength) { return { fullReplot: true, calc: true }; } var flags = editTypes.traceFlags(); flags.arrays = {}; flags.nChanges = 0; flags.nChangesAnim = 0; var i, trace; function getTraceValObject(parts) { var out = PlotSchema.getTraceValObject(trace, parts); if (!trace._module.animatable && out.anim) { out.anim = false; } return out; } var diffOpts = { getValObject: getTraceValObject, flags, immutable, transition, newDataRevision, gd: gd2 }; var seenUIDs = {}; for (i = 0; i < oldFullData.length; i++) { if (newFullData[i]) { trace = newFullData[i]._fullInput; if (Plots.hasMakesDataTransform(trace)) trace = newFullData[i]; if (seenUIDs[trace.uid]) continue; seenUIDs[trace.uid] = 1; getDiffFlags(oldFullData[i]._fullInput, trace, [], diffOpts); } } if (flags.calc || flags.plot) { flags.fullReplot = true; } if (transition && flags.nChanges && flags.nChangesAnim) { flags.anim = flags.nChanges === flags.nChangesAnim && sameTraceLength ? "all" : "some"; } return flags; } function diffLayout(gd2, oldFullLayout, newFullLayout, immutable, transition) { var flags = editTypes.layoutFlags(); flags.arrays = {}; flags.rangesAltered = {}; flags.nChanges = 0; flags.nChangesAnim = 0; function getLayoutValObject(parts) { return PlotSchema.getLayoutValObject(newFullLayout, parts); } var diffOpts = { getValObject: getLayoutValObject, flags, immutable, transition, gd: gd2 }; getDiffFlags(oldFullLayout, newFullLayout, [], diffOpts); if (flags.plot || flags.calc) { flags.layoutReplot = true; } if (transition && flags.nChanges && flags.nChangesAnim) { flags.anim = flags.nChanges === flags.nChangesAnim ? "all" : "some"; } return flags; } function getDiffFlags(oldContainer, newContainer, outerparts, opts) { var valObject, key, astr; var getValObject = opts.getValObject; var flags = opts.flags; var immutable = opts.immutable; var inArray = opts.inArray; var arrayIndex = opts.arrayIndex; function changed() { var editType = valObject.editType; if (inArray && editType.indexOf("arraydraw") !== -1) { Lib.pushUnique(flags.arrays[inArray], arrayIndex); return; } editTypes.update(flags, valObject); if (editType !== "none") { flags.nChanges++; } if (opts.transition && valObject.anim) { flags.nChangesAnim++; } if (AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) { flags.rangesAltered[outerparts[0]] = 1; } if (AX_DOMAIN_RE.test(astr)) { nestedProperty(newContainer, "_inputDomain").set(null); } if (key === "datarevision") { flags.newDataRevision = 1; } } function valObjectCanBeDataArray(valObject2) { return valObject2.valType === "data_array" || valObject2.arrayOk; } for (key in oldContainer) { if (flags.calc && !opts.transition) return; var oldVal = oldContainer[key]; var newVal = newContainer[key]; var parts = outerparts.concat(key); astr = parts.join("."); if (key.charAt(0) === "_" || typeof oldVal === "function" || oldVal === newVal) continue; if ((key === "tick0" || key === "dtick") && outerparts[0] !== "geo") { var tickMode = newContainer.tickmode; if (tickMode === "auto" || tickMode === "array" || !tickMode) continue; } if (key === "range" && newContainer.autorange) continue; if ((key === "zmin" || key === "zmax") && newContainer.type === "contourcarpet") continue; valObject = getValObject(parts); if (!valObject) continue; if (valObject._compareAsJSON && JSON.stringify(oldVal) === JSON.stringify(newVal)) continue; var valType = valObject.valType; var i; var canBeDataArray = valObjectCanBeDataArray(valObject); var wasArray = Array.isArray(oldVal); var nowArray = Array.isArray(newVal); if (wasArray && nowArray) { var inputKey = "_input_" + key; var oldValIn = oldContainer[inputKey]; var newValIn = newContainer[inputKey]; if (Array.isArray(oldValIn) && oldValIn === newValIn) continue; } if (newVal === void 0) { if (canBeDataArray && wasArray) flags.calc = true; else changed(); } else if (valObject._isLinkedToArray) { var arrayEditIndices = []; var extraIndices = false; if (!inArray) flags.arrays[key] = arrayEditIndices; var minLen = Math.min(oldVal.length, newVal.length); var maxLen = Math.max(oldVal.length, newVal.length); if (minLen !== maxLen) { if (valObject.editType === "arraydraw") { extraIndices = true; } else { changed(); continue; } } for (i = 0; i < minLen; i++) { getDiffFlags( oldVal[i], newVal[i], parts.concat(i), // add array indices, but not if we're already in an array Lib.extendFlat({ inArray: key, arrayIndex: i }, opts) ); } if (extraIndices) { for (i = minLen; i < maxLen; i++) { arrayEditIndices.push(i); } } } else if (!valType && Lib.isPlainObject(oldVal)) { getDiffFlags(oldVal, newVal, parts, opts); } else if (canBeDataArray) { if (wasArray && nowArray) { if (immutable) { flags.calc = true; } if (immutable || opts.newDataRevision) { changed(); } } else if (wasArray !== nowArray) { flags.calc = true; } else changed(); } else if (wasArray && nowArray) { if (oldVal.length !== newVal.length || String(oldVal) !== String(newVal)) { changed(); } } else { changed(); } } for (key in newContainer) { if (!(key in oldContainer || key.charAt(0) === "_" || typeof newContainer[key] === "function")) { valObject = getValObject(outerparts.concat(key)); if (valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) { flags.calc = true; return; } else changed(); } } } function diffConfig(oldConfig, newConfig) { var key; for (key in oldConfig) { if (key.charAt(0) === "_") continue; var oldVal = oldConfig[key]; var newVal = newConfig[key]; if (oldVal !== newVal) { if (Lib.isPlainObject(oldVal) && Lib.isPlainObject(newVal)) { if (diffConfig(oldVal, newVal)) { return true; } } else if (Array.isArray(oldVal) && Array.isArray(newVal)) { if (oldVal.length !== newVal.length) { return true; } for (var i = 0; i < oldVal.length; i++) { if (oldVal[i] !== newVal[i]) { if (Lib.isPlainObject(oldVal[i]) && Lib.isPlainObject(newVal[i])) { if (diffConfig(oldVal[i], newVal[i])) { return true; } } else { return true; } } } } else { return true; } } } } function animate(gd2, frameOrGroupNameOrFrameList, animationOpts) { gd2 = Lib.getGraphDiv(gd2); if (!Lib.isPlotDiv(gd2)) { throw new Error( "This element is not a Plotly plot: " + gd2 + ". It's likely that you've failed to create a plot before animating it. For more details, see https://plotly.com/javascript/animations/" ); } var trans = gd2._transitionData; if (!trans._frameQueue) { trans._frameQueue = []; } animationOpts = Plots.supplyAnimationDefaults(animationOpts); var transitionOpts = animationOpts.transition; var frameOpts = animationOpts.frame; if (trans._frameWaitingCnt === void 0) { trans._frameWaitingCnt = 0; } function getTransitionOpts(i) { if (Array.isArray(transitionOpts)) { if (i >= transitionOpts.length) { return transitionOpts[0]; } else { return transitionOpts[i]; } } else { return transitionOpts; } } function getFrameOpts(i) { if (Array.isArray(frameOpts)) { if (i >= frameOpts.length) { return frameOpts[0]; } else { return frameOpts[i]; } } else { return frameOpts; } } function callbackOnNthTime(cb, n) { var cnt = 0; return function() { if (cb && ++cnt === n) { return cb(); } }; } return new Promise(function(resolve, reject) { function discardExistingFrames() { if (trans._frameQueue.length === 0) { return; } while (trans._frameQueue.length) { var next = trans._frameQueue.pop(); if (next.onInterrupt) { next.onInterrupt(); } } gd2.emit("plotly_animationinterrupted", []); } function queueFrames(frameList2) { if (frameList2.length === 0) return; for (var i2 = 0; i2 < frameList2.length; i2++) { var computedFrame; if (frameList2[i2].type === "byname") { computedFrame = Plots.computeFrame(gd2, frameList2[i2].name); } else { computedFrame = frameList2[i2].data; } var frameOpts2 = getFrameOpts(i2); var transitionOpts2 = getTransitionOpts(i2); transitionOpts2.duration = Math.min(transitionOpts2.duration, frameOpts2.duration); var nextFrame2 = { frame: computedFrame, name: frameList2[i2].name, frameOpts: frameOpts2, transitionOpts: transitionOpts2 }; if (i2 === frameList2.length - 1) { nextFrame2.onComplete = callbackOnNthTime(resolve, 2); nextFrame2.onInterrupt = reject; } trans._frameQueue.push(nextFrame2); } if (animationOpts.mode === "immediate") { trans._lastFrameAt = -Infinity; } if (!trans._animationRaf) { beginAnimationLoop(); } } function stopAnimationLoop() { gd2.emit("plotly_animated"); window.cancelAnimationFrame(trans._animationRaf); trans._animationRaf = null; } function nextFrame() { if (trans._currentFrame && trans._currentFrame.onComplete) { trans._currentFrame.onComplete(); } var newFrame = trans._currentFrame = trans._frameQueue.shift(); if (newFrame) { var stringName = newFrame.name ? newFrame.name.toString() : null; gd2._fullLayout._currentFrame = stringName; trans._lastFrameAt = Date.now(); trans._timeToNext = newFrame.frameOpts.duration; Plots.transition( gd2, newFrame.frame.data, newFrame.frame.layout, helpers.coerceTraceIndices(gd2, newFrame.frame.traces), newFrame.frameOpts, newFrame.transitionOpts ).then(function() { if (newFrame.onComplete) { newFrame.onComplete(); } }); gd2.emit("plotly_animatingframe", { name: stringName, frame: newFrame.frame, animation: { frame: newFrame.frameOpts, transition: newFrame.transitionOpts } }); } else { stopAnimationLoop(); } } function beginAnimationLoop() { gd2.emit("plotly_animating"); trans._lastFrameAt = -Infinity; trans._timeToNext = 0; trans._runningTransitions = 0; trans._currentFrame = null; var doFrame = function() { trans._animationRaf = window.requestAnimationFrame(doFrame); if (Date.now() - trans._lastFrameAt > trans._timeToNext) { nextFrame(); } }; doFrame(); } var configCounter = 0; function setTransitionConfig(frame2) { if (Array.isArray(transitionOpts)) { if (configCounter >= transitionOpts.length) { frame2.transitionOpts = transitionOpts[configCounter]; } else { frame2.transitionOpts = transitionOpts[0]; } } else { frame2.transitionOpts = transitionOpts; } configCounter++; return frame2; } var i, frame; var frameList = []; var allFrames = frameOrGroupNameOrFrameList === void 0 || frameOrGroupNameOrFrameList === null; var isFrameArray = Array.isArray(frameOrGroupNameOrFrameList); var isSingleFrame = !allFrames && !isFrameArray && Lib.isPlainObject(frameOrGroupNameOrFrameList); if (isSingleFrame) { frameList.push({ type: "object", data: setTransitionConfig(Lib.extendFlat({}, frameOrGroupNameOrFrameList)) }); } else if (allFrames || ["string", "number"].indexOf(typeof frameOrGroupNameOrFrameList) !== -1) { for (i = 0; i < trans._frames.length; i++) { frame = trans._frames[i]; if (!frame) continue; if (allFrames || String(frame.group) === String(frameOrGroupNameOrFrameList)) { frameList.push({ type: "byname", name: String(frame.name), data: setTransitionConfig({ name: frame.name }) }); } } } else if (isFrameArray) { for (i = 0; i < frameOrGroupNameOrFrameList.length; i++) { var frameOrName = frameOrGroupNameOrFrameList[i]; if (["number", "string"].indexOf(typeof frameOrName) !== -1) { frameOrName = String(frameOrName); frameList.push({ type: "byname", name: frameOrName, data: setTransitionConfig({ name: frameOrName }) }); } else if (Lib.isPlainObject(frameOrName)) { frameList.push({ type: "object", data: setTransitionConfig(Lib.extendFlat({}, frameOrName)) }); } } } for (i = 0; i < frameList.length; i++) { frame = frameList[i]; if (frame.type === "byname" && !trans._frameHash[frame.data.name]) { Lib.warn('animate failure: frame not found: "' + frame.data.name + '"'); reject(); return; } } if (["next", "immediate"].indexOf(animationOpts.mode) !== -1) { discardExistingFrames(); } if (animationOpts.direction === "reverse") { frameList.reverse(); } var currentFrame = gd2._fullLayout._currentFrame; if (currentFrame && animationOpts.fromcurrent) { var idx = -1; for (i = 0; i < frameList.length; i++) { frame = frameList[i]; if (frame.type === "byname" && frame.name === currentFrame) { idx = i; break; } } if (idx > 0 && idx < frameList.length - 1) { var filteredFrameList = []; for (i = 0; i < frameList.length; i++) { frame = frameList[i]; if (frameList[i].type !== "byname" || i > idx) { filteredFrameList.push(frame); } } frameList = filteredFrameList; } } if (frameList.length > 0) { queueFrames(frameList); } else { gd2.emit("plotly_animated"); resolve(); } }); } function addFrames(gd2, frameList, indices) { gd2 = Lib.getGraphDiv(gd2); if (frameList === null || frameList === void 0) { return Promise.resolve(); } if (!Lib.isPlotDiv(gd2)) { throw new Error( "This element is not a Plotly plot: " + gd2 + ". It's likely that you've failed to create a plot before adding frames. For more details, see https://plotly.com/javascript/animations/" ); } var i, frame, j, idx; var _frames = gd2._transitionData._frames; var _frameHash = gd2._transitionData._frameHash; if (!Array.isArray(frameList)) { throw new Error("addFrames failure: frameList must be an Array of frame definitions" + frameList); } var bigIndex = _frames.length + frameList.length * 2; var insertions = []; var _frameHashLocal = {}; for (i = frameList.length - 1; i >= 0; i--) { if (!Lib.isPlainObject(frameList[i])) continue; var lookupName = frameList[i].name; var name = (_frameHash[lookupName] || _frameHashLocal[lookupName] || {}).name; var newName = frameList[i].name; var collisionPresent = _frameHash[name] || _frameHashLocal[name]; if (name && newName && typeof newName === "number" && collisionPresent && numericNameWarningCount < numericNameWarningCountLimit) { numericNameWarningCount++; Lib.warn('addFrames: overwriting frame "' + (_frameHash[name] || _frameHashLocal[name]).name + '" with a frame whose name of type "number" also equates to "' + name + '". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'); if (numericNameWarningCount === numericNameWarningCountLimit) { Lib.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed."); } } _frameHashLocal[lookupName] = { name: lookupName }; insertions.push({ frame: Plots.supplyFrameDefaults(frameList[i]), index: indices && indices[i] !== void 0 && indices[i] !== null ? indices[i] : bigIndex + i }); } insertions.sort(function(a, b) { if (a.index > b.index) return -1; if (a.index < b.index) return 1; return 0; }); var ops = []; var revops = []; var frameCount = _frames.length; for (i = insertions.length - 1; i >= 0; i--) { frame = insertions[i].frame; if (typeof frame.name === "number") { Lib.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"); } if (!frame.name) { while (_frameHash[frame.name = "frame " + gd2._transitionData._counter++]) ; } if (_frameHash[frame.name]) { for (j = 0; j < _frames.length; j++) { if ((_frames[j] || {}).name === frame.name) break; } ops.push({ type: "replace", index: j, value: frame }); revops.unshift({ type: "replace", index: j, value: _frames[j] }); } else { idx = Math.max(0, Math.min(insertions[i].index, frameCount)); ops.push({ type: "insert", index: idx, value: frame }); revops.unshift({ type: "delete", index: idx }); frameCount++; } } var undoFunc = Plots.modifyFrames; var redoFunc = Plots.modifyFrames; var undoArgs = [gd2, revops]; var redoArgs = [gd2, ops]; if (Queue) Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); return Plots.modifyFrames(gd2, ops); } function deleteFrames(gd2, frameList) { gd2 = Lib.getGraphDiv(gd2); if (!Lib.isPlotDiv(gd2)) { throw new Error("This element is not a Plotly plot: " + gd2); } var i, idx; var _frames = gd2._transitionData._frames; var ops = []; var revops = []; if (!frameList) { frameList = []; for (i = 0; i < _frames.length; i++) { frameList.push(i); } } frameList = frameList.slice(); frameList.sort(); for (i = frameList.length - 1; i >= 0; i--) { idx = frameList[i]; ops.push({ type: "delete", index: idx }); revops.unshift({ type: "insert", index: idx, value: _frames[idx] }); } var undoFunc = Plots.modifyFrames; var redoFunc = Plots.modifyFrames; var undoArgs = [gd2, revops]; var redoArgs = [gd2, ops]; if (Queue) Queue.add(gd2, undoFunc, undoArgs, redoFunc, redoArgs); return Plots.modifyFrames(gd2, ops); } function purge(gd2) { gd2 = Lib.getGraphDiv(gd2); var fullLayout = gd2._fullLayout || {}; var fullData = gd2._fullData || []; Plots.cleanPlot([], {}, fullData, fullLayout); Plots.purge(gd2); Events.purge(gd2); if (fullLayout._container) fullLayout._container.remove(); delete gd2._context; return gd2; } function calcInverseTransform(gd2) { var fullLayout = gd2._fullLayout; var newBBox = gd2.getBoundingClientRect(); if (Lib.equalDomRects(newBBox, fullLayout._lastBBox)) return; var m = fullLayout._invTransform = Lib.inverseTransformMatrix(Lib.getFullTransformMatrix(gd2)); fullLayout._invScaleX = Math.sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1] + m[0][2] * m[0][2]); fullLayout._invScaleY = Math.sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]); fullLayout._lastBBox = newBBox; } function makePlotFramework(gd2) { var gd3 = d3.select(gd2); var fullLayout = gd2._fullLayout; fullLayout._calcInverseTransform = calcInverseTransform; fullLayout._calcInverseTransform(gd2); fullLayout._container = gd3.selectAll(".plot-container").data([0]); fullLayout._container.enter().insert("div", ":first-child").classed("plot-container", true).classed("plotly", true).style({ width: "100%", height: "100%" }); fullLayout._paperdiv = fullLayout._container.selectAll(".svg-container").data([0]); fullLayout._paperdiv.enter().append("div").classed("user-select-none", true).classed("svg-container", true).style("position", "relative"); fullLayout._glcontainer = fullLayout._paperdiv.selectAll(".gl-container").data([{}]); fullLayout._glcontainer.enter().append("div").classed("gl-container", true); fullLayout._paperdiv.selectAll(".main-svg").remove(); fullLayout._paperdiv.select(".modebar-container").remove(); fullLayout._paper = fullLayout._paperdiv.insert("svg", ":first-child").classed("main-svg", true); fullLayout._toppaper = fullLayout._paperdiv.append("svg").classed("main-svg", true); fullLayout._modebardiv = fullLayout._paperdiv.append("div"); delete fullLayout._modeBar; fullLayout._hoverpaper = fullLayout._paperdiv.append("svg").classed("main-svg", true); if (!fullLayout._uid) { var otherUids = {}; d3.selectAll("defs").each(function() { if (this.id) otherUids[this.id.split("-")[1]] = 1; }); fullLayout._uid = Lib.randstr(otherUids); } fullLayout._paperdiv.selectAll(".main-svg").attr(xmlnsNamespaces.svgAttrs); fullLayout._defs = fullLayout._paper.append("defs").attr("id", "defs-" + fullLayout._uid); fullLayout._clips = fullLayout._defs.append("g").classed("clips", true); fullLayout._topdefs = fullLayout._toppaper.append("defs").attr("id", "topdefs-" + fullLayout._uid); fullLayout._topclips = fullLayout._topdefs.append("g").classed("clips", true); fullLayout._bgLayer = fullLayout._paper.append("g").classed("bglayer", true); fullLayout._draggers = fullLayout._paper.append("g").classed("draglayer", true); var layerBelow = fullLayout._paper.append("g").classed("layer-below", true); fullLayout._imageLowerLayer = layerBelow.append("g").classed("imagelayer", true); fullLayout._shapeLowerLayer = layerBelow.append("g").classed("shapelayer", true); fullLayout._cartesianlayer = fullLayout._paper.append("g").classed("cartesianlayer", true); fullLayout._polarlayer = fullLayout._paper.append("g").classed("polarlayer", true); fullLayout._smithlayer = fullLayout._paper.append("g").classed("smithlayer", true); fullLayout._ternarylayer = fullLayout._paper.append("g").classed("ternarylayer", true); fullLayout._geolayer = fullLayout._paper.append("g").classed("geolayer", true); fullLayout._funnelarealayer = fullLayout._paper.append("g").classed("funnelarealayer", true); fullLayout._pielayer = fullLayout._paper.append("g").classed("pielayer", true); fullLayout._iciclelayer = fullLayout._paper.append("g").classed("iciclelayer", true); fullLayout._treemaplayer = fullLayout._paper.append("g").classed("treemaplayer", true); fullLayout._sunburstlayer = fullLayout._paper.append("g").classed("sunburstlayer", true); fullLayout._indicatorlayer = fullLayout._toppaper.append("g").classed("indicatorlayer", true); fullLayout._glimages = fullLayout._paper.append("g").classed("glimages", true); var layerAbove = fullLayout._toppaper.append("g").classed("layer-above", true); fullLayout._imageUpperLayer = layerAbove.append("g").classed("imagelayer", true); fullLayout._shapeUpperLayer = layerAbove.append("g").classed("shapelayer", true); fullLayout._selectionLayer = fullLayout._toppaper.append("g").classed("selectionlayer", true); fullLayout._infolayer = fullLayout._toppaper.append("g").classed("infolayer", true); fullLayout._menulayer = fullLayout._toppaper.append("g").classed("menulayer", true); fullLayout._zoomlayer = fullLayout._toppaper.append("g").classed("zoomlayer", true); fullLayout._hoverlayer = fullLayout._hoverpaper.append("g").classed("hoverlayer", true); fullLayout._modebardiv.classed("modebar-container", true).style("position", "absolute").style("top", "0px").style("right", "0px"); gd2.emit("plotly_framework"); } exports2.animate = animate; exports2.addFrames = addFrames; exports2.deleteFrames = deleteFrames; exports2.addTraces = addTraces; exports2.deleteTraces = deleteTraces; exports2.extendTraces = extendTraces; exports2.moveTraces = moveTraces; exports2.prependTraces = prependTraces; exports2.newPlot = newPlot; exports2._doPlot = _doPlot; exports2.purge = purge; exports2.react = react; exports2.redraw = redraw; exports2.relayout = relayout; exports2.restyle = restyle; exports2.setPlotConfig = setPlotConfig; exports2.update = update; exports2._guiRelayout = guiEdit(relayout); exports2._guiRestyle = guiEdit(restyle); exports2._guiUpdate = guiEdit(update); exports2._storeDirectGUIEdit = _storeDirectGUIEdit; } }); // node_modules/plotly.js/src/snapshot/helpers.js var require_helpers10 = __commonJS({ "node_modules/plotly.js/src/snapshot/helpers.js"(exports2) { "use strict"; var Registry = require_registry(); exports2.getDelay = function(fullLayout) { if (!fullLayout._has) return 0; return fullLayout._has("gl3d") || fullLayout._has("gl2d") || fullLayout._has("mapbox") || fullLayout._has("map") ? 500 : 0; }; exports2.getRedrawFunc = function(gd2) { return function() { Registry.getComponentMethod("colorbar", "draw")(gd2); }; }; exports2.encodeSVG = function(svg) { return "data:image/svg+xml," + encodeURIComponent(svg); }; exports2.encodeJSON = function(json) { return "data:application/json," + encodeURIComponent(json); }; var DOM_URL = window.URL || window.webkitURL; exports2.createObjectURL = function(blob) { return DOM_URL.createObjectURL(blob); }; exports2.revokeObjectURL = function(url) { return DOM_URL.revokeObjectURL(url); }; exports2.createBlob = function(url, format2) { if (format2 === "svg") { return new window.Blob([url], { type: "image/svg+xml;charset=utf-8" }); } else if (format2 === "full-json") { return new window.Blob([url], { type: "application/json;charset=utf-8" }); } else { var binary = fixBinary(window.atob(url)); return new window.Blob([binary], { type: "image/" + format2 }); } }; exports2.octetStream = function(s) { document.location.href = "data:application/octet-stream" + s; }; function fixBinary(b) { var len = b.length; var buf = new ArrayBuffer(len); var arr = new Uint8Array(buf); for (var i = 0; i < len; i++) { arr[i] = b.charCodeAt(i); } return buf; } exports2.IMAGE_URL_PREFIX = /^data:image\/\w+;base64,/; exports2.MSG_IE_BAD_FORMAT = "Sorry IE does not support downloading from canvas. Try {format:'svg'} instead."; } }); // node_modules/plotly.js/src/snapshot/tosvg.js var require_tosvg = __commonJS({ "node_modules/plotly.js/src/snapshot/tosvg.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); var Drawing = require_drawing(); var Color = require_color(); var xmlnsNamespaces = require_xmlns_namespaces(); var DOUBLEQUOTE_REGEX = /"/g; var DUMMY_SUB = "TOBESTRIPPED"; var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ")|(" + DUMMY_SUB + '")', "g"); function htmlEntityDecode(s) { var hiddenDiv = d3.select("body").append("div").style({ display: "none" }).html(""); var replaced = s.replace(/(&[^;]*;)/gi, function(d) { if (d === "<") { return "<"; } if (d === "&rt;") { return ">"; } if (d.indexOf("<") !== -1 || d.indexOf(">") !== -1) { return ""; } return hiddenDiv.html(d).text(); }); hiddenDiv.remove(); return replaced; } function xmlEntityEncode(str) { return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, "&"); } module2.exports = function toSVG(gd2, format2, scale) { var fullLayout = gd2._fullLayout; var svg = fullLayout._paper; var toppaper = fullLayout._toppaper; var width = fullLayout.width; var height = fullLayout.height; var i; svg.insert("rect", ":first-child").call(Drawing.setRect, 0, 0, width, height).call(Color.fill, fullLayout.paper_bgcolor); var basePlotModules = fullLayout._basePlotModules || []; for (i = 0; i < basePlotModules.length; i++) { var _module = basePlotModules[i]; if (_module.toSVG) _module.toSVG(gd2); } if (toppaper) { var nodes = toppaper.node().childNodes; var topGroups = Array.prototype.slice.call(nodes); for (i = 0; i < topGroups.length; i++) { var topGroup = topGroups[i]; if (topGroup.childNodes.length) svg.node().appendChild(topGroup); } } if (fullLayout._draggers) { fullLayout._draggers.remove(); } svg.node().style.background = ""; svg.selectAll("text").attr({ "data-unformatted": null, "data-math": null }).each(function() { var txt = d3.select(this); if (this.style.visibility === "hidden" || this.style.display === "none") { txt.remove(); return; } else { txt.style({ visibility: null, display: null }); } var ff2 = this.style.fontFamily; if (ff2 && ff2.indexOf('"') !== -1) { txt.style("font-family", ff2.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } var fw = this.style.fontWeight; if (fw && (fw === "normal" || fw === "400")) { txt.style("font-weight", void 0); } var fs2 = this.style.fontStyle; if (fs2 && fs2 === "normal") { txt.style("font-style", void 0); } var fv2 = this.style.fontVariant; if (fv2 && fv2 === "normal") { txt.style("font-variant", void 0); } }); svg.selectAll(".gradient_filled,.pattern_filled").each(function() { var pt2 = d3.select(this); var fill = this.style.fill; if (fill && fill.indexOf("url(") !== -1) { pt2.style("fill", fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } var stroke = this.style.stroke; if (stroke && stroke.indexOf("url(") !== -1) { pt2.style("stroke", stroke.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); if (format2 === "pdf" || format2 === "eps") { svg.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width", 0); } svg.node().setAttributeNS(xmlnsNamespaces.xmlns, "xmlns", xmlnsNamespaces.svg); svg.node().setAttributeNS(xmlnsNamespaces.xmlns, "xmlns:xlink", xmlnsNamespaces.xlink); if (format2 === "svg" && scale) { svg.attr("width", scale * width); svg.attr("height", scale * height); svg.attr("viewBox", "0 0 " + width + " " + height); } var s = new window.XMLSerializer().serializeToString(svg.node()); s = htmlEntityDecode(s); s = xmlEntityEncode(s); s = s.replace(DUMMY_REGEX, "'"); if (Lib.isIE()) { s = s.replace(/"/gi, "'"); s = s.replace(/(\('#)([^']*)('\))/gi, '("#$2")'); s = s.replace(/(\\')/gi, '"'); } return s; }; } }); // node_modules/plotly.js/src/snapshot/svgtoimg.js var require_svgtoimg = __commonJS({ "node_modules/plotly.js/src/snapshot/svgtoimg.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var EventEmitter = require_events().EventEmitter; var helpers = require_helpers10(); function svgToImg(opts) { var ev2 = opts.emitter || new EventEmitter(); var promise = new Promise(function(resolve, reject) { var Image2 = window.Image; var svg = opts.svg; var format2 = opts.format || "png"; if (Lib.isIE() && format2 !== "svg") { var ieSvgError = new Error(helpers.MSG_IE_BAD_FORMAT); reject(ieSvgError); if (!opts.promise) { return ev2.emit("error", ieSvgError); } else { return promise; } } var canvas = opts.canvas; var scale = opts.scale || 1; var w02 = opts.width || 300; var h02 = opts.height || 150; var w12 = scale * w02; var h12 = scale * h02; var ctx = canvas.getContext("2d", { willReadFrequently: true }); var img = new Image2(); var svgBlob, url; if (format2 === "svg" || Lib.isSafari()) { url = helpers.encodeSVG(svg); } else { svgBlob = helpers.createBlob(svg, "svg"); url = helpers.createObjectURL(svgBlob); } canvas.width = w12; canvas.height = h12; img.onload = function() { var imgData; svgBlob = null; helpers.revokeObjectURL(url); if (format2 !== "svg") { ctx.drawImage(img, 0, 0, w12, h12); } switch (format2) { case "jpeg": imgData = canvas.toDataURL("image/jpeg"); break; case "png": imgData = canvas.toDataURL("image/png"); break; case "webp": imgData = canvas.toDataURL("image/webp"); break; case "svg": imgData = url; break; default: var errorMsg = "Image format is not jpeg, png, svg or webp."; reject(new Error(errorMsg)); if (!opts.promise) { return ev2.emit("error", errorMsg); } } resolve(imgData); if (!opts.promise) { ev2.emit("success", imgData); } }; img.onerror = function(err) { svgBlob = null; helpers.revokeObjectURL(url); reject(err); if (!opts.promise) { return ev2.emit("error", err); } }; img.src = url; }); if (opts.promise) { return promise; } return ev2; } module2.exports = svgToImg; } }); // node_modules/plotly.js/src/plot_api/to_image.js var require_to_image = __commonJS({ "node_modules/plotly.js/src/plot_api/to_image.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var plotApi = require_plot_api(); var plots = require_plots(); var Lib = require_lib(); var helpers = require_helpers10(); var toSVG = require_tosvg(); var svgToImg = require_svgtoimg(); var version = require_version().version; var attrs = { format: { valType: "enumerated", values: ["png", "jpeg", "webp", "svg", "full-json"], dflt: "png", description: "Sets the format of exported image." }, width: { valType: "number", min: 1, description: [ "Sets the exported image width.", "Defaults to the value found in `layout.width`", "If set to *null*, the exported image width will match the current graph width." ].join(" ") }, height: { valType: "number", min: 1, description: [ "Sets the exported image height.", "Defaults to the value found in `layout.height`", "If set to *null*, the exported image height will match the current graph height." ].join(" ") }, scale: { valType: "number", min: 0, dflt: 1, description: [ "Sets a scaling for the generated image.", "If set, all features of a graphs (e.g. text, line width)", "are scaled, unlike simply setting", "a bigger *width* and *height*." ].join(" ") }, setBackground: { valType: "any", dflt: false, description: [ "Sets the image background mode.", "By default, the image background is determined by `layout.paper_bgcolor`,", "the *transparent* mode.", "One might consider setting `setBackground` to *opaque*", "when exporting a *jpeg* image as JPEGs do not support opacity." ].join(" ") }, imageDataOnly: { valType: "boolean", dflt: false, description: [ "Determines whether or not the return value is prefixed by", "the image format's corresponding 'data:image;' spec." ].join(" ") } }; function toImage(gd2, opts) { opts = opts || {}; var data; var layout; var config; var fullLayout; if (Lib.isPlainObject(gd2)) { data = gd2.data || []; layout = gd2.layout || {}; config = gd2.config || {}; fullLayout = {}; } else { gd2 = Lib.getGraphDiv(gd2); data = Lib.extendDeep([], gd2.data); layout = Lib.extendDeep({}, gd2.layout); config = gd2._context; fullLayout = gd2._fullLayout || {}; } function isImpliedOrValid(attr) { return !(attr in opts) || Lib.validate(opts[attr], attrs[attr]); } if (!isImpliedOrValid("width") && opts.width !== null || !isImpliedOrValid("height") && opts.height !== null) { throw new Error("Height and width should be pixel values."); } if (!isImpliedOrValid("format")) { throw new Error("Export format is not " + Lib.join2(attrs.format.values, ", ", " or ") + "."); } var fullOpts = {}; function coerce(attr, dflt) { return Lib.coerce(opts, fullOpts, attrs, attr, dflt); } var format2 = coerce("format"); var width = coerce("width"); var height = coerce("height"); var scale = coerce("scale"); var setBackground = coerce("setBackground"); var imageDataOnly = coerce("imageDataOnly"); var clonedGd = document.createElement("div"); clonedGd.style.position = "absolute"; clonedGd.style.left = "-5000px"; document.body.appendChild(clonedGd); var layoutImage = Lib.extendFlat({}, layout); if (width) { layoutImage.width = width; } else if (opts.width === null && isNumeric(fullLayout.width)) { layoutImage.width = fullLayout.width; } if (height) { layoutImage.height = height; } else if (opts.height === null && isNumeric(fullLayout.height)) { layoutImage.height = fullLayout.height; } var configImage = Lib.extendFlat({}, config, { _exportedPlot: true, staticPlot: true, setBackground }); var redrawFunc = helpers.getRedrawFunc(clonedGd); function wait() { return new Promise(function(resolve) { setTimeout(resolve, helpers.getDelay(clonedGd._fullLayout)); }); } function convert() { return new Promise(function(resolve, reject) { var svg = toSVG(clonedGd, format2, scale); var width2 = clonedGd._fullLayout.width; var height2 = clonedGd._fullLayout.height; function cleanup() { plotApi.purge(clonedGd); document.body.removeChild(clonedGd); } if (format2 === "full-json") { var json = plots.graphJson(clonedGd, false, "keepdata", "object", true, true); json.version = version; json = JSON.stringify(json); cleanup(); if (imageDataOnly) { return resolve(json); } else { return resolve(helpers.encodeJSON(json)); } } cleanup(); if (format2 === "svg") { if (imageDataOnly) { return resolve(svg); } else { return resolve(helpers.encodeSVG(svg)); } } var canvas = document.createElement("canvas"); canvas.id = Lib.randstr(); svgToImg({ format: format2, width: width2, height: height2, scale, canvas, svg, // ask svgToImg to return a Promise // rather than EventEmitter // leave EventEmitter for backward // compatibility promise: true }).then(resolve).catch(reject); }); } function urlToImageData(url) { if (imageDataOnly) { return url.replace(helpers.IMAGE_URL_PREFIX, ""); } else { return url; } } return new Promise(function(resolve, reject) { plotApi.newPlot(clonedGd, data, layoutImage, configImage).then(redrawFunc).then(wait).then(convert).then(function(url) { resolve(urlToImageData(url)); }).catch(function(err) { reject(err); }); }); } module2.exports = toImage; } }); // node_modules/plotly.js/src/plot_api/validate.js var require_validate = __commonJS({ "node_modules/plotly.js/src/plot_api/validate.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Plots = require_plots(); var PlotSchema = require_plot_schema(); var dfltConfig = require_plot_config().dfltConfig; var isPlainObject = Lib.isPlainObject; var isArray = Array.isArray; var isArrayOrTypedArray = Lib.isArrayOrTypedArray; module2.exports = function validate(data, layout) { if (data === void 0) data = []; if (layout === void 0) layout = {}; var schema = PlotSchema.get(); var errorList = []; var gd2 = { _context: Lib.extendFlat({}, dfltConfig) }; var dataIn, layoutIn; if (isArray(data)) { gd2.data = Lib.extendDeep([], data); dataIn = data; } else { gd2.data = []; dataIn = []; errorList.push(format2("array", "data")); } if (isPlainObject(layout)) { gd2.layout = Lib.extendDeep({}, layout); layoutIn = layout; } else { gd2.layout = {}; layoutIn = {}; if (arguments.length > 1) { errorList.push(format2("object", "layout")); } } Plots.supplyDefaults(gd2); var dataOut = gd2._fullData; var len = dataIn.length; for (var i = 0; i < len; i++) { var traceIn = dataIn[i]; var base = ["data", i]; if (!isPlainObject(traceIn)) { errorList.push(format2("object", base)); continue; } var traceOut = dataOut[i]; var traceType = traceOut.type; var traceSchema = schema.traces[traceType].attributes; traceSchema.type = { valType: "enumerated", values: [traceType] }; if (traceOut.visible === false && traceIn.visible !== false) { errorList.push(format2("invisible", base)); } crawl(traceIn, traceOut, traceSchema, errorList, base); var transformsIn = traceIn.transforms; var transformsOut = traceOut.transforms; if (transformsIn) { if (!isArray(transformsIn)) { errorList.push(format2("array", base, ["transforms"])); } base.push("transforms"); for (var j = 0; j < transformsIn.length; j++) { var path = ["transforms", j]; var transformType = transformsIn[j].type; if (!isPlainObject(transformsIn[j])) { errorList.push(format2("object", base, path)); continue; } var transformSchema = schema.transforms[transformType] ? schema.transforms[transformType].attributes : {}; transformSchema.type = { valType: "enumerated", values: Object.keys(schema.transforms) }; crawl(transformsIn[j], transformsOut[j], transformSchema, errorList, base, path); } } } var layoutOut = gd2._fullLayout; var layoutSchema = fillLayoutSchema(schema, dataOut); crawl(layoutIn, layoutOut, layoutSchema, errorList, "layout"); return errorList.length === 0 ? void 0 : errorList; }; function crawl(objIn, objOut, schema, list, base, path) { path = path || []; var keys = Object.keys(objIn); for (var i = 0; i < keys.length; i++) { var k = keys[i]; if (k === "transforms") continue; var p = path.slice(); p.push(k); var valIn = objIn[k]; var valOut = objOut[k]; var nestedSchema = getNestedSchema(schema, k); var nestedValType = (nestedSchema || {}).valType; var isInfoArray = nestedValType === "info_array"; var isColorscale = nestedValType === "colorscale"; var items = (nestedSchema || {}).items; if (!isInSchema(schema, k)) { list.push(format2("schema", base, p)); } else if (isPlainObject(valIn) && isPlainObject(valOut) && nestedValType !== "any") { crawl(valIn, valOut, nestedSchema, list, base, p); } else if (isInfoArray && isArray(valIn)) { if (valIn.length > valOut.length) { list.push(format2("unused", base, p.concat(valOut.length))); } var len = valOut.length; var arrayItems = Array.isArray(items); if (arrayItems) len = Math.min(len, items.length); var m, n, item, valInPart, valOutPart; if (nestedSchema.dimensions === 2) { for (n = 0; n < len; n++) { if (isArray(valIn[n])) { if (valIn[n].length > valOut[n].length) { list.push(format2("unused", base, p.concat(n, valOut[n].length))); } var len2 = valOut[n].length; for (m = 0; m < (arrayItems ? Math.min(len2, items[n].length) : len2); m++) { item = arrayItems ? items[n][m] : items; valInPart = valIn[n][m]; valOutPart = valOut[n][m]; if (!Lib.validate(valInPart, item)) { list.push(format2("value", base, p.concat(n, m), valInPart)); } else if (valOutPart !== valInPart && valOutPart !== +valInPart) { list.push(format2("dynamic", base, p.concat(n, m), valInPart, valOutPart)); } } } else { list.push(format2("array", base, p.concat(n), valIn[n])); } } } else { for (n = 0; n < len; n++) { item = arrayItems ? items[n] : items; valInPart = valIn[n]; valOutPart = valOut[n]; if (!Lib.validate(valInPart, item)) { list.push(format2("value", base, p.concat(n), valInPart)); } else if (valOutPart !== valInPart && valOutPart !== +valInPart) { list.push(format2("dynamic", base, p.concat(n), valInPart, valOutPart)); } } } } else if (nestedSchema.items && !isInfoArray && isArray(valIn)) { var _nestedSchema = items[Object.keys(items)[0]]; var indexList = []; var j, _p2; for (j = 0; j < valOut.length; j++) { var _index = valOut[j]._index || j; _p2 = p.slice(); _p2.push(_index); if (isPlainObject(valIn[_index]) && isPlainObject(valOut[j])) { indexList.push(_index); var valInj = valIn[_index]; var valOutj = valOut[j]; if (isPlainObject(valInj) && valInj.visible !== false && valOutj.visible === false) { list.push(format2("invisible", base, _p2)); } else crawl(valInj, valOutj, _nestedSchema, list, base, _p2); } } for (j = 0; j < valIn.length; j++) { _p2 = p.slice(); _p2.push(j); if (!isPlainObject(valIn[j])) { list.push(format2("object", base, _p2, valIn[j])); } else if (indexList.indexOf(j) === -1) { list.push(format2("unused", base, _p2)); } } } else if (!isPlainObject(valIn) && isPlainObject(valOut)) { list.push(format2("object", base, p, valIn)); } else if (!isArrayOrTypedArray(valIn) && isArrayOrTypedArray(valOut) && !isInfoArray && !isColorscale) { list.push(format2("array", base, p, valIn)); } else if (!(k in objOut)) { list.push(format2("unused", base, p, valIn)); } else if (!Lib.validate(valIn, nestedSchema)) { list.push(format2("value", base, p, valIn)); } else if (nestedSchema.valType === "enumerated" && (nestedSchema.coerceNumber && valIn !== +valOut || valIn !== valOut)) { list.push(format2("dynamic", base, p, valIn, valOut)); } } return list; } function fillLayoutSchema(schema, dataOut) { var layoutSchema = schema.layout.layoutAttributes; for (var i = 0; i < dataOut.length; i++) { var traceOut = dataOut[i]; var traceSchema = schema.traces[traceOut.type]; var traceLayoutAttr = traceSchema.layoutAttributes; if (traceLayoutAttr) { if (traceOut.subplot) { Lib.extendFlat(layoutSchema[traceSchema.attributes.subplot.dflt], traceLayoutAttr); } else { Lib.extendFlat(layoutSchema, traceLayoutAttr); } } } return layoutSchema; } var code2msgFunc = { object: function(base, astr) { var prefix; if (base === "layout" && astr === "") prefix = "The layout argument"; else if (base[0] === "data" && astr === "") { prefix = "Trace " + base[1] + " in the data argument"; } else prefix = inBase(base) + "key " + astr; return prefix + " must be linked to an object container"; }, array: function(base, astr) { var prefix; if (base === "data") prefix = "The data argument"; else prefix = inBase(base) + "key " + astr; return prefix + " must be linked to an array container"; }, schema: function(base, astr) { return inBase(base) + "key " + astr + " is not part of the schema"; }, unused: function(base, astr, valIn) { var target = isPlainObject(valIn) ? "container" : "key"; return inBase(base) + target + " " + astr + " did not get coerced"; }, dynamic: function(base, astr, valIn, valOut) { return [ inBase(base) + "key", astr, "(set to '" + valIn + "')", "got reset to", "'" + valOut + "'", "during defaults." ].join(" "); }, invisible: function(base, astr) { return (astr ? inBase(base) + "item " + astr : "Trace " + base[1]) + " got defaulted to be not visible"; }, value: function(base, astr, valIn) { return [ inBase(base) + "key " + astr, "is set to an invalid value (" + valIn + ")" ].join(" "); } }; function inBase(base) { if (isArray(base)) return "In data trace " + base[1] + ", "; return "In " + base + ", "; } function format2(code, base, path, valIn, valOut) { path = path || ""; var container, trace; if (isArray(base)) { container = base[0]; trace = base[1]; } else { container = base; trace = null; } var astr = convertPathToAttributeString(path); var msg = code2msgFunc[code](base, astr, valIn, valOut); Lib.log(msg); return { code, container, trace, path, astr, msg }; } function isInSchema(schema, key) { var parts = splitKey(key); var keyMinusId = parts.keyMinusId; var id2 = parts.id; if (keyMinusId in schema && schema[keyMinusId]._isSubplotObj && id2) { return true; } return key in schema; } function getNestedSchema(schema, key) { if (key in schema) return schema[key]; var parts = splitKey(key); return schema[parts.keyMinusId]; } var idRegex = Lib.counterRegex("([a-z]+)"); function splitKey(key) { var idMatch = key.match(idRegex); return { keyMinusId: idMatch && idMatch[1], id: idMatch && idMatch[2] }; } function convertPathToAttributeString(path) { if (!isArray(path)) return String(path); var astr = ""; for (var i = 0; i < path.length; i++) { var p = path[i]; if (typeof p === "number") { astr = astr.substr(0, astr.length - 1) + "[" + p + "]"; } else { astr += p; } if (i < path.length - 1) astr += "."; } return astr; } } }); // node_modules/plotly.js/src/snapshot/filesaver.js var require_filesaver = __commonJS({ "node_modules/plotly.js/src/snapshot/filesaver.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var helpers = require_helpers10(); function fileSaver(url, name, format2) { var saveLink = document.createElement("a"); var canUseSaveLink = "download" in saveLink; var promise = new Promise(function(resolve, reject) { var blob; var objectUrl; if (Lib.isIE()) { blob = helpers.createBlob(url, "svg"); window.navigator.msSaveBlob(blob, name); blob = null; return resolve(name); } if (canUseSaveLink) { blob = helpers.createBlob(url, format2); objectUrl = helpers.createObjectURL(blob); saveLink.href = objectUrl; saveLink.download = name; document.body.appendChild(saveLink); saveLink.click(); document.body.removeChild(saveLink); helpers.revokeObjectURL(objectUrl); blob = null; return resolve(name); } if (Lib.isSafari()) { var prefix = format2 === "svg" ? "," : ";base64,"; helpers.octetStream(prefix + encodeURIComponent(url)); return resolve(name); } reject(new Error("download error")); }); return promise; } module2.exports = fileSaver; } }); // node_modules/plotly.js/src/snapshot/download.js var require_download = __commonJS({ "node_modules/plotly.js/src/snapshot/download.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var toImage = require_to_image(); var fileSaver = require_filesaver(); var helpers = require_helpers10(); function downloadImage(gd2, opts) { var _gd; if (!Lib.isPlainObject(gd2)) _gd = Lib.getGraphDiv(gd2); opts = opts || {}; opts.format = opts.format || "png"; opts.width = opts.width || null; opts.height = opts.height || null; opts.imageDataOnly = true; return new Promise(function(resolve, reject) { if (_gd && _gd._snapshotInProgress) { reject(new Error("Snapshotting already in progress.")); } if (Lib.isIE() && opts.format !== "svg") { reject(new Error(helpers.MSG_IE_BAD_FORMAT)); } if (_gd) _gd._snapshotInProgress = true; var promise = toImage(gd2, opts); var filename = opts.filename || gd2.fn || "newplot"; filename += "." + opts.format.replace("-", "."); promise.then(function(result) { if (_gd) _gd._snapshotInProgress = false; return fileSaver(result, filename, opts.format); }).then(function(name) { resolve(name); }).catch(function(err) { if (_gd) _gd._snapshotInProgress = false; reject(err); }); }); } module2.exports = downloadImage; } }); // node_modules/plotly.js/src/plot_api/template_api.js var require_template_api = __commonJS({ "node_modules/plotly.js/src/plot_api/template_api.js"(exports2) { "use strict"; var Lib = require_lib(); var isPlainObject = Lib.isPlainObject; var PlotSchema = require_plot_schema(); var Plots = require_plots(); var plotAttributes = require_attributes2(); var Template = require_plot_template(); var dfltConfig = require_plot_config().dfltConfig; exports2.makeTemplate = function(figure) { figure = Lib.isPlainObject(figure) ? figure : Lib.getGraphDiv(figure); figure = Lib.extendDeep({ _context: dfltConfig }, { data: figure.data, layout: figure.layout }); Plots.supplyDefaults(figure); var data = figure.data || []; var layout = figure.layout || {}; layout._basePlotModules = figure._fullLayout._basePlotModules; layout._modules = figure._fullLayout._modules; var template = { data: {}, layout: {} }; data.forEach(function(trace) { var traceTemplate = {}; walkStyleKeys(trace, traceTemplate, getTraceInfo.bind(null, trace)); var traceType2 = Lib.coerce(trace, {}, plotAttributes, "type"); var typeTemplates2 = template.data[traceType2]; if (!typeTemplates2) typeTemplates2 = template.data[traceType2] = []; typeTemplates2.push(traceTemplate); }); walkStyleKeys(layout, template.layout, getLayoutInfo.bind(null, layout)); delete template.layout.template; var oldTemplate = layout.template; if (isPlainObject(oldTemplate)) { var oldLayoutTemplate = oldTemplate.layout; var i, traceType, oldTypeTemplates, oldTypeLen, typeTemplates, typeLen; if (isPlainObject(oldLayoutTemplate)) { mergeTemplates(oldLayoutTemplate, template.layout); } var oldDataTemplate = oldTemplate.data; if (isPlainObject(oldDataTemplate)) { for (traceType in template.data) { oldTypeTemplates = oldDataTemplate[traceType]; if (Array.isArray(oldTypeTemplates)) { typeTemplates = template.data[traceType]; typeLen = typeTemplates.length; oldTypeLen = oldTypeTemplates.length; for (i = 0; i < typeLen; i++) { mergeTemplates(oldTypeTemplates[i % oldTypeLen], typeTemplates[i]); } for (i = typeLen; i < oldTypeLen; i++) { typeTemplates.push(Lib.extendDeep({}, oldTypeTemplates[i])); } } } for (traceType in oldDataTemplate) { if (!(traceType in template.data)) { template.data[traceType] = Lib.extendDeep([], oldDataTemplate[traceType]); } } } } return template; }; function mergeTemplates(oldTemplate, newTemplate) { oldTemplate = Lib.extendDeep({}, oldTemplate); var oldKeys = Object.keys(oldTemplate).sort(); var i, j; function mergeOne(oldVal2, newVal, key3) { if (isPlainObject(newVal) && isPlainObject(oldVal2)) { mergeTemplates(oldVal2, newVal); } else if (Array.isArray(newVal) && Array.isArray(oldVal2)) { var templater = Template.arrayTemplater({ _template: oldTemplate }, key3); for (j = 0; j < newVal.length; j++) { var item = newVal[j]; var oldItem = templater.newItem(item)._template; if (oldItem) mergeTemplates(oldItem, item); } var defaultItems = templater.defaultItems(); for (j = 0; j < defaultItems.length; j++) newVal.push(defaultItems[j]._template); for (j = 0; j < newVal.length; j++) delete newVal[j].templateitemname; } } for (i = 0; i < oldKeys.length; i++) { var key = oldKeys[i]; var oldVal = oldTemplate[key]; if (key in newTemplate) { mergeOne(oldVal, newTemplate[key], key); } else newTemplate[key] = oldVal; if (getBaseKey(key) === key) { for (var key2 in newTemplate) { var baseKey2 = getBaseKey(key2); if (key2 !== baseKey2 && baseKey2 === key && !(key2 in oldTemplate)) { mergeOne(oldVal, newTemplate[key2], key); } } } } } function getBaseKey(key) { return key.replace(/[0-9]+$/, ""); } function walkStyleKeys(parent, templateOut, getAttributeInfo, path, basePath) { var pathAttr = basePath && getAttributeInfo(basePath); for (var key in parent) { var child = parent[key]; var nextPath = getNextPath(parent, key, path); var nextBasePath = getNextPath(parent, key, basePath); var attr = getAttributeInfo(nextBasePath); if (!attr) { var baseKey = getBaseKey(key); if (baseKey !== key) { nextBasePath = getNextPath(parent, baseKey, basePath); attr = getAttributeInfo(nextBasePath); } } if (pathAttr && pathAttr === attr) continue; if (!attr || attr._noTemplating || attr.valType === "data_array" || attr.arrayOk && Array.isArray(child)) { continue; } if (!attr.valType && isPlainObject(child)) { walkStyleKeys(child, templateOut, getAttributeInfo, nextPath, nextBasePath); } else if (attr._isLinkedToArray && Array.isArray(child)) { var dfltDone = false; var namedIndex = 0; var usedNames = {}; for (var i = 0; i < child.length; i++) { var item = child[i]; if (isPlainObject(item)) { var name = item.name; if (name) { if (!usedNames[name]) { walkStyleKeys( item, templateOut, getAttributeInfo, getNextPath(child, namedIndex, nextPath), getNextPath(child, namedIndex, nextBasePath) ); namedIndex++; usedNames[name] = 1; } } else if (!dfltDone) { var dfltKey = Template.arrayDefaultKey(key); var dfltPath = getNextPath(parent, dfltKey, path); var pathInArray = getNextPath(child, namedIndex, nextPath); walkStyleKeys( item, templateOut, getAttributeInfo, pathInArray, getNextPath(child, namedIndex, nextBasePath) ); var itemPropInArray = Lib.nestedProperty(templateOut, pathInArray); var dfltProp = Lib.nestedProperty(templateOut, dfltPath); dfltProp.set(itemPropInArray.get()); itemPropInArray.set(null); dfltDone = true; } } } } else { var templateProp = Lib.nestedProperty(templateOut, nextPath); templateProp.set(child); } } } function getLayoutInfo(layout, path) { return PlotSchema.getLayoutValObject( layout, Lib.nestedProperty({}, path).parts ); } function getTraceInfo(trace, path) { return PlotSchema.getTraceValObject( trace, Lib.nestedProperty({}, path).parts ); } function getNextPath(parent, key, path) { var nextPath; if (!path) nextPath = key; else if (Array.isArray(parent)) nextPath = path + "[" + key + "]"; else nextPath = path + "." + key; return nextPath; } exports2.validateTemplate = function(figureIn, template) { var figure = Lib.extendDeep({}, { _context: dfltConfig, data: figureIn.data, layout: figureIn.layout }); var layout = figure.layout || {}; if (!isPlainObject(template)) template = layout.template || {}; var layoutTemplate = template.layout; var dataTemplate = template.data; var errorList = []; figure.layout = layout; figure.layout.template = template; Plots.supplyDefaults(figure); var fullLayout = figure._fullLayout; var fullData = figure._fullData; var layoutPaths = {}; function crawlLayoutForContainers(obj, paths) { for (var key in obj) { if (key.charAt(0) !== "_" && isPlainObject(obj[key])) { var baseKey = getBaseKey(key); var nextPaths = []; var i2; for (i2 = 0; i2 < paths.length; i2++) { nextPaths.push(getNextPath(obj, key, paths[i2])); if (baseKey !== key) nextPaths.push(getNextPath(obj, baseKey, paths[i2])); } for (i2 = 0; i2 < nextPaths.length; i2++) { layoutPaths[nextPaths[i2]] = 1; } crawlLayoutForContainers(obj[key], nextPaths); } } } function crawlLayoutTemplateForContainers(obj, path) { for (var key in obj) { if (key.indexOf("defaults") === -1 && isPlainObject(obj[key])) { var nextPath = getNextPath(obj, key, path); if (layoutPaths[nextPath]) { crawlLayoutTemplateForContainers(obj[key], nextPath); } else { errorList.push({ code: "unused", path: nextPath }); } } } } if (!isPlainObject(layoutTemplate)) { errorList.push({ code: "layout" }); } else { crawlLayoutForContainers(fullLayout, ["layout"]); crawlLayoutTemplateForContainers(layoutTemplate, "layout"); } if (!isPlainObject(dataTemplate)) { errorList.push({ code: "data" }); } else { var typeCount = {}; var traceType; for (var i = 0; i < fullData.length; i++) { var fullTrace = fullData[i]; traceType = fullTrace.type; typeCount[traceType] = (typeCount[traceType] || 0) + 1; if (!fullTrace._fullInput._template) { errorList.push({ code: "missing", index: fullTrace._fullInput.index, traceType }); } } for (traceType in dataTemplate) { var templateCount = dataTemplate[traceType].length; var dataCount = typeCount[traceType] || 0; if (templateCount > dataCount) { errorList.push({ code: "unused", traceType, templateCount, dataCount }); } else if (dataCount > templateCount) { errorList.push({ code: "reused", traceType, templateCount, dataCount }); } } } function crawlForMissingTemplates(obj, path) { for (var key in obj) { if (key.charAt(0) === "_") continue; var val = obj[key]; var nextPath = getNextPath(obj, key, path); if (isPlainObject(val)) { if (Array.isArray(obj) && val._template === false && val.templateitemname) { errorList.push({ code: "missing", path: nextPath, templateitemname: val.templateitemname }); } crawlForMissingTemplates(val, nextPath); } else if (Array.isArray(val) && hasPlainObject(val)) { crawlForMissingTemplates(val, nextPath); } } } crawlForMissingTemplates({ data: fullData, layout: fullLayout }, ""); if (errorList.length) return errorList.map(format2); }; function hasPlainObject(arr) { for (var i = 0; i < arr.length; i++) { if (isPlainObject(arr[i])) return true; } } function format2(opts) { var msg; switch (opts.code) { case "data": msg = "The template has no key data."; break; case "layout": msg = "The template has no key layout."; break; case "missing": if (opts.path) { msg = "There are no templates for item " + opts.path + " with name " + opts.templateitemname; } else { msg = "There are no templates for trace " + opts.index + ", of type " + opts.traceType + "."; } break; case "unused": if (opts.path) { msg = "The template item at " + opts.path + " was not used in constructing the plot."; } else if (opts.dataCount) { msg = "Some of the templates of type " + opts.traceType + " were not used. The template has " + opts.templateCount + " traces, the data only has " + opts.dataCount + " of this type."; } else { msg = "The template has " + opts.templateCount + " traces of type " + opts.traceType + " but there are none in the data."; } break; case "reused": msg = "Some of the templates of type " + opts.traceType + " were used more than once. The template has " + opts.templateCount + " traces, the data has " + opts.dataCount + " of this type."; break; } opts.msg = msg; return opts; } } }); // node_modules/plotly.js/src/plot_api/index.js var require_plot_api2 = __commonJS({ "node_modules/plotly.js/src/plot_api/index.js"(exports2) { "use strict"; var main = require_plot_api(); exports2._doPlot = main._doPlot; exports2.newPlot = main.newPlot; exports2.restyle = main.restyle; exports2.relayout = main.relayout; exports2.redraw = main.redraw; exports2.update = main.update; exports2._guiRestyle = main._guiRestyle; exports2._guiRelayout = main._guiRelayout; exports2._guiUpdate = main._guiUpdate; exports2._storeDirectGUIEdit = main._storeDirectGUIEdit; exports2.react = main.react; exports2.extendTraces = main.extendTraces; exports2.prependTraces = main.prependTraces; exports2.addTraces = main.addTraces; exports2.deleteTraces = main.deleteTraces; exports2.moveTraces = main.moveTraces; exports2.purge = main.purge; exports2.addFrames = main.addFrames; exports2.deleteFrames = main.deleteFrames; exports2.animate = main.animate; exports2.setPlotConfig = main.setPlotConfig; var getGraphDiv = require_dom().getGraphDiv; var eraseActiveShape = require_draw2().eraseActiveShape; exports2.deleteActiveShape = function(gd2) { return eraseActiveShape(getGraphDiv(gd2)); }; exports2.toImage = require_to_image(); exports2.validate = require_validate(); exports2.downloadImage = require_download(); var templateApi = require_template_api(); exports2.makeTemplate = templateApi.makeTemplate; exports2.validateTemplate = templateApi.validateTemplate; } }); // node_modules/plotly.js/src/traces/scatter/xy_defaults.js var require_xy_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/xy_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Registry = require_registry(); module2.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { var x = coerce("x"); var y = coerce("y"); var len; var handleCalendarDefaults = Registry.getComponentMethod("calendars", "handleTraceDefaults"); handleCalendarDefaults(traceIn, traceOut, ["x", "y"], layout); if (x) { var xlen = Lib.minRowLength(x); if (y) { len = Math.min(xlen, Lib.minRowLength(y)); } else { len = xlen; coerce("y0"); coerce("dy"); } } else { if (!y) return 0; len = Lib.minRowLength(y); coerce("x0"); coerce("dx"); } traceOut._length = len; return len; }; } }); // node_modules/plotly.js/src/traces/scatter/period_defaults.js var require_period_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/period_defaults.js"(exports2, module2) { "use strict"; var dateTick0 = require_lib().dateTick0; var numConstants = require_numerical(); var ONEWEEK = numConstants.ONEWEEK; function getPeriod0Dflt(period, calendar) { if (period % ONEWEEK === 0) { return dateTick0(calendar, 1); } return dateTick0(calendar, 0); } module2.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) { if (!opts) { opts = { x: true, y: true }; } if (opts.x) { var xperiod = coerce("xperiod"); if (xperiod) { coerce("xperiod0", getPeriod0Dflt(xperiod, traceOut.xcalendar)); coerce("xperiodalignment"); } } if (opts.y) { var yperiod = coerce("yperiod"); if (yperiod) { coerce("yperiod0", getPeriod0Dflt(yperiod, traceOut.ycalendar)); coerce("yperiodalignment"); } } }; } }); // node_modules/plotly.js/src/traces/scatter/stack_defaults.js var require_stack_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/stack_defaults.js"(exports2, module2) { "use strict"; var perStackAttrs = ["orientation", "groupnorm", "stackgaps"]; module2.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) { var stackOpts = layout._scatterStackOpts; var stackGroup = coerce("stackgroup"); if (stackGroup) { var subplot = traceOut.xaxis + traceOut.yaxis; var subplotStackOpts = stackOpts[subplot]; if (!subplotStackOpts) subplotStackOpts = stackOpts[subplot] = {}; var groupOpts = subplotStackOpts[stackGroup]; var firstTrace = false; if (groupOpts) { groupOpts.traces.push(traceOut); } else { groupOpts = subplotStackOpts[stackGroup] = { // keep track of trace indices for use during stacking calculations // this will be filled in during `calc` and used during `crossTraceCalc` // so it's OK if we don't recreate it during a non-calc edit traceIndices: [], // Hold on to the whole set of prior traces // First one is most important, so we can clear defaults // there if we find explicit values only in later traces. // We're only going to *use* the values stored in groupOpts, // but for the editor and validate we want things self-consistent // The full set of traces is used only to fix `fill` default if // we find `orientation: 'h'` beyond the first trace traces: [traceOut] }; firstTrace = true; } var dflts = { orientation: traceOut.x && !traceOut.y ? "h" : "v" }; for (var i = 0; i < perStackAttrs.length; i++) { var attr = perStackAttrs[i]; var attrFound = attr + "Found"; if (!groupOpts[attrFound]) { var traceHasAttr = traceIn[attr] !== void 0; var isOrientation = attr === "orientation"; if (traceHasAttr || firstTrace) { groupOpts[attr] = coerce(attr, dflts[attr]); if (isOrientation) { groupOpts.fillDflt = groupOpts[attr] === "h" ? "tonextx" : "tonexty"; } if (traceHasAttr) { groupOpts[attrFound] = true; if (!firstTrace) { delete groupOpts.traces[0][attr]; if (isOrientation) { for (var j = 0; j < groupOpts.traces.length - 1; j++) { var trace2 = groupOpts.traces[j]; if (trace2._input.fill !== trace2.fill) { trace2.fill = groupOpts.fillDflt; } } } } } } } } return groupOpts; } }; } }); // node_modules/plotly.js/src/traces/scatter/marker_defaults.js var require_marker_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/marker_defaults.js"(exports2, module2) { "use strict"; var Color = require_color(); var hasColorscale = require_helpers().hasColorscale; var colorscaleDefaults = require_defaults2(); var subTypes = require_subtypes(); module2.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { var isBubble = subTypes.isBubble(traceIn); var lineColor = (traceIn.line || {}).color; var defaultMLC; opts = opts || {}; if (lineColor) defaultColor = lineColor; coerce("marker.symbol"); coerce("marker.opacity", isBubble ? 0.7 : 1); coerce("marker.size"); if (!opts.noAngle) { coerce("marker.angle"); if (!opts.noAngleRef) { coerce("marker.angleref"); } if (!opts.noStandOff) { coerce("marker.standoff"); } } coerce("marker.color", defaultColor); if (hasColorscale(traceIn, "marker")) { colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: "marker.", cLetter: "c" }); } if (!opts.noSelect) { coerce("selected.marker.color"); coerce("unselected.marker.color"); coerce("selected.marker.size"); coerce("unselected.marker.size"); } if (!opts.noLine) { if (lineColor && !Array.isArray(lineColor) && traceOut.marker.color !== lineColor) { defaultMLC = lineColor; } else if (isBubble) defaultMLC = Color.background; else defaultMLC = Color.defaultLine; coerce("marker.line.color", defaultMLC); if (hasColorscale(traceIn, "marker.line")) { colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: "marker.line.", cLetter: "c" }); } coerce("marker.line.width", isBubble ? 1 : 0); } if (isBubble) { coerce("marker.sizeref"); coerce("marker.sizemin"); coerce("marker.sizemode"); } if (opts.gradient) { var gradientType = coerce("marker.gradient.type"); if (gradientType !== "none") { coerce("marker.gradient.color"); } } }; } }); // node_modules/plotly.js/src/traces/scatter/line_defaults.js var require_line_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/line_defaults.js"(exports2, module2) { "use strict"; var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; var hasColorscale = require_helpers().hasColorscale; var colorscaleDefaults = require_defaults2(); module2.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) { if (!opts) opts = {}; var markerColor = (traceIn.marker || {}).color; if (markerColor && markerColor._inputArray) markerColor = markerColor._inputArray; coerce("line.color", defaultColor); if (hasColorscale(traceIn, "line")) { colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: "line.", cLetter: "c" }); } else { var lineColorDflt = (isArrayOrTypedArray(markerColor) ? false : markerColor) || defaultColor; coerce("line.color", lineColorDflt); } coerce("line.width"); if (!opts.noDash) coerce("line.dash"); if (opts.backoff) coerce("line.backoff"); }; } }); // node_modules/plotly.js/src/traces/scatter/line_shape_defaults.js var require_line_shape_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/line_shape_defaults.js"(exports2, module2) { "use strict"; module2.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { var shape = coerce("line.shape"); if (shape === "spline") coerce("line.smoothing"); }; } }); // node_modules/plotly.js/src/traces/scatter/text_defaults.js var require_text_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/text_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function(traceIn, traceOut, layout, coerce, opts) { opts = opts || {}; coerce("textposition"); Lib.coerceFont(coerce, "textfont", opts.font || layout.font, opts); if (!opts.noSelect) { coerce("selected.textfont.color"); coerce("unselected.textfont.color"); } }; } }); // node_modules/plotly.js/src/traces/scatter/fillcolor_defaults.js var require_fillcolor_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/fillcolor_defaults.js"(exports2, module2) { "use strict"; var Color = require_color(); var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; function averageColors(colorscale) { var color = Color.interpolate(colorscale[0][1], colorscale[1][1], 0.5); for (var i = 2; i < colorscale.length; i++) { var averageColorI = Color.interpolate(colorscale[i - 1][1], colorscale[i][1], 0.5); color = Color.interpolate(color, averageColorI, colorscale[i - 1][0] / colorscale[i][0]); } return color; } module2.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce, opts) { if (!opts) opts = {}; var inheritColorFromMarker = false; if (traceOut.marker) { var markerColor = traceOut.marker.color; var markerLineColor = (traceOut.marker.line || {}).color; if (markerColor && !isArrayOrTypedArray(markerColor)) { inheritColorFromMarker = markerColor; } else if (markerLineColor && !isArrayOrTypedArray(markerLineColor)) { inheritColorFromMarker = markerLineColor; } } var averageGradientColor; if (opts.moduleHasFillgradient) { var gradientOrientation = coerce("fillgradient.type"); if (gradientOrientation !== "none") { coerce("fillgradient.start"); coerce("fillgradient.stop"); var gradientColorscale = coerce("fillgradient.colorscale"); if (gradientColorscale) { averageGradientColor = averageColors(gradientColorscale); } } } coerce("fillcolor", Color.addOpacity( (traceOut.line || {}).color || inheritColorFromMarker || averageGradientColor || defaultColor, 0.5 )); }; } }); // node_modules/plotly.js/src/traces/scatter/defaults.js var require_defaults8 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Registry = require_registry(); var attributes = require_attributes12(); var constants = require_constants8(); var subTypes = require_subtypes(); var handleXYDefaults = require_xy_defaults(); var handlePeriodDefaults = require_period_defaults(); var handleStackDefaults = require_stack_defaults(); var handleMarkerDefaults = require_marker_defaults(); var handleLineDefaults = require_line_defaults(); var handleLineShapeDefaults = require_line_shape_defaults(); var handleTextDefaults = require_text_defaults(); var handleFillColorDefaults = require_fillcolor_defaults(); var coercePattern = require_lib().coercePattern; module2.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } var len = handleXYDefaults(traceIn, traceOut, layout, coerce); if (!len) traceOut.visible = false; if (!traceOut.visible) return; handlePeriodDefaults(traceIn, traceOut, layout, coerce); coerce("xhoverformat"); coerce("yhoverformat"); coerce("zorder"); var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce); if (layout.scattermode === "group" && traceOut.orientation === void 0) { coerce("orientation", "v"); } var defaultMode = !stackGroupOpts && len < constants.PTS_LINESONLY ? "lines+markers" : "lines"; coerce("text"); coerce("hovertext"); coerce("mode", defaultMode); if (subTypes.hasMarkers(traceOut)) { handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, { gradient: true }); } if (subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce, { backoff: true }); handleLineShapeDefaults(traceIn, traceOut, coerce); coerce("connectgaps"); coerce("line.simplify"); } if (subTypes.hasText(traceOut)) { coerce("texttemplate"); handleTextDefaults(traceIn, traceOut, layout, coerce); } var dfltHoverOn = []; if (subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) { coerce("cliponaxis"); coerce("marker.maxdisplayed"); dfltHoverOn.push("points"); } coerce("fill", stackGroupOpts ? stackGroupOpts.fillDflt : "none"); if (traceOut.fill !== "none") { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce, { moduleHasFillgradient: true }); if (!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); coercePattern(coerce, "fillpattern", traceOut.fillcolor, false); } var lineColor = (traceOut.line || {}).color; var markerColor = (traceOut.marker || {}).color; if (traceOut.fill === "tonext" || traceOut.fill === "toself") { dfltHoverOn.push("fills"); } coerce("hoveron", dfltHoverOn.join("+") || "points"); if (traceOut.hoveron !== "fills") coerce("hovertemplate"); var errorBarsSupplyDefaults = Registry.getComponentMethod("errorbars", "supplyDefaults"); errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: "y" }); errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, { axis: "x", inherit: "y" }); Lib.coerceSelectionMarkerOpacity(traceOut, coerce); }; } }); // node_modules/plotly.js/src/traces/scatter/grouping_defaults.js var require_grouping_defaults = __commonJS({ "node_modules/plotly.js/src/traces/scatter/grouping_defaults.js"(exports2, module2) { "use strict"; var getAxisGroup = require_constraints().getAxisGroup; module2.exports = function handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce) { var orientation = traceOut.orientation; var posAxId = traceOut[{ v: "x", h: "y" }[orientation] + "axis"]; var groupId = getAxisGroup(fullLayout, posAxId) + orientation; var alignmentOpts = fullLayout._alignmentOpts || {}; var alignmentgroup = coerce("alignmentgroup"); var alignmentGroups = alignmentOpts[groupId]; if (!alignmentGroups) alignmentGroups = alignmentOpts[groupId] = {}; var alignmentGroupOpts = alignmentGroups[alignmentgroup]; if (alignmentGroupOpts) { alignmentGroupOpts.traces.push(traceOut); } else { alignmentGroupOpts = alignmentGroups[alignmentgroup] = { traces: [traceOut], alignmentIndex: Object.keys(alignmentGroups).length, offsetGroups: {} }; } var offsetgroup = coerce("offsetgroup"); var offsetGroups = alignmentGroupOpts.offsetGroups; var offsetGroupOpts = offsetGroups[offsetgroup]; if (offsetgroup) { if (!offsetGroupOpts) { offsetGroupOpts = offsetGroups[offsetgroup] = { offsetIndex: Object.keys(offsetGroups).length }; } traceOut._offsetIndex = offsetGroupOpts.offsetIndex; } }; } }); // node_modules/plotly.js/src/traces/scatter/cross_trace_defaults.js var require_cross_trace_defaults2 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/cross_trace_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var handleGroupingDefaults = require_grouping_defaults(); var attributes = require_attributes12(); module2.exports = function crossTraceDefaults(fullData, fullLayout) { var traceIn, traceOut, i; function coerce(attr) { return Lib.coerce(traceOut._input, traceOut, attributes, attr); } if (fullLayout.scattermode === "group") { for (i = 0; i < fullData.length; i++) { traceOut = fullData[i]; if (traceOut.type === "scatter") { traceIn = traceOut._input; handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce); } } } for (i = 0; i < fullData.length; i++) { var tracei = fullData[i]; if (tracei.type !== "scatter") continue; var filli = tracei.fill; if (filli === "none" || filli === "toself") continue; tracei.opacity = void 0; if (filli === "tonexty" || filli === "tonextx") { for (var j = i - 1; j >= 0; j--) { var tracej = fullData[j]; if (tracej.type === "scatter" && tracej.xaxis === tracei.xaxis && tracej.yaxis === tracei.yaxis) { tracej.opacity = void 0; break; } } } } }; } }); // node_modules/plotly.js/src/traces/scatter/layout_defaults.js var require_layout_defaults3 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/layout_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var layoutAttributes = require_layout_attributes3(); module2.exports = function(layoutIn, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } var groupBarmode = layoutOut.barmode === "group"; if (layoutOut.scattermode === "group") { coerce("scattergap", groupBarmode ? layoutOut.bargap : 0.2); } }; } }); // node_modules/plotly.js/src/plots/cartesian/align_period.js var require_align_period = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/align_period.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var dateTime2ms = Lib.dateTime2ms; var incrementMonth = Lib.incrementMonth; var constants = require_numerical(); var ONEAVGMONTH = constants.ONEAVGMONTH; module2.exports = function alignPeriod(trace, ax, axLetter, vals) { if (ax.type !== "date") return { vals }; var alignment = trace[axLetter + "periodalignment"]; if (!alignment) return { vals }; var period = trace[axLetter + "period"]; var mPeriod; if (isNumeric(period)) { period = +period; if (period <= 0) return { vals }; } else if (typeof period === "string" && period.charAt(0) === "M") { var n = +period.substring(1); if (n > 0 && Math.round(n) === n) { mPeriod = n; } else return { vals }; } var calendar = ax.calendar; var isStart = "start" === alignment; var isEnd = "end" === alignment; var period0 = trace[axLetter + "period0"]; var base = dateTime2ms(period0, calendar) || 0; var newVals = []; var starts = []; var ends = []; var len = vals.length; for (var i = 0; i < len; i++) { var v = vals[i]; var nEstimated, startTime, endTime; if (mPeriod) { nEstimated = Math.round((v - base) / (mPeriod * ONEAVGMONTH)); endTime = incrementMonth(base, mPeriod * nEstimated, calendar); while (endTime > v) { endTime = incrementMonth(endTime, -mPeriod, calendar); } while (endTime <= v) { endTime = incrementMonth(endTime, mPeriod, calendar); } startTime = incrementMonth(endTime, -mPeriod, calendar); } else { nEstimated = Math.round((v - base) / period); endTime = base + nEstimated * period; while (endTime > v) { endTime -= period; } while (endTime <= v) { endTime += period; } startTime = endTime - period; } newVals[i] = isStart ? startTime : isEnd ? endTime : (startTime + endTime) / 2; starts[i] = startTime; ends[i] = endTime; } return { vals: newVals, starts, ends }; }; } }); // node_modules/plotly.js/src/traces/scatter/colorscale_calc.js var require_colorscale_calc = __commonJS({ "node_modules/plotly.js/src/traces/scatter/colorscale_calc.js"(exports2, module2) { "use strict"; var hasColorscale = require_helpers().hasColorscale; var calcColorscale = require_calc(); var subTypes = require_subtypes(); module2.exports = function calcMarkerColorscale(gd2, trace) { if (subTypes.hasLines(trace) && hasColorscale(trace, "line")) { calcColorscale(gd2, trace, { vals: trace.line.color, containerStr: "line", cLetter: "c" }); } if (subTypes.hasMarkers(trace)) { if (hasColorscale(trace, "marker")) { calcColorscale(gd2, trace, { vals: trace.marker.color, containerStr: "marker", cLetter: "c" }); } if (hasColorscale(trace, "marker.line")) { calcColorscale(gd2, trace, { vals: trace.marker.line.color, containerStr: "marker.line", cLetter: "c" }); } } }; } }); // node_modules/plotly.js/src/traces/scatter/arrays_to_calcdata.js var require_arrays_to_calcdata = __commonJS({ "node_modules/plotly.js/src/traces/scatter/arrays_to_calcdata.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function arraysToCalcdata(cd2, trace) { for (var i = 0; i < cd2.length; i++) cd2[i].i = i; Lib.mergeArray(trace.text, cd2, "tx"); Lib.mergeArray(trace.texttemplate, cd2, "txt"); Lib.mergeArray(trace.hovertext, cd2, "htx"); Lib.mergeArray(trace.customdata, cd2, "data"); Lib.mergeArray(trace.textposition, cd2, "tp"); if (trace.textfont) { Lib.mergeArrayCastPositive(trace.textfont.size, cd2, "ts"); Lib.mergeArray(trace.textfont.color, cd2, "tc"); Lib.mergeArray(trace.textfont.family, cd2, "tf"); Lib.mergeArray(trace.textfont.weight, cd2, "tw"); Lib.mergeArray(trace.textfont.style, cd2, "ty"); Lib.mergeArray(trace.textfont.variant, cd2, "tv"); Lib.mergeArray(trace.textfont.textcase, cd2, "tC"); Lib.mergeArray(trace.textfont.lineposition, cd2, "tE"); Lib.mergeArray(trace.textfont.shadow, cd2, "tS"); } var marker = trace.marker; if (marker) { Lib.mergeArrayCastPositive(marker.size, cd2, "ms"); Lib.mergeArrayCastPositive(marker.opacity, cd2, "mo"); Lib.mergeArray(marker.symbol, cd2, "mx"); Lib.mergeArray(marker.angle, cd2, "ma"); Lib.mergeArray(marker.standoff, cd2, "mf"); Lib.mergeArray(marker.color, cd2, "mc"); var markerLine = marker.line; if (marker.line) { Lib.mergeArray(markerLine.color, cd2, "mlc"); Lib.mergeArrayCastPositive(markerLine.width, cd2, "mlw"); } var markerGradient = marker.gradient; if (markerGradient && markerGradient.type !== "none") { Lib.mergeArray(markerGradient.type, cd2, "mgt"); Lib.mergeArray(markerGradient.color, cd2, "mgc"); } } }; } }); // node_modules/plotly.js/src/traces/scatter/calc_selection.js var require_calc_selection = __commonJS({ "node_modules/plotly.js/src/traces/scatter/calc_selection.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function calcSelection(cd2, trace) { if (Lib.isArrayOrTypedArray(trace.selectedpoints)) { Lib.tagSelected(cd2, trace); } }; } }); // node_modules/plotly.js/src/traces/scatter/calc.js var require_calc3 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/calc.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Axes = require_axes(); var alignPeriod = require_align_period(); var BADNUM = require_numerical().BADNUM; var subTypes = require_subtypes(); var calcColorscale = require_colorscale_calc(); var arraysToCalcdata = require_arrays_to_calcdata(); var calcSelection = require_calc_selection(); function calc(gd2, trace) { var fullLayout = gd2._fullLayout; var xa2 = trace._xA = Axes.getFromId(gd2, trace.xaxis || "x", "x"); var ya2 = trace._yA = Axes.getFromId(gd2, trace.yaxis || "y", "y"); var origX = xa2.makeCalcdata(trace, "x"); var origY = ya2.makeCalcdata(trace, "y"); var xObj = alignPeriod(trace, xa2, "x", origX); var yObj = alignPeriod(trace, ya2, "y", origY); var x = xObj.vals; var y = yObj.vals; var serieslen = trace._length; var cd2 = new Array(serieslen); var ids = trace.ids; var stackGroupOpts = getStackOpts(trace, fullLayout, xa2, ya2); var interpolateGaps = false; var isV, i, j, k, interpolate, vali; setFirstScatter(fullLayout, trace); var xAttr = "x"; var yAttr = "y"; var posAttr; if (stackGroupOpts) { Lib.pushUnique(stackGroupOpts.traceIndices, trace._expandedIndex); isV = stackGroupOpts.orientation === "v"; if (isV) { yAttr = "s"; posAttr = "x"; } else { xAttr = "s"; posAttr = "y"; } interpolate = stackGroupOpts.stackgaps === "interpolate"; } else { var ppad = calcMarkerSize(trace, serieslen); calcAxisExpansion(gd2, trace, xa2, ya2, x, y, ppad); } var hasPeriodX = !!trace.xperiodalignment; var hasPeriodY = !!trace.yperiodalignment; for (i = 0; i < serieslen; i++) { var cdi = cd2[i] = {}; var xValid = isNumeric(x[i]); var yValid = isNumeric(y[i]); if (xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; if (hasPeriodX) { cdi.orig_x = origX[i]; cdi.xEnd = xObj.ends[i]; cdi.xStart = xObj.starts[i]; } if (hasPeriodY) { cdi.orig_y = origY[i]; cdi.yEnd = yObj.ends[i]; cdi.yStart = yObj.starts[i]; } } else if (stackGroupOpts && (isV ? xValid : yValid)) { cdi[posAttr] = isV ? x[i] : y[i]; cdi.gap = true; if (interpolate) { cdi.s = BADNUM; interpolateGaps = true; } else { cdi.s = 0; } } else { cdi[xAttr] = cdi[yAttr] = BADNUM; } if (ids) { cdi.id = String(ids[i]); } } arraysToCalcdata(cd2, trace); calcColorscale(gd2, trace); calcSelection(cd2, trace); if (stackGroupOpts) { i = 0; while (i < cd2.length) { if (cd2[i][posAttr] === BADNUM) { cd2.splice(i, 1); } else i++; } Lib.sort(cd2, function(a, b) { return a[posAttr] - b[posAttr] || a.i - b.i; }); if (interpolateGaps) { i = 0; while (i < cd2.length - 1 && cd2[i].gap) { i++; } vali = cd2[i].s; if (!vali) vali = cd2[i].s = 0; for (j = 0; j < i; j++) { cd2[j].s = vali; } k = cd2.length - 1; while (k > i && cd2[k].gap) { k--; } vali = cd2[k].s; for (j = cd2.length - 1; j > k; j--) { cd2[j].s = vali; } while (i < k) { i++; if (cd2[i].gap) { j = i + 1; while (cd2[j].gap) { j++; } var pos0 = cd2[i - 1][posAttr]; var size0 = cd2[i - 1].s; var m = (cd2[j].s - size0) / (cd2[j][posAttr] - pos0); while (i < j) { cd2[i].s = size0 + (cd2[i][posAttr] - pos0) * m; i++; } } } } } return cd2; } function calcAxisExpansion(gd2, trace, xa2, ya2, x, y, ppad) { var serieslen = trace._length; var fullLayout = gd2._fullLayout; var xId = xa2._id; var yId = ya2._id; var firstScatter = fullLayout._firstScatter[firstScatterGroup(trace)] === trace.uid; var stackOrientation = (getStackOpts(trace, fullLayout, xa2, ya2) || {}).orientation; var fill = trace.fill; xa2._minDtick = 0; ya2._minDtick = 0; var xOptions = { padded: true }; var yOptions = { padded: true }; if (ppad) { xOptions.ppad = yOptions.ppad = ppad; } var openEnded = serieslen < 2 || x[0] !== x[serieslen - 1] || y[0] !== y[serieslen - 1]; if (openEnded && (fill === "tozerox" || fill === "tonextx" && (firstScatter || stackOrientation === "h"))) { xOptions.tozero = true; } else if (!(trace.error_y || {}).visible && // if no error bars, markers or text, or fill to y=0 remove x padding (fill === "tonexty" || fill === "tozeroy" || !subTypes.hasMarkers(trace) && !subTypes.hasText(trace))) { xOptions.padded = false; xOptions.ppad = 0; } if (openEnded && (fill === "tozeroy" || fill === "tonexty" && (firstScatter || stackOrientation === "v"))) { yOptions.tozero = true; } else if (fill === "tonextx" || fill === "tozerox") { yOptions.padded = false; } if (xId) trace._extremes[xId] = Axes.findExtremes(xa2, x, xOptions); if (yId) trace._extremes[yId] = Axes.findExtremes(ya2, y, yOptions); } function calcMarkerSize(trace, serieslen) { if (!subTypes.hasMarkers(trace)) return; var marker = trace.marker; var sizeref = 1.6 * (trace.marker.sizeref || 1); var markerTrans; if (trace.marker.sizemode === "area") { markerTrans = function(v) { return Math.max(Math.sqrt((v || 0) / sizeref), 3); }; } else { markerTrans = function(v) { return Math.max((v || 0) / sizeref, 3); }; } if (Lib.isArrayOrTypedArray(marker.size)) { var ax = { type: "linear" }; Axes.setConvert(ax); var s = ax.makeCalcdata(trace.marker, "size"); var sizeOut = new Array(serieslen); for (var i = 0; i < serieslen; i++) { sizeOut[i] = markerTrans(s[i]); } return sizeOut; } else { return markerTrans(marker.size); } } function setFirstScatter(fullLayout, trace) { var group = firstScatterGroup(trace); var firstScatter = fullLayout._firstScatter; if (!firstScatter[group]) firstScatter[group] = trace.uid; } function firstScatterGroup(trace) { var stackGroup = trace.stackgroup; return trace.xaxis + trace.yaxis + trace.type + (stackGroup ? "-" + stackGroup : ""); } function getStackOpts(trace, fullLayout, xa2, ya2) { var stackGroup = trace.stackgroup; if (!stackGroup) return; var stackOpts = fullLayout._scatterStackOpts[xa2._id + ya2._id][stackGroup]; var stackAx = stackOpts.orientation === "v" ? ya2 : xa2; if (stackAx.type === "linear" || stackAx.type === "log") return stackOpts; } module2.exports = { calc, calcMarkerSize, calcAxisExpansion, setFirstScatter, getStackOpts }; } }); // node_modules/plotly.js/src/traces/bar/sieve.js var require_sieve = __commonJS({ "node_modules/plotly.js/src/traces/bar/sieve.js"(exports2, module2) { "use strict"; module2.exports = Sieve; var distinctVals = require_lib().distinctVals; function Sieve(traces, opts) { this.traces = traces; this.sepNegVal = opts.sepNegVal; this.overlapNoMerge = opts.overlapNoMerge; var width1 = Infinity; var axLetter = opts.posAxis._id.charAt(0); var positions = []; for (var i = 0; i < traces.length; i++) { var trace = traces[i]; for (var j = 0; j < trace.length; j++) { var bar = trace[j]; var pos = bar.p; if (pos === void 0) { pos = bar[axLetter]; } if (pos !== void 0) positions.push(pos); } if (trace[0] && trace[0].width1) { width1 = Math.min(trace[0].width1, width1); } } this.positions = positions; var dv2 = distinctVals(positions); this.distinctPositions = dv2.vals; if (dv2.vals.length === 1 && width1 !== Infinity) this.minDiff = width1; else this.minDiff = Math.min(dv2.minDiff, width1); var type = (opts.posAxis || {}).type; if (type === "category" || type === "multicategory") { this.minDiff = 1; } this.binWidth = this.minDiff; this.bins = {}; } Sieve.prototype.put = function put(position, value) { var label = this.getLabel(position, value); var oldValue = this.bins[label] || 0; this.bins[label] = oldValue + value; return oldValue; }; Sieve.prototype.get = function get(position, value) { var label = this.getLabel(position, value); return this.bins[label] || 0; }; Sieve.prototype.getLabel = function getLabel(position, value) { var prefix = value < 0 && this.sepNegVal ? "v" : "^"; var label = this.overlapNoMerge ? position : Math.round(position / this.binWidth); return prefix + label; }; } }); // node_modules/plotly.js/src/traces/bar/cross_trace_calc.js var require_cross_trace_calc = __commonJS({ "node_modules/plotly.js/src/traces/bar/cross_trace_calc.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; var BADNUM = require_numerical().BADNUM; var Registry = require_registry(); var Axes = require_axes(); var getAxisGroup = require_constraints().getAxisGroup; var Sieve = require_sieve(); function crossTraceCalc(gd2, plotinfo) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var fullLayout = gd2._fullLayout; var fullTraces = gd2._fullData; var calcTraces = gd2.calcdata; var calcTracesHorz = []; var calcTracesVert = []; for (var i = 0; i < fullTraces.length; i++) { var fullTrace = fullTraces[i]; if (fullTrace.visible === true && Registry.traceIs(fullTrace, "bar") && fullTrace.xaxis === xa2._id && fullTrace.yaxis === ya2._id) { if (fullTrace.orientation === "h") { calcTracesHorz.push(calcTraces[i]); } else { calcTracesVert.push(calcTraces[i]); } if (fullTrace._computePh) { var cd2 = gd2.calcdata[i]; for (var j = 0; j < cd2.length; j++) { if (typeof cd2[j].ph0 === "function") cd2[j].ph0 = cd2[j].ph0(); if (typeof cd2[j].ph1 === "function") cd2[j].ph1 = cd2[j].ph1(); } } } } var opts = { xCat: xa2.type === "category" || xa2.type === "multicategory", yCat: ya2.type === "category" || ya2.type === "multicategory", mode: fullLayout.barmode, norm: fullLayout.barnorm, gap: fullLayout.bargap, groupgap: fullLayout.bargroupgap }; setGroupPositions(gd2, xa2, ya2, calcTracesVert, opts); setGroupPositions(gd2, ya2, xa2, calcTracesHorz, opts); } function setGroupPositions(gd2, pa2, sa2, calcTraces, opts) { if (!calcTraces.length) return; var excluded; var included; var i, calcTrace, fullTrace; initBase(sa2, calcTraces); switch (opts.mode) { case "overlay": setGroupPositionsInOverlayMode(pa2, sa2, calcTraces, opts); break; case "group": excluded = []; included = []; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; if (fullTrace.offset === void 0) included.push(calcTrace); else excluded.push(calcTrace); } if (included.length) { setGroupPositionsInGroupMode(gd2, pa2, sa2, included, opts); } if (excluded.length) { setGroupPositionsInOverlayMode(pa2, sa2, excluded, opts); } break; case "stack": case "relative": excluded = []; included = []; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; if (fullTrace.base === void 0) included.push(calcTrace); else excluded.push(calcTrace); } standardizeCornerradius(included); if (included.length) { setGroupPositionsInStackOrRelativeMode(gd2, pa2, sa2, included, opts); } if (excluded.length) { setGroupPositionsInOverlayMode(pa2, sa2, excluded, opts); } break; } setCornerradius(calcTraces); collectExtents(calcTraces, pa2); } function setCornerradius(calcTraces) { var i, calcTrace, fullTrace, t, cr2, crValue, crForm; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; t = calcTrace[0].t; if (t.cornerradiusvalue === void 0) { cr2 = fullTrace.marker ? fullTrace.marker.cornerradius : void 0; if (cr2 !== void 0) { crValue = isNumeric(cr2) ? +cr2 : +cr2.slice(0, -1); crForm = isNumeric(cr2) ? "px" : "%"; t.cornerradiusvalue = crValue; t.cornerradiusform = crForm; } } } } function standardizeCornerradius(calcTraces) { if (calcTraces.length < 2) return; var i, calcTrace, fullTrace, t; var cr2, crValue, crForm; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; cr2 = fullTrace.marker ? fullTrace.marker.cornerradius : void 0; if (cr2 !== void 0) break; } if (cr2 !== void 0) { crValue = isNumeric(cr2) ? +cr2 : +cr2.slice(0, -1); crForm = isNumeric(cr2) ? "px" : "%"; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; t = calcTrace[0].t; t.cornerradiusvalue = crValue; t.cornerradiusform = crForm; } } } function initBase(sa2, calcTraces) { var i, j; for (i = 0; i < calcTraces.length; i++) { var cd2 = calcTraces[i]; var trace = cd2[0].trace; var base = trace.type === "funnel" ? trace._base : trace.base; var b; var scalendar = trace.orientation === "h" ? trace.xcalendar : trace.ycalendar; var d2c = sa2.type === "category" || sa2.type === "multicategory" ? function() { return null; } : sa2.d2c; if (isArrayOrTypedArray(base)) { for (j = 0; j < Math.min(base.length, cd2.length); j++) { b = d2c(base[j], 0, scalendar); if (isNumeric(b)) { cd2[j].b = +b; cd2[j].hasB = 1; } else cd2[j].b = 0; } for (; j < cd2.length; j++) { cd2[j].b = 0; } } else { b = d2c(base, 0, scalendar); var hasBase = isNumeric(b); b = hasBase ? b : 0; for (j = 0; j < cd2.length; j++) { cd2[j].b = b; if (hasBase) cd2[j].hasB = 1; } } } } function setGroupPositionsInOverlayMode(pa2, sa2, calcTraces, opts) { for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var sieve = new Sieve([calcTrace], { posAxis: pa2, sepNegVal: false, overlapNoMerge: !opts.norm }); setOffsetAndWidth(pa2, sieve, opts); if (opts.norm) { sieveBars(sieve); normalizeBars(sa2, sieve, opts); } else { setBaseAndTop(sa2, sieve); } } } function setGroupPositionsInGroupMode(gd2, pa2, sa2, calcTraces, opts) { var sieve = new Sieve(calcTraces, { posAxis: pa2, sepNegVal: false, overlapNoMerge: !opts.norm }); setOffsetAndWidthInGroupMode(gd2, pa2, sieve, opts); unhideBarsWithinTrace(sieve, pa2); if (opts.norm) { sieveBars(sieve); normalizeBars(sa2, sieve, opts); } else { setBaseAndTop(sa2, sieve); } } function setGroupPositionsInStackOrRelativeMode(gd2, pa2, sa2, calcTraces, opts) { var sieve = new Sieve(calcTraces, { posAxis: pa2, sepNegVal: opts.mode === "relative", overlapNoMerge: !(opts.norm || opts.mode === "stack" || opts.mode === "relative") }); setOffsetAndWidth(pa2, sieve, opts); stackBars(sa2, sieve, opts); for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; if (bar.s !== BADNUM) { var isOutmostBar = bar.b + bar.s === sieve.get(bar.p, bar.s); if (isOutmostBar) bar._outmost = true; } } } if (opts.norm) normalizeBars(sa2, sieve, opts); } function setOffsetAndWidth(pa2, sieve, opts) { var minDiff = sieve.minDiff; var calcTraces = sieve.traces; var barGroupWidth = minDiff * (1 - opts.gap); var barWidthPlusGap = barGroupWidth; var barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0)); var offsetFromCenter = -barWidth / 2; for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var t = calcTrace[0].t; t.barwidth = barWidth; t.poffset = offsetFromCenter; t.bargroupwidth = barGroupWidth; t.bardelta = minDiff; } sieve.binWidth = calcTraces[0][0].t.barwidth / 100; applyAttributes(sieve); setBarCenterAndWidth(pa2, sieve); updatePositionAxis(pa2, sieve); } function setOffsetAndWidthInGroupMode(gd2, pa2, sieve, opts) { var fullLayout = gd2._fullLayout; var positions = sieve.positions; var distinctPositions = sieve.distinctPositions; var minDiff = sieve.minDiff; var calcTraces = sieve.traces; var nTraces = calcTraces.length; var overlap = positions.length !== distinctPositions.length; var barGroupWidth = minDiff * (1 - opts.gap); var groupId = getAxisGroup(fullLayout, pa2._id) + calcTraces[0][0].trace.orientation; var alignmentGroups = fullLayout._alignmentOpts[groupId] || {}; for (var i = 0; i < nTraces; i++) { var calcTrace = calcTraces[i]; var trace = calcTrace[0].trace; var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {}; var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length; var barWidthPlusGap; if (nOffsetGroups) { barWidthPlusGap = barGroupWidth / nOffsetGroups; } else { barWidthPlusGap = overlap ? barGroupWidth / nTraces : barGroupWidth; } var barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0)); var offsetFromCenter; if (nOffsetGroups) { offsetFromCenter = ((2 * trace._offsetIndex + 1 - nOffsetGroups) * barWidthPlusGap - barWidth) / 2; } else { offsetFromCenter = overlap ? ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 : -barWidth / 2; } var t = calcTrace[0].t; t.barwidth = barWidth; t.poffset = offsetFromCenter; t.bargroupwidth = barGroupWidth; t.bardelta = minDiff; } sieve.binWidth = calcTraces[0][0].t.barwidth / 100; applyAttributes(sieve); setBarCenterAndWidth(pa2, sieve); updatePositionAxis(pa2, sieve, overlap); } function applyAttributes(sieve) { var calcTraces = sieve.traces; var i, j; for (i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var calcTrace0 = calcTrace[0]; var fullTrace = calcTrace0.trace; var t = calcTrace0.t; var offset = fullTrace._offset || fullTrace.offset; var initialPoffset = t.poffset; var newPoffset; if (isArrayOrTypedArray(offset)) { newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length); for (j = 0; j < newPoffset.length; j++) { if (!isNumeric(newPoffset[j])) { newPoffset[j] = initialPoffset; } } for (j = newPoffset.length; j < calcTrace.length; j++) { newPoffset.push(initialPoffset); } t.poffset = newPoffset; } else if (offset !== void 0) { t.poffset = offset; } var width = fullTrace._width || fullTrace.width; var initialBarwidth = t.barwidth; if (isArrayOrTypedArray(width)) { var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length); for (j = 0; j < newBarwidth.length; j++) { if (!isNumeric(newBarwidth[j])) newBarwidth[j] = initialBarwidth; } for (j = newBarwidth.length; j < calcTrace.length; j++) { newBarwidth.push(initialBarwidth); } t.barwidth = newBarwidth; if (offset === void 0) { newPoffset = []; for (j = 0; j < calcTrace.length; j++) { newPoffset.push( initialPoffset + (initialBarwidth - newBarwidth[j]) / 2 ); } t.poffset = newPoffset; } } else if (width !== void 0) { t.barwidth = width; if (offset === void 0) { t.poffset = initialPoffset + (initialBarwidth - width) / 2; } } } } function setBarCenterAndWidth(pa2, sieve) { var calcTraces = sieve.traces; var pLetter = getAxisLetter(pa2); for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var t = calcTrace[0].t; var poffset = t.poffset; var poffsetIsArray = isArrayOrTypedArray(poffset); var barwidth = t.barwidth; var barwidthIsArray = isArrayOrTypedArray(barwidth); for (var j = 0; j < calcTrace.length; j++) { var calcBar = calcTrace[j]; var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth; if (calcBar.p === void 0) { calcBar.p = calcBar[pLetter]; calcBar["orig_" + pLetter] = calcBar[pLetter]; } var delta = (poffsetIsArray ? poffset[j] : poffset) + width / 2; calcBar[pLetter] = calcBar.p + delta; } } } function updatePositionAxis(pa2, sieve, allowMinDtick) { var calcTraces = sieve.traces; var minDiff = sieve.minDiff; var vpad = minDiff / 2; Axes.minDtick(pa2, sieve.minDiff, sieve.distinctPositions[0], allowMinDtick); for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var calcTrace0 = calcTrace[0]; var fullTrace = calcTrace0.trace; var pts = []; var bar, l, r, j; for (j = 0; j < calcTrace.length; j++) { bar = calcTrace[j]; l = bar.p - vpad; r = bar.p + vpad; pts.push(l, r); } if (fullTrace.width || fullTrace.offset) { var t = calcTrace0.t; var poffset = t.poffset; var barwidth = t.barwidth; var poffsetIsArray = isArrayOrTypedArray(poffset); var barwidthIsArray = isArrayOrTypedArray(barwidth); for (j = 0; j < calcTrace.length; j++) { bar = calcTrace[j]; var calcBarOffset = poffsetIsArray ? poffset[j] : poffset; var calcBarWidth = barwidthIsArray ? barwidth[j] : barwidth; l = bar.p + calcBarOffset; r = l + calcBarWidth; pts.push(l, r); } } fullTrace._extremes[pa2._id] = Axes.findExtremes(pa2, pts, { padded: false }); } } function setBaseAndTop(sa2, sieve) { var calcTraces = sieve.traces; var sLetter = getAxisLetter(sa2); for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var fullTrace = calcTrace[0].trace; var isScatter = fullTrace.type === "scatter"; var isVertical = fullTrace.orientation === "v"; var pts = []; var tozero = false; for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; var base = isScatter ? 0 : bar.b; var top = isScatter ? isVertical ? bar.y : bar.x : base + bar.s; bar[sLetter] = top; pts.push(top); if (bar.hasB) pts.push(base); if (!bar.hasB || !bar.b) { tozero = true; } } fullTrace._extremes[sa2._id] = Axes.findExtremes(sa2, pts, { tozero, padded: true }); } } function stackBars(sa2, sieve, opts) { var sLetter = getAxisLetter(sa2); var calcTraces = sieve.traces; var calcTrace; var fullTrace; var isFunnel; var i, j; var bar; for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; if (fullTrace.type === "funnel") { for (j = 0; j < calcTrace.length; j++) { bar = calcTrace[j]; if (bar.s !== BADNUM) { sieve.put(bar.p, -0.5 * bar.s); } } } } for (i = 0; i < calcTraces.length; i++) { calcTrace = calcTraces[i]; fullTrace = calcTrace[0].trace; isFunnel = fullTrace.type === "funnel"; var pts = []; for (j = 0; j < calcTrace.length; j++) { bar = calcTrace[j]; if (bar.s !== BADNUM) { var value; if (isFunnel) { value = bar.s; } else { value = bar.s + bar.b; } var base = sieve.put(bar.p, value); var top = base + value; bar.b = base; bar[sLetter] = top; if (!opts.norm) { pts.push(top); if (bar.hasB) { pts.push(base); } } } } if (!opts.norm) { fullTrace._extremes[sa2._id] = Axes.findExtremes(sa2, pts, { // N.B. we don't stack base with 'base', // so set tozero:true always! tozero: true, padded: true }); } } } function sieveBars(sieve) { var calcTraces = sieve.traces; for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; if (bar.s !== BADNUM) { sieve.put(bar.p, bar.b + bar.s); } } } } function unhideBarsWithinTrace(sieve, pa2) { var calcTraces = sieve.traces; for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var fullTrace = calcTrace[0].trace; if (fullTrace.base === void 0) { var inTraceSieve = new Sieve([calcTrace], { posAxis: pa2, sepNegVal: true, overlapNoMerge: true }); for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; if (bar.p !== BADNUM) { var base = inTraceSieve.put(bar.p, bar.b + bar.s); if (base) bar.b = base; } } } } } function normalizeBars(sa2, sieve, opts) { var calcTraces = sieve.traces; var sLetter = getAxisLetter(sa2); var sTop = opts.norm === "fraction" ? 1 : 100; var sTiny = sTop / 1e9; var sMin = sa2.l2c(sa2.c2l(0)); var sMax = opts.mode === "stack" ? sTop : sMin; function needsPadding(v) { return isNumeric(sa2.c2l(v)) && (v < sMin - sTiny || v > sMax + sTiny || !isNumeric(sMin)); } for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; var fullTrace = calcTrace[0].trace; var pts = []; var tozero = false; var padded = false; for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; if (bar.s !== BADNUM) { var scale = Math.abs(sTop / sieve.get(bar.p, bar.s)); bar.b *= scale; bar.s *= scale; var base = bar.b; var top = base + bar.s; bar[sLetter] = top; pts.push(top); padded = padded || needsPadding(top); if (bar.hasB) { pts.push(base); padded = padded || needsPadding(base); } if (!bar.hasB || !bar.b) { tozero = true; } } } fullTrace._extremes[sa2._id] = Axes.findExtremes(sa2, pts, { tozero, padded }); } } function setHelperValuesForRoundedCorners(calcTraces, sMinByPos, sMaxByPos, pa2) { var pLetter = getAxisLetter(pa2); for (var i = 0; i < calcTraces.length; i++) { var calcTrace = calcTraces[i]; for (var j = 0; j < calcTrace.length; j++) { var bar = calcTrace[j]; var pos = bar[pLetter]; bar._sMin = sMinByPos[pos]; bar._sMax = sMaxByPos[pos]; } } } function collectExtents(calcTraces, pa2) { var pLetter = getAxisLetter(pa2); var extents = {}; var i, j, cd2; var pMin = Infinity; var pMax = -Infinity; for (i = 0; i < calcTraces.length; i++) { cd2 = calcTraces[i]; for (j = 0; j < cd2.length; j++) { var p = cd2[j].p; if (isNumeric(p)) { pMin = Math.min(pMin, p); pMax = Math.max(pMax, p); } } } var roundFactor = 1e4 / (pMax - pMin); var round = extents.round = function(p2) { return String(Math.round(roundFactor * (p2 - pMin))); }; var sMinByPos = {}; var sMaxByPos = {}; var anyTraceHasCornerradius = calcTraces.some(function(x) { var trace = x[0].trace; return "marker" in trace && trace.marker.cornerradius; }); for (i = 0; i < calcTraces.length; i++) { cd2 = calcTraces[i]; cd2[0].t.extents = extents; var poffset = cd2[0].t.poffset; var poffsetIsArray = isArrayOrTypedArray(poffset); for (j = 0; j < cd2.length; j++) { var di2 = cd2[j]; var p02 = di2[pLetter] - di2.w / 2; if (isNumeric(p02)) { var p12 = di2[pLetter] + di2.w / 2; var pVal = round(di2.p); if (extents[pVal]) { extents[pVal] = [Math.min(p02, extents[pVal][0]), Math.max(p12, extents[pVal][1])]; } else { extents[pVal] = [p02, p12]; } } di2.p0 = di2.p + (poffsetIsArray ? poffset[j] : poffset); di2.p1 = di2.p0 + di2.w; di2.s0 = di2.b; di2.s1 = di2.s0 + di2.s; if (anyTraceHasCornerradius) { var sMin = Math.min(di2.s0, di2.s1) || 0; var sMax = Math.max(di2.s0, di2.s1) || 0; var pos = di2[pLetter]; sMinByPos[pos] = pos in sMinByPos ? Math.min(sMinByPos[pos], sMin) : sMin; sMaxByPos[pos] = pos in sMaxByPos ? Math.max(sMaxByPos[pos], sMax) : sMax; } } } if (anyTraceHasCornerradius) { setHelperValuesForRoundedCorners(calcTraces, sMinByPos, sMaxByPos, pa2); } } function getAxisLetter(ax) { return ax._id.charAt(0); } module2.exports = { crossTraceCalc, setGroupPositions }; } }); // node_modules/plotly.js/src/traces/scatter/cross_trace_calc.js var require_cross_trace_calc2 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/cross_trace_calc.js"(exports2, module2) { "use strict"; var calc = require_calc3(); var setGroupPositions = require_cross_trace_calc().setGroupPositions; function groupCrossTraceCalc(gd2, plotinfo) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var fullLayout = gd2._fullLayout; var fullTraces = gd2._fullData; var calcTraces = gd2.calcdata; var calcTracesHorz = []; var calcTracesVert = []; for (var i = 0; i < fullTraces.length; i++) { var fullTrace = fullTraces[i]; if (fullTrace.visible === true && fullTrace.type === "scatter" && fullTrace.xaxis === xa2._id && fullTrace.yaxis === ya2._id) { if (fullTrace.orientation === "h") { calcTracesHorz.push(calcTraces[i]); } else if (fullTrace.orientation === "v") { calcTracesVert.push(calcTraces[i]); } } } var opts = { mode: fullLayout.scattermode, gap: fullLayout.scattergap }; setGroupPositions(gd2, xa2, ya2, calcTracesVert, opts); setGroupPositions(gd2, ya2, xa2, calcTracesHorz, opts); } module2.exports = function crossTraceCalc(gd2, plotinfo) { if (gd2._fullLayout.scattermode === "group") { groupCrossTraceCalc(gd2, plotinfo); } var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var subplot = xa2._id + ya2._id; var subplotStackOpts = gd2._fullLayout._scatterStackOpts[subplot]; if (!subplotStackOpts) return; var calcTraces = gd2.calcdata; var i, j, k, i2, cd2, cd0, posj, sumj, norm; var groupOpts, interpolate, groupnorm, posAttr, valAttr; var hasAnyBlanks; for (var stackGroup in subplotStackOpts) { groupOpts = subplotStackOpts[stackGroup]; var indices = groupOpts.traceIndices; if (!indices.length) continue; interpolate = groupOpts.stackgaps === "interpolate"; groupnorm = groupOpts.groupnorm; if (groupOpts.orientation === "v") { posAttr = "x"; valAttr = "y"; } else { posAttr = "y"; valAttr = "x"; } hasAnyBlanks = new Array(indices.length); for (i = 0; i < hasAnyBlanks.length; i++) { hasAnyBlanks[i] = false; } cd0 = calcTraces[indices[0]]; var allPositions = new Array(cd0.length); for (i = 0; i < cd0.length; i++) { allPositions[i] = cd0[i][posAttr]; } for (i = 1; i < indices.length; i++) { cd2 = calcTraces[indices[i]]; for (j = k = 0; j < cd2.length; j++) { posj = cd2[j][posAttr]; for (; posj > allPositions[k] && k < allPositions.length; k++) { insertBlank(cd2, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); j++; } if (posj !== allPositions[k]) { for (i2 = 0; i2 < i; i2++) { insertBlank(calcTraces[indices[i2]], k, posj, i2, hasAnyBlanks, interpolate, posAttr); } allPositions.splice(k, 0, posj); } k++; } for (; k < allPositions.length; k++) { insertBlank(cd2, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr); j++; } } var serieslen = allPositions.length; for (j = 0; j < cd0.length; j++) { sumj = cd0[j][valAttr] = cd0[j].s; for (i = 1; i < indices.length; i++) { cd2 = calcTraces[indices[i]]; cd2[0].trace._rawLength = cd2[0].trace._length; cd2[0].trace._length = serieslen; sumj += cd2[j].s; cd2[j][valAttr] = sumj; } if (groupnorm) { norm = (groupnorm === "fraction" ? sumj : sumj / 100) || 1; for (i = 0; i < indices.length; i++) { var cdj = calcTraces[indices[i]][j]; cdj[valAttr] /= norm; cdj.sNorm = cdj.s / norm; } } } for (i = 0; i < indices.length; i++) { cd2 = calcTraces[indices[i]]; var trace = cd2[0].trace; var ppad = calc.calcMarkerSize(trace, trace._rawLength); var arrayPad = Array.isArray(ppad); if (ppad && hasAnyBlanks[i] || arrayPad) { var ppadRaw = ppad; ppad = new Array(serieslen); for (j = 0; j < serieslen; j++) { ppad[j] = cd2[j].gap ? 0 : arrayPad ? ppadRaw[cd2[j].i] : ppadRaw; } } var x = new Array(serieslen); var y = new Array(serieslen); for (j = 0; j < serieslen; j++) { x[j] = cd2[j].x; y[j] = cd2[j].y; } calc.calcAxisExpansion(gd2, trace, xa2, ya2, x, y, ppad); cd2[0].t.orientation = groupOpts.orientation; } } }; function insertBlank(calcTrace, index, position, traceIndex, hasAnyBlanks, interpolate, posAttr) { hasAnyBlanks[traceIndex] = true; var newEntry = { i: null, gap: true, s: 0 }; newEntry[posAttr] = position; calcTrace.splice(index, 0, newEntry); if (index && position === calcTrace[index - 1][posAttr]) { var prevEntry = calcTrace[index - 1]; newEntry.s = prevEntry.s; newEntry.i = prevEntry.i; newEntry.gap = prevEntry.gap; } else if (interpolate) { newEntry.s = getInterp(calcTrace, index, position, posAttr); } if (!index) { calcTrace[0].t = calcTrace[1].t; calcTrace[0].trace = calcTrace[1].trace; delete calcTrace[1].t; delete calcTrace[1].trace; } } function getInterp(calcTrace, index, position, posAttr) { var pt0 = calcTrace[index - 1]; var pt1 = calcTrace[index + 1]; if (!pt1) return pt0.s; if (!pt0) return pt1.s; return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]); } } }); // node_modules/plotly.js/src/traces/scatter/line_points.js var require_line_points = __commonJS({ "node_modules/plotly.js/src/traces/scatter/line_points.js"(exports2, module2) { "use strict"; var Drawing = require_drawing(); var numConstants = require_numerical(); var BADNUM = numConstants.BADNUM; var LOG_CLIP = numConstants.LOG_CLIP; var LOG_CLIP_PLUS = LOG_CLIP + 0.5; var LOG_CLIP_MINUS = LOG_CLIP - 0.5; var Lib = require_lib(); var segmentsIntersect = Lib.segmentsIntersect; var constrain = Lib.constrain; var constants = require_constants8(); module2.exports = function linePoints(d, opts) { var trace = opts.trace || {}; var xa2 = opts.xaxis; var ya2 = opts.yaxis; var xLog = xa2.type === "log"; var yLog = ya2.type === "log"; var xLen = xa2._length; var yLen = ya2._length; var backoff = opts.backoff; var marker = trace.marker; var connectGaps = opts.connectGaps; var baseTolerance = opts.baseTolerance; var shape = opts.shape; var linear = shape === "linear"; var fill = trace.fill && trace.fill !== "none"; var segments = []; var minTolerance = constants.minTolerance; var len = d.length; var pts = new Array(len); var pti = 0; var i; var clusterStartPt, clusterEndPt, clusterHighPt, clusterLowPt; var thisPt; var clusterHighFirst; var clusterUnitVector; var thisVector; var clusterRefDist, clusterHighVal, clusterLowVal, thisVal; var clusterMinDeviation, clusterMaxDeviation, thisDeviation; function getPt(index) { var di2 = d[index]; if (!di2) return false; var x = opts.linearized ? xa2.l2p(di2.x) : xa2.c2p(di2.x); var y = opts.linearized ? ya2.l2p(di2.y) : ya2.c2p(di2.y); if (x === BADNUM) { if (xLog) x = xa2.c2p(di2.x, true); if (x === BADNUM) return false; if (yLog && y === BADNUM) { x *= Math.abs(xa2._m * yLen * (xa2._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) / (ya2._m * xLen * (ya2._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS))); } x *= 1e3; } if (y === BADNUM) { if (yLog) y = ya2.c2p(di2.y, true); if (y === BADNUM) return false; y *= 1e3; } return [x, y]; } function crossesViewport(xFrac0, yFrac0, xFrac1, yFrac1) { var dx = xFrac1 - xFrac0; var dy = yFrac1 - yFrac0; var dx0 = 0.5 - xFrac0; var dy0 = 0.5 - yFrac0; var norm2 = dx * dx + dy * dy; var dot = dx * dx0 + dy * dy0; if (dot > 0 && dot < norm2) { var cross = dx0 * dy - dy0 * dx; if (cross * cross < norm2) return true; } } var latestXFrac, latestYFrac; function getTolerance(pt2, nextPt2) { var xFrac = pt2[0] / xLen; var yFrac = pt2[1] / yLen; var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1); if (offScreenFraction && latestXFrac !== void 0 && crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac)) { offScreenFraction = 0; } if (offScreenFraction && nextPt2 && crossesViewport(xFrac, yFrac, nextPt2[0] / xLen, nextPt2[1] / yLen)) { offScreenFraction = 0; } return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance; } function ptDist(pt1, pt2) { var dx = pt1[0] - pt2[0]; var dy = pt1[1] - pt2[1]; return Math.sqrt(dx * dx + dy * dy); } var maxScreensAway = constants.maxScreensAway; var xEdge0 = -xLen * maxScreensAway; var xEdge1 = xLen * (1 + maxScreensAway); var yEdge0 = -yLen * maxScreensAway; var yEdge1 = yLen * (1 + maxScreensAway); var edges = [ [xEdge0, yEdge0, xEdge1, yEdge0], [xEdge1, yEdge0, xEdge1, yEdge1], [xEdge1, yEdge1, xEdge0, yEdge1], [xEdge0, yEdge1, xEdge0, yEdge0] ]; var xEdge, yEdge, lastXEdge, lastYEdge, lastFarPt, edgePt; function getLinearEdgeIntersections(pt1, pt2) { var out = []; var ptCount = 0; for (var i2 = 0; i2 < 4; i2++) { var edge = edges[i2]; var ptInt = segmentsIntersect( pt1[0], pt1[1], pt2[0], pt2[1], edge[0], edge[1], edge[2], edge[3] ); if (ptInt && (!ptCount || Math.abs(ptInt.x - out[0][0]) > 1 || Math.abs(ptInt.y - out[0][1]) > 1)) { ptInt = [ptInt.x, ptInt.y]; if (ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt); else out.push(ptInt); ptCount++; } } return out; } function onlyConstrainedPoint(pt2) { if (pt2[0] < xEdge0 || pt2[0] > xEdge1 || pt2[1] < yEdge0 || pt2[1] > yEdge1) { return [constrain(pt2[0], xEdge0, xEdge1), constrain(pt2[1], yEdge0, yEdge1)]; } } function sameEdge(pt1, pt2) { if (pt1[0] === pt2[0] && (pt1[0] === xEdge0 || pt1[0] === xEdge1)) return true; if (pt1[1] === pt2[1] && (pt1[1] === yEdge0 || pt1[1] === yEdge1)) return true; } function getHVEdgeIntersections(pt1, pt2) { var out = []; var ptInt1 = onlyConstrainedPoint(pt1); var ptInt2 = onlyConstrainedPoint(pt2); if (ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; if (ptInt1) out.push(ptInt1); if (ptInt2) out.push(ptInt2); return out; } function getABAEdgeIntersections(dim, limit0, limit1) { return function(pt1, pt2) { var ptInt1 = onlyConstrainedPoint(pt1); var ptInt2 = onlyConstrainedPoint(pt2); var out = []; if (ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out; if (ptInt1) out.push(ptInt1); if (ptInt2) out.push(ptInt2); var midShift = 2 * Lib.constrain((pt1[dim] + pt2[dim]) / 2, limit0, limit1) - ((ptInt1 || pt1)[dim] + (ptInt2 || pt2)[dim]); if (midShift) { var ptToAlter; if (ptInt1 && ptInt2) { ptToAlter = midShift > 0 === ptInt1[dim] > ptInt2[dim] ? ptInt1 : ptInt2; } else ptToAlter = ptInt1 || ptInt2; ptToAlter[dim] += midShift; } return out; }; } var getEdgeIntersections; if (shape === "linear" || shape === "spline") { getEdgeIntersections = getLinearEdgeIntersections; } else if (shape === "hv" || shape === "vh") { getEdgeIntersections = getHVEdgeIntersections; } else if (shape === "hvh") getEdgeIntersections = getABAEdgeIntersections(0, xEdge0, xEdge1); else if (shape === "vhv") getEdgeIntersections = getABAEdgeIntersections(1, yEdge0, yEdge1); function getClosestCorner(pt1, pt2) { var dx = pt2[0] - pt1[0]; var m = (pt2[1] - pt1[1]) / dx; var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx; if (b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1]; else return [m > 0 ? xEdge1 : xEdge0, yEdge0]; } function updateEdge(pt2) { var x = pt2[0]; var y = pt2[1]; var xSame = x === pts[pti - 1][0]; var ySame = y === pts[pti - 1][1]; if (xSame && ySame) return; if (pti > 1) { var xSame2 = x === pts[pti - 2][0]; var ySame2 = y === pts[pti - 2][1]; if (xSame && (x === xEdge0 || x === xEdge1) && xSame2) { if (ySame2) pti--; else pts[pti - 1] = pt2; } else if (ySame && (y === yEdge0 || y === yEdge1) && ySame2) { if (xSame2) pti--; else pts[pti - 1] = pt2; } else pts[pti++] = pt2; } else pts[pti++] = pt2; } function updateEdgesForReentry(pt2) { if (pts[pti - 1][0] !== pt2[0] && pts[pti - 1][1] !== pt2[1]) { updateEdge([lastXEdge, lastYEdge]); } updateEdge(pt2); lastFarPt = null; lastXEdge = lastYEdge = 0; } var arrayMarker = Lib.isArrayOrTypedArray(marker); function addPt(pt2) { if (pt2 && backoff) { pt2.i = i; pt2.d = d; pt2.trace = trace; pt2.marker = arrayMarker ? marker[pt2.i] : marker; pt2.backoff = backoff; } latestXFrac = pt2[0] / xLen; latestYFrac = pt2[1] / yLen; xEdge = pt2[0] < xEdge0 ? xEdge0 : pt2[0] > xEdge1 ? xEdge1 : 0; yEdge = pt2[1] < yEdge0 ? yEdge0 : pt2[1] > yEdge1 ? yEdge1 : 0; if (xEdge || yEdge) { if (!pti) { pts[pti++] = [xEdge || pt2[0], yEdge || pt2[1]]; } else if (lastFarPt) { var intersections = getEdgeIntersections(lastFarPt, pt2); if (intersections.length > 1) { updateEdgesForReentry(intersections[0]); pts[pti++] = intersections[1]; } } else { edgePt = getEdgeIntersections(pts[pti - 1], pt2)[0]; pts[pti++] = edgePt; } var lastPt = pts[pti - 1]; if (xEdge && yEdge && (lastPt[0] !== xEdge || lastPt[1] !== yEdge)) { if (lastFarPt) { if (lastXEdge !== xEdge && lastYEdge !== yEdge) { if (lastXEdge && lastYEdge) { updateEdge(getClosestCorner(lastFarPt, pt2)); } else { updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]); } } else if (lastXEdge && lastYEdge) { updateEdge([lastXEdge, lastYEdge]); } } updateEdge([xEdge, yEdge]); } else if (lastXEdge - xEdge && lastYEdge - yEdge) { updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]); } lastFarPt = pt2; lastXEdge = xEdge; lastYEdge = yEdge; } else { if (lastFarPt) { updateEdgesForReentry(getEdgeIntersections(lastFarPt, pt2)[0]); } pts[pti++] = pt2; } } for (i = 0; i < len; i++) { clusterStartPt = getPt(i); if (!clusterStartPt) continue; pti = 0; lastFarPt = null; addPt(clusterStartPt); for (i++; i < len; i++) { clusterHighPt = getPt(i); if (!clusterHighPt) { if (connectGaps) continue; else break; } if (!linear || !opts.simplify) { addPt(clusterHighPt); continue; } var nextPt = getPt(i + 1); clusterRefDist = ptDist(clusterHighPt, clusterStartPt); if (!(fill && (pti === 0 || pti === len - 1)) && clusterRefDist < getTolerance(clusterHighPt, nextPt) * minTolerance) continue; clusterUnitVector = [ (clusterHighPt[0] - clusterStartPt[0]) / clusterRefDist, (clusterHighPt[1] - clusterStartPt[1]) / clusterRefDist ]; clusterLowPt = clusterStartPt; clusterHighVal = clusterRefDist; clusterLowVal = clusterMinDeviation = clusterMaxDeviation = 0; clusterHighFirst = false; clusterEndPt = clusterHighPt; for (i++; i < d.length; i++) { thisPt = nextPt; nextPt = getPt(i + 1); if (!thisPt) { if (connectGaps) continue; else break; } thisVector = [ thisPt[0] - clusterStartPt[0], thisPt[1] - clusterStartPt[1] ]; thisDeviation = thisVector[0] * clusterUnitVector[1] - thisVector[1] * clusterUnitVector[0]; clusterMinDeviation = Math.min(clusterMinDeviation, thisDeviation); clusterMaxDeviation = Math.max(clusterMaxDeviation, thisDeviation); if (clusterMaxDeviation - clusterMinDeviation > getTolerance(thisPt, nextPt)) break; clusterEndPt = thisPt; thisVal = thisVector[0] * clusterUnitVector[0] + thisVector[1] * clusterUnitVector[1]; if (thisVal > clusterHighVal) { clusterHighVal = thisVal; clusterHighPt = thisPt; clusterHighFirst = false; } else if (thisVal < clusterLowVal) { clusterLowVal = thisVal; clusterLowPt = thisPt; clusterHighFirst = true; } } if (clusterHighFirst) { addPt(clusterHighPt); if (clusterEndPt !== clusterLowPt) addPt(clusterLowPt); } else { if (clusterLowPt !== clusterStartPt) addPt(clusterLowPt); if (clusterEndPt !== clusterHighPt) addPt(clusterHighPt); } addPt(clusterEndPt); if (i >= d.length || !thisPt) break; addPt(thisPt); clusterStartPt = thisPt; } if (lastFarPt) updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]); segments.push(pts.slice(0, pti)); } var lastShapeChar = shape.slice(shape.length - 1); if (backoff && lastShapeChar !== "h" && lastShapeChar !== "v") { var trimmed = false; var n = -1; var newSegments = []; for (var j = 0; j < segments.length; j++) { for (var k = 0; k < segments[j].length - 1; k++) { var start = segments[j][k]; var end = segments[j][k + 1]; var xy = Drawing.applyBackoff(end, start); if (xy[0] !== end[0] || xy[1] !== end[1]) { trimmed = true; } if (!newSegments[n + 1]) { n++; newSegments[n] = [ start, [xy[0], xy[1]] ]; } } } return trimmed ? newSegments : segments; } return segments; }; } }); // node_modules/plotly.js/src/traces/scatter/link_traces.js var require_link_traces = __commonJS({ "node_modules/plotly.js/src/traces/scatter/link_traces.js"(exports2, module2) { "use strict"; var LINKEDFILLS = { tonextx: 1, tonexty: 1, tonext: 1 }; module2.exports = function linkTraces(gd2, plotinfo, cdscatter) { var trace, i, group, prevtrace, groupIndex; var groupIndices = {}; var needsSort = false; var prevGroupIndex = -1; var nextGroupIndex = 0; var prevUnstackedGroupIndex = -1; for (i = 0; i < cdscatter.length; i++) { trace = cdscatter[i][0].trace; group = trace.stackgroup || ""; if (group) { if (group in groupIndices) { groupIndex = groupIndices[group]; } else { groupIndex = groupIndices[group] = nextGroupIndex; nextGroupIndex++; } } else if (trace.fill in LINKEDFILLS && prevUnstackedGroupIndex >= 0) { groupIndex = prevUnstackedGroupIndex; } else { groupIndex = prevUnstackedGroupIndex = nextGroupIndex; nextGroupIndex++; } if (groupIndex < prevGroupIndex) needsSort = true; trace._groupIndex = prevGroupIndex = groupIndex; } var cdscatterSorted = cdscatter.slice(); if (needsSort) { cdscatterSorted.sort(function(a, b) { var traceA = a[0].trace; var traceB = b[0].trace; return traceA._groupIndex - traceB._groupIndex || traceA.index - traceB.index; }); } var prevtraces = {}; for (i = 0; i < cdscatterSorted.length; i++) { trace = cdscatterSorted[i][0].trace; group = trace.stackgroup || ""; if (trace.visible === true) { trace._nexttrace = null; if (trace.fill in LINKEDFILLS) { prevtrace = prevtraces[group]; trace._prevtrace = prevtrace || null; if (prevtrace) { prevtrace._nexttrace = trace; } } trace._ownfill = trace.fill && (trace.fill.substr(0, 6) === "tozero" || trace.fill === "toself" || trace.fill.substr(0, 2) === "to" && !trace._prevtrace); prevtraces[group] = trace; } else { trace._prevtrace = trace._nexttrace = trace._ownfill = null; } } return cdscatterSorted; }; } }); // node_modules/plotly.js/src/traces/scatter/plot.js var require_plot = __commonJS({ "node_modules/plotly.js/src/traces/scatter/plot.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Lib = require_lib(); var ensureSingle = Lib.ensureSingle; var identity = Lib.identity; var Drawing = require_drawing(); var subTypes = require_subtypes(); var linePoints = require_line_points(); var linkTraces = require_link_traces(); var polygonTester = require_polygon().tester; module2.exports = function plot(gd2, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) { var join, onComplete; var isFullReplot = !transitionOpts; var hasTransition = !!transitionOpts && transitionOpts.duration > 0; var cdscatterSorted = linkTraces(gd2, plotinfo, cdscatter); join = scatterLayer.selectAll("g.trace").data(cdscatterSorted, function(d) { return d[0].trace.uid; }); join.enter().append("g").attr("class", function(d) { return "trace scatter trace" + d[0].trace.uid; }).style("stroke-miterlimit", 2); join.order(); createFills(gd2, join, plotinfo); if (hasTransition) { if (makeOnCompleteCallback) { onComplete = makeOnCompleteCallback(); } var transition = d3.transition().duration(transitionOpts.duration).ease(transitionOpts.easing).each("end", function() { onComplete && onComplete(); }).each("interrupt", function() { onComplete && onComplete(); }); transition.each(function() { scatterLayer.selectAll("g.trace").each(function(d, i) { plotOne(gd2, i, plotinfo, d, cdscatterSorted, this, transitionOpts); }); }); } else { join.each(function(d, i) { plotOne(gd2, i, plotinfo, d, cdscatterSorted, this, transitionOpts); }); } if (isFullReplot) { join.exit().remove(); } scatterLayer.selectAll("path:not([d])").remove(); }; function createFills(gd2, traceJoin, plotinfo) { traceJoin.each(function(d) { var fills = ensureSingle(d3.select(this), "g", "fills"); Drawing.setClipUrl(fills, plotinfo.layerClipId, gd2); var trace = d[0].trace; var fillData = []; if (trace._ownfill) fillData.push("_ownFill"); if (trace._nexttrace) fillData.push("_nextFill"); var fillJoin = fills.selectAll("g").data(fillData, identity); fillJoin.enter().append("g"); fillJoin.exit().each(function(d2) { trace[d2] = null; }).remove(); fillJoin.order().each(function(d2) { trace[d2] = ensureSingle(d3.select(this), "path", "js-fill"); }); }); } function plotOne(gd2, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) { var isStatic = gd2._context.staticPlot; var i; selectMarkers(gd2, idx, plotinfo, cdscatter, cdscatterAll); var hasTransition = !!transitionOpts && transitionOpts.duration > 0; function transition(selection) { return hasTransition ? selection.transition() : selection; } var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var trace = cdscatter[0].trace; var line = trace.line; var tr2 = d3.select(element); var errorBarGroup = ensureSingle(tr2, "g", "errorbars"); var lines = ensureSingle(tr2, "g", "lines"); var points = ensureSingle(tr2, "g", "points"); var text = ensureSingle(tr2, "g", "text"); Registry.getComponentMethod("errorbars", "plot")(gd2, errorBarGroup, plotinfo, transitionOpts); if (trace.visible !== true) return; transition(tr2).style("opacity", trace.opacity); var ownFillEl3, tonext; var ownFillDir = trace.fill.charAt(trace.fill.length - 1); if (ownFillDir !== "x" && ownFillDir !== "y") ownFillDir = ""; var fillAxisIndex, fillAxisZero; if (ownFillDir === "y") { fillAxisIndex = 1; fillAxisZero = ya2.c2p(0, true); } else if (ownFillDir === "x") { fillAxisIndex = 0; fillAxisZero = xa2.c2p(0, true); } cdscatter[0][plotinfo.isRangePlot ? "nodeRangePlot3" : "node3"] = tr2; var prevRevpath = ""; var prevPolygons = []; var prevtrace = trace._prevtrace; var prevFillsegments = null; var prevFillElement = null; if (prevtrace) { prevRevpath = prevtrace._prevRevpath || ""; tonext = prevtrace._nextFill; prevPolygons = prevtrace._ownPolygons; prevFillsegments = prevtrace._fillsegments; prevFillElement = prevtrace._fillElement; } var thispath; var thisrevpath; var fullpath = ""; var revpath = ""; var pathfn, revpathbase, revpathfn; var pt0, lastSegment, pt1; var thisPolygons = []; trace._polygons = []; var fillsegments = []; var segments = []; var makeUpdate = Lib.noop; ownFillEl3 = trace._ownFill; if (subTypes.hasLines(trace) || trace.fill !== "none") { if (tonext) { tonext.datum(cdscatter); } if (["hv", "vh", "hvh", "vhv"].indexOf(line.shape) !== -1) { pathfn = Drawing.steps(line.shape); revpathbase = Drawing.steps( line.shape.split("").reverse().join("") ); } else if (line.shape === "spline") { pathfn = revpathbase = function(pts2) { var pLast = pts2[pts2.length - 1]; if (pts2.length > 1 && pts2[0][0] === pLast[0] && pts2[0][1] === pLast[1]) { return Drawing.smoothclosed(pts2.slice(1), line.smoothing); } else { return Drawing.smoothopen(pts2, line.smoothing); } }; } else { pathfn = revpathbase = function(pts2) { return "M" + pts2.join("L"); }; } revpathfn = function(pts2) { return revpathbase(pts2.reverse()); }; segments = linePoints(cdscatter, { xaxis: xa2, yaxis: ya2, trace, connectGaps: trace.connectgaps, baseTolerance: Math.max(line.width || 1, 3) / 4, shape: line.shape, backoff: line.backoff, simplify: line.simplify, fill: trace.fill }); fillsegments = new Array(segments.length); var fillsegmentCount = 0; for (i = 0; i < segments.length; i++) { var curpoints; var pts = segments[i]; if (!curpoints || !ownFillDir) { curpoints = pts.slice(); fillsegments[fillsegmentCount] = curpoints; fillsegmentCount++; } else { curpoints.push.apply(curpoints, pts); } } trace._fillElement = null; trace._fillExclusionElement = prevFillElement; trace._fillsegments = fillsegments.slice(0, fillsegmentCount); fillsegments = trace._fillsegments; if (segments.length) { pt0 = segments[0][0].slice(); lastSegment = segments[segments.length - 1]; pt1 = lastSegment[lastSegment.length - 1].slice(); } makeUpdate = function(isEnter) { return function(pts2) { thispath = pathfn(pts2); thisrevpath = revpathfn(pts2); if (!fullpath) { fullpath = thispath; revpath = thisrevpath; } else if (ownFillDir) { fullpath += "L" + thispath.substr(1); revpath = thisrevpath + ("L" + revpath.substr(1)); } else { fullpath += "Z" + thispath; revpath = thisrevpath + "Z" + revpath; } if (subTypes.hasLines(trace)) { var el = d3.select(this); el.datum(cdscatter); if (isEnter) { transition(el.style("opacity", 0).attr("d", thispath).call(Drawing.lineGroupStyle)).style("opacity", 1); } else { var sel = transition(el); sel.attr("d", thispath); Drawing.singleLineStyle(cdscatter, sel); } } }; }; } var lineJoin = lines.selectAll(".js-line").data(segments); transition(lineJoin.exit()).style("opacity", 0).remove(); lineJoin.each(makeUpdate(false)); lineJoin.enter().append("path").classed("js-line", true).style("vector-effect", isStatic ? "none" : "non-scaling-stroke").call(Drawing.lineGroupStyle).each(makeUpdate(true)); Drawing.setClipUrl(lineJoin, plotinfo.layerClipId, gd2); function clearFill(selection) { transition(selection).attr("d", "M0,0Z"); } var makeSelfPolygons = function() { var polygons = new Array(fillsegments.length); for (i = 0; i < fillsegments.length; i++) { polygons[i] = polygonTester(fillsegments[i]); } return polygons; }; var makePolygonsToPrevious = function(prevFillsegments2) { var polygons, i2; if (!prevFillsegments2 || prevFillsegments2.length === 0) { polygons = new Array(fillsegments.length); for (i2 = 0; i2 < fillsegments.length; i2++) { var pt02 = fillsegments[i2][0].slice(); var pt12 = fillsegments[i2][fillsegments[i2].length - 1].slice(); pt02[fillAxisIndex] = pt12[fillAxisIndex] = fillAxisZero; var zeropoints = [pt12, pt02]; var polypoints = zeropoints.concat(fillsegments[i2]); polygons[i2] = polygonTester(polypoints); } } else { polygons = new Array(prevFillsegments2.length - 1 + fillsegments.length); for (i2 = 0; i2 < prevFillsegments2.length - 1; i2++) { polygons[i2] = polygonTester(prevFillsegments2[i2]); } var reversedPrevFillsegment = prevFillsegments2[prevFillsegments2.length - 1].slice(); reversedPrevFillsegment.reverse(); for (i2 = 0; i2 < fillsegments.length; i2++) { polygons[prevFillsegments2.length - 1 + i2] = polygonTester(fillsegments[i2].concat(reversedPrevFillsegment)); } } return polygons; }; if (segments.length) { if (ownFillEl3) { ownFillEl3.datum(cdscatter); if (pt0 && pt1) { if (ownFillDir) { pt0[fillAxisIndex] = pt1[fillAxisIndex] = fillAxisZero; transition(ownFillEl3).attr("d", "M" + pt1 + "L" + pt0 + "L" + fullpath.substr(1)).call(Drawing.singleFillStyle, gd2); thisPolygons = makePolygonsToPrevious(null); } else { transition(ownFillEl3).attr("d", fullpath + "Z").call(Drawing.singleFillStyle, gd2); thisPolygons = makeSelfPolygons(); } } trace._polygons = thisPolygons; trace._fillElement = ownFillEl3; } else if (tonext) { if (trace.fill.substr(0, 6) === "tonext" && fullpath && prevRevpath) { if (trace.fill === "tonext") { transition(tonext).attr("d", fullpath + "Z" + prevRevpath + "Z").call(Drawing.singleFillStyle, gd2); thisPolygons = makeSelfPolygons(); trace._polygons = thisPolygons.concat(prevPolygons); } else { transition(tonext).attr("d", fullpath + "L" + prevRevpath.substr(1) + "Z").call(Drawing.singleFillStyle, gd2); thisPolygons = makePolygonsToPrevious(prevFillsegments); trace._polygons = thisPolygons; } trace._fillElement = tonext; } else { clearFill(tonext); } } trace._prevRevpath = revpath; } else { if (ownFillEl3) clearFill(ownFillEl3); else if (tonext) clearFill(tonext); trace._prevRevpath = null; } trace._ownPolygons = thisPolygons; function visFilter(d) { return d.filter(function(v) { return !v.gap && v.vis; }); } function visFilterWithGaps(d) { return d.filter(function(v) { return v.vis; }); } function gapFilter(d) { return d.filter(function(v) { return !v.gap; }); } function keyFunc(d) { return d.id; } function getKeyFunc(trace2) { if (trace2.ids) { return keyFunc; } } function hideFilter() { return false; } function makePoints(points2, text2, cdscatter2) { var join, selection, hasNode; var trace2 = cdscatter2[0].trace; var showMarkers = subTypes.hasMarkers(trace2); var showText = subTypes.hasText(trace2); var keyFunc2 = getKeyFunc(trace2); var markerFilter = hideFilter; var textFilter = hideFilter; if (showMarkers || showText) { var showFilter = identity; var stackGroup = trace2.stackgroup; var isInferZero = stackGroup && gd2._fullLayout._scatterStackOpts[xa2._id + ya2._id][stackGroup].stackgaps === "infer zero"; if (trace2.marker.maxdisplayed || trace2._needsCull) { showFilter = isInferZero ? visFilterWithGaps : visFilter; } else if (stackGroup && !isInferZero) { showFilter = gapFilter; } if (showMarkers) markerFilter = showFilter; if (showText) textFilter = showFilter; } selection = points2.selectAll("path.point"); join = selection.data(markerFilter, keyFunc2); var enter = join.enter().append("path").classed("point", true); if (hasTransition) { enter.call(Drawing.pointStyle, trace2, gd2).call(Drawing.translatePoints, xa2, ya2).style("opacity", 0).transition().style("opacity", 1); } join.order(); var styleFns; if (showMarkers) { styleFns = Drawing.makePointStyleFns(trace2); } join.each(function(d) { var el = d3.select(this); var sel = transition(el); hasNode = Drawing.translatePoint(d, sel, xa2, ya2); if (hasNode) { Drawing.singlePointStyle(d, sel, trace2, styleFns, gd2); if (plotinfo.layerClipId) { Drawing.hideOutsideRangePoint(d, sel, xa2, ya2, trace2.xcalendar, trace2.ycalendar); } if (trace2.customdata) { el.classed("plotly-customdata", d.data !== null && d.data !== void 0); } } else { sel.remove(); } }); if (hasTransition) { join.exit().transition().style("opacity", 0).remove(); } else { join.exit().remove(); } selection = text2.selectAll("g"); join = selection.data(textFilter, keyFunc2); join.enter().append("g").classed("textpoint", true).append("text"); join.order(); join.each(function(d) { var g = d3.select(this); var sel = transition(g.select("text")); hasNode = Drawing.translatePoint(d, sel, xa2, ya2); if (hasNode) { if (plotinfo.layerClipId) { Drawing.hideOutsideRangePoint(d, g, xa2, ya2, trace2.xcalendar, trace2.ycalendar); } } else { g.remove(); } }); join.selectAll("text").call(Drawing.textPointStyle, trace2, gd2).each(function(d) { var x = xa2.c2p(d.x); var y = ya2.c2p(d.y); d3.select(this).selectAll("tspan.line").each(function() { transition(d3.select(this)).attr({ x, y }); }); }); join.exit().remove(); } points.datum(cdscatter); text.datum(cdscatter); makePoints(points, text, cdscatter); var hasClipOnAxisFalse = trace.cliponaxis === false; var clipUrl = hasClipOnAxisFalse ? null : plotinfo.layerClipId; Drawing.setClipUrl(points, clipUrl, gd2); Drawing.setClipUrl(text, clipUrl, gd2); } function selectMarkers(gd2, idx, plotinfo, cdscatter, cdscatterAll) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var xr2 = d3.extent(Lib.simpleMap(xa2.range, xa2.r2c)); var yr2 = d3.extent(Lib.simpleMap(ya2.range, ya2.r2c)); var trace = cdscatter[0].trace; if (!subTypes.hasMarkers(trace)) return; var mnum = trace.marker.maxdisplayed; if (mnum === 0) return; var cd2 = cdscatter.filter(function(v) { return v.x >= xr2[0] && v.x <= xr2[1] && v.y >= yr2[0] && v.y <= yr2[1]; }); var inc = Math.ceil(cd2.length / mnum); var tnum = 0; cdscatterAll.forEach(function(cdj, j) { var tracei = cdj[0].trace; if (subTypes.hasMarkers(tracei) && tracei.marker.maxdisplayed > 0 && j < idx) { tnum++; } }); var i02 = Math.round(tnum * inc / 3 + Math.floor(tnum / 3) * inc / 7.1); cdscatter.forEach(function(v) { delete v.vis; }); cd2.forEach(function(v, i) { if (Math.round((i + i02) % inc) === 0) v.vis = true; }); } } }); // node_modules/plotly.js/src/traces/scatter/marker_colorbar.js var require_marker_colorbar = __commonJS({ "node_modules/plotly.js/src/traces/scatter/marker_colorbar.js"(exports2, module2) { "use strict"; module2.exports = { container: "marker", min: "cmin", max: "cmax" }; } }); // node_modules/plotly.js/src/traces/scatter/format_labels.js var require_format_labels = __commonJS({ "node_modules/plotly.js/src/traces/scatter/format_labels.js"(exports2, module2) { "use strict"; var Axes = require_axes(); module2.exports = function formatLabels(cdi, trace, fullLayout) { var labels = {}; var mockGd = { _fullLayout: fullLayout }; var xa2 = Axes.getFromTrace(mockGd, trace, "x"); var ya2 = Axes.getFromTrace(mockGd, trace, "y"); var x = cdi.orig_x; if (x === void 0) x = cdi.x; var y = cdi.orig_y; if (y === void 0) y = cdi.y; labels.xLabel = Axes.tickText(xa2, xa2.c2l(x), true).text; labels.yLabel = Axes.tickText(ya2, ya2.c2l(y), true).text; return labels; }; } }); // node_modules/plotly.js/src/traces/scatter/style.js var require_style2 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/style.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Drawing = require_drawing(); var Registry = require_registry(); function style(gd2) { var s = d3.select(gd2).selectAll("g.trace.scatter"); s.style("opacity", function(d) { return d[0].trace.opacity; }); s.selectAll("g.points").each(function(d) { var sel = d3.select(this); var trace = d.trace || d[0].trace; stylePoints(sel, trace, gd2); }); s.selectAll("g.text").each(function(d) { var sel = d3.select(this); var trace = d.trace || d[0].trace; styleText(sel, trace, gd2); }); s.selectAll("g.trace path.js-line").call(Drawing.lineGroupStyle); s.selectAll("g.trace path.js-fill").call(Drawing.fillGroupStyle, gd2, false); Registry.getComponentMethod("errorbars", "style")(s); } function stylePoints(sel, trace, gd2) { Drawing.pointStyle(sel.selectAll("path.point"), trace, gd2); } function styleText(sel, trace, gd2) { Drawing.textPointStyle(sel.selectAll("text"), trace, gd2); } function styleOnSelect(gd2, cd2, sel) { var trace = cd2[0].trace; if (trace.selectedpoints) { Drawing.selectedPointStyle(sel.selectAll("path.point"), trace); Drawing.selectedTextStyle(sel.selectAll("text"), trace); } else { stylePoints(sel, trace, gd2); styleText(sel, trace, gd2); } } module2.exports = { style, stylePoints, styleText, styleOnSelect }; } }); // node_modules/plotly.js/src/traces/scatter/get_trace_color.js var require_get_trace_color = __commonJS({ "node_modules/plotly.js/src/traces/scatter/get_trace_color.js"(exports2, module2) { "use strict"; var Color = require_color(); var subtypes = require_subtypes(); module2.exports = function getTraceColor(trace, di2) { var lc2, tc2; if (trace.mode === "lines") { lc2 = trace.line.color; return lc2 && Color.opacity(lc2) ? lc2 : trace.fillcolor; } else if (trace.mode === "none") { return trace.fill ? trace.fillcolor : ""; } else { var mc2 = di2.mcc || (trace.marker || {}).color; var mlc = di2.mlcc || ((trace.marker || {}).line || {}).color; tc2 = mc2 && Color.opacity(mc2) ? mc2 : mlc && Color.opacity(mlc) && (di2.mlw || ((trace.marker || {}).line || {}).width) ? mlc : ""; if (tc2) { if (Color.opacity(tc2) < 0.3) { return Color.addOpacity(tc2, 0.3); } else return tc2; } else { lc2 = (trace.line || {}).color; return lc2 && Color.opacity(lc2) && subtypes.hasLines(trace) && trace.line.width ? lc2 : trace.fillcolor; } } }; } }); // node_modules/plotly.js/src/traces/scatter/hover.js var require_hover2 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/hover.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Fx = require_fx(); var Registry = require_registry(); var getTraceColor = require_get_trace_color(); var Color = require_color(); var fillText = Lib.fillText; module2.exports = function hoverPoints(pointData, xval, yval, hovermode) { var cd2 = pointData.cd; var trace = cd2[0].trace; var xa2 = pointData.xa; var ya2 = pointData.ya; var xpx = xa2.c2p(xval); var ypx = ya2.c2p(yval); var pt2 = [xpx, ypx]; var hoveron = trace.hoveron || ""; var minRad = trace.mode.indexOf("markers") !== -1 ? 3 : 0.5; var xPeriod = !!trace.xperiodalignment; var yPeriod = !!trace.yperiodalignment; if (hoveron.indexOf("points") !== -1) { var dx = function(di3) { if (xPeriod) { var x02 = xa2.c2p(di3.xStart); var x12 = xa2.c2p(di3.xEnd); return xpx >= Math.min(x02, x12) && xpx <= Math.max(x02, x12) ? 0 : Infinity; } var rad2 = Math.max(3, di3.mrc || 0); var kink = 1 - 1 / rad2; var dxRaw = Math.abs(xa2.c2p(di3.x) - xpx); return dxRaw < rad2 ? kink * dxRaw / rad2 : dxRaw - rad2 + kink; }; var dy = function(di3) { if (yPeriod) { var y02 = ya2.c2p(di3.yStart); var y12 = ya2.c2p(di3.yEnd); return ypx >= Math.min(y02, y12) && ypx <= Math.max(y02, y12) ? 0 : Infinity; } var rad2 = Math.max(3, di3.mrc || 0); var kink = 1 - 1 / rad2; var dyRaw = Math.abs(ya2.c2p(di3.y) - ypx); return dyRaw < rad2 ? kink * dyRaw / rad2 : dyRaw - rad2 + kink; }; var dxy = function(di3) { var rad2 = Math.max(minRad, di3.mrc || 0); var dx2 = xa2.c2p(di3.x) - xpx; var dy2 = ya2.c2p(di3.y) - ypx; return Math.max(Math.sqrt(dx2 * dx2 + dy2 * dy2) - rad2, 1 - minRad / rad2); }; var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); Fx.getClosest(cd2, distfn, pointData); if (pointData.index !== false) { var di2 = cd2[pointData.index]; var xc2 = xa2.c2p(di2.x, true); var yc2 = ya2.c2p(di2.y, true); var rad = di2.mrc || 1; pointData.index = di2.i; var orientation = cd2[0].t.orientation; var sizeVal = orientation && (di2.sNorm || di2.s); var xLabelVal = orientation === "h" ? sizeVal : di2.orig_x !== void 0 ? di2.orig_x : di2.x; var yLabelVal = orientation === "v" ? sizeVal : di2.orig_y !== void 0 ? di2.orig_y : di2.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di2), x0: xc2 - rad, x1: xc2 + rad, xLabelVal, y0: yc2 - rad, y1: yc2 + rad, yLabelVal, spikeDistance: dxy(di2), hovertemplate: trace.hovertemplate }); fillText(di2, trace, pointData); Registry.getComponentMethod("errorbars", "hoverInfo")(di2, trace, pointData); return [pointData]; } } function isHoverPointInFillElement(el) { if (!el) { return false; } var svgElement = el.node(); try { var domPoint = new DOMPoint(pt2[0], pt2[1]); return svgElement.isPointInFill(domPoint); } catch (TypeError2) { var svgPoint = svgElement.ownerSVGElement.createSVGPoint(); svgPoint.x = pt2[0]; svgPoint.y = pt2[1]; return svgElement.isPointInFill(svgPoint); } } function getHoverLabelPosition(polygons) { var i; var polygonsIn = []; var xmin = Infinity; var xmax = -Infinity; var ymin = Infinity; var ymax = -Infinity; var yPos; for (i = 0; i < polygons.length; i++) { var polygon = polygons[i]; if (polygon.contains(pt2)) { polygonsIn.push(polygon); ymin = Math.min(ymin, polygon.ymin); ymax = Math.max(ymax, polygon.ymax); } } if (polygonsIn.length === 0) { return null; } ymin = Math.max(ymin, 0); ymax = Math.min(ymax, ya2._length); yPos = (ymin + ymax) / 2; var j, pts, xAtYPos, x02, x12, y02, y12; for (i = 0; i < polygonsIn.length; i++) { pts = polygonsIn[i].pts; for (j = 1; j < pts.length; j++) { y02 = pts[j - 1][1]; y12 = pts[j][1]; if (y02 > yPos !== y12 >= yPos) { x02 = pts[j - 1][0]; x12 = pts[j][0]; if (y12 - y02) { xAtYPos = x02 + (x12 - x02) * (yPos - y02) / (y12 - y02); xmin = Math.min(xmin, xAtYPos); xmax = Math.max(xmax, xAtYPos); } } } } xmin = Math.max(xmin, 0); xmax = Math.min(xmax, xa2._length); return { x0: xmin, x1: xmax, y0: yPos, y1: yPos }; } if (hoveron.indexOf("fills") !== -1 && trace._fillElement) { var inside = isHoverPointInFillElement(trace._fillElement) && !isHoverPointInFillElement(trace._fillExclusionElement); if (inside) { var hoverLabelCoords = getHoverLabelPosition(trace._polygons); if (hoverLabelCoords === null) { hoverLabelCoords = { x0: pt2[0], x1: pt2[0], y0: pt2[1], y1: pt2[1] }; } var color = Color.defaultLine; if (Color.opacity(trace.fillcolor)) color = trace.fillcolor; else if (Color.opacity((trace.line || {}).color)) { color = trace.line.color; } Lib.extendFlat(pointData, { // never let a 2D override 1D type as closest point // also: no spikeDistance, it's not allowed for fills distance: pointData.maxHoverDistance, x0: hoverLabelCoords.x0, x1: hoverLabelCoords.x1, y0: hoverLabelCoords.y0, y1: hoverLabelCoords.y1, color, hovertemplate: false }); delete pointData.index; if (trace.text && !Lib.isArrayOrTypedArray(trace.text)) { pointData.text = String(trace.text); } else pointData.text = trace.name; return [pointData]; } } }; } }); // node_modules/plotly.js/src/traces/scatter/select.js var require_select2 = __commonJS({ "node_modules/plotly.js/src/traces/scatter/select.js"(exports2, module2) { "use strict"; var subtypes = require_subtypes(); module2.exports = function selectPoints(searchInfo, selectionTester) { var cd2 = searchInfo.cd; var xa2 = searchInfo.xaxis; var ya2 = searchInfo.yaxis; var selection = []; var trace = cd2[0].trace; var i; var di2; var x; var y; var hasOnlyLines = !subtypes.hasMarkers(trace) && !subtypes.hasText(trace); if (hasOnlyLines) return []; if (selectionTester === false) { for (i = 0; i < cd2.length; i++) { cd2[i].selected = 0; } } else { for (i = 0; i < cd2.length; i++) { di2 = cd2[i]; x = xa2.c2p(di2.x); y = ya2.c2p(di2.y); if (di2.i !== null && selectionTester.contains([x, y], false, i, searchInfo)) { selection.push({ pointNumber: di2.i, x: xa2.c2d(di2.x), y: ya2.c2d(di2.y) }); di2.selected = 1; } else { di2.selected = 0; } } } return selection; }; } }); // node_modules/plotly.js/src/plots/cartesian/attributes.js var require_attributes14 = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/attributes.js"(exports2, module2) { "use strict"; module2.exports = { xaxis: { valType: "subplotid", dflt: "x", editType: "calc+clearAxisTypes", description: [ "Sets a reference between this trace's x coordinates and", "a 2D cartesian x axis.", "If *x* (the default value), the x coordinates refer to", "`layout.xaxis`.", "If *x2*, the x coordinates refer to `layout.xaxis2`, and so on." ].join(" ") }, yaxis: { valType: "subplotid", dflt: "y", editType: "calc+clearAxisTypes", description: [ "Sets a reference between this trace's y coordinates and", "a 2D cartesian y axis.", "If *y* (the default value), the y coordinates refer to", "`layout.yaxis`.", "If *y2*, the y coordinates refer to `layout.yaxis2`, and so on." ].join(" ") } }; } }); // node_modules/plotly.js/src/plots/cartesian/type_defaults.js var require_type_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/type_defaults.js"(exports2, module2) { "use strict"; var traceIs = require_registry().traceIs; var autoType = require_axis_autotype(); module2.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) { coerce("autotypenumbers", options.autotypenumbersDflt); var axType = coerce("type", (options.splomStash || {}).type); if (axType === "-") { setAutoType(containerOut, options.data); if (containerOut.type === "-") { containerOut.type = "linear"; } else { containerIn.type = containerOut.type; } } }; function setAutoType(ax, data) { if (ax.type !== "-") return; var id2 = ax._id; var axLetter = id2.charAt(0); var i; if (id2.indexOf("scene") !== -1) id2 = axLetter; var d02 = getFirstNonEmptyTrace(data, id2, axLetter); if (!d02) return; if (d02.type === "histogram" && axLetter === { v: "y", h: "x" }[d02.orientation || "v"]) { ax.type = "linear"; return; } var calAttr = axLetter + "calendar"; var calendar = d02[calAttr]; var opts = { noMultiCategory: !traceIs(d02, "cartesian") || traceIs(d02, "noMultiCategory") }; if (d02.type === "box" && d02._hasPreCompStats && axLetter === { h: "x", v: "y" }[d02.orientation || "v"]) { opts.noMultiCategory = true; } opts.autotypenumbers = ax.autotypenumbers; if (isBoxWithoutPositionCoords(d02, axLetter)) { var posLetter = getBoxPosLetter(d02); var boxPositions = []; for (i = 0; i < data.length; i++) { var trace = data[i]; if (!traceIs(trace, "box-violin") || (trace[axLetter + "axis"] || axLetter) !== id2) continue; if (trace[posLetter] !== void 0) boxPositions.push(trace[posLetter][0]); else if (trace.name !== void 0) boxPositions.push(trace.name); else boxPositions.push("text"); if (trace[calAttr] !== calendar) calendar = void 0; } ax.type = autoType(boxPositions, calendar, opts); } else if (d02.type === "splom") { var dimensions = d02.dimensions; var dim = dimensions[d02._axesDim[id2]]; if (dim.visible) ax.type = autoType(dim.values, calendar, opts); } else { ax.type = autoType(d02[axLetter] || [d02[axLetter + "0"]], calendar, opts); } } function getFirstNonEmptyTrace(data, id2, axLetter) { for (var i = 0; i < data.length; i++) { var trace = data[i]; if (trace.type === "splom" && trace._length > 0 && (trace["_" + axLetter + "axes"] || {})[id2]) { return trace; } if ((trace[axLetter + "axis"] || axLetter) === id2) { if (isBoxWithoutPositionCoords(trace, axLetter)) { return trace; } else if ((trace[axLetter] || []).length || trace[axLetter + "0"]) { return trace; } } } } function getBoxPosLetter(trace) { return { v: "x", h: "y" }[trace.orientation || "v"]; } function isBoxWithoutPositionCoords(trace, axLetter) { var posLetter = getBoxPosLetter(trace); var isBox = traceIs(trace, "box-violin"); var isCandlestick = traceIs(trace._fullInput || {}, "candlestick"); return isBox && !isCandlestick && axLetter === posLetter && trace[posLetter] === void 0 && trace[posLetter + "0"] === void 0; } } }); // node_modules/plotly.js/src/plots/cartesian/category_order_defaults.js var require_category_order_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/category_order_defaults.js"(exports2, module2) { "use strict"; var isTypedArraySpec = require_array().isTypedArraySpec; function findCategories(ax, opts) { var dataAttr = opts.dataAttr || ax._id.charAt(0); var lookup2 = {}; var axData; var i, j; if (opts.axData) { axData = opts.axData; } else { axData = []; for (i = 0; i < opts.data.length; i++) { var trace = opts.data[i]; if (trace[dataAttr + "axis"] === ax._id) { axData.push(trace); } } } for (i = 0; i < axData.length; i++) { var vals = axData[i][dataAttr]; for (j = 0; j < vals.length; j++) { var v = vals[j]; if (v !== null && v !== void 0) { lookup2[v] = 1; } } } return Object.keys(lookup2); } module2.exports = function handleCategoryOrderDefaults(containerIn, containerOut, coerce, opts) { if (containerOut.type !== "category") return; var arrayIn = containerIn.categoryarray; var isValidArray = Array.isArray(arrayIn) && arrayIn.length > 0 || isTypedArraySpec(arrayIn); var orderDefault; if (isValidArray) orderDefault = "array"; var order = coerce("categoryorder", orderDefault); var array; if (order === "array") { array = coerce("categoryarray"); } if (!isValidArray && order === "array") { order = containerOut.categoryorder = "trace"; } if (order === "trace") { containerOut._initialCategories = []; } else if (order === "array") { containerOut._initialCategories = array.slice(); } else { array = findCategories(containerOut, opts).sort(); if (order === "category ascending") { containerOut._initialCategories = array; } else if (order === "category descending") { containerOut._initialCategories = array.reverse(); } } }; } }); // node_modules/plotly.js/src/plots/cartesian/line_grid_defaults.js var require_line_grid_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/line_grid_defaults.js"(exports2, module2) { "use strict"; var colorMix = require_tinycolor().mix; var colorAttrs = require_attributes3(); var Lib = require_lib(); module2.exports = function handleLineGridDefaults(containerIn, containerOut, coerce, opts) { opts = opts || {}; var dfltColor = opts.dfltColor; function coerce2(attr, dflt) { return Lib.coerce2(containerIn, containerOut, opts.attributes, attr, dflt); } var lineColor = coerce2("linecolor", dfltColor); var lineWidth = coerce2("linewidth"); var showLine = coerce("showline", opts.showLine || !!lineColor || !!lineWidth); if (!showLine) { delete containerOut.linecolor; delete containerOut.linewidth; } var gridColorDflt = colorMix(dfltColor, opts.bgColor, opts.blend || colorAttrs.lightFraction).toRgbString(); var gridColor = coerce2("gridcolor", gridColorDflt); var gridWidth = coerce2("gridwidth"); var gridDash = coerce2("griddash"); var showGridLines = coerce( "showgrid", opts.showGrid || !!gridColor || !!gridWidth || !!gridDash ); if (!showGridLines) { delete containerOut.gridcolor; delete containerOut.gridwidth; delete containerOut.griddash; } if (opts.hasMinor) { var minorGridColorDflt = colorMix(containerOut.gridcolor, opts.bgColor, 67).toRgbString(); var minorGridColor = coerce2("minor.gridcolor", minorGridColorDflt); var minorGridWidth = coerce2("minor.gridwidth", containerOut.gridwidth || 1); var minorGridDash = coerce2("minor.griddash", containerOut.griddash || "solid"); var minorShowGridLines = coerce( "minor.showgrid", !!minorGridColor || !!minorGridWidth || !!minorGridDash ); if (!minorShowGridLines) { delete containerOut.minor.gridcolor; delete containerOut.minor.gridwidth; delete containerOut.minor.griddash; } } if (!opts.noZeroLine) { var zeroLineColor = coerce2("zerolinecolor", dfltColor); var zeroLineWidth = coerce2("zerolinewidth"); var showZeroLine = coerce("zeroline", opts.showGrid || !!zeroLineColor || !!zeroLineWidth); if (!showZeroLine) { delete containerOut.zerolinecolor; delete containerOut.zerolinewidth; } } }; } }); // node_modules/plotly.js/src/plots/cartesian/axis_defaults.js var require_axis_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/axis_defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Registry = require_registry(); var Lib = require_lib(); var Template = require_plot_template(); var handleArrayContainerDefaults = require_array_container_defaults(); var layoutAttributes = require_layout_attributes4(); var handleTickValueDefaults = require_tick_value_defaults(); var handleTickMarkDefaults = require_tick_mark_defaults(); var handleTickLabelDefaults = require_tick_label_defaults(); var handlePrefixSuffixDefaults = require_prefix_suffix_defaults(); var handleCategoryOrderDefaults = require_category_order_defaults(); var handleLineGridDefaults = require_line_grid_defaults(); var handleRangeDefaults = require_range_defaults(); var setConvert = require_set_convert(); var DAY_OF_WEEK = require_constants2().WEEKDAY_PATTERN; var HOUR = require_constants2().HOUR_PATTERN; module2.exports = function handleAxisDefaults(containerIn, containerOut, coerce, options, layoutOut) { var letter = options.letter; var font = options.font || {}; var splomStash = options.splomStash || {}; var visible = coerce("visible", !options.visibleDflt); var axTemplate = containerOut._template || {}; var axType = containerOut.type || axTemplate.type || "-"; var ticklabelmode; if (axType === "date") { var handleCalendarDefaults = Registry.getComponentMethod("calendars", "handleDefaults"); handleCalendarDefaults(containerIn, containerOut, "calendar", options.calendar); if (!options.noTicklabelmode) { ticklabelmode = coerce("ticklabelmode"); } } if (!options.noTicklabelindex && (axType === "date" || axType === "linear")) { coerce("ticklabelindex"); } var ticklabelposition = ""; if (!options.noTicklabelposition || axType === "multicategory") { ticklabelposition = Lib.coerce(containerIn, containerOut, { ticklabelposition: { valType: "enumerated", dflt: "outside", values: ticklabelmode === "period" ? ["outside", "inside"] : letter === "x" ? [ "outside", "inside", "outside left", "inside left", "outside right", "inside right" ] : [ "outside", "inside", "outside top", "inside top", "outside bottom", "inside bottom" ] } }, "ticklabelposition"); } if (!options.noTicklabeloverflow) { coerce( "ticklabeloverflow", ticklabelposition.indexOf("inside") !== -1 ? "hide past domain" : axType === "category" || axType === "multicategory" ? "allow" : "hide past div" ); } setConvert(containerOut, layoutOut); handleRangeDefaults(containerIn, containerOut, coerce, options); handleCategoryOrderDefaults(containerIn, containerOut, coerce, options); if (axType !== "category" && !options.noHover) coerce("hoverformat"); var dfltColor = coerce("color"); var dfltFontColor = dfltColor !== layoutAttributes.color.dflt ? dfltColor : font.color; var dfltTitle = splomStash.label || layoutOut._dfltTitle[letter]; handlePrefixSuffixDefaults(containerIn, containerOut, coerce, axType, options); if (!visible) return containerOut; coerce("title.text", dfltTitle); Lib.coerceFont(coerce, "title.font", font, { overrideDflt: { size: Lib.bigFont(font.size), color: dfltFontColor } }); handleTickValueDefaults(containerIn, containerOut, coerce, axType); var hasMinor = options.hasMinor; if (hasMinor) { Template.newContainer(containerOut, "minor"); handleTickValueDefaults(containerIn, containerOut, coerce, axType, { isMinor: true }); } handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options); handleTickMarkDefaults(containerIn, containerOut, coerce, options); if (hasMinor) { var keepIsMinor = options.isMinor; options.isMinor = true; handleTickMarkDefaults(containerIn, containerOut, coerce, options); options.isMinor = keepIsMinor; } handleLineGridDefaults(containerIn, containerOut, coerce, { dfltColor, bgColor: options.bgColor, showGrid: options.showGrid, hasMinor, attributes: layoutAttributes }); if (hasMinor && !containerOut.minor.ticks && !containerOut.minor.showgrid) { delete containerOut.minor; } if (containerOut.showline || containerOut.ticks) coerce("mirror"); var isMultiCategory = axType === "multicategory"; if (!options.noTickson && (axType === "category" || isMultiCategory) && (containerOut.ticks || containerOut.showgrid)) { var ticksonDflt; if (isMultiCategory) ticksonDflt = "boundaries"; var tickson = coerce("tickson", ticksonDflt); if (tickson === "boundaries") { delete containerOut.ticklabelposition; } } if (isMultiCategory) { var showDividers = coerce("showdividers"); if (showDividers) { coerce("dividercolor"); coerce("dividerwidth"); } } if (axType === "date") { handleArrayContainerDefaults(containerIn, containerOut, { name: "rangebreaks", inclusionAttr: "enabled", handleItemDefaults: rangebreaksDefaults }); if (!containerOut.rangebreaks.length) { delete containerOut.rangebreaks; } else { for (var k = 0; k < containerOut.rangebreaks.length; k++) { if (containerOut.rangebreaks[k].pattern === DAY_OF_WEEK) { containerOut._hasDayOfWeekBreaks = true; break; } } setConvert(containerOut, layoutOut); if (layoutOut._has("scattergl") || layoutOut._has("splom")) { for (var i = 0; i < options.data.length; i++) { var trace = options.data[i]; if (trace.type === "scattergl" || trace.type === "splom") { trace.visible = false; Lib.warn(trace.type + " traces do not work on axes with rangebreaks. Setting trace " + trace.index + " to `visible: false`."); } } } } } return containerOut; }; function rangebreaksDefaults(itemIn, itemOut, containerOut) { function coerce(attr, dflt) { return Lib.coerce(itemIn, itemOut, layoutAttributes.rangebreaks, attr, dflt); } var enabled = coerce("enabled"); if (enabled) { var bnds = coerce("bounds"); if (bnds && bnds.length >= 2) { var dfltPattern = ""; var i, q; if (bnds.length === 2) { for (i = 0; i < 2; i++) { q = indexOfDay(bnds[i]); if (q) { dfltPattern = DAY_OF_WEEK; break; } } } var pattern = coerce("pattern", dfltPattern); if (pattern === DAY_OF_WEEK) { for (i = 0; i < 2; i++) { q = indexOfDay(bnds[i]); if (q) { itemOut.bounds[i] = bnds[i] = q - 1; } } } if (pattern) { for (i = 0; i < 2; i++) { q = bnds[i]; switch (pattern) { case DAY_OF_WEEK: if (!isNumeric(q)) { itemOut.enabled = false; return; } q = +q; if (q !== Math.floor(q) || // don't accept fractional days for mow q < 0 || q >= 7) { itemOut.enabled = false; return; } itemOut.bounds[i] = bnds[i] = q; break; case HOUR: if (!isNumeric(q)) { itemOut.enabled = false; return; } q = +q; if (q < 0 || q > 24) { itemOut.enabled = false; return; } itemOut.bounds[i] = bnds[i] = q; break; } } } if (containerOut.autorange === false) { var rng = containerOut.range; if (rng[0] < rng[1]) { if (bnds[0] < rng[0] && bnds[1] > rng[1]) { itemOut.enabled = false; return; } } else if (bnds[0] > rng[0] && bnds[1] < rng[1]) { itemOut.enabled = false; return; } } } else { var values = coerce("values"); if (values && values.length) { coerce("dvalue"); } else { itemOut.enabled = false; return; } } } } var dayStrToNum = { sun: 1, mon: 2, tue: 3, wed: 4, thu: 5, fri: 6, sat: 7 }; function indexOfDay(v) { if (typeof v !== "string") return; return dayStrToNum[v.substr(0, 3).toLowerCase()]; } } }); // node_modules/plotly.js/src/plots/cartesian/position_defaults.js var require_position_defaults = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/position_defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); module2.exports = function handlePositionDefaults(containerIn, containerOut, coerce, options) { var counterAxes = options.counterAxes || []; var overlayableAxes = options.overlayableAxes || []; var letter = options.letter; var grid = options.grid; var overlayingDomain = options.overlayingDomain; var dfltAnchor, dfltDomain, dfltSide, dfltPosition, dfltShift, dfltAutomargin; if (grid) { dfltDomain = grid._domains[letter][grid._axisMap[containerOut._id]]; dfltAnchor = grid._anchors[containerOut._id]; if (dfltDomain) { dfltSide = grid[letter + "side"].split(" ")[0]; dfltPosition = grid.domain[letter][dfltSide === "right" || dfltSide === "top" ? 1 : 0]; } } dfltDomain = dfltDomain || [0, 1]; dfltAnchor = dfltAnchor || (isNumeric(containerIn.position) ? "free" : counterAxes[0] || "free"); dfltSide = dfltSide || (letter === "x" ? "bottom" : "left"); dfltPosition = dfltPosition || 0; dfltShift = 0; dfltAutomargin = false; var anchor = Lib.coerce(containerIn, containerOut, { anchor: { valType: "enumerated", values: ["free"].concat(counterAxes), dflt: dfltAnchor } }, "anchor"); var side = Lib.coerce(containerIn, containerOut, { side: { valType: "enumerated", values: letter === "x" ? ["bottom", "top"] : ["left", "right"], dflt: dfltSide } }, "side"); if (anchor === "free") { if (letter === "y") { var autoshift = coerce("autoshift"); if (autoshift) { dfltPosition = side === "left" ? overlayingDomain[0] : overlayingDomain[1]; dfltAutomargin = containerOut.automargin ? containerOut.automargin : true; dfltShift = side === "left" ? -3 : 3; } coerce("shift", dfltShift); } coerce("position", dfltPosition); } coerce("automargin", dfltAutomargin); var overlaying = false; if (overlayableAxes.length) { overlaying = Lib.coerce(containerIn, containerOut, { overlaying: { valType: "enumerated", values: [false].concat(overlayableAxes), dflt: false } }, "overlaying"); } if (!overlaying) { var domain = coerce("domain", dfltDomain); if (domain[0] > domain[1] - 1 / 4096) containerOut.domain = dfltDomain; Lib.noneOrAll(containerIn.domain, containerOut.domain, dfltDomain); if (containerOut.tickmode === "sync") { containerOut.tickmode = "auto"; } } coerce("layer"); return containerOut; }; } }); // node_modules/plotly.js/src/plots/cartesian/layout_defaults.js var require_layout_defaults4 = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/layout_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Color = require_color(); var isUnifiedHover = require_helpers2().isUnifiedHover; var handleHoverModeDefaults = require_hovermode_defaults(); var Template = require_plot_template(); var basePlotLayoutAttributes = require_layout_attributes2(); var layoutAttributes = require_layout_attributes4(); var handleTypeDefaults = require_type_defaults(); var handleAxisDefaults = require_axis_defaults(); var constraints = require_constraints(); var handlePositionDefaults = require_position_defaults(); var axisIds = require_axis_ids(); var id2name = axisIds.id2name; var name2id = axisIds.name2id; var AX_ID_PATTERN = require_constants2().AX_ID_PATTERN; var Registry = require_registry(); var traceIs = Registry.traceIs; var getComponentMethod = Registry.getComponentMethod; function appendList(cont, k, item) { if (Array.isArray(cont[k])) cont[k].push(item); else cont[k] = [item]; } module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { var autotypenumbersDflt = layoutOut.autotypenumbers; var ax2traces = {}; var xaMayHide = {}; var yaMayHide = {}; var xaMustDisplay = {}; var yaMustDisplay = {}; var yaMustNotReverse = {}; var yaMayReverse = {}; var axHasImage = {}; var outerTicks = {}; var noGrids = {}; var i, j; for (i = 0; i < fullData.length; i++) { var trace = fullData[i]; if (!traceIs(trace, "cartesian") && !traceIs(trace, "gl2d")) continue; var xaName; if (trace.xaxis) { xaName = id2name(trace.xaxis); appendList(ax2traces, xaName, trace); } else if (trace.xaxes) { for (j = 0; j < trace.xaxes.length; j++) { appendList(ax2traces, id2name(trace.xaxes[j]), trace); } } var yaName; if (trace.yaxis) { yaName = id2name(trace.yaxis); appendList(ax2traces, yaName, trace); } else if (trace.yaxes) { for (j = 0; j < trace.yaxes.length; j++) { appendList(ax2traces, id2name(trace.yaxes[j]), trace); } } if (trace.type === "funnel") { if (trace.orientation === "h") { if (xaName) xaMayHide[xaName] = true; if (yaName) yaMayReverse[yaName] = true; } else { if (yaName) yaMayHide[yaName] = true; } } else if (trace.type === "image") { if (yaName) axHasImage[yaName] = true; if (xaName) axHasImage[xaName] = true; } else { if (yaName) { yaMustDisplay[yaName] = true; yaMustNotReverse[yaName] = true; } if (!traceIs(trace, "carpet") || trace.type === "carpet" && !trace._cheater) { if (xaName) xaMustDisplay[xaName] = true; } } if (trace.type === "carpet" && trace._cheater) { if (xaName) xaMayHide[xaName] = true; } if (traceIs(trace, "2dMap")) { outerTicks[xaName] = true; outerTicks[yaName] = true; } if (traceIs(trace, "oriented")) { var positionAxis = trace.orientation === "h" ? yaName : xaName; noGrids[positionAxis] = true; } } var subplots = layoutOut._subplots; var xIds = subplots.xaxis; var yIds = subplots.yaxis; var xNames = Lib.simpleMap(xIds, id2name); var yNames = Lib.simpleMap(yIds, id2name); var axNames = xNames.concat(yNames); var plotBgColor = Color.background; if (xIds.length && yIds.length) { plotBgColor = Lib.coerce(layoutIn, layoutOut, basePlotLayoutAttributes, "plot_bgcolor"); } var bgColor = Color.combine(plotBgColor, layoutOut.paper_bgcolor); var axName; var axId; var axLetter; var axLayoutIn; var axLayoutOut; function newAxLayoutOut() { var traces = ax2traces[axName] || []; axLayoutOut._traceIndices = traces.map(function(t) { return t._expandedIndex; }); axLayoutOut._annIndices = []; axLayoutOut._shapeIndices = []; axLayoutOut._selectionIndices = []; axLayoutOut._imgIndices = []; axLayoutOut._subplotsWith = []; axLayoutOut._counterAxes = []; axLayoutOut._name = axLayoutOut._attr = axName; axLayoutOut._id = axId; } function coerce(attr, dflt) { return Lib.coerce(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); } function coerce2(attr, dflt) { return Lib.coerce2(axLayoutIn, axLayoutOut, layoutAttributes, attr, dflt); } function getCounterAxes(axLetter2) { return axLetter2 === "x" ? yIds : xIds; } function getOverlayableAxes(axLetter2, axName2) { var list = axLetter2 === "x" ? xNames : yNames; var out = []; for (var j2 = 0; j2 < list.length; j2++) { var axName22 = list[j2]; if (axName22 !== axName2 && !(layoutIn[axName22] || {}).overlaying) { out.push(name2id(axName22)); } } return out; } var counterAxes = { x: getCounterAxes("x"), y: getCounterAxes("y") }; var allAxisIds = counterAxes.x.concat(counterAxes.y); var missingMatchedAxisIdsLookup = {}; var missingMatchedAxisIds = []; function addMissingMatchedAxis() { var matchesIn = axLayoutIn.matches; if (AX_ID_PATTERN.test(matchesIn) && allAxisIds.indexOf(matchesIn) === -1) { missingMatchedAxisIdsLookup[matchesIn] = axLayoutIn.type; missingMatchedAxisIds = Object.keys(missingMatchedAxisIdsLookup); } } var hovermode = handleHoverModeDefaults(layoutIn, layoutOut); var unifiedHover = isUnifiedHover(hovermode); for (i = 0; i < axNames.length; i++) { axName = axNames[i]; axId = name2id(axName); axLetter = axName.charAt(0); if (!Lib.isPlainObject(layoutIn[axName])) { layoutIn[axName] = {}; } axLayoutIn = layoutIn[axName]; axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + "axis"); newAxLayoutOut(); var visibleDflt = axLetter === "x" && !xaMustDisplay[axName] && xaMayHide[axName] || axLetter === "y" && !yaMustDisplay[axName] && yaMayHide[axName]; var reverseDflt = axLetter === "y" && (!yaMustNotReverse[axName] && yaMayReverse[axName] || axHasImage[axName]); var defaultOptions = { hasMinor: true, letter: axLetter, font: layoutOut.font, outerTicks: outerTicks[axName], showGrid: !noGrids[axName], data: ax2traces[axName] || [], bgColor, calendar: layoutOut.calendar, automargin: true, visibleDflt, reverseDflt, autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId], noAutotickangles: axLetter === "y" }; coerce("uirevision", layoutOut.uirevision); handleTypeDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions); handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut); var unifiedSpike = unifiedHover && axLetter === hovermode.charAt(0); var spikecolor = coerce2("spikecolor", unifiedHover ? axLayoutOut.color : void 0); var spikethickness = coerce2("spikethickness", unifiedHover ? 1.5 : void 0); var spikedash = coerce2("spikedash", unifiedHover ? "dot" : void 0); var spikemode = coerce2("spikemode", unifiedHover ? "across" : void 0); var spikesnap = coerce2("spikesnap"); var showSpikes = coerce("showspikes", !!unifiedSpike || !!spikecolor || !!spikethickness || !!spikedash || !!spikemode || !!spikesnap); if (!showSpikes) { delete axLayoutOut.spikecolor; delete axLayoutOut.spikethickness; delete axLayoutOut.spikedash; delete axLayoutOut.spikemode; delete axLayoutOut.spikesnap; } var overlayingAxis = id2name(axLayoutIn.overlaying); var overlayingAnchorDomain = [0, 1]; if (layoutOut[overlayingAxis] !== void 0) { var overlayingAnchor = id2name(layoutOut[overlayingAxis].anchor); if (layoutOut[overlayingAnchor] !== void 0) { overlayingAnchorDomain = layoutOut[overlayingAnchor].domain; } } handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, { letter: axLetter, counterAxes: counterAxes[axLetter], overlayableAxes: getOverlayableAxes(axLetter, axName), grid: layoutOut.grid, overlayingDomain: overlayingAnchorDomain }); coerce("title.standoff"); addMissingMatchedAxis(); axLayoutOut._input = axLayoutIn; } i = 0; while (i < missingMatchedAxisIds.length) { axId = missingMatchedAxisIds[i++]; axName = id2name(axId); axLetter = axName.charAt(0); if (!Lib.isPlainObject(layoutIn[axName])) { layoutIn[axName] = {}; } axLayoutIn = layoutIn[axName]; axLayoutOut = Template.newContainer(layoutOut, axName, axLetter + "axis"); newAxLayoutOut(); var defaultOptions2 = { letter: axLetter, font: layoutOut.font, outerTicks: outerTicks[axName], showGrid: !noGrids[axName], data: [], bgColor, calendar: layoutOut.calendar, automargin: true, visibleDflt: false, reverseDflt: false, autotypenumbersDflt, splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId] }; coerce("uirevision", layoutOut.uirevision); axLayoutOut.type = missingMatchedAxisIdsLookup[axId] || "linear"; handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions2, layoutOut); handlePositionDefaults(axLayoutIn, axLayoutOut, coerce, { letter: axLetter, counterAxes: counterAxes[axLetter], overlayableAxes: getOverlayableAxes(axLetter, axName), grid: layoutOut.grid }); coerce("fixedrange"); addMissingMatchedAxis(); axLayoutOut._input = axLayoutIn; } var rangeSliderDefaults = getComponentMethod("rangeslider", "handleDefaults"); var rangeSelectorDefaults = getComponentMethod("rangeselector", "handleDefaults"); for (i = 0; i < xNames.length; i++) { axName = xNames[i]; axLayoutIn = layoutIn[axName]; axLayoutOut = layoutOut[axName]; rangeSliderDefaults(layoutIn, layoutOut, axName); if (axLayoutOut.type === "date") { rangeSelectorDefaults( axLayoutIn, axLayoutOut, layoutOut, yNames, axLayoutOut.calendar ); } coerce("fixedrange"); } for (i = 0; i < yNames.length; i++) { axName = yNames[i]; axLayoutIn = layoutIn[axName]; axLayoutOut = layoutOut[axName]; var anchoredAxis = layoutOut[id2name(axLayoutOut.anchor)]; var fixedRangeDflt = getComponentMethod("rangeslider", "isVisible")(anchoredAxis); coerce("fixedrange", fixedRangeDflt); } constraints.handleDefaults(layoutIn, layoutOut, { axIds: allAxisIds.concat(missingMatchedAxisIds).sort(axisIds.idSort), axHasImage }); }; } }); // node_modules/plotly.js/src/plots/cartesian/transition_axes.js var require_transition_axes = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/transition_axes.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Lib = require_lib(); var Drawing = require_drawing(); var Axes = require_axes(); module2.exports = function transitionAxes(gd2, edits, transitionOpts, makeOnCompleteCallback) { var fullLayout = gd2._fullLayout; if (edits.length === 0) { Axes.redrawComponents(gd2); return; } function unsetSubplotTransform(subplot) { var xa2 = subplot.xaxis; var ya2 = subplot.yaxis; fullLayout._defs.select("#" + subplot.clipId + "> rect").call(Drawing.setTranslate, 0, 0).call(Drawing.setScale, 1, 1); subplot.plot.call(Drawing.setTranslate, xa2._offset, ya2._offset).call(Drawing.setScale, 1, 1); var traceGroups = subplot.plot.selectAll(".scatterlayer .trace"); traceGroups.selectAll(".point").call(Drawing.setPointGroupScale, 1, 1); traceGroups.selectAll(".textpoint").call(Drawing.setTextPointsScale, 1, 1); traceGroups.call(Drawing.hideOutsideRangePoints, subplot); } function updateSubplot(edit, progress) { var plotinfo = edit.plotinfo; var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var xlen = xa2._length; var ylen = ya2._length; var editX = !!edit.xr1; var editY = !!edit.yr1; var viewBox = []; if (editX) { var xr0 = Lib.simpleMap(edit.xr0, xa2.r2l); var xr1 = Lib.simpleMap(edit.xr1, xa2.r2l); var dx0 = xr0[1] - xr0[0]; var dx1 = xr1[1] - xr1[0]; viewBox[0] = (xr0[0] * (1 - progress) + progress * xr1[0] - xr0[0]) / (xr0[1] - xr0[0]) * xlen; viewBox[2] = xlen * (1 - progress + progress * dx1 / dx0); xa2.range[0] = xa2.l2r(xr0[0] * (1 - progress) + progress * xr1[0]); xa2.range[1] = xa2.l2r(xr0[1] * (1 - progress) + progress * xr1[1]); } else { viewBox[0] = 0; viewBox[2] = xlen; } if (editY) { var yr0 = Lib.simpleMap(edit.yr0, ya2.r2l); var yr1 = Lib.simpleMap(edit.yr1, ya2.r2l); var dy0 = yr0[1] - yr0[0]; var dy1 = yr1[1] - yr1[0]; viewBox[1] = (yr0[1] * (1 - progress) + progress * yr1[1] - yr0[1]) / (yr0[0] - yr0[1]) * ylen; viewBox[3] = ylen * (1 - progress + progress * dy1 / dy0); ya2.range[0] = xa2.l2r(yr0[0] * (1 - progress) + progress * yr1[0]); ya2.range[1] = ya2.l2r(yr0[1] * (1 - progress) + progress * yr1[1]); } else { viewBox[1] = 0; viewBox[3] = ylen; } Axes.drawOne(gd2, xa2, { skipTitle: true }); Axes.drawOne(gd2, ya2, { skipTitle: true }); Axes.redrawComponents(gd2, [xa2._id, ya2._id]); var xScaleFactor = editX ? xlen / viewBox[2] : 1; var yScaleFactor = editY ? ylen / viewBox[3] : 1; var clipDx = editX ? viewBox[0] : 0; var clipDy = editY ? viewBox[1] : 0; var fracDx = editX ? viewBox[0] / viewBox[2] * xlen : 0; var fracDy = editY ? viewBox[1] / viewBox[3] * ylen : 0; var plotDx = xa2._offset - fracDx; var plotDy = ya2._offset - fracDy; plotinfo.clipRect.call(Drawing.setTranslate, clipDx, clipDy).call(Drawing.setScale, 1 / xScaleFactor, 1 / yScaleFactor); plotinfo.plot.call(Drawing.setTranslate, plotDx, plotDy).call(Drawing.setScale, xScaleFactor, yScaleFactor); Drawing.setPointGroupScale(plotinfo.zoomScalePts, 1 / xScaleFactor, 1 / yScaleFactor); Drawing.setTextPointsScale(plotinfo.zoomScaleTxt, 1 / xScaleFactor, 1 / yScaleFactor); } var onComplete; if (makeOnCompleteCallback) { onComplete = makeOnCompleteCallback(); } function transitionComplete() { var aobj = {}; for (var i = 0; i < edits.length; i++) { var edit = edits[i]; var xa2 = edit.plotinfo.xaxis; var ya2 = edit.plotinfo.yaxis; if (edit.xr1) aobj[xa2._name + ".range"] = edit.xr1.slice(); if (edit.yr1) aobj[ya2._name + ".range"] = edit.yr1.slice(); } onComplete && onComplete(); return Registry.call("relayout", gd2, aobj).then(function() { for (var i2 = 0; i2 < edits.length; i2++) { unsetSubplotTransform(edits[i2].plotinfo); } }); } function transitionInterrupt() { var aobj = {}; for (var i = 0; i < edits.length; i++) { var edit = edits[i]; var xa2 = edit.plotinfo.xaxis; var ya2 = edit.plotinfo.yaxis; if (edit.xr0) aobj[xa2._name + ".range"] = edit.xr0.slice(); if (edit.yr0) aobj[ya2._name + ".range"] = edit.yr0.slice(); } return Registry.call("relayout", gd2, aobj).then(function() { for (var i2 = 0; i2 < edits.length; i2++) { unsetSubplotTransform(edits[i2].plotinfo); } }); } var t13, t2, raf; var easeFn = d3.ease(transitionOpts.easing); gd2._transitionData._interruptCallbacks.push(function() { window.cancelAnimationFrame(raf); raf = null; return transitionInterrupt(); }); function doFrame() { t2 = Date.now(); var tInterp = Math.min(1, (t2 - t13) / transitionOpts.duration); var progress = easeFn(tInterp); for (var i = 0; i < edits.length; i++) { updateSubplot(edits[i], progress); } if (t2 - t13 > transitionOpts.duration) { transitionComplete(); raf = window.cancelAnimationFrame(doFrame); } else { raf = window.requestAnimationFrame(doFrame); } } t13 = Date.now(); raf = window.requestAnimationFrame(doFrame); return Promise.resolve(); }; } }); // node_modules/plotly.js/src/plots/cartesian/index.js var require_cartesian = __commonJS({ "node_modules/plotly.js/src/plots/cartesian/index.js"(exports2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Lib = require_lib(); var Plots = require_plots(); var Drawing = require_drawing(); var getModuleCalcData = require_get_data().getModuleCalcData; var axisIds = require_axis_ids(); var constants = require_constants2(); var xmlnsNamespaces = require_xmlns_namespaces(); var ensureSingle = Lib.ensureSingle; function ensureSingleAndAddDatum(parent, nodeType, className) { return Lib.ensureSingle(parent, nodeType, className, function(s) { s.datum(className); }); } var zindexSeparator = constants.zindexSeparator; exports2.name = "cartesian"; exports2.attr = ["xaxis", "yaxis"]; exports2.idRoot = ["x", "y"]; exports2.idRegex = constants.idRegex; exports2.attrRegex = constants.attrRegex; exports2.attributes = require_attributes14(); exports2.layoutAttributes = require_layout_attributes4(); exports2.supplyLayoutDefaults = require_layout_defaults4(); exports2.transitionAxes = require_transition_axes(); exports2.finalizeSubplots = function(layoutIn, layoutOut) { var subplots = layoutOut._subplots; var xList = subplots.xaxis; var yList = subplots.yaxis; var spSVG = subplots.cartesian; var spAll = spSVG.concat(subplots.gl2d || []); var allX = {}; var allY = {}; var i, xi2, yi2; for (i = 0; i < spAll.length; i++) { var parts = spAll[i].split("y"); allX[parts[0]] = 1; allY["y" + parts[1]] = 1; } for (i = 0; i < xList.length; i++) { xi2 = xList[i]; if (!allX[xi2]) { yi2 = (layoutIn[axisIds.id2name(xi2)] || {}).anchor; if (!constants.idRegex.y.test(yi2)) yi2 = "y"; spSVG.push(xi2 + yi2); spAll.push(xi2 + yi2); if (!allY[yi2]) { allY[yi2] = 1; Lib.pushUnique(yList, yi2); } } } for (i = 0; i < yList.length; i++) { yi2 = yList[i]; if (!allY[yi2]) { xi2 = (layoutIn[axisIds.id2name(yi2)] || {}).anchor; if (!constants.idRegex.x.test(xi2)) xi2 = "x"; spSVG.push(xi2 + yi2); spAll.push(xi2 + yi2); if (!allX[xi2]) { allX[xi2] = 1; Lib.pushUnique(xList, xi2); } } } if (!spAll.length) { xi2 = ""; yi2 = ""; for (var ki2 in layoutIn) { if (constants.attrRegex.test(ki2)) { var axLetter = ki2.charAt(0); if (axLetter === "x") { if (!xi2 || +ki2.substr(5) < +xi2.substr(5)) { xi2 = ki2; } } else if (!yi2 || +ki2.substr(5) < +yi2.substr(5)) { yi2 = ki2; } } } xi2 = xi2 ? axisIds.name2id(xi2) : "x"; yi2 = yi2 ? axisIds.name2id(yi2) : "y"; xList.push(xi2); yList.push(yi2); spSVG.push(xi2 + yi2); } }; exports2.plot = function(gd2, traces, transitionOpts, makeOnCompleteCallback) { var fullLayout = gd2._fullLayout; var subplots = fullLayout._subplots.cartesian; var calcdata = gd2.calcdata; var i; if (!Array.isArray(traces)) { traces = []; for (i = 0; i < calcdata.length; i++) traces.push(i); } var zindices = fullLayout._zindices; for (var z = 0; z < zindices.length; z++) { var zorder = zindices[z]; for (i = 0; i < subplots.length; i++) { var subplot = subplots[i]; var subplotInfo = fullLayout._plots[subplot]; if (z > 0) { var idWithZ = subplotInfo.id; if (idWithZ.indexOf(zindexSeparator) !== -1) continue; idWithZ += zindexSeparator + (z + 1); subplotInfo = Lib.extendFlat({}, subplotInfo, { id: idWithZ, plot: fullLayout._cartesianlayer.selectAll(".subplot").select("." + idWithZ) }); } var cdSubplot = []; var pcd; for (var j = 0; j < calcdata.length; j++) { var cd2 = calcdata[j]; var trace = cd2[0].trace; if (zorder !== (trace.zorder || 0)) continue; if (trace.xaxis + trace.yaxis === subplot) { if (traces.indexOf(trace.index) !== -1 || trace.carpet) { if (pcd && pcd[0].trace.xaxis + pcd[0].trace.yaxis === subplot && ["tonextx", "tonexty", "tonext"].indexOf(trace.fill) !== -1 && cdSubplot.indexOf(pcd) === -1) { cdSubplot.push(pcd); } cdSubplot.push(cd2); } pcd = cd2; } } plotOne(gd2, subplotInfo, cdSubplot, transitionOpts, makeOnCompleteCallback); } } }; function plotOne(gd2, plotinfo, cdSubplot, transitionOpts, makeOnCompleteCallback) { var traceLayerClasses = constants.traceLayerClasses; var fullLayout = gd2._fullLayout; var zindices = fullLayout._zindices; var modules = fullLayout._modules; var _module, cdModuleAndOthers, cdModule; var layerData = []; var zoomScaleQueryParts = []; for (var z = 0; z < zindices.length; z++) { var zorder = zindices[z]; for (var i = 0; i < modules.length; i++) { _module = modules[i]; var name = _module.name; var categories = Registry.modules[name].categories; if (categories.svg) { var classBaseName = _module.layerName || name + "layer"; var className = classBaseName + (z ? Number(z) + 1 : ""); var plotMethod = _module.plot; cdModuleAndOthers = getModuleCalcData(cdSubplot, plotMethod, zorder); cdModule = cdModuleAndOthers[0]; cdSubplot = cdModuleAndOthers[1]; if (cdModule.length) { layerData.push({ i: traceLayerClasses.indexOf(classBaseName), zindex: z, className, plotMethod, cdModule }); } if (categories.zoomScale) { zoomScaleQueryParts.push("." + className); } } } } layerData.sort(function(a, b) { return (a.zindex || 0) - (b.zindex || 0) || a.i - b.i; }); var layers = plotinfo.plot.selectAll("g.mlayer").data(layerData, function(d) { return d.className; }); layers.enter().append("g").attr("class", function(d) { return d.className; }).classed("mlayer", true).classed("rangeplot", plotinfo.isRangePlot); layers.exit().remove(); layers.order(); layers.each(function(d) { var sel = d3.select(this); var className2 = d.className; d.plotMethod( gd2, plotinfo, d.cdModule, sel, transitionOpts, makeOnCompleteCallback ); if (constants.clipOnAxisFalseQuery.indexOf("." + className2) === -1) { Drawing.setClipUrl(sel, plotinfo.layerClipId, gd2); } }); if (fullLayout._has("scattergl")) { _module = Registry.getModule("scattergl"); cdModule = getModuleCalcData(cdSubplot, _module)[0]; _module.plot(gd2, plotinfo, cdModule); } if (!gd2._context.staticPlot) { if (plotinfo._hasClipOnAxisFalse) { plotinfo.clipOnAxisFalseTraces = plotinfo.plot.selectAll(constants.clipOnAxisFalseQuery.join(",")).selectAll(".trace"); } if (zoomScaleQueryParts.length) { var traces = plotinfo.plot.selectAll(zoomScaleQueryParts.join(",")).selectAll(".trace"); plotinfo.zoomScalePts = traces.selectAll("path.point"); plotinfo.zoomScaleTxt = traces.selectAll(".textpoint"); } } } exports2.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) { var oldPlots = oldFullLayout._plots || {}; var newPlots = newFullLayout._plots || {}; var oldSubplotList = oldFullLayout._subplots || {}; var plotinfo; var i, k; if (oldFullLayout._hasOnlyLargeSploms && !newFullLayout._hasOnlyLargeSploms) { for (k in oldPlots) { plotinfo = oldPlots[k]; if (plotinfo.plotgroup) plotinfo.plotgroup.remove(); } } var hadGl = oldFullLayout._has && oldFullLayout._has("gl"); var hasGl = newFullLayout._has && newFullLayout._has("gl"); if (hadGl && !hasGl) { for (k in oldPlots) { plotinfo = oldPlots[k]; if (plotinfo._scene) plotinfo._scene.destroy(); } } if (oldSubplotList.xaxis && oldSubplotList.yaxis) { var oldAxIDs = axisIds.listIds({ _fullLayout: oldFullLayout }); for (i = 0; i < oldAxIDs.length; i++) { var oldAxId = oldAxIDs[i]; if (!newFullLayout[axisIds.id2name(oldAxId)]) { oldFullLayout._infolayer.selectAll(".g-" + oldAxId + "title").remove(); } } } var hadCartesian = oldFullLayout._has && oldFullLayout._has("cartesian"); var hasCartesian = newFullLayout._has && newFullLayout._has("cartesian"); if (hadCartesian && !hasCartesian) { purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll(".subplot"), oldFullLayout); oldFullLayout._defs.selectAll(".axesclip").remove(); delete oldFullLayout._axisConstraintGroups; delete oldFullLayout._axisMatchGroups; } else if (oldSubplotList.cartesian) { for (i = 0; i < oldSubplotList.cartesian.length; i++) { var oldSubplotId = oldSubplotList.cartesian[i]; if (oldSubplotId.indexOf(zindexSeparator) !== -1) continue; if (!newPlots[oldSubplotId]) { var selector = "." + oldSubplotId + ",." + oldSubplotId + "-x,." + oldSubplotId + "-y"; oldFullLayout._cartesianlayer.selectAll(selector).remove(); removeSubplotExtras(oldSubplotId, oldFullLayout); } } } }; exports2.drawFramework = function(gd2) { var fullLayout = gd2._fullLayout; var calcdata = gd2.calcdata; var i; var traceZorderGroups = {}; for (i = 0; i < calcdata.length; i++) { var cdi = calcdata[i][0]; var trace = cdi.trace; var zi2 = trace.zorder || 0; if (!traceZorderGroups[zi2]) traceZorderGroups[zi2] = []; traceZorderGroups[zi2].push(cdi); } var zindices = Object.keys(traceZorderGroups).map(Number).sort(Lib.sorterAsc); if (!zindices.length) zindices = [0]; fullLayout._zindices = zindices; var initialSubplotData = makeSubplotData(gd2); var len = initialSubplotData.length; var subplotData = []; for (i = 0; i < len; i++) { subplotData[i] = initialSubplotData[i].slice(); } for (var z = 1; z < zindices.length; z++) { var newSubplotData = []; for (i = 0; i < len; i++) { newSubplotData[i] = initialSubplotData[i].slice(); newSubplotData[i][0] += zindexSeparator + (z + 1); } subplotData = subplotData.concat(newSubplotData); } var subplotLayers = fullLayout._cartesianlayer.selectAll(".subplot").data(subplotData, String); subplotLayers.enter().append("g").attr("class", function(d) { return "subplot " + d[0]; }); subplotLayers.order(); subplotLayers.exit().call(purgeSubplotLayers, fullLayout); subplotLayers.each(function(d) { var id2 = d[0]; var posZ = id2.indexOf(zindexSeparator); var hasZ = posZ !== -1; var idWithoutZ = hasZ ? id2.slice(0, posZ) : id2; var plotinfo = fullLayout._plots[id2]; if (!plotinfo) { plotinfo = Lib.extendFlat({}, fullLayout._plots[idWithoutZ]); if (plotinfo) { plotinfo.id = id2; fullLayout._plots[id2] = plotinfo; fullLayout._subplots.cartesian.push(id2); } } if (plotinfo) { plotinfo.plotgroup = d3.select(this); makeSubplotLayer(gd2, plotinfo); if (!hasZ) { plotinfo.draglayer = ensureSingle(fullLayout._draggers, "g", id2); } } }); }; exports2.rangePlot = function(gd2, plotinfo, cdSubplot) { makeSubplotLayer(gd2, plotinfo); plotOne(gd2, plotinfo, cdSubplot); Plots.style(gd2); }; function makeSubplotData(gd2) { var fullLayout = gd2._fullLayout; var numZ = fullLayout._zindices.length; var ids = fullLayout._subplots.cartesian; var len = ids.length; var i, j, id2, plotinfo, xa2, ya2; var regulars = []; var overlays = []; for (i = 0; i < len; i++) { id2 = ids[i]; plotinfo = fullLayout._plots[id2]; xa2 = plotinfo.xaxis; ya2 = plotinfo.yaxis; var xa22 = xa2._mainAxis; var ya22 = ya2._mainAxis; var mainplot = xa22._id + ya22._id; var mainplotinfo = fullLayout._plots[mainplot]; plotinfo.overlays = []; if (mainplot !== id2 && mainplotinfo) { plotinfo.mainplot = mainplot; plotinfo.mainplotinfo = mainplotinfo; overlays.push(id2); } else { plotinfo.mainplot = void 0; plotinfo.mainplotinfo = void 0; regulars.push(id2); } } for (i = 0; i < overlays.length; i++) { id2 = overlays[i]; plotinfo = fullLayout._plots[id2]; plotinfo.mainplotinfo.overlays.push(plotinfo); } var subplotIds = regulars.concat(overlays); var subplotData = []; for (i = 0; i < len; i++) { id2 = subplotIds[i]; plotinfo = fullLayout._plots[id2]; xa2 = plotinfo.xaxis; ya2 = plotinfo.yaxis; var d = []; for (var z = 1; z <= numZ; z++) { var zStr = ""; if (z > 1) zStr += zindexSeparator + z; d.push(id2 + zStr); for (j = 0; j < plotinfo.overlays.length; j++) { d.push(plotinfo.overlays[j].id + zStr); } } d = d.concat([ xa2.layer, ya2.layer, xa2.overlaying || "", ya2.overlaying || "" ]); subplotData.push(d); } return subplotData; } function makeSubplotLayer(gd2, plotinfo) { var fullLayout = gd2._fullLayout; var plotgroup = plotinfo.plotgroup; var id2 = plotinfo.id; var posZ = id2.indexOf(zindexSeparator); var hasZ = posZ !== -1; var xLayer = constants.layerValue2layerClass[plotinfo.xaxis.layer]; var yLayer = constants.layerValue2layerClass[plotinfo.yaxis.layer]; var hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms; if (!plotinfo.mainplot || fullLayout._zindices.length > 1) { if (hasOnlyLargeSploms) { plotinfo.xlines = ensureSingle(plotgroup, "path", "xlines-above"); plotinfo.ylines = ensureSingle(plotgroup, "path", "ylines-above"); plotinfo.xaxislayer = ensureSingle(plotgroup, "g", "xaxislayer-above"); plotinfo.yaxislayer = ensureSingle(plotgroup, "g", "yaxislayer-above"); } else { if (!hasZ) { var backLayer = ensureSingle(plotgroup, "g", "layer-subplot"); plotinfo.shapelayer = ensureSingle(backLayer, "g", "shapelayer"); plotinfo.imagelayer = ensureSingle(backLayer, "g", "imagelayer"); plotinfo.minorGridlayer = ensureSingle(plotgroup, "g", "minor-gridlayer"); plotinfo.gridlayer = ensureSingle(plotgroup, "g", "gridlayer"); plotinfo.zerolinelayer = ensureSingle(plotgroup, "g", "zerolinelayer"); var betweenLayer = ensureSingle(plotgroup, "g", "layer-between"); plotinfo.shapelayerBetween = ensureSingle(betweenLayer, "g", "shapelayer"); plotinfo.imagelayerBetween = ensureSingle(betweenLayer, "g", "imagelayer"); ensureSingle(plotgroup, "path", "xlines-below"); ensureSingle(plotgroup, "path", "ylines-below"); plotinfo.overlinesBelow = ensureSingle(plotgroup, "g", "overlines-below"); ensureSingle(plotgroup, "g", "xaxislayer-below"); ensureSingle(plotgroup, "g", "yaxislayer-below"); plotinfo.overaxesBelow = ensureSingle(plotgroup, "g", "overaxes-below"); } plotinfo.overplot = ensureSingle(plotgroup, "g", "overplot"); plotinfo.plot = ensureSingle(plotinfo.overplot, "g", id2); if (!hasZ) { plotinfo.xlines = ensureSingle(plotgroup, "path", "xlines-above"); plotinfo.ylines = ensureSingle(plotgroup, "path", "ylines-above"); plotinfo.overlinesAbove = ensureSingle(plotgroup, "g", "overlines-above"); ensureSingle(plotgroup, "g", "xaxislayer-above"); ensureSingle(plotgroup, "g", "yaxislayer-above"); plotinfo.overaxesAbove = ensureSingle(plotgroup, "g", "overaxes-above"); plotinfo.xlines = plotgroup.select(".xlines-" + xLayer); plotinfo.ylines = plotgroup.select(".ylines-" + yLayer); plotinfo.xaxislayer = plotgroup.select(".xaxislayer-" + xLayer); plotinfo.yaxislayer = plotgroup.select(".yaxislayer-" + yLayer); } } } else { var mainplotinfo = plotinfo.mainplotinfo; var mainplotgroup = mainplotinfo.plotgroup; var xId = id2 + "-x"; var yId = id2 + "-y"; plotinfo.minorGridlayer = mainplotinfo.minorGridlayer; plotinfo.gridlayer = mainplotinfo.gridlayer; plotinfo.zerolinelayer = mainplotinfo.zerolinelayer; ensureSingle(mainplotinfo.overlinesBelow, "path", xId); ensureSingle(mainplotinfo.overlinesBelow, "path", yId); ensureSingle(mainplotinfo.overaxesBelow, "g", xId); ensureSingle(mainplotinfo.overaxesBelow, "g", yId); plotinfo.plot = ensureSingle(mainplotinfo.overplot, "g", id2); ensureSingle(mainplotinfo.overlinesAbove, "path", xId); ensureSingle(mainplotinfo.overlinesAbove, "path", yId); ensureSingle(mainplotinfo.overaxesAbove, "g", xId); ensureSingle(mainplotinfo.overaxesAbove, "g", yId); plotinfo.xlines = mainplotgroup.select(".overlines-" + xLayer).select("." + xId); plotinfo.ylines = mainplotgroup.select(".overlines-" + yLayer).select("." + yId); plotinfo.xaxislayer = mainplotgroup.select(".overaxes-" + xLayer).select("." + xId); plotinfo.yaxislayer = mainplotgroup.select(".overaxes-" + yLayer).select("." + yId); } if (!hasZ) { if (!hasOnlyLargeSploms) { ensureSingleAndAddDatum(plotinfo.minorGridlayer, "g", plotinfo.xaxis._id); ensureSingleAndAddDatum(plotinfo.minorGridlayer, "g", plotinfo.yaxis._id); plotinfo.minorGridlayer.selectAll("g").map(function(d) { return d[0]; }).sort(axisIds.idSort); ensureSingleAndAddDatum(plotinfo.gridlayer, "g", plotinfo.xaxis._id); ensureSingleAndAddDatum(plotinfo.gridlayer, "g", plotinfo.yaxis._id); plotinfo.gridlayer.selectAll("g").map(function(d) { return d[0]; }).sort(axisIds.idSort); } plotinfo.xlines.style("fill", "none").classed("crisp", true); plotinfo.ylines.style("fill", "none").classed("crisp", true); } } function purgeSubplotLayers(layers, fullLayout) { if (!layers) return; var overlayIdsToRemove = {}; layers.each(function(d) { var id2 = d[0]; var plotgroup = d3.select(this); plotgroup.remove(); removeSubplotExtras(id2, fullLayout); overlayIdsToRemove[id2] = true; }); for (var k in fullLayout._plots) { var subplotInfo = fullLayout._plots[k]; var overlays = subplotInfo.overlays || []; for (var j = 0; j < overlays.length; j++) { var overlayInfo = overlays[j]; if (overlayIdsToRemove[overlayInfo.id]) { overlayInfo.plot.selectAll(".trace").remove(); } } } } function removeSubplotExtras(subplotId, fullLayout) { fullLayout._draggers.selectAll("g." + subplotId).remove(); fullLayout._defs.select("#clip" + fullLayout._uid + subplotId + "plot").remove(); } exports2.toSVG = function(gd2) { var imageRoot = gd2._fullLayout._glimages; var root = d3.select(gd2).selectAll(".svg-container"); var canvases = root.filter(function(d, i) { return i === root.size() - 1; }).selectAll(".gl-canvas-context, .gl-canvas-focus"); function canvasToImage() { var canvas = this; var imageData = canvas.toDataURL("image/png"); var image = imageRoot.append("svg:image"); image.attr({ xmlns: xmlnsNamespaces.svg, "xlink:href": imageData, preserveAspectRatio: "none", x: 0, y: 0, width: canvas.style.width, height: canvas.style.height }); } canvases.each(canvasToImage); }; exports2.updateFx = require_graph_interact().updateFx; } }); // node_modules/plotly.js/src/traces/scatter/index.js var require_scatter = __commonJS({ "node_modules/plotly.js/src/traces/scatter/index.js"(exports2, module2) { "use strict"; var subtypes = require_subtypes(); module2.exports = { hasLines: subtypes.hasLines, hasMarkers: subtypes.hasMarkers, hasText: subtypes.hasText, isBubble: subtypes.isBubble, attributes: require_attributes12(), layoutAttributes: require_layout_attributes3(), supplyDefaults: require_defaults8(), crossTraceDefaults: require_cross_trace_defaults2(), supplyLayoutDefaults: require_layout_defaults3(), calc: require_calc3().calc, crossTraceCalc: require_cross_trace_calc2(), arraysToCalcdata: require_arrays_to_calcdata(), plot: require_plot(), colorbar: require_marker_colorbar(), formatLabels: require_format_labels(), style: require_style2().style, styleOnSelect: require_style2().styleOnSelect, hoverPoints: require_hover2(), selectPoints: require_select2(), animatable: true, moduleType: "trace", name: "scatter", basePlotModule: require_cartesian(), categories: [ "cartesian", "svg", "symbols", "errorBarsOK", "showLegend", "scatter-like", "zoomScale" ], meta: { description: [ "The scatter trace type encompasses line charts, scatter charts, text charts, and bubble charts.", "The data visualized as scatter point or lines is set in `x` and `y`.", "Text (appearing either on the chart or on hover only) is via `text`.", "Bubble charts are achieved by setting `marker.size` and/or `marker.color`", "to numerical arrays." ].join(" ") } }; } }); // node_modules/plotly.js/src/components/annotations/draw_arrow_head.js var require_draw_arrow_head = __commonJS({ "node_modules/plotly.js/src/components/annotations/draw_arrow_head.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Color = require_color(); var ARROWPATHS = require_arrow_paths(); var Lib = require_lib(); var strScale = Lib.strScale; var strRotate = Lib.strRotate; var strTranslate = Lib.strTranslate; module2.exports = function drawArrowHead(el3, ends, options) { var el = el3.node(); var headStyle = ARROWPATHS[options.arrowhead || 0]; var startHeadStyle = ARROWPATHS[options.startarrowhead || 0]; var scale = (options.arrowwidth || 1) * (options.arrowsize || 1); var startScale = (options.arrowwidth || 1) * (options.startarrowsize || 1); var doStart = ends.indexOf("start") >= 0; var doEnd = ends.indexOf("end") >= 0; var backOff = headStyle.backoff * scale + options.standoff; var startBackOff = startHeadStyle.backoff * startScale + options.startstandoff; var start, end, startRot, endRot; if (el.nodeName === "line") { start = { x: +el3.attr("x1"), y: +el3.attr("y1") }; end = { x: +el3.attr("x2"), y: +el3.attr("y2") }; var dx = start.x - end.x; var dy = start.y - end.y; startRot = Math.atan2(dy, dx); endRot = startRot + Math.PI; if (backOff && startBackOff) { if (backOff + startBackOff > Math.sqrt(dx * dx + dy * dy)) { hideLine(); return; } } if (backOff) { if (backOff * backOff > dx * dx + dy * dy) { hideLine(); return; } var backOffX = backOff * Math.cos(startRot); var backOffY = backOff * Math.sin(startRot); end.x += backOffX; end.y += backOffY; el3.attr({ x2: end.x, y2: end.y }); } if (startBackOff) { if (startBackOff * startBackOff > dx * dx + dy * dy) { hideLine(); return; } var startBackOffX = startBackOff * Math.cos(startRot); var startbackOffY = startBackOff * Math.sin(startRot); start.x -= startBackOffX; start.y -= startbackOffY; el3.attr({ x1: start.x, y1: start.y }); } } else if (el.nodeName === "path") { var pathlen = el.getTotalLength(); var dashArray = ""; if (pathlen < backOff + startBackOff) { hideLine(); return; } var start0 = el.getPointAtLength(0); var dstart = el.getPointAtLength(0.1); startRot = Math.atan2(start0.y - dstart.y, start0.x - dstart.x); start = el.getPointAtLength(Math.min(startBackOff, pathlen)); dashArray = "0px," + startBackOff + "px,"; var end0 = el.getPointAtLength(pathlen); var dend = el.getPointAtLength(pathlen - 0.1); endRot = Math.atan2(end0.y - dend.y, end0.x - dend.x); end = el.getPointAtLength(Math.max(0, pathlen - backOff)); var shortening = dashArray ? startBackOff + backOff : backOff; dashArray += pathlen - shortening + "px," + pathlen + "px"; el3.style("stroke-dasharray", dashArray); } function hideLine() { el3.style("stroke-dasharray", "0px,100px"); } function drawhead(arrowHeadStyle, p, rot, arrowScale) { if (!arrowHeadStyle.path) return; if (arrowHeadStyle.noRotate) rot = 0; d3.select(el.parentNode).append("path").attr({ class: el3.attr("class"), d: arrowHeadStyle.path, transform: strTranslate(p.x, p.y) + strRotate(rot * 180 / Math.PI) + strScale(arrowScale) }).style({ fill: Color.rgb(options.arrowcolor), "stroke-width": 0 }); } if (doStart) drawhead(startHeadStyle, start, startRot, startScale); if (doEnd) drawhead(headStyle, end, endRot, scale); }; } }); // node_modules/plotly.js/src/components/annotations/draw.js var require_draw4 = __commonJS({ "node_modules/plotly.js/src/components/annotations/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Plots = require_plots(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var Axes = require_axes(); var Color = require_color(); var Drawing = require_drawing(); var Fx = require_fx(); var svgTextUtils = require_svg_text_utils(); var setCursor = require_setcursor(); var dragElement = require_dragelement(); var arrayEditor = require_plot_template().arrayEditor; var drawArrowHead = require_draw_arrow_head(); module2.exports = { draw, drawOne, drawRaw }; function draw(gd2) { var fullLayout = gd2._fullLayout; fullLayout._infolayer.selectAll(".annotation").remove(); for (var i = 0; i < fullLayout.annotations.length; i++) { if (fullLayout.annotations[i].visible) { drawOne(gd2, i); } } return Plots.previousPromises(gd2); } function drawOne(gd2, index) { var fullLayout = gd2._fullLayout; var options = fullLayout.annotations[index] || {}; var xa2 = Axes.getFromId(gd2, options.xref); var ya2 = Axes.getFromId(gd2, options.yref); if (xa2) xa2.setScale(); if (ya2) ya2.setScale(); drawRaw(gd2, options, index, false, xa2, ya2); } function shiftPosition(axa, dAx, axLetter, gs2, options) { var optAx = options[axLetter]; var axRef = options[axLetter + "ref"]; var vertical = axLetter.indexOf("y") !== -1; var axDomainRef = Axes.getRefType(axRef) === "domain"; var gsDim = vertical ? gs2.h : gs2.w; if (axa) { if (axDomainRef) { return optAx + (vertical ? -dAx : dAx) / axa._length; } else { return axa.p2r(axa.r2p(optAx) + dAx); } } else { return optAx + (vertical ? -dAx : dAx) / gsDim; } } function drawRaw(gd2, options, index, subplotId, xa2, ya2) { var fullLayout = gd2._fullLayout; var gs2 = gd2._fullLayout._size; var edits = gd2._context.edits; var className, containerStr; if (subplotId) { className = "annotation-" + subplotId; containerStr = subplotId + ".annotations"; } else { className = "annotation"; containerStr = "annotations"; } var editHelpers = arrayEditor(gd2.layout, containerStr, options); var modifyBase = editHelpers.modifyBase; var modifyItem = editHelpers.modifyItem; var getUpdateObj = editHelpers.getUpdateObj; fullLayout._infolayer.selectAll("." + className + '[data-index="' + index + '"]').remove(); var annClipID = "clip" + fullLayout._uid + "_ann" + index; if (!options._input || options.visible === false) { d3.selectAll("#" + annClipID).remove(); return; } var annPosPx = { x: {}, y: {} }; var textangle = +options.textangle || 0; var annGroup = fullLayout._infolayer.append("g").classed(className, true).attr("data-index", String(index)).style("opacity", options.opacity); var annTextGroup = annGroup.append("g").classed("annotation-text-g", true); var editTextPosition = edits[options.showarrow ? "annotationTail" : "annotationPosition"]; var textEvents = options.captureevents || edits.annotationText || editTextPosition; function makeEventData(initialEvent) { var eventData = { index, annotation: options._input, fullAnnotation: options, event: initialEvent }; if (subplotId) { eventData.subplotId = subplotId; } return eventData; } var annTextGroupInner = annTextGroup.append("g").style("pointer-events", textEvents ? "all" : null).call(setCursor, "pointer").on("click", function() { gd2._dragging = false; gd2.emit("plotly_clickannotation", makeEventData(d3.event)); }); if (options.hovertext) { annTextGroupInner.on("mouseover", function() { var hoverOptions = options.hoverlabel; var hoverFont = hoverOptions.font; var bBox = this.getBoundingClientRect(); var bBoxRef = gd2.getBoundingClientRect(); Fx.loneHover({ x0: bBox.left - bBoxRef.left, x1: bBox.right - bBoxRef.left, y: (bBox.top + bBox.bottom) / 2 - bBoxRef.top, text: options.hovertext, color: hoverOptions.bgcolor, borderColor: hoverOptions.bordercolor, fontFamily: hoverFont.family, fontSize: hoverFont.size, fontColor: hoverFont.color, fontWeight: hoverFont.weight, fontStyle: hoverFont.style, fontVariant: hoverFont.variant, fontShadow: hoverFont.fontShadow, fontLineposition: hoverFont.fontLineposition, fontTextcase: hoverFont.fontTextcase }, { container: fullLayout._hoverlayer.node(), outerContainer: fullLayout._paper.node(), gd: gd2 }); }).on("mouseout", function() { Fx.loneUnhover(fullLayout._hoverlayer.node()); }); } var borderwidth = options.borderwidth; var borderpad = options.borderpad; var borderfull = borderwidth + borderpad; var annTextBG = annTextGroupInner.append("rect").attr("class", "bg").style("stroke-width", borderwidth + "px").call(Color.stroke, options.bordercolor).call(Color.fill, options.bgcolor); var isSizeConstrained = options.width || options.height; var annTextClip = fullLayout._topclips.selectAll("#" + annClipID).data(isSizeConstrained ? [0] : []); annTextClip.enter().append("clipPath").classed("annclip", true).attr("id", annClipID).append("rect"); annTextClip.exit().remove(); var font = options.font; var text = fullLayout._meta ? Lib.templateString(options.text, fullLayout._meta) : options.text; var annText = annTextGroupInner.append("text").classed("annotation-text", true).text(text); function textLayout(s) { s.call(Drawing.font, font).attr({ "text-anchor": { left: "start", right: "end" }[options.align] || "middle" }); svgTextUtils.convertToTspans(s, gd2, drawGraphicalElements); return s; } function drawGraphicalElements() { var anchor3 = annText.selectAll("a"); if (anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert("a", ":first-child").attr({ "xlink:xlink:href": anchor3.attr("xlink:href"), "xlink:xlink:show": anchor3.attr("xlink:show") }).style({ cursor: "pointer" }); wholeLink.node().appendChild(annTextBG.node()); } var mathjaxGroup = annTextGroupInner.select(".annotation-text-math-group"); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node() ); var textWidth = anntextBB.width; var textHeight = anntextBB.height; var annWidth = options.width || textWidth; var annHeight = options.height || textHeight; var outerWidth = Math.round(annWidth + 2 * borderfull); var outerHeight = Math.round(annHeight + 2 * borderfull); function shiftFraction(v, anchor2) { if (anchor2 === "auto") { if (v < 1 / 3) anchor2 = "left"; else if (v > 2 / 3) anchor2 = "right"; else anchor2 = "center"; } return { center: 0, middle: 0, left: 0.5, bottom: -0.5, right: -0.5, top: 0.5 }[anchor2]; } var annotationIsOffscreen = false; var letters = ["x", "y"]; for (var i = 0; i < letters.length; i++) { var axLetter = letters[i]; var axRef = options[axLetter + "ref"] || axLetter; var tailRef = options["a" + axLetter + "ref"]; var ax = { x: xa2, y: ya2 }[axLetter]; var dimAngle = (textangle + (axLetter === "x" ? 0 : -90)) * Math.PI / 180; var annSizeFromWidth = outerWidth * Math.cos(dimAngle); var annSizeFromHeight = outerHeight * Math.sin(dimAngle); var annSize = Math.abs(annSizeFromWidth) + Math.abs(annSizeFromHeight); var anchor = options[axLetter + "anchor"]; var overallShift = options[axLetter + "shift"] * (axLetter === "x" ? 1 : -1); var posPx = annPosPx[axLetter]; var basePx; var textPadShift; var alignPosition; var autoAlignFraction; var textShift; var axRefType = Axes.getRefType(axRef); if (ax && axRefType !== "domain") { var posFraction = ax.r2fraction(options[axLetter]); if (posFraction < 0 || posFraction > 1) { if (tailRef === axRef) { posFraction = ax.r2fraction(options["a" + axLetter]); if (posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; } } else { annotationIsOffscreen = true; } } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; } else { var axRefTypeEqDomain = axRefType === "domain"; if (axLetter === "x") { alignPosition = options[axLetter]; basePx = axRefTypeEqDomain ? ax._offset + ax._length * alignPosition : basePx = gs2.l + gs2.w * alignPosition; } else { alignPosition = 1 - options[axLetter]; basePx = axRefTypeEqDomain ? ax._offset + ax._length * alignPosition : basePx = gs2.t + gs2.h * alignPosition; } autoAlignFraction = options.showarrow ? 0.5 : alignPosition; } if (options.showarrow) { posPx.head = basePx; var arrowLength = options["a" + axLetter]; textShift = annSizeFromWidth * shiftFraction(0.5, options.xanchor) - annSizeFromHeight * shiftFraction(0.5, options.yanchor); if (tailRef === axRef) { var tailRefType = Axes.getRefType(tailRef); if (tailRefType === "domain") { if (axLetter === "y") { arrowLength = 1 - arrowLength; } posPx.tail = ax._offset + ax._length * arrowLength; } else if (tailRefType === "paper") { if (axLetter === "y") { arrowLength = 1 - arrowLength; posPx.tail = gs2.t + gs2.h * arrowLength; } else { posPx.tail = gs2.l + gs2.w * arrowLength; } } else { posPx.tail = ax._offset + ax.r2p(arrowLength); } textPadShift = textShift; } else { posPx.tail = basePx + arrowLength; textPadShift = textShift + arrowLength; } posPx.text = posPx.tail + textShift; var maxPx = fullLayout[axLetter === "x" ? "width" : "height"]; if (axRef === "paper") { posPx.head = Lib.constrain(posPx.head, 1, maxPx - 1); } if (tailRef === "pixel") { var shiftPlus = -Math.max(posPx.tail - 3, posPx.text); var shiftMinus = Math.min(posPx.tail + 3, posPx.text) - maxPx; if (shiftPlus > 0) { posPx.tail += shiftPlus; posPx.text += shiftPlus; } else if (shiftMinus > 0) { posPx.tail -= shiftMinus; posPx.text -= shiftMinus; } } posPx.tail += overallShift; posPx.head += overallShift; } else { textShift = annSize * shiftFraction(autoAlignFraction, anchor); textPadShift = textShift; posPx.text = basePx + textShift; } posPx.text += overallShift; textShift += overallShift; textPadShift += overallShift; options["_" + axLetter + "padplus"] = annSize / 2 + textPadShift; options["_" + axLetter + "padminus"] = annSize / 2 - textPadShift; options["_" + axLetter + "size"] = annSize; options["_" + axLetter + "shift"] = textShift; } if (annotationIsOffscreen) { annTextGroupInner.remove(); return; } var xShift = 0; var yShift = 0; if (options.align !== "left") { xShift = (annWidth - textWidth) * (options.align === "center" ? 0.5 : 1); } if (options.valign !== "top") { yShift = (annHeight - textHeight) * (options.valign === "middle" ? 0.5 : 1); } if (hasMathjax) { mathjaxGroup.select("svg").attr({ x: borderfull + xShift - 1, y: borderfull + yShift }).call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd2); } else { var texty = borderfull + yShift - anntextBB.top; var textx = borderfull + xShift - anntextBB.left; annText.call(svgTextUtils.positionText, textx, texty).call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null, gd2); } annTextClip.select("rect").call( Drawing.setRect, borderfull, borderfull, annWidth, annHeight ); annTextBG.call( Drawing.setRect, borderwidth / 2, borderwidth / 2, outerWidth - borderwidth, outerHeight - borderwidth ); annTextGroupInner.call( Drawing.setTranslate, Math.round(annPosPx.x.text - outerWidth / 2), Math.round(annPosPx.y.text - outerHeight / 2) ); annTextGroup.attr({ transform: "rotate(" + textangle + "," + annPosPx.x.text + "," + annPosPx.y.text + ")" }); var drawArrow = function(dx, dy) { annGroup.selectAll(".annotation-arrow-g").remove(); var headX = annPosPx.x.head; var headY = annPosPx.y.head; var tailX = annPosPx.x.tail + dx; var tailY = annPosPx.y.tail + dy; var textX = annPosPx.x.text + dx; var textY = annPosPx.y.text + dy; var transform = Lib.rotationXYMatrix(textangle, textX, textY); var applyTransform = Lib.apply2DTransform(transform); var applyTransform2 = Lib.apply2DTransform2(transform); var width = +annTextBG.attr("width"); var height = +annTextBG.attr("height"); var xLeft = textX - 0.5 * width; var xRight = xLeft + width; var yTop = textY - 0.5 * height; var yBottom = yTop + height; var edges = [ [xLeft, yTop, xLeft, yBottom], [xLeft, yBottom, xRight, yBottom], [xRight, yBottom, xRight, yTop], [xRight, yTop, xLeft, yTop] ].map(applyTransform2); if (edges.reduce(function(a, x) { return a ^ !!Lib.segmentsIntersect( headX, headY, headX + 1e6, headY + 1e6, x[0], x[1], x[2], x[3] ); }, false)) { return; } edges.forEach(function(x) { var p = Lib.segmentsIntersect( tailX, tailY, headX, headY, x[0], x[1], x[2], x[3] ); if (p) { tailX = p.x; tailY = p.y; } }); var strokewidth = options.arrowwidth; var arrowColor = options.arrowcolor; var arrowSide = options.arrowside; var arrowGroup = annGroup.append("g").style({ opacity: Color.opacity(arrowColor) }).classed("annotation-arrow-g", true); var arrow = arrowGroup.append("path").attr("d", "M" + tailX + "," + tailY + "L" + headX + "," + headY).style("stroke-width", strokewidth + "px").call(Color.stroke, Color.rgb(arrowColor)); drawArrowHead(arrow, arrowSide, options); if (edits.annotationPosition && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if (options.standoff) { var arrowLength2 = Math.sqrt(Math.pow(headX - tailX, 2) + Math.pow(headY - tailY, 2)); arrowDragHeadX += options.standoff * (tailX - headX) / arrowLength2; arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength2; } var arrowDrag = arrowGroup.append("path").classed("annotation-arrow", true).classed("anndrag", true).classed("cursor-move", true).attr({ d: "M3,3H-3V-3H3ZM0,0L" + (tailX - arrowDragHeadX) + "," + (tailY - arrowDragHeadY), transform: strTranslate(arrowDragHeadX, arrowDragHeadY) }).style("stroke-width", strokewidth + 6 + "px").call(Color.stroke, "rgba(0,0,0,0)").call(Color.fill, "rgba(0,0,0,0)"); var annx0, anny0; dragElement.init({ element: arrowDrag.node(), gd: gd2, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); annx0 = pos.x; anny0 = pos.y; if (xa2 && xa2.autorange) { modifyBase(xa2._name + ".autorange", true); } if (ya2 && ya2.autorange) { modifyBase(ya2._name + ".autorange", true); } }, moveFn: function(dx2, dy2) { var annxy0 = applyTransform(annx0, anny0); var xcenter = annxy0[0] + dx2; var ycenter = annxy0[1] + dy2; annTextGroupInner.call(Drawing.setTranslate, xcenter, ycenter); modifyItem( "x", shiftPosition(xa2, dx2, "x", gs2, options) ); modifyItem( "y", shiftPosition(ya2, dy2, "y", gs2, options) ); if (options.axref === options.xref) { modifyItem("ax", shiftPosition(xa2, dx2, "ax", gs2, options)); } if (options.ayref === options.yref) { modifyItem("ay", shiftPosition(ya2, dy2, "ay", gs2, options)); } arrowGroup.attr("transform", strTranslate(dx2, dy2)); annTextGroup.attr({ transform: "rotate(" + textangle + "," + xcenter + "," + ycenter + ")" }); }, doneFn: function() { Registry.call("_guiRelayout", gd2, getUpdateObj()); var notesBox = document.querySelector(".js-notes-box-panel"); if (notesBox) notesBox.redraw(notesBox.selectedObj); } }); } }; if (options.showarrow) drawArrow(0, 0); if (editTextPosition) { var baseTextTransform; dragElement.init({ element: annTextGroupInner.node(), gd: gd2, prepFn: function() { baseTextTransform = annTextGroup.attr("transform"); }, moveFn: function(dx, dy) { var csr = "pointer"; if (options.showarrow) { if (options.axref === options.xref) { modifyItem("ax", shiftPosition(xa2, dx, "ax", gs2, options)); } else { modifyItem("ax", options.ax + dx); } if (options.ayref === options.yref) { modifyItem("ay", shiftPosition(ya2, dy, "ay", gs2.w, options)); } else { modifyItem("ay", options.ay + dy); } drawArrow(dx, dy); } else if (!subplotId) { var xUpdate, yUpdate; if (xa2) { xUpdate = shiftPosition(xa2, dx, "x", gs2, options); } else { var widthFraction = options._xsize / gs2.w; var xLeft = options.x + (options._xshift - options.xshift) / gs2.w - widthFraction / 2; xUpdate = dragElement.align( xLeft + dx / gs2.w, widthFraction, 0, 1, options.xanchor ); } if (ya2) { yUpdate = shiftPosition(ya2, dy, "y", gs2, options); } else { var heightFraction = options._ysize / gs2.h; var yBottom = options.y - (options._yshift + options.yshift) / gs2.h - heightFraction / 2; yUpdate = dragElement.align( yBottom - dy / gs2.h, heightFraction, 0, 1, options.yanchor ); } modifyItem("x", xUpdate); modifyItem("y", yUpdate); if (!xa2 || !ya2) { csr = dragElement.getCursor( xa2 ? 0.5 : xUpdate, ya2 ? 0.5 : yUpdate, options.xanchor, options.yanchor ); } } else return; annTextGroup.attr({ transform: strTranslate(dx, dy) + baseTextTransform }); setCursor(annTextGroupInner, csr); }, clickFn: function(_, initialEvent) { if (options.captureevents) { gd2.emit("plotly_clickannotation", makeEventData(initialEvent)); } }, doneFn: function() { setCursor(annTextGroupInner); Registry.call("_guiRelayout", gd2, getUpdateObj()); var notesBox = document.querySelector(".js-notes-box-panel"); if (notesBox) notesBox.redraw(notesBox.selectedObj); } }); } } if (edits.annotationText) { annText.call(svgTextUtils.makeEditable, { delegate: annTextGroupInner, gd: gd2 }).call(textLayout).on("edit", function(_text) { options.text = _text; this.call(textLayout); modifyItem("text", _text); if (xa2 && xa2.autorange) { modifyBase(xa2._name + ".autorange", true); } if (ya2 && ya2.autorange) { modifyBase(ya2._name + ".autorange", true); } Registry.call("_guiRelayout", gd2, getUpdateObj()); }); } else annText.call(textLayout); } } }); // node_modules/plotly.js/src/components/annotations/click.js var require_click2 = __commonJS({ "node_modules/plotly.js/src/components/annotations/click.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Registry = require_registry(); var arrayEditor = require_plot_template().arrayEditor; module2.exports = { hasClickToShow, onClick }; function hasClickToShow(gd2, hoverData) { var sets = getToggleSets(gd2, hoverData); return sets.on.length > 0 || sets.explicitOff.length > 0; } function onClick(gd2, hoverData) { var toggleSets = getToggleSets(gd2, hoverData); var onSet = toggleSets.on; var offSet = toggleSets.off.concat(toggleSets.explicitOff); var update = {}; var annotationsOut = gd2._fullLayout.annotations; var i, editHelpers; if (!(onSet.length || offSet.length)) return; for (i = 0; i < onSet.length; i++) { editHelpers = arrayEditor(gd2.layout, "annotations", annotationsOut[onSet[i]]); editHelpers.modifyItem("visible", true); Lib.extendFlat(update, editHelpers.getUpdateObj()); } for (i = 0; i < offSet.length; i++) { editHelpers = arrayEditor(gd2.layout, "annotations", annotationsOut[offSet[i]]); editHelpers.modifyItem("visible", false); Lib.extendFlat(update, editHelpers.getUpdateObj()); } return Registry.call("update", gd2, {}, update); } function getToggleSets(gd2, hoverData) { var annotations = gd2._fullLayout.annotations; var onSet = []; var offSet = []; var explicitOffSet = []; var hoverLen = (hoverData || []).length; var i, j, anni, showMode, pointj, xa2, ya2, toggleType; for (i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; if (showMode) { for (j = 0; j < hoverLen; j++) { pointj = hoverData[j]; xa2 = pointj.xaxis; ya2 = pointj.yaxis; if (xa2._id === anni.xref && ya2._id === anni.yref && xa2.d2r(pointj.x) === clickData2r(anni._xclick, xa2) && ya2.d2r(pointj.y) === clickData2r(anni._yclick, ya2)) { if (anni.visible) { if (showMode === "onout") toggleType = offSet; else toggleType = explicitOffSet; } else { toggleType = onSet; } toggleType.push(i); break; } } if (j === hoverLen) { if (anni.visible && showMode === "onout") offSet.push(i); } } } return { on: onSet, off: offSet, explicitOff: explicitOffSet }; } function clickData2r(d, ax) { return ax.type === "log" ? ax.l2r(d) : ax.d2r(d); } } }); // node_modules/plotly.js/src/components/annotations/common_defaults.js var require_common_defaults = __commonJS({ "node_modules/plotly.js/src/components/annotations/common_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Color = require_color(); module2.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { coerce("opacity"); var bgColor = coerce("bgcolor"); var borderColor = coerce("bordercolor"); var borderOpacity = Color.opacity(borderColor); coerce("borderpad"); var borderWidth = coerce("borderwidth"); var showArrow = coerce("showarrow"); coerce("text", showArrow ? " " : fullLayout._dfltTitle.annotation); coerce("textangle"); Lib.coerceFont(coerce, "font", fullLayout.font); coerce("width"); coerce("align"); var h = coerce("height"); if (h) coerce("valign"); if (showArrow) { var arrowside = coerce("arrowside"); var arrowhead; var arrowsize; if (arrowside.indexOf("end") !== -1) { arrowhead = coerce("arrowhead"); arrowsize = coerce("arrowsize"); } if (arrowside.indexOf("start") !== -1) { coerce("startarrowhead", arrowhead); coerce("startarrowsize", arrowsize); } coerce("arrowcolor", borderOpacity ? annOut.bordercolor : Color.defaultLine); coerce("arrowwidth", (borderOpacity && borderWidth || 1) * 2); coerce("standoff"); coerce("startstandoff"); } var hoverText = coerce("hovertext"); var globalHoverLabel = fullLayout.hoverlabel || {}; if (hoverText) { var hoverBG = coerce( "hoverlabel.bgcolor", globalHoverLabel.bgcolor || (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) ); var hoverBorder = coerce( "hoverlabel.bordercolor", globalHoverLabel.bordercolor || Color.contrast(hoverBG) ); var fontDflt = Lib.extendFlat({}, globalHoverLabel.font); if (!fontDflt.color) { fontDflt.color = hoverBorder; } Lib.coerceFont(coerce, "hoverlabel.font", fontDflt); } coerce("captureevents", !!hoverText); }; } }); // node_modules/plotly.js/src/components/annotations/defaults.js var require_defaults9 = __commonJS({ "node_modules/plotly.js/src/components/annotations/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var handleArrayContainerDefaults = require_array_container_defaults(); var handleAnnotationCommonDefaults = require_common_defaults(); var attributes = require_attributes11(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, { name: "annotations", handleItemDefaults: handleAnnotationDefaults }); }; function handleAnnotationDefaults(annIn, annOut, fullLayout) { function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } var visible = coerce("visible"); var clickToShow = coerce("clicktoshow"); if (!(visible || clickToShow)) return; handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); var showArrow = annOut.showarrow; var axLetters = ["x", "y"]; var arrowPosDflt = [-10, -30]; var gdMock = { _fullLayout: fullLayout }; for (var i = 0; i < 2; i++) { var axLetter = axLetters[i]; var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, "", "paper"); if (axRef !== "paper") { var ax = Axes.getFromId(gdMock, axRef); ax._annIndices.push(annOut._index); } Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5); if (showArrow) { var arrowPosAttr = "a" + axLetter; var aaxRef = Axes.coerceRef( annIn, annOut, gdMock, arrowPosAttr, "pixel", ["pixel", "paper"] ); if (aaxRef !== "pixel" && aaxRef !== axRef) { aaxRef = annOut[arrowPosAttr] = "pixel"; } var aDflt = aaxRef === "pixel" ? arrowPosDflt[i] : 0.4; Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt); } coerce(axLetter + "anchor"); coerce(axLetter + "shift"); } Lib.noneOrAll(annIn, annOut, ["x", "y"]); if (showArrow) { Lib.noneOrAll(annIn, annOut, ["ax", "ay"]); } if (clickToShow) { var xClick = coerce("xclick"); var yClick = coerce("yclick"); annOut._xclick = xClick === void 0 ? annOut.x : Axes.cleanPosition(xClick, gdMock, annOut.xref); annOut._yclick = yClick === void 0 ? annOut.y : Axes.cleanPosition(yClick, gdMock, annOut.yref); } } } }); // node_modules/plotly.js/src/components/annotations/calc_autorange.js var require_calc_autorange = __commonJS({ "node_modules/plotly.js/src/components/annotations/calc_autorange.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var draw = require_draw4().draw; module2.exports = function calcAutorange(gd2) { var fullLayout = gd2._fullLayout; var annotationList = Lib.filterVisible(fullLayout.annotations); if (annotationList.length && gd2._fullData.length) { return Lib.syncOrAsync([draw, annAutorange], gd2); } }; function annAutorange(gd2) { var fullLayout = gd2._fullLayout; Lib.filterVisible(fullLayout.annotations).forEach(function(ann) { var xa2 = Axes.getFromId(gd2, ann.xref); var ya2 = Axes.getFromId(gd2, ann.yref); var xRefType = Axes.getRefType(ann.xref); var yRefType = Axes.getRefType(ann.yref); ann._extremes = {}; if (xRefType === "range") calcAxisExpansion(ann, xa2); if (yRefType === "range") calcAxisExpansion(ann, ya2); }); } function calcAxisExpansion(ann, ax) { var axId = ax._id; var letter = axId.charAt(0); var pos = ann[letter]; var apos = ann["a" + letter]; var ref2 = ann[letter + "ref"]; var aref = ann["a" + letter + "ref"]; var padplus = ann["_" + letter + "padplus"]; var padminus = ann["_" + letter + "padminus"]; var shift = { x: 1, y: -1 }[letter] * ann[letter + "shift"]; var headSize = 3 * ann.arrowsize * ann.arrowwidth || 0; var headPlus = headSize + shift; var headMinus = headSize - shift; var startHeadSize = 3 * ann.startarrowsize * ann.arrowwidth || 0; var startHeadPlus = startHeadSize + shift; var startHeadMinus = startHeadSize - shift; var extremes; if (aref === ref2) { var extremeArrowHead = Axes.findExtremes(ax, [ax.r2c(pos)], { ppadplus: headPlus, ppadminus: headMinus }); var extremeText = Axes.findExtremes(ax, [ax.r2c(apos)], { ppadplus: Math.max(padplus, startHeadPlus), ppadminus: Math.max(padminus, startHeadMinus) }); extremes = { min: [extremeArrowHead.min[0], extremeText.min[0]], max: [extremeArrowHead.max[0], extremeText.max[0]] }; } else { startHeadPlus = apos ? startHeadPlus + apos : startHeadPlus; startHeadMinus = apos ? startHeadMinus - apos : startHeadMinus; extremes = Axes.findExtremes(ax, [ax.r2c(pos)], { ppadplus: Math.max(padplus, headPlus, startHeadPlus), ppadminus: Math.max(padminus, headMinus, startHeadMinus) }); } ann._extremes[axId] = extremes; } } }); // node_modules/plotly.js/src/components/annotations/convert_coords.js var require_convert_coords = __commonJS({ "node_modules/plotly.js/src/components/annotations/convert_coords.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var toLogRange = require_to_log_range(); module2.exports = function convertCoords(gd2, ax, newType, doExtra) { ax = ax || {}; var toLog = newType === "log" && ax.type === "linear"; var fromLog = newType === "linear" && ax.type === "log"; if (!(toLog || fromLog)) return; var annotations = gd2._fullLayout.annotations; var axLetter = ax._id.charAt(0); var ann; var attrPrefix; function convert(attr) { var currentVal = ann[attr]; var newVal = null; if (toLog) newVal = toLogRange(currentVal, ax.range); else newVal = Math.pow(10, currentVal); if (!isNumeric(newVal)) newVal = null; doExtra(attrPrefix + attr, newVal); } for (var i = 0; i < annotations.length; i++) { ann = annotations[i]; attrPrefix = "annotations[" + i + "]."; if (ann[axLetter + "ref"] === ax._id) convert(axLetter); if (ann["a" + axLetter + "ref"] === ax._id) convert("a" + axLetter); } }; } }); // node_modules/plotly.js/src/components/annotations/index.js var require_annotations = __commonJS({ "node_modules/plotly.js/src/components/annotations/index.js"(exports2, module2) { "use strict"; var drawModule = require_draw4(); var clickModule = require_click2(); module2.exports = { moduleType: "component", name: "annotations", layoutAttributes: require_attributes11(), supplyLayoutDefaults: require_defaults9(), includeBasePlot: require_include_components()("annotations"), calcAutorange: require_calc_autorange(), draw: drawModule.draw, drawOne: drawModule.drawOne, drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, convertCoords: require_convert_coords() }; } }); // node_modules/plotly.js/src/components/annotations3d/attributes.js var require_attributes15 = __commonJS({ "node_modules/plotly.js/src/components/annotations3d/attributes.js"(exports2, module2) { "use strict"; var annAttrs = require_attributes11(); var overrideAll = require_edit_types().overrideAll; var templatedArray = require_plot_template().templatedArray; module2.exports = overrideAll(templatedArray("annotation", { visible: annAttrs.visible, x: { valType: "any", description: [ "Sets the annotation's x position." ].join(" ") }, y: { valType: "any", description: [ "Sets the annotation's y position." ].join(" ") }, z: { valType: "any", description: [ "Sets the annotation's z position." ].join(" ") }, ax: { valType: "number", description: [ "Sets the x component of the arrow tail about the arrow head (in pixels)." ].join(" ") }, ay: { valType: "number", description: [ "Sets the y component of the arrow tail about the arrow head (in pixels)." ].join(" ") }, xanchor: annAttrs.xanchor, xshift: annAttrs.xshift, yanchor: annAttrs.yanchor, yshift: annAttrs.yshift, text: annAttrs.text, textangle: annAttrs.textangle, font: annAttrs.font, width: annAttrs.width, height: annAttrs.height, opacity: annAttrs.opacity, align: annAttrs.align, valign: annAttrs.valign, bgcolor: annAttrs.bgcolor, bordercolor: annAttrs.bordercolor, borderpad: annAttrs.borderpad, borderwidth: annAttrs.borderwidth, showarrow: annAttrs.showarrow, arrowcolor: annAttrs.arrowcolor, arrowhead: annAttrs.arrowhead, startarrowhead: annAttrs.startarrowhead, arrowside: annAttrs.arrowside, arrowsize: annAttrs.arrowsize, startarrowsize: annAttrs.startarrowsize, arrowwidth: annAttrs.arrowwidth, standoff: annAttrs.standoff, startstandoff: annAttrs.startstandoff, hovertext: annAttrs.hovertext, hoverlabel: annAttrs.hoverlabel, captureevents: annAttrs.captureevents // maybes later? // clicktoshow: annAttrs.clicktoshow, // xclick: annAttrs.xclick, // yclick: annAttrs.yclick, // not needed! // axref: 'pixel' // ayref: 'pixel' // xref: 'x' // yref: 'y // zref: 'z' }), "calc", "from-root"); } }); // node_modules/plotly.js/src/components/annotations3d/defaults.js var require_defaults10 = __commonJS({ "node_modules/plotly.js/src/components/annotations3d/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var handleArrayContainerDefaults = require_array_container_defaults(); var handleAnnotationCommonDefaults = require_common_defaults(); var attributes = require_attributes15(); module2.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { name: "annotations", handleItemDefaults: handleAnnotationDefaults, fullLayout: opts.fullLayout }); }; function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts) { function coerce(attr, dflt) { return Lib.coerce(annIn, annOut, attributes, attr, dflt); } function coercePosition(axLetter) { var axName = axLetter + "axis"; var gdMock = { _fullLayout: {} }; gdMock._fullLayout[axName] = sceneLayout[axName]; return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); } var visible = coerce("visible"); if (!visible) return; handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); coercePosition("x"); coercePosition("y"); coercePosition("z"); Lib.noneOrAll(annIn, annOut, ["x", "y", "z"]); annOut.xref = "x"; annOut.yref = "y"; annOut.zref = "z"; coerce("xanchor"); coerce("yanchor"); coerce("xshift"); coerce("yshift"); if (annOut.showarrow) { annOut.axref = "pixel"; annOut.ayref = "pixel"; coerce("ax", -10); coerce("ay", -30); Lib.noneOrAll(annIn, annOut, ["ax", "ay"]); } } } }); // node_modules/plotly.js/src/components/annotations3d/convert.js var require_convert = __commonJS({ "node_modules/plotly.js/src/components/annotations3d/convert.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); module2.exports = function convert(scene) { var fullSceneLayout = scene.fullSceneLayout; var anns = fullSceneLayout.annotations; for (var i = 0; i < anns.length; i++) { mockAnnAxes(anns[i], scene); } scene.fullLayout._infolayer.selectAll(".annotation-" + scene.id).remove(); }; function mockAnnAxes(ann, scene) { var fullSceneLayout = scene.fullSceneLayout; var domain = fullSceneLayout.domain; var size = scene.fullLayout._size; var base = { // this gets fill in on render pdata: null, // to get setConvert to not execute cleanly type: "linear", // don't try to update them on `editable: true` autorange: false, // set infinite range so that annotation draw routine // does not try to remove 'outside-range' annotations, // this case is handled in the render loop range: [-Infinity, Infinity] }; ann._xa = {}; Lib.extendFlat(ann._xa, base); Axes.setConvert(ann._xa); ann._xa._offset = size.l + domain.x[0] * size.w; ann._xa.l2p = function() { return 0.5 * (1 + ann._pdata[0] / ann._pdata[3]) * size.w * (domain.x[1] - domain.x[0]); }; ann._ya = {}; Lib.extendFlat(ann._ya, base); Axes.setConvert(ann._ya); ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; ann._ya.l2p = function() { return 0.5 * (1 - ann._pdata[1] / ann._pdata[3]) * size.h * (domain.y[1] - domain.y[0]); }; } } }); // node_modules/plotly.js/src/plots/gl3d/project.js var require_project = __commonJS({ "node_modules/plotly.js/src/plots/gl3d/project.js"(exports2, module2) { "use strict"; function xformMatrix(m, v) { var out = [0, 0, 0, 0]; var i, j; for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) { out[j] += m[4 * i + j] * v[i]; } } return out; } function project(camera, v) { var p = xformMatrix( camera.projection, xformMatrix( camera.view, xformMatrix(camera.model, [v[0], v[1], v[2], 1]) ) ); return p; } module2.exports = project; } }); // node_modules/plotly.js/src/components/annotations3d/draw.js var require_draw5 = __commonJS({ "node_modules/plotly.js/src/components/annotations3d/draw.js"(exports2, module2) { "use strict"; var drawRaw = require_draw4().drawRaw; var project = require_project(); var axLetters = ["x", "y", "z"]; module2.exports = function draw(scene) { var fullSceneLayout = scene.fullSceneLayout; var dataScale = scene.dataScale; var anns = fullSceneLayout.annotations; for (var i = 0; i < anns.length; i++) { var ann = anns[i]; var annotationIsOffscreen = false; for (var j = 0; j < 3; j++) { var axLetter = axLetters[j]; var pos = ann[axLetter]; var ax = fullSceneLayout[axLetter + "axis"]; var posFraction = ax.r2fraction(pos); if (posFraction < 0 || posFraction > 1) { annotationIsOffscreen = true; break; } } if (annotationIsOffscreen) { scene.fullLayout._infolayer.select(".annotation-" + scene.id + '[data-index="' + i + '"]').remove(); } else { ann._pdata = project(scene.glplot.cameraParams, [ fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] ]); drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); } } }; } }); // node_modules/plotly.js/src/components/annotations3d/index.js var require_annotations3d = __commonJS({ "node_modules/plotly.js/src/components/annotations3d/index.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); module2.exports = { moduleType: "component", name: "annotations3d", schema: { subplots: { scene: { annotations: require_attributes15() } } }, layoutAttributes: require_attributes15(), handleDefaults: require_defaults10(), includeBasePlot: includeGL3D, convert: require_convert(), draw: require_draw5() }; function includeGL3D(layoutIn, layoutOut) { var GL3D = Registry.subplotsRegistry.gl3d; if (!GL3D) return; var attrRegex = GL3D.attrRegex; var keys = Object.keys(layoutIn); for (var i = 0; i < keys.length; i++) { var k = keys[i]; if (attrRegex.test(k) && (layoutIn[k].annotations || []).length) { Lib.pushUnique(layoutOut._basePlotModules, GL3D); Lib.pushUnique(layoutOut._subplots.gl3d, k); } } } } }); // node_modules/plotly.js/src/components/shapes/attributes.js var require_attributes16 = __commonJS({ "node_modules/plotly.js/src/components/shapes/attributes.js"(exports2, module2) { "use strict"; var annAttrs = require_attributes11(); var fontAttrs = require_font_attributes(); var scatterLineAttrs = require_attributes12().line; var dash = require_attributes4().dash; var extendFlat = require_extend().extendFlat; var templatedArray = require_plot_template().templatedArray; var axisPlaceableObjs = require_axis_placeable_objects(); var basePlotAttributes = require_attributes2(); var shapeTexttemplateAttrs = require_template_attributes().shapeTexttemplateAttrs; var shapeLabelTexttemplateVars = require_label_texttemplate(); module2.exports = templatedArray("shape", { visible: extendFlat({}, basePlotAttributes.visible, { editType: "calc+arraydraw", description: [ "Determines whether or not this shape is visible.", "If *legendonly*, the shape is not drawn,", "but can appear as a legend item", "(provided that the legend itself is visible)." ].join(" ") }), showlegend: { valType: "boolean", dflt: false, editType: "calc+arraydraw", description: [ "Determines whether or not this", "shape is shown in the legend." ].join(" ") }, legend: extendFlat({}, basePlotAttributes.legend, { editType: "calc+arraydraw", description: [ "Sets the reference to a legend to show this shape in.", "References to these legends are *legend*, *legend2*, *legend3*, etc.", "Settings for these legends are set in the layout, under", "`layout.legend`, `layout.legend2`, etc." ].join(" ") }), legendgroup: extendFlat({}, basePlotAttributes.legendgroup, { editType: "calc+arraydraw", description: [ "Sets the legend group for this shape.", "Traces and shapes part of the same legend group hide/show at the same time", "when toggling legend items." ].join(" ") }), legendgrouptitle: { text: extendFlat({}, basePlotAttributes.legendgrouptitle.text, { editType: "calc+arraydraw" }), font: fontAttrs({ editType: "calc+arraydraw", description: [ "Sets this legend group's title font." ].join(" ") }), editType: "calc+arraydraw" }, legendrank: extendFlat({}, basePlotAttributes.legendrank, { editType: "calc+arraydraw", description: [ "Sets the legend rank for this shape.", "Items and groups with smaller ranks are presented on top/left side while", "with *reversed* `legend.traceorder` they are on bottom/right side.", "The default legendrank is 1000,", "so that you can use ranks less than 1000 to place certain items before all unranked items,", "and ranks greater than 1000 to go after all unranked items.", "When having unranked or equal rank items shapes would be displayed after traces", "i.e. according to their order in data and layout." ].join(" ") }), legendwidth: extendFlat({}, basePlotAttributes.legendwidth, { editType: "calc+arraydraw", description: "Sets the width (in px or fraction) of the legend for this shape." }), type: { valType: "enumerated", values: ["circle", "rect", "path", "line"], editType: "calc+arraydraw", description: [ "Specifies the shape type to be drawn.", "If *line*, a line is drawn from (`x0`,`y0`) to (`x1`,`y1`)", "with respect to the axes' sizing mode.", "If *circle*, a circle is drawn from", "((`x0`+`x1`)/2, (`y0`+`y1`)/2))", "with radius", "(|(`x0`+`x1`)/2 - `x0`|, |(`y0`+`y1`)/2 -`y0`)|)", "with respect to the axes' sizing mode.", "If *rect*, a rectangle is drawn linking", "(`x0`,`y0`), (`x1`,`y0`), (`x1`,`y1`), (`x0`,`y1`), (`x0`,`y0`)", "with respect to the axes' sizing mode.", "If *path*, draw a custom SVG path using `path`.", "with respect to the axes' sizing mode." ].join(" ") }, layer: { valType: "enumerated", values: ["below", "above", "between"], dflt: "above", editType: "arraydraw", description: [ "Specifies whether shapes are drawn below gridlines (*below*),", "between gridlines and traces (*between*) or above traces (*above*)." ].join(" ") }, xref: extendFlat({}, annAttrs.xref, { description: [ "Sets the shape's x coordinate axis.", axisPlaceableObjs.axisRefDescription("x", "left", "right") ].join(" ") }), xsizemode: { valType: "enumerated", values: ["scaled", "pixel"], dflt: "scaled", editType: "calc+arraydraw", description: [ "Sets the shapes's sizing mode along the x axis.", "If set to *scaled*, `x0`, `x1` and x coordinates within `path` refer to", "data values on the x axis or a fraction of the plot area's width", "(`xref` set to *paper*).", "If set to *pixel*, `xanchor` specifies the x position in terms", "of data or plot fraction but `x0`, `x1` and x coordinates within `path`", "are pixels relative to `xanchor`. This way, the shape can have", "a fixed width while maintaining a position relative to data or", "plot fraction." ].join(" ") }, xanchor: { valType: "any", editType: "calc+arraydraw", description: [ "Only relevant in conjunction with `xsizemode` set to *pixel*.", "Specifies the anchor point on the x axis to which `x0`, `x1`", "and x coordinates within `path` are relative to.", "E.g. useful to attach a pixel sized shape to a certain data value.", "No effect when `xsizemode` not set to *pixel*." ].join(" ") }, x0: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the shape's starting x position.", "See `type` and `xsizemode` for more info." ].join(" ") }, x1: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the shape's end x position.", "See `type` and `xsizemode` for more info." ].join(" ") }, x0shift: { valType: "number", dflt: 0, min: -1, max: 1, editType: "calc", description: [ "Shifts `x0` away from the center of the category when `xref` is a *category* or", "*multicategory* axis. -0.5 corresponds to the start of the category and 0.5", "corresponds to the end of the category." ].join(" ") }, x1shift: { valType: "number", dflt: 0, min: -1, max: 1, editType: "calc", description: [ "Shifts `x1` away from the center of the category when `xref` is a *category* or", "*multicategory* axis. -0.5 corresponds to the start of the category and 0.5", "corresponds to the end of the category." ].join(" ") }, yref: extendFlat({}, annAttrs.yref, { description: [ "Sets the shape's y coordinate axis.", axisPlaceableObjs.axisRefDescription("y", "bottom", "top") ].join(" ") }), ysizemode: { valType: "enumerated", values: ["scaled", "pixel"], dflt: "scaled", editType: "calc+arraydraw", description: [ "Sets the shapes's sizing mode along the y axis.", "If set to *scaled*, `y0`, `y1` and y coordinates within `path` refer to", "data values on the y axis or a fraction of the plot area's height", "(`yref` set to *paper*).", "If set to *pixel*, `yanchor` specifies the y position in terms", "of data or plot fraction but `y0`, `y1` and y coordinates within `path`", "are pixels relative to `yanchor`. This way, the shape can have", "a fixed height while maintaining a position relative to data or", "plot fraction." ].join(" ") }, yanchor: { valType: "any", editType: "calc+arraydraw", description: [ "Only relevant in conjunction with `ysizemode` set to *pixel*.", "Specifies the anchor point on the y axis to which `y0`, `y1`", "and y coordinates within `path` are relative to.", "E.g. useful to attach a pixel sized shape to a certain data value.", "No effect when `ysizemode` not set to *pixel*." ].join(" ") }, y0: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the shape's starting y position.", "See `type` and `ysizemode` for more info." ].join(" ") }, y1: { valType: "any", editType: "calc+arraydraw", description: [ "Sets the shape's end y position.", "See `type` and `ysizemode` for more info." ].join(" ") }, y0shift: { valType: "number", dflt: 0, min: -1, max: 1, editType: "calc", description: [ "Shifts `y0` away from the center of the category when `yref` is a *category* or", "*multicategory* axis. -0.5 corresponds to the start of the category and 0.5", "corresponds to the end of the category." ].join(" ") }, y1shift: { valType: "number", dflt: 0, min: -1, max: 1, editType: "calc", description: [ "Shifts `y1` away from the center of the category when `yref` is a *category* or", "*multicategory* axis. -0.5 corresponds to the start of the category and 0.5", "corresponds to the end of the category." ].join(" ") }, path: { valType: "string", editType: "calc+arraydraw", description: [ "For `type` *path* - a valid SVG path with the pixel values", "replaced by data values in `xsizemode`/`ysizemode` being *scaled*", "and taken unmodified as pixels relative to `xanchor` and `yanchor`", "in case of *pixel* size mode.", "There are a few restrictions / quirks", "only absolute instructions, not relative. So the allowed segments", "are: M, L, H, V, Q, C, T, S, and Z", "arcs (A) are not allowed because radius rx and ry are relative.", "In the future we could consider supporting relative commands,", "but we would have to decide on how to handle date and log axes.", "Note that even as is, Q and C Bezier paths that are smooth on", "linear axes may not be smooth on log, and vice versa.", 'no chained "polybezier" commands - specify the segment type for', "each one.", "On category axes, values are numbers scaled to the serial numbers", "of categories because using the categories themselves there would", "be no way to describe fractional positions", "On data axes: because space and T are both normal components of path", "strings, we can't use either to separate date from time parts.", "Therefore we'll use underscore for this purpose:", "2015-02-21_13:45:56.789" ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw", description: "Sets the opacity of the shape." }, line: { color: extendFlat({}, scatterLineAttrs.color, { editType: "arraydraw" }), width: extendFlat({}, scatterLineAttrs.width, { editType: "calc+arraydraw" }), dash: extendFlat({}, dash, { editType: "arraydraw" }), editType: "calc+arraydraw" }, fillcolor: { valType: "color", dflt: "rgba(0,0,0,0)", editType: "arraydraw", description: [ "Sets the color filling the shape's interior. Only applies to closed shapes." ].join(" ") }, fillrule: { valType: "enumerated", values: ["evenodd", "nonzero"], dflt: "evenodd", editType: "arraydraw", description: [ "Determines which regions of complex paths constitute the interior.", "For more info please visit https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule" ].join(" ") }, editable: { valType: "boolean", dflt: false, editType: "calc+arraydraw", description: [ "Determines whether the shape could be activated for edit or not.", "Has no effect when the older editable shapes mode is enabled via", "`config.editable` or `config.edits.shapePosition`." ].join(" ") }, label: { text: { valType: "string", dflt: "", editType: "arraydraw", description: [ "Sets the text to display with shape.", "It is also used for legend item if `name` is not provided." ].join(" ") }, texttemplate: shapeTexttemplateAttrs({}, { keys: Object.keys(shapeLabelTexttemplateVars) }), font: fontAttrs({ editType: "calc+arraydraw", colorEditType: "arraydraw", description: "Sets the shape label text font." }), textposition: { valType: "enumerated", values: [ "top left", "top center", "top right", "middle left", "middle center", "middle right", "bottom left", "bottom center", "bottom right", "start", "middle", "end" ], editType: "arraydraw", description: [ "Sets the position of the label text relative to the shape.", "Supported values for rectangles, circles and paths are", "*top left*, *top center*, *top right*, *middle left*,", "*middle center*, *middle right*, *bottom left*, *bottom center*,", "and *bottom right*.", "Supported values for lines are *start*, *middle*, and *end*.", "Default: *middle center* for rectangles, circles, and paths; *middle* for lines." ].join(" ") }, textangle: { valType: "angle", dflt: "auto", editType: "calc+arraydraw", description: [ "Sets the angle at which the label text is drawn", "with respect to the horizontal. For lines, angle *auto*", "is the same angle as the line. For all other shapes,", "angle *auto* is horizontal." ].join(" ") }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "auto", editType: "calc+arraydraw", description: [ "Sets the label's horizontal position anchor", "This anchor binds the specified `textposition` to the *left*, *center*", "or *right* of the label text.", "For example, if `textposition` is set to *top right* and", "`xanchor` to *right* then the right-most portion of the", "label text lines up with the right-most edge of the", "shape." ].join(" ") }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"], editType: "calc+arraydraw", description: [ "Sets the label's vertical position anchor", "This anchor binds the specified `textposition` to the *top*, *middle*", "or *bottom* of the label text.", "For example, if `textposition` is set to *top right* and", "`yanchor` to *top* then the top-most portion of the", "label text lines up with the top-most edge of the", "shape." ].join(" ") }, padding: { valType: "number", dflt: 3, min: 0, editType: "arraydraw", description: "Sets padding (in px) between edge of label and edge of shape." }, editType: "arraydraw" }, editType: "arraydraw" }); } }); // node_modules/plotly.js/src/components/shapes/defaults.js var require_defaults11 = __commonJS({ "node_modules/plotly.js/src/components/shapes/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes16(); var helpers = require_helpers8(); module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, { name: "shapes", handleItemDefaults: handleShapeDefaults }); }; function dfltLabelYanchor(isLine, labelTextPosition) { return isLine ? "bottom" : labelTextPosition.indexOf("top") !== -1 ? "top" : labelTextPosition.indexOf("bottom") !== -1 ? "bottom" : "middle"; } function handleShapeDefaults(shapeIn, shapeOut, fullLayout) { function coerce(attr, dflt) { return Lib.coerce(shapeIn, shapeOut, attributes, attr, dflt); } shapeOut._isShape = true; var visible = coerce("visible"); if (!visible) return; var showlegend = coerce("showlegend"); if (showlegend) { coerce("legend"); coerce("legendwidth"); coerce("legendgroup"); coerce("legendgrouptitle.text"); Lib.coerceFont(coerce, "legendgrouptitle.font"); coerce("legendrank"); } var path = coerce("path"); var dfltType = path ? "path" : "rect"; var shapeType = coerce("type", dfltType); var noPath = shapeType !== "path"; if (noPath) delete shapeOut.path; coerce("editable"); coerce("layer"); coerce("opacity"); coerce("fillcolor"); coerce("fillrule"); var lineWidth = coerce("line.width"); if (lineWidth) { coerce("line.color"); coerce("line.dash"); } var xSizeMode = coerce("xsizemode"); var ySizeMode = coerce("ysizemode"); var axLetters = ["x", "y"]; for (var i = 0; i < 2; i++) { var axLetter = axLetters[i]; var attrAnchor = axLetter + "anchor"; var sizeMode = axLetter === "x" ? xSizeMode : ySizeMode; var gdMock = { _fullLayout: fullLayout }; var ax; var pos2r; var r2pos; var axRef = Axes.coerceRef( shapeIn, shapeOut, gdMock, axLetter, void 0, "paper" ); var axRefType = Axes.getRefType(axRef); if (axRefType === "range") { ax = Axes.getFromId(gdMock, axRef); ax._shapeIndices.push(shapeOut._index); r2pos = helpers.rangeToShapePosition(ax); pos2r = helpers.shapePositionToRange(ax); if (ax.type === "category" || ax.type === "multicategory") { coerce(axLetter + "0shift"); coerce(axLetter + "1shift"); } } else { pos2r = r2pos = Lib.identity; } if (noPath) { var dflt0 = 0.25; var dflt1 = 0.75; var attr0 = axLetter + "0"; var attr1 = axLetter + "1"; var in0 = shapeIn[attr0]; var in1 = shapeIn[attr1]; shapeIn[attr0] = pos2r(shapeIn[attr0], true); shapeIn[attr1] = pos2r(shapeIn[attr1], true); if (sizeMode === "pixel") { coerce(attr0, 0); coerce(attr1, 10); } else { Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr0, dflt0); Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attr1, dflt1); } shapeOut[attr0] = r2pos(shapeOut[attr0]); shapeOut[attr1] = r2pos(shapeOut[attr1]); shapeIn[attr0] = in0; shapeIn[attr1] = in1; } if (sizeMode === "pixel") { var inAnchor = shapeIn[attrAnchor]; shapeIn[attrAnchor] = pos2r(shapeIn[attrAnchor], true); Axes.coercePosition(shapeOut, gdMock, coerce, axRef, attrAnchor, 0.25); shapeOut[attrAnchor] = r2pos(shapeOut[attrAnchor]); shapeIn[attrAnchor] = inAnchor; } } if (noPath) { Lib.noneOrAll(shapeIn, shapeOut, ["x0", "x1", "y0", "y1"]); } var isLine = shapeType === "line"; var labelTextTemplate, labelText; if (noPath) { labelTextTemplate = coerce("label.texttemplate"); } if (!labelTextTemplate) { labelText = coerce("label.text"); } if (labelText || labelTextTemplate) { coerce("label.textangle"); var labelTextPosition = coerce("label.textposition", isLine ? "middle" : "middle center"); coerce("label.xanchor"); coerce("label.yanchor", dfltLabelYanchor(isLine, labelTextPosition)); coerce("label.padding"); Lib.coerceFont(coerce, "label.font", fullLayout.font); } } } }); // node_modules/plotly.js/src/components/shapes/draw_newshape/defaults.js var require_defaults12 = __commonJS({ "node_modules/plotly.js/src/components/shapes/draw_newshape/defaults.js"(exports2, module2) { "use strict"; var Color = require_color(); var Lib = require_lib(); function dfltLabelYanchor(isLine, labelTextPosition) { return isLine ? "bottom" : labelTextPosition.indexOf("top") !== -1 ? "top" : labelTextPosition.indexOf("bottom") !== -1 ? "bottom" : "middle"; } module2.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce) { coerce("newshape.visible"); coerce("newshape.name"); coerce("newshape.showlegend"); coerce("newshape.legend"); coerce("newshape.legendwidth"); coerce("newshape.legendgroup"); coerce("newshape.legendgrouptitle.text"); Lib.coerceFont(coerce, "newshape.legendgrouptitle.font"); coerce("newshape.legendrank"); coerce("newshape.drawdirection"); coerce("newshape.layer"); coerce("newshape.fillcolor"); coerce("newshape.fillrule"); coerce("newshape.opacity"); var newshapeLineWidth = coerce("newshape.line.width"); if (newshapeLineWidth) { var bgcolor = (layoutIn || {}).plot_bgcolor || "#FFF"; coerce("newshape.line.color", Color.contrast(bgcolor)); coerce("newshape.line.dash"); } var isLine = layoutIn.dragmode === "drawline"; var labelText = coerce("newshape.label.text"); var labelTextTemplate = coerce("newshape.label.texttemplate"); if (labelText || labelTextTemplate) { coerce("newshape.label.textangle"); var labelTextPosition = coerce("newshape.label.textposition", isLine ? "middle" : "middle center"); coerce("newshape.label.xanchor"); coerce("newshape.label.yanchor", dfltLabelYanchor(isLine, labelTextPosition)); coerce("newshape.label.padding"); Lib.coerceFont(coerce, "newshape.label.font", layoutOut.font); } coerce("activeshape.fillcolor"); coerce("activeshape.opacity"); }; } }); // node_modules/plotly.js/src/components/shapes/calc_autorange.js var require_calc_autorange2 = __commonJS({ "node_modules/plotly.js/src/components/shapes/calc_autorange.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var constants = require_constants5(); var helpers = require_helpers8(); module2.exports = function calcAutorange(gd2) { var fullLayout = gd2._fullLayout; var shapeList = Lib.filterVisible(fullLayout.shapes); if (!shapeList.length || !gd2._fullData.length) return; for (var i = 0; i < shapeList.length; i++) { var shape = shapeList[i]; shape._extremes = {}; var ax; var bounds; var xRefType = Axes.getRefType(shape.xref); var yRefType = Axes.getRefType(shape.yref); if (shape.xref !== "paper" && xRefType !== "domain") { ax = Axes.getFromId(gd2, shape.xref); bounds = shapeBounds(ax, shape, constants.paramIsX); if (bounds) { shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcXPaddingOptions(shape)); } } if (shape.yref !== "paper" && yRefType !== "domain") { ax = Axes.getFromId(gd2, shape.yref); bounds = shapeBounds(ax, shape, constants.paramIsY); if (bounds) { shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcYPaddingOptions(shape)); } } } }; function calcXPaddingOptions(shape) { return calcPaddingOptions(shape.line.width, shape.xsizemode, shape.x0, shape.x1, shape.path, false); } function calcYPaddingOptions(shape) { return calcPaddingOptions(shape.line.width, shape.ysizemode, shape.y0, shape.y1, shape.path, true); } function calcPaddingOptions(lineWidth, sizeMode, v02, v12, path, isYAxis) { var ppad = lineWidth / 2; var axisDirectionReverted = isYAxis; if (sizeMode === "pixel") { var coords = path ? helpers.extractPathCoords(path, isYAxis ? constants.paramIsY : constants.paramIsX) : [v02, v12]; var maxValue = Lib.aggNums(Math.max, null, coords); var minValue = Lib.aggNums(Math.min, null, coords); var beforePad = minValue < 0 ? Math.abs(minValue) + ppad : ppad; var afterPad = maxValue > 0 ? maxValue + ppad : ppad; return { ppad, ppadplus: axisDirectionReverted ? beforePad : afterPad, ppadminus: axisDirectionReverted ? afterPad : beforePad }; } else { return { ppad }; } } function shapeBounds(ax, shape, paramsToUse) { var dim = ax._id.charAt(0) === "x" ? "x" : "y"; var isCategory = ax.type === "category" || ax.type === "multicategory"; var v02; var v12; var shiftStart = 0; var shiftEnd = 0; var convertVal = isCategory ? ax.r2c : ax.d2c; var isSizeModeScale = shape[dim + "sizemode"] === "scaled"; if (isSizeModeScale) { v02 = shape[dim + "0"]; v12 = shape[dim + "1"]; if (isCategory) { shiftStart = shape[dim + "0shift"]; shiftEnd = shape[dim + "1shift"]; } } else { v02 = shape[dim + "anchor"]; v12 = shape[dim + "anchor"]; } if (v02 !== void 0) return [convertVal(v02) + shiftStart, convertVal(v12) + shiftEnd]; if (!shape.path) return; var min = Infinity; var max = -Infinity; var segments = shape.path.match(constants.segmentRE); var i; var segment; var drawnParam; var params; var val; if (ax.type === "date") convertVal = helpers.decodeDate(convertVal); for (i = 0; i < segments.length; i++) { segment = segments[i]; drawnParam = paramsToUse[segment.charAt(0)].drawn; if (drawnParam === void 0) continue; params = segments[i].substr(1).match(constants.paramRE); if (!params || params.length < drawnParam) continue; val = convertVal(params[drawnParam]); if (val < min) min = val; if (val > max) max = val; } if (max >= min) return [min, max]; } } }); // node_modules/plotly.js/src/components/shapes/index.js var require_shapes = __commonJS({ "node_modules/plotly.js/src/components/shapes/index.js"(exports2, module2) { "use strict"; var drawModule = require_draw2(); module2.exports = { moduleType: "component", name: "shapes", layoutAttributes: require_attributes16(), supplyLayoutDefaults: require_defaults11(), supplyDrawNewShapeDefaults: require_defaults12(), includeBasePlot: require_include_components()("shapes"), calcAutorange: require_calc_autorange2(), draw: drawModule.draw, drawOne: drawModule.drawOne }; } }); // node_modules/plotly.js/src/components/images/attributes.js var require_attributes17 = __commonJS({ "node_modules/plotly.js/src/components/images/attributes.js"(exports2, module2) { "use strict"; var cartesianConstants = require_constants2(); var templatedArray = require_plot_template().templatedArray; var axisPlaceableObjs = require_axis_placeable_objects(); module2.exports = templatedArray("image", { visible: { valType: "boolean", dflt: true, editType: "arraydraw", description: [ "Determines whether or not this image is visible." ].join(" ") }, source: { valType: "string", editType: "arraydraw", description: [ "Specifies the URL of the image to be used.", "The URL must be accessible from the domain where the", "plot code is run, and can be either relative or absolute." ].join(" ") }, layer: { valType: "enumerated", values: ["below", "above"], dflt: "above", editType: "arraydraw", description: [ "Specifies whether images are drawn below or above traces.", "When `xref` and `yref` are both set to `paper`,", "image is drawn below the entire plot area." ].join(" ") }, sizex: { valType: "number", dflt: 0, editType: "arraydraw", description: [ "Sets the image container size horizontally.", "The image will be sized based on the `position` value.", "When `xref` is set to `paper`, units are sized relative", "to the plot width.", "When `xref` ends with ` domain`, units are sized relative", "to the axis width." ].join(" ") }, sizey: { valType: "number", dflt: 0, editType: "arraydraw", description: [ "Sets the image container size vertically.", "The image will be sized based on the `position` value.", "When `yref` is set to `paper`, units are sized relative", "to the plot height.", "When `yref` ends with ` domain`, units are sized relative", "to the axis height." ].join(" ") }, sizing: { valType: "enumerated", values: ["fill", "contain", "stretch"], dflt: "contain", editType: "arraydraw", description: [ "Specifies which dimension of the image to constrain." ].join(" ") }, opacity: { valType: "number", min: 0, max: 1, dflt: 1, editType: "arraydraw", description: "Sets the opacity of the image." }, x: { valType: "any", dflt: 0, editType: "arraydraw", description: [ "Sets the image's x position.", "When `xref` is set to `paper`, units are sized relative", "to the plot height.", "See `xref` for more info" ].join(" ") }, y: { valType: "any", dflt: 0, editType: "arraydraw", description: [ "Sets the image's y position.", "When `yref` is set to `paper`, units are sized relative", "to the plot height.", "See `yref` for more info" ].join(" ") }, xanchor: { valType: "enumerated", values: ["left", "center", "right"], dflt: "left", editType: "arraydraw", description: "Sets the anchor for the x position" }, yanchor: { valType: "enumerated", values: ["top", "middle", "bottom"], dflt: "top", editType: "arraydraw", description: "Sets the anchor for the y position." }, xref: { valType: "enumerated", values: [ "paper", cartesianConstants.idRegex.x.toString() ], dflt: "paper", editType: "arraydraw", description: [ "Sets the images's x coordinate axis.", axisPlaceableObjs.axisRefDescription("x", "left", "right") ].join(" ") }, yref: { valType: "enumerated", values: [ "paper", cartesianConstants.idRegex.y.toString() ], dflt: "paper", editType: "arraydraw", description: [ "Sets the images's y coordinate axis.", axisPlaceableObjs.axisRefDescription("y", "bottom", "top") ].join(" ") }, editType: "arraydraw" }); } }); // node_modules/plotly.js/src/components/images/defaults.js var require_defaults13 = __commonJS({ "node_modules/plotly.js/src/components/images/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes17(); var name = "images"; module2.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { var opts = { name, handleItemDefaults: imageDefaults }; handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function imageDefaults(imageIn, imageOut, fullLayout) { function coerce(attr, dflt) { return Lib.coerce(imageIn, imageOut, attributes, attr, dflt); } var source = coerce("source"); var visible = coerce("visible", !!source); if (!visible) return imageOut; coerce("layer"); coerce("xanchor"); coerce("yanchor"); coerce("sizex"); coerce("sizey"); coerce("sizing"); coerce("opacity"); var gdMock = { _fullLayout: fullLayout }; var axLetters = ["x", "y"]; for (var i = 0; i < 2; i++) { var axLetter = axLetters[i]; var axRef = Axes.coerceRef(imageIn, imageOut, gdMock, axLetter, "paper", void 0); if (axRef !== "paper") { var ax = Axes.getFromId(gdMock, axRef); ax._imgIndices.push(imageOut._index); } Axes.coercePosition(imageOut, gdMock, coerce, axRef, axLetter, 0); } return imageOut; } } }); // node_modules/plotly.js/src/components/images/draw.js var require_draw6 = __commonJS({ "node_modules/plotly.js/src/components/images/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Drawing = require_drawing(); var Axes = require_axes(); var axisIds = require_axis_ids(); var xmlnsNamespaces = require_xmlns_namespaces(); module2.exports = function draw(gd2) { var fullLayout = gd2._fullLayout; var imageDataAbove = []; var imageDataSubplot = {}; var imageDataBelow = []; var subplot; var i; for (i = 0; i < fullLayout.images.length; i++) { var img = fullLayout.images[i]; if (img.visible) { if (img.layer === "below" && img.xref !== "paper" && img.yref !== "paper") { subplot = axisIds.ref2id(img.xref) + axisIds.ref2id(img.yref); var plotinfo = fullLayout._plots[subplot]; if (!plotinfo) { imageDataBelow.push(img); continue; } if (plotinfo.mainplot) { subplot = plotinfo.mainplot.id; } if (!imageDataSubplot[subplot]) { imageDataSubplot[subplot] = []; } imageDataSubplot[subplot].push(img); } else if (img.layer === "above") { imageDataAbove.push(img); } else { imageDataBelow.push(img); } } } var anchors = { x: { left: { sizing: "xMin", offset: 0 }, center: { sizing: "xMid", offset: -1 / 2 }, right: { sizing: "xMax", offset: -1 } }, y: { top: { sizing: "YMin", offset: 0 }, middle: { sizing: "YMid", offset: -1 / 2 }, bottom: { sizing: "YMax", offset: -1 } } }; function setImage(d) { var thisImage = d3.select(this); if (this._imgSrc === d.source) { return; } thisImage.attr("xmlns", xmlnsNamespaces.svg); if (d.source && d.source.slice(0, 5) === "data:") { thisImage.attr("xlink:href", d.source); this._imgSrc = d.source; } else { var imagePromise = new Promise((function(resolve) { var img2 = new Image(); this.img = img2; img2.setAttribute("crossOrigin", "anonymous"); img2.onerror = errorHandler; img2.onload = function() { var canvas = document.createElement("canvas"); canvas.width = this.width; canvas.height = this.height; var ctx = canvas.getContext("2d", { willReadFrequently: true }); ctx.drawImage(this, 0, 0); var dataURL = canvas.toDataURL("image/png"); thisImage.attr("xlink:href", dataURL); resolve(); }; thisImage.on("error", errorHandler); img2.src = d.source; this._imgSrc = d.source; function errorHandler() { thisImage.remove(); resolve(); } }).bind(this)); gd2._promises.push(imagePromise); } } function applyAttributes(d) { var thisImage = d3.select(this); var xa2 = Axes.getFromId(gd2, d.xref); var ya2 = Axes.getFromId(gd2, d.yref); var xIsDomain = Axes.getRefType(d.xref) === "domain"; var yIsDomain = Axes.getRefType(d.yref) === "domain"; var size = fullLayout._size; var width, height; if (xa2 !== void 0) { width = typeof d.xref === "string" && xIsDomain ? xa2._length * d.sizex : Math.abs(xa2.l2p(d.sizex) - xa2.l2p(0)); } else { width = d.sizex * size.w; } if (ya2 !== void 0) { height = typeof d.yref === "string" && yIsDomain ? ya2._length * d.sizey : Math.abs(ya2.l2p(d.sizey) - ya2.l2p(0)); } else { height = d.sizey * size.h; } var xOffset = width * anchors.x[d.xanchor].offset; var yOffset = height * anchors.y[d.yanchor].offset; var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing; var xPos, yPos; if (xa2 !== void 0) { xPos = typeof d.xref === "string" && xIsDomain ? xa2._length * d.x + xa2._offset : xa2.r2p(d.x) + xa2._offset; } else { xPos = d.x * size.w + size.l; } xPos += xOffset; if (ya2 !== void 0) { yPos = typeof d.yref === "string" && yIsDomain ? ( // consistent with "paper" yref value, where positive values // move up the page ya2._length * (1 - d.y) + ya2._offset ) : ya2.r2p(d.y) + ya2._offset; } else { yPos = size.h - d.y * size.h + size.t; } yPos += yOffset; switch (d.sizing) { case "fill": sizing += " slice"; break; case "stretch": sizing = "none"; break; } thisImage.attr({ x: xPos, y: yPos, width, height, preserveAspectRatio: sizing, opacity: d.opacity }); var xId = xa2 && Axes.getRefType(d.xref) !== "domain" ? xa2._id : ""; var yId = ya2 && Axes.getRefType(d.yref) !== "domain" ? ya2._id : ""; var clipAxes = xId + yId; Drawing.setClipUrl( thisImage, clipAxes ? "clip" + fullLayout._uid + clipAxes : null, gd2 ); } var imagesBelow = fullLayout._imageLowerLayer.selectAll("image").data(imageDataBelow); var imagesAbove = fullLayout._imageUpperLayer.selectAll("image").data(imageDataAbove); imagesBelow.enter().append("image"); imagesAbove.enter().append("image"); imagesBelow.exit().remove(); imagesAbove.exit().remove(); imagesBelow.each(function(d) { setImage.bind(this)(d); applyAttributes.bind(this)(d); }); imagesAbove.each(function(d) { setImage.bind(this)(d); applyAttributes.bind(this)(d); }); var allSubplots = Object.keys(fullLayout._plots); for (i = 0; i < allSubplots.length; i++) { subplot = allSubplots[i]; var subplotObj = fullLayout._plots[subplot]; if (!subplotObj.imagelayer) continue; var imagesOnSubplot = subplotObj.imagelayer.selectAll("image").data(imageDataSubplot[subplot] || []); imagesOnSubplot.enter().append("image"); imagesOnSubplot.exit().remove(); imagesOnSubplot.each(function(d) { setImage.bind(this)(d); applyAttributes.bind(this)(d); }); } }; } }); // node_modules/plotly.js/src/components/images/convert_coords.js var require_convert_coords2 = __commonJS({ "node_modules/plotly.js/src/components/images/convert_coords.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var toLogRange = require_to_log_range(); module2.exports = function convertCoords(gd2, ax, newType, doExtra) { ax = ax || {}; var toLog = newType === "log" && ax.type === "linear"; var fromLog = newType === "linear" && ax.type === "log"; if (!(toLog || fromLog)) return; var images = gd2._fullLayout.images; var axLetter = ax._id.charAt(0); var image; var attrPrefix; for (var i = 0; i < images.length; i++) { image = images[i]; attrPrefix = "images[" + i + "]."; if (image[axLetter + "ref"] === ax._id) { var currentPos = image[axLetter]; var currentSize = image["size" + axLetter]; var newPos = null; var newSize = null; if (toLog) { newPos = toLogRange(currentPos, ax.range); var dx = currentSize / Math.pow(10, newPos) / 2; newSize = 2 * Math.log(dx + Math.sqrt(1 + dx * dx)) / Math.LN10; } else { newPos = Math.pow(10, currentPos); newSize = newPos * (Math.pow(10, currentSize / 2) - Math.pow(10, -currentSize / 2)); } if (!isNumeric(newPos)) { newPos = null; newSize = null; } else if (!isNumeric(newSize)) newSize = null; doExtra(attrPrefix + axLetter, newPos); doExtra(attrPrefix + "size" + axLetter, newSize); } } }; } }); // node_modules/plotly.js/src/components/images/index.js var require_images = __commonJS({ "node_modules/plotly.js/src/components/images/index.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "component", name: "images", layoutAttributes: require_attributes17(), supplyLayoutDefaults: require_defaults13(), includeBasePlot: require_include_components()("images"), draw: require_draw6(), convertCoords: require_convert_coords2() }; } }); // node_modules/plotly.js/src/components/updatemenus/constants.js var require_constants9 = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/constants.js"(exports2, module2) { "use strict"; module2.exports = { // layout attribute name name: "updatemenus", // class names containerClassName: "updatemenu-container", headerGroupClassName: "updatemenu-header-group", headerClassName: "updatemenu-header", headerArrowClassName: "updatemenu-header-arrow", dropdownButtonGroupClassName: "updatemenu-dropdown-button-group", dropdownButtonClassName: "updatemenu-dropdown-button", buttonClassName: "updatemenu-button", itemRectClassName: "updatemenu-item-rect", itemTextClassName: "updatemenu-item-text", // DOM attribute name in button group keeping track // of active update menu menuIndexAttrName: "updatemenu-active-index", // id root pass to Plots.autoMargin autoMarginIdRoot: "updatemenu-", // options when 'active: -1' blankHeaderOpts: { label: " " }, // min item width / height minWidth: 30, minHeight: 30, // padding around item text textPadX: 24, arrowPadX: 16, // item rect radii rx: 2, ry: 2, // item text x offset off left edge textOffsetX: 12, // item text y offset (w.r.t. middle) textOffsetY: 3, // arrow offset off right edge arrowOffsetX: 4, // gap between header and buttons gapButtonHeader: 5, // gap between between buttons gapButton: 2, // color given to active buttons activeColor: "#F4FAFF", // color given to hovered buttons hoverColor: "#F4FAFF", // symbol for menu open arrow arrowSymbol: { left: "◄", right: "►", up: "▲", down: "▼" } }; } }); // node_modules/plotly.js/src/components/updatemenus/attributes.js var require_attributes18 = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var colorAttrs = require_attributes3(); var extendFlat = require_extend().extendFlat; var overrideAll = require_edit_types().overrideAll; var padAttrs = require_pad_attributes(); var templatedArray = require_plot_template().templatedArray; var buttonsAttrs = templatedArray("button", { visible: { valType: "boolean", description: "Determines whether or not this button is visible." }, method: { valType: "enumerated", values: ["restyle", "relayout", "animate", "update", "skip"], dflt: "restyle", description: [ "Sets the Plotly method to be called on click.", "If the `skip` method is used, the API updatemenu will function as normal", "but will perform no API calls and will not bind automatically to state", "updates. This may be used to create a component interface and attach to", "updatemenu events manually via JavaScript." ].join(" ") }, args: { valType: "info_array", freeLength: true, items: [ { valType: "any" }, { valType: "any" }, { valType: "any" } ], description: [ "Sets the arguments values to be passed to the Plotly", "method set in `method` on click." ].join(" ") }, args2: { valType: "info_array", freeLength: true, items: [ { valType: "any" }, { valType: "any" }, { valType: "any" } ], description: [ "Sets a 2nd set of `args`,", "these arguments values are passed to the Plotly", "method set in `method` when clicking this button while in the active state.", "Use this to create toggle buttons." ].join(" ") }, label: { valType: "string", dflt: "", description: "Sets the text label to appear on the button." }, execute: { valType: "boolean", dflt: true, description: [ "When true, the API method is executed. When false, all other behaviors are the same", "and command execution is skipped. This may be useful when hooking into, for example,", "the `plotly_buttonclicked` method and executing the API command manually without losing", "the benefit of the updatemenu automatically binding to the state of the plot through the", "specification of `method` and `args`." ].join(" ") } }); module2.exports = overrideAll(templatedArray("updatemenu", { _arrayAttrRegexps: [/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/], visible: { valType: "boolean", description: [ "Determines whether or not the update menu is visible." ].join(" ") }, type: { valType: "enumerated", values: ["dropdown", "buttons"], dflt: "dropdown", description: [ "Determines whether the buttons are accessible via a dropdown menu", "or whether the buttons are stacked horizontally or vertically" ].join(" ") }, direction: { valType: "enumerated", values: ["left", "right", "up", "down"], dflt: "down", description: [ "Determines the direction in which the buttons are laid out, whether", "in a dropdown menu or a row/column of buttons. For `left` and `up`,", "the buttons will still appear in left-to-right or top-to-bottom order", "respectively." ].join(" ") }, active: { valType: "integer", min: -1, dflt: 0, description: [ "Determines which button (by index starting from 0) is", "considered active." ].join(" ") }, showactive: { valType: "boolean", dflt: true, description: "Highlights active dropdown item or active button if true." }, buttons: buttonsAttrs, x: { valType: "number", min: -2, max: 3, dflt: -0.05, description: "Sets the x position (in normalized coordinates) of the update menu." }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "right", description: [ "Sets the update menu's horizontal position anchor.", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the range selector." ].join(" ") }, y: { valType: "number", min: -2, max: 3, dflt: 1, description: "Sets the y position (in normalized coordinates) of the update menu." }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "top", description: [ "Sets the update menu's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the range selector." ].join(" ") }, pad: extendFlat(padAttrs({ editType: "arraydraw" }), { description: "Sets the padding around the buttons or dropdown menu." }), font: fontAttrs({ description: "Sets the font of the update menu button text." }), bgcolor: { valType: "color", description: "Sets the background color of the update menu buttons." }, bordercolor: { valType: "color", dflt: colorAttrs.borderLine, description: "Sets the color of the border enclosing the update menu." }, borderwidth: { valType: "number", min: 0, dflt: 1, editType: "arraydraw", description: "Sets the width (in px) of the border enclosing the update menu." } }), "arraydraw", "from-root"); } }); // node_modules/plotly.js/src/components/updatemenus/defaults.js var require_defaults14 = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes18(); var constants = require_constants9(); var name = constants.name; var buttonAttrs = attributes.buttons; module2.exports = function updateMenusDefaults(layoutIn, layoutOut) { var opts = { name, handleItemDefaults: menuDefaults }; handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; function menuDefaults(menuIn, menuOut, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(menuIn, menuOut, attributes, attr, dflt); } var buttons = handleArrayContainerDefaults(menuIn, menuOut, { name: "buttons", handleItemDefaults: buttonDefaults }); var visible = coerce("visible", buttons.length > 0); if (!visible) return; coerce("active"); coerce("direction"); coerce("type"); coerce("showactive"); coerce("x"); coerce("y"); Lib.noneOrAll(menuIn, menuOut, ["x", "y"]); coerce("xanchor"); coerce("yanchor"); coerce("pad.t"); coerce("pad.r"); coerce("pad.b"); coerce("pad.l"); Lib.coerceFont(coerce, "font", layoutOut.font); coerce("bgcolor", layoutOut.paper_bgcolor); coerce("bordercolor"); coerce("borderwidth"); } function buttonDefaults(buttonIn, buttonOut) { function coerce(attr, dflt) { return Lib.coerce(buttonIn, buttonOut, buttonAttrs, attr, dflt); } var visible = coerce( "visible", buttonIn.method === "skip" || Array.isArray(buttonIn.args) ); if (visible) { coerce("method"); coerce("args"); coerce("args2"); coerce("label"); coerce("execute"); } } } }); // node_modules/plotly.js/src/components/updatemenus/scrollbox.js var require_scrollbox = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/scrollbox.js"(exports2, module2) { "use strict"; module2.exports = ScrollBox; var d3 = require_d3(); var Color = require_color(); var Drawing = require_drawing(); var Lib = require_lib(); function ScrollBox(gd2, container, id2) { this.gd = gd2; this.container = container; this.id = id2; this.position = null; this.translateX = null; this.translateY = null; this.hbar = null; this.vbar = null; this.bg = this.container.selectAll("rect.scrollbox-bg").data([0]); this.bg.exit().on(".drag", null).on("wheel", null).remove(); this.bg.enter().append("rect").classed("scrollbox-bg", true).style("pointer-events", "all").attr({ opacity: 0, x: 0, y: 0, width: 0, height: 0 }); } ScrollBox.barWidth = 2; ScrollBox.barLength = 20; ScrollBox.barRadius = 2; ScrollBox.barPad = 1; ScrollBox.barColor = "#808BA4"; ScrollBox.prototype.enable = function enable(position, translateX, translateY) { var fullLayout = this.gd._fullLayout; var fullWidth = fullLayout.width; var fullHeight = fullLayout.height; this.position = position; var l = this.position.l; var w = this.position.w; var t = this.position.t; var h = this.position.h; var direction = this.position.direction; var isDown = direction === "down"; var isLeft = direction === "left"; var isRight = direction === "right"; var isUp = direction === "up"; var boxW = w; var boxH = h; var boxL, boxR; var boxT, boxB; if (!isDown && !isLeft && !isRight && !isUp) { this.position.direction = "down"; isDown = true; } var isVertical = isDown || isUp; if (isVertical) { boxL = l; boxR = boxL + boxW; if (isDown) { boxT = t; boxB = Math.min(boxT + boxH, fullHeight); boxH = boxB - boxT; } else { boxB = t + boxH; boxT = Math.max(boxB - boxH, 0); boxH = boxB - boxT; } } else { boxT = t; boxB = boxT + boxH; if (isLeft) { boxR = l + boxW; boxL = Math.max(boxR - boxW, 0); boxW = boxR - boxL; } else { boxL = l; boxR = Math.min(boxL + boxW, fullWidth); boxW = boxR - boxL; } } this._box = { l: boxL, t: boxT, w: boxW, h: boxH }; var needsHorizontalScrollBar = w > boxW; var hbarW = ScrollBox.barLength + 2 * ScrollBox.barPad; var hbarH = ScrollBox.barWidth + 2 * ScrollBox.barPad; var hbarL = l; var hbarT = t + h; if (hbarT + hbarH > fullHeight) hbarT = fullHeight - hbarH; var hbar = this.container.selectAll("rect.scrollbar-horizontal").data( needsHorizontalScrollBar ? [0] : [] ); hbar.exit().on(".drag", null).remove(); hbar.enter().append("rect").classed("scrollbar-horizontal", true).call(Color.fill, ScrollBox.barColor); if (needsHorizontalScrollBar) { this.hbar = hbar.attr({ rx: ScrollBox.barRadius, ry: ScrollBox.barRadius, x: hbarL, y: hbarT, width: hbarW, height: hbarH }); this._hbarXMin = hbarL + hbarW / 2; this._hbarTranslateMax = boxW - hbarW; } else { delete this.hbar; delete this._hbarXMin; delete this._hbarTranslateMax; } var needsVerticalScrollBar = h > boxH; var vbarW = ScrollBox.barWidth + 2 * ScrollBox.barPad; var vbarH = ScrollBox.barLength + 2 * ScrollBox.barPad; var vbarL = l + w; var vbarT = t; if (vbarL + vbarW > fullWidth) vbarL = fullWidth - vbarW; var vbar = this.container.selectAll("rect.scrollbar-vertical").data( needsVerticalScrollBar ? [0] : [] ); vbar.exit().on(".drag", null).remove(); vbar.enter().append("rect").classed("scrollbar-vertical", true).call(Color.fill, ScrollBox.barColor); if (needsVerticalScrollBar) { this.vbar = vbar.attr({ rx: ScrollBox.barRadius, ry: ScrollBox.barRadius, x: vbarL, y: vbarT, width: vbarW, height: vbarH }); this._vbarYMin = vbarT + vbarH / 2; this._vbarTranslateMax = boxH - vbarH; } else { delete this.vbar; delete this._vbarYMin; delete this._vbarTranslateMax; } var clipId = this.id; var clipL = boxL - 0.5; var clipR = needsVerticalScrollBar ? boxR + vbarW + 0.5 : boxR + 0.5; var clipT = boxT - 0.5; var clipB = needsHorizontalScrollBar ? boxB + hbarH + 0.5 : boxB + 0.5; var clipPath = fullLayout._topdefs.selectAll("#" + clipId).data(needsHorizontalScrollBar || needsVerticalScrollBar ? [0] : []); clipPath.exit().remove(); clipPath.enter().append("clipPath").attr("id", clipId).append("rect"); if (needsHorizontalScrollBar || needsVerticalScrollBar) { this._clipRect = clipPath.select("rect").attr({ x: Math.floor(clipL), y: Math.floor(clipT), width: Math.ceil(clipR) - Math.floor(clipL), height: Math.ceil(clipB) - Math.floor(clipT) }); this.container.call(Drawing.setClipUrl, clipId, this.gd); this.bg.attr({ x: l, y: t, width: w, height: h }); } else { this.bg.attr({ width: 0, height: 0 }); this.container.on("wheel", null).on(".drag", null).call(Drawing.setClipUrl, null); delete this._clipRect; } if (needsHorizontalScrollBar || needsVerticalScrollBar) { var onBoxDrag = d3.behavior.drag().on("dragstart", function() { d3.event.sourceEvent.preventDefault(); }).on("drag", this._onBoxDrag.bind(this)); this.container.on("wheel", null).on("wheel", this._onBoxWheel.bind(this)).on(".drag", null).call(onBoxDrag); var onBarDrag = d3.behavior.drag().on("dragstart", function() { d3.event.sourceEvent.preventDefault(); d3.event.sourceEvent.stopPropagation(); }).on("drag", this._onBarDrag.bind(this)); if (needsHorizontalScrollBar) { this.hbar.on(".drag", null).call(onBarDrag); } if (needsVerticalScrollBar) { this.vbar.on(".drag", null).call(onBarDrag); } } this.setTranslate(translateX, translateY); }; ScrollBox.prototype.disable = function disable() { if (this.hbar || this.vbar) { this.bg.attr({ width: 0, height: 0 }); this.container.on("wheel", null).on(".drag", null).call(Drawing.setClipUrl, null); delete this._clipRect; } if (this.hbar) { this.hbar.on(".drag", null); this.hbar.remove(); delete this.hbar; delete this._hbarXMin; delete this._hbarTranslateMax; } if (this.vbar) { this.vbar.on(".drag", null); this.vbar.remove(); delete this.vbar; delete this._vbarYMin; delete this._vbarTranslateMax; } }; ScrollBox.prototype._onBoxDrag = function _onBoxDrag() { var translateX = this.translateX; var translateY = this.translateY; if (this.hbar) { translateX -= d3.event.dx; } if (this.vbar) { translateY -= d3.event.dy; } this.setTranslate(translateX, translateY); }; ScrollBox.prototype._onBoxWheel = function _onBoxWheel() { var translateX = this.translateX; var translateY = this.translateY; if (this.hbar) { translateX += d3.event.deltaY; } if (this.vbar) { translateY += d3.event.deltaY; } this.setTranslate(translateX, translateY); }; ScrollBox.prototype._onBarDrag = function _onBarDrag() { var translateX = this.translateX; var translateY = this.translateY; if (this.hbar) { var xMin = translateX + this._hbarXMin; var xMax = xMin + this._hbarTranslateMax; var x = Lib.constrain(d3.event.x, xMin, xMax); var xf2 = (x - xMin) / (xMax - xMin); var translateXMax = this.position.w - this._box.w; translateX = xf2 * translateXMax; } if (this.vbar) { var yMin = translateY + this._vbarYMin; var yMax = yMin + this._vbarTranslateMax; var y = Lib.constrain(d3.event.y, yMin, yMax); var yf2 = (y - yMin) / (yMax - yMin); var translateYMax = this.position.h - this._box.h; translateY = yf2 * translateYMax; } this.setTranslate(translateX, translateY); }; ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) { var translateXMax = this.position.w - this._box.w; var translateYMax = this.position.h - this._box.h; translateX = Lib.constrain(translateX || 0, 0, translateXMax); translateY = Lib.constrain(translateY || 0, 0, translateYMax); this.translateX = translateX; this.translateY = translateY; this.container.call( Drawing.setTranslate, this._box.l - this.position.l - translateX, this._box.t - this.position.t - translateY ); if (this._clipRect) { this._clipRect.attr({ x: Math.floor(this.position.l + translateX - 0.5), y: Math.floor(this.position.t + translateY - 0.5) }); } if (this.hbar) { var xf2 = translateX / translateXMax; this.hbar.call( Drawing.setTranslate, translateX + xf2 * this._hbarTranslateMax, translateY ); } if (this.vbar) { var yf2 = translateY / translateYMax; this.vbar.call( Drawing.setTranslate, translateX, translateY + yf2 * this._vbarTranslateMax ); } }; } }); // node_modules/plotly.js/src/components/updatemenus/draw.js var require_draw7 = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Plots = require_plots(); var Color = require_color(); var Drawing = require_drawing(); var Lib = require_lib(); var svgTextUtils = require_svg_text_utils(); var arrayEditor = require_plot_template().arrayEditor; var LINE_SPACING = require_alignment().LINE_SPACING; var constants = require_constants9(); var ScrollBox = require_scrollbox(); module2.exports = function draw(gd2) { var fullLayout = gd2._fullLayout; var menuData = Lib.filterVisible(fullLayout[constants.name]); function clearAutoMargin(menuOpts2) { Plots.autoMargin(gd2, autoMarginId(menuOpts2)); } var menus = fullLayout._menulayer.selectAll("g." + constants.containerClassName).data(menuData.length > 0 ? [0] : []); menus.enter().append("g").classed(constants.containerClassName, true).style("cursor", "pointer"); menus.exit().each(function() { d3.select(this).selectAll("g." + constants.headerGroupClassName).each(clearAutoMargin); }).remove(); if (menuData.length === 0) return; var headerGroups = menus.selectAll("g." + constants.headerGroupClassName).data(menuData, keyFunction); headerGroups.enter().append("g").classed(constants.headerGroupClassName, true); var gButton = Lib.ensureSingle(menus, "g", constants.dropdownButtonGroupClassName, function(s) { s.style("pointer-events", "all"); }); for (var i = 0; i < menuData.length; i++) { var menuOpts = menuData[i]; findDimensions(gd2, menuOpts); } var scrollBoxId = "updatemenus" + fullLayout._uid; var scrollBox = new ScrollBox(gd2, gButton, scrollBoxId); if (headerGroups.enter().size()) { gButton.node().parentNode.appendChild(gButton.node()); gButton.call(removeAllButtons); } headerGroups.exit().each(function(menuOpts2) { gButton.call(removeAllButtons); clearAutoMargin(menuOpts2); }).remove(); headerGroups.each(function(menuOpts2) { var gHeader = d3.select(this); var _gButton = menuOpts2.type === "dropdown" ? gButton : null; Plots.manageCommandObserver(gd2, menuOpts2, menuOpts2.buttons, function(data) { setActive(gd2, menuOpts2, menuOpts2.buttons[data.index], gHeader, _gButton, scrollBox, data.index, true); }); if (menuOpts2.type === "dropdown") { drawHeader(gd2, gHeader, gButton, scrollBox, menuOpts2); if (isActive(gButton, menuOpts2)) { drawButtons(gd2, gHeader, gButton, scrollBox, menuOpts2); } } else { drawButtons(gd2, gHeader, null, null, menuOpts2); } }); }; function keyFunction(menuOpts) { return menuOpts._index; } function isFolded(gButton) { return +gButton.attr(constants.menuIndexAttrName) === -1; } function isActive(gButton, menuOpts) { return +gButton.attr(constants.menuIndexAttrName) === menuOpts._index; } function setActive(gd2, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex, isSilentUpdate) { menuOpts.active = buttonIndex; arrayEditor(gd2.layout, constants.name, menuOpts).applyUpdate("active", buttonIndex); if (menuOpts.type === "buttons") { drawButtons(gd2, gHeader, null, null, menuOpts); } else if (menuOpts.type === "dropdown") { gButton.attr(constants.menuIndexAttrName, "-1"); drawHeader(gd2, gHeader, gButton, scrollBox, menuOpts); if (!isSilentUpdate) { drawButtons(gd2, gHeader, gButton, scrollBox, menuOpts); } } } function drawHeader(gd2, gHeader, gButton, scrollBox, menuOpts) { var header = Lib.ensureSingle(gHeader, "g", constants.headerClassName, function(s) { s.style("pointer-events", "all"); }); var dims = menuOpts._dims; var active = menuOpts.active; var headerOpts = menuOpts.buttons[active] || constants.blankHeaderOpts; var posOpts = { y: menuOpts.pad.t, yPad: 0, x: menuOpts.pad.l, xPad: 0, index: 0 }; var positionOverrides = { width: dims.headerWidth, height: dims.headerHeight }; header.call(drawItem, menuOpts, headerOpts, gd2).call(setItemPosition, menuOpts, posOpts, positionOverrides); var arrow = Lib.ensureSingle(gHeader, "text", constants.headerArrowClassName, function(s) { s.attr("text-anchor", "end").call(Drawing.font, menuOpts.font).text(constants.arrowSymbol[menuOpts.direction]); }); arrow.attr({ x: dims.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, y: dims.headerHeight / 2 + constants.textOffsetY + menuOpts.pad.t }); header.on("click", function() { gButton.call( removeAllButtons, String(isActive(gButton, menuOpts) ? -1 : menuOpts._index) ); drawButtons(gd2, gHeader, gButton, scrollBox, menuOpts); }); header.on("mouseover", function() { header.call(styleOnMouseOver); }); header.on("mouseout", function() { header.call(styleOnMouseOut, menuOpts); }); Drawing.setTranslate(gHeader, dims.lx, dims.ly); } function drawButtons(gd2, gHeader, gButton, scrollBox, menuOpts) { if (!gButton) { gButton = gHeader; gButton.attr("pointer-events", "all"); } var buttonData = !isFolded(gButton) || menuOpts.type === "buttons" ? menuOpts.buttons : []; var klass = menuOpts.type === "dropdown" ? constants.dropdownButtonClassName : constants.buttonClassName; var buttons = gButton.selectAll("g." + klass).data(Lib.filterVisible(buttonData)); var enter = buttons.enter().append("g").classed(klass, true); var exit = buttons.exit(); if (menuOpts.type === "dropdown") { enter.attr("opacity", "0").transition().attr("opacity", "1"); exit.transition().attr("opacity", "0").remove(); } else { exit.remove(); } var x02 = 0; var y02 = 0; var dims = menuOpts._dims; var isVertical = ["up", "down"].indexOf(menuOpts.direction) !== -1; if (menuOpts.type === "dropdown") { if (isVertical) { y02 = dims.headerHeight + constants.gapButtonHeader; } else { x02 = dims.headerWidth + constants.gapButtonHeader; } } if (menuOpts.type === "dropdown" && menuOpts.direction === "up") { y02 = -constants.gapButtonHeader + constants.gapButton - dims.openHeight; } if (menuOpts.type === "dropdown" && menuOpts.direction === "left") { x02 = -constants.gapButtonHeader + constants.gapButton - dims.openWidth; } var posOpts = { x: dims.lx + x02 + menuOpts.pad.l, y: dims.ly + y02 + menuOpts.pad.t, yPad: constants.gapButton, xPad: constants.gapButton, index: 0 }; var scrollBoxPosition = { l: posOpts.x + menuOpts.borderwidth, t: posOpts.y + menuOpts.borderwidth }; buttons.each(function(buttonOpts, buttonIndex) { var button = d3.select(this); button.call(drawItem, menuOpts, buttonOpts, gd2).call(setItemPosition, menuOpts, posOpts); button.on("click", function() { if (d3.event.defaultPrevented) return; if (buttonOpts.execute) { if (buttonOpts.args2 && menuOpts.active === buttonIndex) { setActive(gd2, menuOpts, buttonOpts, gHeader, gButton, scrollBox, -1); Plots.executeAPICommand(gd2, buttonOpts.method, buttonOpts.args2); } else { setActive(gd2, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); Plots.executeAPICommand(gd2, buttonOpts.method, buttonOpts.args); } } gd2.emit("plotly_buttonclicked", { menu: menuOpts, button: buttonOpts, active: menuOpts.active }); }); button.on("mouseover", function() { button.call(styleOnMouseOver); }); button.on("mouseout", function() { button.call(styleOnMouseOut, menuOpts); buttons.call(styleButtons, menuOpts); }); }); buttons.call(styleButtons, menuOpts); if (isVertical) { scrollBoxPosition.w = Math.max(dims.openWidth, dims.headerWidth); scrollBoxPosition.h = posOpts.y - scrollBoxPosition.t; } else { scrollBoxPosition.w = posOpts.x - scrollBoxPosition.l; scrollBoxPosition.h = Math.max(dims.openHeight, dims.headerHeight); } scrollBoxPosition.direction = menuOpts.direction; if (scrollBox) { if (buttons.size()) { drawScrollBox(gd2, gHeader, gButton, scrollBox, menuOpts, scrollBoxPosition); } else { hideScrollBox(scrollBox); } } } function drawScrollBox(gd2, gHeader, gButton, scrollBox, menuOpts, position) { var direction = menuOpts.direction; var isVertical = direction === "up" || direction === "down"; var dims = menuOpts._dims; var active = menuOpts.active; var translateX, translateY; var i; if (isVertical) { translateY = 0; for (i = 0; i < active; i++) { translateY += dims.heights[i] + constants.gapButton; } } else { translateX = 0; for (i = 0; i < active; i++) { translateX += dims.widths[i] + constants.gapButton; } } scrollBox.enable(position, translateX, translateY); if (scrollBox.hbar) { scrollBox.hbar.attr("opacity", "0").transition().attr("opacity", "1"); } if (scrollBox.vbar) { scrollBox.vbar.attr("opacity", "0").transition().attr("opacity", "1"); } } function hideScrollBox(scrollBox) { var hasHBar = !!scrollBox.hbar; var hasVBar = !!scrollBox.vbar; if (hasHBar) { scrollBox.hbar.transition().attr("opacity", "0").each("end", function() { hasHBar = false; if (!hasVBar) scrollBox.disable(); }); } if (hasVBar) { scrollBox.vbar.transition().attr("opacity", "0").each("end", function() { hasVBar = false; if (!hasHBar) scrollBox.disable(); }); } } function drawItem(item, menuOpts, itemOpts, gd2) { item.call(drawItemRect, menuOpts).call(drawItemText, menuOpts, itemOpts, gd2); } function drawItemRect(item, menuOpts) { var rect = Lib.ensureSingle(item, "rect", constants.itemRectClassName, function(s) { s.attr({ rx: constants.rx, ry: constants.ry, "shape-rendering": "crispEdges" }); }); rect.call(Color.stroke, menuOpts.bordercolor).call(Color.fill, menuOpts.bgcolor).style("stroke-width", menuOpts.borderwidth + "px"); } function drawItemText(item, menuOpts, itemOpts, gd2) { var text = Lib.ensureSingle(item, "text", constants.itemTextClassName, function(s) { s.attr({ "text-anchor": "start", "data-notex": 1 }); }); var tx = itemOpts.label; var _meta = gd2._fullLayout._meta; if (_meta) tx = Lib.templateString(tx, _meta); text.call(Drawing.font, menuOpts.font).text(tx).call(svgTextUtils.convertToTspans, gd2); } function styleButtons(buttons, menuOpts) { var active = menuOpts.active; buttons.each(function(buttonOpts, i) { var button = d3.select(this); if (i === active && menuOpts.showactive) { button.select("rect." + constants.itemRectClassName).call(Color.fill, constants.activeColor); } }); } function styleOnMouseOver(item) { item.select("rect." + constants.itemRectClassName).call(Color.fill, constants.hoverColor); } function styleOnMouseOut(item, menuOpts) { item.select("rect." + constants.itemRectClassName).call(Color.fill, menuOpts.bgcolor); } function findDimensions(gd2, menuOpts) { var dims = menuOpts._dims = { width1: 0, height1: 0, heights: [], widths: [], totalWidth: 0, totalHeight: 0, openWidth: 0, openHeight: 0, lx: 0, ly: 0 }; var fakeButtons = Drawing.tester.selectAll("g." + constants.dropdownButtonClassName).data(Lib.filterVisible(menuOpts.buttons)); fakeButtons.enter().append("g").classed(constants.dropdownButtonClassName, true); var isVertical = ["up", "down"].indexOf(menuOpts.direction) !== -1; fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); button.call(drawItem, menuOpts, buttonOpts, gd2); var text = button.select("." + constants.itemTextClassName); var tWidth = text.node() && Drawing.bBox(text.node()).width; var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); var tHeight = menuOpts.font.size * LINE_SPACING; var tLines = svgTextUtils.lineCount(text); var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); dims.widths[i] = wEff; dims.heights[i] = hEff; dims.height1 = Math.max(dims.height1, hEff); dims.width1 = Math.max(dims.width1, wEff); if (isVertical) { dims.totalWidth = Math.max(dims.totalWidth, wEff); dims.openWidth = dims.totalWidth; dims.totalHeight += hEff + constants.gapButton; dims.openHeight += hEff + constants.gapButton; } else { dims.totalWidth += wEff + constants.gapButton; dims.openWidth += wEff + constants.gapButton; dims.totalHeight = Math.max(dims.totalHeight, hEff); dims.openHeight = dims.totalHeight; } }); if (isVertical) { dims.totalHeight -= constants.gapButton; } else { dims.totalWidth -= constants.gapButton; } dims.headerWidth = dims.width1 + constants.arrowPadX; dims.headerHeight = dims.height1; if (menuOpts.type === "dropdown") { if (isVertical) { dims.width1 += constants.arrowPadX; dims.totalHeight = dims.height1; } else { dims.totalWidth = dims.width1; } dims.totalWidth += constants.arrowPadX; } fakeButtons.remove(); var paddedWidth = dims.totalWidth + menuOpts.pad.l + menuOpts.pad.r; var paddedHeight = dims.totalHeight + menuOpts.pad.t + menuOpts.pad.b; var graphSize = gd2._fullLayout._size; dims.lx = graphSize.l + graphSize.w * menuOpts.x; dims.ly = graphSize.t + graphSize.h * (1 - menuOpts.y); var xanchor = "left"; if (Lib.isRightAnchor(menuOpts)) { dims.lx -= paddedWidth; xanchor = "right"; } if (Lib.isCenterAnchor(menuOpts)) { dims.lx -= paddedWidth / 2; xanchor = "center"; } var yanchor = "top"; if (Lib.isBottomAnchor(menuOpts)) { dims.ly -= paddedHeight; yanchor = "bottom"; } if (Lib.isMiddleAnchor(menuOpts)) { dims.ly -= paddedHeight / 2; yanchor = "middle"; } dims.totalWidth = Math.ceil(dims.totalWidth); dims.totalHeight = Math.ceil(dims.totalHeight); dims.lx = Math.round(dims.lx); dims.ly = Math.round(dims.ly); Plots.autoMargin(gd2, autoMarginId(menuOpts), { x: menuOpts.x, y: menuOpts.y, l: paddedWidth * ({ right: 1, center: 0.5 }[xanchor] || 0), r: paddedWidth * ({ left: 1, center: 0.5 }[xanchor] || 0), b: paddedHeight * ({ top: 1, middle: 0.5 }[yanchor] || 0), t: paddedHeight * ({ bottom: 1, middle: 0.5 }[yanchor] || 0) }); } function autoMarginId(menuOpts) { return constants.autoMarginIdRoot + menuOpts._index; } function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; var rect = item.select("." + constants.itemRectClassName); var text = item.select("." + constants.itemTextClassName); var borderWidth = menuOpts.borderwidth; var index = posOpts.index; var dims = menuOpts._dims; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ["up", "down"].indexOf(menuOpts.direction) !== -1; var finalHeight = overrideOpts.height || (isVertical ? dims.heights[index] : dims.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? dims.width1 : dims.widths[index]), height: finalHeight }); var tHeight = menuOpts.font.size * LINE_SPACING; var tLines = svgTextUtils.lineCount(text); var spanOffset = (tLines - 1) * tHeight / 2; svgTextUtils.positionText( text, constants.textOffsetX, finalHeight / 2 - spanOffset + constants.textOffsetY ); if (isVertical) { posOpts.y += dims.heights[index] + posOpts.yPad; } else { posOpts.x += dims.widths[index] + posOpts.xPad; } posOpts.index++; } function removeAllButtons(gButton, newMenuIndexAttr) { gButton.attr(constants.menuIndexAttrName, newMenuIndexAttr || "-1").selectAll("g." + constants.dropdownButtonClassName).remove(); } } }); // node_modules/plotly.js/src/components/updatemenus/index.js var require_updatemenus = __commonJS({ "node_modules/plotly.js/src/components/updatemenus/index.js"(exports2, module2) { "use strict"; var constants = require_constants9(); module2.exports = { moduleType: "component", name: constants.name, layoutAttributes: require_attributes18(), supplyLayoutDefaults: require_defaults14(), draw: require_draw7() }; } }); // node_modules/plotly.js/src/components/sliders/constants.js var require_constants10 = __commonJS({ "node_modules/plotly.js/src/components/sliders/constants.js"(exports2, module2) { "use strict"; module2.exports = { // layout attribute name name: "sliders", // class names containerClassName: "slider-container", groupClassName: "slider-group", inputAreaClass: "slider-input-area", railRectClass: "slider-rail-rect", railTouchRectClass: "slider-rail-touch-rect", gripRectClass: "slider-grip-rect", tickRectClass: "slider-tick-rect", inputProxyClass: "slider-input-proxy", labelsClass: "slider-labels", labelGroupClass: "slider-label-group", labelClass: "slider-label", currentValueClass: "slider-current-value", railHeight: 5, // DOM attribute name in button group keeping track // of active update menu menuIndexAttrName: "slider-active-index", // id root pass to Plots.autoMargin autoMarginIdRoot: "slider-", // min item width / height minWidth: 30, minHeight: 30, // padding around item text textPadX: 40, // arrow offset off right edge arrowOffsetX: 4, railRadius: 2, railWidth: 5, railBorder: 4, railBorderWidth: 1, railBorderColor: "#bec8d9", railBgColor: "#f8fafc", // The distance of the rail from the edge of the touchable area // Slightly less than the step inset because of the curved edges // of the rail railInset: 8, // The distance from the extremal tick marks to the edge of the // touchable area. This is basically the same as the grip radius, // but for other styles it wouldn't really need to be. stepInset: 10, gripRadius: 10, gripWidth: 20, gripHeight: 20, gripBorder: 20, gripBorderWidth: 1, gripBorderColor: "#bec8d9", gripBgColor: "#f6f8fa", gripBgActiveColor: "#dbdde0", labelPadding: 8, labelOffset: 0, tickWidth: 1, tickColor: "#333", tickOffset: 25, tickLength: 7, minorTickOffset: 25, minorTickColor: "#333", minorTickLength: 4, // Extra space below the current value label: currentValuePadding: 8, currentValueInset: 0 }; } }); // node_modules/plotly.js/src/components/sliders/attributes.js var require_attributes19 = __commonJS({ "node_modules/plotly.js/src/components/sliders/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var padAttrs = require_pad_attributes(); var extendDeepAll = require_extend().extendDeepAll; var overrideAll = require_edit_types().overrideAll; var animationAttrs = require_animation_attributes(); var templatedArray = require_plot_template().templatedArray; var constants = require_constants10(); var stepsAttrs = templatedArray("step", { visible: { valType: "boolean", dflt: true, description: [ "Determines whether or not this step is included in the slider." ].join(" ") }, method: { valType: "enumerated", values: ["restyle", "relayout", "animate", "update", "skip"], dflt: "restyle", description: [ "Sets the Plotly method to be called when the slider value is changed.", "If the `skip` method is used, the API slider will function as normal", "but will perform no API calls and will not bind automatically to state", "updates. This may be used to create a component interface and attach to", "slider events manually via JavaScript." ].join(" ") }, args: { valType: "info_array", freeLength: true, items: [ { valType: "any" }, { valType: "any" }, { valType: "any" } ], description: [ "Sets the arguments values to be passed to the Plotly", "method set in `method` on slide." ].join(" ") }, label: { valType: "string", description: "Sets the text label to appear on the slider" }, value: { valType: "string", description: [ "Sets the value of the slider step, used to refer to the step programatically.", "Defaults to the slider label if not provided." ].join(" ") }, execute: { valType: "boolean", dflt: true, description: [ "When true, the API method is executed. When false, all other behaviors are the same", "and command execution is skipped. This may be useful when hooking into, for example,", "the `plotly_sliderchange` method and executing the API command manually without losing", "the benefit of the slider automatically binding to the state of the plot through the", "specification of `method` and `args`." ].join(" ") } }); module2.exports = overrideAll(templatedArray("slider", { visible: { valType: "boolean", dflt: true, description: [ "Determines whether or not the slider is visible." ].join(" ") }, active: { valType: "number", min: 0, dflt: 0, description: [ "Determines which button (by index starting from 0) is", "considered active." ].join(" ") }, steps: stepsAttrs, lenmode: { valType: "enumerated", values: ["fraction", "pixels"], dflt: "fraction", description: [ "Determines whether this slider length", "is set in units of plot *fraction* or in *pixels.", "Use `len` to set the value." ].join(" ") }, len: { valType: "number", min: 0, dflt: 1, description: [ "Sets the length of the slider", "This measure excludes the padding of both ends.", "That is, the slider's length is this length minus the", "padding on both ends." ].join(" ") }, x: { valType: "number", min: -2, max: 3, dflt: 0, description: "Sets the x position (in normalized coordinates) of the slider." }, pad: extendDeepAll(padAttrs({ editType: "arraydraw" }), { description: "Set the padding of the slider component along each side." }, { t: { dflt: 20 } }), xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left", description: [ "Sets the slider's horizontal position anchor.", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the range selector." ].join(" ") }, y: { valType: "number", min: -2, max: 3, dflt: 0, description: "Sets the y position (in normalized coordinates) of the slider." }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "top", description: [ "Sets the slider's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the range selector." ].join(" ") }, transition: { duration: { valType: "number", min: 0, dflt: 150, description: "Sets the duration of the slider transition" }, easing: { valType: "enumerated", values: animationAttrs.transition.easing.values, dflt: "cubic-in-out", description: "Sets the easing function of the slider transition" } }, currentvalue: { visible: { valType: "boolean", dflt: true, description: [ "Shows the currently-selected value above the slider." ].join(" ") }, xanchor: { valType: "enumerated", values: ["left", "center", "right"], dflt: "left", description: [ "The alignment of the value readout relative to the length of the slider." ].join(" ") }, offset: { valType: "number", dflt: 10, description: [ "The amount of space, in pixels, between the current value label", "and the slider." ].join(" ") }, prefix: { valType: "string", description: "When currentvalue.visible is true, this sets the prefix of the label." }, suffix: { valType: "string", description: "When currentvalue.visible is true, this sets the suffix of the label." }, font: fontAttrs({ description: "Sets the font of the current value label text." }) }, font: fontAttrs({ description: "Sets the font of the slider step labels." }), activebgcolor: { valType: "color", dflt: constants.gripBgActiveColor, description: [ "Sets the background color of the slider grip", "while dragging." ].join(" ") }, bgcolor: { valType: "color", dflt: constants.railBgColor, description: "Sets the background color of the slider." }, bordercolor: { valType: "color", dflt: constants.railBorderColor, description: "Sets the color of the border enclosing the slider." }, borderwidth: { valType: "number", min: 0, dflt: constants.railBorderWidth, description: "Sets the width (in px) of the border enclosing the slider." }, ticklen: { valType: "number", min: 0, dflt: constants.tickLength, description: "Sets the length in pixels of step tick marks" }, tickcolor: { valType: "color", dflt: constants.tickColor, description: "Sets the color of the border enclosing the slider." }, tickwidth: { valType: "number", min: 0, dflt: 1, description: "Sets the tick width (in px)." }, minorticklen: { valType: "number", min: 0, dflt: constants.minorTickLength, description: "Sets the length in pixels of minor step tick marks" } }), "arraydraw", "from-root"); } }); // node_modules/plotly.js/src/components/sliders/defaults.js var require_defaults15 = __commonJS({ "node_modules/plotly.js/src/components/sliders/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes19(); var constants = require_constants10(); var name = constants.name; var stepAttrs = attributes.steps; module2.exports = function slidersDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, { name, handleItemDefaults: sliderDefaults }); }; function sliderDefaults(sliderIn, sliderOut, layoutOut) { function coerce(attr, dflt) { return Lib.coerce(sliderIn, sliderOut, attributes, attr, dflt); } var steps = handleArrayContainerDefaults(sliderIn, sliderOut, { name: "steps", handleItemDefaults: stepDefaults }); var stepCount = 0; for (var i = 0; i < steps.length; i++) { if (steps[i].visible) stepCount++; } var visible; if (stepCount < 2) visible = sliderOut.visible = false; else visible = coerce("visible"); if (!visible) return; sliderOut._stepCount = stepCount; var visSteps = sliderOut._visibleSteps = Lib.filterVisible(steps); var active = coerce("active"); if (!(steps[active] || {}).visible) sliderOut.active = visSteps[0]._index; coerce("x"); coerce("y"); Lib.noneOrAll(sliderIn, sliderOut, ["x", "y"]); coerce("xanchor"); coerce("yanchor"); coerce("len"); coerce("lenmode"); coerce("pad.t"); coerce("pad.r"); coerce("pad.b"); coerce("pad.l"); Lib.coerceFont(coerce, "font", layoutOut.font); var currentValueIsVisible = coerce("currentvalue.visible"); if (currentValueIsVisible) { coerce("currentvalue.xanchor"); coerce("currentvalue.prefix"); coerce("currentvalue.suffix"); coerce("currentvalue.offset"); Lib.coerceFont(coerce, "currentvalue.font", sliderOut.font); } coerce("transition.duration"); coerce("transition.easing"); coerce("bgcolor"); coerce("activebgcolor"); coerce("bordercolor"); coerce("borderwidth"); coerce("ticklen"); coerce("tickwidth"); coerce("tickcolor"); coerce("minorticklen"); } function stepDefaults(valueIn, valueOut) { function coerce(attr, dflt) { return Lib.coerce(valueIn, valueOut, stepAttrs, attr, dflt); } var visible; if (valueIn.method !== "skip" && !Array.isArray(valueIn.args)) { visible = valueOut.visible = false; } else visible = coerce("visible"); if (visible) { coerce("method"); coerce("args"); var label = coerce("label", "step-" + valueOut._index); coerce("value", label); coerce("execute"); } } } }); // node_modules/plotly.js/src/components/sliders/draw.js var require_draw8 = __commonJS({ "node_modules/plotly.js/src/components/sliders/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Plots = require_plots(); var Color = require_color(); var Drawing = require_drawing(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var svgTextUtils = require_svg_text_utils(); var arrayEditor = require_plot_template().arrayEditor; var constants = require_constants10(); var alignmentConstants = require_alignment(); var LINE_SPACING = alignmentConstants.LINE_SPACING; var FROM_TL = alignmentConstants.FROM_TL; var FROM_BR = alignmentConstants.FROM_BR; module2.exports = function draw(gd2) { var staticPlot = gd2._context.staticPlot; var fullLayout = gd2._fullLayout; var sliderData = makeSliderData(fullLayout, gd2); var sliders = fullLayout._infolayer.selectAll("g." + constants.containerClassName).data(sliderData.length > 0 ? [0] : []); sliders.enter().append("g").classed(constants.containerClassName, true).style("cursor", staticPlot ? null : "ew-resize"); function clearSlider(sliderOpts2) { if (sliderOpts2._commandObserver) { sliderOpts2._commandObserver.remove(); delete sliderOpts2._commandObserver; } Plots.autoMargin(gd2, autoMarginId(sliderOpts2)); } sliders.exit().each(function() { d3.select(this).selectAll("g." + constants.groupClassName).each(clearSlider); }).remove(); if (sliderData.length === 0) return; var sliderGroups = sliders.selectAll("g." + constants.groupClassName).data(sliderData, keyFunction); sliderGroups.enter().append("g").classed(constants.groupClassName, true); sliderGroups.exit().each(clearSlider).remove(); for (var i = 0; i < sliderData.length; i++) { var sliderOpts = sliderData[i]; findDimensions(gd2, sliderOpts); } sliderGroups.each(function(sliderOpts2) { var gSlider = d3.select(this); computeLabelSteps(sliderOpts2); Plots.manageCommandObserver(gd2, sliderOpts2, sliderOpts2._visibleSteps, function(data) { var opts = gSlider.data()[0]; if (opts.active === data.index) return; if (opts._dragging) return; setActive(gd2, gSlider, opts, data.index, false, true); }); drawSlider(gd2, d3.select(this), sliderOpts2); }); }; function autoMarginId(sliderOpts) { return constants.autoMarginIdRoot + sliderOpts._index; } function makeSliderData(fullLayout, gd2) { var contOpts = fullLayout[constants.name]; var sliderData = []; for (var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if (!item.visible) continue; item._gd = gd2; sliderData.push(item); } return sliderData; } function keyFunction(opts) { return opts._index; } function findDimensions(gd2, sliderOpts) { var sliderLabels = Drawing.tester.selectAll("g." + constants.labelGroupClass).data(sliderOpts._visibleSteps); sliderLabels.enter().append("g").classed(constants.labelGroupClass, true); var maxLabelWidth = 0; var labelHeight = 0; sliderLabels.each(function(stepOpts) { var labelGroup = d3.select(this); var text = drawLabel(labelGroup, { step: stepOpts }, sliderOpts); var textNode = text.node(); if (textNode) { var bBox = Drawing.bBox(textNode); labelHeight = Math.max(labelHeight, bBox.height); maxLabelWidth = Math.max(maxLabelWidth, bBox.width); } }); sliderLabels.remove(); var dims = sliderOpts._dims = {}; dims.inputAreaWidth = Math.max( constants.railWidth, constants.gripHeight ); var graphSize = gd2._fullLayout._size; dims.lx = graphSize.l + graphSize.w * sliderOpts.x; dims.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); if (sliderOpts.lenmode === "fraction") { dims.outerLength = Math.round(graphSize.w * sliderOpts.len); } else { dims.outerLength = sliderOpts.len; } dims.inputAreaStart = 0; dims.inputAreaLength = Math.round(dims.outerLength - sliderOpts.pad.l - sliderOpts.pad.r); var textableInputLength = dims.inputAreaLength - 2 * constants.stepInset; var availableSpacePerLabel = textableInputLength / (sliderOpts._stepCount - 1); var computedSpacePerLabel = maxLabelWidth + constants.labelPadding; dims.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); dims.labelHeight = labelHeight; dims.currentValueMaxWidth = 0; dims.currentValueHeight = 0; dims.currentValueTotalHeight = 0; dims.currentValueMaxLines = 1; if (sliderOpts.currentvalue.visible) { var dummyGroup = Drawing.tester.append("g"); sliderLabels.each(function(stepOpts) { var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); var curValSize = curValPrefix.node() && Drawing.bBox(curValPrefix.node()) || { width: 0, height: 0 }; var lines = svgTextUtils.lineCount(curValPrefix); dims.currentValueMaxWidth = Math.max(dims.currentValueMaxWidth, Math.ceil(curValSize.width)); dims.currentValueHeight = Math.max(dims.currentValueHeight, Math.ceil(curValSize.height)); dims.currentValueMaxLines = Math.max(dims.currentValueMaxLines, lines); }); dims.currentValueTotalHeight = dims.currentValueHeight + sliderOpts.currentvalue.offset; dummyGroup.remove(); } dims.height = dims.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + dims.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = "left"; if (Lib.isRightAnchor(sliderOpts)) { dims.lx -= dims.outerLength; xanchor = "right"; } if (Lib.isCenterAnchor(sliderOpts)) { dims.lx -= dims.outerLength / 2; xanchor = "center"; } var yanchor = "top"; if (Lib.isBottomAnchor(sliderOpts)) { dims.ly -= dims.height; yanchor = "bottom"; } if (Lib.isMiddleAnchor(sliderOpts)) { dims.ly -= dims.height / 2; yanchor = "middle"; } dims.outerLength = Math.ceil(dims.outerLength); dims.height = Math.ceil(dims.height); dims.lx = Math.round(dims.lx); dims.ly = Math.round(dims.ly); var marginOpts = { y: sliderOpts.y, b: dims.height * FROM_BR[yanchor], t: dims.height * FROM_TL[yanchor] }; if (sliderOpts.lenmode === "fraction") { marginOpts.l = 0; marginOpts.xl = sliderOpts.x - sliderOpts.len * FROM_TL[xanchor]; marginOpts.r = 0; marginOpts.xr = sliderOpts.x + sliderOpts.len * FROM_BR[xanchor]; } else { marginOpts.x = sliderOpts.x; marginOpts.l = dims.outerLength * FROM_TL[xanchor]; marginOpts.r = dims.outerLength * FROM_BR[xanchor]; } Plots.autoMargin(gd2, autoMarginId(sliderOpts), marginOpts); } function drawSlider(gd2, sliderGroup, sliderOpts) { if (!(sliderOpts.steps[sliderOpts.active] || {}).visible) { sliderOpts.active = sliderOpts._visibleSteps[0]._index; } sliderGroup.call(drawCurrentValue, sliderOpts).call(drawRail, sliderOpts).call(drawLabelGroup, sliderOpts).call(drawTicks, sliderOpts).call(drawTouchRect, gd2, sliderOpts).call(drawGrip, gd2, sliderOpts); var dims = sliderOpts._dims; Drawing.setTranslate(sliderGroup, dims.lx + sliderOpts.pad.l, dims.ly + sliderOpts.pad.t); sliderGroup.call(setGripPosition, sliderOpts, false); sliderGroup.call(drawCurrentValue, sliderOpts); } function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { if (!sliderOpts.currentvalue.visible) return; var dims = sliderOpts._dims; var x02, textAnchor; switch (sliderOpts.currentvalue.xanchor) { case "right": x02 = dims.inputAreaLength - constants.currentValueInset - dims.currentValueMaxWidth; textAnchor = "left"; break; case "center": x02 = dims.inputAreaLength * 0.5; textAnchor = "middle"; break; default: x02 = constants.currentValueInset; textAnchor = "left"; } var text = Lib.ensureSingle(sliderGroup, "text", constants.labelClass, function(s) { s.attr({ "text-anchor": textAnchor, "data-notex": 1 }); }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ""; if (typeof valueOverride === "string") { str += valueOverride; } else { var curVal = sliderOpts.steps[sliderOpts.active].label; var _meta = sliderOpts._gd._fullLayout._meta; if (_meta) curVal = Lib.templateString(curVal, _meta); str += curVal; } if (sliderOpts.currentvalue.suffix) { str += sliderOpts.currentvalue.suffix; } text.call(Drawing.font, sliderOpts.currentvalue.font).text(str).call(svgTextUtils.convertToTspans, sliderOpts._gd); var lines = svgTextUtils.lineCount(text); var y02 = (dims.currentValueMaxLines + 1 - lines) * sliderOpts.currentvalue.font.size * LINE_SPACING; svgTextUtils.positionText(text, x02, y02); return text; } function drawGrip(sliderGroup, gd2, sliderOpts) { var grip = Lib.ensureSingle(sliderGroup, "rect", constants.gripRectClass, function(s) { s.call(attachGripEvents, gd2, sliderGroup, sliderOpts).style("pointer-events", "all"); }); grip.attr({ width: constants.gripWidth, height: constants.gripHeight, rx: constants.gripRadius, ry: constants.gripRadius }).call(Color.stroke, sliderOpts.bordercolor).call(Color.fill, sliderOpts.bgcolor).style("stroke-width", sliderOpts.borderwidth + "px"); } function drawLabel(item, data, sliderOpts) { var text = Lib.ensureSingle(item, "text", constants.labelClass, function(s) { s.attr({ "text-anchor": "middle", "data-notex": 1 }); }); var tx = data.step.label; var _meta = sliderOpts._gd._fullLayout._meta; if (_meta) tx = Lib.templateString(tx, _meta); text.call(Drawing.font, sliderOpts.font).text(tx).call(svgTextUtils.convertToTspans, sliderOpts._gd); return text; } function drawLabelGroup(sliderGroup, sliderOpts) { var labels = Lib.ensureSingle(sliderGroup, "g", constants.labelsClass); var dims = sliderOpts._dims; var labelItems = labels.selectAll("g." + constants.labelGroupClass).data(dims.labelSteps); labelItems.enter().append("g").classed(constants.labelGroupClass, true); labelItems.exit().remove(); labelItems.each(function(d) { var item = d3.select(this); item.call(drawLabel, d, sliderOpts); Drawing.setTranslate( item, normalizedValueToPosition(sliderOpts, d.fraction), constants.tickOffset + sliderOpts.ticklen + // position is the baseline of the top line of text only, even // if the label spans multiple lines sliderOpts.font.size * LINE_SPACING + constants.labelOffset + dims.currentValueTotalHeight ); }); } function handleInput(gd2, sliderGroup, sliderOpts, normalizedPosition, doTransition) { var quantizedPosition = Math.round(normalizedPosition * (sliderOpts._stepCount - 1)); var quantizedIndex = sliderOpts._visibleSteps[quantizedPosition]._index; if (quantizedIndex !== sliderOpts.active) { setActive(gd2, sliderGroup, sliderOpts, quantizedIndex, true, doTransition); } } function setActive(gd2, sliderGroup, sliderOpts, index, doCallback, doTransition) { var previousActive = sliderOpts.active; sliderOpts.active = index; arrayEditor(gd2.layout, constants.name, sliderOpts).applyUpdate("active", index); var step = sliderOpts.steps[sliderOpts.active]; sliderGroup.call(setGripPosition, sliderOpts, doTransition); sliderGroup.call(drawCurrentValue, sliderOpts); gd2.emit("plotly_sliderchange", { slider: sliderOpts, step: sliderOpts.steps[sliderOpts.active], interaction: doCallback, previousActive }); if (step && step.method && doCallback) { if (sliderGroup._nextMethod) { sliderGroup._nextMethod.step = step; sliderGroup._nextMethod.doCallback = doCallback; sliderGroup._nextMethod.doTransition = doTransition; } else { sliderGroup._nextMethod = { step, doCallback, doTransition }; sliderGroup._nextMethodRaf = window.requestAnimationFrame(function() { var _step = sliderGroup._nextMethod.step; if (!_step.method) return; if (_step.execute) { Plots.executeAPICommand(gd2, _step.method, _step.args); } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; }); } } } function attachGripEvents(item, gd2, sliderGroup) { if (gd2._context.staticPlot) return; var node = sliderGroup.node(); var $gd = d3.select(gd2); function getSliderOpts() { return sliderGroup.data()[0]; } function mouseDownHandler() { var sliderOpts = getSliderOpts(); gd2.emit("plotly_sliderstart", { slider: sliderOpts }); var grip = sliderGroup.select("." + constants.gripRectClass); d3.event.stopPropagation(); d3.event.preventDefault(); grip.call(Color.fill, sliderOpts.activebgcolor); var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]); handleInput(gd2, sliderGroup, sliderOpts, normalizedPosition, true); sliderOpts._dragging = true; function mouseMoveHandler() { var sliderOpts2 = getSliderOpts(); var normalizedPosition2 = positionToNormalizedValue(sliderOpts2, d3.mouse(node)[0]); handleInput(gd2, sliderGroup, sliderOpts2, normalizedPosition2, false); } $gd.on("mousemove", mouseMoveHandler); $gd.on("touchmove", mouseMoveHandler); function mouseUpHandler() { var sliderOpts2 = getSliderOpts(); sliderOpts2._dragging = false; grip.call(Color.fill, sliderOpts2.bgcolor); $gd.on("mouseup", null); $gd.on("mousemove", null); $gd.on("touchend", null); $gd.on("touchmove", null); gd2.emit("plotly_sliderend", { slider: sliderOpts2, step: sliderOpts2.steps[sliderOpts2.active] }); } $gd.on("mouseup", mouseUpHandler); $gd.on("touchend", mouseUpHandler); } item.on("mousedown", mouseDownHandler); item.on("touchstart", mouseDownHandler); } function drawTicks(sliderGroup, sliderOpts) { var tick = sliderGroup.selectAll("rect." + constants.tickRectClass).data(sliderOpts._visibleSteps); var dims = sliderOpts._dims; tick.enter().append("rect").classed(constants.tickRectClass, true); tick.exit().remove(); tick.attr({ width: sliderOpts.tickwidth + "px", "shape-rendering": "crispEdges" }); tick.each(function(d, i) { var isMajor = i % dims.labelStride === 0; var item = d3.select(this); item.attr({ height: isMajor ? sliderOpts.ticklen : sliderOpts.minorticklen }).call(Color.fill, isMajor ? sliderOpts.tickcolor : sliderOpts.tickcolor); Drawing.setTranslate( item, normalizedValueToPosition(sliderOpts, i / (sliderOpts._stepCount - 1)) - 0.5 * sliderOpts.tickwidth, (isMajor ? constants.tickOffset : constants.minorTickOffset) + dims.currentValueTotalHeight ); }); } function computeLabelSteps(sliderOpts) { var dims = sliderOpts._dims; dims.labelSteps = []; var nsteps = sliderOpts._stepCount; for (var i = 0; i < nsteps; i += dims.labelStride) { dims.labelSteps.push({ fraction: i / (nsteps - 1), step: sliderOpts._visibleSteps[i] }); } } function setGripPosition(sliderGroup, sliderOpts, doTransition) { var grip = sliderGroup.select("rect." + constants.gripRectClass); var quantizedIndex = 0; for (var i = 0; i < sliderOpts._stepCount; i++) { if (sliderOpts._visibleSteps[i]._index === sliderOpts.active) { quantizedIndex = i; break; } } var x = normalizedValueToPosition(sliderOpts, quantizedIndex / (sliderOpts._stepCount - 1)); if (sliderOpts._invokingCommand) return; var el = grip; if (doTransition && sliderOpts.transition.duration > 0) { el = el.transition().duration(sliderOpts.transition.duration).ease(sliderOpts.transition.easing); } el.attr("transform", strTranslate(x - constants.gripWidth * 0.5, sliderOpts._dims.currentValueTotalHeight)); } function normalizedValueToPosition(sliderOpts, normalizedPosition) { var dims = sliderOpts._dims; return dims.inputAreaStart + constants.stepInset + (dims.inputAreaLength - 2 * constants.stepInset) * Math.min(1, Math.max(0, normalizedPosition)); } function positionToNormalizedValue(sliderOpts, position) { var dims = sliderOpts._dims; return Math.min(1, Math.max(0, (position - constants.stepInset - dims.inputAreaStart) / (dims.inputAreaLength - 2 * constants.stepInset - 2 * dims.inputAreaStart))); } function drawTouchRect(sliderGroup, gd2, sliderOpts) { var dims = sliderOpts._dims; var rect = Lib.ensureSingle(sliderGroup, "rect", constants.railTouchRectClass, function(s) { s.call(attachGripEvents, gd2, sliderGroup, sliderOpts).style("pointer-events", "all"); }); rect.attr({ width: dims.inputAreaLength, height: Math.max(dims.inputAreaWidth, constants.tickOffset + sliderOpts.ticklen + dims.labelHeight) }).call(Color.fill, sliderOpts.bgcolor).attr("opacity", 0); Drawing.setTranslate(rect, 0, dims.currentValueTotalHeight); } function drawRail(sliderGroup, sliderOpts) { var dims = sliderOpts._dims; var computedLength = dims.inputAreaLength - constants.railInset * 2; var rect = Lib.ensureSingle(sliderGroup, "rect", constants.railRectClass); rect.attr({ width: computedLength, height: constants.railWidth, rx: constants.railRadius, ry: constants.railRadius, "shape-rendering": "crispEdges" }).call(Color.stroke, sliderOpts.bordercolor).call(Color.fill, sliderOpts.bgcolor).style("stroke-width", sliderOpts.borderwidth + "px"); Drawing.setTranslate( rect, constants.railInset, (dims.inputAreaWidth - constants.railWidth) * 0.5 + dims.currentValueTotalHeight ); } } }); // node_modules/plotly.js/src/components/sliders/index.js var require_sliders = __commonJS({ "node_modules/plotly.js/src/components/sliders/index.js"(exports2, module2) { "use strict"; var constants = require_constants10(); module2.exports = { moduleType: "component", name: constants.name, layoutAttributes: require_attributes19(), supplyLayoutDefaults: require_defaults15(), draw: require_draw8() }; } }); // node_modules/plotly.js/src/components/rangeslider/attributes.js var require_attributes20 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/attributes.js"(exports2, module2) { "use strict"; var colorAttributes = require_attributes3(); module2.exports = { bgcolor: { valType: "color", dflt: colorAttributes.background, editType: "plot", description: "Sets the background color of the range slider." }, bordercolor: { valType: "color", dflt: colorAttributes.defaultLine, editType: "plot", description: "Sets the border color of the range slider." }, borderwidth: { valType: "integer", dflt: 0, min: 0, editType: "plot", description: "Sets the border width of the range slider." }, autorange: { valType: "boolean", dflt: true, editType: "calc", impliedEdits: { "range[0]": void 0, "range[1]": void 0 }, description: [ "Determines whether or not the range slider range is", "computed in relation to the input data.", "If `range` is provided, then `autorange` is set to *false*." ].join(" ") }, range: { valType: "info_array", items: [ { valType: "any", editType: "calc", impliedEdits: { "^autorange": false } }, { valType: "any", editType: "calc", impliedEdits: { "^autorange": false } } ], editType: "calc", impliedEdits: { autorange: false }, description: [ "Sets the range of the range slider.", "If not set, defaults to the full xaxis range.", "If the axis `type` is *log*, then you must take the", "log of your desired range.", "If the axis `type` is *date*, it should be date strings,", "like date data, though Date objects and unix milliseconds", "will be accepted and converted to strings.", "If the axis `type` is *category*, it should be numbers,", "using the scale where each category is assigned a serial", "number from zero in the order it appears." ].join(" ") }, thickness: { valType: "number", dflt: 0.15, min: 0, max: 1, editType: "plot", description: [ "The height of the range slider as a fraction of the", "total plot area height." ].join(" ") }, visible: { valType: "boolean", dflt: true, editType: "calc", description: [ "Determines whether or not the range slider will be visible.", "If visible, perpendicular axes will be set to `fixedrange`" ].join(" ") }, editType: "calc" }; } }); // node_modules/plotly.js/src/components/rangeslider/oppaxis_attributes.js var require_oppaxis_attributes = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/oppaxis_attributes.js"(exports2, module2) { "use strict"; module2.exports = { // not really a 'subplot' attribute container, // but this is the flag we use to denote attributes that // support yaxis, yaxis2, yaxis3, ... counters _isSubplotObj: true, rangemode: { valType: "enumerated", values: ["auto", "fixed", "match"], dflt: "match", editType: "calc", description: [ "Determines whether or not the range of this axis in", "the rangeslider use the same value than in the main plot", "when zooming in/out.", "If *auto*, the autorange will be used.", "If *fixed*, the `range` is used.", "If *match*, the current range of the corresponding y-axis on the main subplot is used." ].join(" ") }, range: { valType: "info_array", items: [ { valType: "any", editType: "plot" }, { valType: "any", editType: "plot" } ], editType: "plot", description: [ "Sets the range of this axis for the rangeslider." ].join(" ") }, editType: "calc" }; } }); // node_modules/plotly.js/src/components/rangeslider/constants.js var require_constants11 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/constants.js"(exports2, module2) { "use strict"; module2.exports = { // attribute container name name: "rangeslider", // class names containerClassName: "rangeslider-container", bgClassName: "rangeslider-bg", rangePlotClassName: "rangeslider-rangeplot", maskMinClassName: "rangeslider-mask-min", maskMaxClassName: "rangeslider-mask-max", slideBoxClassName: "rangeslider-slidebox", grabberMinClassName: "rangeslider-grabber-min", grabAreaMinClassName: "rangeslider-grabarea-min", handleMinClassName: "rangeslider-handle-min", grabberMaxClassName: "rangeslider-grabber-max", grabAreaMaxClassName: "rangeslider-grabarea-max", handleMaxClassName: "rangeslider-handle-max", maskMinOppAxisClassName: "rangeslider-mask-min-opp-axis", maskMaxOppAxisClassName: "rangeslider-mask-max-opp-axis", // style constants maskColor: "rgba(0,0,0,0.4)", maskOppAxisColor: "rgba(0,0,0,0.2)", slideBoxFill: "transparent", slideBoxCursor: "ew-resize", grabAreaFill: "transparent", grabAreaCursor: "col-resize", grabAreaWidth: 10, handleWidth: 4, handleRadius: 1, handleStrokeWidth: 1, extraPad: 15 }; } }); // node_modules/plotly.js/src/components/rangeslider/helpers.js var require_helpers11 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/helpers.js"(exports2) { "use strict"; var axisIDs = require_axis_ids(); var svgTextUtils = require_svg_text_utils(); var constants = require_constants11(); var LINE_SPACING = require_alignment().LINE_SPACING; var name = constants.name; function isVisible(ax) { var rangeSlider = ax && ax[name]; return rangeSlider && rangeSlider.visible; } exports2.isVisible = isVisible; exports2.makeData = function(fullLayout) { var axes = axisIDs.list({ _fullLayout: fullLayout }, "x", true); var margin = fullLayout.margin; var rangeSliderData = []; if (!fullLayout._has("gl2d")) { for (var i = 0; i < axes.length; i++) { var ax = axes[i]; if (isVisible(ax)) { rangeSliderData.push(ax); var opts = ax[name]; opts._id = name + ax._id; opts._height = (fullLayout.height - margin.b - margin.t) * opts.thickness; opts._offsetShift = Math.floor(opts.borderwidth / 2); } } } fullLayout._rangeSliderData = rangeSliderData; }; exports2.autoMarginOpts = function(gd2, ax) { var fullLayout = gd2._fullLayout; var opts = ax[name]; var axLetter = ax._id.charAt(0); var bottomDepth = 0; var titleHeight = 0; if (ax.side === "bottom") { bottomDepth = ax._depth; if (ax.title.text !== fullLayout._dfltTitle[axLetter]) { titleHeight = 1.5 * ax.title.font.size + 10 + opts._offsetShift; var extraLines = (ax.title.text.match(svgTextUtils.BR_TAG_ALL) || []).length; titleHeight += extraLines * ax.title.font.size * LINE_SPACING; } } return { x: 0, y: ax._counterDomainMin, l: 0, r: 0, t: 0, b: opts._height + bottomDepth + Math.max(fullLayout.margin.b, titleHeight), pad: constants.extraPad + opts._offsetShift * 2 }; }; } }); // node_modules/plotly.js/src/components/rangeslider/defaults.js var require_defaults16 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Template = require_plot_template(); var axisIds = require_axis_ids(); var attributes = require_attributes20(); var oppAxisAttrs = require_oppaxis_attributes(); module2.exports = function handleDefaults(layoutIn, layoutOut, axName) { var axIn = layoutIn[axName]; var axOut = layoutOut[axName]; if (!(axIn.rangeslider || layoutOut._requestRangeslider[axOut._id])) return; if (!Lib.isPlainObject(axIn.rangeslider)) { axIn.rangeslider = {}; } var containerIn = axIn.rangeslider; var containerOut = Template.newContainer(axOut, "rangeslider"); function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); } var rangeContainerIn, rangeContainerOut; function coerceRange(attr, dflt) { return Lib.coerce(rangeContainerIn, rangeContainerOut, oppAxisAttrs, attr, dflt); } var visible = coerce("visible"); if (!visible) return; coerce("bgcolor", layoutOut.plot_bgcolor); coerce("bordercolor"); coerce("borderwidth"); coerce("thickness"); coerce("autorange", !axOut.isValidRange(containerIn.range)); coerce("range"); var subplots = layoutOut._subplots; if (subplots) { var yIds = subplots.cartesian.filter(function(subplotId) { return subplotId.substr(0, subplotId.indexOf("y")) === axisIds.name2id(axName); }).map(function(subplotId) { return subplotId.substr(subplotId.indexOf("y"), subplotId.length); }); var yNames = Lib.simpleMap(yIds, axisIds.id2name); for (var i = 0; i < yNames.length; i++) { var yName = yNames[i]; rangeContainerIn = containerIn[yName] || {}; rangeContainerOut = Template.newContainer(containerOut, yName, "yaxis"); var yAxOut = layoutOut[yName]; var rangemodeDflt; if (rangeContainerIn.range && yAxOut.isValidRange(rangeContainerIn.range)) { rangemodeDflt = "fixed"; } var rangeMode = coerceRange("rangemode", rangemodeDflt); if (rangeMode !== "match") { coerceRange("range", yAxOut.range.slice()); } } } containerOut._input = containerIn; }; } }); // node_modules/plotly.js/src/components/rangeslider/calc_autorange.js var require_calc_autorange3 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/calc_autorange.js"(exports2, module2) { "use strict"; var listAxes = require_axis_ids().list; var getAutoRange = require_autorange().getAutoRange; var constants = require_constants11(); module2.exports = function calcAutorange(gd2) { var axes = listAxes(gd2, "x", true); for (var i = 0; i < axes.length; i++) { var ax = axes[i]; var opts = ax[constants.name]; if (opts && opts.visible && opts.autorange) { opts._input.autorange = true; opts._input.range = opts.range = getAutoRange(gd2, ax); } } }; } }); // node_modules/plotly.js/src/components/rangeslider/draw.js var require_draw9 = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Plots = require_plots(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var Drawing = require_drawing(); var Color = require_color(); var Titles = require_titles(); var Cartesian = require_cartesian(); var axisIDs = require_axis_ids(); var dragElement = require_dragelement(); var setCursor = require_setcursor(); var constants = require_constants11(); module2.exports = function(gd2) { var fullLayout = gd2._fullLayout; var rangeSliderData = fullLayout._rangeSliderData; for (var i = 0; i < rangeSliderData.length; i++) { var opts = rangeSliderData[i][constants.name]; opts._clipId = opts._id + "-" + fullLayout._uid; } function keyFunction(axisOpts) { return axisOpts._name; } var rangeSliders = fullLayout._infolayer.selectAll("g." + constants.containerClassName).data(rangeSliderData, keyFunction); rangeSliders.exit().each(function(axisOpts) { var opts2 = axisOpts[constants.name]; fullLayout._topdefs.select("#" + opts2._clipId).remove(); }).remove(); if (rangeSliderData.length === 0) return; rangeSliders.enter().append("g").classed(constants.containerClassName, true).attr("pointer-events", "all"); rangeSliders.each(function(axisOpts) { var rangeSlider = d3.select(this); var opts2 = axisOpts[constants.name]; var oppAxisOpts = fullLayout[axisIDs.id2name(axisOpts.anchor)]; var oppAxisRangeOpts = opts2[axisIDs.id2name(axisOpts.anchor)]; if (opts2.range) { var rng = Lib.simpleMap(opts2.range, axisOpts.r2l); var axRng = Lib.simpleMap(axisOpts.range, axisOpts.r2l); var newRng; if (axRng[0] < axRng[1]) { newRng = [ Math.min(rng[0], axRng[0]), Math.max(rng[1], axRng[1]) ]; } else { newRng = [ Math.max(rng[0], axRng[0]), Math.min(rng[1], axRng[1]) ]; } opts2.range = opts2._input.range = Lib.simpleMap(newRng, axisOpts.l2r); } axisOpts.cleanRange("rangeslider.range"); var gs2 = fullLayout._size; var domain = axisOpts.domain; opts2._width = gs2.w * (domain[1] - domain[0]); var x = Math.round(gs2.l + gs2.w * domain[0]); var y = Math.round( gs2.t + gs2.h * (1 - axisOpts._counterDomainMin) + (axisOpts.side === "bottom" ? axisOpts._depth : 0) + opts2._offsetShift + constants.extraPad ); rangeSlider.attr("transform", strTranslate(x, y)); opts2._rl = Lib.simpleMap(opts2.range, axisOpts.r2l); var rl0 = opts2._rl[0]; var rl1 = opts2._rl[1]; var drl = rl1 - rl0; opts2.p2d = function(v) { return v / opts2._width * drl + rl0; }; opts2.d2p = function(v) { return (v - rl0) / drl * opts2._width; }; if (axisOpts.rangebreaks) { var rsBreaks = axisOpts.locateBreaks(rl0, rl1); if (rsBreaks.length) { var j, brk; var lBreaks = 0; for (j = 0; j < rsBreaks.length; j++) { brk = rsBreaks[j]; lBreaks += brk.max - brk.min; } var m2 = opts2._width / (rl1 - rl0 - lBreaks); var _B = [-m2 * rl0]; for (j = 0; j < rsBreaks.length; j++) { brk = rsBreaks[j]; _B.push(_B[_B.length - 1] - m2 * (brk.max - brk.min)); } opts2.d2p = function(v) { var b = _B[0]; for (var j2 = 0; j2 < rsBreaks.length; j2++) { var brk2 = rsBreaks[j2]; if (v >= brk2.max) b = _B[j2 + 1]; else if (v < brk2.min) break; } return b + m2 * v; }; for (j = 0; j < rsBreaks.length; j++) { brk = rsBreaks[j]; brk.pmin = opts2.d2p(brk.min); brk.pmax = opts2.d2p(brk.max); } opts2.p2d = function(v) { var b = _B[0]; for (var j2 = 0; j2 < rsBreaks.length; j2++) { var brk2 = rsBreaks[j2]; if (v >= brk2.pmax) b = _B[j2 + 1]; else if (v < brk2.pmin) break; } return (v - b) / m2; }; } } if (oppAxisRangeOpts.rangemode !== "match") { var range0OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[0]); var range1OppAxis = oppAxisOpts.r2l(oppAxisRangeOpts.range[1]); var distOppAxis = range1OppAxis - range0OppAxis; opts2.d2pOppAxis = function(v) { return (v - range0OppAxis) / distOppAxis * opts2._height; }; } rangeSlider.call(drawBg, gd2, axisOpts, opts2).call(addClipPath, gd2, axisOpts, opts2).call(drawRangePlot, gd2, axisOpts, opts2).call(drawMasks, gd2, axisOpts, opts2, oppAxisRangeOpts).call(drawSlideBox, gd2, axisOpts, opts2).call(drawGrabbers, gd2, axisOpts, opts2); setupDragElement(rangeSlider, gd2, axisOpts, opts2); setPixelRange(rangeSlider, gd2, axisOpts, opts2, oppAxisOpts, oppAxisRangeOpts); if (axisOpts.side === "bottom") { Titles.draw(gd2, axisOpts._id + "title", { propContainer: axisOpts, propName: axisOpts._name + ".title", placeholder: fullLayout._dfltTitle.x, attributes: { x: axisOpts._offset + axisOpts._length / 2, y: y + opts2._height + opts2._offsetShift + 10 + 1.5 * axisOpts.title.font.size, "text-anchor": "middle" } }); } }); }; function eventX(event) { if (typeof event.clientX === "number") { return event.clientX; } if (event.touches && event.touches.length > 0) { return event.touches[0].clientX; } return 0; } function setupDragElement(rangeSlider, gd2, axisOpts, opts) { if (gd2._context.staticPlot) return; var slideBox = rangeSlider.select("rect." + constants.slideBoxClassName).node(); var grabAreaMin = rangeSlider.select("rect." + constants.grabAreaMinClassName).node(); var grabAreaMax = rangeSlider.select("rect." + constants.grabAreaMaxClassName).node(); function mouseDownHandler() { var event = d3.event; var target = event.target; var startX = eventX(event); var offsetX = startX - rangeSlider.node().getBoundingClientRect().left; var minVal = opts.d2p(axisOpts._rl[0]); var maxVal = opts.d2p(axisOpts._rl[1]); var dragCover = dragElement.coverSlip(); this.addEventListener("touchmove", mouseMove); this.addEventListener("touchend", mouseUp); dragCover.addEventListener("mousemove", mouseMove); dragCover.addEventListener("mouseup", mouseUp); function mouseMove(e) { var clientX = eventX(e); var delta = +clientX - startX; var pixelMin, pixelMax, cursor; switch (target) { case slideBox: cursor = "ew-resize"; if (minVal + delta > axisOpts._length || maxVal + delta < 0) { return; } pixelMin = minVal + delta; pixelMax = maxVal + delta; break; case grabAreaMin: cursor = "col-resize"; if (minVal + delta > axisOpts._length) { return; } pixelMin = minVal + delta; pixelMax = maxVal; break; case grabAreaMax: cursor = "col-resize"; if (maxVal + delta < 0) { return; } pixelMin = minVal; pixelMax = maxVal + delta; break; default: cursor = "ew-resize"; pixelMin = offsetX; pixelMax = offsetX + delta; break; } if (pixelMax < pixelMin) { var tmp = pixelMax; pixelMax = pixelMin; pixelMin = tmp; } opts._pixelMin = pixelMin; opts._pixelMax = pixelMax; setCursor(d3.select(dragCover), cursor); setDataRange(rangeSlider, gd2, axisOpts, opts); } function mouseUp() { dragCover.removeEventListener("mousemove", mouseMove); dragCover.removeEventListener("mouseup", mouseUp); this.removeEventListener("touchmove", mouseMove); this.removeEventListener("touchend", mouseUp); Lib.removeElement(dragCover); } } rangeSlider.on("mousedown", mouseDownHandler); rangeSlider.on("touchstart", mouseDownHandler); } function setDataRange(rangeSlider, gd2, axisOpts, opts) { function clamp(v) { return axisOpts.l2r(Lib.constrain(v, opts._rl[0], opts._rl[1])); } var dataMin = clamp(opts.p2d(opts._pixelMin)); var dataMax = clamp(opts.p2d(opts._pixelMax)); window.requestAnimationFrame(function() { Registry.call("_guiRelayout", gd2, axisOpts._name + ".range", [dataMin, dataMax]); }); } function setPixelRange(rangeSlider, gd2, axisOpts, opts, oppAxisOpts, oppAxisRangeOpts) { var hw2 = constants.handleWidth / 2; function clamp(v) { return Lib.constrain(v, 0, opts._width); } function clampOppAxis(v) { return Lib.constrain(v, 0, opts._height); } function clampHandle(v) { return Lib.constrain(v, -hw2, opts._width + hw2); } var pixelMin = clamp(opts.d2p(axisOpts._rl[0])); var pixelMax = clamp(opts.d2p(axisOpts._rl[1])); rangeSlider.select("rect." + constants.slideBoxClassName).attr("x", pixelMin).attr("width", pixelMax - pixelMin); rangeSlider.select("rect." + constants.maskMinClassName).attr("width", pixelMin); rangeSlider.select("rect." + constants.maskMaxClassName).attr("x", pixelMax).attr("width", opts._width - pixelMax); if (oppAxisRangeOpts.rangemode !== "match") { var pixelMinOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[1])); var pixelMaxOppAxis = opts._height - clampOppAxis(opts.d2pOppAxis(oppAxisOpts._rl[0])); rangeSlider.select("rect." + constants.maskMinOppAxisClassName).attr("x", pixelMin).attr("height", pixelMinOppAxis).attr("width", pixelMax - pixelMin); rangeSlider.select("rect." + constants.maskMaxOppAxisClassName).attr("x", pixelMin).attr("y", pixelMaxOppAxis).attr("height", opts._height - pixelMaxOppAxis).attr("width", pixelMax - pixelMin); rangeSlider.select("rect." + constants.slideBoxClassName).attr("y", pixelMinOppAxis).attr("height", pixelMaxOppAxis - pixelMinOppAxis); } var offset = 0.5; var xMin = Math.round(clampHandle(pixelMin - hw2)) - offset; var xMax = Math.round(clampHandle(pixelMax - hw2)) + offset; rangeSlider.select("g." + constants.grabberMinClassName).attr("transform", strTranslate(xMin, offset)); rangeSlider.select("g." + constants.grabberMaxClassName).attr("transform", strTranslate(xMax, offset)); } function drawBg(rangeSlider, gd2, axisOpts, opts) { var bg2 = Lib.ensureSingle(rangeSlider, "rect", constants.bgClassName, function(s) { s.attr({ x: 0, y: 0, "shape-rendering": "crispEdges" }); }); var borderCorrect = opts.borderwidth % 2 === 0 ? opts.borderwidth : opts.borderwidth - 1; var offsetShift = -opts._offsetShift; var lw = Drawing.crispRound(gd2, opts.borderwidth); bg2.attr({ width: opts._width + borderCorrect, height: opts._height + borderCorrect, transform: strTranslate(offsetShift, offsetShift), "stroke-width": lw }).call(Color.stroke, opts.bordercolor).call(Color.fill, opts.bgcolor); } function addClipPath(rangeSlider, gd2, axisOpts, opts) { var fullLayout = gd2._fullLayout; var clipPath = Lib.ensureSingleById(fullLayout._topdefs, "clipPath", opts._clipId, function(s) { s.append("rect").attr({ x: 0, y: 0 }); }); clipPath.select("rect").attr({ width: opts._width, height: opts._height }); } function drawRangePlot(rangeSlider, gd2, axisOpts, opts) { var calcData = gd2.calcdata; var rangePlots = rangeSlider.selectAll("g." + constants.rangePlotClassName).data(axisOpts._subplotsWith, Lib.identity); rangePlots.enter().append("g").attr("class", function(id2) { return constants.rangePlotClassName + " " + id2; }).call(Drawing.setClipUrl, opts._clipId, gd2); rangePlots.order(); rangePlots.exit().remove(); var mainplotinfo; rangePlots.each(function(id2, i) { var plotgroup = d3.select(this); var isMainPlot = i === 0; var oppAxisOpts = axisIDs.getFromId(gd2, id2, "y"); var oppAxisName = oppAxisOpts._name; var oppAxisRangeOpts = opts[oppAxisName]; var mockFigure = { data: [], layout: { xaxis: { type: axisOpts.type, domain: [0, 1], range: opts.range.slice(), calendar: axisOpts.calendar }, width: opts._width, height: opts._height, margin: { t: 0, b: 0, l: 0, r: 0 } }, _context: gd2._context }; if (axisOpts.rangebreaks) { mockFigure.layout.xaxis.rangebreaks = axisOpts.rangebreaks; } mockFigure.layout[oppAxisName] = { type: oppAxisOpts.type, domain: [0, 1], range: oppAxisRangeOpts.rangemode !== "match" ? oppAxisRangeOpts.range.slice() : oppAxisOpts.range.slice(), calendar: oppAxisOpts.calendar }; if (oppAxisOpts.rangebreaks) { mockFigure.layout[oppAxisName].rangebreaks = oppAxisOpts.rangebreaks; } Plots.supplyDefaults(mockFigure); var xa2 = mockFigure._fullLayout.xaxis; var ya2 = mockFigure._fullLayout[oppAxisName]; xa2.clearCalc(); xa2.setScale(); ya2.clearCalc(); ya2.setScale(); var plotinfo = { id: id2, plotgroup, xaxis: xa2, yaxis: ya2, isRangePlot: true }; if (isMainPlot) mainplotinfo = plotinfo; else { plotinfo.mainplot = "xy"; plotinfo.mainplotinfo = mainplotinfo; } Cartesian.rangePlot(gd2, plotinfo, filterRangePlotCalcData(calcData, id2)); }); } function filterRangePlotCalcData(calcData, subplotId) { var out = []; for (var i = 0; i < calcData.length; i++) { var calcTrace = calcData[i]; var trace = calcTrace[0].trace; if (trace.xaxis + trace.yaxis === subplotId) { out.push(calcTrace); } } return out; } function drawMasks(rangeSlider, gd2, axisOpts, opts, oppAxisRangeOpts) { var maskMin = Lib.ensureSingle(rangeSlider, "rect", constants.maskMinClassName, function(s) { s.attr({ x: 0, y: 0, "shape-rendering": "crispEdges" }); }); maskMin.attr("height", opts._height).call(Color.fill, constants.maskColor); var maskMax = Lib.ensureSingle(rangeSlider, "rect", constants.maskMaxClassName, function(s) { s.attr({ y: 0, "shape-rendering": "crispEdges" }); }); maskMax.attr("height", opts._height).call(Color.fill, constants.maskColor); if (oppAxisRangeOpts.rangemode !== "match") { var maskMinOppAxis = Lib.ensureSingle(rangeSlider, "rect", constants.maskMinOppAxisClassName, function(s) { s.attr({ y: 0, "shape-rendering": "crispEdges" }); }); maskMinOppAxis.attr("width", opts._width).call(Color.fill, constants.maskOppAxisColor); var maskMaxOppAxis = Lib.ensureSingle(rangeSlider, "rect", constants.maskMaxOppAxisClassName, function(s) { s.attr({ y: 0, "shape-rendering": "crispEdges" }); }); maskMaxOppAxis.attr("width", opts._width).style("border-top", constants.maskOppBorder).call(Color.fill, constants.maskOppAxisColor); } } function drawSlideBox(rangeSlider, gd2, axisOpts, opts) { if (gd2._context.staticPlot) return; var slideBox = Lib.ensureSingle(rangeSlider, "rect", constants.slideBoxClassName, function(s) { s.attr({ y: 0, cursor: constants.slideBoxCursor, "shape-rendering": "crispEdges" }); }); slideBox.attr({ height: opts._height, fill: constants.slideBoxFill }); } function drawGrabbers(rangeSlider, gd2, axisOpts, opts) { var grabberMin = Lib.ensureSingle(rangeSlider, "g", constants.grabberMinClassName); var grabberMax = Lib.ensureSingle(rangeSlider, "g", constants.grabberMaxClassName); var handleFixAttrs = { x: 0, width: constants.handleWidth, rx: constants.handleRadius, fill: Color.background, stroke: Color.defaultLine, "stroke-width": constants.handleStrokeWidth, "shape-rendering": "crispEdges" }; var handleDynamicAttrs = { y: Math.round(opts._height / 4), height: Math.round(opts._height / 2) }; var handleMin = Lib.ensureSingle(grabberMin, "rect", constants.handleMinClassName, function(s) { s.attr(handleFixAttrs); }); handleMin.attr(handleDynamicAttrs); var handleMax = Lib.ensureSingle(grabberMax, "rect", constants.handleMaxClassName, function(s) { s.attr(handleFixAttrs); }); handleMax.attr(handleDynamicAttrs); var grabAreaFixAttrs = { width: constants.grabAreaWidth, x: 0, y: 0, fill: constants.grabAreaFill, cursor: !gd2._context.staticPlot ? constants.grabAreaCursor : void 0 }; var grabAreaMin = Lib.ensureSingle(grabberMin, "rect", constants.grabAreaMinClassName, function(s) { s.attr(grabAreaFixAttrs); }); grabAreaMin.attr("height", opts._height); var grabAreaMax = Lib.ensureSingle(grabberMax, "rect", constants.grabAreaMaxClassName, function(s) { s.attr(grabAreaFixAttrs); }); grabAreaMax.attr("height", opts._height); } } }); // node_modules/plotly.js/src/components/rangeslider/index.js var require_rangeslider = __commonJS({ "node_modules/plotly.js/src/components/rangeslider/index.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var attrs = require_attributes20(); var oppAxisAttrs = require_oppaxis_attributes(); var helpers = require_helpers11(); module2.exports = { moduleType: "component", name: "rangeslider", schema: { subplots: { xaxis: { rangeslider: Lib.extendFlat({}, attrs, { yaxis: oppAxisAttrs }) } } }, layoutAttributes: require_attributes20(), handleDefaults: require_defaults16(), calcAutorange: require_calc_autorange3(), draw: require_draw9(), isVisible: helpers.isVisible, makeData: helpers.makeData, autoMarginOpts: helpers.autoMarginOpts }; } }); // node_modules/plotly.js/src/components/rangeselector/attributes.js var require_attributes21 = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/attributes.js"(exports2, module2) { "use strict"; var fontAttrs = require_font_attributes(); var colorAttrs = require_attributes3(); var templatedArray = require_plot_template().templatedArray; var buttonAttrs = templatedArray("button", { visible: { valType: "boolean", dflt: true, editType: "plot", description: "Determines whether or not this button is visible." }, step: { valType: "enumerated", values: ["month", "year", "day", "hour", "minute", "second", "all"], dflt: "month", editType: "plot", description: [ "The unit of measurement that the `count` value will set the range by." ].join(" ") }, stepmode: { valType: "enumerated", values: ["backward", "todate"], dflt: "backward", editType: "plot", description: [ "Sets the range update mode.", "If *backward*, the range update shifts the start of range", "back *count* times *step* milliseconds.", "If *todate*, the range update shifts the start of range", "back to the first timestamp from *count* times", "*step* milliseconds back.", "For example, with `step` set to *year* and `count` set to *1*", "the range update shifts the start of the range back to", "January 01 of the current year.", "Month and year *todate* are currently available only", "for the built-in (Gregorian) calendar." ].join(" ") }, count: { valType: "number", min: 0, dflt: 1, editType: "plot", description: [ "Sets the number of steps to take to update the range.", "Use with `step` to specify the update interval." ].join(" ") }, label: { valType: "string", editType: "plot", description: "Sets the text label to appear on the button." }, editType: "plot", description: [ "Sets the specifications for each buttons.", "By default, a range selector comes with no buttons." ].join(" ") }); module2.exports = { visible: { valType: "boolean", editType: "plot", description: [ "Determines whether or not this range selector is visible.", "Note that range selectors are only available for x axes of", "`type` set to or auto-typed to *date*." ].join(" ") }, buttons: buttonAttrs, x: { valType: "number", min: -2, max: 3, editType: "plot", description: "Sets the x position (in normalized coordinates) of the range selector." }, xanchor: { valType: "enumerated", values: ["auto", "left", "center", "right"], dflt: "left", editType: "plot", description: [ "Sets the range selector's horizontal position anchor.", "This anchor binds the `x` position to the *left*, *center*", "or *right* of the range selector." ].join(" ") }, y: { valType: "number", min: -2, max: 3, editType: "plot", description: "Sets the y position (in normalized coordinates) of the range selector." }, yanchor: { valType: "enumerated", values: ["auto", "top", "middle", "bottom"], dflt: "bottom", editType: "plot", description: [ "Sets the range selector's vertical position anchor", "This anchor binds the `y` position to the *top*, *middle*", "or *bottom* of the range selector." ].join(" ") }, font: fontAttrs({ editType: "plot", description: "Sets the font of the range selector button text." }), bgcolor: { valType: "color", dflt: colorAttrs.lightLine, editType: "plot", description: "Sets the background color of the range selector buttons." }, activecolor: { valType: "color", editType: "plot", description: "Sets the background color of the active range selector button." }, bordercolor: { valType: "color", dflt: colorAttrs.defaultLine, editType: "plot", description: "Sets the color of the border enclosing the range selector." }, borderwidth: { valType: "number", min: 0, dflt: 0, editType: "plot", description: "Sets the width (in px) of the border enclosing the range selector." }, editType: "plot" }; } }); // node_modules/plotly.js/src/components/rangeselector/constants.js var require_constants12 = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/constants.js"(exports2, module2) { "use strict"; module2.exports = { // 'y' position pad above counter axis domain yPad: 0.02, // minimum button width (regardless of text size) minButtonWidth: 30, // buttons rect radii rx: 3, ry: 3, // light fraction used to compute the 'activecolor' default lightAmount: 25, darkAmount: 10 }; } }); // node_modules/plotly.js/src/components/rangeselector/defaults.js var require_defaults17 = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Color = require_color(); var Template = require_plot_template(); var handleArrayContainerDefaults = require_array_container_defaults(); var attributes = require_attributes21(); var constants = require_constants12(); module2.exports = function handleDefaults(containerIn, containerOut, layout, counterAxes, calendar) { var selectorIn = containerIn.rangeselector || {}; var selectorOut = Template.newContainer(containerOut, "rangeselector"); function coerce(attr, dflt) { return Lib.coerce(selectorIn, selectorOut, attributes, attr, dflt); } var buttons = handleArrayContainerDefaults(selectorIn, selectorOut, { name: "buttons", handleItemDefaults: buttonDefaults, calendar }); var visible = coerce("visible", buttons.length > 0); if (visible) { var posDflt = getPosDflt(containerOut, layout, counterAxes); coerce("x", posDflt[0]); coerce("y", posDflt[1]); Lib.noneOrAll(containerIn, containerOut, ["x", "y"]); coerce("xanchor"); coerce("yanchor"); Lib.coerceFont(coerce, "font", layout.font); var bgColor = coerce("bgcolor"); coerce("activecolor", Color.contrast(bgColor, constants.lightAmount, constants.darkAmount)); coerce("bordercolor"); coerce("borderwidth"); } }; function buttonDefaults(buttonIn, buttonOut, selectorOut, opts) { var calendar = opts.calendar; function coerce(attr, dflt) { return Lib.coerce(buttonIn, buttonOut, attributes.buttons, attr, dflt); } var visible = coerce("visible"); if (visible) { var step = coerce("step"); if (step !== "all") { if (calendar && calendar !== "gregorian" && (step === "month" || step === "year")) { buttonOut.stepmode = "backward"; } else { coerce("stepmode"); } coerce("count"); } coerce("label"); } } function getPosDflt(containerOut, layout, counterAxes) { var anchoredList = counterAxes.filter(function(ax) { return layout[ax].anchor === containerOut._id; }); var posY = 0; for (var i = 0; i < anchoredList.length; i++) { var domain = layout[anchoredList[i]].domain; if (domain) posY = Math.max(domain[1], posY); } return [containerOut.domain[0], posY + constants.yPad]; } } }); // node_modules/plotly.js/src/components/rangeselector/get_update_object.js var require_get_update_object = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/get_update_object.js"(exports2, module2) { "use strict"; var d3Time = (init_src(), __toCommonJS(src_exports)); var titleCase = require_lib().titleCase; module2.exports = function getUpdateObject(axisLayout, buttonLayout) { var axName = axisLayout._name; var update = {}; if (buttonLayout.step === "all") { update[axName + ".autorange"] = true; } else { var xrange = getXRange(axisLayout, buttonLayout); update[axName + ".range[0]"] = xrange[0]; update[axName + ".range[1]"] = xrange[1]; } return update; }; function getXRange(axisLayout, buttonLayout) { var currentRange = axisLayout.range; var base = new Date(axisLayout.r2l(currentRange[1])); var step = buttonLayout.step; var utcStep = d3Time["utc" + titleCase(step)]; var count = buttonLayout.count; var range0; switch (buttonLayout.stepmode) { case "backward": range0 = axisLayout.l2r(+utcStep.offset(base, -count)); break; case "todate": var base2 = utcStep.offset(base, -count); range0 = axisLayout.l2r(+utcStep.ceil(base2)); break; } var range1 = currentRange[1]; return [range0, range1]; } } }); // node_modules/plotly.js/src/components/rangeselector/draw.js var require_draw10 = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Registry = require_registry(); var Plots = require_plots(); var Color = require_color(); var Drawing = require_drawing(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var svgTextUtils = require_svg_text_utils(); var axisIds = require_axis_ids(); var alignmentConstants = require_alignment(); var LINE_SPACING = alignmentConstants.LINE_SPACING; var FROM_TL = alignmentConstants.FROM_TL; var FROM_BR = alignmentConstants.FROM_BR; var constants = require_constants12(); var getUpdateObject = require_get_update_object(); module2.exports = function draw(gd2) { var fullLayout = gd2._fullLayout; var selectors = fullLayout._infolayer.selectAll(".rangeselector").data(makeSelectorData(gd2), selectorKeyFunc); selectors.enter().append("g").classed("rangeselector", true); selectors.exit().remove(); selectors.style({ cursor: "pointer", "pointer-events": "all" }); selectors.each(function(d) { var selector = d3.select(this); var axisLayout = d; var selectorLayout = axisLayout.rangeselector; var buttons = selector.selectAll("g.button").data(Lib.filterVisible(selectorLayout.buttons)); buttons.enter().append("g").classed("button", true); buttons.exit().remove(); buttons.each(function(d2) { var button = d3.select(this); var update = getUpdateObject(axisLayout, d2); d2._isActive = isActive(axisLayout, d2, update); button.call(drawButtonRect, selectorLayout, d2); button.call(drawButtonText, selectorLayout, d2, gd2); button.on("click", function() { if (gd2._dragged) return; Registry.call("_guiRelayout", gd2, update); }); button.on("mouseover", function() { d2._isHovered = true; button.call(drawButtonRect, selectorLayout, d2); }); button.on("mouseout", function() { d2._isHovered = false; button.call(drawButtonRect, selectorLayout, d2); }); }); reposition(gd2, buttons, selectorLayout, axisLayout._name, selector); }); }; function makeSelectorData(gd2) { var axes = axisIds.list(gd2, "x", true); var data = []; for (var i = 0; i < axes.length; i++) { var axis = axes[i]; if (axis.rangeselector && axis.rangeselector.visible) { data.push(axis); } } return data; } function selectorKeyFunc(d) { return d._id; } function isActive(axisLayout, opts, update) { if (opts.step === "all") { return axisLayout.autorange === true; } else { var keys = Object.keys(update); return axisLayout.range[0] === update[keys[0]] && axisLayout.range[1] === update[keys[1]]; } } function drawButtonRect(button, selectorLayout, d) { var rect = Lib.ensureSingle(button, "rect", "selector-rect", function(s) { s.attr("shape-rendering", "crispEdges"); }); rect.attr({ rx: constants.rx, ry: constants.ry }); rect.call(Color.stroke, selectorLayout.bordercolor).call(Color.fill, getFillColor(selectorLayout, d)).style("stroke-width", selectorLayout.borderwidth + "px"); } function getFillColor(selectorLayout, d) { return d._isActive || d._isHovered ? selectorLayout.activecolor : selectorLayout.bgcolor; } function drawButtonText(button, selectorLayout, d, gd2) { function textLayout(s) { svgTextUtils.convertToTspans(s, gd2); } var text = Lib.ensureSingle(button, "text", "selector-text", function(s) { s.attr("text-anchor", "middle"); }); text.call(Drawing.font, selectorLayout.font).text(getLabel(d, gd2._fullLayout._meta)).call(textLayout); } function getLabel(opts, _meta) { if (opts.label) { return _meta ? Lib.templateString(opts.label, _meta) : opts.label; } if (opts.step === "all") return "all"; return opts.count + opts.step.charAt(0); } function reposition(gd2, buttons, opts, axName, selector) { var width = 0; var height = 0; var borderWidth = opts.borderwidth; buttons.each(function() { var button = d3.select(this); var text = button.select(".selector-text"); var tHeight = opts.font.size * LINE_SPACING; var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; height = Math.max(height, hEff); }); buttons.each(function() { var button = d3.select(this); var rect = button.select(".selector-rect"); var text = button.select(".selector-text"); var tWidth = text.node() && Drawing.bBox(text.node()).width; var tHeight = opts.font.size * LINE_SPACING; var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); button.attr("transform", strTranslate(borderWidth + width, borderWidth)); rect.attr({ x: 0, y: 0, width: wEff, height }); svgTextUtils.positionText( text, wEff / 2, height / 2 - (tLines - 1) * tHeight / 2 + 3 ); width += wEff + 5; }); var graphSize = gd2._fullLayout._size; var lx = graphSize.l + graphSize.w * opts.x; var ly = graphSize.t + graphSize.h * (1 - opts.y); var xanchor = "left"; if (Lib.isRightAnchor(opts)) { lx -= width; xanchor = "right"; } if (Lib.isCenterAnchor(opts)) { lx -= width / 2; xanchor = "center"; } var yanchor = "top"; if (Lib.isBottomAnchor(opts)) { ly -= height; yanchor = "bottom"; } if (Lib.isMiddleAnchor(opts)) { ly -= height / 2; yanchor = "middle"; } width = Math.ceil(width); height = Math.ceil(height); lx = Math.round(lx); ly = Math.round(ly); Plots.autoMargin(gd2, axName + "-range-selector", { x: opts.x, y: opts.y, l: width * FROM_TL[xanchor], r: width * FROM_BR[xanchor], b: height * FROM_BR[yanchor], t: height * FROM_TL[yanchor] }); selector.attr("transform", strTranslate(lx, ly)); } } }); // node_modules/plotly.js/src/components/rangeselector/index.js var require_rangeselector = __commonJS({ "node_modules/plotly.js/src/components/rangeselector/index.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "component", name: "rangeselector", schema: { subplots: { xaxis: { rangeselector: require_attributes21() } } }, layoutAttributes: require_attributes21(), handleDefaults: require_defaults17(), draw: require_draw10() }; } }); // node_modules/plotly.js/src/plots/domain.js var require_domain = __commonJS({ "node_modules/plotly.js/src/plots/domain.js"(exports2) { "use strict"; var extendFlat = require_extend().extendFlat; exports2.attributes = function(opts, extra) { opts = opts || {}; extra = extra || {}; var base = { valType: "info_array", editType: opts.editType, items: [ { valType: "number", min: 0, max: 1, editType: opts.editType }, { valType: "number", min: 0, max: 1, editType: opts.editType } ], dflt: [0, 1] }; var namePart = opts.name ? opts.name + " " : ""; var contPart = opts.trace ? "trace " : "subplot "; var descPart = extra.description ? " " + extra.description : ""; var out = { x: extendFlat({}, base, { description: [ "Sets the horizontal domain of this ", namePart, contPart, "(in plot fraction).", descPart ].join("") }), y: extendFlat({}, base, { description: [ "Sets the vertical domain of this ", namePart, contPart, "(in plot fraction).", descPart ].join("") }), editType: opts.editType }; if (!opts.noGridCell) { out.row = { valType: "integer", min: 0, dflt: 0, editType: opts.editType, description: [ "If there is a layout grid, use the domain ", "for this row in the grid for this ", namePart, contPart, ".", descPart ].join("") }; out.column = { valType: "integer", min: 0, dflt: 0, editType: opts.editType, description: [ "If there is a layout grid, use the domain ", "for this column in the grid for this ", namePart, contPart, ".", descPart ].join("") }; } return out; }; exports2.defaults = function(containerOut, layout, coerce, dfltDomains) { var dfltX = dfltDomains && dfltDomains.x || [0, 1]; var dfltY = dfltDomains && dfltDomains.y || [0, 1]; var grid = layout.grid; if (grid) { var column = coerce("domain.column"); if (column !== void 0) { if (column < grid.columns) dfltX = grid._domains.x[column]; else delete containerOut.domain.column; } var row = coerce("domain.row"); if (row !== void 0) { if (row < grid.rows) dfltY = grid._domains.y[row]; else delete containerOut.domain.row; } } var x = coerce("domain.x", dfltX); var y = coerce("domain.y", dfltY); if (!(x[0] < x[1])) containerOut.domain.x = dfltX.slice(); if (!(y[0] < y[1])) containerOut.domain.y = dfltY.slice(); }; } }); // node_modules/plotly.js/src/components/grid/index.js var require_grid = __commonJS({ "node_modules/plotly.js/src/components/grid/index.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var counterRegex = require_regex().counter; var domainAttrs = require_domain().attributes; var cartesianIdRegex = require_constants2().idRegex; var Template = require_plot_template(); var gridAttrs = { rows: { valType: "integer", min: 1, editType: "plot", description: [ "The number of rows in the grid. If you provide a 2D `subplots`", "array or a `yaxes` array, its length is used as the default.", "But it's also possible to have a different length, if you", "want to leave a row at the end for non-cartesian subplots." ].join(" ") }, roworder: { valType: "enumerated", values: ["top to bottom", "bottom to top"], dflt: "top to bottom", editType: "plot", description: [ "Is the first row the top or the bottom? Note that columns", "are always enumerated from left to right." ].join(" ") }, columns: { valType: "integer", min: 1, editType: "plot", description: [ "The number of columns in the grid. If you provide a 2D `subplots`", "array, the length of its longest row is used as the default.", "If you give an `xaxes` array, its length is used as the default.", "But it's also possible to have a different length, if you", "want to leave a row at the end for non-cartesian subplots." ].join(" ") }, subplots: { valType: "info_array", freeLength: true, dimensions: 2, items: { valType: "enumerated", values: [counterRegex("xy").toString(), ""], editType: "plot" }, editType: "plot", description: [ "Used for freeform grids, where some axes may be shared across subplots", "but others are not. Each entry should be a cartesian subplot id, like", "*xy* or *x3y2*, or ** to leave that cell empty. You may reuse x axes", "within the same column, and y axes within the same row.", "Non-cartesian subplots and traces that support `domain` can place themselves", "in this grid separately using the `gridcell` attribute." ].join(" ") }, xaxes: { valType: "info_array", freeLength: true, items: { valType: "enumerated", values: [cartesianIdRegex.x.toString(), ""], editType: "plot" }, editType: "plot", description: [ "Used with `yaxes` when the x and y axes are shared across columns and rows.", "Each entry should be an x axis id like *x*, *x2*, etc., or ** to", "not put an x axis in that column. Entries other than ** must be unique.", "Ignored if `subplots` is present. If missing but `yaxes` is present,", "will generate consecutive IDs." ].join(" ") }, yaxes: { valType: "info_array", freeLength: true, items: { valType: "enumerated", values: [cartesianIdRegex.y.toString(), ""], editType: "plot" }, editType: "plot", description: [ "Used with `yaxes` when the x and y axes are shared across columns and rows.", "Each entry should be an y axis id like *y*, *y2*, etc., or ** to", "not put a y axis in that row. Entries other than ** must be unique.", "Ignored if `subplots` is present. If missing but `xaxes` is present,", "will generate consecutive IDs." ].join(" ") }, pattern: { valType: "enumerated", values: ["independent", "coupled"], dflt: "coupled", editType: "plot", description: [ "If no `subplots`, `xaxes`, or `yaxes` are given but we do have `rows` and `columns`,", "we can generate defaults using consecutive axis IDs, in two ways:", "*coupled* gives one x axis per column and one y axis per row.", "*independent* uses a new xy pair for each cell, left-to-right across each row", "then iterating rows according to `roworder`." ].join(" ") }, xgap: { valType: "number", min: 0, max: 1, editType: "plot", description: [ "Horizontal space between grid cells, expressed as a fraction", "of the total width available to one cell. Defaults to 0.1", "for coupled-axes grids and 0.2 for independent grids." ].join(" ") }, ygap: { valType: "number", min: 0, max: 1, editType: "plot", description: [ "Vertical space between grid cells, expressed as a fraction", "of the total height available to one cell. Defaults to 0.1", "for coupled-axes grids and 0.3 for independent grids." ].join(" ") }, domain: domainAttrs({ name: "grid", editType: "plot", noGridCell: true }, { description: [ "The first and last cells end exactly at the domain", "edges, with no grout around the edges." ].join(" ") }), xside: { valType: "enumerated", values: ["bottom", "bottom plot", "top plot", "top"], dflt: "bottom plot", editType: "plot", description: [ "Sets where the x axis labels and titles go. *bottom* means", "the very bottom of the grid. *bottom plot* is the lowest plot", "that each x axis is used in. *top* and *top plot* are similar." ].join(" ") }, yside: { valType: "enumerated", values: ["left", "left plot", "right plot", "right"], dflt: "left plot", editType: "plot", description: [ "Sets where the y axis labels and titles go. *left* means", "the very left edge of the grid. *left plot* is the leftmost plot", "that each y axis is used in. *right* and *right plot* are similar." ].join(" ") }, editType: "plot" }; function getAxes(layout, grid, axLetter) { var gridVal = grid[axLetter + "axes"]; var splomVal = Object.keys((layout._splomAxes || {})[axLetter] || {}); if (Array.isArray(gridVal)) return gridVal; if (splomVal.length) return splomVal; } function sizeDefaults(layoutIn, layoutOut) { var gridIn = layoutIn.grid || {}; var xAxes = getAxes(layoutOut, gridIn, "x"); var yAxes = getAxes(layoutOut, gridIn, "y"); if (!layoutIn.grid && !xAxes && !yAxes) return; var hasSubplotGrid = Array.isArray(gridIn.subplots) && Array.isArray(gridIn.subplots[0]); var hasXaxes = Array.isArray(xAxes); var hasYaxes = Array.isArray(yAxes); var isSplomGenerated = hasXaxes && xAxes !== gridIn.xaxes && hasYaxes && yAxes !== gridIn.yaxes; var dfltRows, dfltColumns; if (hasSubplotGrid) { dfltRows = gridIn.subplots.length; dfltColumns = gridIn.subplots[0].length; } else { if (hasYaxes) dfltRows = yAxes.length; if (hasXaxes) dfltColumns = xAxes.length; } var gridOut = Template.newContainer(layoutOut, "grid"); function coerce(attr, dflt) { return Lib.coerce(gridIn, gridOut, gridAttrs, attr, dflt); } var rows = coerce("rows", dfltRows); var columns = coerce("columns", dfltColumns); if (!(rows * columns > 1)) { delete layoutOut.grid; return; } if (!hasSubplotGrid && !hasXaxes && !hasYaxes) { var useDefaultSubplots = coerce("pattern") === "independent"; if (useDefaultSubplots) hasSubplotGrid = true; } gridOut._hasSubplotGrid = hasSubplotGrid; var rowOrder = coerce("roworder"); var reversed = rowOrder === "top to bottom"; var dfltGapX = hasSubplotGrid ? 0.2 : 0.1; var dfltGapY = hasSubplotGrid ? 0.3 : 0.1; var dfltSideX, dfltSideY; if (isSplomGenerated && layoutOut._splomGridDflt) { dfltSideX = layoutOut._splomGridDflt.xside; dfltSideY = layoutOut._splomGridDflt.yside; } gridOut._domains = { x: fillGridPositions("x", coerce, dfltGapX, dfltSideX, columns), y: fillGridPositions("y", coerce, dfltGapY, dfltSideY, rows, reversed) }; } function fillGridPositions(axLetter, coerce, dfltGap, dfltSide, len, reversed) { var dirGap = coerce(axLetter + "gap", dfltGap); var domain = coerce("domain." + axLetter); coerce(axLetter + "side", dfltSide); var out = new Array(len); var start = domain[0]; var step = (domain[1] - start) / (len - dirGap); var cellDomain = step * (1 - dirGap); for (var i = 0; i < len; i++) { var cellStart = start + step * i; out[reversed ? len - 1 - i : i] = [cellStart, cellStart + cellDomain]; } return out; } function contentDefaults(layoutIn, layoutOut) { var gridOut = layoutOut.grid; if (!gridOut || !gridOut._domains) return; var gridIn = layoutIn.grid || {}; var subplots = layoutOut._subplots; var hasSubplotGrid = gridOut._hasSubplotGrid; var rows = gridOut.rows; var columns = gridOut.columns; var useDefaultSubplots = gridOut.pattern === "independent"; var i, j, xId, yId, subplotId, subplotsOut, yPos; var axisMap = gridOut._axisMap = {}; if (hasSubplotGrid) { var subplotsIn = gridIn.subplots || []; subplotsOut = gridOut.subplots = new Array(rows); var index = 1; for (i = 0; i < rows; i++) { var rowOut = subplotsOut[i] = new Array(columns); var rowIn = subplotsIn[i] || []; for (j = 0; j < columns; j++) { if (useDefaultSubplots) { subplotId = index === 1 ? "xy" : "x" + index + "y" + index; index++; } else subplotId = rowIn[j]; rowOut[j] = ""; if (subplots.cartesian.indexOf(subplotId) !== -1) { yPos = subplotId.indexOf("y"); xId = subplotId.slice(0, yPos); yId = subplotId.slice(yPos); if (axisMap[xId] !== void 0 && axisMap[xId] !== j || axisMap[yId] !== void 0 && axisMap[yId] !== i) { continue; } rowOut[j] = subplotId; axisMap[xId] = j; axisMap[yId] = i; } } } } else { var xAxes = getAxes(layoutOut, gridIn, "x"); var yAxes = getAxes(layoutOut, gridIn, "y"); gridOut.xaxes = fillGridAxes(xAxes, subplots.xaxis, columns, axisMap, "x"); gridOut.yaxes = fillGridAxes(yAxes, subplots.yaxis, rows, axisMap, "y"); } var anchors = gridOut._anchors = {}; var reversed = gridOut.roworder === "top to bottom"; for (var axisId in axisMap) { var axLetter = axisId.charAt(0); var side = gridOut[axLetter + "side"]; var i02, inc, iFinal; if (side.length < 8) { anchors[axisId] = "free"; } else if (axLetter === "x") { if (side.charAt(0) === "t" === reversed) { i02 = 0; inc = 1; iFinal = rows; } else { i02 = rows - 1; inc = -1; iFinal = -1; } if (hasSubplotGrid) { var column = axisMap[axisId]; for (i = i02; i !== iFinal; i += inc) { subplotId = subplotsOut[i][column]; if (!subplotId) continue; yPos = subplotId.indexOf("y"); if (subplotId.slice(0, yPos) === axisId) { anchors[axisId] = subplotId.slice(yPos); break; } } } else { for (i = i02; i !== iFinal; i += inc) { yId = gridOut.yaxes[i]; if (subplots.cartesian.indexOf(axisId + yId) !== -1) { anchors[axisId] = yId; break; } } } } else { if (side.charAt(0) === "l") { i02 = 0; inc = 1; iFinal = columns; } else { i02 = columns - 1; inc = -1; iFinal = -1; } if (hasSubplotGrid) { var row = axisMap[axisId]; for (i = i02; i !== iFinal; i += inc) { subplotId = subplotsOut[row][i]; if (!subplotId) continue; yPos = subplotId.indexOf("y"); if (subplotId.slice(yPos) === axisId) { anchors[axisId] = subplotId.slice(0, yPos); break; } } } else { for (i = i02; i !== iFinal; i += inc) { xId = gridOut.xaxes[i]; if (subplots.cartesian.indexOf(xId + axisId) !== -1) { anchors[axisId] = xId; break; } } } } } } function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) { var out = new Array(len); var i; function fillOneAxis(i2, axisId) { if (axesAllowed.indexOf(axisId) !== -1 && axisMap[axisId] === void 0) { out[i2] = axisId; axisMap[axisId] = i2; } else out[i2] = ""; } if (Array.isArray(axesIn)) { for (i = 0; i < len; i++) { fillOneAxis(i, axesIn[i]); } } else { fillOneAxis(0, axLetter); for (i = 1; i < len; i++) { fillOneAxis(i, axLetter + (i + 1)); } } return out; } module2.exports = { moduleType: "component", name: "grid", schema: { layout: { grid: gridAttrs } }, layoutAttributes: gridAttrs, sizeDefaults, contentDefaults }; } }); // node_modules/plotly.js/src/components/errorbars/attributes.js var require_attributes22 = __commonJS({ "node_modules/plotly.js/src/components/errorbars/attributes.js"(exports2, module2) { "use strict"; module2.exports = { visible: { valType: "boolean", editType: "calc", description: [ "Determines whether or not this set of error bars is visible." ].join(" ") }, type: { valType: "enumerated", values: ["percent", "constant", "sqrt", "data"], editType: "calc", description: [ "Determines the rule used to generate the error bars.", "If *constant`, the bar lengths are of a constant value.", "Set this constant in `value`.", "If *percent*, the bar lengths correspond to a percentage of", "underlying data. Set this percentage in `value`.", "If *sqrt*, the bar lengths correspond to the square of the", "underlying data.", "If *data*, the bar lengths are set with data set `array`." ].join(" ") }, symmetric: { valType: "boolean", editType: "calc", description: [ "Determines whether or not the error bars have the same length", "in both direction", "(top/bottom for vertical bars, left/right for horizontal bars." ].join(" ") }, array: { valType: "data_array", editType: "calc", description: [ "Sets the data corresponding the length of each error bar.", "Values are plotted relative to the underlying data." ].join(" ") }, arrayminus: { valType: "data_array", editType: "calc", description: [ "Sets the data corresponding the length of each error bar in the", "bottom (left) direction for vertical (horizontal) bars", "Values are plotted relative to the underlying data." ].join(" ") }, value: { valType: "number", min: 0, dflt: 10, editType: "calc", description: [ "Sets the value of either the percentage", "(if `type` is set to *percent*) or the constant", "(if `type` is set to *constant*) corresponding to the lengths of", "the error bars." ].join(" ") }, valueminus: { valType: "number", min: 0, dflt: 10, editType: "calc", description: [ "Sets the value of either the percentage", "(if `type` is set to *percent*) or the constant", "(if `type` is set to *constant*) corresponding to the lengths of", "the error bars in the", "bottom (left) direction for vertical (horizontal) bars" ].join(" ") }, traceref: { valType: "integer", min: 0, dflt: 0, editType: "style" }, tracerefminus: { valType: "integer", min: 0, dflt: 0, editType: "style" }, copy_ystyle: { valType: "boolean", editType: "plot" }, copy_zstyle: { valType: "boolean", editType: "style" }, color: { valType: "color", editType: "style", description: "Sets the stoke color of the error bars." }, thickness: { valType: "number", min: 0, dflt: 2, editType: "style", description: "Sets the thickness (in px) of the error bars." }, width: { valType: "number", min: 0, editType: "plot", description: [ "Sets the width (in px) of the cross-bar at both ends", "of the error bars." ].join(" ") }, editType: "calc", _deprecated: { opacity: { valType: "number", editType: "style", description: [ "Obsolete.", "Use the alpha channel in error bar `color` to set the opacity." ].join(" ") } } }; } }); // node_modules/plotly.js/src/components/errorbars/defaults.js var require_defaults18 = __commonJS({ "node_modules/plotly.js/src/components/errorbars/defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Registry = require_registry(); var Lib = require_lib(); var Template = require_plot_template(); var attributes = require_attributes22(); module2.exports = function(traceIn, traceOut, defaultColor, opts) { var objName = "error_" + opts.axis; var containerOut = Template.newContainer(traceOut, objName); var containerIn = traceIn[objName] || {}; function coerce(attr, dflt) { return Lib.coerce(containerIn, containerOut, attributes, attr, dflt); } var hasErrorBars = containerIn.array !== void 0 || containerIn.value !== void 0 || containerIn.type === "sqrt"; var visible = coerce("visible", hasErrorBars); if (visible === false) return; var type = coerce("type", "array" in containerIn ? "data" : "percent"); var symmetric = true; if (type !== "sqrt") { symmetric = coerce( "symmetric", !((type === "data" ? "arrayminus" : "valueminus") in containerIn) ); } if (type === "data") { coerce("array"); coerce("traceref"); if (!symmetric) { coerce("arrayminus"); coerce("tracerefminus"); } } else if (type === "percent" || type === "constant") { coerce("value"); if (!symmetric) coerce("valueminus"); } var copyAttr = "copy_" + opts.inherit + "style"; if (opts.inherit) { var inheritObj = traceOut["error_" + opts.inherit]; if ((inheritObj || {}).visible) { coerce(copyAttr, !(containerIn.color || isNumeric(containerIn.thickness) || isNumeric(containerIn.width))); } } if (!opts.inherit || !containerOut[copyAttr]) { coerce("color", defaultColor); coerce("thickness"); coerce("width", Registry.traceIs(traceOut, "gl3d") ? 0 : 4); } }; } }); // node_modules/plotly.js/src/components/errorbars/compute_error.js var require_compute_error = __commonJS({ "node_modules/plotly.js/src/components/errorbars/compute_error.js"(exports2, module2) { "use strict"; module2.exports = function makeComputeError(opts) { var type = opts.type; var symmetric = opts.symmetric; if (type === "data") { var array = opts.array || []; if (symmetric) { return function computeError(dataPt, index) { var val = +array[index]; return [val, val]; }; } else { var arrayminus = opts.arrayminus || []; return function computeError(dataPt, index) { var val = +array[index]; var valMinus = +arrayminus[index]; if (!isNaN(val) || !isNaN(valMinus)) { return [valMinus || 0, val || 0]; } return [NaN, NaN]; }; } } else { var computeErrorValue = makeComputeErrorValue(type, opts.value); var computeErrorValueMinus = makeComputeErrorValue(type, opts.valueminus); if (symmetric || opts.valueminus === void 0) { return function computeError(dataPt) { var val = computeErrorValue(dataPt); return [val, val]; }; } else { return function computeError(dataPt) { return [ computeErrorValueMinus(dataPt), computeErrorValue(dataPt) ]; }; } } }; function makeComputeErrorValue(type, value) { if (type === "percent") { return function(dataPt) { return Math.abs(dataPt * value / 100); }; } if (type === "constant") { return function() { return Math.abs(value); }; } if (type === "sqrt") { return function(dataPt) { return Math.sqrt(Math.abs(dataPt)); }; } } } }); // node_modules/plotly.js/src/components/errorbars/calc.js var require_calc4 = __commonJS({ "node_modules/plotly.js/src/components/errorbars/calc.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Registry = require_registry(); var Axes = require_axes(); var Lib = require_lib(); var makeComputeError = require_compute_error(); module2.exports = function calc(gd2) { var calcdata = gd2.calcdata; for (var i = 0; i < calcdata.length; i++) { var calcTrace = calcdata[i]; var trace = calcTrace[0].trace; if (trace.visible === true && Registry.traceIs(trace, "errorBarsOK")) { var xa2 = Axes.getFromId(gd2, trace.xaxis); var ya2 = Axes.getFromId(gd2, trace.yaxis); calcOneAxis(calcTrace, trace, xa2, "x"); calcOneAxis(calcTrace, trace, ya2, "y"); } } }; function calcOneAxis(calcTrace, trace, axis, coord) { var opts = trace["error_" + coord] || {}; var isVisible = opts.visible && ["linear", "log"].indexOf(axis.type) !== -1; var vals = []; if (!isVisible) return; var computeError = makeComputeError(opts); for (var i = 0; i < calcTrace.length; i++) { var calcPt = calcTrace[i]; var iIn = calcPt.i; if (iIn === void 0) iIn = i; else if (iIn === null) continue; var calcCoord = calcPt[coord]; if (!isNumeric(axis.c2l(calcCoord))) continue; var errors = computeError(calcCoord, iIn); if (isNumeric(errors[0]) && isNumeric(errors[1])) { var shoe = calcPt[coord + "s"] = calcCoord - errors[0]; var hat = calcPt[coord + "h"] = calcCoord + errors[1]; vals.push(shoe, hat); } } var axId = axis._id; var baseExtremes = trace._extremes[axId]; var extremes = Axes.findExtremes( axis, vals, Lib.extendFlat({ tozero: baseExtremes.opts.tozero }, { padded: true }) ); baseExtremes.min = baseExtremes.min.concat(extremes.min); baseExtremes.max = baseExtremes.max.concat(extremes.max); } } }); // node_modules/plotly.js/src/components/errorbars/plot.js var require_plot2 = __commonJS({ "node_modules/plotly.js/src/components/errorbars/plot.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Drawing = require_drawing(); var subTypes = require_subtypes(); module2.exports = function plot(gd2, traces, plotinfo, transitionOpts) { var isNew; var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var hasAnimation = transitionOpts && transitionOpts.duration > 0; var isStatic = gd2._context.staticPlot; traces.each(function(d) { var trace = d[0].trace; var xObj = trace.error_x || {}; var yObj = trace.error_y || {}; var keyFunc; if (trace.ids) { keyFunc = function(d2) { return d2.id; }; } var sparse = subTypes.hasMarkers(trace) && trace.marker.maxdisplayed > 0; if (!yObj.visible && !xObj.visible) d = []; var errorbars = d3.select(this).selectAll("g.errorbar").data(d, keyFunc); errorbars.exit().remove(); if (!d.length) return; if (!xObj.visible) errorbars.selectAll("path.xerror").remove(); if (!yObj.visible) errorbars.selectAll("path.yerror").remove(); errorbars.style("opacity", 1); var enter = errorbars.enter().append("g").classed("errorbar", true); if (hasAnimation) { enter.style("opacity", 0).transition().duration(transitionOpts.duration).style("opacity", 1); } Drawing.setClipUrl(errorbars, plotinfo.layerClipId, gd2); errorbars.each(function(d2) { var errorbar = d3.select(this); var coords = errorCoords(d2, xa2, ya2); if (sparse && !d2.vis) return; var path; var yerror = errorbar.select("path.yerror"); if (yObj.visible && isNumeric(coords.x) && isNumeric(coords.yh) && isNumeric(coords.ys)) { var yw = yObj.width; path = "M" + (coords.x - yw) + "," + coords.yh + "h" + 2 * yw + // hat "m-" + yw + ",0V" + coords.ys; if (!coords.noYS) path += "m-" + yw + ",0h" + 2 * yw; isNew = !yerror.size(); if (isNew) { yerror = errorbar.append("path").style("vector-effect", isStatic ? "none" : "non-scaling-stroke").classed("yerror", true); } else if (hasAnimation) { yerror = yerror.transition().duration(transitionOpts.duration).ease(transitionOpts.easing); } yerror.attr("d", path); } else yerror.remove(); var xerror = errorbar.select("path.xerror"); if (xObj.visible && isNumeric(coords.y) && isNumeric(coords.xh) && isNumeric(coords.xs)) { var xw = (xObj.copy_ystyle ? yObj : xObj).width; path = "M" + coords.xh + "," + (coords.y - xw) + "v" + 2 * xw + // hat "m0,-" + xw + "H" + coords.xs; if (!coords.noXS) path += "m0,-" + xw + "v" + 2 * xw; isNew = !xerror.size(); if (isNew) { xerror = errorbar.append("path").style("vector-effect", isStatic ? "none" : "non-scaling-stroke").classed("xerror", true); } else if (hasAnimation) { xerror = xerror.transition().duration(transitionOpts.duration).ease(transitionOpts.easing); } xerror.attr("d", path); } else xerror.remove(); }); }); }; function errorCoords(d, xa2, ya2) { var out = { x: xa2.c2p(d.x), y: ya2.c2p(d.y) }; if (d.yh !== void 0) { out.yh = ya2.c2p(d.yh); out.ys = ya2.c2p(d.ys); if (!isNumeric(out.ys)) { out.noYS = true; out.ys = ya2.c2p(d.ys, true); } } if (d.xh !== void 0) { out.xh = xa2.c2p(d.xh); out.xs = xa2.c2p(d.xs); if (!isNumeric(out.xs)) { out.noXS = true; out.xs = xa2.c2p(d.xs, true); } } return out; } } }); // node_modules/plotly.js/src/components/errorbars/style.js var require_style3 = __commonJS({ "node_modules/plotly.js/src/components/errorbars/style.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Color = require_color(); module2.exports = function style(traces) { traces.each(function(d) { var trace = d[0].trace; var yObj = trace.error_y || {}; var xObj = trace.error_x || {}; var s = d3.select(this); s.selectAll("path.yerror").style("stroke-width", yObj.thickness + "px").call(Color.stroke, yObj.color); if (xObj.copy_ystyle) xObj = yObj; s.selectAll("path.xerror").style("stroke-width", xObj.thickness + "px").call(Color.stroke, xObj.color); }); }; } }); // node_modules/plotly.js/src/components/errorbars/index.js var require_errorbars = __commonJS({ "node_modules/plotly.js/src/components/errorbars/index.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var overrideAll = require_edit_types().overrideAll; var attributes = require_attributes22(); var xyAttrs = { error_x: Lib.extendFlat({}, attributes), error_y: Lib.extendFlat({}, attributes) }; delete xyAttrs.error_x.copy_zstyle; delete xyAttrs.error_y.copy_zstyle; delete xyAttrs.error_y.copy_ystyle; var xyzAttrs = { error_x: Lib.extendFlat({}, attributes), error_y: Lib.extendFlat({}, attributes), error_z: Lib.extendFlat({}, attributes) }; delete xyzAttrs.error_x.copy_ystyle; delete xyzAttrs.error_y.copy_ystyle; delete xyzAttrs.error_z.copy_ystyle; delete xyzAttrs.error_z.copy_zstyle; module2.exports = { moduleType: "component", name: "errorbars", schema: { traces: { scatter: xyAttrs, bar: xyAttrs, histogram: xyAttrs, scatter3d: overrideAll(xyzAttrs, "calc", "nested"), scattergl: overrideAll(xyAttrs, "calc", "nested") } }, supplyDefaults: require_defaults18(), calc: require_calc4(), makeComputeError: require_compute_error(), plot: require_plot2(), style: require_style3(), hoverInfo }; function hoverInfo(calcPoint, trace, hoverPoint) { if ((trace.error_y || {}).visible) { hoverPoint.yerr = calcPoint.yh - calcPoint.y; if (!trace.error_y.symmetric) hoverPoint.yerrneg = calcPoint.y - calcPoint.ys; } if ((trace.error_x || {}).visible) { hoverPoint.xerr = calcPoint.xh - calcPoint.x; if (!trace.error_x.symmetric) hoverPoint.xerrneg = calcPoint.x - calcPoint.xs; } } } }); // node_modules/plotly.js/src/components/colorbar/constants.js var require_constants13 = __commonJS({ "node_modules/plotly.js/src/components/colorbar/constants.js"(exports2, module2) { "use strict"; module2.exports = { cn: { colorbar: "colorbar", cbbg: "cbbg", cbfill: "cbfill", cbfills: "cbfills", cbline: "cbline", cblines: "cblines", cbaxis: "cbaxis", cbtitleunshift: "cbtitleunshift", cbtitle: "cbtitle", cboutline: "cboutline", crisp: "crisp", jsPlaceholder: "js-placeholder" } }; } }); // node_modules/plotly.js/src/components/colorbar/draw.js var require_draw11 = __commonJS({ "node_modules/plotly.js/src/components/colorbar/draw.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var tinycolor = require_tinycolor(); var Plots = require_plots(); var Registry = require_registry(); var Axes = require_axes(); var dragElement = require_dragelement(); var Lib = require_lib(); var strTranslate = Lib.strTranslate; var extendFlat = require_extend().extendFlat; var setCursor = require_setcursor(); var Drawing = require_drawing(); var Color = require_color(); var Titles = require_titles(); var svgTextUtils = require_svg_text_utils(); var flipScale = require_helpers().flipScale; var handleAxisDefaults = require_axis_defaults(); var handleAxisPositionDefaults = require_position_defaults(); var axisLayoutAttrs = require_layout_attributes4(); var alignmentConstants = require_alignment(); var LINE_SPACING = alignmentConstants.LINE_SPACING; var FROM_TL = alignmentConstants.FROM_TL; var FROM_BR = alignmentConstants.FROM_BR; var cn = require_constants13().cn; function draw(gd2) { var fullLayout = gd2._fullLayout; var colorBars = fullLayout._infolayer.selectAll("g." + cn.colorbar).data(makeColorBarData(gd2), function(opts) { return opts._id; }); colorBars.enter().append("g").attr("class", function(opts) { return opts._id; }).classed(cn.colorbar, true); colorBars.each(function(opts) { var g = d3.select(this); Lib.ensureSingle(g, "rect", cn.cbbg); Lib.ensureSingle(g, "g", cn.cbfills); Lib.ensureSingle(g, "g", cn.cblines); Lib.ensureSingle(g, "g", cn.cbaxis, function(s) { s.classed(cn.crisp, true); }); Lib.ensureSingle(g, "g", cn.cbtitleunshift, function(s) { s.append("g").classed(cn.cbtitle, true); }); Lib.ensureSingle(g, "rect", cn.cboutline); var done = drawColorBar(g, opts, gd2); if (done && done.then) (gd2._promises || []).push(done); if (gd2._context.edits.colorbarPosition) { makeEditable(g, opts, gd2); } }); colorBars.exit().each(function(opts) { Plots.autoMargin(gd2, opts._id); }).remove(); colorBars.order(); } function makeColorBarData(gd2) { var fullLayout = gd2._fullLayout; var calcdata = gd2.calcdata; var out = []; var opts; var cont; var trace; var cbOpt; function initOpts(opts2) { return extendFlat(opts2, { // fillcolor can be a d3 scale, domain is z values, range is colors // or leave it out for no fill, // or set to a string constant for single-color fill _fillcolor: null, // line.color has the same options as fillcolor _line: { color: null, width: null, dash: null }, // levels of lines to draw. // note that this DOES NOT determine the extent of the bar // that's given by the domain of fillcolor // (or line.color if no fillcolor domain) _levels: { start: null, end: null, size: null }, // separate fill levels (for example, heatmap coloring of a // contour map) if this is omitted, fillcolors will be // evaluated halfway between levels _filllevels: null, // for continuous colorscales: fill with a gradient instead of explicit levels // value should be the colorscale [[0, c0], [v1, c1], ..., [1, cEnd]] _fillgradient: null, // when using a gradient, we need the data range specified separately _zrange: null }); } function calcOpts() { if (typeof cbOpt.calc === "function") { cbOpt.calc(gd2, trace, opts); } else { opts._fillgradient = cont.reversescale ? flipScale(cont.colorscale) : cont.colorscale; opts._zrange = [cont[cbOpt.min], cont[cbOpt.max]]; } } for (var i = 0; i < calcdata.length; i++) { var cd2 = calcdata[i]; trace = cd2[0].trace; if (!trace._module) continue; var moduleOpts = trace._module.colorbar; if (trace.visible === true && moduleOpts) { var allowsMultiplotCbs = Array.isArray(moduleOpts); var cbOpts = allowsMultiplotCbs ? moduleOpts : [moduleOpts]; for (var j = 0; j < cbOpts.length; j++) { cbOpt = cbOpts[j]; var contName = cbOpt.container; cont = contName ? trace[contName] : trace; if (cont && cont.showscale) { opts = initOpts(cont.colorbar); opts._id = "cb" + trace.uid + (allowsMultiplotCbs && contName ? "-" + contName : ""); opts._traceIndex = trace.index; opts._propPrefix = (contName ? contName + "." : "") + "colorbar."; opts._meta = trace._meta; calcOpts(); out.push(opts); } } } } for (var k in fullLayout._colorAxes) { cont = fullLayout[k]; if (cont.showscale) { var colorAxOpts = fullLayout._colorAxes[k]; opts = initOpts(cont.colorbar); opts._id = "cb" + k; opts._propPrefix = k + ".colorbar."; opts._meta = fullLayout._meta; cbOpt = { min: "cmin", max: "cmax" }; if (colorAxOpts[0] !== "heatmap") { trace = colorAxOpts[1]; cbOpt.calc = trace._module.colorbar.calc; } calcOpts(); out.push(opts); } } return out; } function drawColorBar(g, opts, gd2) { var isVertical = opts.orientation === "v"; var len = opts.len; var lenmode = opts.lenmode; var thickness = opts.thickness; var thicknessmode = opts.thicknessmode; var outlinewidth = opts.outlinewidth; var borderwidth = opts.borderwidth; var bgcolor = opts.bgcolor; var xanchor = opts.xanchor; var yanchor = opts.yanchor; var xpad = opts.xpad; var ypad = opts.ypad; var optsX = opts.x; var optsY = isVertical ? opts.y : 1 - opts.y; var isPaperY = opts.yref === "paper"; var isPaperX = opts.xref === "paper"; var fullLayout = gd2._fullLayout; var gs2 = fullLayout._size; var fillColor = opts._fillcolor; var line = opts._line; var title = opts.title; var titleSide = title.side; var zrange = opts._zrange || d3.extent((typeof fillColor === "function" ? fillColor : line.color).domain()); var lineColormap = typeof line.color === "function" ? line.color : function() { return line.color; }; var fillColormap = typeof fillColor === "function" ? fillColor : function() { return fillColor; }; var levelsIn = opts._levels; var levelsOut = calcLevels(gd2, opts, zrange); var fillLevels = levelsOut.fill; var lineLevels = levelsOut.line; var thickPx = Math.round(thickness * (thicknessmode === "fraction" ? isVertical ? gs2.w : gs2.h : 1)); var thickFrac = thickPx / (isVertical ? gs2.w : gs2.h); var lenPx = Math.round(len * (lenmode === "fraction" ? isVertical ? gs2.h : gs2.w : 1)); var lenFrac = lenPx / (isVertical ? gs2.h : gs2.w); var posW = isPaperX ? gs2.w : gd2._fullLayout.width; var posH = isPaperY ? gs2.h : gd2._fullLayout.height; var uPx = Math.round( isVertical ? optsX * posW + xpad : optsY * posH + ypad ); var xRatio = { center: 0.5, right: 1 }[xanchor] || 0; var yRatio = { top: 1, middle: 0.5 }[yanchor] || 0; var uFrac = isVertical ? optsX - xRatio * thickFrac : optsY - yRatio * thickFrac; var vFrac = isVertical ? optsY - yRatio * lenFrac : optsX - xRatio * lenFrac; var vPx = Math.round( isVertical ? posH * (1 - vFrac) : posW * vFrac ); opts._lenFrac = lenFrac; opts._thickFrac = thickFrac; opts._uFrac = uFrac; opts._vFrac = vFrac; var ax = opts._axis = mockColorBarAxis(gd2, opts, zrange); ax.position = thickFrac + (isVertical ? optsX + xpad / gs2.w : optsY + ypad / gs2.h); var topOrBottom = ["top", "bottom"].indexOf(titleSide) !== -1; if (isVertical && topOrBottom) { ax.title.side = titleSide; ax.titlex = optsX + xpad / gs2.w; ax.titley = vFrac + (title.side === "top" ? lenFrac - ypad / gs2.h : ypad / gs2.h); } if (!isVertical && !topOrBottom) { ax.title.side = titleSide; ax.titley = optsY + ypad / gs2.h; ax.titlex = vFrac + xpad / gs2.w; } if (line.color && opts.tickmode === "auto") { ax.tickmode = "linear"; ax.tick0 = levelsIn.start; var dtick = levelsIn.size; var autoNtick = Lib.constrain(lenPx / 50, 4, 15) + 1; var dtFactor = (zrange[1] - zrange[0]) / ((opts.nticks || autoNtick) * dtick); if (dtFactor > 1) { var dtexp = Math.pow(10, Math.floor(Math.log(dtFactor) / Math.LN10)); dtick *= dtexp * Lib.roundUp(dtFactor / dtexp, [2, 5, 10]); if ((Math.abs(levelsIn.start) / levelsIn.size + 1e-6) % 1 < 2e-6) { ax.tick0 = 0; } } ax.dtick = dtick; } ax.domain = isVertical ? [ vFrac + ypad / gs2.h, vFrac + lenFrac - ypad / gs2.h ] : [ vFrac + xpad / gs2.w, vFrac + lenFrac - xpad / gs2.w ]; ax.setScale(); g.attr("transform", strTranslate(Math.round(gs2.l), Math.round(gs2.t))); var titleCont = g.select("." + cn.cbtitleunshift).attr("transform", strTranslate(-Math.round(gs2.l), -Math.round(gs2.t))); var ticklabelposition = ax.ticklabelposition; var titleFontSize = ax.title.font.size; var axLayer = g.select("." + cn.cbaxis); var titleEl; var titleHeight = 0; var titleWidth = 0; function drawTitle(titleClass, titleOpts) { var dfltTitleOpts = { propContainer: ax, propName: opts._propPrefix + "title", traceIndex: opts._traceIndex, _meta: opts._meta, placeholder: fullLayout._dfltTitle.colorbar, containerGroup: g.select("." + cn.cbtitle) }; var otherClass = titleClass.charAt(0) === "h" ? titleClass.substr(1) : "h" + titleClass; g.selectAll("." + otherClass + ",." + otherClass + "-math-group").remove(); Titles.draw(gd2, titleClass, extendFlat(dfltTitleOpts, titleOpts || {})); } function drawDummyTitle() { if (isVertical && topOrBottom || !isVertical && !topOrBottom) { var x, y; if (titleSide === "top") { x = xpad + gs2.l + posW * optsX; y = ypad + gs2.t + posH * (1 - vFrac - lenFrac) + 3 + titleFontSize * 0.75; } if (titleSide === "bottom") { x = xpad + gs2.l + posW * optsX; y = ypad + gs2.t + posH * (1 - vFrac) - 3 - titleFontSize * 0.25; } if (titleSide === "right") { y = ypad + gs2.t + posH * optsY + 3 + titleFontSize * 0.75; x = xpad + gs2.l + posW * vFrac; } drawTitle(ax._id + "title", { attributes: { x, y, "text-anchor": isVertical ? "start" : "middle" } }); } } function drawCbTitle() { if (isVertical && !topOrBottom || !isVertical && topOrBottom) { var pos = ax.position || 0; var mid = ax._offset + ax._length / 2; var x, y; if (titleSide === "right") { y = mid; x = gs2.l + posW * pos + 10 + titleFontSize * (ax.showticklabels ? 1 : 0.5); } else { x = mid; if (titleSide === "bottom") { y = gs2.t + posH * pos + 10 + (ticklabelposition.indexOf("inside") === -1 ? ax.tickfont.size : 0) + (ax.ticks !== "intside" ? opts.ticklen || 0 : 0); } if (titleSide === "top") { var nlines = title.text.split("
").length; y = gs2.t + posH * pos + 10 - thickPx - LINE_SPACING * titleFontSize * nlines; } } drawTitle((isVertical ? ( // the 'h' + is a hack to get around the fact that // convertToTspans rotates any 'y...' class by 90 degrees. // TODO: find a better way to control this. "h" ) : "v") + ax._id + "title", { avoid: { selection: d3.select(gd2).selectAll("g." + ax._id + "tick"), side: titleSide, offsetTop: isVertical ? 0 : gs2.t, offsetLeft: isVertical ? gs2.l : 0, maxShift: isVertical ? fullLayout.width : fullLayout.height }, attributes: { x, y, "text-anchor": "middle" }, transform: { rotate: isVertical ? -90 : 0, offset: 0 } }); } } function drawAxis() { if (!isVertical && !topOrBottom || isVertical && topOrBottom) { var titleGroup = g.select("." + cn.cbtitle); var titleText = titleGroup.select("text"); var titleTrans = [-outlinewidth / 2, outlinewidth / 2]; var mathJaxNode = titleGroup.select(".h" + ax._id + "title-math-group").node(); var lineSize = 15.6; if (titleText.node()) { lineSize = parseInt(titleText.node().style.fontSize, 10) * LINE_SPACING; } var bb; if (mathJaxNode) { bb = Drawing.bBox(mathJaxNode); titleWidth = bb.width; titleHeight = bb.height; if (titleHeight > lineSize) { titleTrans[1] -= (titleHeight - lineSize) / 2; } } else if (titleText.node() && !titleText.classed(cn.jsPlaceholder)) { bb = Drawing.bBox(titleText.node()); titleWidth = bb.width; titleHeight = bb.height; } if (isVertical) { if (titleHeight) { titleHeight += 5; if (titleSide === "top") { ax.domain[1] -= titleHeight / gs2.h; titleTrans[1] *= -1; } else { ax.domain[0] += titleHeight / gs2.h; var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } titleGroup.attr("transform", strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } else { if (titleWidth) { if (titleSide === "right") { ax.domain[0] += (titleWidth + titleFontSize / 2) / gs2.w; } titleGroup.attr("transform", strTranslate(titleTrans[0], titleTrans[1])); ax.setScale(); } } } g.selectAll("." + cn.cbfills + ",." + cn.cblines).attr( "transform", isVertical ? strTranslate(0, Math.round(gs2.h * (1 - ax.domain[1]))) : strTranslate(Math.round(gs2.w * ax.domain[0]), 0) ); axLayer.attr( "transform", isVertical ? strTranslate(0, Math.round(-gs2.t)) : strTranslate(Math.round(-gs2.l), 0) ); var fills = g.select("." + cn.cbfills).selectAll("rect." + cn.cbfill).attr("style", "").data(fillLevels); fills.enter().append("rect").classed(cn.cbfill, true).attr("style", ""); fills.exit().remove(); var zBounds = zrange.map(ax.c2p).map(Math.round).sort(function(a, b) { return a - b; }); fills.each(function(d, i) { var z = [ i === 0 ? zrange[0] : (fillLevels[i] + fillLevels[i - 1]) / 2, i === fillLevels.length - 1 ? zrange[1] : (fillLevels[i] + fillLevels[i + 1]) / 2 ].map(ax.c2p).map(Math.round); if (isVertical) { z[1] = Lib.constrain(z[1] + (z[1] > z[0]) ? 1 : -1, zBounds[0], zBounds[1]); } var fillEl = d3.select(this).attr(isVertical ? "x" : "y", uPx).attr(isVertical ? "y" : "x", d3.min(z)).attr(isVertical ? "width" : "height", Math.max(thickPx, 2)).attr(isVertical ? "height" : "width", Math.max(d3.max(z) - d3.min(z), 2)); if (opts._fillgradient) { Drawing.gradient(fillEl, gd2, opts._id, isVertical ? "vertical" : "horizontalreversed", opts._fillgradient, "fill"); } else { var colorString = fillColormap(d).replace("e-", ""); fillEl.attr("fill", tinycolor(colorString).toHexString()); } }); var lines = g.select("." + cn.cblines).selectAll("path." + cn.cbline).data(line.color && line.width ? lineLevels : []); lines.enter().append("path").classed(cn.cbline, true); lines.exit().remove(); lines.each(function(d) { var a = uPx; var b = Math.round(ax.c2p(d)) + line.width / 2 % 1; d3.select(this).attr( "d", "M" + (isVertical ? a + "," + b : b + "," + a) + (isVertical ? "h" : "v") + thickPx ).call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash); }); axLayer.selectAll("g." + ax._id + "tick,path").remove(); var shift = uPx + thickPx + (outlinewidth || 0) / 2 - (opts.ticks === "outside" ? 1 : 0); var vals = Axes.calcTicks(ax); var tickSign = Axes.getTickSigns(ax)[2]; Axes.drawTicks(gd2, ax, { vals: ax.ticks === "inside" ? Axes.clipEnds(ax, vals) : vals, layer: axLayer, path: Axes.makeTickPath(ax, shift, tickSign), transFn: Axes.makeTransTickFn(ax) }); return Axes.drawLabels(gd2, ax, { vals, layer: axLayer, transFn: Axes.makeTransTickLabelFn(ax), labelFns: Axes.makeLabelFns(ax, shift) }); } function positionCB() { var bb; var innerThickness = thickPx + outlinewidth / 2; if (ticklabelposition.indexOf("inside") === -1) { bb = Drawing.bBox(axLayer.node()); innerThickness += isVertical ? bb.width : bb.height; } titleEl = titleCont.select("text"); var titleWidth2 = 0; var topSideVertical = isVertical && titleSide === "top"; var rightSideHorizontal = !isVertical && titleSide === "right"; var moveY = 0; if (titleEl.node() && !titleEl.classed(cn.jsPlaceholder)) { var _titleHeight; var mathJaxNode = titleCont.select(".h" + ax._id + "title-math-group").node(); if (mathJaxNode && (isVertical && topOrBottom || !isVertical && !topOrBottom)) { bb = Drawing.bBox(mathJaxNode); titleWidth2 = bb.width; _titleHeight = bb.height; } else { bb = Drawing.bBox(titleCont.node()); titleWidth2 = bb.right - gs2.l - (isVertical ? uPx : vPx); _titleHeight = bb.bottom - gs2.t - (isVertical ? vPx : uPx); if (!isVertical && titleSide === "top") { innerThickness += bb.height; moveY = bb.height; } } if (rightSideHorizontal) { titleEl.attr("transform", strTranslate(titleWidth2 / 2 + titleFontSize / 2, 0)); titleWidth2 *= 2; } innerThickness = Math.max( innerThickness, isVertical ? titleWidth2 : _titleHeight ); } var outerThickness = (isVertical ? xpad : ypad) * 2 + innerThickness + borderwidth + outlinewidth / 2; var hColorbarMoveTitle = 0; if (!isVertical && title.text && yanchor === "bottom" && optsY <= 0) { hColorbarMoveTitle = outerThickness / 2; outerThickness += hColorbarMoveTitle; moveY += hColorbarMoveTitle; } fullLayout._hColorbarMoveTitle = hColorbarMoveTitle; fullLayout._hColorbarMoveCBTitle = moveY; var extraW = borderwidth + outlinewidth; var lx = (isVertical ? uPx : vPx) - extraW / 2 - (isVertical ? xpad : 0); var ly = (isVertical ? vPx : uPx) - (isVertical ? lenPx : ypad + moveY - hColorbarMoveTitle); g.select("." + cn.cbbg).attr("x", lx).attr("y", ly).attr(isVertical ? "width" : "height", Math.max(outerThickness - hColorbarMoveTitle, 2)).attr(isVertical ? "height" : "width", Math.max(lenPx + extraW, 2)).call(Color.fill, bgcolor).call(Color.stroke, opts.bordercolor).style("stroke-width", borderwidth); var moveX = rightSideHorizontal ? Math.max(titleWidth2 - 10, 0) : 0; g.selectAll("." + cn.cboutline).attr("x", (isVertical ? uPx : vPx + xpad) + moveX).attr("y", (isVertical ? vPx + ypad - lenPx : uPx) + (topSideVertical ? titleHeight : 0)).attr(isVertical ? "width" : "height", Math.max(thickPx, 2)).attr(isVertical ? "height" : "width", Math.max(lenPx - (isVertical ? 2 * ypad + titleHeight : 2 * xpad + moveX), 2)).call(Color.stroke, opts.outlinecolor).style({ fill: "none", "stroke-width": outlinewidth }); var xShift = isVertical ? xRatio * outerThickness : 0; var yShift = isVertical ? 0 : (1 - yRatio) * outerThickness - moveY; xShift = isPaperX ? gs2.l - xShift : -xShift; yShift = isPaperY ? gs2.t - yShift : -yShift; g.attr("transform", strTranslate( xShift, yShift )); if (!isVertical && (borderwidth || tinycolor(bgcolor).getAlpha() && !tinycolor.equals(fullLayout.paper_bgcolor, bgcolor))) { var tickLabels = axLayer.selectAll("text"); var numTicks = tickLabels[0].length; var border = g.select("." + cn.cbbg).node(); var oBb = Drawing.bBox(border); var oTr = Drawing.getTranslate(g); var TEXTPAD = 2; tickLabels.each(function(d, i) { var first = 0; var last = numTicks - 1; if (i === first || i === last) { var iBb = Drawing.bBox(this); var iTr = Drawing.getTranslate(this); var deltaX; if (i === last) { var iRight = iBb.right + iTr.x; var oRight = oBb.right + oTr.x + vPx - borderwidth - TEXTPAD + optsX; deltaX = oRight - iRight; if (deltaX > 0) deltaX = 0; } else if (i === first) { var iLeft = iBb.left + iTr.x; var oLeft = oBb.left + oTr.x + vPx + borderwidth + TEXTPAD; deltaX = oLeft - iLeft; if (deltaX < 0) deltaX = 0; } if (deltaX) { if (numTicks < 3) { this.setAttribute( "transform", "translate(" + deltaX + ",0) " + this.getAttribute("transform") ); } else { this.setAttribute("visibility", "hidden"); } } } }); } var marginOpts = {}; var lFrac = FROM_TL[xanchor]; var rFrac = FROM_BR[xanchor]; var tFrac = FROM_TL[yanchor]; var bFrac = FROM_BR[yanchor]; var extraThickness = outerThickness - thickPx; if (isVertical) { if (lenmode === "pixels") { marginOpts.y = optsY; marginOpts.t = lenPx * tFrac; marginOpts.b = lenPx * bFrac; } else { marginOpts.t = marginOpts.b = 0; marginOpts.yt = optsY + len * tFrac; marginOpts.yb = optsY - len * bFrac; } if (thicknessmode === "pixels") { marginOpts.x = optsX; marginOpts.l = outerThickness * lFrac; marginOpts.r = outerThickness * rFrac; } else { marginOpts.l = extraThickness * lFrac; marginOpts.r = extraThickness * rFrac; marginOpts.xl = optsX - thickness * lFrac; marginOpts.xr = optsX + thickness * rFrac; } } else { if (lenmode === "pixels") { marginOpts.x = optsX; marginOpts.l = lenPx * lFrac; marginOpts.r = lenPx * rFrac; } else { marginOpts.l = marginOpts.r = 0; marginOpts.xl = optsX + len * lFrac; marginOpts.xr = optsX - len * rFrac; } if (thicknessmode === "pixels") { marginOpts.y = 1 - optsY; marginOpts.t = outerThickness * tFrac; marginOpts.b = outerThickness * bFrac; } else { marginOpts.t = extraThickness * tFrac; marginOpts.b = extraThickness * bFrac; marginOpts.yt = optsY - thickness * tFrac; marginOpts.yb = optsY + thickness * bFrac; } } var sideY = opts.y < 0.5 ? "b" : "t"; var sideX = opts.x < 0.5 ? "l" : "r"; gd2._fullLayout._reservedMargin[opts._id] = {}; var possibleReservedMargins = { r: fullLayout.width - lx - xShift, l: lx + marginOpts.r, b: fullLayout.height - ly - yShift, t: ly + marginOpts.b }; if (isPaperX && isPaperY) { Plots.autoMargin(gd2, opts._id, marginOpts); } else if (isPaperX) { gd2._fullLayout._reservedMargin[opts._id][sideY] = possibleReservedMargins[sideY]; } else if (isPaperY) { gd2._fullLayout._reservedMargin[opts._id][sideX] = possibleReservedMargins[sideX]; } else { if (isVertical) { gd2._fullLayout._reservedMargin[opts._id][sideX] = possibleReservedMargins[sideX]; } else { gd2._fullLayout._reservedMargin[opts._id][sideY] = possibleReservedMargins[sideY]; } } } return Lib.syncOrAsync([ Plots.previousPromises, drawDummyTitle, drawAxis, drawCbTitle, Plots.previousPromises, positionCB ], gd2); } function makeEditable(g, opts, gd2) { var isVertical = opts.orientation === "v"; var fullLayout = gd2._fullLayout; var gs2 = fullLayout._size; var t03, xf2, yf2; dragElement.init({ element: g.node(), gd: gd2, prepFn: function() { t03 = g.attr("transform"); setCursor(g); }, moveFn: function(dx, dy) { g.attr("transform", t03 + strTranslate(dx, dy)); xf2 = dragElement.align( (isVertical ? opts._uFrac : opts._vFrac) + dx / gs2.w, isVertical ? opts._thickFrac : opts._lenFrac, 0, 1, opts.xanchor ); yf2 = dragElement.align( (isVertical ? opts._vFrac : 1 - opts._uFrac) - dy / gs2.h, isVertical ? opts._lenFrac : opts._thickFrac, 0, 1, opts.yanchor ); var csr = dragElement.getCursor(xf2, yf2, opts.xanchor, opts.yanchor); setCursor(g, csr); }, doneFn: function() { setCursor(g); if (xf2 !== void 0 && yf2 !== void 0) { var update = {}; update[opts._propPrefix + "x"] = xf2; update[opts._propPrefix + "y"] = yf2; if (opts._traceIndex !== void 0) { Registry.call("_guiRestyle", gd2, update, opts._traceIndex); } else { Registry.call("_guiRelayout", gd2, update); } } } }); } function calcLevels(gd2, opts, zrange) { var levelsIn = opts._levels; var lineLevels = []; var fillLevels = []; var l; var i; var l02 = levelsIn.end + levelsIn.size / 100; var ls2 = levelsIn.size; var zr0 = 1.001 * zrange[0] - 1e-3 * zrange[1]; var zr1 = 1.001 * zrange[1] - 1e-3 * zrange[0]; for (i = 0; i < 1e5; i++) { l = levelsIn.start + i * ls2; if (ls2 > 0 ? l >= l02 : l <= l02) break; if (l > zr0 && l < zr1) lineLevels.push(l); } if (opts._fillgradient) { fillLevels = [0]; } else if (typeof opts._fillcolor === "function") { var fillLevelsIn = opts._filllevels; if (fillLevelsIn) { l02 = fillLevelsIn.end + fillLevelsIn.size / 100; ls2 = fillLevelsIn.size; for (i = 0; i < 1e5; i++) { l = fillLevelsIn.start + i * ls2; if (ls2 > 0 ? l >= l02 : l <= l02) break; if (l > zrange[0] && l < zrange[1]) fillLevels.push(l); } } else { fillLevels = lineLevels.map(function(v) { return v - levelsIn.size / 2; }); fillLevels.push(fillLevels[fillLevels.length - 1] + levelsIn.size); } } else if (opts._fillcolor && typeof opts._fillcolor === "string") { fillLevels = [0]; } if (levelsIn.size < 0) { lineLevels.reverse(); fillLevels.reverse(); } return { line: lineLevels, fill: fillLevels }; } function mockColorBarAxis(gd2, opts, zrange) { var fullLayout = gd2._fullLayout; var isVertical = opts.orientation === "v"; var cbAxisIn = { type: "linear", range: zrange, tickmode: opts.tickmode, nticks: opts.nticks, tick0: opts.tick0, dtick: opts.dtick, tickvals: opts.tickvals, ticktext: opts.ticktext, ticks: opts.ticks, ticklen: opts.ticklen, tickwidth: opts.tickwidth, tickcolor: opts.tickcolor, showticklabels: opts.showticklabels, labelalias: opts.labelalias, ticklabelposition: opts.ticklabelposition, ticklabeloverflow: opts.ticklabeloverflow, ticklabelstep: opts.ticklabelstep, tickfont: opts.tickfont, tickangle: opts.tickangle, tickformat: opts.tickformat, exponentformat: opts.exponentformat, minexponent: opts.minexponent, separatethousands: opts.separatethousands, showexponent: opts.showexponent, showtickprefix: opts.showtickprefix, tickprefix: opts.tickprefix, showticksuffix: opts.showticksuffix, ticksuffix: opts.ticksuffix, title: opts.title, showline: true, anchor: "free", side: isVertical ? "right" : "bottom", position: 1 }; var letter = isVertical ? "y" : "x"; var cbAxisOut = { type: "linear", _id: letter + opts._id }; var axisOptions = { letter, font: fullLayout.font, noAutotickangles: letter === "y", noHover: true, noTickson: true, noTicklabelmode: true, noInsideRange: true, calendar: fullLayout.calendar // not really necessary (yet?) }; function coerce(attr, dflt) { return Lib.coerce(cbAxisIn, cbAxisOut, axisLayoutAttrs, attr, dflt); } handleAxisDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions, fullLayout); handleAxisPositionDefaults(cbAxisIn, cbAxisOut, coerce, axisOptions); return cbAxisOut; } module2.exports = { draw }; } }); // node_modules/plotly.js/src/components/colorbar/index.js var require_colorbar = __commonJS({ "node_modules/plotly.js/src/components/colorbar/index.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "component", name: "colorbar", attributes: require_attributes7(), supplyDefaults: require_defaults(), draw: require_draw11().draw, hasColorbar: require_has_colorbar() }; } }); // node_modules/plotly.js/src/components/legend/index.js var require_legend = __commonJS({ "node_modules/plotly.js/src/components/legend/index.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "component", name: "legend", layoutAttributes: require_attributes9(), supplyLayoutDefaults: require_defaults3(), draw: require_draw(), style: require_style() }; } }); // node_modules/plotly.js/src/locale-en.js var require_locale_en = __commonJS({ "node_modules/plotly.js/src/locale-en.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "locale", name: "en", dictionary: { "Click to enter Colorscale title": "Click to enter Colourscale title" }, format: { 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" ], periods: ["AM", "PM"], dateTime: "%a %b %e %X %Y", date: "%d/%m/%Y", time: "%H:%M:%S", decimal: ".", thousands: ",", grouping: [3], currency: ["$", ""], year: "%Y", month: "%b %Y", dayMonth: "%b %-d", dayMonthYear: "%b %-d, %Y" } }; } }); // node_modules/plotly.js/src/locale-en-us.js var require_locale_en_us = __commonJS({ "node_modules/plotly.js/src/locale-en-us.js"(exports2, module2) { "use strict"; module2.exports = { moduleType: "locale", name: "en-US", dictionary: { "Click to enter Colorscale title": "Click to enter Colorscale title" }, format: { date: "%m/%d/%Y" } }; } }); // node_modules/plotly.js/src/snapshot/cloneplot.js var require_cloneplot = __commonJS({ "node_modules/plotly.js/src/snapshot/cloneplot.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var extendFlat = Lib.extendFlat; var extendDeep = Lib.extendDeep; function cloneLayoutOverride(tileClass) { var override; switch (tileClass) { case "themes__thumb": override = { autosize: true, width: 150, height: 150, title: { text: "" }, showlegend: false, margin: { l: 5, r: 5, t: 5, b: 5, pad: 0 }, annotations: [] }; break; case "thumbnail": override = { title: { text: "" }, hidesources: true, showlegend: false, borderwidth: 0, bordercolor: "", margin: { l: 1, r: 1, t: 1, b: 1, pad: 0 }, annotations: [] }; break; default: override = {}; } return override; } function keyIsAxis(keyName) { var types = ["xaxis", "yaxis", "zaxis"]; return types.indexOf(keyName.slice(0, 5)) > -1; } module2.exports = function clonePlot(graphObj, options) { var i; var oldData = graphObj.data; var oldLayout = graphObj.layout; var newData = extendDeep([], oldData); var newLayout = extendDeep({}, oldLayout, cloneLayoutOverride(options.tileClass)); var context = graphObj._context || {}; if (options.width) newLayout.width = options.width; if (options.height) newLayout.height = options.height; if (options.tileClass === "thumbnail" || options.tileClass === "themes__thumb") { newLayout.annotations = []; var keys = Object.keys(newLayout); for (i = 0; i < keys.length; i++) { if (keyIsAxis(keys[i])) { newLayout[keys[i]].title = { text: "" }; } } for (i = 0; i < newData.length; i++) { var trace = newData[i]; trace.showscale = false; if (trace.marker) trace.marker.showscale = false; if (Registry.traceIs(trace, "pie-like")) trace.textposition = "none"; } } if (Array.isArray(options.annotations)) { for (i = 0; i < options.annotations.length; i++) { newLayout.annotations.push(options.annotations[i]); } } var sceneIds = Object.keys(newLayout).filter(function(key) { return key.match(/^scene\d*$/); }); if (sceneIds.length) { var axesImageOverride = {}; if (options.tileClass === "thumbnail") { axesImageOverride = { title: { text: "" }, showaxeslabels: false, showticklabels: false, linetickenable: false }; } for (i = 0; i < sceneIds.length; i++) { var scene = newLayout[sceneIds[i]]; if (!scene.xaxis) { scene.xaxis = {}; } if (!scene.yaxis) { scene.yaxis = {}; } if (!scene.zaxis) { scene.zaxis = {}; } extendFlat(scene.xaxis, axesImageOverride); extendFlat(scene.yaxis, axesImageOverride); extendFlat(scene.zaxis, axesImageOverride); scene._scene = null; } } var gd2 = document.createElement("div"); if (options.tileClass) gd2.className = options.tileClass; var plotTile = { gd: gd2, td: gd2, // for external (image server) compatibility layout: newLayout, data: newData, config: { staticPlot: options.staticPlot === void 0 ? true : options.staticPlot, plotGlPixelRatio: options.plotGlPixelRatio === void 0 ? 2 : options.plotGlPixelRatio, displaylogo: options.displaylogo || false, showLink: options.showLink || false, showTips: options.showTips || false, mapboxAccessToken: context.mapboxAccessToken } }; if (options.setBackground !== "transparent") { plotTile.config.setBackground = options.setBackground || "opaque"; } plotTile.gd.defaultLayout = cloneLayoutOverride(options.tileClass); return plotTile; }; } }); // node_modules/plotly.js/src/snapshot/toimage.js var require_toimage = __commonJS({ "node_modules/plotly.js/src/snapshot/toimage.js"(exports2, module2) { "use strict"; var EventEmitter = require_events().EventEmitter; var Registry = require_registry(); var Lib = require_lib(); var helpers = require_helpers10(); var clonePlot = require_cloneplot(); var toSVG = require_tosvg(); var svgToImg = require_svgtoimg(); function toImage(gd2, opts) { var ev2 = new EventEmitter(); var clone = clonePlot(gd2, { format: "png" }); var clonedGd = clone.gd; clonedGd.style.position = "absolute"; clonedGd.style.left = "-5000px"; document.body.appendChild(clonedGd); function wait() { var delay = helpers.getDelay(clonedGd._fullLayout); setTimeout(function() { var svg = toSVG(clonedGd); var canvas = document.createElement("canvas"); canvas.id = Lib.randstr(); ev2 = svgToImg({ format: opts.format, width: clonedGd._fullLayout.width, height: clonedGd._fullLayout.height, canvas, emitter: ev2, svg }); ev2.clean = function() { if (clonedGd) document.body.removeChild(clonedGd); }; }, delay); } var redrawFunc = helpers.getRedrawFunc(clonedGd); Registry.call("_doPlot", clonedGd, clone.data, clone.layout, clone.config).then(redrawFunc).then(wait).catch(function(err) { ev2.emit("error", err); }); return ev2; } module2.exports = toImage; } }); // node_modules/plotly.js/src/snapshot/index.js var require_snapshot = __commonJS({ "node_modules/plotly.js/src/snapshot/index.js"(exports2, module2) { "use strict"; var helpers = require_helpers10(); var Snapshot = { getDelay: helpers.getDelay, getRedrawFunc: helpers.getRedrawFunc, clone: require_cloneplot(), toSVG: require_tosvg(), svgToImg: require_svgtoimg(), toImage: require_toimage(), downloadImage: require_download() }; module2.exports = Snapshot; } }); // node_modules/plotly.js/src/core.js var require_core = __commonJS({ "node_modules/plotly.js/src/core.js"(exports2) { "use strict"; exports2.version = require_version().version; require_npo_src(); require_plotcss(); var Registry = require_registry(); var register = exports2.register = Registry.register; var plotApi = require_plot_api2(); var methodNames = Object.keys(plotApi); for (i = 0; i < methodNames.length; i++) { name = methodNames[i]; if (name.charAt(0) !== "_") exports2[name] = plotApi[name]; register({ moduleType: "apiMethod", name, fn: plotApi[name] }); } var name; var i; register(require_scatter()); register([ require_annotations(), require_annotations3d(), require_selections(), require_shapes(), require_images(), require_updatemenus(), require_sliders(), require_rangeslider(), require_rangeselector(), require_grid(), require_errorbars(), require_colorscale(), require_colorbar(), require_legend(), // legend needs to come after shape | legend defaults depends on shapes require_fx(), // fx needs to come after legend | unified hover defaults depends on legends require_modebar2() ]); register([ require_locale_en(), require_locale_en_us() ]); if (window.PlotlyLocales && Array.isArray(window.PlotlyLocales)) { register(window.PlotlyLocales); delete window.PlotlyLocales; } exports2.Icons = require_ploticon(); var Fx = require_fx(); var Plots = require_plots(); exports2.Plots = { resize: Plots.resize, graphJson: Plots.graphJson, sendDataToCloud: Plots.sendDataToCloud }; exports2.Fx = { hover: Fx.hover, unhover: Fx.unhover, loneHover: Fx.loneHover, loneUnhover: Fx.loneUnhover }; exports2.Snapshot = require_snapshot(); exports2.PlotSchema = require_plot_schema(); } }); // node_modules/plotly.js/lib/core.js var require_core2 = __commonJS({ "node_modules/plotly.js/lib/core.js"(exports2, module2) { "use strict"; module2.exports = require_core(); } }); // node_modules/plotly.js/lib/scatter.js var require_scatter2 = __commonJS({ "node_modules/plotly.js/lib/scatter.js"(exports2, module2) { "use strict"; module2.exports = require_scatter(); } }); // node_modules/plotly.js/src/traces/bar/constants.js var require_constants14 = __commonJS({ "node_modules/plotly.js/src/traces/bar/constants.js"(exports2, module2) { "use strict"; module2.exports = { // padding in pixels around text TEXTPAD: 3, // 'value' and 'label' are not really necessary for bar traces, // but they were made available to `texttemplate` (maybe by accident) // via tokens `%{value}` and `%{label}` starting in 1.50.0, // so let's include them in the event data also. eventDataKeys: ["value", "label"] }; } }); // node_modules/plotly.js/src/traces/bar/attributes.js var require_attributes23 = __commonJS({ "node_modules/plotly.js/src/traces/bar/attributes.js"(exports2, module2) { "use strict"; var scatterAttrs = require_attributes12(); var axisHoverFormat = require_axis_format_attributes().axisHoverFormat; var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs; var texttemplateAttrs = require_template_attributes().texttemplateAttrs; var colorScaleAttrs = require_attributes8(); var fontAttrs = require_font_attributes(); var constants = require_constants14(); var pattern = require_attributes4().pattern; var extendFlat = require_extend().extendFlat; var textFontAttrs = fontAttrs({ editType: "calc", arrayOk: true, colorEditType: "style", description: "" }); var scatterMarkerAttrs = scatterAttrs.marker; var scatterMarkerLineAttrs = scatterMarkerAttrs.line; var markerLineWidth = extendFlat( {}, scatterMarkerLineAttrs.width, { dflt: 0 } ); var markerLine = extendFlat({ width: markerLineWidth, editType: "calc" }, colorScaleAttrs("marker.line")); var marker = extendFlat({ line: markerLine, editType: "calc" }, colorScaleAttrs("marker"), { opacity: { valType: "number", arrayOk: true, dflt: 1, min: 0, max: 1, editType: "style", description: "Sets the opacity of the bars." }, pattern, cornerradius: { valType: "any", editType: "calc", description: [ "Sets the rounding of corners. May be an integer number of pixels,", "or a percentage of bar width (as a string ending in %). Defaults to `layout.barcornerradius`.", "In stack or relative barmode, the first trace to set cornerradius is used for the whole stack." ].join(" ") } }); module2.exports = { x: scatterAttrs.x, x0: scatterAttrs.x0, dx: scatterAttrs.dx, y: scatterAttrs.y, y0: scatterAttrs.y0, dy: scatterAttrs.dy, xperiod: scatterAttrs.xperiod, yperiod: scatterAttrs.yperiod, xperiod0: scatterAttrs.xperiod0, yperiod0: scatterAttrs.yperiod0, xperiodalignment: scatterAttrs.xperiodalignment, yperiodalignment: scatterAttrs.yperiodalignment, xhoverformat: axisHoverFormat("x"), yhoverformat: axisHoverFormat("y"), text: scatterAttrs.text, texttemplate: texttemplateAttrs({ editType: "plot" }, { keys: constants.eventDataKeys }), hovertext: scatterAttrs.hovertext, hovertemplate: hovertemplateAttrs({}, { keys: constants.eventDataKeys }), textposition: { valType: "enumerated", values: ["inside", "outside", "auto", "none"], dflt: "auto", arrayOk: true, editType: "calc", description: [ "Specifies the location of the `text`.", "*inside* positions `text` inside, next to the bar end", "(rotated and scaled if needed).", "*outside* positions `text` outside, next to the bar end", "(scaled if needed), unless there is another bar stacked on", "this one, then the text gets pushed inside.", "*auto* tries to position `text` inside the bar, but if", "the bar is too small and no bar is stacked on this one", "the text is moved outside.", "If *none*, no text appears." ].join(" ") }, insidetextanchor: { valType: "enumerated", values: ["end", "middle", "start"], dflt: "end", editType: "plot", description: [ "Determines if texts are kept at center or start/end points in `textposition` *inside* mode." ].join(" ") }, textangle: { valType: "angle", dflt: "auto", editType: "plot", description: [ "Sets the angle of the tick labels with respect to the bar.", "For example, a `tickangle` of -90 draws the tick labels", "vertically. With *auto* the texts may automatically be", "rotated to fit with the maximum size in bars." ].join(" ") }, textfont: extendFlat({}, textFontAttrs, { description: "Sets the font used for `text`." }), insidetextfont: extendFlat({}, textFontAttrs, { description: "Sets the font used for `text` lying inside the bar." }), outsidetextfont: extendFlat({}, textFontAttrs, { description: "Sets the font used for `text` lying outside the bar." }), constraintext: { valType: "enumerated", values: ["inside", "outside", "both", "none"], dflt: "both", editType: "calc", description: [ "Constrain the size of text inside or outside a bar to be no", "larger than the bar itself." ].join(" ") }, cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, { description: [ "Determines whether the text nodes", "are clipped about the subplot axes.", "To show the text nodes above axis lines and tick labels,", "make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*." ].join(" ") }), orientation: { valType: "enumerated", values: ["v", "h"], editType: "calc+clearAxisTypes", description: [ "Sets the orientation of the bars.", "With *v* (*h*), the value of the each bar spans", "along the vertical (horizontal)." ].join(" ") }, base: { valType: "any", dflt: null, arrayOk: true, editType: "calc", description: [ "Sets where the bar base is drawn (in position axis units).", "In *stack* or *relative* barmode,", "traces that set *base* will be excluded", "and drawn in *overlay* mode instead." ].join(" ") }, offset: { valType: "number", dflt: null, arrayOk: true, editType: "calc", description: [ "Shifts the position where the bar is drawn", "(in position axis units).", "In *group* barmode,", "traces that set *offset* will be excluded", "and drawn in *overlay* mode instead." ].join(" ") }, width: { valType: "number", dflt: null, min: 0, arrayOk: true, editType: "calc", description: [ "Sets the bar width (in position axis units)." ].join(" ") }, marker, offsetgroup: scatterAttrs.offsetgroup, alignmentgroup: scatterAttrs.alignmentgroup, selected: { marker: { opacity: scatterAttrs.selected.marker.opacity, color: scatterAttrs.selected.marker.color, editType: "style" }, textfont: scatterAttrs.selected.textfont, editType: "style" }, unselected: { marker: { opacity: scatterAttrs.unselected.marker.opacity, color: scatterAttrs.unselected.marker.color, editType: "style" }, textfont: scatterAttrs.unselected.textfont, editType: "style" }, zorder: scatterAttrs.zorder, _deprecated: { bardir: { valType: "enumerated", editType: "calc", values: ["v", "h"], description: "Renamed to `orientation`." } } }; } }); // node_modules/plotly.js/src/traces/bar/layout_attributes.js var require_layout_attributes6 = __commonJS({ "node_modules/plotly.js/src/traces/bar/layout_attributes.js"(exports2, module2) { "use strict"; module2.exports = { barmode: { valType: "enumerated", values: ["stack", "group", "overlay", "relative"], dflt: "group", editType: "calc", description: [ "Determines how bars at the same location coordinate", "are displayed on the graph.", "With *stack*, the bars are stacked on top of one another", "With *relative*, the bars are stacked on top of one another,", "with negative values below the axis, positive values above", "With *group*, the bars are plotted next to one another", "centered around the shared location.", "With *overlay*, the bars are plotted over one another,", "you might need to reduce *opacity* to see multiple bars." ].join(" ") }, barnorm: { valType: "enumerated", values: ["", "fraction", "percent"], dflt: "", editType: "calc", description: [ "Sets the normalization for bar traces on the graph.", "With *fraction*, the value of each bar is divided by the sum of all", "values at that location coordinate.", "*percent* is the same but multiplied by 100 to show percentages." ].join(" ") }, bargap: { valType: "number", min: 0, max: 1, editType: "calc", description: [ "Sets the gap (in plot fraction) between bars of", "adjacent location coordinates." ].join(" ") }, bargroupgap: { valType: "number", min: 0, max: 1, dflt: 0, editType: "calc", description: [ "Sets the gap (in plot fraction) between bars of", "the same location coordinate." ].join(" ") }, barcornerradius: { valType: "any", editType: "calc", description: [ "Sets the rounding of bar corners. May be an integer number of pixels,", "or a percentage of bar width (as a string ending in %)." ].join(" ") } }; } }); // node_modules/plotly.js/src/traces/bar/style_defaults.js var require_style_defaults = __commonJS({ "node_modules/plotly.js/src/traces/bar/style_defaults.js"(exports2, module2) { "use strict"; var Color = require_color(); var hasColorscale = require_helpers().hasColorscale; var colorscaleDefaults = require_defaults2(); var coercePattern = require_lib().coercePattern; module2.exports = function handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout) { var markerColor = coerce("marker.color", defaultColor); var hasMarkerColorscale = hasColorscale(traceIn, "marker"); if (hasMarkerColorscale) { colorscaleDefaults( traceIn, traceOut, layout, coerce, { prefix: "marker.", cLetter: "c" } ); } coerce("marker.line.color", Color.defaultLine); if (hasColorscale(traceIn, "marker.line")) { colorscaleDefaults( traceIn, traceOut, layout, coerce, { prefix: "marker.line.", cLetter: "c" } ); } coerce("marker.line.width"); coerce("marker.opacity"); coercePattern(coerce, "marker.pattern", markerColor, hasMarkerColorscale); coerce("selected.marker.color"); coerce("unselected.marker.color"); }; } }); // node_modules/plotly.js/src/traces/bar/defaults.js var require_defaults19 = __commonJS({ "node_modules/plotly.js/src/traces/bar/defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Color = require_color(); var Registry = require_registry(); var handleXYDefaults = require_xy_defaults(); var handlePeriodDefaults = require_period_defaults(); var handleStyleDefaults = require_style_defaults(); var handleGroupingDefaults = require_grouping_defaults(); var attributes = require_attributes23(); var coerceFont = Lib.coerceFont; function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } var len = handleXYDefaults(traceIn, traceOut, layout, coerce); if (!len) { traceOut.visible = false; return; } handlePeriodDefaults(traceIn, traceOut, layout, coerce); coerce("xhoverformat"); coerce("yhoverformat"); coerce("zorder"); coerce("orientation", traceOut.x && !traceOut.y ? "h" : "v"); coerce("base"); coerce("offset"); coerce("width"); coerce("text"); coerce("hovertext"); coerce("hovertemplate"); var textposition = coerce("textposition"); handleText(traceIn, traceOut, layout, coerce, textposition, { moduleHasSelected: true, moduleHasUnselected: true, moduleHasConstrain: true, moduleHasCliponaxis: true, moduleHasTextangle: true, moduleHasInsideanchor: true }); handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout); var lineColor = (traceOut.marker.line || {}).color; var errorBarsSupplyDefaults = Registry.getComponentMethod("errorbars", "supplyDefaults"); errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, { axis: "y" }); errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, { axis: "x", inherit: "y" }); Lib.coerceSelectionMarkerOpacity(traceOut, coerce); } function crossTraceDefaults(fullData, fullLayout) { var traceIn, traceOut; function coerce(attr, dflt) { return Lib.coerce(traceOut._input, traceOut, attributes, attr, dflt); } for (var i = 0; i < fullData.length; i++) { traceOut = fullData[i]; if (traceOut.type === "bar") { traceIn = traceOut._input; var r = coerce("marker.cornerradius", fullLayout.barcornerradius); if (traceOut.marker) { traceOut.marker.cornerradius = validateCornerradius(r); } if (fullLayout.barmode === "group") { handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce); } } } } function validateCornerradius(r) { if (isNumeric(r)) { r = +r; if (r >= 0) return r; } else if (typeof r === "string") { r = r.trim(); if (r.slice(-1) === "%" && isNumeric(r.slice(0, -1))) { r = +r.slice(0, -1); if (r >= 0) return r + "%"; } } return void 0; } function handleText(traceIn, traceOut, layout, coerce, textposition, opts) { opts = opts || {}; var moduleHasSelected = !(opts.moduleHasSelected === false); var moduleHasUnselected = !(opts.moduleHasUnselected === false); var moduleHasConstrain = !(opts.moduleHasConstrain === false); var moduleHasCliponaxis = !(opts.moduleHasCliponaxis === false); var moduleHasTextangle = !(opts.moduleHasTextangle === false); var moduleHasInsideanchor = !(opts.moduleHasInsideanchor === false); var hasPathbar = !!opts.hasPathbar; var hasBoth = Array.isArray(textposition) || textposition === "auto"; var hasInside = hasBoth || textposition === "inside"; var hasOutside = hasBoth || textposition === "outside"; if (hasInside || hasOutside) { var dfltFont = coerceFont(coerce, "textfont", layout.font); var insideTextFontDefault = Lib.extendFlat({}, dfltFont); var isTraceTextfontColorSet = traceIn.textfont && traceIn.textfont.color; var isColorInheritedFromLayoutFont = !isTraceTextfontColorSet; if (isColorInheritedFromLayoutFont) { delete insideTextFontDefault.color; } coerceFont(coerce, "insidetextfont", insideTextFontDefault); if (hasPathbar) { var pathbarTextFontDefault = Lib.extendFlat({}, dfltFont); if (isColorInheritedFromLayoutFont) { delete pathbarTextFontDefault.color; } coerceFont(coerce, "pathbar.textfont", pathbarTextFontDefault); } if (hasOutside) coerceFont(coerce, "outsidetextfont", dfltFont); if (moduleHasSelected) coerce("selected.textfont.color"); if (moduleHasUnselected) coerce("unselected.textfont.color"); if (moduleHasConstrain) coerce("constraintext"); if (moduleHasCliponaxis) coerce("cliponaxis"); if (moduleHasTextangle) coerce("textangle"); coerce("texttemplate"); } if (hasInside) { if (moduleHasInsideanchor) coerce("insidetextanchor"); } } module2.exports = { supplyDefaults, crossTraceDefaults, handleText, validateCornerradius }; } }); // node_modules/plotly.js/src/traces/bar/layout_defaults.js var require_layout_defaults5 = __commonJS({ "node_modules/plotly.js/src/traces/bar/layout_defaults.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Axes = require_axes(); var Lib = require_lib(); var layoutAttributes = require_layout_attributes6(); var validateCornerradius = require_defaults19().validateCornerradius; module2.exports = function(layoutIn, layoutOut, fullData) { function coerce(attr, dflt) { return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt); } var hasBars = false; var shouldBeGapless = false; var gappedAnyway = false; var usedSubplots = {}; var mode = coerce("barmode"); for (var i = 0; i < fullData.length; i++) { var trace = fullData[i]; if (Registry.traceIs(trace, "bar") && trace.visible) hasBars = true; else continue; if (mode === "group") { var subploti = trace.xaxis + trace.yaxis; if (usedSubplots[subploti]) gappedAnyway = true; usedSubplots[subploti] = true; } if (trace.visible && trace.type === "histogram") { var pa2 = Axes.getFromId( { _fullLayout: layoutOut }, trace[trace.orientation === "v" ? "xaxis" : "yaxis"] ); if (pa2.type !== "category") shouldBeGapless = true; } } if (!hasBars) { delete layoutOut.barmode; return; } if (mode !== "overlay") coerce("barnorm"); coerce("bargap", shouldBeGapless && !gappedAnyway ? 0 : 0.2); coerce("bargroupgap"); var r = coerce("barcornerradius"); layoutOut.barcornerradius = validateCornerradius(r); }; } }); // node_modules/plotly.js/src/traces/bar/arrays_to_calcdata.js var require_arrays_to_calcdata2 = __commonJS({ "node_modules/plotly.js/src/traces/bar/arrays_to_calcdata.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function arraysToCalcdata(cd2, trace) { for (var i = 0; i < cd2.length; i++) cd2[i].i = i; Lib.mergeArray(trace.text, cd2, "tx"); Lib.mergeArray(trace.hovertext, cd2, "htx"); var marker = trace.marker; if (marker) { Lib.mergeArray(marker.opacity, cd2, "mo", true); Lib.mergeArray(marker.color, cd2, "mc"); var markerLine = marker.line; if (markerLine) { Lib.mergeArray(markerLine.color, cd2, "mlc"); Lib.mergeArrayCastPositive(markerLine.width, cd2, "mlw"); } } }; } }); // node_modules/plotly.js/src/traces/bar/calc.js var require_calc5 = __commonJS({ "node_modules/plotly.js/src/traces/bar/calc.js"(exports2, module2) { "use strict"; var Axes = require_axes(); var alignPeriod = require_align_period(); var hasColorscale = require_helpers().hasColorscale; var colorscaleCalc = require_calc(); var arraysToCalcdata = require_arrays_to_calcdata2(); var calcSelection = require_calc_selection(); module2.exports = function calc(gd2, trace) { var xa2 = Axes.getFromId(gd2, trace.xaxis || "x"); var ya2 = Axes.getFromId(gd2, trace.yaxis || "y"); var size, pos, origPos, pObj, hasPeriod, pLetter; var sizeOpts = { msUTC: !!(trace.base || trace.base === 0) }; if (trace.orientation === "h") { size = xa2.makeCalcdata(trace, "x", sizeOpts); origPos = ya2.makeCalcdata(trace, "y"); pObj = alignPeriod(trace, ya2, "y", origPos); hasPeriod = !!trace.yperiodalignment; pLetter = "y"; } else { size = ya2.makeCalcdata(trace, "y", sizeOpts); origPos = xa2.makeCalcdata(trace, "x"); pObj = alignPeriod(trace, xa2, "x", origPos); hasPeriod = !!trace.xperiodalignment; pLetter = "x"; } pos = pObj.vals; var serieslen = Math.min(pos.length, size.length); var cd2 = new Array(serieslen); for (var i = 0; i < serieslen; i++) { cd2[i] = { p: pos[i], s: size[i] }; if (hasPeriod) { cd2[i].orig_p = origPos[i]; cd2[i][pLetter + "End"] = pObj.ends[i]; cd2[i][pLetter + "Start"] = pObj.starts[i]; } if (trace.ids) { cd2[i].id = String(trace.ids[i]); } } if (hasColorscale(trace, "marker")) { colorscaleCalc(gd2, trace, { vals: trace.marker.color, containerStr: "marker", cLetter: "c" }); } if (hasColorscale(trace, "marker.line")) { colorscaleCalc(gd2, trace, { vals: trace.marker.line.color, containerStr: "marker.line", cLetter: "c" }); } arraysToCalcdata(cd2, trace); calcSelection(cd2, trace); return cd2; }; } }); // node_modules/plotly.js/src/traces/bar/uniform_text.js var require_uniform_text = __commonJS({ "node_modules/plotly.js/src/traces/bar/uniform_text.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Lib = require_lib(); function resizeText(gd2, gTrace, traceType) { var fullLayout = gd2._fullLayout; var minSize = fullLayout["_" + traceType + "Text_minsize"]; if (minSize) { var shouldHide = fullLayout.uniformtext.mode === "hide"; var selector; switch (traceType) { case "funnelarea": case "pie": case "sunburst": selector = "g.slice"; break; case "treemap": case "icicle": selector = "g.slice, g.pathbar"; break; default: selector = "g.points > g.point"; } gTrace.selectAll(selector).each(function(d) { var transform = d.transform; if (transform) { transform.scale = shouldHide && transform.hide ? 0 : minSize / transform.fontSize; var el = d3.select(this).select("text"); Lib.setTransormAndDisplay(el, transform); } }); } } function recordMinTextSize(traceType, transform, fullLayout) { if (fullLayout.uniformtext.mode) { var minKey = getMinKey(traceType); var minSize = fullLayout.uniformtext.minsize; var size = transform.scale * transform.fontSize; transform.hide = size < minSize; fullLayout[minKey] = fullLayout[minKey] || Infinity; if (!transform.hide) { fullLayout[minKey] = Math.min( fullLayout[minKey], Math.max(size, minSize) ); } } } function clearMinTextSize(traceType, fullLayout) { var minKey = getMinKey(traceType); fullLayout[minKey] = void 0; } function getMinKey(traceType) { return "_" + traceType + "Text_minsize"; } module2.exports = { recordMinTextSize, clearMinTextSize, resizeText }; } }); // node_modules/plotly.js/src/traces/bar/helpers.js var require_helpers12 = __commonJS({ "node_modules/plotly.js/src/traces/bar/helpers.js"(exports2) { "use strict"; var isNumeric = require_fast_isnumeric(); var tinycolor = require_tinycolor(); var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; exports2.coerceString = function(attributeDefinition, value, defaultValue) { if (typeof value === "string") { if (value || !attributeDefinition.noBlank) return value; } else if (typeof value === "number" || value === true) { if (!attributeDefinition.strict) return String(value); } return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt; }; exports2.coerceNumber = function(attributeDefinition, value, defaultValue) { if (isNumeric(value)) { value = +value; var min = attributeDefinition.min; var max = attributeDefinition.max; var isOutOfBounds = min !== void 0 && value < min || max !== void 0 && value > max; if (!isOutOfBounds) return value; } return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt; }; exports2.coerceColor = function(attributeDefinition, value, defaultValue) { if (tinycolor(value).isValid()) return value; return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt; }; exports2.coerceEnumerated = function(attributeDefinition, value, defaultValue) { if (attributeDefinition.coerceNumber) value = +value; if (attributeDefinition.values.indexOf(value) !== -1) return value; return defaultValue !== void 0 ? defaultValue : attributeDefinition.dflt; }; exports2.getValue = function(arrayOrScalar, index) { var value; if (!isArrayOrTypedArray(arrayOrScalar)) value = arrayOrScalar; else if (index < arrayOrScalar.length) value = arrayOrScalar[index]; return value; }; exports2.getLineWidth = function(trace, di2) { var w = 0 < di2.mlw ? di2.mlw : !isArrayOrTypedArray(trace.marker.line.width) ? trace.marker.line.width : 0; return w; }; } }); // node_modules/plotly.js/src/traces/bar/style.js var require_style4 = __commonJS({ "node_modules/plotly.js/src/traces/bar/style.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var Color = require_color(); var Drawing = require_drawing(); var Lib = require_lib(); var Registry = require_registry(); var resizeText = require_uniform_text().resizeText; var attributes = require_attributes23(); var attributeTextFont = attributes.textfont; var attributeInsideTextFont = attributes.insidetextfont; var attributeOutsideTextFont = attributes.outsidetextfont; var helpers = require_helpers12(); function style(gd2) { var s = d3.select(gd2).selectAll('g[class^="barlayer"]').selectAll("g.trace"); resizeText(gd2, s, "bar"); var barcount = s.size(); var fullLayout = gd2._fullLayout; s.style("opacity", function(d) { return d[0].trace.opacity; }).each(function(d) { if (fullLayout.barmode === "stack" && barcount > 1 || fullLayout.bargap === 0 && fullLayout.bargroupgap === 0 && !d[0].trace.marker.line.width) { d3.select(this).attr("shape-rendering", "crispEdges"); } }); s.selectAll("g.points").each(function(d) { var sel = d3.select(this); var trace = d[0].trace; stylePoints(sel, trace, gd2); }); Registry.getComponentMethod("errorbars", "style")(s); } function stylePoints(sel, trace, gd2) { Drawing.pointStyle(sel.selectAll("path"), trace, gd2); styleTextPoints(sel, trace, gd2); } function styleTextPoints(sel, trace, gd2) { sel.selectAll("text").each(function(d) { var tx = d3.select(this); var font = Lib.ensureUniformFontSize(gd2, determineFont(tx, d, trace, gd2)); Drawing.font(tx, font); }); } function styleOnSelect(gd2, cd2, sel) { var trace = cd2[0].trace; if (trace.selectedpoints) { stylePointsInSelectionMode(sel, trace, gd2); } else { stylePoints(sel, trace, gd2); Registry.getComponentMethod("errorbars", "style")(sel); } } function stylePointsInSelectionMode(s, trace, gd2) { Drawing.selectedPointStyle(s.selectAll("path"), trace); styleTextInSelectionMode(s.selectAll("text"), trace, gd2); } function styleTextInSelectionMode(txs, trace, gd2) { txs.each(function(d) { var tx = d3.select(this); var font; if (d.selected) { font = Lib.ensureUniformFontSize(gd2, determineFont(tx, d, trace, gd2)); var selectedFontColor = trace.selected.textfont && trace.selected.textfont.color; if (selectedFontColor) { font.color = selectedFontColor; } Drawing.font(tx, font); } else { Drawing.selectedTextStyle(tx, trace); } }); } function determineFont(tx, d, trace, gd2) { var layoutFont = gd2._fullLayout.font; var textFont = trace.textfont; if (tx.classed("bartext-inside")) { var barColor = getBarColor(d, trace); textFont = getInsideTextFont(trace, d.i, layoutFont, barColor); } else if (tx.classed("bartext-outside")) { textFont = getOutsideTextFont(trace, d.i, layoutFont); } return textFont; } function getTextFont(trace, index, defaultValue) { return getFontValue( attributeTextFont, trace.textfont, index, defaultValue ); } function getInsideTextFont(trace, index, layoutFont, barColor) { var defaultFont = getTextFont(trace, index, layoutFont); var wouldFallBackToLayoutFont = trace._input.textfont === void 0 || trace._input.textfont.color === void 0 || Array.isArray(trace.textfont.color) && trace.textfont.color[index] === void 0; if (wouldFallBackToLayoutFont) { defaultFont = { color: Color.contrast(barColor), family: defaultFont.family, size: defaultFont.size, weight: defaultFont.weight, style: defaultFont.style, variant: defaultFont.variant, textcase: defaultFont.textcase, lineposition: defaultFont.lineposition, shadow: defaultFont.shadow }; } return getFontValue( attributeInsideTextFont, trace.insidetextfont, index, defaultFont ); } function getOutsideTextFont(trace, index, layoutFont) { var defaultFont = getTextFont(trace, index, layoutFont); return getFontValue( attributeOutsideTextFont, trace.outsidetextfont, index, defaultFont ); } function getFontValue(attributeDefinition, attributeValue, index, defaultValue) { attributeValue = attributeValue || {}; var familyValue = helpers.getValue(attributeValue.family, index); var sizeValue = helpers.getValue(attributeValue.size, index); var colorValue = helpers.getValue(attributeValue.color, index); var weightValue = helpers.getValue(attributeValue.weight, index); var styleValue = helpers.getValue(attributeValue.style, index); var variantValue = helpers.getValue(attributeValue.variant, index); var textcaseValue = helpers.getValue(attributeValue.textcase, index); var linepositionValue = helpers.getValue(attributeValue.lineposition, index); var shadowValue = helpers.getValue(attributeValue.shadow, index); return { family: helpers.coerceString( attributeDefinition.family, familyValue, defaultValue.family ), size: helpers.coerceNumber( attributeDefinition.size, sizeValue, defaultValue.size ), color: helpers.coerceColor( attributeDefinition.color, colorValue, defaultValue.color ), weight: helpers.coerceString( attributeDefinition.weight, weightValue, defaultValue.weight ), style: helpers.coerceString( attributeDefinition.style, styleValue, defaultValue.style ), variant: helpers.coerceString( attributeDefinition.variant, variantValue, defaultValue.variant ), textcase: helpers.coerceString( attributeDefinition.variant, textcaseValue, defaultValue.textcase ), lineposition: helpers.coerceString( attributeDefinition.variant, linepositionValue, defaultValue.lineposition ), shadow: helpers.coerceString( attributeDefinition.variant, shadowValue, defaultValue.shadow ) }; } function getBarColor(cd2, trace) { if (trace.type === "waterfall") { return trace[cd2.dir].marker.color; } return cd2.mcc || cd2.mc || trace.marker.color; } module2.exports = { style, styleTextPoints, styleOnSelect, getInsideTextFont, getOutsideTextFont, getBarColor, resizeText }; } }); // node_modules/plotly.js/src/traces/bar/plot.js var require_plot3 = __commonJS({ "node_modules/plotly.js/src/traces/bar/plot.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var svgTextUtils = require_svg_text_utils(); var Color = require_color(); var Drawing = require_drawing(); var Registry = require_registry(); var tickText = require_axes().tickText; var uniformText = require_uniform_text(); var recordMinTextSize = uniformText.recordMinTextSize; var clearMinTextSize = uniformText.clearMinTextSize; var style = require_style4(); var helpers = require_helpers12(); var constants = require_constants14(); var attributes = require_attributes23(); var attributeText = attributes.text; var attributeTextPosition = attributes.textposition; var appendArrayPointValue = require_helpers2().appendArrayPointValue; var TEXTPAD = constants.TEXTPAD; function keyFunc(d) { return d.id; } function getKeyFunc(trace) { if (trace.ids) { return keyFunc; } } function sign(v) { return (v > 0) - (v < 0); } function dirSign(a, b) { return a < b ? 1 : -1; } function getXY(di2, xa2, ya2, isHorizontal) { var s = []; var p = []; var sAxis = isHorizontal ? xa2 : ya2; var pAxis = isHorizontal ? ya2 : xa2; s[0] = sAxis.c2p(di2.s0, true); p[0] = pAxis.c2p(di2.p0, true); s[1] = sAxis.c2p(di2.s1, true); p[1] = pAxis.c2p(di2.p1, true); return isHorizontal ? [s, p] : [p, s]; } function transition(selection, fullLayout, opts, makeOnCompleteCallback) { if (!fullLayout.uniformtext.mode && hasTransition(opts)) { var onComplete; if (makeOnCompleteCallback) { onComplete = makeOnCompleteCallback(); } return selection.transition().duration(opts.duration).ease(opts.easing).each("end", function() { onComplete && onComplete(); }).each("interrupt", function() { onComplete && onComplete(); }); } else { return selection; } } function hasTransition(transitionOpts) { return transitionOpts && transitionOpts.duration > 0; } function plot(gd2, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var fullLayout = gd2._fullLayout; var isStatic = gd2._context.staticPlot; if (!opts) { opts = { mode: fullLayout.barmode, norm: fullLayout.barmode, gap: fullLayout.bargap, groupgap: fullLayout.bargroupgap }; clearMinTextSize("bar", fullLayout); } var bartraces = Lib.makeTraceGroups(traceLayer, cdModule, "trace bars").each(function(cd2) { var plotGroup = d3.select(this); var trace = cd2[0].trace; var t = cd2[0].t; var isWaterfall = trace.type === "waterfall"; var isFunnel = trace.type === "funnel"; var isHistogram = trace.type === "histogram"; var isBar = trace.type === "bar"; var shouldDisplayZeros = isBar || isFunnel; var adjustPixel = 0; if (isWaterfall && trace.connector.visible && trace.connector.mode === "between") { adjustPixel = trace.connector.line.width / 2; } var isHorizontal = trace.orientation === "h"; var withTransition = hasTransition(opts); var pointGroup = Lib.ensureSingle(plotGroup, "g", "points"); var keyFunc2 = getKeyFunc(trace); var bars = pointGroup.selectAll("g.point").data(Lib.identity, keyFunc2); bars.enter().append("g").classed("point", true); bars.exit().remove(); bars.each(function(di2, i) { var bar = d3.select(this); var xy = getXY(di2, xa2, ya2, isHorizontal); var x02 = xy[0][0]; var x12 = xy[0][1]; var y02 = xy[1][0]; var y12 = xy[1][1]; var isBlank = (isHorizontal ? x12 - x02 : y12 - y02) === 0; if (isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di2)) { isBlank = false; } if (!isBlank) { isBlank = !isNumeric(x02) || !isNumeric(x12) || !isNumeric(y02) || !isNumeric(y12); } di2.isBlank = isBlank; if (isBlank) { if (isHorizontal) { x12 = x02; } else { y12 = y02; } } if (adjustPixel && !isBlank) { if (isHorizontal) { x02 -= dirSign(x02, x12) * adjustPixel; x12 += dirSign(x02, x12) * adjustPixel; } else { y02 -= dirSign(y02, y12) * adjustPixel; y12 += dirSign(y02, y12) * adjustPixel; } } var lw; var mc2; if (trace.type === "waterfall") { if (!isBlank) { var cont = trace[di2.dir].marker; lw = cont.line.width; mc2 = cont.color; } } else { lw = helpers.getLineWidth(trace, di2); mc2 = di2.mc || trace.marker.color; } function roundWithLine(v) { var offset = d3.round(lw / 2 % 1, 2); return opts.gap === 0 && opts.groupgap === 0 ? d3.round(Math.round(v) - offset, 2) : v; } function expandToVisible(v, vc2, hideZeroSpan) { if (hideZeroSpan && v === vc2) { return v; } return Math.abs(v - vc2) >= 2 ? roundWithLine(v) : ( // but if it's very thin, expand it so it's // necessarily visible, even if it might overlap // its neighbor v > vc2 ? Math.ceil(v) : Math.floor(v) ); } var op2 = Color.opacity(mc2); var fixpx = op2 < 1 || lw > 0.01 ? roundWithLine : expandToVisible; if (!gd2._context.staticPlot) { x02 = fixpx(x02, x12, isHorizontal); x12 = fixpx(x12, x02, isHorizontal); y02 = fixpx(y02, y12, !isHorizontal); y12 = fixpx(y12, y02, !isHorizontal); } var c2p = isHorizontal ? xa2.c2p : ya2.c2p; var outerBound; if (di2.s0 > 0) { outerBound = di2._sMax; } else if (di2.s0 < 0) { outerBound = di2._sMin; } else { outerBound = di2.s1 > 0 ? di2._sMax : di2._sMin; } function calcCornerRadius(crValue, crForm) { if (!crValue) return 0; var barWidth = isHorizontal ? Math.abs(y12 - y02) : Math.abs(x12 - x02); var barLength = isHorizontal ? Math.abs(x12 - x02) : Math.abs(y12 - y02); var stackedBarTotalLength = fixpx(Math.abs(c2p(outerBound, true) - c2p(0, true))); var maxRadius = di2.hasB ? Math.min(barWidth / 2, barLength / 2) : Math.min(barWidth / 2, stackedBarTotalLength); var crPx; if (crForm === "%") { var crPercent = Math.min(50, crValue); crPx = barWidth * (crPercent / 100); } else { crPx = crValue; } return fixpx(Math.max(Math.min(crPx, maxRadius), 0)); } var r = isBar || isHistogram ? calcCornerRadius(t.cornerradiusvalue, t.cornerradiusform) : 0; var path, h; var rectanglePath = "M" + x02 + "," + y02 + "V" + y12 + "H" + x12 + "V" + y02 + "Z"; var overhead = 0; if (r && di2.s) { var refPoint = sign(di2.s0) === 0 || sign(di2.s) === sign(di2.s0) ? di2.s1 : di2.s0; overhead = fixpx(!di2.hasB ? Math.abs(c2p(outerBound, true) - c2p(refPoint, true)) : 0); if (overhead < r) { var xdir = dirSign(x02, x12); var ydir = dirSign(y02, y12); var cornersweep = xdir === -ydir ? 1 : 0; if (isHorizontal) { if (di2.hasB) { path = "M" + (x02 + r * xdir) + "," + y02 + "A " + r + "," + r + " 0 0 " + cornersweep + " " + x02 + "," + (y02 + r * ydir) + "V" + (y12 - r * ydir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x02 + r * xdir) + "," + y12 + "H" + (x12 - r * xdir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + x12 + "," + (y12 - r * ydir) + "V" + (y02 + r * ydir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x12 - r * xdir) + "," + y02 + "Z"; } else { h = Math.abs(x12 - x02) + overhead; var dy1 = h < r ? r - Math.sqrt(h * (2 * r - h)) : 0; var dy2 = overhead > 0 ? Math.sqrt(overhead * (2 * r - overhead)) : 0; var xminfunc = xdir > 0 ? Math.max : Math.min; path = "M" + x02 + "," + y02 + "V" + (y12 - dy1 * ydir) + "H" + xminfunc(x12 - (r - overhead) * xdir, x02) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + x12 + "," + (y12 - r * ydir - dy2) + "V" + (y02 + r * ydir + dy2) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + xminfunc(x12 - (r - overhead) * xdir, x02) + "," + (y02 + dy1 * ydir) + "Z"; } } else { if (di2.hasB) { path = "M" + (x02 + r * xdir) + "," + y02 + "A " + r + "," + r + " 0 0 " + cornersweep + " " + x02 + "," + (y02 + r * ydir) + "V" + (y12 - r * ydir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x02 + r * xdir) + "," + y12 + "H" + (x12 - r * xdir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + x12 + "," + (y12 - r * ydir) + "V" + (y02 + r * ydir) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x12 - r * xdir) + "," + y02 + "Z"; } else { h = Math.abs(y12 - y02) + overhead; var dx1 = h < r ? r - Math.sqrt(h * (2 * r - h)) : 0; var dx2 = overhead > 0 ? Math.sqrt(overhead * (2 * r - overhead)) : 0; var yminfunc = ydir > 0 ? Math.max : Math.min; path = "M" + (x02 + dx1 * xdir) + "," + y02 + "V" + yminfunc(y12 - (r - overhead) * ydir, y02) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x02 + r * xdir - dx2) + "," + y12 + "H" + (x12 - r * xdir + dx2) + "A " + r + "," + r + " 0 0 " + cornersweep + " " + (x12 - dx1 * xdir) + "," + yminfunc(y12 - (r - overhead) * ydir, y02) + "V" + y02 + "Z"; } } } else { path = rectanglePath; } } else { path = rectanglePath; } var sel = transition(Lib.ensureSingle(bar, "path"), fullLayout, opts, makeOnCompleteCallback); sel.style("vector-effect", isStatic ? "none" : "non-scaling-stroke").attr("d", isNaN((x12 - x02) * (y12 - y02)) || isBlank && gd2._context.staticPlot ? "M0,0Z" : path).call(Drawing.setClipUrl, plotinfo.layerClipId, gd2); if (!fullLayout.uniformtext.mode && withTransition) { var styleFns = Drawing.makePointStyleFns(trace); Drawing.singlePointStyle(di2, sel, trace, styleFns, gd2); } appendBarText(gd2, plotinfo, bar, cd2, i, x02, x12, y02, y12, r, overhead, opts, makeOnCompleteCallback); if (plotinfo.layerClipId) { Drawing.hideOutsideRangePoint(di2, bar.select("text"), xa2, ya2, trace.xcalendar, trace.ycalendar); } }); var hasClipOnAxisFalse = trace.cliponaxis === false; Drawing.setClipUrl(plotGroup, hasClipOnAxisFalse ? null : plotinfo.layerClipId, gd2); }); Registry.getComponentMethod("errorbars", "plot")(gd2, bartraces, plotinfo, opts); } function appendBarText(gd2, plotinfo, bar, cd2, i, x02, x12, y02, y12, r, overhead, opts, makeOnCompleteCallback) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; var fullLayout = gd2._fullLayout; var textPosition; function appendTextNode(bar2, text2, font2) { var textSelection2 = Lib.ensureSingle(bar2, "text").text(text2).attr({ class: "bartext bartext-" + textPosition, "text-anchor": "middle", // prohibit tex interpretation until we can handle // tex and regular text together "data-notex": 1 }).call(Drawing.font, font2).call(svgTextUtils.convertToTspans, gd2); return textSelection2; } var trace = cd2[0].trace; var isHorizontal = trace.orientation === "h"; var text = getText(fullLayout, cd2, i, xa2, ya2); textPosition = getTextPosition(trace, i); var inStackOrRelativeMode = opts.mode === "stack" || opts.mode === "relative"; var calcBar = cd2[i]; var isOutmostBar = !inStackOrRelativeMode || calcBar._outmost; var hasB = calcBar.hasB; var barIsRounded = r && r - overhead > TEXTPAD; if (!text || textPosition === "none" || (calcBar.isBlank || x02 === x12 || y02 === y12) && (textPosition === "auto" || textPosition === "inside")) { bar.select("text").remove(); return; } var layoutFont = fullLayout.font; var barColor = style.getBarColor(cd2[i], trace); var insideTextFont = style.getInsideTextFont(trace, i, layoutFont, barColor); var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont); var insidetextanchor = trace.insidetextanchor || "end"; var di2 = bar.datum(); if (isHorizontal) { if (xa2.type === "log" && di2.s0 <= 0) { if (xa2.range[0] < xa2.range[1]) { x02 = 0; } else { x02 = xa2._length; } } } else { if (ya2.type === "log" && di2.s0 <= 0) { if (ya2.range[0] < ya2.range[1]) { y02 = ya2._length; } else { y02 = 0; } } } var lx = Math.abs(x12 - x02); var ly = Math.abs(y12 - y02); var barWidth = lx - 2 * TEXTPAD; var barHeight = ly - 2 * TEXTPAD; var textSelection; var textBB; var textWidth; var textHeight; var font; if (textPosition === "outside") { if (!isOutmostBar && !calcBar.hasB) textPosition = "inside"; } if (textPosition === "auto") { if (isOutmostBar) { textPosition = "inside"; font = Lib.ensureUniformFontSize(gd2, insideTextFont); textSelection = appendTextNode(bar, text, font); textBB = Drawing.bBox(textSelection.node()); textWidth = textBB.width; textHeight = textBB.height; var textHasSize = textWidth > 0 && textHeight > 0; var fitsInside; if (barIsRounded) { if (hasB) { fitsInside = textfitsInsideBar(barWidth - 2 * r, barHeight, textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth, barHeight - 2 * r, textWidth, textHeight, isHorizontal); } else if (isHorizontal) { fitsInside = textfitsInsideBar(barWidth - (r - overhead), barHeight, textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth, barHeight - 2 * (r - overhead), textWidth, textHeight, isHorizontal); } else { fitsInside = textfitsInsideBar(barWidth, barHeight - (r - overhead), textWidth, textHeight, isHorizontal) || textfitsInsideBar(barWidth - 2 * (r - overhead), barHeight, textWidth, textHeight, isHorizontal); } } else { fitsInside = textfitsInsideBar(barWidth, barHeight, textWidth, textHeight, isHorizontal); } if (textHasSize && fitsInside) { textPosition = "inside"; } else { textPosition = "outside"; textSelection.remove(); textSelection = null; } } else { textPosition = "inside"; } } if (!textSelection) { font = Lib.ensureUniformFontSize(gd2, textPosition === "outside" ? outsideTextFont : insideTextFont); textSelection = appendTextNode(bar, text, font); var currentTransform = textSelection.attr("transform"); textSelection.attr("transform", ""); textBB = Drawing.bBox(textSelection.node()), textWidth = textBB.width, textHeight = textBB.height; textSelection.attr("transform", currentTransform); if (textWidth <= 0 || textHeight <= 0) { textSelection.remove(); return; } } var angle = trace.textangle; var transform, constrained; if (textPosition === "outside") { constrained = trace.constraintext === "both" || trace.constraintext === "outside"; transform = toMoveOutsideBar(x02, x12, y02, y12, textBB, { isHorizontal, constrained, angle }); } else { constrained = trace.constraintext === "both" || trace.constraintext === "inside"; transform = toMoveInsideBar(x02, x12, y02, y12, textBB, { isHorizontal, constrained, angle, anchor: insidetextanchor, hasB, r, overhead }); } transform.fontSize = font.size; recordMinTextSize(trace.type === "histogram" ? "bar" : trace.type, transform, fullLayout); calcBar.transform = transform; var s = transition(textSelection, fullLayout, opts, makeOnCompleteCallback); Lib.setTransormAndDisplay(s, transform); } function textfitsInsideBar(barWidth, barHeight, textWidth, textHeight, isHorizontal) { if (barWidth < 0 || barHeight < 0) return false; var fitsInside = textWidth <= barWidth && textHeight <= barHeight; var fitsInsideIfRotated = textWidth <= barHeight && textHeight <= barWidth; var fitsInsideIfShrunk = isHorizontal ? barWidth >= textWidth * (barHeight / textHeight) : barHeight >= textHeight * (barWidth / textWidth); return fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk; } function getRotateFromAngle(angle) { return angle === "auto" ? 0 : angle; } function getRotatedTextSize(textBB, rotate) { var a = Math.PI / 180 * rotate; var absSin = Math.abs(Math.sin(a)); var absCos = Math.abs(Math.cos(a)); return { x: textBB.width * absCos + textBB.height * absSin, y: textBB.width * absSin + textBB.height * absCos }; } function toMoveInsideBar(x02, x12, y02, y12, textBB, opts) { var isHorizontal = !!opts.isHorizontal; var constrained = !!opts.constrained; var angle = opts.angle || 0; var anchor = opts.anchor; var isEnd = anchor === "end"; var isStart = anchor === "start"; var leftToRight = opts.leftToRight || 0; var toRight = (leftToRight + 1) / 2; var toLeft = 1 - toRight; var hasB = opts.hasB; var r = opts.r; var overhead = opts.overhead; var textWidth = textBB.width; var textHeight = textBB.height; var lx = Math.abs(x12 - x02); var ly = Math.abs(y12 - y02); var textpad = lx > 2 * TEXTPAD && ly > 2 * TEXTPAD ? TEXTPAD : 0; lx -= 2 * textpad; ly -= 2 * textpad; var rotate = getRotateFromAngle(angle); if (angle === "auto" && !(textWidth <= lx && textHeight <= ly) && (textWidth > lx || textHeight > ly) && (!(textWidth > ly || textHeight > lx) || textWidth < textHeight !== lx < ly)) { rotate += 90; } var t = getRotatedTextSize(textBB, rotate); var scale, padForRounding; if (r && r - overhead > TEXTPAD) { var scaleAndPad = scaleTextForRoundedBar(x02, x12, y02, y12, t, r, overhead, isHorizontal, hasB); scale = scaleAndPad.scale; padForRounding = scaleAndPad.pad; } else { scale = 1; if (constrained) { scale = Math.min( 1, lx / t.x, ly / t.y ); } padForRounding = 0; } var textX = textBB.left * toLeft + textBB.right * toRight; var textY = (textBB.top + textBB.bottom) / 2; var targetX = (x02 + TEXTPAD) * toLeft + (x12 - TEXTPAD) * toRight; var targetY = (y02 + y12) / 2; var anchorX = 0; var anchorY = 0; if (isStart || isEnd) { var extrapad = (isHorizontal ? t.x : t.y) / 2; if (r && (isEnd || hasB)) { textpad += padForRounding; } var dir = isHorizontal ? dirSign(x02, x12) : dirSign(y02, y12); if (isHorizontal) { if (isStart) { targetX = x02 + dir * textpad; anchorX = -dir * extrapad; } else { targetX = x12 - dir * textpad; anchorX = dir * extrapad; } } else { if (isStart) { targetY = y02 + dir * textpad; anchorY = -dir * extrapad; } else { targetY = y12 - dir * textpad; anchorY = dir * extrapad; } } } return { textX, textY, targetX, targetY, anchorX, anchorY, scale, rotate }; } function scaleTextForRoundedBar(x02, x12, y02, y12, t, r, overhead, isHorizontal, hasB) { var barWidth = Math.max(0, Math.abs(x12 - x02) - 2 * TEXTPAD); var barHeight = Math.max(0, Math.abs(y12 - y02) - 2 * TEXTPAD); var R = r - TEXTPAD; var clippedR = overhead ? R - Math.sqrt(R * R - (R - overhead) * (R - overhead)) : R; var rX = hasB ? R * 2 : isHorizontal ? R - overhead : 2 * clippedR; var rY = hasB ? R * 2 : isHorizontal ? 2 * clippedR : R - overhead; var a, b, c; var scale, pad2; if (t.y / t.x >= barHeight / (barWidth - rX)) { scale = barHeight / t.y; } else if (t.y / t.x <= (barHeight - rY) / barWidth) { scale = barWidth / t.x; } else if (!hasB && isHorizontal) { a = t.x * t.x + t.y * t.y / 4; b = -2 * t.x * (barWidth - R) - t.y * (barHeight / 2 - R); c = (barWidth - R) * (barWidth - R) + (barHeight / 2 - R) * (barHeight / 2 - R) - R * R; scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a); } else if (!hasB) { a = t.x * t.x / 4 + t.y * t.y; b = -t.x * (barWidth / 2 - R) - 2 * t.y * (barHeight - R); c = (barWidth / 2 - R) * (barWidth / 2 - R) + (barHeight - R) * (barHeight - R) - R * R; scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a); } else { a = (t.x * t.x + t.y * t.y) / 4; b = -t.x * (barWidth / 2 - R) - t.y * (barHeight / 2 - R); c = (barWidth / 2 - R) * (barWidth / 2 - R) + (barHeight / 2 - R) * (barHeight / 2 - R) - R * R; scale = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a); } scale = Math.min(1, scale); if (isHorizontal) { pad2 = Math.max(0, R - Math.sqrt(Math.max(0, R * R - (R - (barHeight - t.y * scale) / 2) * (R - (barHeight - t.y * scale) / 2))) - overhead); } else { pad2 = Math.max(0, R - Math.sqrt(Math.max(0, R * R - (R - (barWidth - t.x * scale) / 2) * (R - (barWidth - t.x * scale) / 2))) - overhead); } return { scale, pad: pad2 }; } function toMoveOutsideBar(x02, x12, y02, y12, textBB, opts) { var isHorizontal = !!opts.isHorizontal; var constrained = !!opts.constrained; var angle = opts.angle || 0; var textWidth = textBB.width; var textHeight = textBB.height; var lx = Math.abs(x12 - x02); var ly = Math.abs(y12 - y02); var textpad; if (isHorizontal) { textpad = ly > 2 * TEXTPAD ? TEXTPAD : 0; } else { textpad = lx > 2 * TEXTPAD ? TEXTPAD : 0; } var scale = 1; if (constrained) { scale = isHorizontal ? Math.min(1, ly / textHeight) : Math.min(1, lx / textWidth); } var rotate = getRotateFromAngle(angle); var t = getRotatedTextSize(textBB, rotate); var extrapad = (isHorizontal ? t.x : t.y) / 2; var textX = (textBB.left + textBB.right) / 2; var textY = (textBB.top + textBB.bottom) / 2; var targetX = (x02 + x12) / 2; var targetY = (y02 + y12) / 2; var anchorX = 0; var anchorY = 0; var dir = isHorizontal ? dirSign(x12, x02) : dirSign(y02, y12); if (isHorizontal) { targetX = x12 - dir * textpad; anchorX = dir * extrapad; } else { targetY = y12 + dir * textpad; anchorY = -dir * extrapad; } return { textX, textY, targetX, targetY, anchorX, anchorY, scale, rotate }; } function getText(fullLayout, cd2, index, xa2, ya2) { var trace = cd2[0].trace; var texttemplate = trace.texttemplate; var value; if (texttemplate) { value = calcTexttemplate(fullLayout, cd2, index, xa2, ya2); } else if (trace.textinfo) { value = calcTextinfo(cd2, index, xa2, ya2); } else { value = helpers.getValue(trace.text, index); } return helpers.coerceString(attributeText, value); } function getTextPosition(trace, index) { var value = helpers.getValue(trace.textposition, index); return helpers.coerceEnumerated(attributeTextPosition, value); } function calcTexttemplate(fullLayout, cd2, index, xa2, ya2) { var trace = cd2[0].trace; var texttemplate = Lib.castOption(trace, index, "texttemplate"); if (!texttemplate) return ""; var isHistogram = trace.type === "histogram"; var isWaterfall = trace.type === "waterfall"; var isFunnel = trace.type === "funnel"; var isHorizontal = trace.orientation === "h"; var pLetter, pAxis; var vLetter, vAxis; if (isHorizontal) { pLetter = "y"; pAxis = ya2; vLetter = "x"; vAxis = xa2; } else { pLetter = "x"; pAxis = xa2; vLetter = "y"; vAxis = ya2; } function formatLabel(u) { return tickText(pAxis, pAxis.c2l(u), true).text; } function formatNumber(v) { return tickText(vAxis, vAxis.c2l(v), true).text; } var cdi = cd2[index]; var obj = {}; obj.label = cdi.p; obj.labelLabel = obj[pLetter + "Label"] = formatLabel(cdi.p); var tx = Lib.castOption(trace, cdi.i, "text"); if (tx === 0 || tx) obj.text = tx; obj.value = cdi.s; obj.valueLabel = obj[vLetter + "Label"] = formatNumber(cdi.s); var pt2 = {}; appendArrayPointValue(pt2, trace, cdi.i); if (isHistogram || pt2.x === void 0) pt2.x = isHorizontal ? obj.value : obj.label; if (isHistogram || pt2.y === void 0) pt2.y = isHorizontal ? obj.label : obj.value; if (isHistogram || pt2.xLabel === void 0) pt2.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel; if (isHistogram || pt2.yLabel === void 0) pt2.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel; if (isWaterfall) { obj.delta = +cdi.rawS || cdi.s; obj.deltaLabel = formatNumber(obj.delta); obj.final = cdi.v; obj.finalLabel = formatNumber(obj.final); obj.initial = obj.final - obj.delta; obj.initialLabel = formatNumber(obj.initial); } if (isFunnel) { obj.value = cdi.s; obj.valueLabel = formatNumber(obj.value); obj.percentInitial = cdi.begR; obj.percentInitialLabel = Lib.formatPercent(cdi.begR); obj.percentPrevious = cdi.difR; obj.percentPreviousLabel = Lib.formatPercent(cdi.difR); obj.percentTotal = cdi.sumR; obj.percenTotalLabel = Lib.formatPercent(cdi.sumR); } var customdata = Lib.castOption(trace, cdi.i, "customdata"); if (customdata) obj.customdata = customdata; return Lib.texttemplateString(texttemplate, obj, fullLayout._d3locale, pt2, obj, trace._meta || {}); } function calcTextinfo(cd2, index, xa2, ya2) { var trace = cd2[0].trace; var isHorizontal = trace.orientation === "h"; var isWaterfall = trace.type === "waterfall"; var isFunnel = trace.type === "funnel"; function formatLabel(u) { var pAxis = isHorizontal ? ya2 : xa2; return tickText(pAxis, u, true).text; } function formatNumber(v) { var sAxis = isHorizontal ? xa2 : ya2; return tickText(sAxis, +v, true).text; } var textinfo = trace.textinfo; var cdi = cd2[index]; var parts = textinfo.split("+"); var text = []; var tx; var hasFlag = function(flag) { return parts.indexOf(flag) !== -1; }; if (hasFlag("label")) { text.push(formatLabel(cd2[index].p)); } if (hasFlag("text")) { tx = Lib.castOption(trace, cdi.i, "text"); if (tx === 0 || tx) text.push(tx); } if (isWaterfall) { var delta = +cdi.rawS || cdi.s; var final = cdi.v; var initial = final - delta; if (hasFlag("initial")) text.push(formatNumber(initial)); if (hasFlag("delta")) text.push(formatNumber(delta)); if (hasFlag("final")) text.push(formatNumber(final)); } if (isFunnel) { if (hasFlag("value")) text.push(formatNumber(cdi.s)); var nPercent = 0; if (hasFlag("percent initial")) nPercent++; if (hasFlag("percent previous")) nPercent++; if (hasFlag("percent total")) nPercent++; var hasMultiplePercents = nPercent > 1; if (hasFlag("percent initial")) { tx = Lib.formatPercent(cdi.begR); if (hasMultiplePercents) tx += " of initial"; text.push(tx); } if (hasFlag("percent previous")) { tx = Lib.formatPercent(cdi.difR); if (hasMultiplePercents) tx += " of previous"; text.push(tx); } if (hasFlag("percent total")) { tx = Lib.formatPercent(cdi.sumR); if (hasMultiplePercents) tx += " of total"; text.push(tx); } } return text.join("
"); } module2.exports = { plot, toMoveInsideBar }; } }); // node_modules/plotly.js/src/traces/bar/hover.js var require_hover3 = __commonJS({ "node_modules/plotly.js/src/traces/bar/hover.js"(exports2, module2) { "use strict"; var Fx = require_fx(); var Registry = require_registry(); var Color = require_color(); var fillText = require_lib().fillText; var getLineWidth = require_helpers12().getLineWidth; var hoverLabelText = require_axes().hoverLabelText; var BADNUM = require_numerical().BADNUM; function hoverPoints(pointData, xval, yval, hovermode, opts) { var barPointData = hoverOnBars(pointData, xval, yval, hovermode, opts); if (barPointData) { var cd2 = barPointData.cd; var trace = cd2[0].trace; var di2 = cd2[barPointData.index]; barPointData.color = getTraceColor(trace, di2); Registry.getComponentMethod("errorbars", "hoverInfo")(di2, trace, barPointData); return [barPointData]; } } function hoverOnBars(pointData, xval, yval, hovermode, opts) { var cd2 = pointData.cd; var trace = cd2[0].trace; var t = cd2[0].t; var isClosest = hovermode === "closest"; var isWaterfall = trace.type === "waterfall"; var maxHoverDistance = pointData.maxHoverDistance; var maxSpikeDistance = pointData.maxSpikeDistance; var posVal, sizeVal, posLetter, sizeLetter, dx, dy, pRangeCalc; if (trace.orientation === "h") { posVal = yval; sizeVal = xval; posLetter = "y"; sizeLetter = "x"; dx = sizeFn; dy = positionFn; } else { posVal = xval; sizeVal = yval; posLetter = "x"; sizeLetter = "y"; dy = sizeFn; dx = positionFn; } var period = trace[posLetter + "period"]; var isClosestOrPeriod = isClosest || period; function thisBarMinPos(di3) { return thisBarExtPos(di3, -1); } function thisBarMaxPos(di3) { return thisBarExtPos(di3, 1); } function thisBarExtPos(di3, sgn) { var w = di3.w; return di3[posLetter] + sgn * w / 2; } function periodLength(di3) { return di3[posLetter + "End"] - di3[posLetter + "Start"]; } var minPos = isClosest ? thisBarMinPos : period ? function(di3) { return di3.p - periodLength(di3) / 2; } : function(di3) { return Math.min(thisBarMinPos(di3), di3.p - t.bardelta / 2); }; var maxPos = isClosest ? thisBarMaxPos : period ? function(di3) { return di3.p + periodLength(di3) / 2; } : function(di3) { return Math.max(thisBarMaxPos(di3), di3.p + t.bardelta / 2); }; function inbox(_minPos, _maxPos, maxDistance) { if (opts.finiteRange) maxDistance = 0; return Fx.inbox( _minPos - posVal, _maxPos - posVal, maxDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1 ); } function positionFn(di3) { return inbox(minPos(di3), maxPos(di3), maxHoverDistance); } function thisBarPositionFn(di3) { return inbox(thisBarMinPos(di3), thisBarMaxPos(di3), maxSpikeDistance); } function getSize(di3) { var s = di3[sizeLetter]; if (isWaterfall) { var rawS = Math.abs(di3.rawS) || 0; if (sizeVal > 0) { s += rawS; } else if (sizeVal < 0) { s -= rawS; } } return s; } function sizeFn(di3) { var v = sizeVal; var b = di3.b; var s = getSize(di3); return Fx.inbox(b - v, s - v, maxHoverDistance + (s - v) / (s - b) - 1); } function thisBarSizeFn(di3) { var v = sizeVal; var b = di3.b; var s = getSize(di3); return Fx.inbox(b - v, s - v, maxSpikeDistance + (s - v) / (s - b) - 1); } var pa2 = pointData[posLetter + "a"]; var sa2 = pointData[sizeLetter + "a"]; pRangeCalc = Math.abs(pa2.r2c(pa2.range[1]) - pa2.r2c(pa2.range[0])); function dxy(di3) { return (dx(di3) + dy(di3)) / 2; } var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy); Fx.getClosest(cd2, distfn, pointData); if (pointData.index === false) return; if (cd2[pointData.index].p === BADNUM) return; if (!isClosestOrPeriod) { minPos = function(di3) { return Math.min(thisBarMinPos(di3), di3.p - t.bargroupwidth / 2); }; maxPos = function(di3) { return Math.max(thisBarMaxPos(di3), di3.p + t.bargroupwidth / 2); }; } var index = pointData.index; var di2 = cd2[index]; var size = trace.base ? di2.b + di2.s : di2.s; pointData[sizeLetter + "0"] = pointData[sizeLetter + "1"] = sa2.c2p(di2[sizeLetter], true); pointData[sizeLetter + "LabelVal"] = size; var extent = t.extents[t.extents.round(di2.p)]; pointData[posLetter + "0"] = pa2.c2p(isClosest ? minPos(di2) : extent[0], true); pointData[posLetter + "1"] = pa2.c2p(isClosest ? maxPos(di2) : extent[1], true); var hasPeriod = di2.orig_p !== void 0; pointData[posLetter + "LabelVal"] = hasPeriod ? di2.orig_p : di2.p; pointData.labelLabel = hoverLabelText(pa2, pointData[posLetter + "LabelVal"], trace[posLetter + "hoverformat"]); pointData.valueLabel = hoverLabelText(sa2, pointData[sizeLetter + "LabelVal"], trace[sizeLetter + "hoverformat"]); pointData.baseLabel = hoverLabelText(sa2, di2.b, trace[sizeLetter + "hoverformat"]); pointData.spikeDistance = (thisBarSizeFn(di2) + thisBarPositionFn(di2)) / 2; pointData[posLetter + "Spike"] = pa2.c2p(di2.p, true); fillText(di2, trace, pointData); pointData.hovertemplate = trace.hovertemplate; return pointData; } function getTraceColor(trace, di2) { var mc2 = di2.mcc || trace.marker.color; var mlc = di2.mlcc || trace.marker.line.color; var mlw = getLineWidth(trace, di2); if (Color.opacity(mc2)) return mc2; else if (Color.opacity(mlc) && mlw) return mlc; } module2.exports = { hoverPoints, hoverOnBars, getTraceColor }; } }); // node_modules/plotly.js/src/traces/bar/event_data.js var require_event_data = __commonJS({ "node_modules/plotly.js/src/traces/bar/event_data.js"(exports2, module2) { "use strict"; module2.exports = function eventData(out, pt2, trace) { out.x = "xVal" in pt2 ? pt2.xVal : pt2.x; out.y = "yVal" in pt2 ? pt2.yVal : pt2.y; if (pt2.xa) out.xaxis = pt2.xa; if (pt2.ya) out.yaxis = pt2.ya; if (trace.orientation === "h") { out.label = out.y; out.value = out.x; } else { out.label = out.x; out.value = out.y; } return out; }; } }); // node_modules/plotly.js/src/traces/bar/select.js var require_select3 = __commonJS({ "node_modules/plotly.js/src/traces/bar/select.js"(exports2, module2) { "use strict"; module2.exports = function selectPoints(searchInfo, selectionTester) { var cd2 = searchInfo.cd; var xa2 = searchInfo.xaxis; var ya2 = searchInfo.yaxis; var trace = cd2[0].trace; var isFunnel = trace.type === "funnel"; var isHorizontal = trace.orientation === "h"; var selection = []; var i; if (selectionTester === false) { for (i = 0; i < cd2.length; i++) { cd2[i].selected = 0; } } else { for (i = 0; i < cd2.length; i++) { var di2 = cd2[i]; var ct2 = "ct" in di2 ? di2.ct : getCentroid(di2, xa2, ya2, isHorizontal, isFunnel); if (selectionTester.contains(ct2, false, i, searchInfo)) { selection.push({ pointNumber: i, x: xa2.c2d(di2.x), y: ya2.c2d(di2.y) }); di2.selected = 1; } else { di2.selected = 0; } } } return selection; }; function getCentroid(d, xa2, ya2, isHorizontal, isFunnel) { var x02 = xa2.c2p(isHorizontal ? d.s0 : d.p0, true); var x12 = xa2.c2p(isHorizontal ? d.s1 : d.p1, true); var y02 = ya2.c2p(isHorizontal ? d.p0 : d.s0, true); var y12 = ya2.c2p(isHorizontal ? d.p1 : d.s1, true); if (isFunnel) { return [(x02 + x12) / 2, (y02 + y12) / 2]; } else { if (isHorizontal) { return [x12, (y02 + y12) / 2]; } else { return [(x02 + x12) / 2, y12]; } } } } }); // node_modules/plotly.js/src/traces/bar/index.js var require_bar = __commonJS({ "node_modules/plotly.js/src/traces/bar/index.js"(exports2, module2) { "use strict"; module2.exports = { attributes: require_attributes23(), layoutAttributes: require_layout_attributes6(), supplyDefaults: require_defaults19().supplyDefaults, crossTraceDefaults: require_defaults19().crossTraceDefaults, supplyLayoutDefaults: require_layout_defaults5(), calc: require_calc5(), crossTraceCalc: require_cross_trace_calc().crossTraceCalc, colorbar: require_marker_colorbar(), arraysToCalcdata: require_arrays_to_calcdata2(), plot: require_plot3().plot, style: require_style4().style, styleOnSelect: require_style4().styleOnSelect, hoverPoints: require_hover3().hoverPoints, eventData: require_event_data(), selectPoints: require_select3(), moduleType: "trace", name: "bar", basePlotModule: require_cartesian(), categories: ["bar-like", "cartesian", "svg", "bar", "oriented", "errorBarsOK", "showLegend", "zoomScale"], animatable: true, meta: { description: [ "The data visualized by the span of the bars is set in `y`", "if `orientation` is set to *v* (the default)", "and the labels are set in `x`.", "By setting `orientation` to *h*, the roles are interchanged." ].join(" ") } }; } }); // node_modules/plotly.js/lib/bar.js var require_bar2 = __commonJS({ "node_modules/plotly.js/lib/bar.js"(exports2, module2) { "use strict"; module2.exports = require_bar(); } }); // node_modules/plotly.js/src/traces/heatmap/attributes.js var require_attributes24 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/attributes.js"(exports2, module2) { "use strict"; var scatterAttrs = require_attributes12(); var baseAttrs = require_attributes2(); var fontAttrs = require_font_attributes(); var axisHoverFormat = require_axis_format_attributes().axisHoverFormat; var hovertemplateAttrs = require_template_attributes().hovertemplateAttrs; var texttemplateAttrs = require_template_attributes().texttemplateAttrs; var colorScaleAttrs = require_attributes8(); var extendFlat = require_extend().extendFlat; module2.exports = extendFlat( { z: { valType: "data_array", editType: "calc", description: "Sets the z data." }, x: extendFlat({}, scatterAttrs.x, { impliedEdits: { xtype: "array" } }), x0: extendFlat({}, scatterAttrs.x0, { impliedEdits: { xtype: "scaled" } }), dx: extendFlat({}, scatterAttrs.dx, { impliedEdits: { xtype: "scaled" } }), y: extendFlat({}, scatterAttrs.y, { impliedEdits: { ytype: "array" } }), y0: extendFlat({}, scatterAttrs.y0, { impliedEdits: { ytype: "scaled" } }), dy: extendFlat({}, scatterAttrs.dy, { impliedEdits: { ytype: "scaled" } }), xperiod: extendFlat({}, scatterAttrs.xperiod, { impliedEdits: { xtype: "scaled" } }), yperiod: extendFlat({}, scatterAttrs.yperiod, { impliedEdits: { ytype: "scaled" } }), xperiod0: extendFlat({}, scatterAttrs.xperiod0, { impliedEdits: { xtype: "scaled" } }), yperiod0: extendFlat({}, scatterAttrs.yperiod0, { impliedEdits: { ytype: "scaled" } }), xperiodalignment: extendFlat({}, scatterAttrs.xperiodalignment, { impliedEdits: { xtype: "scaled" } }), yperiodalignment: extendFlat({}, scatterAttrs.yperiodalignment, { impliedEdits: { ytype: "scaled" } }), text: { valType: "data_array", editType: "calc", description: "Sets the text elements associated with each z value." }, hovertext: { valType: "data_array", editType: "calc", description: "Same as `text`." }, transpose: { valType: "boolean", dflt: false, editType: "calc", description: "Transposes the z data." }, xtype: { valType: "enumerated", values: ["array", "scaled"], editType: "calc+clearAxisTypes", description: [ "If *array*, the heatmap's x coordinates are given by *x*", "(the default behavior when `x` is provided).", "If *scaled*, the heatmap's x coordinates are given by *x0* and *dx*", "(the default behavior when `x` is not provided)." ].join(" ") }, ytype: { valType: "enumerated", values: ["array", "scaled"], editType: "calc+clearAxisTypes", description: [ "If *array*, the heatmap's y coordinates are given by *y*", "(the default behavior when `y` is provided)", "If *scaled*, the heatmap's y coordinates are given by *y0* and *dy*", "(the default behavior when `y` is not provided)" ].join(" ") }, zsmooth: { valType: "enumerated", values: ["fast", "best", false], dflt: false, editType: "calc", description: [ "Picks a smoothing algorithm use to smooth `z` data." ].join(" ") }, hoverongaps: { valType: "boolean", dflt: true, editType: "none", description: [ "Determines whether or not gaps", "(i.e. {nan} or missing values)", "in the `z` data have hover labels associated with them." ].join(" ") }, connectgaps: { valType: "boolean", editType: "calc", description: [ "Determines whether or not gaps", "(i.e. {nan} or missing values)", "in the `z` data are filled in.", "It is defaulted to true if `z` is a", "one dimensional array and `zsmooth` is not false;", "otherwise it is defaulted to false." ].join(" ") }, xgap: { valType: "number", dflt: 0, min: 0, editType: "plot", description: "Sets the horizontal gap (in pixels) between bricks." }, ygap: { valType: "number", dflt: 0, min: 0, editType: "plot", description: "Sets the vertical gap (in pixels) between bricks." }, xhoverformat: axisHoverFormat("x"), yhoverformat: axisHoverFormat("y"), zhoverformat: axisHoverFormat("z", 1), hovertemplate: hovertemplateAttrs(), texttemplate: texttemplateAttrs({ arrayOk: false, editType: "plot" }, { keys: ["x", "y", "z", "text"] }), textfont: fontAttrs({ editType: "plot", autoSize: true, autoColor: true, colorEditType: "style", description: "Sets the text font." }), showlegend: extendFlat({}, baseAttrs.showlegend, { dflt: false }), zorder: scatterAttrs.zorder }, { transforms: void 0 }, colorScaleAttrs("", { cLetter: "z", autoColorDflt: false }) ); } }); // node_modules/plotly.js/src/traces/heatmap/xyz_defaults.js var require_xyz_defaults = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/xyz_defaults.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Registry = require_registry(); module2.exports = function handleXYZDefaults(traceIn, traceOut, coerce, layout, xName, yName) { var z = coerce("z"); xName = xName || "x"; yName = yName || "y"; var x, y; if (z === void 0 || !z.length) return 0; if (Lib.isArray1D(z)) { x = coerce(xName); y = coerce(yName); var xlen = Lib.minRowLength(x); var ylen = Lib.minRowLength(y); if (xlen === 0 || ylen === 0) return 0; traceOut._length = Math.min(xlen, ylen, z.length); } else { x = coordDefaults(xName, coerce); y = coordDefaults(yName, coerce); if (!isValidZ(z)) return 0; coerce("transpose"); traceOut._length = null; } if (traceIn.type === "heatmapgl") return true; var handleCalendarDefaults = Registry.getComponentMethod("calendars", "handleTraceDefaults"); handleCalendarDefaults(traceIn, traceOut, [xName, yName], layout); return true; }; function coordDefaults(coordStr, coerce) { var coord = coerce(coordStr); var coordType = coord ? coerce(coordStr + "type", "array") : "scaled"; if (coordType === "scaled") { coerce(coordStr + "0"); coerce("d" + coordStr); } return coord; } function isValidZ(z) { var allRowsAreArrays = true; var oneRowIsFilled = false; var hasOneNumber = false; var zi2; for (var i = 0; i < z.length; i++) { zi2 = z[i]; if (!Lib.isArrayOrTypedArray(zi2)) { allRowsAreArrays = false; break; } if (zi2.length > 0) oneRowIsFilled = true; for (var j = 0; j < zi2.length; j++) { if (isNumeric(zi2[j])) { hasOneNumber = true; break; } } } return allRowsAreArrays && oneRowIsFilled && hasOneNumber; } } }); // node_modules/plotly.js/src/traces/heatmap/label_defaults.js var require_label_defaults = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/label_defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); module2.exports = function handleHeatmapLabelDefaults(coerce, layout) { coerce("texttemplate"); var fontDflt = Lib.extendFlat({}, layout.font, { color: "auto", size: "auto" }); Lib.coerceFont(coerce, "textfont", fontDflt); }; } }); // node_modules/plotly.js/src/traces/heatmap/style_defaults.js var require_style_defaults2 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/style_defaults.js"(exports2, module2) { "use strict"; module2.exports = function handleStyleDefaults(traceIn, traceOut, coerce) { var zsmooth = coerce("zsmooth"); if (zsmooth === false) { coerce("xgap"); coerce("ygap"); } coerce("zhoverformat"); }; } }); // node_modules/plotly.js/src/traces/heatmap/defaults.js var require_defaults20 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/defaults.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var handleXYZDefaults = require_xyz_defaults(); var handleHeatmapLabelDefaults = require_label_defaults(); var handlePeriodDefaults = require_period_defaults(); var handleStyleDefaults = require_style_defaults2(); var colorscaleDefaults = require_defaults2(); var attributes = require_attributes24(); module2.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } var validData = handleXYZDefaults(traceIn, traceOut, coerce, layout); if (!validData) { traceOut.visible = false; return; } handlePeriodDefaults(traceIn, traceOut, layout, coerce); coerce("xhoverformat"); coerce("yhoverformat"); coerce("text"); coerce("hovertext"); coerce("hovertemplate"); handleHeatmapLabelDefaults(coerce, layout); handleStyleDefaults(traceIn, traceOut, coerce, layout); coerce("hoverongaps"); coerce("connectgaps", Lib.isArray1D(traceOut.z) && traceOut.zsmooth !== false); colorscaleDefaults(traceIn, traceOut, layout, coerce, { prefix: "", cLetter: "z" }); coerce("zorder"); }; } }); // node_modules/plotly.js/src/traces/histogram/bin_functions.js var require_bin_functions = __commonJS({ "node_modules/plotly.js/src/traces/histogram/bin_functions.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); module2.exports = { count: function(n, i, size) { size[n]++; return 1; }, sum: function(n, i, size, counterData) { var v = counterData[i]; if (isNumeric(v)) { v = Number(v); size[n] += v; return v; } return 0; }, avg: function(n, i, size, counterData, counts) { var v = counterData[i]; if (isNumeric(v)) { v = Number(v); size[n] += v; counts[n]++; } return 0; }, min: function(n, i, size, counterData) { var v = counterData[i]; if (isNumeric(v)) { v = Number(v); if (!isNumeric(size[n])) { size[n] = v; return v; } else if (size[n] > v) { var delta = v - size[n]; size[n] = v; return delta; } } return 0; }, max: function(n, i, size, counterData) { var v = counterData[i]; if (isNumeric(v)) { v = Number(v); if (!isNumeric(size[n])) { size[n] = v; return v; } else if (size[n] < v) { var delta = v - size[n]; size[n] = v; return delta; } } return 0; } }; } }); // node_modules/plotly.js/src/traces/histogram/norm_functions.js var require_norm_functions = __commonJS({ "node_modules/plotly.js/src/traces/histogram/norm_functions.js"(exports2, module2) { "use strict"; module2.exports = { percent: function(size, total) { var nMax = size.length; var norm = 100 / total; for (var n = 0; n < nMax; n++) size[n] *= norm; }, probability: function(size, total) { var nMax = size.length; for (var n = 0; n < nMax; n++) size[n] /= total; }, density: function(size, total, inc, yinc) { var nMax = size.length; yinc = yinc || 1; for (var n = 0; n < nMax; n++) size[n] *= inc[n] * yinc; }, "probability density": function(size, total, inc, yinc) { var nMax = size.length; if (yinc) total /= yinc; for (var n = 0; n < nMax; n++) size[n] *= inc[n] / total; } }; } }); // node_modules/plotly.js/src/traces/histogram/average.js var require_average = __commonJS({ "node_modules/plotly.js/src/traces/histogram/average.js"(exports2, module2) { "use strict"; module2.exports = function doAvg(size, counts) { var nMax = size.length; var total = 0; for (var i = 0; i < nMax; i++) { if (counts[i]) { size[i] /= counts[i]; total += size[i]; } else size[i] = null; } return total; }; } }); // node_modules/plotly.js/src/traces/histogram/bin_label_vals.js var require_bin_label_vals = __commonJS({ "node_modules/plotly.js/src/traces/histogram/bin_label_vals.js"(exports2, module2) { "use strict"; var numConstants = require_numerical(); var oneYear = numConstants.ONEAVGYEAR; var oneMonth = numConstants.ONEAVGMONTH; var oneDay = numConstants.ONEDAY; var oneHour = numConstants.ONEHOUR; var oneMin = numConstants.ONEMIN; var oneSec = numConstants.ONESEC; var tickIncrement = require_axes().tickIncrement; module2.exports = function getBinSpanLabelRound(leftGap, rightGap, binEdges, pa2, calendar) { var dv0 = -1.1 * rightGap; var dv1 = -0.1 * rightGap; var dv2 = leftGap - dv1; var edge0 = binEdges[0]; var edge1 = binEdges[1]; var leftDigit = Math.min( biggestDigitChanged(edge0 + dv1, edge0 + dv2, pa2, calendar), biggestDigitChanged(edge1 + dv1, edge1 + dv2, pa2, calendar) ); var rightDigit = Math.min( biggestDigitChanged(edge0 + dv0, edge0 + dv1, pa2, calendar), biggestDigitChanged(edge1 + dv0, edge1 + dv1, pa2, calendar) ); var digit, disambiguateEdges; if (leftDigit > rightDigit && rightDigit < Math.abs(edge1 - edge0) / 4e3) { digit = leftDigit; disambiguateEdges = false; } else { digit = Math.min(leftDigit, rightDigit); disambiguateEdges = true; } if (pa2.type === "date" && digit > oneDay) { var dashExclude = digit === oneYear ? 1 : 6; var increment = digit === oneYear ? "M12" : "M1"; return function(v, isRightEdge) { var dateStr = pa2.c2d(v, oneYear, calendar); var dashPos = dateStr.indexOf("-", dashExclude); if (dashPos > 0) dateStr = dateStr.substr(0, dashPos); var roundedV = pa2.d2c(dateStr, 0, calendar); if (roundedV < v) { var nextV = tickIncrement(roundedV, increment, false, calendar); if ((roundedV + nextV) / 2 < v + leftGap) roundedV = nextV; } if (isRightEdge && disambiguateEdges) { return tickIncrement(roundedV, increment, true, calendar); } return roundedV; }; } return function(v, isRightEdge) { var roundedV = digit * Math.round(v / digit); if (roundedV + digit / 10 < v && roundedV + digit * 0.9 < v + leftGap) { roundedV += digit; } if (isRightEdge && disambiguateEdges) { roundedV -= digit; } return roundedV; }; }; function biggestDigitChanged(v12, v2, pa2, calendar) { if (v12 * v2 <= 0) return Infinity; var dv2 = Math.abs(v2 - v12); var isDate = pa2.type === "date"; var digit = biggestGuaranteedDigitChanged(dv2, isDate); for (var i = 0; i < 10; i++) { var nextDigit = biggestGuaranteedDigitChanged(digit * 80, isDate); if (digit === nextDigit) break; if (didDigitChange(nextDigit, v12, v2, isDate, pa2, calendar)) digit = nextDigit; else break; } return digit; } function biggestGuaranteedDigitChanged(dv2, isDate) { if (isDate && dv2 > oneSec) { if (dv2 > oneDay) { if (dv2 > oneYear * 1.1) return oneYear; if (dv2 > oneMonth * 1.1) return oneMonth; return oneDay; } if (dv2 > oneHour) return oneHour; if (dv2 > oneMin) return oneMin; return oneSec; } return Math.pow(10, Math.floor(Math.log(dv2) / Math.LN10)); } function didDigitChange(digit, v12, v2, isDate, pa2, calendar) { if (isDate && digit > oneDay) { var dateParts1 = dateParts(v12, pa2, calendar); var dateParts2 = dateParts(v2, pa2, calendar); var parti = digit === oneYear ? 0 : 1; return dateParts1[parti] !== dateParts2[parti]; } return Math.floor(v2 / digit) - Math.floor(v12 / digit) > 0.1; } function dateParts(v, pa2, calendar) { var parts = pa2.c2d(v, oneYear, calendar).split("-"); if (parts[0] === "") { parts.unshift(); parts[0] = "-" + parts[0]; } return parts; } } }); // node_modules/plotly.js/src/traces/histogram/calc.js var require_calc6 = __commonJS({ "node_modules/plotly.js/src/traces/histogram/calc.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var Registry = require_registry(); var Axes = require_axes(); var arraysToCalcdata = require_arrays_to_calcdata2(); var binFunctions = require_bin_functions(); var normFunctions = require_norm_functions(); var doAvg = require_average(); var getBinSpanLabelRound = require_bin_label_vals(); function calc(gd2, trace) { var pos = []; var size = []; var isHorizontal = trace.orientation === "h"; var pa2 = Axes.getFromId(gd2, isHorizontal ? trace.yaxis : trace.xaxis); var mainData = isHorizontal ? "y" : "x"; var counterData = { x: "y", y: "x" }[mainData]; var calendar = trace[mainData + "calendar"]; var cumulativeSpec = trace.cumulative; var i; var binsAndPos = calcAllAutoBins(gd2, trace, pa2, mainData); var binSpec = binsAndPos[0]; var pos0 = binsAndPos[1]; var nonuniformBins = typeof binSpec.size === "string"; var binEdges = []; var bins = nonuniformBins ? binEdges : binSpec; var inc = []; var counts = []; var inputPoints = []; var total = 0; var norm = trace.histnorm; var func = trace.histfunc; var densityNorm = norm.indexOf("density") !== -1; var i2, binEnd, n; if (cumulativeSpec.enabled && densityNorm) { norm = norm.replace(/ ?density$/, ""); densityNorm = false; } var extremeFunc = func === "max" || func === "min"; var sizeInit = extremeFunc ? null : 0; var binFunc = binFunctions.count; var normFunc = normFunctions[norm]; var isAvg = false; var pr2c = function(v) { return pa2.r2c(v, 0, calendar); }; var rawCounterData; if (Lib.isArrayOrTypedArray(trace[counterData]) && func !== "count") { rawCounterData = trace[counterData]; isAvg = func === "avg"; binFunc = binFunctions[func]; } i = pr2c(binSpec.start); binEnd = pr2c(binSpec.end) + (i - Axes.tickIncrement(i, binSpec.size, false, calendar)) / 1e6; while (i < binEnd && pos.length < 1e6) { i2 = Axes.tickIncrement(i, binSpec.size, false, calendar); pos.push((i + i2) / 2); size.push(sizeInit); inputPoints.push([]); binEdges.push(i); if (densityNorm) inc.push(1 / (i2 - i)); if (isAvg) counts.push(0); if (i2 <= i) break; i = i2; } binEdges.push(i); if (!nonuniformBins && pa2.type === "date") { bins = { start: pr2c(bins.start), end: pr2c(bins.end), size: bins.size }; } if (!gd2._fullLayout._roundFnOpts) gd2._fullLayout._roundFnOpts = {}; var groupName = trace["_" + mainData + "bingroup"]; var roundFnOpts = { leftGap: Infinity, rightGap: Infinity }; if (groupName) { if (!gd2._fullLayout._roundFnOpts[groupName]) gd2._fullLayout._roundFnOpts[groupName] = roundFnOpts; roundFnOpts = gd2._fullLayout._roundFnOpts[groupName]; } var nMax = size.length; var uniqueValsPerBin = true; var leftGap = roundFnOpts.leftGap; var rightGap = roundFnOpts.rightGap; var ptNumber2cdIndex = {}; for (i = 0; i < pos0.length; i++) { var posi = pos0[i]; n = Lib.findBin(posi, bins); if (n >= 0 && n < nMax) { total += binFunc(n, i, size, rawCounterData, counts); if (uniqueValsPerBin && inputPoints[n].length && posi !== pos0[inputPoints[n][0]]) { uniqueValsPerBin = false; } inputPoints[n].push(i); ptNumber2cdIndex[i] = n; leftGap = Math.min(leftGap, posi - binEdges[n]); rightGap = Math.min(rightGap, binEdges[n + 1] - posi); } } roundFnOpts.leftGap = leftGap; roundFnOpts.rightGap = rightGap; var roundFn; if (!uniqueValsPerBin) { roundFn = function(v, isRightEdge) { return function() { var roundFnOpts2 = gd2._fullLayout._roundFnOpts[groupName]; return getBinSpanLabelRound( roundFnOpts2.leftGap, roundFnOpts2.rightGap, binEdges, pa2, calendar )(v, isRightEdge); }; }; } if (isAvg) total = doAvg(size, counts); if (normFunc) normFunc(size, total, inc); if (cumulativeSpec.enabled) cdf(size, cumulativeSpec.direction, cumulativeSpec.currentbin); var seriesLen = Math.min(pos.length, size.length); var cd2 = []; var firstNonzero = 0; var lastNonzero = seriesLen - 1; for (i = 0; i < seriesLen; i++) { if (size[i]) { firstNonzero = i; break; } } for (i = seriesLen - 1; i >= firstNonzero; i--) { if (size[i]) { lastNonzero = i; break; } } for (i = firstNonzero; i <= lastNonzero; i++) { if (isNumeric(pos[i]) && isNumeric(size[i])) { var cdi = { p: pos[i], s: size[i], b: 0 }; if (!cumulativeSpec.enabled) { cdi.pts = inputPoints[i]; if (uniqueValsPerBin) { cdi.ph0 = cdi.ph1 = inputPoints[i].length ? pos0[inputPoints[i][0]] : pos[i]; } else { trace._computePh = true; cdi.ph0 = roundFn(binEdges[i]); cdi.ph1 = roundFn(binEdges[i + 1], true); } } cd2.push(cdi); } } if (cd2.length === 1) { cd2[0].width1 = Axes.tickIncrement(cd2[0].p, binSpec.size, false, calendar) - cd2[0].p; } arraysToCalcdata(cd2, trace); if (Lib.isArrayOrTypedArray(trace.selectedpoints)) { Lib.tagSelected(cd2, trace, ptNumber2cdIndex); } return cd2; } function calcAllAutoBins(gd2, trace, pa2, mainData, _overlayEdgeCase) { var binAttr = mainData + "bins"; var fullLayout = gd2._fullLayout; var groupName = trace["_" + mainData + "bingroup"]; var binOpts = fullLayout._histogramBinOpts[groupName]; var isOverlay = fullLayout.barmode === "overlay"; var i, traces, tracei, calendar, pos0, autoVals, cumulativeSpec; var r2c = function(v) { return pa2.r2c(v, 0, calendar); }; var c2r = function(v) { return pa2.c2r(v, 0, calendar); }; var cleanBound = pa2.type === "date" ? function(v) { return v || v === 0 ? Lib.cleanDate(v, null, calendar) : null; } : function(v) { return isNumeric(v) ? Number(v) : null; }; function setBound(attr, bins, newBins) { if (bins[attr + "Found"]) { bins[attr] = cleanBound(bins[attr]); if (bins[attr] === null) bins[attr] = newBins[attr]; } else { autoVals[attr] = bins[attr] = newBins[attr]; Lib.nestedProperty(traces[0], binAttr + "." + attr).set(newBins[attr]); } } if (trace["_" + mainData + "autoBinFinished"]) { delete trace["_" + mainData + "autoBinFinished"]; } else { traces = binOpts.traces; var allPos = []; var isFirstVisible = true; var has2dMap = false; var hasHist2dContour = false; for (i = 0; i < traces.length; i++) { tracei = traces[i]; if (tracei.visible) { var mainDatai = binOpts.dirs[i]; pos0 = tracei["_" + mainDatai + "pos0"] = pa2.makeCalcdata(tracei, mainDatai); allPos = Lib.concat(allPos, pos0); delete tracei["_" + mainData + "autoBinFinished"]; if (trace.visible === true) { if (isFirstVisible) { isFirstVisible = false; } else { delete tracei._autoBin; tracei["_" + mainData + "autoBinFinished"] = 1; } if (Registry.traceIs(tracei, "2dMap")) { has2dMap = true; } if (tracei.type === "histogram2dcontour") { hasHist2dContour = true; } } } } calendar = traces[0][mainData + "calendar"]; var newBinSpec = Axes.autoBin(allPos, pa2, binOpts.nbins, has2dMap, calendar, binOpts.sizeFound && binOpts.size); var autoBin = traces[0]._autoBin = {}; autoVals = autoBin[binOpts.dirs[0]] = {}; if (hasHist2dContour) { if (!binOpts.size) { newBinSpec.start = c2r(Axes.tickIncrement( r2c(newBinSpec.start), newBinSpec.size, true, calendar )); } if (binOpts.end === void 0) { newBinSpec.end = c2r(Axes.tickIncrement( r2c(newBinSpec.end), newBinSpec.size, false, calendar )); } } if (isOverlay && !Registry.traceIs(trace, "2dMap") && newBinSpec._dataSpan === 0 && pa2.type !== "category" && pa2.type !== "multicategory" && trace.bingroup === "" && typeof trace.xbins === "undefined") { if (_overlayEdgeCase) return [newBinSpec, pos0, true]; newBinSpec = handleSingleValueOverlays(gd2, trace, pa2, mainData, binAttr); } cumulativeSpec = tracei.cumulative || {}; if (cumulativeSpec.enabled && cumulativeSpec.currentbin !== "include") { if (cumulativeSpec.direction === "decreasing") { newBinSpec.start = c2r(Axes.tickIncrement( r2c(newBinSpec.start), newBinSpec.size, true, calendar )); } else { newBinSpec.end = c2r(Axes.tickIncrement( r2c(newBinSpec.end), newBinSpec.size, false, calendar )); } } binOpts.size = newBinSpec.size; if (!binOpts.sizeFound) { autoVals.size = newBinSpec.size; Lib.nestedProperty(traces[0], binAttr + ".size").set(newBinSpec.size); } setBound("start", binOpts, newBinSpec); setBound("end", binOpts, newBinSpec); } pos0 = trace["_" + mainData + "pos0"]; delete trace["_" + mainData + "pos0"]; var traceInputBins = trace._input[binAttr] || {}; var traceBinOptsCalc = Lib.extendFlat({}, binOpts); var mainStart = binOpts.start; var startIn = pa2.r2l(traceInputBins.start); var hasStart = startIn !== void 0; if ((binOpts.startFound || hasStart) && startIn !== pa2.r2l(mainStart)) { var traceStart = hasStart ? startIn : Lib.aggNums(Math.min, null, pos0); var dummyAx = { type: pa2.type === "category" || pa2.type === "multicategory" ? "linear" : pa2.type, r2l: pa2.r2l, dtick: binOpts.size, tick0: mainStart, calendar, range: [traceStart, Axes.tickIncrement(traceStart, binOpts.size, false, calendar)].map(pa2.l2r) }; var newStart = Axes.tickFirst(dummyAx); if (newStart > pa2.r2l(traceStart)) { newStart = Axes.tickIncrement(newStart, binOpts.size, true, calendar); } traceBinOptsCalc.start = pa2.l2r(newStart); if (!hasStart) Lib.nestedProperty(trace, binAttr + ".start").set(traceBinOptsCalc.start); } var mainEnd = binOpts.end; var endIn = pa2.r2l(traceInputBins.end); var hasEnd = endIn !== void 0; if ((binOpts.endFound || hasEnd) && endIn !== pa2.r2l(mainEnd)) { var traceEnd = hasEnd ? endIn : Lib.aggNums(Math.max, null, pos0); traceBinOptsCalc.end = pa2.l2r(traceEnd); if (!hasEnd) Lib.nestedProperty(trace, binAttr + ".start").set(traceBinOptsCalc.end); } var autoBinAttr = "autobin" + mainData; if (trace._input[autoBinAttr] === false) { trace._input[binAttr] = Lib.extendFlat({}, trace[binAttr] || {}); delete trace._input[autoBinAttr]; delete trace[autoBinAttr]; } return [traceBinOptsCalc, pos0]; } function handleSingleValueOverlays(gd2, trace, pa2, mainData, binAttr) { var fullLayout = gd2._fullLayout; var overlaidTraceGroup = getConnectedHistograms(gd2, trace); var pastThisTrace = false; var minSize = Infinity; var singleValuedTraces = [trace]; var i, tracei, binOpts; for (i = 0; i < overlaidTraceGroup.length; i++) { tracei = overlaidTraceGroup[i]; if (tracei === trace) { pastThisTrace = true; } else if (!pastThisTrace) { binOpts = fullLayout._histogramBinOpts[tracei["_" + mainData + "bingroup"]]; minSize = Math.min(minSize, binOpts.size || tracei[binAttr].size); } else { var resulti = calcAllAutoBins(gd2, tracei, pa2, mainData, true); var binSpeci = resulti[0]; var isSingleValued = resulti[2]; tracei["_" + mainData + "autoBinFinished"] = 1; tracei["_" + mainData + "pos0"] = resulti[1]; if (isSingleValued) { singleValuedTraces.push(tracei); } else { minSize = Math.min(minSize, binSpeci.size); } } } var dataVals = new Array(singleValuedTraces.length); for (i = 0; i < singleValuedTraces.length; i++) { var pos0 = singleValuedTraces[i]["_" + mainData + "pos0"]; for (var j = 0; j < pos0.length; j++) { if (pos0[j] !== void 0) { dataVals[i] = pos0[j]; break; } } } if (!isFinite(minSize)) { minSize = Lib.distinctVals(dataVals).minDiff; } for (i = 0; i < singleValuedTraces.length; i++) { tracei = singleValuedTraces[i]; var calendar = tracei[mainData + "calendar"]; var newBins = { start: pa2.c2r(dataVals[i] - minSize / 2, 0, calendar), end: pa2.c2r(dataVals[i] + minSize / 2, 0, calendar), size: minSize }; tracei._input[binAttr] = tracei[binAttr] = newBins; binOpts = fullLayout._histogramBinOpts[tracei["_" + mainData + "bingroup"]]; if (binOpts) Lib.extendFlat(binOpts, newBins); } return trace[binAttr]; } function getConnectedHistograms(gd2, trace) { var xid = trace.xaxis; var yid = trace.yaxis; var orientation = trace.orientation; var out = []; var fullData = gd2._fullData; for (var i = 0; i < fullData.length; i++) { var tracei = fullData[i]; if (tracei.type === "histogram" && tracei.visible === true && tracei.orientation === orientation && tracei.xaxis === xid && tracei.yaxis === yid) { out.push(tracei); } } return out; } function cdf(size, direction, currentBin) { var i, vi2, prevSum; function firstHalfPoint(i2) { prevSum = size[i2]; size[i2] /= 2; } function nextHalfPoint(i2) { vi2 = size[i2]; size[i2] = prevSum + vi2 / 2; prevSum += vi2; } if (currentBin === "half") { if (direction === "increasing") { firstHalfPoint(0); for (i = 1; i < size.length; i++) { nextHalfPoint(i); } } else { firstHalfPoint(size.length - 1); for (i = size.length - 2; i >= 0; i--) { nextHalfPoint(i); } } } else if (direction === "increasing") { for (i = 1; i < size.length; i++) { size[i] += size[i - 1]; } if (currentBin === "exclude") { size.unshift(0); size.pop(); } } else { for (i = size.length - 2; i >= 0; i--) { size[i] += size[i + 1]; } if (currentBin === "exclude") { size.push(0); size.shift(); } } } module2.exports = { calc, calcAllAutoBins }; } }); // node_modules/plotly.js/src/traces/histogram2d/calc.js var require_calc7 = __commonJS({ "node_modules/plotly.js/src/traces/histogram2d/calc.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var Axes = require_axes(); var binFunctions = require_bin_functions(); var normFunctions = require_norm_functions(); var doAvg = require_average(); var getBinSpanLabelRound = require_bin_label_vals(); var calcAllAutoBins = require_calc6().calcAllAutoBins; module2.exports = function calc(gd2, trace) { var xa2 = Axes.getFromId(gd2, trace.xaxis); var ya2 = Axes.getFromId(gd2, trace.yaxis); var xcalendar = trace.xcalendar; var ycalendar = trace.ycalendar; var xr2c = function(v) { return xa2.r2c(v, 0, xcalendar); }; var yr2c = function(v) { return ya2.r2c(v, 0, ycalendar); }; var xc2r = function(v) { return xa2.c2r(v, 0, xcalendar); }; var yc2r = function(v) { return ya2.c2r(v, 0, ycalendar); }; var i, j, n, m; var xBinsAndPos = calcAllAutoBins(gd2, trace, xa2, "x"); var xBinSpec = xBinsAndPos[0]; var xPos0 = xBinsAndPos[1]; var yBinsAndPos = calcAllAutoBins(gd2, trace, ya2, "y"); var yBinSpec = yBinsAndPos[0]; var yPos0 = yBinsAndPos[1]; var serieslen = trace._length; if (xPos0.length > serieslen) xPos0.splice(serieslen, xPos0.length - serieslen); if (yPos0.length > serieslen) yPos0.splice(serieslen, yPos0.length - serieslen); var z = []; var onecol = []; var zerocol = []; var nonuniformBinsX = typeof xBinSpec.size === "string"; var nonuniformBinsY = typeof yBinSpec.size === "string"; var xEdges = []; var yEdges = []; var xbins = nonuniformBinsX ? xEdges : xBinSpec; var ybins = nonuniformBinsY ? yEdges : yBinSpec; var total = 0; var counts = []; var inputPoints = []; var norm = trace.histnorm; var func = trace.histfunc; var densitynorm = norm.indexOf("density") !== -1; var extremefunc = func === "max" || func === "min"; var sizeinit = extremefunc ? null : 0; var binfunc = binFunctions.count; var normfunc = normFunctions[norm]; var doavg = false; var xinc = []; var yinc = []; var rawCounterData = "z" in trace ? trace.z : "marker" in trace && Array.isArray(trace.marker.color) ? trace.marker.color : ""; if (rawCounterData && func !== "count") { doavg = func === "avg"; binfunc = binFunctions[func]; } var xBinSize = xBinSpec.size; var xBinStart = xr2c(xBinSpec.start); var xBinEnd = xr2c(xBinSpec.end) + (xBinStart - Axes.tickIncrement(xBinStart, xBinSize, false, xcalendar)) / 1e6; for (i = xBinStart; i < xBinEnd; i = Axes.tickIncrement(i, xBinSize, false, xcalendar)) { onecol.push(sizeinit); xEdges.push(i); if (doavg) zerocol.push(0); } xEdges.push(i); var nx = onecol.length; var dx = (i - xBinStart) / nx; var x02 = xc2r(xBinStart + dx / 2); var yBinSize = yBinSpec.size; var yBinStart = yr2c(yBinSpec.start); var yBinEnd = yr2c(yBinSpec.end) + (yBinStart - Axes.tickIncrement(yBinStart, yBinSize, false, ycalendar)) / 1e6; for (i = yBinStart; i < yBinEnd; i = Axes.tickIncrement(i, yBinSize, false, ycalendar)) { z.push(onecol.slice()); yEdges.push(i); var ipCol = new Array(nx); for (j = 0; j < nx; j++) ipCol[j] = []; inputPoints.push(ipCol); if (doavg) counts.push(zerocol.slice()); } yEdges.push(i); var ny = z.length; var dy = (i - yBinStart) / ny; var y02 = yc2r(yBinStart + dy / 2); if (densitynorm) { xinc = makeIncrements(onecol.length, xbins, dx, nonuniformBinsX); yinc = makeIncrements(z.length, ybins, dy, nonuniformBinsY); } if (!nonuniformBinsX && xa2.type === "date") xbins = binsToCalc(xr2c, xbins); if (!nonuniformBinsY && ya2.type === "date") ybins = binsToCalc(yr2c, ybins); var uniqueValsPerX = true; var uniqueValsPerY = true; var xVals = new Array(nx); var yVals = new Array(ny); var xGapLow = Infinity; var xGapHigh = Infinity; var yGapLow = Infinity; var yGapHigh = Infinity; for (i = 0; i < serieslen; i++) { var xi2 = xPos0[i]; var yi2 = yPos0[i]; n = Lib.findBin(xi2, xbins); m = Lib.findBin(yi2, ybins); if (n >= 0 && n < nx && m >= 0 && m < ny) { total += binfunc(n, i, z[m], rawCounterData, counts[m]); inputPoints[m][n].push(i); if (uniqueValsPerX) { if (xVals[n] === void 0) xVals[n] = xi2; else if (xVals[n] !== xi2) uniqueValsPerX = false; } if (uniqueValsPerY) { if (yVals[m] === void 0) yVals[m] = yi2; else if (yVals[m] !== yi2) uniqueValsPerY = false; } xGapLow = Math.min(xGapLow, xi2 - xEdges[n]); xGapHigh = Math.min(xGapHigh, xEdges[n + 1] - xi2); yGapLow = Math.min(yGapLow, yi2 - yEdges[m]); yGapHigh = Math.min(yGapHigh, yEdges[m + 1] - yi2); } } if (doavg) { for (m = 0; m < ny; m++) total += doAvg(z[m], counts[m]); } if (normfunc) { for (m = 0; m < ny; m++) normfunc(z[m], total, xinc, yinc[m]); } return { x: xPos0, xRanges: getRanges(xEdges, uniqueValsPerX && xVals, xGapLow, xGapHigh, xa2, xcalendar), x0: x02, dx, y: yPos0, yRanges: getRanges(yEdges, uniqueValsPerY && yVals, yGapLow, yGapHigh, ya2, ycalendar), y0: y02, dy, z, pts: inputPoints }; }; function makeIncrements(len, bins, dv2, nonuniform) { var out = new Array(len); var i; if (nonuniform) { for (i = 0; i < len; i++) out[i] = 1 / (bins[i + 1] - bins[i]); } else { var inc = 1 / dv2; for (i = 0; i < len; i++) out[i] = inc; } return out; } function binsToCalc(r2c, bins) { return { start: r2c(bins.start), end: r2c(bins.end), size: bins.size }; } function getRanges(edges, uniqueVals, gapLow, gapHigh, ax, calendar) { var i; var len = edges.length - 1; var out = new Array(len); var roundFn = getBinSpanLabelRound(gapLow, gapHigh, edges, ax, calendar); for (i = 0; i < len; i++) { var v = (uniqueVals || [])[i]; out[i] = v === void 0 ? [roundFn(edges[i]), roundFn(edges[i + 1], true)] : [v, v]; } return out; } } }); // node_modules/plotly.js/src/traces/heatmap/convert_column_xyz.js var require_convert_column_xyz = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/convert_column_xyz.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var BADNUM = require_numerical().BADNUM; var alignPeriod = require_align_period(); module2.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, arrayVarNames) { var colLen = trace._length; var col1 = ax1.makeCalcdata(trace, var1Name); var col2 = ax2.makeCalcdata(trace, var2Name); col1 = alignPeriod(trace, ax1, var1Name, col1).vals; col2 = alignPeriod(trace, ax2, var2Name, col2).vals; var textCol = trace.text; var hasColumnText = textCol !== void 0 && Lib.isArray1D(textCol); var hoverTextCol = trace.hovertext; var hasColumnHoverText = hoverTextCol !== void 0 && Lib.isArray1D(hoverTextCol); var i, j; var col1dv = Lib.distinctVals(col1); var col1vals = col1dv.vals; var col2dv = Lib.distinctVals(col2); var col2vals = col2dv.vals; var newArrays = []; var text; var hovertext; var nI = col2vals.length; var nJ = col1vals.length; for (i = 0; i < arrayVarNames.length; i++) { newArrays[i] = Lib.init2dArray(nI, nJ); } if (hasColumnText) { text = Lib.init2dArray(nI, nJ); } if (hasColumnHoverText) { hovertext = Lib.init2dArray(nI, nJ); } var after2before = Lib.init2dArray(nI, nJ); for (i = 0; i < colLen; i++) { if (col1[i] !== BADNUM && col2[i] !== BADNUM) { var i12 = Lib.findBin(col1[i] + col1dv.minDiff / 2, col1vals); var i2 = Lib.findBin(col2[i] + col2dv.minDiff / 2, col2vals); for (j = 0; j < arrayVarNames.length; j++) { var arrayVarName = arrayVarNames[j]; var arrayVar = trace[arrayVarName]; var newArray = newArrays[j]; newArray[i2][i12] = arrayVar[i]; after2before[i2][i12] = i; } if (hasColumnText) text[i2][i12] = textCol[i]; if (hasColumnHoverText) hovertext[i2][i12] = hoverTextCol[i]; } } trace["_" + var1Name] = col1vals; trace["_" + var2Name] = col2vals; for (j = 0; j < arrayVarNames.length; j++) { trace["_" + arrayVarNames[j]] = newArrays[j]; } if (hasColumnText) trace._text = text; if (hasColumnHoverText) trace._hovertext = hovertext; if (ax1 && ax1.type === "category") { trace["_" + var1Name + "CategoryMap"] = col1vals.map(function(v) { return ax1._categories[v]; }); } if (ax2 && ax2.type === "category") { trace["_" + var2Name + "CategoryMap"] = col2vals.map(function(v) { return ax2._categories[v]; }); } trace._after2before = after2before; }; } }); // node_modules/plotly.js/src/traces/heatmap/clean_2d_array.js var require_clean_2d_array = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/clean_2d_array.js"(exports2, module2) { "use strict"; var isNumeric = require_fast_isnumeric(); var Lib = require_lib(); var BADNUM = require_numerical().BADNUM; module2.exports = function clean2dArray(zOld, trace, xa2, ya2) { var rowlen, collen, getCollen, old2new, i, j; function cleanZvalue(v) { if (!isNumeric(v)) return void 0; return +v; } if (trace && trace.transpose) { rowlen = 0; for (i = 0; i < zOld.length; i++) rowlen = Math.max(rowlen, zOld[i].length); if (rowlen === 0) return false; getCollen = function(zOld2) { return zOld2.length; }; old2new = function(zOld2, i2, j2) { return (zOld2[j2] || [])[i2]; }; } else { rowlen = zOld.length; getCollen = function(zOld2, i2) { return zOld2[i2].length; }; old2new = function(zOld2, i2, j2) { return (zOld2[i2] || [])[j2]; }; } var padOld2new = function(zOld2, i2, j2) { if (i2 === BADNUM || j2 === BADNUM) return BADNUM; return old2new(zOld2, i2, j2); }; function axisMapping(ax) { if (trace && trace.type !== "carpet" && trace.type !== "contourcarpet" && ax && ax.type === "category" && trace["_" + ax._id.charAt(0)].length) { var axLetter = ax._id.charAt(0); var axMapping = {}; var traceCategories = trace["_" + axLetter + "CategoryMap"] || trace[axLetter]; for (i = 0; i < traceCategories.length; i++) { axMapping[traceCategories[i]] = i; } return function(i2) { var ind = axMapping[ax._categories[i2]]; return ind + 1 ? ind : BADNUM; }; } else { return Lib.identity; } } var xMap = axisMapping(xa2); var yMap = axisMapping(ya2); if (ya2 && ya2.type === "category") rowlen = ya2._categories.length; var zNew = new Array(rowlen); for (i = 0; i < rowlen; i++) { if (xa2 && xa2.type === "category") { collen = xa2._categories.length; } else { collen = getCollen(zOld, i); } zNew[i] = new Array(collen); for (j = 0; j < collen; j++) zNew[i][j] = cleanZvalue(padOld2new(zOld, yMap(i), xMap(j))); } return zNew; }; } }); // node_modules/plotly.js/src/traces/heatmap/interp2d.js var require_interp2d = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/interp2d.js"(exports2, module2) { "use strict"; var Lib = require_lib(); var INTERPTHRESHOLD = 0.01; var NEIGHBORSHIFTS = [[-1, 0], [1, 0], [0, -1], [0, 1]]; function correctionOvershoot(maxFractionalChange) { return 0.5 - 0.25 * Math.min(1, maxFractionalChange * 0.5); } module2.exports = function interp2d(z, emptyPoints) { var maxFractionalChange = 1; var i; iterateInterp2d(z, emptyPoints); for (i = 0; i < emptyPoints.length; i++) { if (emptyPoints[i][2] < 4) break; } emptyPoints = emptyPoints.slice(i); for (i = 0; i < 100 && maxFractionalChange > INTERPTHRESHOLD; i++) { maxFractionalChange = iterateInterp2d( z, emptyPoints, correctionOvershoot(maxFractionalChange) ); } if (maxFractionalChange > INTERPTHRESHOLD) { Lib.log("interp2d didn't converge quickly", maxFractionalChange); } return z; }; function iterateInterp2d(z, emptyPoints, overshoot) { var maxFractionalChange = 0; var thisPt; var i; var j; var p; var q; var neighborShift; var neighborRow; var neighborVal; var neighborCount; var neighborSum; var initialVal; var minNeighbor; var maxNeighbor; for (p = 0; p < emptyPoints.length; p++) { thisPt = emptyPoints[p]; i = thisPt[0]; j = thisPt[1]; initialVal = z[i][j]; neighborSum = 0; neighborCount = 0; for (q = 0; q < 4; q++) { neighborShift = NEIGHBORSHIFTS[q]; neighborRow = z[i + neighborShift[0]]; if (!neighborRow) continue; neighborVal = neighborRow[j + neighborShift[1]]; if (neighborVal !== void 0) { if (neighborSum === 0) { minNeighbor = maxNeighbor = neighborVal; } else { minNeighbor = Math.min(minNeighbor, neighborVal); maxNeighbor = Math.max(maxNeighbor, neighborVal); } neighborCount++; neighborSum += neighborVal; } } if (neighborCount === 0) { throw "iterateInterp2d order is wrong: no defined neighbors"; } z[i][j] = neighborSum / neighborCount; if (initialVal === void 0) { if (neighborCount < 4) maxFractionalChange = 1; } else { z[i][j] = (1 + overshoot) * z[i][j] - overshoot * initialVal; if (maxNeighbor > minNeighbor) { maxFractionalChange = Math.max( maxFractionalChange, Math.abs(z[i][j] - initialVal) / (maxNeighbor - minNeighbor) ); } } } return maxFractionalChange; } } }); // node_modules/plotly.js/src/traces/heatmap/find_empties.js var require_find_empties = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/find_empties.js"(exports2, module2) { "use strict"; var maxRowLength = require_lib().maxRowLength; module2.exports = function findEmpties(z) { var empties = []; var neighborHash = {}; var noNeighborList = []; var nextRow = z[0]; var row = []; var blank = [0, 0, 0]; var rowLength = maxRowLength(z); var prevRow; var i; var j; var thisPt; var p; var neighborCount; var newNeighborHash; var foundNewNeighbors; for (i = 0; i < z.length; i++) { prevRow = row; row = nextRow; nextRow = z[i + 1] || []; for (j = 0; j < rowLength; j++) { if (row[j] === void 0) { neighborCount = (row[j - 1] !== void 0 ? 1 : 0) + (row[j + 1] !== void 0 ? 1 : 0) + (prevRow[j] !== void 0 ? 1 : 0) + (nextRow[j] !== void 0 ? 1 : 0); if (neighborCount) { if (i === 0) neighborCount++; if (j === 0) neighborCount++; if (i === z.length - 1) neighborCount++; if (j === row.length - 1) neighborCount++; if (neighborCount < 4) { neighborHash[[i, j]] = [i, j, neighborCount]; } empties.push([i, j, neighborCount]); } else noNeighborList.push([i, j]); } } } while (noNeighborList.length) { newNeighborHash = {}; foundNewNeighbors = false; for (p = noNeighborList.length - 1; p >= 0; p--) { thisPt = noNeighborList[p]; i = thisPt[0]; j = thisPt[1]; neighborCount = ((neighborHash[[i - 1, j]] || blank)[2] + (neighborHash[[i + 1, j]] || blank)[2] + (neighborHash[[i, j - 1]] || blank)[2] + (neighborHash[[i, j + 1]] || blank)[2]) / 20; if (neighborCount) { newNeighborHash[thisPt] = [i, j, neighborCount]; noNeighborList.splice(p, 1); foundNewNeighbors = true; } } if (!foundNewNeighbors) { throw "findEmpties iterated with no new neighbors"; } for (thisPt in newNeighborHash) { neighborHash[thisPt] = newNeighborHash[thisPt]; empties.push(newNeighborHash[thisPt]); } } return empties.sort(function(a, b) { return b[2] - a[2]; }); }; } }); // node_modules/plotly.js/src/traces/heatmap/make_bound_array.js var require_make_bound_array = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/make_bound_array.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var isArrayOrTypedArray = require_lib().isArrayOrTypedArray; module2.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) { var arrayOut = []; var isContour = Registry.traceIs(trace, "contour"); var isHist = Registry.traceIs(trace, "histogram"); var isGL2D = Registry.traceIs(trace, "gl2d"); var v02; var dv2; var i; var isArrayOfTwoItemsOrMore = isArrayOrTypedArray(arrayIn) && arrayIn.length > 1; if (isArrayOfTwoItemsOrMore && !isHist && ax.type !== "category") { var len = arrayIn.length; if (len <= numbricks) { if (isContour || isGL2D) arrayOut = Array.from(arrayIn).slice(0, numbricks); else if (numbricks === 1) { if (ax.type === "log") { arrayOut = [0.5 * arrayIn[0], 2 * arrayIn[0]]; } else { arrayOut = [arrayIn[0] - 0.5, arrayIn[0] + 0.5]; } } else if (ax.type === "log") { arrayOut = [Math.pow(arrayIn[0], 1.5) / Math.pow(arrayIn[1], 0.5)]; for (i = 1; i < len; i++) { arrayOut.push(Math.sqrt(arrayIn[i - 1] * arrayIn[i])); } arrayOut.push(Math.pow(arrayIn[len - 1], 1.5) / Math.pow(arrayIn[len - 2], 0.5)); } else { arrayOut = [1.5 * arrayIn[0] - 0.5 * arrayIn[1]]; for (i = 1; i < len; i++) { arrayOut.push((arrayIn[i - 1] + arrayIn[i]) * 0.5); } arrayOut.push(1.5 * arrayIn[len - 1] - 0.5 * arrayIn[len - 2]); } if (len < numbricks) { var lastPt = arrayOut[arrayOut.length - 1]; var delta; if (ax.type === "log") { delta = lastPt / arrayOut[arrayOut.length - 2]; for (i = len; i < numbricks; i++) { lastPt *= delta; arrayOut.push(lastPt); } } else { delta = lastPt - arrayOut[arrayOut.length - 2]; for (i = len; i < numbricks; i++) { lastPt += delta; arrayOut.push(lastPt); } } } } else { return isContour ? arrayIn.slice(0, numbricks) : ( // we must be strict for contours arrayIn.slice(0, numbricks + 1) ); } } else { var calendar = trace[ax._id.charAt(0) + "calendar"]; if (isHist) { v02 = ax.r2c(v0In, 0, calendar); } else { if (isArrayOrTypedArray(arrayIn) && arrayIn.length === 1) { v02 = arrayIn[0]; } else if (v0In === void 0) { v02 = 0; } else { var fn = ax.type === "log" ? ax.d2c : ax.r2c; v02 = fn(v0In, 0, calendar); } } dv2 = dvIn || 1; for (i = isContour || isGL2D ? 0 : -0.5; i < numbricks; i++) { arrayOut.push(v02 + dv2 * i); } } return arrayOut; }; } }); // node_modules/plotly.js/src/traces/heatmap/calc.js var require_calc8 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/calc.js"(exports2, module2) { "use strict"; var Registry = require_registry(); var Lib = require_lib(); var Axes = require_axes(); var alignPeriod = require_align_period(); var histogram2dCalc = require_calc7(); var colorscaleCalc = require_calc(); var convertColumnData = require_convert_column_xyz(); var clean2dArray = require_clean_2d_array(); var interp2d = require_interp2d(); var findEmpties = require_find_empties(); var makeBoundArray = require_make_bound_array(); var BADNUM = require_numerical().BADNUM; module2.exports = function calc(gd2, trace) { var xa2 = Axes.getFromId(gd2, trace.xaxis || "x"); var ya2 = Axes.getFromId(gd2, trace.yaxis || "y"); var isContour = Registry.traceIs(trace, "contour"); var isHist = Registry.traceIs(trace, "histogram"); var isGL2D = Registry.traceIs(trace, "gl2d"); var zsmooth = isContour ? "best" : trace.zsmooth; var x, x02, dx, origX; var y, y02, dy, origY; var z, i, binned; xa2._minDtick = 0; ya2._minDtick = 0; if (isHist) { binned = histogram2dCalc(gd2, trace); origX = binned.orig_x; x = binned.x; x02 = binned.x0; dx = binned.dx; origY = binned.orig_y; y = binned.y; y02 = binned.y0; dy = binned.dy; z = binned.z; } else { var zIn = trace.z; if (Lib.isArray1D(zIn)) { convertColumnData(trace, xa2, ya2, "x", "y", ["z"]); x = trace._x; y = trace._y; zIn = trace._z; } else { origX = trace.x ? xa2.makeCalcdata(trace, "x") : []; origY = trace.y ? ya2.makeCalcdata(trace, "y") : []; x = alignPeriod(trace, xa2, "x", origX).vals; y = alignPeriod(trace, ya2, "y", origY).vals; trace._x = x; trace._y = y; } x02 = trace.x0; dx = trace.dx; y02 = trace.y0; dy = trace.dy; z = clean2dArray(zIn, trace, xa2, ya2); } if (xa2.rangebreaks || ya2.rangebreaks) { z = dropZonBreaks(x, y, z); if (!isHist) { x = skipBreaks(x); y = skipBreaks(y); trace._x = x; trace._y = y; } } if (!isHist && (isContour || trace.connectgaps)) { trace._emptypoints = findEmpties(z); interp2d(z, trace._emptypoints); } function noZsmooth(msg) { zsmooth = trace._input.zsmooth = trace.zsmooth = false; Lib.warn('cannot use zsmooth: "fast": ' + msg); } function scaleIsLinear(s) { if (s.length > 1) { var avgdx = (s[s.length - 1] - s[0]) / (s.length - 1); var maxErrX = Math.abs(avgdx / 100); for (i = 0; i < s.length - 1; i++) { if (Math.abs(s[i + 1] - s[i] - avgdx) > maxErrX) { return false; } } } return true; } trace._islinear = false; if (xa2.type === "log" || ya2.type === "log") { if (zsmooth === "fast") { noZsmooth("log axis found"); } } else if (!scaleIsLinear(x)) { if (zsmooth === "fast") noZsmooth("x scale is not linear"); } else if (!scaleIsLinear(y)) { if (zsmooth === "fast") noZsmooth("y scale is not linear"); } else { trace._islinear = true; } var xlen = Lib.maxRowLength(z); var xIn = trace.xtype === "scaled" ? "" : x; var xArray = makeBoundArray(trace, xIn, x02, dx, xlen, xa2); var yIn = trace.ytype === "scaled" ? "" : y; var yArray = makeBoundArray(trace, yIn, y02, dy, z.length, ya2); if (!isGL2D) { trace._extremes[xa2._id] = Axes.findExtremes(xa2, xArray); trace._extremes[ya2._id] = Axes.findExtremes(ya2, yArray); } var cd0 = { x: xArray, y: yArray, z, text: trace._text || trace.text, hovertext: trace._hovertext || trace.hovertext }; if (trace.xperiodalignment && origX) { cd0.orig_x = origX; } if (trace.yperiodalignment && origY) { cd0.orig_y = origY; } if (xIn && xIn.length === xArray.length - 1) cd0.xCenter = xIn; if (yIn && yIn.length === yArray.length - 1) cd0.yCenter = yIn; if (isHist) { cd0.xRanges = binned.xRanges; cd0.yRanges = binned.yRanges; cd0.pts = binned.pts; } if (!isContour) { colorscaleCalc(gd2, trace, { vals: z, cLetter: "z" }); } if (isContour && trace.contours && trace.contours.coloring === "heatmap") { var dummyTrace = { type: trace.type === "contour" ? "heatmap" : "histogram2d", xcalendar: trace.xcalendar, ycalendar: trace.ycalendar }; cd0.xfill = makeBoundArray(dummyTrace, xIn, x02, dx, xlen, xa2); cd0.yfill = makeBoundArray(dummyTrace, yIn, y02, dy, z.length, ya2); } return [cd0]; }; function skipBreaks(a) { var b = []; var len = a.length; for (var i = 0; i < len; i++) { var v = a[i]; if (v !== BADNUM) b.push(v); } return b; } function dropZonBreaks(x, y, z) { var newZ = []; var k = -1; for (var i = 0; i < z.length; i++) { if (y[i] === BADNUM) continue; k++; newZ[k] = []; for (var j = 0; j < z[i].length; j++) { if (x[j] === BADNUM) continue; newZ[k].push(z[i][j]); } } return newZ; } } }); // node_modules/plotly.js/src/constants/pixelated_image.js var require_pixelated_image = __commonJS({ "node_modules/plotly.js/src/constants/pixelated_image.js"(exports2) { "use strict"; exports2.CSS_DECLARATIONS = [ ["image-rendering", "optimizeSpeed"], ["image-rendering", "-moz-crisp-edges"], ["image-rendering", "-o-crisp-edges"], ["image-rendering", "-webkit-optimize-contrast"], ["image-rendering", "optimize-contrast"], ["image-rendering", "crisp-edges"], ["image-rendering", "pixelated"] ]; exports2.STYLE = exports2.CSS_DECLARATIONS.map(function(d) { return d.join(": ") + "; "; }).join(""); } }); // node_modules/plotly.js/src/lib/supports_pixelated_image.js var require_supports_pixelated_image = __commonJS({ "node_modules/plotly.js/src/lib/supports_pixelated_image.js"(exports2, module2) { "use strict"; var constants = require_pixelated_image(); var Drawing = require_drawing(); var Lib = require_lib(); var _supportsPixelated = null; function supportsPixelatedImage() { if (_supportsPixelated !== null) { return _supportsPixelated; } _supportsPixelated = false; var unsupportedBrowser = Lib.isIE() || Lib.isSafari() || Lib.isIOS(); if (window.navigator.userAgent && !unsupportedBrowser) { var declarations = Array.from(constants.CSS_DECLARATIONS).reverse(); var supports = window.CSS && window.CSS.supports || window.supportsCSS; if (typeof supports === "function") { _supportsPixelated = declarations.some(function(d) { return supports.apply(null, d); }); } else { var image3 = Drawing.tester.append("image").attr("style", constants.STYLE); var cStyles = window.getComputedStyle(image3.node()); var imageRendering = cStyles.imageRendering; _supportsPixelated = declarations.some(function(d) { var value = d[1]; return imageRendering === value || imageRendering === value.toLowerCase(); }); image3.remove(); } } return _supportsPixelated; } module2.exports = supportsPixelatedImage; } }); // node_modules/plotly.js/src/traces/heatmap/plot.js var require_plot4 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/plot.js"(exports2, module2) { "use strict"; var d3 = require_d3(); var tinycolor = require_tinycolor(); var Registry = require_registry(); var Drawing = require_drawing(); var Axes = require_axes(); var Lib = require_lib(); var svgTextUtils = require_svg_text_utils(); var formatLabels = require_format_labels(); var Color = require_color(); var extractOpts = require_colorscale().extractOpts; var makeColorScaleFuncFromTrace = require_colorscale().makeColorScaleFuncFromTrace; var xmlnsNamespaces = require_xmlns_namespaces(); var alignmentConstants = require_alignment(); var LINE_SPACING = alignmentConstants.LINE_SPACING; var supportsPixelatedImage = require_supports_pixelated_image(); var PIXELATED_IMAGE_STYLE = require_pixelated_image().STYLE; var labelClass = "heatmap-label"; function selectLabels(plotGroup) { return plotGroup.selectAll("g." + labelClass); } function removeLabels(plotGroup) { selectLabels(plotGroup).remove(); } module2.exports = function(gd2, plotinfo, cdheatmaps, heatmapLayer) { var xa2 = plotinfo.xaxis; var ya2 = plotinfo.yaxis; Lib.makeTraceGroups(heatmapLayer, cdheatmaps, "hm").each(function(cd2) { var plotGroup = d3.select(this); var cd0 = cd2[0]; var trace = cd0.trace; var xGap = trace.xgap || 0; var yGap = trace.ygap || 0; var z = cd0.z; var x = cd0.x; var y = cd0.y; var xc2 = cd0.xCenter; var yc2 = cd0.yCenter; var isContour = Registry.traceIs(trace, "contour"); var zsmooth = isContour ? "best" : trace.zsmooth; var m = z.length; var n = Lib.maxRowLength(z); var xrev = false; var yrev = false; var left, right, temp, top, bottom, i, j, k; i = 0; while (left === void 0 && i < x.length - 1) { left = xa2.c2p(x[i]); i++; } i = x.length - 1; while (right === void 0 && i > 0) { right = xa2.c2p(x[i]); i--; } if (right < left) { temp = right; right = left; left = temp; xrev = true; } i = 0; while (top === void 0 && i < y.length - 1) { top = ya2.c2p(y[i]); i++; } i = y.length - 1; while (bottom === void 0 && i > 0) { bottom = ya2.c2p(y[i]); i--; } if (bottom < top) { temp = top; top = bottom; bottom = temp; yrev = true; } if (isContour) { xc2 = x; yc2 = y; x = cd0.xfill; y = cd0.yfill; } var drawingMethod = "default"; if (zsmooth) { drawingMethod = zsmooth === "best" ? "smooth" : "fast"; } else if (trace._islinear && xGap === 0 && yGap === 0 && supportsPixelatedImage()) { drawingMethod = "fast"; } if (drawingMethod !== "fast") { var extra = zsmooth === "best" ? 0 : 0.5; left = Math.max(-extra * xa2._length, left); right = Math.min((1 + extra) * xa2._length, right); top = Math.max(-extra * ya2._length, top); bottom = Math.min((1 + extra) * ya2._length, bottom); } var imageWidth = Math.round(right - left); var imageHeight = Math.round(bottom - top); var isOffScreen = left >= xa2._length || right <= 0 || top >= ya2._length || bottom <= 0; if (isOffScreen) { var noImage = plotGroup.selectAll("image").data([]); noImage.exit().remove(); removeLabels(plotGroup); return; } var canvasW, canvasH; if (drawingMethod === "fast") { canvasW = n; canvasH = m; } else { canvasW = imageWidth; canvasH = imageHeight; } var canvas = document.createElement("canvas"); canvas.width = canvasW; canvas.height = canvasH; var context = canvas.getContext("2d", { willReadFrequently: true }); var sclFunc = makeColorScaleFuncFromTrace(trace, { noNumericCheck: true, returnArray: true }); var xpx, ypx; if (drawingMethod === "fast") { xpx = xrev ? function(index) { return n - 1 - index; } : Lib.identity; ypx = yrev ? function(index) { return m - 1 - index; } : Lib.identity; } else { xpx = function(index) { return Lib.constrain( Math.round(xa2.c2p(x[index]) - left), 0, imageWidth ); }; ypx = function(index) { return Lib.constrain( Math.round(ya2.c2p(y[index]) - top), 0, imageHeight ); }; } var yi2 = ypx(0); var yb = [yi2, yi2]; var xbi = xrev ? 0 : 1; var ybi = yrev ? 0 : 1; var pixcount = 0; var rcount = 0; var gcount = 0; var bcount = 0; var xb, xi2, v, row, c; function setColor(v2, pixsize) { if (v2 !== void 0) { var c2 = sclFunc(v2); c2[0] = Math.round(c2[0]); c2[1] = Math.round(c2[1]); c2[2] = Math.round(c2[2]); pixcount += pixsize; rcount += c2[0] * pixsize; gcount += c2[1] * pixsize; bcount += c2[2] * pixsize; return c2; } return [0, 0, 0, 0]; } function interpColor(r03, r13, xinterp, yinterp2) { var z00 = r03[xinterp.bin0]; if (z00 === void 0) return setColor(void 0, 1); var z01 = r03[xinterp.bin1]; var z10 = r13[xinterp.bin0]; var z11 = r13[xinterp.bin1]; var dx2 = z01 - z00 || 0; var dy2 = z10 - z00 || 0; var dxy; if (z01 === void 0) { if (z11 === void 0) dxy = 0; else if (z10 === void 0) dxy = 2 * (z11 - z00); else dxy = (2 * z11 - z10 - z00) * 2 / 3; } else if (z11 === void 0) { if (z10 === void 0) dxy = 0; else dxy = (2 * z00 - z01 - z10) * 2 / 3; } else if (z10 === void 0) dxy = (2 * z11 - z01 - z00) * 2 / 3; else dxy = z11 + z00 - z01 - z10; return setColor(z00 + xinterp.frac * dx2 + yinterp2.frac * (dy2 + xinterp.frac * dxy)); } if (drawingMethod !== "default") { var pxIndex = 0; var pixels; try { pixels = new Uint8Array(canvasW * canvasH * 4); } catch (e) { pixels = new Array(canvasW * canvasH * 4); } if (drawingMethod === "smooth") { var xForPx = xc2 || x; var yForPx = yc2 || y; var xPixArray = new Array(xForPx.length); var yPixArray = new Array(yForPx.length); var xinterpArray = new Array(imageWidth); var findInterpX = xc2 ? findInterpFromCenters : findInterp; var findInterpY = yc2 ? findInterpFromCenters : findInterp; var yinterp, r02, r12; for (i = 0; i < xForPx.length; i++) xPixArray[i] = Math.round(xa2.c2p(xForPx[i]) - left); for (i = 0; i < yForPx.length; i++) yPixArray[i] = Math.round(ya2.c2p(yForPx[i]) - top); for (i = 0; i < imageWidth; i++) xinterpArray[i] = findInterpX(i, xPixArray); for (j = 0; j < imageHeight; j++) { yinterp = findInterpY(j, yPixArray); r02 = z[yinterp.bin0]; r12 = z[yinterp.bin1]; for (i = 0; i < imageWidth; i++, pxIndex += 4) { c = interpColor(r02, r12, xinterpArray[i], yinterp); putColor(pixels, pxIndex, c); } } } else { for (j = 0; j < m; j++) { row = z[j]; yb = ypx(j); for (i = 0; i < n; i++) { c = setColor(row[i], 1); pxIndex = (yb * n + xpx(i)) * 4; putColor(pixels, pxIndex, c); } } } var imageData = context.createImageData(canvasW, canvasH); try { imageData.data.set(pixels); } catch (e) { var pxArray = imageData.data; var dlen = pxArray.length; for (j = 0; j < dlen; j++) { pxArray[j] = pixels[j]; } } context.putImageData(imageData, 0, 0); } else { var xGapLeft = Math.floor(xGap / 2); var yGapTop = Math.floor(yGap / 2); for (j = 0; j < m; j++) { row = z[j]; yb.reverse(); yb[ybi] = ypx(j + 1); if (yb[0] === yb[1] || yb[0] === void 0 || yb[1] === void 0) { continue; } xi2 = xpx(0); xb = [xi2, xi2]; for (i = 0; i < n; i++) { xb.reverse(); xb[xbi] = xpx(i + 1); if (xb[0] === xb[1] || xb[0] === void 0 || xb[1] === void 0) { continue; } v = row[i]; c = setColor(v, (xb[1] - xb[0]) * (yb[1] - yb[0])); context.fillStyle = "rgba(" + c.join(",") + ")"; context.fillRect( xb[0] + xGapLeft, yb[0] + yGapTop, xb[1] - xb[0] - xGap, yb[1] - yb[0] - yGap ); } } } rcount = Math.round(rcount / pixcount); gcount = Math.round(gcount / pixcount); bcount = Math.round(bcount / pixcount); var avgColor = tinycolor("rgb(" + rcount + "," + gcount + "," + bcount + ")"); gd2._hmpixcount = (gd2._hmpixcount || 0) + pixcount; gd2._hmlumcount = (gd2._hmlumcount || 0) + pixcount * avgColor.getLuminance(); var image3 = plotGroup.selectAll("image").data(cd2); image3.enter().append("svg:image").attr({ xmlns: xmlnsNamespaces.svg, preserveAspectRatio: "none" }); image3.attr({ height: imageHeight, width: imageWidth, x: left, y: top, "xlink:href": canvas.toDataURL("image/png") }); if (drawingMethod === "fast" && !zsmooth) { image3.attr("style", PIXELATED_IMAGE_STYLE); } removeLabels(plotGroup); var texttemplate = trace.texttemplate; if (texttemplate) { var cOpts = extractOpts(trace); var dummyAx = { type: "linear", range: [cOpts.min, cOpts.max], _separators: xa2._separators, _numFormat: xa2._numFormat }; var aHistogram2dContour = trace.type === "histogram2dcontour"; var aContour = trace.type === "contour"; var iStart = aContour ? 1 : 0; var iStop = aContour ? m - 1 : m; var jStart = aContour ? 1 : 0; var jStop = aContour ? n - 1 : n; var textData = []; for (i = iStart; i < iStop; i++) { var yVal; if (aContour) { yVal = cd0.y[i]; } else if (aHistogram2dContour) { if (i === 0 || i === m - 1) continue; yVal = cd0.y[i]; } else if (cd0.yCenter) { yVal = cd0.yCenter[i]; } else { if (i + 1 === m && cd0.y[i + 1] === void 0) continue; yVal = (cd0.y[i] + cd0.y[i + 1]) / 2; } var _y = Math.round(ya2.c2p(yVal)); if (0 > _y || _y > ya2._length) continue; for (j = jStart; j < jStop; j++) { var xVal; if (aContour) { xVal = cd0.x[j]; } else if (aHistogram2dContour) { if (j === 0 || j === n - 1) continue; xVal = cd0.x[j]; } else if (cd0.xCenter) { xVal = cd0.xCenter[j]; } else { if (j + 1 === n && cd0.x[j + 1] === void 0) continue; xVal = (cd0.x[j] + cd0.x[j + 1]) / 2; } var _x = Math.round(xa2.c2p(xVal)); if (0 > _x || _x > xa2._length) continue; var obj = formatLabels({ x: xVal, y: yVal }, trace, gd2._fullLayout); obj.x = xVal; obj.y = yVal; var zVal = cd0.z[i][j]; if (zVal === void 0) { obj.z = ""; obj.zLabel = ""; } else { obj.z = zVal; obj.zLabel = Axes.tickText(dummyAx, zVal, "hover").text; } var theText = cd0.text && cd0.text[i] && cd0.text[i][j]; if (theText === void 0 || theText === false) theText = ""; obj.text = theText; var _t2 = Lib.texttemplateString(texttemplate, obj, gd2._fullLayout._d3locale, obj, trace._meta || {}); if (!_t2) continue; var lines = _t2.split("
"); var nL = lines.length; var nC = 0; for (k = 0; k < nL; k++) { nC = Math.max(nC, lines[k].length); } textData.push({ l: nL, // number of lines c: nC, // maximum number of chars in a line t: _t2, // text x: _x, y: _y, z: zVal }); } } var font = trace.textfont; var fontSize = font.size; var globalFontSize = gd2._fullLayout.font.size; if (!fontSize || fontSize === "auto") { var minW = Infinity; var minH = Infinity; var maxL = 0; var maxC = 0; for (k = 0; k < textData.length; k++) { var d = textData[k]; maxL = Math.max(maxL, d.l); maxC = Math.max(maxC, d.c); if (k < textData.length - 1) { var nextD = textData[k + 1]; var dx = Math.abs(nextD.x - d.x); var dy = Math.abs(nextD.y - d.y); if (dx) minW = Math.min(minW, dx); if (dy) minH = Math.min(minH, dy); } } if (!isFinite(minW) || !isFinite(minH)) { fontSize = globalFontSize; } else { minW -= xGap; minH -= yGap; minW /= maxC; minH /= maxL; minW /= LINE_SPACING / 2; minH /= LINE_SPACING; fontSize = Math.min( Math.floor(minW), Math.floor(minH), globalFontSize ); } } if (fontSize <= 0 || !isFinite(fontSize)) return; var xFn = function(d2) { return d2.x; }; var yFn = function(d2) { return d2.y - fontSize * (d2.l * LINE_SPACING / 2 - 1); }; var labels = selectLabels(plotGroup).data(textData); labels.enter().append("g").classed(labelClass, 1).append("text").attr("text-anchor", "middle").each(function(d2) { var thisLabel = d3.select(this); var fontColor = font.color; if (!fontColor || fontColor === "auto") { fontColor = Color.contrast( d2.z === void 0 ? gd2._fullLayout.plot_bgcolor : "rgba(" + sclFunc(d2.z).join() + ")" ); } thisLabel.attr("data-notex", 1).call(svgTextUtils.positionText, xFn(d2), yFn(d2)).call(Drawing.font, { family: font.family, size: fontSize, color: fontColor, weight: font.weight, style: font.style, variant: font.variant, textcase: font.textcase, lineposition: font.lineposition, shadow: font.shadow }).text(d2.t).call(svgTextUtils.convertToTspans, gd2); }); } }); }; function findInterp(pixel, pixArray) { var maxBin = pixArray.length - 2; var bin = Lib.constrain(Lib.findBin(pixel, pixArray), 0, maxBin); var pix0 = pixArray[bin]; var pix1 = pixArray[bin + 1]; var interp = Lib.constrain(bin + (pixel - pix0) / (pix1 - pix0) - 0.5, 0, maxBin); var bin0 = Math.round(interp); var frac = Math.abs(interp - bin0); if (!interp || interp === maxBin || !frac) { return { bin0, bin1: bin0, frac: 0 }; } return { bin0, frac, bin1: Math.round(bin0 + frac / (interp - bin0)) }; } function findInterpFromCenters(pixel, centerPixArray) { var maxBin = centerPixArray.length - 1; var bin = Lib.constrain(Lib.findBin(pixel, centerPixArray), 0, maxBin); var pix0 = centerPixArray[bin]; var pix1 = centerPixArray[bin + 1]; var frac = (pixel - pix0) / (pix1 - pix0) || 0; if (frac <= 0) { return { bin0: bin, bin1: bin, frac: 0 }; } if (frac < 0.5) { return { bin0: bin, bin1: bin + 1, frac }; } return { bin0: bin + 1, bin1: bin, frac: 1 - frac }; } function putColor(pixels, pxIndex, c) { pixels[pxIndex] = c[0]; pixels[pxIndex + 1] = c[1]; pixels[pxIndex + 2] = c[2]; pixels[pxIndex + 3] = Math.round(c[3] * 255); } } }); // node_modules/plotly.js/src/traces/heatmap/colorbar.js var require_colorbar2 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/colorbar.js"(exports2, module2) { "use strict"; module2.exports = { min: "zmin", max: "zmax" }; } }); // node_modules/plotly.js/src/traces/heatmap/style.js var require_style5 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/style.js"(exports2, module2) { "use strict"; var d3 = require_d3(); module2.exports = function style(gd2) { d3.select(gd2).selectAll(".hm image").style("opacity", function(d) { return d.trace.opacity; }); }; } }); // node_modules/plotly.js/src/traces/heatmap/hover.js var require_hover4 = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/hover.js"(exports2, module2) { "use strict"; var Fx = require_fx(); var Lib = require_lib(); var isArrayOrTypedArray = Lib.isArrayOrTypedArray; var Axes = require_axes(); var extractOpts = require_colorscale().extractOpts; module2.exports = function hoverPoints(pointData, xval, yval, hovermode, opts) { if (!opts) opts = {}; var isContour = opts.isContour; var cd0 = pointData.cd[0]; var trace = cd0.trace; var xa2 = pointData.xa; var ya2 = pointData.ya; var x = cd0.x; var y = cd0.y; var z = cd0.z; var xc2 = cd0.xCenter; var yc2 = cd0.yCenter; var zmask = cd0.zmask; var zhoverformat = trace.zhoverformat; var x2 = x; var y2 = y; var xl, yl, nx, ny; if (pointData.index !== false) { try { nx = Math.round(pointData.index[1]); ny = Math.round(pointData.index[0]); } catch (e) { Lib.error("Error hovering on heatmap, pointNumber must be [row,col], found:", pointData.index); return; } if (nx < 0 || nx >= z[0].length || ny < 0 || ny > z.length) { return; } } else if (Fx.inbox(xval - x[0], xval - x[x.length - 1], 0) > 0 || Fx.inbox(yval - y[0], yval - y[y.length - 1], 0) > 0) { return; } else { if (isContour) { var i2; x2 = [2 * x[0] - x[1]]; for (i2 = 1; i2 < x.length; i2++) { x2.push((x[i2] + x[i2 - 1]) / 2); } x2.push([2 * x[x.length - 1] - x[x.length - 2]]); y2 = [2 * y[0] - y[1]]; for (i2 = 1; i2 < y.length; i2++) { y2.push((y[i2] + y[i2 - 1]) / 2); } y2.push([2 * y[y.length - 1] - y[y.length - 2]]); } nx = Math.max(0, Math.min(x2.length - 2, Lib.findBin(xval, x2))); ny = Math.max(0, Math.min(y2.length - 2, Lib.findBin(yval, y2))); } var x02 = xa2.c2p(x[nx]); var x12 = xa2.c2p(x[nx + 1]); var y02 = ya2.c2p(y[ny]); var y12 = ya2.c2p(y[ny + 1]); var _x, _y; if (isContour) { _x = cd0.orig_x || x; _y = cd0.orig_y || y; x12 = x02; xl = _x[nx]; y12 = y02; yl = _y[ny]; } else { _x = cd0.orig_x || xc2 || x; _y = cd0.orig_y || yc2 || y; xl = xc2 ? _x[nx] : (_x[nx] + _x[nx + 1]) / 2; yl = yc2 ? _y[ny] : (_y[ny] + _y[ny + 1]) / 2; if (xa2 && xa2.type === "category") xl = x[nx]; if (ya2 && ya2.type === "category") yl = y[ny]; if (trace.zsmooth) { x02 = x12 = xa2.c2p(xl); y02 = y12 = ya2.c2p(yl); } } var zVal = z[ny][nx]; if (zmask && !zmask[ny][nx]) zVal = void 0; if (zVal === void 0 && !trace.hoverongaps) return; var text; if (isArrayOrTypedArray(cd0.hovertext) && isArrayOrTypedArray(cd0.hovertext[ny])) { text = cd0.hovertext[ny][nx]; } else if (isArrayOrTypedArray(cd0.text) && isArrayOrTypedArray(cd0.text[ny])) { text = cd0.text[ny][nx]; } var cOpts = extractOpts(trace); var dummyAx = { type: "linear", range: [cOpts.min, cOpts.max], hoverformat: zhoverformat, _separators: xa2._separators, _numFormat: xa2._numFormat }; var zLabel = Axes.tickText(dummyAx, zVal, "hover").text; return [Lib.extendFlat(pointData, { index: trace._after2before ? trace._after2before[ny][nx] : [ny, nx], // never let a 2D override 1D type as closest point distance: pointData.maxHoverDistance, spikeDistance: pointData.maxSpikeDistance, x0: x02, x1: x12, y0: y02, y1: y12, xLabelVal: xl, yLabelVal: yl, zLabelVal: zVal, zLabel, text })]; }; } }); // node_modules/plotly.js/src/traces/heatmap/index.js var require_heatmap = __commonJS({ "node_modules/plotly.js/src/traces/heatmap/index.js"(exports2, module2) { "use strict"; module2.exports = { attributes: require_attributes24(), supplyDefaults: require_defaults20(), calc: require_calc8(), plot: require_plot4(), colorbar: require_colorbar2(), style: require_style5(), hoverPoints: require_hover4(), moduleType: "trace", name: "heatmap", basePlotModule: require_cartesian(), categories: ["cartesian", "svg", "2dMap", "showLegend"], meta: { description: [ "The data that describes the heatmap value-to-color mapping", "is set in `z`.", "Data in `z` can either be a {2D array} of values (ragged or not)", "or a 1D array of values.", "In the case where `z` is a {2D array},", "say that `z` has N rows and M columns.", "Then, by default, the resulting heatmap will have N partitions along", "the y axis and M partitions along the x axis.", "In other words, the i-th row/ j-th column cell in `z`", "is mapped to the i-th partition of the y axis", "(starting from the bottom of the plot) and the j-th partition", "of the x-axis (starting from the left of the plot).", "This behavior can be flipped by using `transpose`.", "Moreover, `x` (`y`) can be provided with M or M+1 (N or N+1) elements.", "If M (N), then the coordinates correspond to the center of the", "heatmap cells and the cells have equal width.", "If M+1 (N+1), then the coordinates correspond to the edges of the", "heatmap cells.", "In the case where `z` is a 1D {array}, the x and y coordinates must be", "provided in `x` and `y` respectively to form data triplets." ].join(" ") } }; } }); // node_modules/plotly.js/lib/heatmap.js var require_heatmap2 = __commonJS({ "node_modules/plotly.js/lib/heatmap.js"(exports2, module2) { "use strict"; module2.exports = require_heatmap(); } }); // node_modules/papaparse/papaparse.min.js var require_papaparse_min = __commonJS({ "node_modules/papaparse/papaparse.min.js"(exports2, module2) { ((e, t) => { "function" == typeof define && define.amd ? define([], t) : "object" == typeof module2 && "undefined" != typeof exports2 ? module2.exports = t() : e.Papa = t(); })(exports2, function r() { var n = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n ? n : {}; var d, s = !n.document && !!n.postMessage, a = n.IS_PAPA_WORKER || false, o = {}, h = 0, v = {}; function u(e) { this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, (function(e2) { var t = b(e2); t.chunkSize = parseInt(t.chunkSize), e2.step || e2.chunk || (t.chunkSize = null); this._handle = new i(t), (this._handle.streamer = this)._config = t; }).call(this, e), this.parseChunk = function(t, e2) { var i2 = parseInt(this._config.skipFirstNLines) || 0; if (this.isFirstChunk && 0 < i2) { let e3 = this._config.newline; e3 || (r2 = this._config.quoteChar || '"', e3 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e3).slice(i2)].join(e3); } this.isFirstChunk && U(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false; var i2 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i2, this._baseIndex, !this._finished)); if (!this._handle.paused() && !this._handle.aborted()) { t = r2.meta.cursor, i2 = (this._finished || (this._partialLine = i2.substring(t - this._baseIndex), this._baseIndex = t), r2 && r2.data && (this._rowCount += r2.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview); if (a) n.postMessage({ results: r2, workerId: v.WORKER_ID, finished: i2 }); else if (U(this._config.chunk) && !e2) { if (this._config.chunk(r2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true); this._completeResults = r2 = void 0; } return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i2 || !U(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i2 || r2 && r2.meta.paused || this._nextChunk(), r2; } this._halted = true; }, this._sendError = function(e2) { U(this._config.error) ? this._config.error(e2) : a && this._config.error && n.postMessage({ workerId: v.WORKER_ID, error: e2, finished: false }); }; } function f(e) { var r2; (e = e || {}).chunkSize || (e.chunkSize = v.RemoteChunkSize), u.call(this, e), this._nextChunk = s ? function() { this._readChunk(), this._chunkLoaded(); } : function() { this._readChunk(); }, this.stream = function(e2) { this._input = e2, this._nextChunk(); }, this._readChunk = function() { if (this._finished) this._chunkLoaded(); else { if (r2 = new XMLHttpRequest(), this._config.withCredentials && (r2.withCredentials = this._config.withCredentials), s || (r2.onload = y(this._chunkLoaded, this), r2.onerror = y(this._chunkError, this)), r2.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s), this._config.downloadRequestHeaders) { var e2, t = this._config.downloadRequestHeaders; for (e2 in t) r2.setRequestHeader(e2, t[e2]); } var i2; this._config.chunkSize && (i2 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i2)); try { r2.send(this._config.downloadRequestBody); } catch (e3) { this._chunkError(e3.message); } s && 0 === r2.status && this._chunkError(); } }, this._chunkLoaded = function() { 4 === r2.readyState && (r2.status < 200 || 400 <= r2.status ? this._chunkError() : (this._start += this._config.chunkSize || r2.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e2) => null !== (e2 = e2.getResponseHeader("Content-Range")) ? parseInt(e2.substring(e2.lastIndexOf("/") + 1)) : -1)(r2), this.parseChunk(r2.responseText))); }, this._chunkError = function(e2) { e2 = r2.statusText || e2; this._sendError(new Error(e2)); }; } function l(e) { (e = e || {}).chunkSize || (e.chunkSize = v.LocalChunkSize), u.call(this, e); var i2, r2, n2 = "undefined" != typeof FileReader; this.stream = function(e2) { this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i2 = new FileReader()).onload = y(this._chunkLoaded, this), i2.onerror = y(this._chunkError, this)) : i2 = new FileReaderSync(), this._nextChunk(); }, this._nextChunk = function() { this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk(); }, this._readChunk = function() { var e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i2.readAsText(e2, this._config.encoding)); n2 || this._chunkLoaded({ target: { result: t } }); }, this._chunkLoaded = function(e2) { this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result); }, this._chunkError = function() { this._sendError(i2.error); }; } function c(e) { var i2; u.call(this, e = e || {}), this.stream = function(e2) { return i2 = e2, this._nextChunk(); }, this._nextChunk = function() { var e2, t; if (!this._finished) return e2 = this._config.chunkSize, i2 = e2 ? (t = i2.substring(0, e2), i2.substring(e2)) : (t = i2, ""), this._finished = !i2, this.parseChunk(t); }; } function p(e) { u.call(this, e = e || {}); var t = [], i2 = true, r2 = false; this.pause = function() { u.prototype.pause.apply(this, arguments), this._input.pause(); }, this.resume = function() { u.prototype.resume.apply(this, arguments), this._input.resume(); }, this.stream = function(e2) { this._input = e2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError); }, this._checkIsFinished = function() { r2 && 1 === t.length && (this._finished = true); }, this._nextChunk = function() { this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i2 = true; }, this._streamData = y(function(e2) { try { t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i2 && (i2 = false, this._checkIsFinished(), this.parseChunk(t.shift())); } catch (e3) { this._streamError(e3); } }, this), this._streamError = y(function(e2) { this._streamCleanUp(), this._sendError(e2); }, this), this._streamEnd = y(function() { this._streamCleanUp(), r2 = true, this._streamData(""); }, this), this._streamCleanUp = y(function() { this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError); }, this); } function i(m2) { var n2, s2, a2, t, o2 = Math.pow(2, 53), h2 = -o2, u2 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i2 = this, r2 = 0, f2 = 0, l2 = false, e = false, c2 = [], p2 = { data: [], errors: [], meta: {} }; function y2(e2) { return "greedy" === m2.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length; } function g2() { if (p2 && a2 && (k("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v.DefaultDelimiter + "'"), a2 = false), m2.skipEmptyLines && (p2.data = p2.data.filter(function(e3) { return !y2(e3); })), _2()) { let t3 = function(e3, t4) { U(m2.transformHeader) && (e3 = m2.transformHeader(e3, t4)), c2.push(e3); }; var t2 = t3; if (p2) if (Array.isArray(p2.data[0])) { for (var e2 = 0; _2() && e2 < p2.data.length; e2++) p2.data[e2].forEach(t3); p2.data.splice(0, 1); } else p2.data.forEach(t3); } function i3(e3, t3) { for (var i4 = m2.header ? {} : [], r4 = 0; r4 < e3.length; r4++) { var n3 = r4, s3 = e3[r4], s3 = ((e4, t4) => ((e5) => (m2.dynamicTypingFunction && void 0 === m2.dynamicTyping[e5] && (m2.dynamicTyping[e5] = m2.dynamicTypingFunction(e5)), true === (m2.dynamicTyping[e5] || m2.dynamicTyping)))(e4) ? "true" === t4 || "TRUE" === t4 || "false" !== t4 && "FALSE" !== t4 && (((e5) => { if (u2.test(e5)) { e5 = parseFloat(e5); if (h2 < e5 && e5 < o2) return 1; } })(t4) ? parseFloat(t4) : d2.test(t4) ? new Date(t4) : "" === t4 ? null : t4) : t4)(n3 = m2.header ? r4 >= c2.length ? "__parsed_extra" : c2[r4] : n3, s3 = m2.transform ? m2.transform(s3, n3) : s3); "__parsed_extra" === n3 ? (i4[n3] = i4[n3] || [], i4[n3].push(s3)) : i4[n3] = s3; } return m2.header && (r4 > c2.length ? k("FieldMismatch", "TooManyFields", "Too many fields: expected " + c2.length + " fields but parsed " + r4, f2 + t3) : r4 < c2.length && k("FieldMismatch", "TooFewFields", "Too few fields: expected " + c2.length + " fields but parsed " + r4, f2 + t3)), i4; } var r3; p2 && (m2.header || m2.dynamicTyping || m2.transform) && (r3 = 1, !p2.data.length || Array.isArray(p2.data[0]) ? (p2.data = p2.data.map(i3), r3 = p2.data.length) : p2.data = i3(p2.data, 0), m2.header && p2.meta && (p2.meta.fields = c2), f2 += r3); } function _2() { return m2.header && 0 === c2.length; } function k(e2, t2, i3, r3) { e2 = { type: e2, code: t2, message: i3 }; void 0 !== r3 && (e2.row = r3), p2.errors.push(e2); } U(m2.step) && (t = m2.step, m2.step = function(e2) { p2 = e2, _2() ? g2() : (g2(), 0 !== p2.data.length && (r2 += e2.data.length, m2.preview && r2 > m2.preview ? s2.abort() : (p2.data = p2.data[0], t(p2, i2)))); }), this.parse = function(e2, t2, i3) { var r3 = m2.quoteChar || '"', r3 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r3)), a2 = false, m2.delimiter ? U(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p2.meta.delimiter = m2.delimiter) : ((r3 = ((e3, t3, i4, r4, n3) => { var s3, a3, o3, h3; n3 = n3 || [",", " ", "|", ";", v.RECORD_SEP, v.UNIT_SEP]; for (var u3 = 0; u3 < n3.length; u3++) { for (var d3, f3 = n3[u3], l3 = 0, c3 = 0, p3 = 0, g3 = (o3 = void 0, new E({ comments: r4, delimiter: f3, newline: t3, preview: 10 }).parse(e3)), _3 = 0; _3 < g3.data.length; _3++) i4 && y2(g3.data[_3]) ? p3++ : (d3 = g3.data[_3].length, c3 += d3, void 0 === o3 ? o3 = d3 : 0 < d3 && (l3 += Math.abs(d3 - o3), o3 = d3)); 0 < g3.data.length && (c3 /= g3.data.length - p3), (void 0 === a3 || l3 <= a3) && (void 0 === h3 || h3 < c3) && 1.99 < c3 && (a3 = l3, s3 = f3, h3 = c3); } return { successful: !!(m2.delimiter = s3), bestDelimiter: s3 }; })(e2, m2.newline, m2.skipEmptyLines, m2.comments, m2.delimitersToGuess)).successful ? m2.delimiter = r3.bestDelimiter : (a2 = true, m2.delimiter = v.DefaultDelimiter), p2.meta.delimiter = m2.delimiter), b(m2)); return m2.preview && m2.header && r3.preview++, n2 = e2, s2 = new E(r3), p2 = s2.parse(n2, t2, i3), g2(), l2 ? { meta: { paused: true } } : p2 || { meta: { paused: false } }; }, this.paused = function() { return l2; }, this.pause = function() { l2 = true, s2.abort(), n2 = U(m2.chunk) ? "" : n2.substring(s2.getCharIndex()); }, this.resume = function() { i2.streamer._halted ? (l2 = false, i2.streamer.parseChunk(n2, true)) : setTimeout(i2.resume, 3); }, this.aborted = function() { return e; }, this.abort = function() { e = true, s2.abort(), p2.meta.aborted = true, U(m2.complete) && m2.complete(p2), n2 = ""; }, this.guessLineEndings = function(e2, t2) { e2 = e2.substring(0, 1048576); var t2 = new RegExp(P(t2) + "([^]*?)" + P(t2), "gm"), i3 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i3[0].length; if (1 === i3.length || e2) return "\n"; for (var r3 = 0, n3 = 0; n3 < i3.length; n3++) "\n" === i3[n3][0] && r3++; return r3 >= i3.length / 2 ? "\r\n" : "\r"; }; } function P(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function E(C) { var S = (C = C || {}).delimiter, O = C.newline, x = C.comments, I = C.step, A = C.preview, T = C.fastMode, D2 = null, L = false, F = null == C.quoteChar ? '"' : C.quoteChar, j = F; if (void 0 !== C.escapeChar && (j = C.escapeChar), ("string" != typeof S || -1 < v.BAD_DELIMITERS.indexOf(S)) && (S = ","), x === S) throw new Error("Comment character same as delimiter"); true === x ? x = "#" : ("string" != typeof x || -1 < v.BAD_DELIMITERS.indexOf(x)) && (x = false), "\n" !== O && "\r" !== O && "\r\n" !== O && (O = "\n"); var z = 0, M = false; this.parse = function(i2, t, r2) { if ("string" != typeof i2) throw new Error("Input must be a string"); var n2 = i2.length, e = S.length, s2 = O.length, a2 = x.length, o2 = U(I), h2 = [], u2 = [], d2 = [], f2 = z = 0; if (!i2) return w(); if (T || false !== T && -1 === i2.indexOf(F)) { for (var l2 = i2.split(O), c2 = 0; c2 < l2.length; c2++) { if (d2 = l2[c2], z += d2.length, c2 !== l2.length - 1) z += O.length; else if (r2) return w(); if (!x || d2.substring(0, a2) !== x) { if (o2) { if (h2 = [], k(d2.split(S)), R(), M) return w(); } else k(d2.split(S)); if (A && A <= c2) return h2 = h2.slice(0, A), w(true); } } return w(); } for (var p2 = i2.indexOf(S, z), g2 = i2.indexOf(O, z), _2 = new RegExp(P(j) + P(F), "g"), m2 = i2.indexOf(F, z); ; ) if (i2[z] === F) for (m2 = z, z++; ; ) { if (-1 === (m2 = i2.indexOf(F, m2 + 1))) return r2 || u2.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h2.length, index: z }), E2(); if (m2 === n2 - 1) return E2(i2.substring(z, m2).replace(_2, F)); if (F === j && i2[m2 + 1] === j) m2++; else if (F === j || 0 === m2 || i2[m2 - 1] !== j) { -1 !== p2 && p2 < m2 + 1 && (p2 = i2.indexOf(S, m2 + 1)); var y2 = v2(-1 === (g2 = -1 !== g2 && g2 < m2 + 1 ? i2.indexOf(O, m2 + 1) : g2) ? p2 : Math.min(p2, g2)); if (i2.substr(m2 + 1 + y2, e) === S) { d2.push(i2.substring(z, m2).replace(_2, F)), i2[z = m2 + 1 + y2 + e] !== F && (m2 = i2.indexOf(F, z)), p2 = i2.indexOf(S, z), g2 = i2.indexOf(O, z); break; } y2 = v2(g2); if (i2.substring(m2 + 1 + y2, m2 + 1 + y2 + s2) === O) { if (d2.push(i2.substring(z, m2).replace(_2, F)), b2(m2 + 1 + y2 + s2), p2 = i2.indexOf(S, z), m2 = i2.indexOf(F, z), o2 && (R(), M)) return w(); if (A && h2.length >= A) return w(true); break; } u2.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h2.length, index: z }), m2++; } } else if (x && 0 === d2.length && i2.substring(z, z + a2) === x) { if (-1 === g2) return w(); z = g2 + s2, g2 = i2.indexOf(O, z), p2 = i2.indexOf(S, z); } else if (-1 !== p2 && (p2 < g2 || -1 === g2)) d2.push(i2.substring(z, p2)), z = p2 + e, p2 = i2.indexOf(S, z); else { if (-1 === g2) break; if (d2.push(i2.substring(z, g2)), b2(g2 + s2), o2 && (R(), M)) return w(); if (A && h2.length >= A) return w(true); } return E2(); function k(e2) { h2.push(e2), f2 = z; } function v2(e2) { var t2 = 0; return t2 = -1 !== e2 && (e2 = i2.substring(m2 + 1, e2)) && "" === e2.trim() ? e2.length : t2; } function E2(e2) { return r2 || (void 0 === e2 && (e2 = i2.substring(z)), d2.push(e2), z = n2, k(d2), o2 && R()), w(); } function b2(e2) { z = e2, k(d2), d2 = [], g2 = i2.indexOf(O, z); } function w(e2) { if (C.header && !t && h2.length && !L) { var s3 = h2[0], a3 = /* @__PURE__ */ Object.create(null), o3 = new Set(s3); let n3 = false; for (let r3 = 0; r3 < s3.length; r3++) { let i3 = s3[r3]; if (a3[i3 = U(C.transformHeader) ? C.transformHeader(i3, r3) : i3]) { let e3, t2 = a3[i3]; for (; e3 = i3 + "_" + t2, t2++, o3.has(e3); ) ; o3.add(e3), s3[r3] = e3, a3[i3]++, n3 = true, (D2 = null === D2 ? {} : D2)[e3] = i3; } else a3[i3] = 1, s3[r3] = i3; o3.add(i3); } n3 && console.warn("Duplicate headers found and renamed."), L = true; } return { data: h2, errors: u2, meta: { delimiter: S, linebreak: O, aborted: M, truncated: !!e2, cursor: f2 + (t || 0), renamedHeaders: D2 } }; } function R() { I(w()), h2 = [], u2 = []; } }, this.abort = function() { M = true; }, this.getCharIndex = function() { return z; }; } function g(e) { var t = e.data, i2 = o[t.workerId], r2 = false; if (t.error) i2.userError(t.error, t.file); else if (t.results && t.results.data) { var n2 = { abort: function() { r2 = true, _(t.workerId, { data: [], errors: [], meta: { aborted: true } }); }, pause: m, resume: m }; if (U(i2.userStep)) { for (var s2 = 0; s2 < t.results.data.length && (i2.userStep({ data: t.results.data[s2], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s2++) ; delete t.results; } else U(i2.userChunk) && (i2.userChunk(t.results, n2, t.file), delete t.results); } t.finished && !r2 && _(t.workerId, t.results); } function _(e, t) { var i2 = o[e]; U(i2.userComplete) && i2.userComplete(t), i2.terminate(), delete o[e]; } function m() { throw new Error("Not implemented."); } function b(e) { if ("object" != typeof e || null === e) return e; var t, i2 = Array.isArray(e) ? [] : {}; for (t in e) i2[t] = b(e[t]); return i2; } function y(e, t) { return function() { e.apply(t, arguments); }; } function U(e) { return "function" == typeof e; } return v.parse = function(e, t) { var i2 = (t = t || {}).dynamicTyping || false; U(i2) && (t.dynamicTypingFunction = i2, i2 = {}); if (t.dynamicTyping = i2, t.transform = !!U(t.transform) && t.transform, !t.worker || !v.WORKERS_SUPPORTED) return i2 = null, v.NODE_STREAM_INPUT, "string" == typeof e ? (e = ((e2) => 65279 !== e2.charCodeAt(0) ? e2 : e2.slice(1))(e), i2 = new (t.download ? f : c)(t)) : true === e.readable && U(e.read) && U(e.on) ? i2 = new p(t) : (n.File && e instanceof File || e instanceof Object) && (i2 = new l(t)), i2.stream(e); (i2 = (() => { var e2; return !!v.WORKERS_SUPPORTED && (e2 = (() => { var e3 = n.URL || n.webkitURL || null, t2 = r.toString(); return v.BLOB_URL || (v.BLOB_URL = e3.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t2, ")();"], { type: "text/javascript" }))); })(), (e2 = new n.Worker(e2)).onmessage = g, e2.id = h++, o[e2.id] = e2); })()).userStep = t.step, i2.userChunk = t.chunk, i2.userComplete = t.complete, i2.userError = t.error, t.step = U(t.step), t.chunk = U(t.chunk), t.complete = U(t.complete), t.error = U(t.error), delete t.worker, i2.postMessage({ input: e, config: t, workerId: i2.id }); }, v.unparse = function(e, t) { var n2 = false, _2 = true, m2 = ",", y2 = "\r\n", s2 = '"', a2 = s2 + s2, i2 = false, r2 = null, o2 = false, h2 = ((() => { if ("object" == typeof t) { if ("string" != typeof t.delimiter || v.BAD_DELIMITERS.filter(function(e2) { return -1 !== t.delimiter.indexOf(e2); }).length || (m2 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (n2 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i2 = t.skipEmptyLines), "string" == typeof t.newline && (y2 = t.newline), "string" == typeof t.quoteChar && (s2 = t.quoteChar), "boolean" == typeof t.header && (_2 = t.header), Array.isArray(t.columns)) { if (0 === t.columns.length) throw new Error("Option columns is empty"); r2 = t.columns; } void 0 !== t.escapeChar && (a2 = t.escapeChar + s2), t.escapeFormulae instanceof RegExp ? o2 = t.escapeFormulae : "boolean" == typeof t.escapeFormulae && t.escapeFormulae && (o2 = /^[=+\-@\t\r].*$/); } })(), new RegExp(P(s2), "g")); "string" == typeof e && (e = JSON.parse(e)); if (Array.isArray(e)) { if (!e.length || Array.isArray(e[0])) return u2(null, e, i2); if ("object" == typeof e[0]) return u2(r2 || Object.keys(e[0]), e, i2); } else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), u2(e.fields || [], e.data || [], i2); throw new Error("Unable to serialize unrecognized input"); function u2(e2, t2, i3) { var r3 = "", n3 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s3 = !Array.isArray(t2[0]); if (n3 && _2) { for (var a3 = 0; a3 < e2.length; a3++) 0 < a3 && (r3 += m2), r3 += k(e2[a3], a3); 0 < t2.length && (r3 += y2); } for (var o3 = 0; o3 < t2.length; o3++) { var h3 = (n3 ? e2 : t2[o3]).length, u3 = false, d2 = n3 ? 0 === Object.keys(t2[o3]).length : 0 === t2[o3].length; if (i3 && !n3 && (u3 = "greedy" === i3 ? "" === t2[o3].join("").trim() : 1 === t2[o3].length && 0 === t2[o3][0].length), "greedy" === i3 && n3) { for (var f2 = [], l2 = 0; l2 < h3; l2++) { var c2 = s3 ? e2[l2] : l2; f2.push(t2[o3][c2]); } u3 = "" === f2.join("").trim(); } if (!u3) { for (var p2 = 0; p2 < h3; p2++) { 0 < p2 && !d2 && (r3 += m2); var g2 = n3 && s3 ? e2[p2] : p2; r3 += k(t2[o3][g2], p2); } o3 < t2.length - 1 && (!i3 || 0 < h3 && !d2) && (r3 += y2); } } return r3; } function k(e2, t2) { var i3, r3; return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (r3 = false, o2 && "string" == typeof e2 && o2.test(e2) && (e2 = "'" + e2, r3 = true), i3 = e2.toString().replace(h2, a2), (r3 = r3 || true === n2 || "function" == typeof n2 && n2(e2, t2) || Array.isArray(n2) && n2[t2] || ((e3, t3) => { for (var i4 = 0; i4 < t3.length; i4++) if (-1 < e3.indexOf(t3[i4])) return true; return false; })(i3, v.BAD_DELIMITERS) || -1 < i3.indexOf(m2) || " " === i3.charAt(0) || " " === i3.charAt(i3.length - 1)) ? s2 + i3 + s2 : i3); } }, v.RECORD_SEP = String.fromCharCode(30), v.UNIT_SEP = String.fromCharCode(31), v.BYTE_ORDER_MARK = "\uFEFF", v.BAD_DELIMITERS = ["\r", "\n", '"', v.BYTE_ORDER_MARK], v.WORKERS_SUPPORTED = !s && !!n.Worker, v.NODE_STREAM_INPUT = 1, v.LocalChunkSize = 10485760, v.RemoteChunkSize = 5242880, v.DefaultDelimiter = ",", v.Parser = E, v.ParserHandle = i, v.NetworkStreamer = f, v.FileStreamer = l, v.StringStreamer = c, v.ReadableStreamStreamer = p, n.jQuery && ((d = n.jQuery).fn.parse = function(o2) { var i2 = o2.config || {}, h2 = []; return this.each(function(e2) { if (!("INPUT" === d(this).prop("tagName").toUpperCase() && "file" === d(this).attr("type").toLowerCase() && n.FileReader) || !this.files || 0 === this.files.length) return true; for (var t = 0; t < this.files.length; t++) h2.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i2) }); }), e(), this; function e() { if (0 === h2.length) U(o2.complete) && o2.complete(); else { var e2, t, i3, r2, n2 = h2[0]; if (U(o2.before)) { var s2 = o2.before(n2.file, n2.inputElem); if ("object" == typeof s2) { if ("abort" === s2.action) return e2 = "AbortError", t = n2.file, i3 = n2.inputElem, r2 = s2.reason, void (U(o2.error) && o2.error({ name: e2 }, t, i3, r2)); if ("skip" === s2.action) return void u2(); "object" == typeof s2.config && (n2.instanceConfig = d.extend(n2.instanceConfig, s2.config)); } else if ("skip" === s2) return void u2(); } var a2 = n2.instanceConfig.complete; n2.instanceConfig.complete = function(e3) { U(a2) && a2(e3, n2.file, n2.inputElem), u2(); }, v.parse(n2.file, n2.instanceConfig); } } function u2() { h2.splice(0, 1), e(); } }), a && (n.onmessage = function(e) { e = e.data; void 0 === v.WORKER_ID && e && (v.WORKER_ID = e.workerId); "string" == typeof e.input ? n.postMessage({ workerId: v.WORKER_ID, results: v.parse(e.input, e.config), finished: true }) : (n.File && e.input instanceof File || e.input instanceof Object) && (e = v.parse(e.input, e.config)) && n.postMessage({ workerId: v.WORKER_ID, results: e, finished: true }); }), (f.prototype = Object.create(u.prototype)).constructor = f, (l.prototype = Object.create(u.prototype)).constructor = l, (c.prototype = Object.create(c.prototype)).constructor = c, (p.prototype = Object.create(u.prototype)).constructor = p, v; }); } }); // node_modules/@abi-software/plotvuer/dist/plotvuer.js var import_core = __toESM(require_core2()); var import_scatter = __toESM(require_scatter2()); var import_bar = __toESM(require_bar2()); var import_heatmap = __toESM(require_heatmap2()); var import_papaparse = __toESM(require_papaparse_min()); function Rl(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var as = { exports: {} }; var ne = as.exports = {}; var Pe; var Le; function zo() { throw new Error("setTimeout has not been defined"); } function Ho() { throw new Error("clearTimeout has not been defined"); } (function() { try { typeof setTimeout == "function" ? Pe = setTimeout : Pe = zo; } catch { Pe = zo; } try { typeof clearTimeout == "function" ? Le = clearTimeout : Le = Ho; } catch { Le = Ho; } })(); function ss(e) { if (Pe === setTimeout) return setTimeout(e, 0); if ((Pe === zo || !Pe) && setTimeout) return Pe = setTimeout, setTimeout(e, 0); try { return Pe(e, 0); } catch { try { return Pe.call(null, e, 0); } catch { return Pe.call(this, e, 0); } } } function Nl(e) { if (Le === clearTimeout) return clearTimeout(e); if ((Le === Ho || !Le) && clearTimeout) return Le = clearTimeout, clearTimeout(e); try { return Le(e); } catch { try { return Le.call(null, e); } catch { return Le.call(this, e); } } } var Xe = []; var Wt = false; var Ot; var Yn = -1; function Bl() { !Wt || !Ot || (Wt = false, Ot.length ? Xe = Ot.concat(Xe) : Yn = -1, Xe.length && is()); } function is() { if (!Wt) { var e = ss(Bl); Wt = true; for (var t = Xe.length; t; ) { for (Ot = Xe, Xe = []; ++Yn < t; ) Ot && Ot[Yn].run(); Yn = -1, t = Xe.length; } Ot = null, Wt = false, Nl(e); } } ne.nextTick = function(e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; Xe.push(new ls(e, t)), Xe.length === 1 && !Wt && ss(is); }; function ls(e, t) { this.fun = e, this.array = t; } ls.prototype.run = function() { this.fun.apply(null, this.array); }; ne.title = "browser"; ne.browser = true; ne.env = {}; ne.argv = []; ne.version = ""; ne.versions = {}; function at() { } ne.on = at; ne.addListener = at; ne.once = at; ne.off = at; ne.removeListener = at; ne.removeAllListeners = at; ne.emit = at; ne.prependListener = at; ne.prependOnceListener = at; ne.listeners = function(e) { return []; }; ne.binding = function(e) { throw new Error("process.binding is not supported"); }; ne.cwd = function() { return "/"; }; ne.chdir = function(e) { throw new Error("process.chdir is not supported"); }; ne.umask = function() { return 0; }; var Dl = as.exports; var Pt = Rl(Dl); var Ze = (e, t, { checkForDefaultPrevented: n = true } = {}) => (r) => { const a = e == null ? void 0 : e(r); if (n === false || !a) return t == null ? void 0 : t(r); }; var Gt = globalThis || void 0 || self; var Ur; var se = typeof window < "u"; var zl = (e) => typeof e == "string"; var us = () => { }; var Vo = se && ((Ur = window == null ? void 0 : window.navigator) == null ? void 0 : Ur.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function cs(e) { return typeof e == "function" ? e() : unref(e); } function Hl(e) { return e; } function ao(e) { return getCurrentScope() ? (onScopeDispose(e), true) : false; } function Vl(e, t = true) { getCurrentInstance() ? onMounted(e) : t ? e() : nextTick(e); } function Qe(e) { var t; const n = cs(e); return (t = n == null ? void 0 : n.$el) != null ? t : n; } var so = se ? window : void 0; function Te(...e) { let t, n, o, r; if (zl(e[0]) || Array.isArray(e[0]) ? ([n, o, r] = e, t = so) : [t, n, o, r] = e, !t) return us; Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]); const a = [], s = () => { a.forEach((c) => c()), a.length = 0; }, i = (c, d, v, g) => (c.addEventListener(d, v, g), () => c.removeEventListener(d, v, g)), l = watch(() => [Qe(t), cs(r)], ([c, d]) => { s(), c && a.push(...n.flatMap((v) => o.map((g) => i(c, v, g, d)))); }, { immediate: true, flush: "post" }), u = () => { l(), s(); }; return ao(u), u; } var Kr = false; function jl(e, t, n = {}) { const { window: o = so, ignore: r = [], capture: a = true, detectIframe: s = false } = n; if (!o) return; Vo && !Kr && (Kr = true, Array.from(o.document.body.children).forEach((v) => v.addEventListener("click", us))); let i = true; const l = (v) => r.some((g) => { if (typeof g == "string") return Array.from(o.document.querySelectorAll(g)).some((f) => f === v.target || v.composedPath().includes(f)); { const f = Qe(g); return f && (v.target === f || v.composedPath().includes(f)); } }), c = [ Te(o, "click", (v) => { const g = Qe(e); if (!(!g || g === v.target || v.composedPath().includes(g))) { if (v.detail === 0 && (i = !l(v)), !i) { i = true; return; } t(v); } }, { passive: true, capture: a }), Te(o, "pointerdown", (v) => { const g = Qe(e); g && (i = !v.composedPath().includes(g) && !l(v)); }, { passive: true }), s && Te(o, "blur", (v) => { var g; const f = Qe(e); ((g = o.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !(f != null && f.contains(o.document.activeElement)) && t(v); }) ].filter(Boolean); return () => c.forEach((v) => v()); } function ds(e, t = false) { const n = ref(), o = () => n.value = !!e(); return o(), Vl(o, t), n; } var jo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof Gt < "u" ? Gt : typeof self < "u" ? self : {}; var Uo = "__vueuse_ssr_handlers__"; jo[Uo] = jo[Uo] || {}; jo[Uo]; var Gr = Object.getOwnPropertySymbols; var Ul = Object.prototype.hasOwnProperty; var Kl = Object.prototype.propertyIsEnumerable; var Gl = (e, t) => { var n = {}; for (var o in e) Ul.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && Gr) for (var o of Gr(e)) t.indexOf(o) < 0 && Kl.call(e, o) && (n[o] = e[o]); return n; }; function pt(e, t, n = {}) { const o = n, { window: r = so } = o, a = Gl(o, ["window"]); let s; const i = ds(() => r && "ResizeObserver" in r), l = () => { s && (s.disconnect(), s = void 0); }, u = watch(() => Qe(e), (d) => { l(), i.value && r && d && (s = new ResizeObserver(t), s.observe(d, a)); }, { immediate: true, flush: "post" }), c = () => { l(), u(); }; return ao(c), { isSupported: i, stop: c }; } var Wr = Object.getOwnPropertySymbols; var Wl = Object.prototype.hasOwnProperty; var ql = Object.prototype.propertyIsEnumerable; var Zl = (e, t) => { var n = {}; for (var o in e) Wl.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && Wr) for (var o of Wr(e)) t.indexOf(o) < 0 && ql.call(e, o) && (n[o] = e[o]); return n; }; function Yl(e, t, n = {}) { const o = n, { window: r = so } = o, a = Zl(o, ["window"]); let s; const i = ds(() => r && "MutationObserver" in r), l = () => { s && (s.disconnect(), s = void 0); }, u = watch(() => Qe(e), (d) => { l(), i.value && r && d && (s = new MutationObserver(t), s.observe(d, a)); }, { immediate: true }), c = () => { l(), u(); }; return ao(c), { isSupported: i, stop: c }; } var qr; (function(e) { e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE"; })(qr || (qr = {})); var Jl = Object.defineProperty; var Zr = Object.getOwnPropertySymbols; var Xl = Object.prototype.hasOwnProperty; var Ql = Object.prototype.propertyIsEnumerable; var Yr = (e, t, n) => t in e ? Jl(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n; var eu = (e, t) => { for (var n in t || (t = {})) Xl.call(t, n) && Yr(e, n, t[n]); if (Zr) for (var n of Zr(t)) Ql.call(t, n) && Yr(e, n, t[n]); return e; }; var tu = { easeInSine: [0.12, 0, 0.39, 0], easeOutSine: [0.61, 1, 0.88, 1], easeInOutSine: [0.37, 0, 0.63, 1], easeInQuad: [0.11, 0, 0.5, 0], easeOutQuad: [0.5, 1, 0.89, 1], easeInOutQuad: [0.45, 0, 0.55, 1], easeInCubic: [0.32, 0, 0.67, 0], easeOutCubic: [0.33, 1, 0.68, 1], easeInOutCubic: [0.65, 0, 0.35, 1], easeInQuart: [0.5, 0, 0.75, 0], easeOutQuart: [0.25, 1, 0.5, 1], easeInOutQuart: [0.76, 0, 0.24, 1], easeInQuint: [0.64, 0, 0.78, 0], easeOutQuint: [0.22, 1, 0.36, 1], easeInOutQuint: [0.83, 0, 0.17, 1], easeInExpo: [0.7, 0, 0.84, 0], easeOutExpo: [0.16, 1, 0.3, 1], easeInOutExpo: [0.87, 0, 0.13, 1], easeInCirc: [0.55, 0, 1, 0.45], easeOutCirc: [0, 0.55, 0.45, 1], easeInOutCirc: [0.85, 0, 0.15, 1], easeInBack: [0.36, 0, 0.66, -0.56], easeOutBack: [0.34, 1.56, 0.64, 1], easeInOutBack: [0.68, -0.6, 0.32, 1.6] }; eu({ linear: Hl }, tu); Pt.env.NODE_ENV !== "production" && Object.freeze({}); Pt.env.NODE_ENV !== "production" && Object.freeze([]); var Xn = () => { }; var nu = Object.prototype.hasOwnProperty; var Jr = (e, t) => nu.call(e, t); var Ne = Array.isArray; var ue = (e) => typeof e == "function"; var rn = (e) => typeof e == "string"; var Be = (e) => e !== null && typeof e == "object"; var ou = Object.prototype.toString; var ru = (e) => ou.call(e); var _o = (e) => ru(e).slice(8, -1); var fs = typeof Gt == "object" && Gt && Gt.Object === Object && Gt; var au = typeof self == "object" && self && self.Object === Object && self; var Ue = fs || au || Function("return this")(); var He = Ue.Symbol; var ps = Object.prototype; var su = ps.hasOwnProperty; var iu = ps.toString; var mn = He ? He.toStringTag : void 0; function lu(e) { var t = su.call(e, mn), n = e[mn]; try { e[mn] = void 0; var o = true; } catch { } var r = iu.call(e); return o && (t ? e[mn] = n : delete e[mn]), r; } var uu = Object.prototype; var cu = uu.toString; function du(e) { return cu.call(e); } var fu = "[object Null]"; var pu = "[object Undefined]"; var Xr = He ? He.toStringTag : void 0; function an(e) { return e == null ? e === void 0 ? pu : fu : Xr && Xr in Object(e) ? lu(e) : du(e); } function Zt(e) { return e != null && typeof e == "object"; } var vu = "[object Symbol]"; function io(e) { return typeof e == "symbol" || Zt(e) && an(e) == vu; } function hu(e, t) { for (var n = -1, o = e == null ? 0 : e.length, r = Array(o); ++n < o; ) r[n] = t(e[n], n, e); return r; } var _e = Array.isArray; var gu = 1 / 0; var Qr = He ? He.prototype : void 0; var ea = Qr ? Qr.toString : void 0; function vs(e) { if (typeof e == "string") return e; if (_e(e)) return hu(e, vs) + ""; if (io(e)) return ea ? ea.call(e) : ""; var t = e + ""; return t == "0" && 1 / e == -gu ? "-0" : t; } var mu = /\s/; function yu(e) { for (var t = e.length; t-- && mu.test(e.charAt(t)); ) ; return t; } var bu = /^\s+/; function wu(e) { return e && e.slice(0, yu(e) + 1).replace(bu, ""); } function mt(e) { var t = typeof e; return e != null && (t == "object" || t == "function"); } var ta = NaN; var xu = /^[-+]0x[0-9a-f]+$/i; var Fu = /^0b[01]+$/i; var Cu = /^0o[0-7]+$/i; var Su = parseInt; function na(e) { if (typeof e == "number") return e; if (io(e)) return ta; if (mt(e)) { var t = typeof e.valueOf == "function" ? e.valueOf() : e; e = mt(t) ? t + "" : t; } if (typeof e != "string") return e === 0 ? e : +e; e = wu(e); var n = Fu.test(e); return n || Cu.test(e) ? Su(e.slice(2), n ? 2 : 8) : xu.test(e) ? ta : +e; } function hs(e) { return e; } var Ou = "[object AsyncFunction]"; var Tu = "[object Function]"; var _u = "[object GeneratorFunction]"; var Eu = "[object Proxy]"; function gs(e) { if (!mt(e)) return false; var t = an(e); return t == Tu || t == _u || t == Ou || t == Eu; } var Eo = Ue["__core-js_shared__"]; var oa = function() { var e = /[^.]+$/.exec(Eo && Eo.keys && Eo.keys.IE_PROTO || ""); return e ? "Symbol(src)_1." + e : ""; }(); function ku(e) { return !!oa && oa in e; } var Iu = Function.prototype; var $u = Iu.toString; function Lt(e) { if (e != null) { try { return $u.call(e); } catch { } try { return e + ""; } catch { } } return ""; } var Au = /[\\^$.*+?()[\]{}|]/g; var Pu = /^\[object .+?Constructor\]$/; var Lu = Function.prototype; var Mu = Object.prototype; var Ru = Lu.toString; var Nu = Mu.hasOwnProperty; var Bu = RegExp( "^" + Ru.call(Nu).replace(Au, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function Du(e) { if (!mt(e) || ku(e)) return false; var t = gs(e) ? Bu : Pu; return t.test(Lt(e)); } function zu(e, t) { return e == null ? void 0 : e[t]; } function Mt(e, t) { var n = zu(e, t); return Du(n) ? n : void 0; } var Ko = Mt(Ue, "WeakMap"); function Hu(e, t, n) { switch (n.length) { case 0: return e.call(t); case 1: return e.call(t, n[0]); case 2: return e.call(t, n[0], n[1]); case 3: return e.call(t, n[0], n[1], n[2]); } return e.apply(t, n); } var Vu = 800; var ju = 16; var Uu = Date.now; function Ku(e) { var t = 0, n = 0; return function() { var o = Uu(), r = ju - (o - n); if (n = o, r > 0) { if (++t >= Vu) return arguments[0]; } else t = 0; return e.apply(void 0, arguments); }; } function Gu(e) { return function() { return e; }; } var Qn = function() { try { var e = Mt(Object, "defineProperty"); return e({}, "", {}), e; } catch { } }(); var Wu = Qn ? function(e, t) { return Qn(e, "toString", { configurable: true, enumerable: false, value: Gu(t), writable: true }); } : hs; var qu = Ku(Wu); function Zu(e, t, n, o) { e.length; for (var r = n + 1; r--; ) if (t(e[r], r, e)) return r; return -1; } var Yu = 9007199254740991; var Ju = /^(?:0|[1-9]\d*)$/; function ur(e, t) { var n = typeof e; return t = t ?? Yu, !!t && (n == "number" || n != "symbol" && Ju.test(e)) && e > -1 && e % 1 == 0 && e < t; } function Xu(e, t, n) { t == "__proto__" && Qn ? Qn(e, t, { configurable: true, enumerable: true, value: n, writable: true }) : e[t] = n; } function cr(e, t) { return e === t || e !== e && t !== t; } var Qu = Object.prototype; var ec = Qu.hasOwnProperty; function tc(e, t, n) { var o = e[t]; (!(ec.call(e, t) && cr(o, n)) || n === void 0 && !(t in e)) && Xu(e, t, n); } var ra = Math.max; function nc(e, t, n) { return t = ra(t === void 0 ? e.length - 1 : t, 0), function() { for (var o = arguments, r = -1, a = ra(o.length - t, 0), s = Array(a); ++r < a; ) s[r] = o[t + r]; r = -1; for (var i = Array(t + 1); ++r < t; ) i[r] = o[r]; return i[t] = n(s), Hu(e, this, i); }; } var oc = 9007199254740991; function dr(e) { return typeof e == "number" && e > -1 && e % 1 == 0 && e <= oc; } function rc(e) { return e != null && dr(e.length) && !gs(e); } var ac = Object.prototype; function sc(e) { var t = e && e.constructor, n = typeof t == "function" && t.prototype || ac; return e === n; } function ic(e, t) { for (var n = -1, o = Array(e); ++n < e; ) o[n] = t(n); return o; } var lc = "[object Arguments]"; function aa(e) { return Zt(e) && an(e) == lc; } var ms = Object.prototype; var uc = ms.hasOwnProperty; var cc = ms.propertyIsEnumerable; var fr = aa(/* @__PURE__ */ function() { return arguments; }()) ? aa : function(e) { return Zt(e) && uc.call(e, "callee") && !cc.call(e, "callee"); }; function dc() { return false; } var ys = typeof exports == "object" && exports && !exports.nodeType && exports; var sa = ys && typeof module == "object" && module && !module.nodeType && module; var fc = sa && sa.exports === ys; var ia = fc ? Ue.Buffer : void 0; var pc = ia ? ia.isBuffer : void 0; var Go = pc || dc; var vc = "[object Arguments]"; var hc = "[object Array]"; var gc = "[object Boolean]"; var mc = "[object Date]"; var yc = "[object Error]"; var bc = "[object Function]"; var wc = "[object Map]"; var xc = "[object Number]"; var Fc = "[object Object]"; var Cc = "[object RegExp]"; var Sc = "[object Set]"; var Oc = "[object String]"; var Tc = "[object WeakMap]"; var _c = "[object ArrayBuffer]"; var Ec = "[object DataView]"; var kc = "[object Float32Array]"; var Ic = "[object Float64Array]"; var $c = "[object Int8Array]"; var Ac = "[object Int16Array]"; var Pc = "[object Int32Array]"; var Lc = "[object Uint8Array]"; var Mc = "[object Uint8ClampedArray]"; var Rc = "[object Uint16Array]"; var Nc = "[object Uint32Array]"; var Q = {}; Q[kc] = Q[Ic] = Q[$c] = Q[Ac] = Q[Pc] = Q[Lc] = Q[Mc] = Q[Rc] = Q[Nc] = true; Q[vc] = Q[hc] = Q[_c] = Q[gc] = Q[Ec] = Q[mc] = Q[yc] = Q[bc] = Q[wc] = Q[xc] = Q[Fc] = Q[Cc] = Q[Sc] = Q[Oc] = Q[Tc] = false; function Bc(e) { return Zt(e) && dr(e.length) && !!Q[an(e)]; } function Dc(e) { return function(t) { return e(t); }; } var bs = typeof exports == "object" && exports && !exports.nodeType && exports; var wn = bs && typeof module == "object" && module && !module.nodeType && module; var zc = wn && wn.exports === bs; var ko = zc && fs.process; var la = function() { try { var e = wn && wn.require && wn.require("util").types; return e || ko && ko.binding && ko.binding("util"); } catch { } }(); var ua = la && la.isTypedArray; var ws = ua ? Dc(ua) : Bc; var Hc = Object.prototype; var Vc = Hc.hasOwnProperty; function jc(e, t) { var n = _e(e), o = !n && fr(e), r = !n && !o && Go(e), a = !n && !o && !r && ws(e), s = n || o || r || a, i = s ? ic(e.length, String) : [], l = i.length; for (var u in e) Vc.call(e, u) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode. (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. r && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. a && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties. ur(u, l))) && i.push(u); return i; } function Uc(e, t) { return function(n) { return e(t(n)); }; } var Kc = Uc(Object.keys, Object); var Gc = Object.prototype; var Wc = Gc.hasOwnProperty; function qc(e) { if (!sc(e)) return Kc(e); var t = []; for (var n in Object(e)) Wc.call(e, n) && n != "constructor" && t.push(n); return t; } function xs(e) { return rc(e) ? jc(e) : qc(e); } var Zc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; var Yc = /^\w*$/; function pr(e, t) { if (_e(e)) return false; var n = typeof e; return n == "number" || n == "symbol" || n == "boolean" || e == null || io(e) ? true : Yc.test(e) || !Zc.test(e) || t != null && e in Object(t); } var Sn = Mt(Object, "create"); function Jc() { this.__data__ = Sn ? Sn(null) : {}, this.size = 0; } function Xc(e) { var t = this.has(e) && delete this.__data__[e]; return this.size -= t ? 1 : 0, t; } var Qc = "__lodash_hash_undefined__"; var ed = Object.prototype; var td = ed.hasOwnProperty; function nd(e) { var t = this.__data__; if (Sn) { var n = t[e]; return n === Qc ? void 0 : n; } return td.call(t, e) ? t[e] : void 0; } var od = Object.prototype; var rd = od.hasOwnProperty; function ad(e) { var t = this.__data__; return Sn ? t[e] !== void 0 : rd.call(t, e); } var sd = "__lodash_hash_undefined__"; function id(e, t) { var n = this.__data__; return this.size += this.has(e) ? 0 : 1, n[e] = Sn && t === void 0 ? sd : t, this; } function $t(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n; ) { var o = e[t]; this.set(o[0], o[1]); } } $t.prototype.clear = Jc; $t.prototype.delete = Xc; $t.prototype.get = nd; $t.prototype.has = ad; $t.prototype.set = id; function ld() { this.__data__ = [], this.size = 0; } function lo(e, t) { for (var n = e.length; n--; ) if (cr(e[n][0], t)) return n; return -1; } var ud = Array.prototype; var cd = ud.splice; function dd(e) { var t = this.__data__, n = lo(t, e); if (n < 0) return false; var o = t.length - 1; return n == o ? t.pop() : cd.call(t, n, 1), --this.size, true; } function fd(e) { var t = this.__data__, n = lo(t, e); return n < 0 ? void 0 : t[n][1]; } function pd(e) { return lo(this.__data__, e) > -1; } function vd(e, t) { var n = this.__data__, o = lo(n, e); return o < 0 ? (++this.size, n.push([e, t])) : n[o][1] = t, this; } function st(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n; ) { var o = e[t]; this.set(o[0], o[1]); } } st.prototype.clear = ld; st.prototype.delete = dd; st.prototype.get = fd; st.prototype.has = pd; st.prototype.set = vd; var On = Mt(Ue, "Map"); function hd() { this.size = 0, this.__data__ = { hash: new $t(), map: new (On || st)(), string: new $t() }; } function gd(e) { var t = typeof e; return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null; } function uo(e, t) { var n = e.__data__; return gd(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map; } function md(e) { var t = uo(this, e).delete(e); return this.size -= t ? 1 : 0, t; } function yd(e) { return uo(this, e).get(e); } function bd(e) { return uo(this, e).has(e); } function wd(e, t) { var n = uo(this, e), o = n.size; return n.set(e, t), this.size += n.size == o ? 0 : 1, this; } function it(e) { var t = -1, n = e == null ? 0 : e.length; for (this.clear(); ++t < n; ) { var o = e[t]; this.set(o[0], o[1]); } } it.prototype.clear = hd; it.prototype.delete = md; it.prototype.get = yd; it.prototype.has = bd; it.prototype.set = wd; var xd = "Expected a function"; function vr(e, t) { if (typeof e != "function" || t != null && typeof t != "function") throw new TypeError(xd); var n = function() { var o = arguments, r = t ? t.apply(this, o) : o[0], a = n.cache; if (a.has(r)) return a.get(r); var s = e.apply(this, o); return n.cache = a.set(r, s) || a, s; }; return n.cache = new (vr.Cache || it)(), n; } vr.Cache = it; var Fd = 500; function Cd(e) { var t = vr(e, function(o) { return n.size === Fd && n.clear(), o; }), n = t.cache; return t; } var Sd = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var Od = /\\(\\)?/g; var Td = Cd(function(e) { var t = []; return e.charCodeAt(0) === 46 && t.push(""), e.replace(Sd, function(n, o, r, a) { t.push(r ? a.replace(Od, "$1") : o || n); }), t; }); function _d(e) { return e == null ? "" : vs(e); } function co(e, t) { return _e(e) ? e : pr(e, t) ? [e] : Td(_d(e)); } var Ed = 1 / 0; function In(e) { if (typeof e == "string" || io(e)) return e; var t = e + ""; return t == "0" && 1 / e == -Ed ? "-0" : t; } function hr(e, t) { t = co(t, e); for (var n = 0, o = t.length; e != null && n < o; ) e = e[In(t[n++])]; return n && n == o ? e : void 0; } function Je(e, t, n) { var o = e == null ? void 0 : hr(e, t); return o === void 0 ? n : o; } function Fs(e, t) { for (var n = -1, o = t.length, r = e.length; ++n < o; ) e[r + n] = t[n]; return e; } var ca = He ? He.isConcatSpreadable : void 0; function kd(e) { return _e(e) || fr(e) || !!(ca && e && e[ca]); } function Id(e, t, n, o, r) { var a = -1, s = e.length; for (n || (n = kd), r || (r = []); ++a < s; ) { var i = e[a]; n(i) ? Fs(r, i) : r[r.length] = i; } return r; } function $d(e) { var t = e == null ? 0 : e.length; return t ? Id(e) : []; } function Ad(e) { return qu(nc(e, void 0, $d), e + ""); } function Me() { if (!arguments.length) return []; var e = arguments[0]; return _e(e) ? e : [e]; } function Pd() { this.__data__ = new st(), this.size = 0; } function Ld(e) { var t = this.__data__, n = t.delete(e); return this.size = t.size, n; } function Md(e) { return this.__data__.get(e); } function Rd(e) { return this.__data__.has(e); } var Nd = 200; function Bd(e, t) { var n = this.__data__; if (n instanceof st) { var o = n.__data__; if (!On || o.length < Nd - 1) return o.push([e, t]), this.size = ++n.size, this; n = this.__data__ = new it(o); } return n.set(e, t), this.size = n.size, this; } function nt(e) { var t = this.__data__ = new st(e); this.size = t.size; } nt.prototype.clear = Pd; nt.prototype.delete = Ld; nt.prototype.get = Md; nt.prototype.has = Rd; nt.prototype.set = Bd; function Dd(e, t) { for (var n = -1, o = e == null ? 0 : e.length, r = 0, a = []; ++n < o; ) { var s = e[n]; t(s, n, e) && (a[r++] = s); } return a; } function zd() { return []; } var Hd = Object.prototype; var Vd = Hd.propertyIsEnumerable; var da = Object.getOwnPropertySymbols; var jd = da ? function(e) { return e == null ? [] : (e = Object(e), Dd(da(e), function(t) { return Vd.call(e, t); })); } : zd; function Ud(e, t, n) { var o = t(e); return _e(e) ? o : Fs(o, n(e)); } function fa(e) { return Ud(e, xs, jd); } var Wo = Mt(Ue, "DataView"); var qo = Mt(Ue, "Promise"); var Zo = Mt(Ue, "Set"); var pa = "[object Map]"; var Kd = "[object Object]"; var va = "[object Promise]"; var ha = "[object Set]"; var ga = "[object WeakMap]"; var ma = "[object DataView]"; var Gd = Lt(Wo); var Wd = Lt(On); var qd = Lt(qo); var Zd = Lt(Zo); var Yd = Lt(Ko); var vt = an; (Wo && vt(new Wo(new ArrayBuffer(1))) != ma || On && vt(new On()) != pa || qo && vt(qo.resolve()) != va || Zo && vt(new Zo()) != ha || Ko && vt(new Ko()) != ga) && (vt = function(e) { var t = an(e), n = t == Kd ? e.constructor : void 0, o = n ? Lt(n) : ""; if (o) switch (o) { case Gd: return ma; case Wd: return pa; case qd: return va; case Zd: return ha; case Yd: return ga; } return t; }); var ya = Ue.Uint8Array; var Jd = "__lodash_hash_undefined__"; function Xd(e) { return this.__data__.set(e, Jd), this; } function Qd(e) { return this.__data__.has(e); } function eo(e) { var t = -1, n = e == null ? 0 : e.length; for (this.__data__ = new it(); ++t < n; ) this.add(e[t]); } eo.prototype.add = eo.prototype.push = Xd; eo.prototype.has = Qd; function ef(e, t) { for (var n = -1, o = e == null ? 0 : e.length; ++n < o; ) if (t(e[n], n, e)) return true; return false; } function tf(e, t) { return e.has(t); } var nf = 1; var of = 2; function Cs(e, t, n, o, r, a) { var s = n & nf, i = e.length, l = t.length; if (i != l && !(s && l > i)) return false; var u = a.get(e), c = a.get(t); if (u && c) return u == t && c == e; var d = -1, v = true, g = n & of ? new eo() : void 0; for (a.set(e, t), a.set(t, e); ++d < i; ) { var f = e[d], p = t[d]; if (o) var m = s ? o(p, f, d, t, e, a) : o(f, p, d, e, t, a); if (m !== void 0) { if (m) continue; v = false; break; } if (g) { if (!ef(t, function(y, C) { if (!tf(g, C) && (f === y || r(f, y, n, o, a))) return g.push(C); })) { v = false; break; } } else if (!(f === p || r(f, p, n, o, a))) { v = false; break; } } return a.delete(e), a.delete(t), v; } function rf(e) { var t = -1, n = Array(e.size); return e.forEach(function(o, r) { n[++t] = [r, o]; }), n; } function af(e) { var t = -1, n = Array(e.size); return e.forEach(function(o) { n[++t] = o; }), n; } var sf = 1; var lf = 2; var uf = "[object Boolean]"; var cf = "[object Date]"; var df = "[object Error]"; var ff = "[object Map]"; var pf = "[object Number]"; var vf = "[object RegExp]"; var hf = "[object Set]"; var gf = "[object String]"; var mf = "[object Symbol]"; var yf = "[object ArrayBuffer]"; var bf = "[object DataView]"; var ba = He ? He.prototype : void 0; var Io = ba ? ba.valueOf : void 0; function wf(e, t, n, o, r, a, s) { switch (n) { case bf: if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return false; e = e.buffer, t = t.buffer; case yf: return !(e.byteLength != t.byteLength || !a(new ya(e), new ya(t))); case uf: case cf: case pf: return cr(+e, +t); case df: return e.name == t.name && e.message == t.message; case vf: case gf: return e == t + ""; case ff: var i = rf; case hf: var l = o & sf; if (i || (i = af), e.size != t.size && !l) return false; var u = s.get(e); if (u) return u == t; o |= lf, s.set(e, t); var c = Cs(i(e), i(t), o, r, a, s); return s.delete(e), c; case mf: if (Io) return Io.call(e) == Io.call(t); } return false; } var xf = 1; var Ff = Object.prototype; var Cf = Ff.hasOwnProperty; function Sf(e, t, n, o, r, a) { var s = n & xf, i = fa(e), l = i.length, u = fa(t), c = u.length; if (l != c && !s) return false; for (var d = l; d--; ) { var v = i[d]; if (!(s ? v in t : Cf.call(t, v))) return false; } var g = a.get(e), f = a.get(t); if (g && f) return g == t && f == e; var p = true; a.set(e, t), a.set(t, e); for (var m = s; ++d < l; ) { v = i[d]; var y = e[v], C = t[v]; if (o) var $ = s ? o(C, y, v, t, e, a) : o(y, C, v, e, t, a); if (!($ === void 0 ? y === C || r(y, C, n, o, a) : $)) { p = false; break; } m || (m = v == "constructor"); } if (p && !m) { var S = e.constructor, x = t.constructor; S != x && "constructor" in e && "constructor" in t && !(typeof S == "function" && S instanceof S && typeof x == "function" && x instanceof x) && (p = false); } return a.delete(e), a.delete(t), p; } var Of = 1; var wa = "[object Arguments]"; var xa = "[object Array]"; var jn = "[object Object]"; var Tf = Object.prototype; var Fa = Tf.hasOwnProperty; function _f(e, t, n, o, r, a) { var s = _e(e), i = _e(t), l = s ? xa : vt(e), u = i ? xa : vt(t); l = l == wa ? jn : l, u = u == wa ? jn : u; var c = l == jn, d = u == jn, v = l == u; if (v && Go(e)) { if (!Go(t)) return false; s = true, c = false; } if (v && !c) return a || (a = new nt()), s || ws(e) ? Cs(e, t, n, o, r, a) : wf(e, t, l, n, o, r, a); if (!(n & Of)) { var g = c && Fa.call(e, "__wrapped__"), f = d && Fa.call(t, "__wrapped__"); if (g || f) { var p = g ? e.value() : e, m = f ? t.value() : t; return a || (a = new nt()), r(p, m, n, o, a); } } return v ? (a || (a = new nt()), Sf(e, t, n, o, r, a)) : false; } function fo(e, t, n, o, r) { return e === t ? true : e == null || t == null || !Zt(e) && !Zt(t) ? e !== e && t !== t : _f(e, t, n, o, fo, r); } var Ef = 1; var kf = 2; function If(e, t, n, o) { var r = n.length, a = r; if (e == null) return !a; for (e = Object(e); r--; ) { var s = n[r]; if (s[2] ? s[1] !== e[s[0]] : !(s[0] in e)) return false; } for (; ++r < a; ) { s = n[r]; var i = s[0], l = e[i], u = s[1]; if (s[2]) { if (l === void 0 && !(i in e)) return false; } else { var c = new nt(), d; if (!(d === void 0 ? fo(u, l, Ef | kf, o, c) : d)) return false; } } return true; } function Ss(e) { return e === e && !mt(e); } function $f(e) { for (var t = xs(e), n = t.length; n--; ) { var o = t[n], r = e[o]; t[n] = [o, r, Ss(r)]; } return t; } function Os(e, t) { return function(n) { return n == null ? false : n[e] === t && (t !== void 0 || e in Object(n)); }; } function Af(e) { var t = $f(e); return t.length == 1 && t[0][2] ? Os(t[0][0], t[0][1]) : function(n) { return n === e || If(n, e, t); }; } function Pf(e, t) { return e != null && t in Object(e); } function Lf(e, t, n) { t = co(t, e); for (var o = -1, r = t.length, a = false; ++o < r; ) { var s = In(t[o]); if (!(a = e != null && n(e, s))) break; e = e[s]; } return a || ++o != r ? a : (r = e == null ? 0 : e.length, !!r && dr(r) && ur(s, r) && (_e(e) || fr(e))); } function Ts(e, t) { return e != null && Lf(e, t, Pf); } var Mf = 1; var Rf = 2; function Nf(e, t) { return pr(e) && Ss(t) ? Os(In(e), t) : function(n) { var o = Je(n, e); return o === void 0 && o === t ? Ts(n, e) : fo(t, o, Mf | Rf); }; } function Bf(e) { return function(t) { return t == null ? void 0 : t[e]; }; } function Df(e) { return function(t) { return hr(t, e); }; } function zf(e) { return pr(e) ? Bf(In(e)) : Df(e); } function Hf(e) { return typeof e == "function" ? e : e == null ? hs : typeof e == "object" ? _e(e) ? Nf(e[0], e[1]) : Af(e) : zf(e); } var $o = function() { return Ue.Date.now(); }; var Vf = "Expected a function"; var jf = Math.max; var Uf = Math.min; function Kf(e, t, n) { var o, r, a, s, i, l, u = 0, c = false, d = false, v = true; if (typeof e != "function") throw new TypeError(Vf); t = na(t) || 0, mt(n) && (c = !!n.leading, d = "maxWait" in n, a = d ? jf(na(n.maxWait) || 0, t) : a, v = "trailing" in n ? !!n.trailing : v); function g(O) { var E = o, A = r; return o = r = void 0, u = O, s = e.apply(A, E), s; } function f(O) { return u = O, i = setTimeout(y, t), c ? g(O) : s; } function p(O) { var E = O - l, A = O - u, L = t - E; return d ? Uf(L, a - A) : L; } function m(O) { var E = O - l, A = O - u; return l === void 0 || E >= t || E < 0 || d && A >= a; } function y() { var O = $o(); if (m(O)) return C(O); i = setTimeout(y, p(O)); } function C(O) { return i = void 0, v && o ? g(O) : (o = r = void 0, s); } function $() { i !== void 0 && clearTimeout(i), u = 0, o = l = r = i = void 0; } function S() { return i === void 0 ? s : C($o()); } function x() { var O = $o(), E = m(O); if (o = arguments, r = this, l = O, E) { if (i === void 0) return f(l); if (d) return clearTimeout(i), i = setTimeout(y, t), g(l); } return i === void 0 && (i = setTimeout(y, t)), s; } return x.cancel = $, x.flush = S, x; } function Gf(e, t, n) { var o = e == null ? 0 : e.length; if (!o) return -1; var r = o - 1; return Zu(e, Hf(t), r); } function Yo(e) { for (var t = -1, n = e == null ? 0 : e.length, o = {}; ++t < n; ) { var r = e[t]; o[r[0]] = r[1]; } return o; } function Jo(e, t) { return fo(e, t); } function gr(e) { return e == null; } function Wf(e) { return e === void 0; } function qf(e, t, n, o) { if (!mt(e)) return e; t = co(t, e); for (var r = -1, a = t.length, s = a - 1, i = e; i != null && ++r < a; ) { var l = In(t[r]), u = n; if (l === "__proto__" || l === "constructor" || l === "prototype") return e; if (r != s) { var c = i[l]; u = void 0, u === void 0 && (u = mt(c) ? c : ur(t[r + 1]) ? [] : {}); } tc(i, l, u), i = i[l]; } return e; } function Zf(e, t, n) { for (var o = -1, r = t.length, a = {}; ++o < r; ) { var s = t[o], i = hr(e, s); n(i, s) && qf(a, co(s, e), i); } return a; } function Yf(e, t) { return Zf(e, t, function(n, o) { return Ts(e, o); }); } var Jf = Ad(function(e, t) { return e == null ? {} : Yf(e, t); }); var bn = (e) => e === void 0; var mr = (e) => typeof e == "boolean"; var xe = (e) => typeof e == "number"; var _t = (e) => typeof Element > "u" ? false : e instanceof Element; var Xf = (e) => rn(e) ? !Number.isNaN(Number(e)) : false; var Qf = (e = "") => e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); var _s = class extends Error { constructor(t) { super(t), this.name = "ElementPlusError"; } }; function ep(e, t) { throw new _s(`[${e}] ${t}`); } function Ve(e, t) { if (Pt.env.NODE_ENV !== "production") { const n = rn(e) ? new _s(`[${e}] ${t}`) : e; console.warn(n); } } var tp = "utils/dom/style"; function to(e, t = "px") { if (!e) return ""; if (xe(e) || Xf(e)) return `${e}${t}`; if (rn(e)) return e; Ve(tp, "binding value must be a string or number"); } function np(e, t) { if (!se) return; if (!t) { e.scrollTop = 0; return; } const n = []; let o = t.offsetParent; for (; o !== null && e !== o && e.contains(o); ) n.push(o), o = o.offsetParent; const r = t.offsetTop + n.reduce((l, u) => l + u.offsetTop, 0), a = r + t.offsetHeight, s = e.scrollTop, i = s + e.clientHeight; r < s ? e.scrollTop = r : a > i && (e.scrollTop = a - e.clientHeight); } var op = defineComponent({ name: "ArrowDown", __name: "arrow-down", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z" }) ])); } }); var rp = op; var ap = defineComponent({ name: "ArrowRight", __name: "arrow-right", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z" }) ])); } }); var sp = ap; var ip = defineComponent({ name: "CircleCheck", __name: "circle-check", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }), createBaseVNode("path", { fill: "currentColor", d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z" }) ])); } }); var lp = ip; var up = defineComponent({ name: "CircleClose", __name: "circle-close", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z" }), createBaseVNode("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }) ])); } }); var Es = up; var cp = defineComponent({ name: "Close", __name: "close", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z" }) ])); } }); var Ca = cp; var dp = defineComponent({ name: "Loading", __name: "loading", setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" }) ])); } }); var ks = dp; var Is = "__epPropKey"; var D = (e) => e; var fp = (e) => Be(e) && !!e[Is]; var po = (e, t) => { if (!Be(e) || fp(e)) return e; const { values: n, required: o, default: r, type: a, validator: s } = e, l = { type: a, required: !!o, validator: n || s ? (u) => { let c = false, d = []; if (n && (d = Array.from(n), Jr(e, "default") && d.push(r), c || (c = d.includes(u))), s && (c || (c = s(u))), !c && d.length > 0) { const v = [...new Set(d)].map((g) => JSON.stringify(g)).join(", "); warn(`Invalid prop: validation failed${t ? ` for prop "${t}"` : ""}. Expected one of [${v}], got value ${JSON.stringify(u)}.`); } return c; } : void 0, [Is]: true }; return Jr(e, "default") && (l.default = r), l; }; var ee = (e) => Yo(Object.entries(e).map(([t, n]) => [ t, po(n, t) ])); var Yt = D([ String, Object, Function ]); var pp = { validating: ks, success: lp, error: Es }; var ke = (e, t) => { if (e.install = (n) => { for (const o of [e, ...Object.values(t ?? {})]) n.component(o.name, o); }, t) for (const [n, o] of Object.entries(t)) e[n] = o; return e; }; var vp = (e, t) => (e.install = (n) => { n.directive(t, e); }, e); var vo = (e) => (e.install = Xn, e); var Tn = { tab: "Tab", enter: "Enter", space: "Space", left: "ArrowLeft", up: "ArrowUp", right: "ArrowRight", down: "ArrowDown", esc: "Escape", delete: "Delete", backspace: "Backspace", numpadEnter: "NumpadEnter", pageUp: "PageUp", pageDown: "PageDown", home: "Home", end: "End" }; var ht = "update:modelValue"; var ho = "change"; var $s = ["", "default", "small", "large"]; var hp = (e) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e); var gp = (e) => e; var mp = ({ from: e, replacement: t, scope: n, version: o, ref: r, type: a = "API" }, s) => { watch(() => unref(s), (i) => { i && Ve(n, `[${a}] ${e} is about to be deprecated in version ${o}, please use ${t} instead. For more detail, please visit: ${r} `); }, { immediate: true }); }; var yp = { name: "en", el: { breadcrumb: { label: "Breadcrumb" }, colorpicker: { confirm: "OK", clear: "Clear", defaultLabel: "color picker", description: "current color is {color}. press enter to select a new color.", alphaLabel: "pick alpha value" }, datepicker: { now: "Now", today: "Today", cancel: "Cancel", clear: "Clear", confirm: "OK", dateTablePrompt: "Use the arrow keys and enter to select the day of the month", monthTablePrompt: "Use the arrow keys and enter to select the month", yearTablePrompt: "Use the arrow keys and enter to select the year", selectedDate: "Selected date", selectDate: "Select date", selectTime: "Select time", startDate: "Start Date", startTime: "Start Time", endDate: "End Date", endTime: "End Time", prevYear: "Previous Year", nextYear: "Next Year", prevMonth: "Previous Month", nextMonth: "Next Month", year: "", month1: "January", month2: "February", month3: "March", month4: "April", month5: "May", month6: "June", month7: "July", month8: "August", month9: "September", month10: "October", month11: "November", month12: "December", week: "week", weeks: { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat" }, weeksFull: { sun: "Sunday", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday" }, months: { jan: "Jan", feb: "Feb", mar: "Mar", apr: "Apr", may: "May", jun: "Jun", jul: "Jul", aug: "Aug", sep: "Sep", oct: "Oct", nov: "Nov", dec: "Dec" } }, inputNumber: { decrease: "decrease number", increase: "increase number" }, select: { loading: "Loading", noMatch: "No matching data", noData: "No data", placeholder: "Select" }, mention: { loading: "Loading" }, dropdown: { toggleDropdown: "Toggle Dropdown" }, cascader: { noMatch: "No matching data", loading: "Loading", placeholder: "Select", noData: "No data" }, pagination: { goto: "Go to", pagesize: "/page", total: "Total {total}", pageClassifier: "", page: "Page", prev: "Go to previous page", next: "Go to next page", currentPage: "page {pager}", prevPages: "Previous {pager} pages", nextPages: "Next {pager} pages", deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" }, dialog: { close: "Close this dialog" }, drawer: { close: "Close this dialog" }, messagebox: { title: "Message", confirm: "OK", cancel: "Cancel", error: "Illegal input", close: "Close this dialog" }, upload: { deleteTip: "press delete to remove", delete: "Delete", preview: "Preview", continue: "Continue" }, slider: { defaultLabel: "slider between {min} and {max}", defaultRangeStartLabel: "pick start value", defaultRangeEndLabel: "pick end value" }, table: { emptyText: "No Data", confirmFilter: "Confirm", resetFilter: "Reset", clearFilter: "All", sumText: "Sum" }, tour: { next: "Next", previous: "Previous", finish: "Finish" }, tree: { emptyText: "No Data" }, transfer: { noMatch: "No matching data", noData: "No data", titles: ["List 1", "List 2"], filterPlaceholder: "Enter keyword", noCheckedFormat: "{total} items", hasCheckedFormat: "{checked}/{total} checked" }, image: { error: "FAILED" }, pageHeader: { title: "Back" }, popconfirm: { confirmButtonText: "Yes", cancelButtonText: "No" }, carousel: { leftArrow: "Carousel arrow left", rightArrow: "Carousel arrow right", indicator: "Carousel switch to index {index}" } } }; var bp = (e) => (t, n) => wp(t, n, unref(e)); var wp = (e, t, n) => Je(n, e, e).replace(/\{(\w+)\}/g, (o, r) => { var a; return `${(a = t == null ? void 0 : t[r]) != null ? a : `{${r}}`}`; }); var xp = (e) => { const t = computed(() => unref(e).name), n = isRef(e) ? e : ref(e); return { lang: t, locale: n, t: bp(e) }; }; var Fp = Symbol("localeContextKey"); var Cp = (e) => { const t = inject(Fp, ref()); return xp(computed(() => t.value || yp)); }; var Ao = "el"; var Sp = "is-"; var St = (e, t, n, o, r) => { let a = `${e}-${t}`; return n && (a += `-${n}`), o && (a += `__${o}`), r && (a += `--${r}`), a; }; var Op = Symbol("namespaceContextKey"); var yr = (e) => { const t = getCurrentInstance() ? inject(Op, ref(Ao)) : ref(Ao); return computed(() => unref(t) || Ao); }; var te = (e, t) => { const n = yr(); return { namespace: n, b: (p = "") => St(n.value, e, p, "", ""), e: (p) => p ? St(n.value, e, "", p, "") : "", m: (p) => p ? St(n.value, e, "", "", p) : "", be: (p, m) => p && m ? St(n.value, e, p, m, "") : "", em: (p, m) => p && m ? St(n.value, e, "", p, m) : "", bm: (p, m) => p && m ? St(n.value, e, p, "", m) : "", bem: (p, m, y) => p && m && y ? St(n.value, e, p, m, y) : "", is: (p, ...m) => { const y = m.length >= 1 ? m[0] : true; return p && y ? `${Sp}${p}` : ""; }, cssVar: (p) => { const m = {}; for (const y in p) p[y] && (m[`--${n.value}-${y}`] = p[y]); return m; }, cssVarName: (p) => `--${n.value}-${p}`, cssVarBlock: (p) => { const m = {}; for (const y in p) p[y] && (m[`--${n.value}-${e}-${y}`] = p[y]); return m; }, cssVarBlockName: (p) => `--${n.value}-${e}-${p}` }; }; var Tp = po({ type: D(Boolean), default: null }); var _p = po({ type: D(Function) }); var Ep = (e) => { const t = `update:${e}`, n = `onUpdate:${e}`, o = [t], r = { [e]: Tp, [n]: _p }; return { useModelToggle: ({ indicator: s, toggleReason: i, shouldHideWhenRouteChanges: l, shouldProceed: u, onShow: c, onHide: d }) => { const v = getCurrentInstance(), { emit: g } = v, f = v.props, p = computed(() => ue(f[n])), m = computed(() => f[e] === null), y = (E) => { s.value !== true && (s.value = true, i && (i.value = E), ue(c) && c(E)); }, C = (E) => { s.value !== false && (s.value = false, i && (i.value = E), ue(d) && d(E)); }, $ = (E) => { if (f.disabled === true || ue(u) && !u()) return; const A = p.value && se; A && g(t, true), (m.value || !A) && y(E); }, S = (E) => { if (f.disabled === true || !se) return; const A = p.value && se; A && g(t, false), (m.value || !A) && C(E); }, x = (E) => { mr(E) && (f.disabled && E ? p.value && g(t, false) : s.value !== E && (E ? y() : C())); }, O = () => { s.value ? S() : $(); }; return watch(() => f[e], x), l && v.appContext.config.globalProperties.$route !== void 0 && watch(() => ({ ...v.proxy.$route }), () => { l.value && s.value && S(); }), onMounted(() => { x(f[e]); }), { hide: S, show: $, toggle: O, hasUpdateHandler: p }; }, useModelToggleProps: r, useModelToggleEmits: o }; }; var As = (e) => { const t = getCurrentInstance(); return computed(() => { var n, o; return (o = (n = t == null ? void 0 : t.proxy) == null ? void 0 : n.$props) == null ? void 0 : o[e]; }); }; var ce = "top"; var Ce = "bottom"; var Se = "right"; var de = "left"; var br = "auto"; var $n = [ce, Ce, Se, de]; var Jt = "start"; var _n = "end"; var kp = "clippingParents"; var Ps = "viewport"; var yn = "popper"; var Ip = "reference"; var Sa = $n.reduce(function(e, t) { return e.concat([t + "-" + Jt, t + "-" + _n]); }, []); var go = [].concat($n, [br]).reduce(function(e, t) { return e.concat([t, t + "-" + Jt, t + "-" + _n]); }, []); var $p = "beforeRead"; var Ap = "read"; var Pp = "afterRead"; var Lp = "beforeMain"; var Mp = "main"; var Rp = "afterMain"; var Np = "beforeWrite"; var Bp = "write"; var Dp = "afterWrite"; var zp = [$p, Ap, Pp, Lp, Mp, Rp, Np, Bp, Dp]; function je(e) { return e ? (e.nodeName || "").toLowerCase() : null; } function Ie(e) { if (e == null) return window; if (e.toString() !== "[object Window]") { var t = e.ownerDocument; return t && t.defaultView || window; } return e; } function Xt(e) { var t = Ie(e).Element; return e instanceof t || e instanceof Element; } function Fe(e) { var t = Ie(e).HTMLElement; return e instanceof t || e instanceof HTMLElement; } function wr(e) { if (typeof ShadowRoot > "u") return false; var t = Ie(e).ShadowRoot; return e instanceof t || e instanceof ShadowRoot; } function Hp(e) { var t = e.state; Object.keys(t.elements).forEach(function(n) { var o = t.styles[n] || {}, r = t.attributes[n] || {}, a = t.elements[n]; !Fe(a) || !je(a) || (Object.assign(a.style, o), Object.keys(r).forEach(function(s) { var i = r[s]; i === false ? a.removeAttribute(s) : a.setAttribute(s, i === true ? "" : i); })); }); } function Vp(e) { var t = e.state, n = { popper: { position: t.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(t.elements.popper.style, n.popper), t.styles = n, t.elements.arrow && Object.assign(t.elements.arrow.style, n.arrow), function() { Object.keys(t.elements).forEach(function(o) { var r = t.elements[o], a = t.attributes[o] || {}, s = Object.keys(t.styles.hasOwnProperty(o) ? t.styles[o] : n[o]), i = s.reduce(function(l, u) { return l[u] = "", l; }, {}); !Fe(r) || !je(r) || (Object.assign(r.style, i), Object.keys(a).forEach(function(l) { r.removeAttribute(l); })); }); }; } var Ls = { name: "applyStyles", enabled: true, phase: "write", fn: Hp, effect: Vp, requires: ["computeStyles"] }; function ze(e) { return e.split("-")[0]; } var Et = Math.max; var no = Math.min; var Qt = Math.round; function en(e, t) { t === void 0 && (t = false); var n = e.getBoundingClientRect(), o = 1, r = 1; if (Fe(e) && t) { var a = e.offsetHeight, s = e.offsetWidth; s > 0 && (o = Qt(n.width) / s || 1), a > 0 && (r = Qt(n.height) / a || 1); } return { width: n.width / o, height: n.height / r, top: n.top / r, right: n.right / o, bottom: n.bottom / r, left: n.left / o, x: n.left / o, y: n.top / r }; } function xr(e) { var t = en(e), n = e.offsetWidth, o = e.offsetHeight; return Math.abs(t.width - n) <= 1 && (n = t.width), Math.abs(t.height - o) <= 1 && (o = t.height), { x: e.offsetLeft, y: e.offsetTop, width: n, height: o }; } function Ms(e, t) { var n = t.getRootNode && t.getRootNode(); if (e.contains(t)) return true; if (n && wr(n)) { var o = t; do { if (o && e.isSameNode(o)) return true; o = o.parentNode || o.host; } while (o); } return false; } function rt(e) { return Ie(e).getComputedStyle(e); } function jp(e) { return ["table", "td", "th"].indexOf(je(e)) >= 0; } function yt(e) { return ((Xt(e) ? e.ownerDocument : e.document) || window.document).documentElement; } function mo(e) { return je(e) === "html" ? e : e.assignedSlot || e.parentNode || (wr(e) ? e.host : null) || yt(e); } function Oa(e) { return !Fe(e) || rt(e).position === "fixed" ? null : e.offsetParent; } function Up(e) { var t = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1; if (n && Fe(e)) { var o = rt(e); if (o.position === "fixed") return null; } var r = mo(e); for (wr(r) && (r = r.host); Fe(r) && ["html", "body"].indexOf(je(r)) < 0; ) { var a = rt(r); if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none") return r; r = r.parentNode; } return null; } function An(e) { for (var t = Ie(e), n = Oa(e); n && jp(n) && rt(n).position === "static"; ) n = Oa(n); return n && (je(n) === "html" || je(n) === "body" && rt(n).position === "static") ? t : n || Up(e) || t; } function Fr(e) { return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y"; } function xn(e, t, n) { return Et(e, no(t, n)); } function Kp(e, t, n) { var o = xn(e, t, n); return o > n ? n : o; } function Rs() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function Ns(e) { return Object.assign({}, Rs(), e); } function Bs(e, t) { return t.reduce(function(n, o) { return n[o] = e, n; }, {}); } var Gp = function(e, t) { return e = typeof e == "function" ? e(Object.assign({}, t.rects, { placement: t.placement })) : e, Ns(typeof e != "number" ? e : Bs(e, $n)); }; function Wp(e) { var t, n = e.state, o = e.name, r = e.options, a = n.elements.arrow, s = n.modifiersData.popperOffsets, i = ze(n.placement), l = Fr(i), u = [de, Se].indexOf(i) >= 0, c = u ? "height" : "width"; if (!(!a || !s)) { var d = Gp(r.padding, n), v = xr(a), g = l === "y" ? ce : de, f = l === "y" ? Ce : Se, p = n.rects.reference[c] + n.rects.reference[l] - s[l] - n.rects.popper[c], m = s[l] - n.rects.reference[l], y = An(a), C = y ? l === "y" ? y.clientHeight || 0 : y.clientWidth || 0 : 0, $ = p / 2 - m / 2, S = d[g], x = C - v[c] - d[f], O = C / 2 - v[c] / 2 + $, E = xn(S, O, x), A = l; n.modifiersData[o] = (t = {}, t[A] = E, t.centerOffset = E - O, t); } } function qp(e) { var t = e.state, n = e.options, o = n.element, r = o === void 0 ? "[data-popper-arrow]" : o; r != null && (typeof r == "string" && (r = t.elements.popper.querySelector(r), !r) || !Ms(t.elements.popper, r) || (t.elements.arrow = r)); } var Zp = { name: "arrow", enabled: true, phase: "main", fn: Wp, effect: qp, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function tn(e) { return e.split("-")[1]; } var Yp = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function Jp(e) { var t = e.x, n = e.y, o = window, r = o.devicePixelRatio || 1; return { x: Qt(t * r) / r || 0, y: Qt(n * r) / r || 0 }; } function Ta(e) { var t, n = e.popper, o = e.popperRect, r = e.placement, a = e.variation, s = e.offsets, i = e.position, l = e.gpuAcceleration, u = e.adaptive, c = e.roundOffsets, d = e.isFixed, v = s.x, g = v === void 0 ? 0 : v, f = s.y, p = f === void 0 ? 0 : f, m = typeof c == "function" ? c({ x: g, y: p }) : { x: g, y: p }; g = m.x, p = m.y; var y = s.hasOwnProperty("x"), C = s.hasOwnProperty("y"), $ = de, S = ce, x = window; if (u) { var O = An(n), E = "clientHeight", A = "clientWidth"; if (O === Ie(n) && (O = yt(n), rt(O).position !== "static" && i === "absolute" && (E = "scrollHeight", A = "scrollWidth")), O = O, r === ce || (r === de || r === Se) && a === _n) { S = Ce; var L = d && O === x && x.visualViewport ? x.visualViewport.height : O[E]; p -= L - o.height, p *= l ? 1 : -1; } if (r === de || (r === ce || r === Ce) && a === _n) { $ = Se; var H = d && O === x && x.visualViewport ? x.visualViewport.width : O[A]; g -= H - o.width, g *= l ? 1 : -1; } } var Z = Object.assign({ position: i }, u && Yp), K = c === true ? Jp({ x: g, y: p }) : { x: g, y: p }; if (g = K.x, p = K.y, l) { var X; return Object.assign({}, Z, (X = {}, X[S] = C ? "0" : "", X[$] = y ? "0" : "", X.transform = (x.devicePixelRatio || 1) <= 1 ? "translate(" + g + "px, " + p + "px)" : "translate3d(" + g + "px, " + p + "px, 0)", X)); } return Object.assign({}, Z, (t = {}, t[S] = C ? p + "px" : "", t[$] = y ? g + "px" : "", t.transform = "", t)); } function Xp(e) { var t = e.state, n = e.options, o = n.gpuAcceleration, r = o === void 0 ? true : o, a = n.adaptive, s = a === void 0 ? true : a, i = n.roundOffsets, l = i === void 0 ? true : i, u = { placement: ze(t.placement), variation: tn(t.placement), popper: t.elements.popper, popperRect: t.rects.popper, gpuAcceleration: r, isFixed: t.options.strategy === "fixed" }; t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, Ta(Object.assign({}, u, { offsets: t.modifiersData.popperOffsets, position: t.options.strategy, adaptive: s, roundOffsets: l })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, Ta(Object.assign({}, u, { offsets: t.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: l })))), t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-placement": t.placement }); } var Ds = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Xp, data: {} }; var Un = { passive: true }; function Qp(e) { var t = e.state, n = e.instance, o = e.options, r = o.scroll, a = r === void 0 ? true : r, s = o.resize, i = s === void 0 ? true : s, l = Ie(t.elements.popper), u = [].concat(t.scrollParents.reference, t.scrollParents.popper); return a && u.forEach(function(c) { c.addEventListener("scroll", n.update, Un); }), i && l.addEventListener("resize", n.update, Un), function() { a && u.forEach(function(c) { c.removeEventListener("scroll", n.update, Un); }), i && l.removeEventListener("resize", n.update, Un); }; } var zs = { name: "eventListeners", enabled: true, phase: "write", fn: function() { }, effect: Qp, data: {} }; var e0 = { left: "right", right: "left", bottom: "top", top: "bottom" }; function Jn(e) { return e.replace(/left|right|bottom|top/g, function(t) { return e0[t]; }); } var t02 = { start: "end", end: "start" }; function _a(e) { return e.replace(/start|end/g, function(t) { return t02[t]; }); } function Cr(e) { var t = Ie(e), n = t.pageXOffset, o = t.pageYOffset; return { scrollLeft: n, scrollTop: o }; } function Sr(e) { return en(yt(e)).left + Cr(e).scrollLeft; } function n0(e) { var t = Ie(e), n = yt(e), o = t.visualViewport, r = n.clientWidth, a = n.clientHeight, s = 0, i = 0; return o && (r = o.width, a = o.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (s = o.offsetLeft, i = o.offsetTop)), { width: r, height: a, x: s + Sr(e), y: i }; } function o0(e) { var t, n = yt(e), o = Cr(e), r = (t = e.ownerDocument) == null ? void 0 : t.body, a = Et(n.scrollWidth, n.clientWidth, r ? r.scrollWidth : 0, r ? r.clientWidth : 0), s = Et(n.scrollHeight, n.clientHeight, r ? r.scrollHeight : 0, r ? r.clientHeight : 0), i = -o.scrollLeft + Sr(e), l = -o.scrollTop; return rt(r || n).direction === "rtl" && (i += Et(n.clientWidth, r ? r.clientWidth : 0) - a), { width: a, height: s, x: i, y: l }; } function Or(e) { var t = rt(e), n = t.overflow, o = t.overflowX, r = t.overflowY; return /auto|scroll|overlay|hidden/.test(n + r + o); } function Hs(e) { return ["html", "body", "#document"].indexOf(je(e)) >= 0 ? e.ownerDocument.body : Fe(e) && Or(e) ? e : Hs(mo(e)); } function Fn(e, t) { var n; t === void 0 && (t = []); var o = Hs(e), r = o === ((n = e.ownerDocument) == null ? void 0 : n.body), a = Ie(o), s = r ? [a].concat(a.visualViewport || [], Or(o) ? o : []) : o, i = t.concat(s); return r ? i : i.concat(Fn(mo(s))); } function Xo(e) { return Object.assign({}, e, { left: e.x, top: e.y, right: e.x + e.width, bottom: e.y + e.height }); } function r0(e) { var t = en(e); return t.top = t.top + e.clientTop, t.left = t.left + e.clientLeft, t.bottom = t.top + e.clientHeight, t.right = t.left + e.clientWidth, t.width = e.clientWidth, t.height = e.clientHeight, t.x = t.left, t.y = t.top, t; } function Ea(e, t) { return t === Ps ? Xo(n0(e)) : Xt(t) ? r0(t) : Xo(o0(yt(e))); } function a0(e) { var t = Fn(mo(e)), n = ["absolute", "fixed"].indexOf(rt(e).position) >= 0, o = n && Fe(e) ? An(e) : e; return Xt(o) ? t.filter(function(r) { return Xt(r) && Ms(r, o) && je(r) !== "body"; }) : []; } function s0(e, t, n) { var o = t === "clippingParents" ? a0(e) : [].concat(t), r = [].concat(o, [n]), a = r[0], s = r.reduce(function(i, l) { var u = Ea(e, l); return i.top = Et(u.top, i.top), i.right = no(u.right, i.right), i.bottom = no(u.bottom, i.bottom), i.left = Et(u.left, i.left), i; }, Ea(e, a)); return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s; } function Vs(e) { var t = e.reference, n = e.element, o = e.placement, r = o ? ze(o) : null, a = o ? tn(o) : null, s = t.x + t.width / 2 - n.width / 2, i = t.y + t.height / 2 - n.height / 2, l; switch (r) { case ce: l = { x: s, y: t.y - n.height }; break; case Ce: l = { x: s, y: t.y + t.height }; break; case Se: l = { x: t.x + t.width, y: i }; break; case de: l = { x: t.x - n.width, y: i }; break; default: l = { x: t.x, y: t.y }; } var u = r ? Fr(r) : null; if (u != null) { var c = u === "y" ? "height" : "width"; switch (a) { case Jt: l[u] = l[u] - (t[c] / 2 - n[c] / 2); break; case _n: l[u] = l[u] + (t[c] / 2 - n[c] / 2); break; } } return l; } function En(e, t) { t === void 0 && (t = {}); var n = t, o = n.placement, r = o === void 0 ? e.placement : o, a = n.boundary, s = a === void 0 ? kp : a, i = n.rootBoundary, l = i === void 0 ? Ps : i, u = n.elementContext, c = u === void 0 ? yn : u, d = n.altBoundary, v = d === void 0 ? false : d, g = n.padding, f = g === void 0 ? 0 : g, p = Ns(typeof f != "number" ? f : Bs(f, $n)), m = c === yn ? Ip : yn, y = e.rects.popper, C = e.elements[v ? m : c], $ = s0(Xt(C) ? C : C.contextElement || yt(e.elements.popper), s, l), S = en(e.elements.reference), x = Vs({ reference: S, element: y, strategy: "absolute", placement: r }), O = Xo(Object.assign({}, y, x)), E = c === yn ? O : S, A = { top: $.top - E.top + p.top, bottom: E.bottom - $.bottom + p.bottom, left: $.left - E.left + p.left, right: E.right - $.right + p.right }, L = e.modifiersData.offset; if (c === yn && L) { var H = L[r]; Object.keys(A).forEach(function(Z) { var K = [Se, Ce].indexOf(Z) >= 0 ? 1 : -1, X = [ce, Ce].indexOf(Z) >= 0 ? "y" : "x"; A[Z] += H[X] * K; }); } return A; } function i0(e, t) { t === void 0 && (t = {}); var n = t, o = n.placement, r = n.boundary, a = n.rootBoundary, s = n.padding, i = n.flipVariations, l = n.allowedAutoPlacements, u = l === void 0 ? go : l, c = tn(o), d = c ? i ? Sa : Sa.filter(function(f) { return tn(f) === c; }) : $n, v = d.filter(function(f) { return u.indexOf(f) >= 0; }); v.length === 0 && (v = d); var g = v.reduce(function(f, p) { return f[p] = En(e, { placement: p, boundary: r, rootBoundary: a, padding: s })[ze(p)], f; }, {}); return Object.keys(g).sort(function(f, p) { return g[f] - g[p]; }); } function l0(e) { if (ze(e) === br) return []; var t = Jn(e); return [_a(e), t, _a(t)]; } function u0(e) { var t = e.state, n = e.options, o = e.name; if (!t.modifiersData[o]._skip) { for (var r = n.mainAxis, a = r === void 0 ? true : r, s = n.altAxis, i = s === void 0 ? true : s, l = n.fallbackPlacements, u = n.padding, c = n.boundary, d = n.rootBoundary, v = n.altBoundary, g = n.flipVariations, f = g === void 0 ? true : g, p = n.allowedAutoPlacements, m = t.options.placement, y = ze(m), C = y === m, $ = l || (C || !f ? [Jn(m)] : l0(m)), S = [m].concat($).reduce(function($e, le) { return $e.concat(ze(le) === br ? i0(t, { placement: le, boundary: c, rootBoundary: d, padding: u, flipVariations: f, allowedAutoPlacements: p }) : le); }, []), x = t.rects.reference, O = t.rects.popper, E = /* @__PURE__ */ new Map(), A = true, L = S[0], H = 0; H < S.length; H++) { var Z = S[H], K = ze(Z), X = tn(Z) === Jt, be = [ce, Ce].indexOf(K) >= 0, re2 = be ? "width" : "height", k = En(t, { placement: Z, boundary: c, rootBoundary: d, altBoundary: v, padding: u }), q = be ? X ? Se : de : X ? Ce : ce; x[re2] > O[re2] && (q = Jn(q)); var Ke = Jn(q), fe = []; if (a && fe.push(k[K] <= 0), i && fe.push(k[q] <= 0, k[Ke] <= 0), fe.every(function($e) { return $e; })) { L = Z, A = false; break; } E.set(Z, fe); } if (A) for (var Rt = f ? 3 : 1, Nt = function($e) { var le = S.find(function(oe) { var wt = E.get(oe); if (wt) return wt.slice(0, $e).every(function(lt) { return lt; }); }); if (le) return L = le, "break"; }, bt = Rt; bt > 0; bt--) { var Bt = Nt(bt); if (Bt === "break") break; } t.placement !== L && (t.modifiersData[o]._skip = true, t.placement = L, t.reset = true); } } var c0 = { name: "flip", enabled: true, phase: "main", fn: u0, requiresIfExists: ["offset"], data: { _skip: false } }; function ka(e, t, n) { return n === void 0 && (n = { x: 0, y: 0 }), { top: e.top - t.height - n.y, right: e.right - t.width + n.x, bottom: e.bottom - t.height + n.y, left: e.left - t.width - n.x }; } function Ia(e) { return [ce, Se, Ce, de].some(function(t) { return e[t] >= 0; }); } function d0(e) { var t = e.state, n = e.name, o = t.rects.reference, r = t.rects.popper, a = t.modifiersData.preventOverflow, s = En(t, { elementContext: "reference" }), i = En(t, { altBoundary: true }), l = ka(s, o), u = ka(i, r, a), c = Ia(l), d = Ia(u); t.modifiersData[n] = { referenceClippingOffsets: l, popperEscapeOffsets: u, isReferenceHidden: c, hasPopperEscaped: d }, t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-reference-hidden": c, "data-popper-escaped": d }); } var f0 = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: d0 }; function p0(e, t, n) { var o = ze(e), r = [de, ce].indexOf(o) >= 0 ? -1 : 1, a = typeof n == "function" ? n(Object.assign({}, t, { placement: e })) : n, s = a[0], i = a[1]; return s = s || 0, i = (i || 0) * r, [de, Se].indexOf(o) >= 0 ? { x: i, y: s } : { x: s, y: i }; } function v0(e) { var t = e.state, n = e.options, o = e.name, r = n.offset, a = r === void 0 ? [0, 0] : r, s = go.reduce(function(c, d) { return c[d] = p0(d, t.rects, a), c; }, {}), i = s[t.placement], l = i.x, u = i.y; t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += l, t.modifiersData.popperOffsets.y += u), t.modifiersData[o] = s; } var h0 = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: v0 }; function g0(e) { var t = e.state, n = e.name; t.modifiersData[n] = Vs({ reference: t.rects.reference, element: t.rects.popper, strategy: "absolute", placement: t.placement }); } var js = { name: "popperOffsets", enabled: true, phase: "read", fn: g0, data: {} }; function m0(e) { return e === "x" ? "y" : "x"; } function y0(e) { var t = e.state, n = e.options, o = e.name, r = n.mainAxis, a = r === void 0 ? true : r, s = n.altAxis, i = s === void 0 ? false : s, l = n.boundary, u = n.rootBoundary, c = n.altBoundary, d = n.padding, v = n.tether, g = v === void 0 ? true : v, f = n.tetherOffset, p = f === void 0 ? 0 : f, m = En(t, { boundary: l, rootBoundary: u, padding: d, altBoundary: c }), y = ze(t.placement), C = tn(t.placement), $ = !C, S = Fr(y), x = m0(S), O = t.modifiersData.popperOffsets, E = t.rects.reference, A = t.rects.popper, L = typeof p == "function" ? p(Object.assign({}, t.rects, { placement: t.placement })) : p, H = typeof L == "number" ? { mainAxis: L, altAxis: L } : Object.assign({ mainAxis: 0, altAxis: 0 }, L), Z = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, K = { x: 0, y: 0 }; if (O) { if (a) { var X, be = S === "y" ? ce : de, re2 = S === "y" ? Ce : Se, k = S === "y" ? "height" : "width", q = O[S], Ke = q + m[be], fe = q - m[re2], Rt = g ? -A[k] / 2 : 0, Nt = C === Jt ? E[k] : A[k], bt = C === Jt ? -A[k] : -E[k], Bt = t.elements.arrow, $e = g && Bt ? xr(Bt) : { width: 0, height: 0 }, le = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : Rs(), oe = le[be], wt = le[re2], lt = xn(0, E[k], $e[k]), Mn = $ ? E[k] / 2 - Rt - lt - oe - H.mainAxis : Nt - lt - oe - H.mainAxis, Rn = $ ? -E[k] / 2 + Rt + lt + wt + H.mainAxis : bt + lt + wt + H.mainAxis, un = t.elements.arrow && An(t.elements.arrow), Co = un ? S === "y" ? un.clientTop || 0 : un.clientLeft || 0 : 0, Nn = (X = Z == null ? void 0 : Z[S]) != null ? X : 0, So = q + Mn - Nn - Co, Oo = q + Rn - Nn, xt = xn(g ? no(Ke, So) : Ke, q, g ? Et(fe, Oo) : fe); O[S] = xt, K[S] = xt - q; } if (i) { var cn, Dt = S === "x" ? ce : de, Bn = S === "x" ? Ce : Se, Ge = O[x], zt = x === "y" ? "height" : "width", dn = Ge + m[Dt], Dn = Ge - m[Bn], Ft = [ce, de].indexOf(y) !== -1, fn = (cn = Z == null ? void 0 : Z[x]) != null ? cn : 0, pn = Ft ? dn : Ge - E[zt] - A[zt] - fn + H.altAxis, vn = Ft ? Ge + E[zt] + A[zt] - fn - H.altAxis : Dn, hn = g && Ft ? Kp(pn, Ge, vn) : xn(g ? pn : dn, Ge, g ? vn : Dn); O[x] = hn, K[x] = hn - Ge; } t.modifiersData[o] = K; } } var b0 = { name: "preventOverflow", enabled: true, phase: "main", fn: y0, requiresIfExists: ["offset"] }; function w0(e) { return { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop }; } function x0(e) { return e === Ie(e) || !Fe(e) ? Cr(e) : w0(e); } function F0(e) { var t = e.getBoundingClientRect(), n = Qt(t.width) / e.offsetWidth || 1, o = Qt(t.height) / e.offsetHeight || 1; return n !== 1 || o !== 1; } function C0(e, t, n) { n === void 0 && (n = false); var o = Fe(t), r = Fe(t) && F0(t), a = yt(t), s = en(e, r), i = { scrollLeft: 0, scrollTop: 0 }, l = { x: 0, y: 0 }; return (o || !o && !n) && ((je(t) !== "body" || Or(a)) && (i = x0(t)), Fe(t) ? (l = en(t, true), l.x += t.clientLeft, l.y += t.clientTop) : a && (l.x = Sr(a))), { x: s.left + i.scrollLeft - l.x, y: s.top + i.scrollTop - l.y, width: s.width, height: s.height }; } function S0(e) { var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), o = []; e.forEach(function(a) { t.set(a.name, a); }); function r(a) { n.add(a.name); var s = [].concat(a.requires || [], a.requiresIfExists || []); s.forEach(function(i) { if (!n.has(i)) { var l = t.get(i); l && r(l); } }), o.push(a); } return e.forEach(function(a) { n.has(a.name) || r(a); }), o; } function O0(e) { var t = S0(e); return zp.reduce(function(n, o) { return n.concat(t.filter(function(r) { return r.phase === o; })); }, []); } function T0(e) { var t; return function() { return t || (t = new Promise(function(n) { Promise.resolve().then(function() { t = void 0, n(e()); }); })), t; }; } function _0(e) { var t = e.reduce(function(n, o) { var r = n[o.name]; return n[o.name] = r ? Object.assign({}, r, o, { options: Object.assign({}, r.options, o.options), data: Object.assign({}, r.data, o.data) }) : o, n; }, {}); return Object.keys(t).map(function(n) { return t[n]; }); } var $a = { placement: "bottom", modifiers: [], strategy: "absolute" }; function Aa() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n]; return !t.some(function(o) { return !(o && typeof o.getBoundingClientRect == "function"); }); } function Tr(e) { e === void 0 && (e = {}); var t = e, n = t.defaultModifiers, o = n === void 0 ? [] : n, r = t.defaultOptions, a = r === void 0 ? $a : r; return function(s, i, l) { l === void 0 && (l = a); var u = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, $a, a), modifiersData: {}, elements: { reference: s, popper: i }, attributes: {}, styles: {} }, c = [], d = false, v = { state: u, setOptions: function(p) { var m = typeof p == "function" ? p(u.options) : p; f(), u.options = Object.assign({}, a, u.options, m), u.scrollParents = { reference: Xt(s) ? Fn(s) : s.contextElement ? Fn(s.contextElement) : [], popper: Fn(i) }; var y = O0(_0([].concat(o, u.options.modifiers))); return u.orderedModifiers = y.filter(function(C) { return C.enabled; }), g(), v.update(); }, forceUpdate: function() { if (!d) { var p = u.elements, m = p.reference, y = p.popper; if (Aa(m, y)) { u.rects = { reference: C0(m, An(y), u.options.strategy === "fixed"), popper: xr(y) }, u.reset = false, u.placement = u.options.placement, u.orderedModifiers.forEach(function(A) { return u.modifiersData[A.name] = Object.assign({}, A.data); }); for (var C = 0; C < u.orderedModifiers.length; C++) { if (u.reset === true) { u.reset = false, C = -1; continue; } var $ = u.orderedModifiers[C], S = $.fn, x = $.options, O = x === void 0 ? {} : x, E = $.name; typeof S == "function" && (u = S({ state: u, options: O, name: E, instance: v }) || u); } } } }, update: T0(function() { return new Promise(function(p) { v.forceUpdate(), p(u); }); }), destroy: function() { f(), d = true; } }; if (!Aa(s, i)) return v; v.setOptions(l).then(function(p) { !d && l.onFirstUpdate && l.onFirstUpdate(p); }); function g() { u.orderedModifiers.forEach(function(p) { var m = p.name, y = p.options, C = y === void 0 ? {} : y, $ = p.effect; if (typeof $ == "function") { var S = $({ state: u, name: m, instance: v, options: C }), x = function() { }; c.push(S || x); } }); } function f() { c.forEach(function(p) { return p(); }), c = []; } return v; }; } Tr(); var E0 = [zs, js, Ds, Ls]; Tr({ defaultModifiers: E0 }); var k0 = [zs, js, Ds, Ls, h0, c0, b0, Zp, f0]; var I0 = Tr({ defaultModifiers: k0 }); var $0 = (e, t, n = {}) => { const o = { name: "updateState", enabled: true, phase: "write", fn: ({ state: l }) => { const u = A0(l); Object.assign(s.value, u); }, requires: ["computeStyles"] }, r = computed(() => { const { onFirstUpdate: l, placement: u, strategy: c, modifiers: d } = unref(n); return { onFirstUpdate: l, placement: u || "bottom", strategy: c || "absolute", modifiers: [ ...d || [], o, { name: "applyStyles", enabled: false } ] }; }), a = shallowRef(), s = ref({ styles: { popper: { position: unref(r).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), i = () => { a.value && (a.value.destroy(), a.value = void 0); }; return watch(r, (l) => { const u = unref(a); u && u.setOptions(l); }, { deep: true }), watch([e, t], ([l, u]) => { i(), !(!l || !u) && (a.value = I0(l, u, unref(r))); }), onBeforeUnmount(() => { i(); }), { state: computed(() => { var l; return { ...((l = unref(a)) == null ? void 0 : l.state) || {} }; }), styles: computed(() => unref(s).styles), attributes: computed(() => unref(s).attributes), update: () => { var l; return (l = unref(a)) == null ? void 0 : l.update(); }, forceUpdate: () => { var l; return (l = unref(a)) == null ? void 0 : l.forceUpdate(); }, instanceRef: computed(() => unref(a)) }; }; function A0(e) { const t = Object.keys(e.elements), n = Yo(t.map((r) => [r, e.styles[r] || {}])), o = Yo(t.map((r) => [r, e.attributes[r]])); return { styles: n, attributes: o }; } function Pa() { let e; const t = (o, r) => { n(), e = window.setTimeout(o, r); }, n = () => window.clearTimeout(e); return ao(() => n()), { registerTimeout: t, cancelTimeout: n }; } var Qo = { prefix: Math.floor(Math.random() * 1e4), current: 0 }; var P0 = Symbol("elIdInjection"); var _r = () => getCurrentInstance() ? inject(P0, Qo) : Qo; var yo = (e) => { const t = _r(); !se && t === Qo && Ve("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed usage: app.provide(ID_INJECTION_KEY, { prefix: number, current: number, })`); const n = yr(); return computed(() => unref(e) || `${n.value}-id-${t.prefix}-${t.current++}`); }; var Kt = []; var La = (e) => { const t = e; t.key === Tn.esc && Kt.forEach((n) => n(t)); }; var L0 = (e) => { onMounted(() => { Kt.length === 0 && document.addEventListener("keydown", La), se && Kt.push(e); }), onBeforeUnmount(() => { Kt = Kt.filter((t) => t !== e), Kt.length === 0 && se && document.removeEventListener("keydown", La); }); }; var Ma; var Us = () => { const e = yr(), t = _r(), n = computed(() => `${e.value}-popper-container-${t.prefix}`), o = computed(() => `#${n.value}`); return { id: n, selector: o }; }; var M0 = (e) => { const t = document.createElement("div"); return t.id = e, document.body.appendChild(t), t; }; var R0 = () => { const { id: e, selector: t } = Us(); return onBeforeMount(() => { se && (Pt.env.NODE_ENV === "test" || !Ma || !document.body.querySelector(t.value)) && (Ma = M0(e.value)); }), { id: e, selector: t }; }; var N0 = ee({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }); var B0 = ({ showAfter: e, hideAfter: t, autoClose: n, open: o, close: r }) => { const { registerTimeout: a } = Pa(), { registerTimeout: s, cancelTimeout: i } = Pa(); return { onOpen: (c) => { a(() => { o(c); const d = unref(n); xe(d) && d > 0 && s(() => { r(c); }, d); }, unref(e)); }, onClose: (c) => { i(), a(() => { r(c); }, unref(t)); } }; }; var Ks = Symbol("elForwardRef"); var D0 = (e) => { provide(Ks, { setForwardRef: (n) => { e.value = n; } }); }; var z0 = (e) => ({ mounted(t) { e(t); }, updated(t) { e(t); }, unmounted() { e(null); } }); var Ra = { current: 0 }; var Na = ref(0); var H0 = 2e3; var Ba = Symbol("elZIndexContextKey"); var V0 = Symbol("zIndexContextKey"); var j0 = (e) => { const t = getCurrentInstance() ? inject(Ba, Ra) : Ra, n = getCurrentInstance() ? inject(V0, void 0) : void 0, o = computed(() => { const s = unref(n); return xe(s) ? s : H0; }), r = computed(() => o.value + Na.value), a = () => (t.current++, Na.value = t.current, r.value); return !se && !inject(Ba) && Ve("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), { initialZIndex: o, currentZIndex: r, nextZIndex: a }; }; var Gs = po({ type: String, values: $s, required: false }); var U0 = Symbol("size"); var K0 = () => { const e = inject(U0, {}); return computed(() => unref(e.size) || ""); }; function G0(e, { beforeFocus: t, afterFocus: n, beforeBlur: o, afterBlur: r } = {}) { const a = getCurrentInstance(), { emit: s } = a, i = shallowRef(), l = ref(false), u = (v) => { ue(t) && t(v) || l.value || (l.value = true, s("focus", v), n == null || n()); }, c = (v) => { var g; ue(o) && o(v) || v.relatedTarget && ((g = i.value) != null && g.contains(v.relatedTarget)) || (l.value = false, s("blur", v), r == null || r()); }, d = () => { var v, g; (v = i.value) != null && v.contains(document.activeElement) && i.value !== document.activeElement || (g = e.value) == null || g.focus(); }; return watch(i, (v) => { v && v.setAttribute("tabindex", "-1"); }), Te(i, "focus", u, true), Te(i, "blur", c, true), Te(i, "click", d, true), Pt.env.NODE_ENV === "test" && onMounted(() => { const v = _t(e.value) ? e.value : document.querySelector("input,textarea"); v && (Te(v, "focus", u, true), Te(v, "blur", c, true)); }), { isFocused: l, wrapperRef: i, handleFocus: u, handleBlur: c }; } function W0({ afterComposition: e, emit: t }) { const n = ref(false), o = (i) => { t == null || t("compositionstart", i), n.value = true; }, r = (i) => { var l; t == null || t("compositionupdate", i); const u = (l = i.target) == null ? void 0 : l.value, c = u[u.length - 1] || ""; n.value = !hp(c); }, a = (i) => { t == null || t("compositionend", i), n.value && (n.value = false, nextTick(() => e(i))); }; return { isComposing: n, handleComposition: (i) => { i.type === "compositionend" ? a(i) : r(i); }, handleCompositionStart: o, handleCompositionUpdate: r, handleCompositionEnd: a }; } var q0 = Symbol("emptyValuesContextKey"); var Z0 = "use-empty-values"; var Y0 = ["", void 0, null]; var J0 = void 0; var X0 = ee({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (e) => ue(e) ? !e() : !e } }); var Q0 = (e, t) => { const n = getCurrentInstance() ? inject(q0, ref({})) : ref({}), o = computed(() => e.emptyValues || n.value.emptyValues || Y0), r = computed(() => ue(e.valueOnClear) ? e.valueOnClear() : e.valueOnClear !== void 0 ? e.valueOnClear : ue(n.value.valueOnClear) ? n.value.valueOnClear() : n.value.valueOnClear !== void 0 ? n.value.valueOnClear : J0), a = (s) => o.value.includes(s); return o.value.includes(r.value) || Ve(Z0, "value-on-clear should be a value of empty-values"), { emptyValues: o, valueOnClear: r, isEmptyValue: a }; }; var ev = ee({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }); var bo = (e) => Jf(ev, e); var tv = Symbol(); var Da = ref(); function nv(e, t = void 0) { const n = getCurrentInstance() ? inject(tv, Da) : Da; return computed(() => { var o, r; return (r = (o = n.value) == null ? void 0 : o[e]) != null ? r : t; }); } var J = (e, t) => { const n = e.__vccOpts || e; for (const [o, r] of t) n[o] = r; return n; }; var ov = ee({ size: { type: D([Number, String]) }, color: { type: String } }); var rv = defineComponent({ name: "ElIcon", inheritAttrs: false }); var av = defineComponent({ ...rv, props: ov, setup(e) { const t = e, n = te("icon"), o = computed(() => { const { size: r, color: a } = t; return !r && !a ? {} : { fontSize: bn(r) ? void 0 : to(r), "--color": a }; }); return (r, a) => (openBlock(), createElementBlock("i", mergeProps({ class: unref(n).b(), style: unref(o) }, r.$attrs), [ renderSlot(r.$slots, "default") ], 16)); } }); var sv = J(av, [["__file", "icon.vue"]]); var nn = ke(sv); var Er = Symbol("formContextKey"); var oo = Symbol("formItemContextKey"); var kr = (e, t = {}) => { const n = ref(void 0), o = t.prop ? n : As("size"), r = t.global ? n : K0(), a = t.form ? { size: void 0 } : inject(Er, void 0), s = t.formItem ? { size: void 0 } : inject(oo, void 0); return computed(() => o.value || unref(e) || (s == null ? void 0 : s.size) || (a == null ? void 0 : a.size) || r.value || ""); }; var Ws = (e) => { const t = As("disabled"), n = inject(Er, void 0); return computed(() => t.value || unref(e) || (n == null ? void 0 : n.disabled) || false); }; var qs = () => { const e = inject(Er, void 0), t = inject(oo, void 0); return { form: e, formItem: t }; }; var iv = (e, { formItemContext: t, disableIdGeneration: n, disableIdManagement: o }) => { n || (n = ref(false)), o || (o = ref(false)); const r = ref(); let a; const s = computed(() => { var i; return !!(!(e.label || e.ariaLabel) && t && t.inputIds && ((i = t.inputIds) == null ? void 0 : i.length) <= 1); }); return onMounted(() => { a = watch([toRef(e, "id"), n], ([i, l]) => { const u = i ?? (l ? void 0 : yo().value); u !== r.value && (t != null && t.removeInputId && (r.value && t.removeInputId(r.value), !(o != null && o.value) && !l && u && t.addInputId(u)), r.value = u); }, { immediate: true }); }), onUnmounted(() => { a && a(), t != null && t.removeInputId && r.value && t.removeInputId(r.value); }), { isLabeledByFormItem: s, inputId: r }; }; var Vt = 4; var lv = { vertical: { offset: "offsetHeight", scroll: "scrollTop", scrollSize: "scrollHeight", size: "height", key: "vertical", axis: "Y", client: "clientY", direction: "top" }, horizontal: { offset: "offsetWidth", scroll: "scrollLeft", scrollSize: "scrollWidth", size: "width", key: "horizontal", axis: "X", client: "clientX", direction: "left" } }; var uv = ({ move: e, size: t, bar: n }) => ({ [n.size]: t, transform: `translate${n.axis}(${e}%)` }); var Ir = Symbol("scrollbarContextKey"); var cv = ee({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: true }, always: Boolean }); var dv = "Thumb"; var fv = defineComponent({ __name: "thumb", props: cv, setup(e) { const t = e, n = inject(Ir), o = te("scrollbar"); n || ep(dv, "can not inject scrollbar context"); const r = ref(), a = ref(), s = ref({}), i = ref(false); let l = false, u = false, c = se ? document.onselectstart : null; const d = computed(() => lv[t.vertical ? "vertical" : "horizontal"]), v = computed(() => uv({ size: t.size, move: t.move, bar: d.value })), g = computed(() => r.value[d.value.offset] ** 2 / n.wrapElement[d.value.scrollSize] / t.ratio / a.value[d.value.offset]), f = (O) => { var E; if (O.stopPropagation(), O.ctrlKey || [1, 2].includes(O.button)) return; (E = window.getSelection()) == null || E.removeAllRanges(), m(O); const A = O.currentTarget; A && (s.value[d.value.axis] = A[d.value.offset] - (O[d.value.client] - A.getBoundingClientRect()[d.value.direction])); }, p = (O) => { if (!a.value || !r.value || !n.wrapElement) return; const E = Math.abs(O.target.getBoundingClientRect()[d.value.direction] - O[d.value.client]), A = a.value[d.value.offset] / 2, L = (E - A) * 100 * g.value / r.value[d.value.offset]; n.wrapElement[d.value.scroll] = L * n.wrapElement[d.value.scrollSize] / 100; }, m = (O) => { O.stopImmediatePropagation(), l = true, document.addEventListener("mousemove", y), document.addEventListener("mouseup", C), c = document.onselectstart, document.onselectstart = () => false; }, y = (O) => { if (!r.value || !a.value || l === false) return; const E = s.value[d.value.axis]; if (!E) return; const A = (r.value.getBoundingClientRect()[d.value.direction] - O[d.value.client]) * -1, L = a.value[d.value.offset] - E, H = (A - L) * 100 * g.value / r.value[d.value.offset]; n.wrapElement[d.value.scroll] = H * n.wrapElement[d.value.scrollSize] / 100; }, C = () => { l = false, s.value[d.value.axis] = 0, document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", C), x(), u && (i.value = false); }, $ = () => { u = false, i.value = !!t.size; }, S = () => { u = true, i.value = l; }; onBeforeUnmount(() => { x(), document.removeEventListener("mouseup", C); }); const x = () => { document.onselectstart !== c && (document.onselectstart = c); }; return Te(toRef(n, "scrollbarElement"), "mousemove", $), Te(toRef(n, "scrollbarElement"), "mouseleave", S), (O, E) => (openBlock(), createBlock(Transition, { name: unref(o).b("fade"), persisted: "" }, { default: withCtx(() => [ withDirectives(createBaseVNode("div", { ref_key: "instance", ref: r, class: normalizeClass([unref(o).e("bar"), unref(o).is(unref(d).key)]), onMousedown: p }, [ createBaseVNode("div", { ref_key: "thumb", ref: a, class: normalizeClass(unref(o).e("thumb")), style: normalizeStyle(unref(v)), onMousedown: f }, null, 38) ], 34), [ [vShow, O.always || i.value] ]) ]), _: 1 }, 8, ["name"])); } }); var za = J(fv, [["__file", "thumb.vue"]]); var pv = ee({ always: { type: Boolean, default: true }, minSize: { type: Number, required: true } }); var vv = defineComponent({ __name: "bar", props: pv, setup(e, { expose: t }) { const n = e, o = inject(Ir), r = ref(0), a = ref(0), s = ref(""), i = ref(""), l = ref(1), u = ref(1); return t({ handleScroll: (v) => { if (v) { const g = v.offsetHeight - Vt, f = v.offsetWidth - Vt; a.value = v.scrollTop * 100 / g * l.value, r.value = v.scrollLeft * 100 / f * u.value; } }, update: () => { const v = o == null ? void 0 : o.wrapElement; if (!v) return; const g = v.offsetHeight - Vt, f = v.offsetWidth - Vt, p = g ** 2 / v.scrollHeight, m = f ** 2 / v.scrollWidth, y = Math.max(p, n.minSize), C = Math.max(m, n.minSize); l.value = p / (g - p) / (y / (g - y)), u.value = m / (f - m) / (C / (f - C)), i.value = y + Vt < g ? `${y}px` : "", s.value = C + Vt < f ? `${C}px` : ""; } }), (v, g) => (openBlock(), createElementBlock(Fragment, null, [ createVNode(za, { move: r.value, ratio: u.value, size: s.value, always: v.always }, null, 8, ["move", "ratio", "size", "always"]), createVNode(za, { move: a.value, ratio: l.value, size: i.value, vertical: "", always: v.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var hv = J(vv, [["__file", "bar.vue"]]); var gv = ee({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: false }, wrapStyle: { type: D([String, Object, Array]), default: "" }, wrapClass: { type: [String, Array], default: "" }, viewClass: { type: [String, Array], default: "" }, viewStyle: { type: [String, Array, Object], default: "" }, noresize: Boolean, tag: { type: String, default: "div" }, always: Boolean, minSize: { type: Number, default: 20 }, tabindex: { type: [String, Number], default: void 0 }, id: String, role: String, ...bo(["ariaLabel", "ariaOrientation"]) }); var mv = { scroll: ({ scrollTop: e, scrollLeft: t }) => [e, t].every(xe) }; var er = "ElScrollbar"; var yv = defineComponent({ name: er }); var bv = defineComponent({ ...yv, props: gv, emits: mv, setup(e, { expose: t, emit: n }) { const o = e, r = te("scrollbar"); let a, s, i = 0, l = 0; const u = ref(), c = ref(), d = ref(), v = ref(), g = computed(() => { const x = {}; return o.height && (x.height = to(o.height)), o.maxHeight && (x.maxHeight = to(o.maxHeight)), [o.wrapStyle, x]; }), f = computed(() => [ o.wrapClass, r.e("wrap"), { [r.em("wrap", "hidden-default")]: !o.native } ]), p = computed(() => [r.e("view"), o.viewClass]), m = () => { var x; c.value && ((x = v.value) == null || x.handleScroll(c.value), i = c.value.scrollTop, l = c.value.scrollLeft, n("scroll", { scrollTop: c.value.scrollTop, scrollLeft: c.value.scrollLeft })); }; function y(x, O) { Be(x) ? c.value.scrollTo(x) : xe(x) && xe(O) && c.value.scrollTo(x, O); } const C = (x) => { if (!xe(x)) { Ve(er, "value must be a number"); return; } c.value.scrollTop = x; }, $ = (x) => { if (!xe(x)) { Ve(er, "value must be a number"); return; } c.value.scrollLeft = x; }, S = () => { var x; (x = v.value) == null || x.update(); }; return watch(() => o.noresize, (x) => { x ? (a == null || a(), s == null || s()) : ({ stop: a } = pt(d, S), s = Te("resize", S)); }, { immediate: true }), watch(() => [o.maxHeight, o.height], () => { o.native || nextTick(() => { var x; S(), c.value && ((x = v.value) == null || x.handleScroll(c.value)); }); }), provide(Ir, reactive({ scrollbarElement: u, wrapElement: c })), onActivated(() => { c.value && (c.value.scrollTop = i, c.value.scrollLeft = l); }), onMounted(() => { o.native || nextTick(() => { S(); }); }), onUpdated(() => S()), t({ wrapRef: c, update: S, scrollTo: y, setScrollTop: C, setScrollLeft: $, handleScroll: m }), (x, O) => (openBlock(), createElementBlock("div", { ref_key: "scrollbarRef", ref: u, class: normalizeClass(unref(r).b()) }, [ createBaseVNode("div", { ref_key: "wrapRef", ref: c, class: normalizeClass(unref(f)), style: normalizeStyle(unref(g)), tabindex: x.tabindex, onScroll: m }, [ (openBlock(), createBlock(resolveDynamicComponent(x.tag), { id: x.id, ref_key: "resizeRef", ref: d, class: normalizeClass(unref(p)), style: normalizeStyle(x.viewStyle), role: x.role, "aria-label": x.ariaLabel, "aria-orientation": x.ariaOrientation }, { default: withCtx(() => [ renderSlot(x.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), x.native ? createCommentVNode("v-if", true) : (openBlock(), createBlock(hv, { key: 0, ref_key: "barRef", ref: v, always: x.always, "min-size": x.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var wv = J(bv, [["__file", "scrollbar.vue"]]); var xv = ke(wv); var $r = Symbol("popper"); var Zs = Symbol("popperContent"); var Fv = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ]; var Ys = ee({ role: { type: String, values: Fv, default: "tooltip" } }); var Cv = defineComponent({ name: "ElPopper", inheritAttrs: false }); var Sv = defineComponent({ ...Cv, props: Ys, setup(e, { expose: t }) { const n = e, o = ref(), r = ref(), a = ref(), s = ref(), i = computed(() => n.role), l = { triggerRef: o, popperInstanceRef: r, contentRef: a, referenceRef: s, role: i }; return t(l), provide($r, l), (u, c) => renderSlot(u.$slots, "default"); } }); var Ov = J(Sv, [["__file", "popper.vue"]]); var Js = ee({ arrowOffset: { type: Number, default: 5 } }); var Tv = defineComponent({ name: "ElPopperArrow", inheritAttrs: false }); var _v = defineComponent({ ...Tv, props: Js, setup(e, { expose: t }) { const n = e, o = te("popper"), { arrowOffset: r, arrowRef: a, arrowStyle: s } = inject(Zs, void 0); return watch(() => n.arrowOffset, (i) => { r.value = i; }), onBeforeUnmount(() => { a.value = void 0; }), t({ arrowRef: a }), (i, l) => (openBlock(), createElementBlock("span", { ref_key: "arrowRef", ref: a, class: normalizeClass(unref(o).e("arrow")), style: normalizeStyle(unref(s)), "data-popper-arrow": "" }, null, 6)); } }); var Ev = J(_v, [["__file", "arrow.vue"]]); var Po = "ElOnlyChild"; var kv = defineComponent({ name: Po, setup(e, { slots: t, attrs: n }) { var o; const r = inject(Ks), a = z0((o = r == null ? void 0 : r.setForwardRef) != null ? o : Xn); return () => { var s; const i = (s = t.default) == null ? void 0 : s.call(t, n); if (!i) return null; if (i.length > 1) return Ve(Po, "requires exact only one valid child."), null; const l = Xs(i); return l ? withDirectives(cloneVNode(l, n), [[a]]) : (Ve(Po, "no valid child node found"), null); }; } }); function Xs(e) { if (!e) return null; const t = e; for (const n of t) { if (Be(n)) switch (n.type) { case Comment: continue; case Text: case "svg": return Ha(n); case Fragment: return Xs(n.children); default: return n; } return Ha(n); } return null; } function Ha(e) { const t = te("only-child"); return createVNode("span", { class: t.e("content") }, [e]); } var Qs = ee({ virtualRef: { type: D(Object) }, virtualTriggering: Boolean, onMouseenter: { type: D(Function) }, onMouseleave: { type: D(Function) }, onClick: { type: D(Function) }, onKeydown: { type: D(Function) }, onFocus: { type: D(Function) }, onBlur: { type: D(Function) }, onContextmenu: { type: D(Function) }, id: String, open: Boolean }); var Iv = defineComponent({ name: "ElPopperTrigger", inheritAttrs: false }); var $v = defineComponent({ ...Iv, props: Qs, setup(e, { expose: t }) { const n = e, { role: o, triggerRef: r } = inject($r, void 0); D0(r); const a = computed(() => i.value ? n.id : void 0), s = computed(() => { if (o && o.value === "tooltip") return n.open && n.id ? n.id : void 0; }), i = computed(() => { if (o && o.value !== "tooltip") return o.value; }), l = computed(() => i.value ? `${n.open}` : void 0); let u; const c = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return onMounted(() => { watch(() => n.virtualRef, (d) => { d && (r.value = Qe(d)); }, { immediate: true }), watch(r, (d, v) => { u == null || u(), u = void 0, _t(d) && (c.forEach((g) => { var f; const p = n[g]; p && (d.addEventListener(g.slice(2).toLowerCase(), p), (f = v == null ? void 0 : v.removeEventListener) == null || f.call(v, g.slice(2).toLowerCase(), p)); }), u = watch([a, s, i, l], (g) => { [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((f, p) => { gr(g[p]) ? d.removeAttribute(f) : d.setAttribute(f, g[p]); }); }, { immediate: true })), _t(v) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((g) => v.removeAttribute(g)); }, { immediate: true }); }), onBeforeUnmount(() => { if (u == null || u(), u = void 0, r.value && _t(r.value)) { const d = r.value; c.forEach((v) => { const g = n[v]; g && d.removeEventListener(v.slice(2).toLowerCase(), g); }), r.value = void 0; } }), t({ triggerRef: r }), (d, v) => d.virtualTriggering ? createCommentVNode("v-if", true) : (openBlock(), createBlock(unref(kv), mergeProps({ key: 0 }, d.$attrs, { "aria-controls": unref(a), "aria-describedby": unref(s), "aria-expanded": unref(l), "aria-haspopup": unref(i) }), { default: withCtx(() => [ renderSlot(d.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var Av = J($v, [["__file", "trigger.vue"]]); var Lo = "focus-trap.focus-after-trapped"; var Mo = "focus-trap.focus-after-released"; var Pv = "focus-trap.focusout-prevented"; var Va = { cancelable: true, bubbles: false }; var Lv = { cancelable: true, bubbles: false }; var ja = "focusAfterTrapped"; var Ua = "focusAfterReleased"; var Mv = Symbol("elFocusTrap"); var Ar = ref(); var wo = ref(0); var Pr = ref(0); var Kn = 0; var ei = (e) => { const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (o) => { const r = o.tagName === "INPUT" && o.type === "hidden"; return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 || o === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; n.nextNode(); ) t.push(n.currentNode); return t; }; var Ka = (e, t) => { for (const n of e) if (!Rv(n, t)) return n; }; var Rv = (e, t) => { if (Pt.env.NODE_ENV === "test") return false; if (getComputedStyle(e).visibility === "hidden") return true; for (; e; ) { if (t && e === t) return false; if (getComputedStyle(e).display === "none") return true; e = e.parentElement; } return false; }; var Nv = (e) => { const t = ei(e), n = Ka(t, e), o = Ka(t.reverse(), e); return [n, o]; }; var Bv = (e) => e instanceof HTMLInputElement && "select" in e; var dt = (e, t) => { if (e && e.focus) { const n = document.activeElement; e.focus({ preventScroll: true }), Pr.value = window.performance.now(), e !== n && Bv(e) && t && e.select(); } }; function Ga(e, t) { const n = [...e], o = e.indexOf(t); return o !== -1 && n.splice(o, 1), n; } var Dv = () => { let e = []; return { push: (o) => { const r = e[0]; r && o !== r && r.pause(), e = Ga(e, o), e.unshift(o); }, remove: (o) => { var r, a; e = Ga(e, o), (a = (r = e[0]) == null ? void 0 : r.resume) == null || a.call(r); } }; }; var zv = (e, t = false) => { const n = document.activeElement; for (const o of e) if (dt(o, t), document.activeElement !== n) return; }; var Wa = Dv(); var Hv = () => wo.value > Pr.value; var Gn = () => { Ar.value = "pointer", wo.value = window.performance.now(); }; var qa = () => { Ar.value = "keyboard", wo.value = window.performance.now(); }; var Vv = () => (onMounted(() => { Kn === 0 && (document.addEventListener("mousedown", Gn), document.addEventListener("touchstart", Gn), document.addEventListener("keydown", qa)), Kn++; }), onBeforeUnmount(() => { Kn--, Kn <= 0 && (document.removeEventListener("mousedown", Gn), document.removeEventListener("touchstart", Gn), document.removeEventListener("keydown", qa)); }), { focusReason: Ar, lastUserFocusTimestamp: wo, lastAutomatedFocusTimestamp: Pr }); var Wn = (e) => new CustomEvent(Pv, { ...Lv, detail: e }); var jv = defineComponent({ name: "ElFocusTrap", inheritAttrs: false, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ ja, Ua, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(e, { emit: t }) { const n = ref(); let o, r; const { focusReason: a } = Vv(); L0((f) => { e.trapped && !s.paused && t("release-requested", f); }); const s = { paused: false, pause() { this.paused = true; }, resume() { this.paused = false; } }, i = (f) => { if (!e.loop && !e.trapped || s.paused) return; const { key: p, altKey: m, ctrlKey: y, metaKey: C, currentTarget: $, shiftKey: S } = f, { loop: x } = e, O = p === Tn.tab && !m && !y && !C, E = document.activeElement; if (O && E) { const A = $, [L, H] = Nv(A); if (L && H) { if (!S && E === H) { const K = Wn({ focusReason: a.value }); t("focusout-prevented", K), K.defaultPrevented || (f.preventDefault(), x && dt(L, true)); } else if (S && [L, A].includes(E)) { const K = Wn({ focusReason: a.value }); t("focusout-prevented", K), K.defaultPrevented || (f.preventDefault(), x && dt(H, true)); } } else if (E === A) { const K = Wn({ focusReason: a.value }); t("focusout-prevented", K), K.defaultPrevented || f.preventDefault(); } } }; provide(Mv, { focusTrapRef: n, onKeydown: i }), watch(() => e.focusTrapEl, (f) => { f && (n.value = f); }, { immediate: true }), watch([n], ([f], [p]) => { f && (f.addEventListener("keydown", i), f.addEventListener("focusin", c), f.addEventListener("focusout", d)), p && (p.removeEventListener("keydown", i), p.removeEventListener("focusin", c), p.removeEventListener("focusout", d)); }); const l = (f) => { t(ja, f); }, u = (f) => t(Ua, f), c = (f) => { const p = unref(n); if (!p) return; const m = f.target, y = f.relatedTarget, C = m && p.contains(m); e.trapped || y && p.contains(y) || (o = y), C && t("focusin", f), !s.paused && e.trapped && (C ? r = m : dt(r, true)); }, d = (f) => { const p = unref(n); if (!(s.paused || !p)) if (e.trapped) { const m = f.relatedTarget; !gr(m) && !p.contains(m) && setTimeout(() => { if (!s.paused && e.trapped) { const y = Wn({ focusReason: a.value }); t("focusout-prevented", y), y.defaultPrevented || dt(r, true); } }, 0); } else { const m = f.target; m && p.contains(m) || t("focusout", f); } }; async function v() { await nextTick(); const f = unref(n); if (f) { Wa.push(s); const p = f.contains(document.activeElement) ? o : document.activeElement; if (o = p, !f.contains(p)) { const y = new Event(Lo, Va); f.addEventListener(Lo, l), f.dispatchEvent(y), y.defaultPrevented || nextTick(() => { let C = e.focusStartEl; rn(C) || (dt(C), document.activeElement !== C && (C = "first")), C === "first" && zv(ei(f), true), (document.activeElement === p || C === "container") && dt(f); }); } } } function g() { const f = unref(n); if (f) { f.removeEventListener(Lo, l); const p = new CustomEvent(Mo, { ...Va, detail: { focusReason: a.value } }); f.addEventListener(Mo, u), f.dispatchEvent(p), !p.defaultPrevented && (a.value == "keyboard" || !Hv() || f.contains(document.activeElement)) && dt(o ?? document.body), f.removeEventListener(Mo, u), Wa.remove(s); } } return onMounted(() => { e.trapped && v(), watch(() => e.trapped, (f) => { f ? v() : g(); }); }), onBeforeUnmount(() => { e.trapped && g(), n.value && (n.value.removeEventListener("keydown", i), n.value.removeEventListener("focusin", c), n.value.removeEventListener("focusout", d), n.value = void 0); }), { onKeydown: i }; } }); function Uv(e, t, n, o, r, a) { return renderSlot(e.$slots, "default", { handleKeydown: e.onKeydown }); } var Kv = J(jv, [["render", Uv], ["__file", "focus-trap.vue"]]); var Gv = ["fixed", "absolute"]; var Wv = ee({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: D(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: true }, offset: { type: Number, default: 12 }, placement: { type: String, values: go, default: "bottom" }, popperOptions: { type: D(Object), default: () => ({}) }, strategy: { type: String, values: Gv, default: "absolute" } }); var ti = ee({ ...Wv, id: String, style: { type: D([String, Array, Object]) }, className: { type: D([String, Array, Object]) }, effect: { type: D(String), default: "dark" }, visible: Boolean, enterable: { type: Boolean, default: true }, pure: Boolean, focusOnShow: { type: Boolean, default: false }, trapping: { type: Boolean, default: false }, popperClass: { type: D([String, Array, Object]) }, popperStyle: { type: D([String, Array, Object]) }, referenceEl: { type: D(Object) }, triggerTargetEl: { type: D(Object) }, stopPopperMouseEvent: { type: Boolean, default: true }, virtualTriggering: Boolean, zIndex: Number, ...bo(["ariaLabel"]) }); var qv = { mouseenter: (e) => e instanceof MouseEvent, mouseleave: (e) => e instanceof MouseEvent, focus: () => true, blur: () => true, close: () => true }; var Zv = (e, t = []) => { const { placement: n, strategy: o, popperOptions: r } = e, a = { placement: n, strategy: o, ...r, modifiers: [...Jv(e), ...t] }; return Xv(a, r == null ? void 0 : r.modifiers), a; }; var Yv = (e) => { if (se) return Qe(e); }; function Jv(e) { const { offset: t, gpuAcceleration: n, fallbackPlacements: o } = e; return [ { name: "offset", options: { offset: [0, t ?? 12] } }, { name: "preventOverflow", options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: "flip", options: { padding: 5, fallbackPlacements: o } }, { name: "computeStyles", options: { gpuAcceleration: n } } ]; } function Xv(e, t) { t && (e.modifiers = [...e.modifiers, ...t ?? []]); } var Qv = 0; var eh = (e) => { const { popperInstanceRef: t, contentRef: n, triggerRef: o, role: r } = inject($r, void 0), a = ref(), s = ref(), i = computed(() => ({ name: "eventListeners", enabled: !!e.visible })), l = computed(() => { var y; const C = unref(a), $ = (y = unref(s)) != null ? y : Qv; return { name: "arrow", enabled: !Wf(C), options: { element: C, padding: $ } }; }), u = computed(() => ({ onFirstUpdate: () => { f(); }, ...Zv(e, [ unref(l), unref(i) ]) })), c = computed(() => Yv(e.referenceEl) || unref(o)), { attributes: d, state: v, styles: g, update: f, forceUpdate: p, instanceRef: m } = $0(c, n, u); return watch(m, (y) => t.value = y), onMounted(() => { watch(() => { var y; return (y = unref(c)) == null ? void 0 : y.getBoundingClientRect(); }, () => { f(); }); }), { attributes: d, arrowRef: a, contentRef: n, instanceRef: m, state: v, styles: g, role: r, forceUpdate: p, update: f }; }; var th = (e, { attributes: t, styles: n, role: o }) => { const { nextZIndex: r } = j0(), a = te("popper"), s = computed(() => unref(t).popper), i = ref(xe(e.zIndex) ? e.zIndex : r()), l = computed(() => [ a.b(), a.is("pure", e.pure), a.is(e.effect), e.popperClass ]), u = computed(() => [ { zIndex: unref(i) }, unref(n).popper, e.popperStyle || {} ]), c = computed(() => o.value === "dialog" ? "false" : void 0), d = computed(() => unref(n).arrow || {}); return { ariaModal: c, arrowStyle: d, contentAttrs: s, contentClass: l, contentStyle: u, contentZIndex: i, updateZIndex: () => { i.value = xe(e.zIndex) ? e.zIndex : r(); } }; }; var nh = (e, t) => { const n = ref(false), o = ref(); return { focusStartRef: o, trapped: n, onFocusAfterReleased: (u) => { var c; ((c = u.detail) == null ? void 0 : c.focusReason) !== "pointer" && (o.value = "first", t("blur")); }, onFocusAfterTrapped: () => { t("focus"); }, onFocusInTrap: (u) => { e.visible && !n.value && (u.target && (o.value = u.target), n.value = true); }, onFocusoutPrevented: (u) => { e.trapping || (u.detail.focusReason === "pointer" && u.preventDefault(), n.value = false); }, onReleaseRequested: () => { n.value = false, t("close"); } }; }; var oh = defineComponent({ name: "ElPopperContent" }); var rh = defineComponent({ ...oh, props: ti, emits: qv, setup(e, { expose: t, emit: n }) { const o = e, { focusStartRef: r, trapped: a, onFocusAfterReleased: s, onFocusAfterTrapped: i, onFocusInTrap: l, onFocusoutPrevented: u, onReleaseRequested: c } = nh(o, n), { attributes: d, arrowRef: v, contentRef: g, styles: f, instanceRef: p, role: m, update: y } = eh(o), { ariaModal: C, arrowStyle: $, contentAttrs: S, contentClass: x, contentStyle: O, updateZIndex: E } = th(o, { styles: f, attributes: d, role: m }), A = inject(oo, void 0), L = ref(); provide(Zs, { arrowStyle: $, arrowRef: v, arrowOffset: L }), A && provide(oo, { ...A, addInputId: Xn, removeInputId: Xn }); let H; const Z = (X = true) => { y(), X && E(); }, K = () => { Z(false), o.visible && o.focusOnShow ? a.value = true : o.visible === false && (a.value = false); }; return onMounted(() => { watch(() => o.triggerTargetEl, (X, be) => { H == null || H(), H = void 0; const re2 = unref(X || g.value), k = unref(be || g.value); _t(re2) && (H = watch([m, () => o.ariaLabel, C, () => o.id], (q) => { ["role", "aria-label", "aria-modal", "id"].forEach((Ke, fe) => { gr(q[fe]) ? re2.removeAttribute(Ke) : re2.setAttribute(Ke, q[fe]); }); }, { immediate: true })), k !== re2 && _t(k) && ["role", "aria-label", "aria-modal", "id"].forEach((q) => { k.removeAttribute(q); }); }, { immediate: true }), watch(() => o.visible, K, { immediate: true }); }), onBeforeUnmount(() => { H == null || H(), H = void 0; }), t({ popperContentRef: g, popperInstanceRef: p, updatePopper: Z, contentStyle: O }), (X, be) => (openBlock(), createElementBlock("div", mergeProps({ ref_key: "contentRef", ref: g }, unref(S), { style: unref(O), class: unref(x), tabindex: "-1", onMouseenter: (re2) => X.$emit("mouseenter", re2), onMouseleave: (re2) => X.$emit("mouseleave", re2) }), [ createVNode(unref(Kv), { trapped: unref(a), "trap-on-focus-in": true, "focus-trap-el": unref(g), "focus-start-el": unref(r), onFocusAfterTrapped: unref(i), onFocusAfterReleased: unref(s), onFocusin: unref(l), onFocusoutPrevented: unref(u), onReleaseRequested: unref(c) }, { default: withCtx(() => [ renderSlot(X.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var ah = J(rh, [["__file", "content.vue"]]); var sh = ke(Ov); var Lr = Symbol("elTooltip"); var he = ee({ ...N0, ...ti, appendTo: { type: D([String, Object]) }, content: { type: String, default: "" }, rawContent: Boolean, persistent: Boolean, visible: { type: D(Boolean), default: null }, transition: String, teleported: { type: Boolean, default: true }, disabled: Boolean, ...bo(["ariaLabel"]) }); var kn = ee({ ...Qs, disabled: Boolean, trigger: { type: D([String, Array]), default: "hover" }, triggerKeys: { type: D(Array), default: () => [Tn.enter, Tn.space] } }); var { useModelToggleProps: ih, useModelToggleEmits: lh, useModelToggle: uh } = Ep("visible"); var ch = ee({ ...Ys, ...ih, ...he, ...kn, ...Js, showArrow: { type: Boolean, default: true } }); var dh = [ ...lh, "before-show", "before-hide", "show", "hide", "open", "close" ]; var fh = (e, t) => Ne(e) ? e.includes(t) : e === t; var jt = (e, t, n) => (o) => { fh(unref(e), t) && n(o); }; var ph = defineComponent({ name: "ElTooltipTrigger" }); var vh = defineComponent({ ...ph, props: kn, setup(e, { expose: t }) { const n = e, o = te("tooltip"), { controlled: r, id: a, open: s, onOpen: i, onClose: l, onToggle: u } = inject(Lr, void 0), c = ref(null), d = () => { if (unref(r) || n.disabled) return true; }, v = toRef(n, "trigger"), g = Ze(d, jt(v, "hover", i)), f = Ze(d, jt(v, "hover", l)), p = Ze(d, jt(v, "click", (S) => { S.button === 0 && u(S); })), m = Ze(d, jt(v, "focus", i)), y = Ze(d, jt(v, "focus", l)), C = Ze(d, jt(v, "contextmenu", (S) => { S.preventDefault(), u(S); })), $ = Ze(d, (S) => { const { code: x } = S; n.triggerKeys.includes(x) && (S.preventDefault(), u(S)); }); return t({ triggerRef: c }), (S, x) => (openBlock(), createBlock(unref(Av), { id: unref(a), "virtual-ref": S.virtualRef, open: unref(s), "virtual-triggering": S.virtualTriggering, class: normalizeClass(unref(o).e("trigger")), onBlur: unref(y), onClick: unref(p), onContextmenu: unref(C), onFocus: unref(m), onMouseenter: unref(g), onMouseleave: unref(f), onKeydown: unref($) }, { default: withCtx(() => [ renderSlot(S.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var hh = J(vh, [["__file", "trigger.vue"]]); var gh = ee({ to: { type: D([String, Object]), required: true }, disabled: Boolean }); var mh = defineComponent({ __name: "teleport", props: gh, setup(e) { return (t, n) => t.disabled ? renderSlot(t.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport, { key: 1, to: t.to }, [ renderSlot(t.$slots, "default") ], 8, ["to"])); } }); var yh = J(mh, [["__file", "teleport.vue"]]); var bh = ke(yh); var wh = defineComponent({ name: "ElTooltipContent", inheritAttrs: false }); var xh = defineComponent({ ...wh, props: he, setup(e, { expose: t }) { const n = e, { selector: o } = Us(), r = te("tooltip"), a = ref(null); let s; const { controlled: i, id: l, open: u, trigger: c, onClose: d, onOpen: v, onShow: g, onHide: f, onBeforeShow: p, onBeforeHide: m } = inject(Lr, void 0), y = computed(() => n.transition || `${r.namespace.value}-fade-in-linear`), C = computed(() => Pt.env.NODE_ENV === "test" ? true : n.persistent); onBeforeUnmount(() => { s == null || s(); }); const $ = computed(() => unref(C) ? true : unref(u)), S = computed(() => n.disabled ? false : unref(u)), x = computed(() => n.appendTo || o.value), O = computed(() => { var k; return (k = n.style) != null ? k : {}; }), E = ref(true), A = () => { f(), E.value = true; }, L = () => { if (unref(i)) return true; }, H = Ze(L, () => { n.enterable && unref(c) === "hover" && v(); }), Z = Ze(L, () => { unref(c) === "hover" && d(); }), K = () => { var k, q; (q = (k = a.value) == null ? void 0 : k.updatePopper) == null || q.call(k), p == null || p(); }, X = () => { m == null || m(); }, be = () => { g(), s = jl(computed(() => { var k; return (k = a.value) == null ? void 0 : k.popperContentRef; }), () => { if (unref(i)) return; unref(c) !== "hover" && d(); }); }, re2 = () => { n.virtualTriggering || d(); }; return watch(() => unref(u), (k) => { k ? E.value = false : s == null || s(); }, { flush: "post" }), watch(() => n.content, () => { var k, q; (q = (k = a.value) == null ? void 0 : k.updatePopper) == null || q.call(k); }), t({ contentRef: a }), (k, q) => (openBlock(), createBlock(unref(bh), { disabled: !k.teleported, to: unref(x) }, { default: withCtx(() => [ createVNode(Transition, { name: unref(y), onAfterLeave: A, onBeforeEnter: K, onAfterEnter: be, onBeforeLeave: X }, { default: withCtx(() => [ unref($) ? withDirectives((openBlock(), createBlock(unref(ah), mergeProps({ key: 0, id: unref(l), ref_key: "contentRef", ref: a }, k.$attrs, { "aria-label": k.ariaLabel, "aria-hidden": E.value, "boundaries-padding": k.boundariesPadding, "fallback-placements": k.fallbackPlacements, "gpu-acceleration": k.gpuAcceleration, offset: k.offset, placement: k.placement, "popper-options": k.popperOptions, strategy: k.strategy, effect: k.effect, enterable: k.enterable, pure: k.pure, "popper-class": k.popperClass, "popper-style": [k.popperStyle, unref(O)], "reference-el": k.referenceEl, "trigger-target-el": k.triggerTargetEl, visible: unref(S), "z-index": k.zIndex, onMouseenter: unref(H), onMouseleave: unref(Z), onBlur: re2, onClose: unref(d) }), { default: withCtx(() => [ renderSlot(k.$slots, "default") ]), _: 3 }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [ [vShow, unref(S)] ]) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var Fh = J(xh, [["__file", "content.vue"]]); var Ch = defineComponent({ name: "ElTooltip" }); var Sh = defineComponent({ ...Ch, props: ch, emits: dh, setup(e, { expose: t, emit: n }) { const o = e; R0(); const r = yo(), a = ref(), s = ref(), i = () => { var y; const C = unref(a); C && ((y = C.popperInstanceRef) == null || y.update()); }, l = ref(false), u = ref(), { show: c, hide: d, hasUpdateHandler: v } = uh({ indicator: l, toggleReason: u }), { onOpen: g, onClose: f } = B0({ showAfter: toRef(o, "showAfter"), hideAfter: toRef(o, "hideAfter"), autoClose: toRef(o, "autoClose"), open: c, close: d }), p = computed(() => mr(o.visible) && !v.value); provide(Lr, { controlled: p, id: r, open: readonly(l), trigger: toRef(o, "trigger"), onOpen: (y) => { g(y); }, onClose: (y) => { f(y); }, onToggle: (y) => { unref(l) ? f(y) : g(y); }, onShow: () => { n("show", u.value); }, onHide: () => { n("hide", u.value); }, onBeforeShow: () => { n("before-show", u.value); }, onBeforeHide: () => { n("before-hide", u.value); }, updatePopper: i }), watch(() => o.disabled, (y) => { y && l.value && (l.value = false); }); const m = (y) => { var C, $; const S = ($ = (C = s.value) == null ? void 0 : C.contentRef) == null ? void 0 : $.popperContentRef, x = (y == null ? void 0 : y.relatedTarget) || document.activeElement; return S && S.contains(x); }; return onDeactivated(() => l.value && d()), t({ popperRef: a, contentRef: s, isFocusInsideContent: m, updatePopper: i, onOpen: g, onClose: f, hide: d }), (y, C) => (openBlock(), createBlock(unref(sh), { ref_key: "popperRef", ref: a, role: y.role }, { default: withCtx(() => [ createVNode(hh, { disabled: y.disabled, trigger: y.trigger, "trigger-keys": y.triggerKeys, "virtual-ref": y.virtualRef, "virtual-triggering": y.virtualTriggering }, { default: withCtx(() => [ y.$slots.default ? renderSlot(y.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), createVNode(Fh, { ref_key: "contentRef", ref: s, "aria-label": y.ariaLabel, "boundaries-padding": y.boundariesPadding, content: y.content, disabled: y.disabled, effect: y.effect, enterable: y.enterable, "fallback-placements": y.fallbackPlacements, "hide-after": y.hideAfter, "gpu-acceleration": y.gpuAcceleration, offset: y.offset, persistent: y.persistent, "popper-class": y.popperClass, "popper-style": y.popperStyle, placement: y.placement, "popper-options": y.popperOptions, pure: y.pure, "raw-content": y.rawContent, "reference-el": y.referenceEl, "trigger-target-el": y.triggerTargetEl, "show-after": y.showAfter, strategy: y.strategy, teleported: y.teleported, transition: y.transition, "virtual-triggering": y.virtualTriggering, "z-index": y.zIndex, "append-to": y.appendTo }, { default: withCtx(() => [ renderSlot(y.$slots, "content", {}, () => [ y.rawContent ? (openBlock(), createElementBlock("span", { key: 0, innerHTML: y.content }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(y.content), 1)) ]), y.showArrow ? (openBlock(), createBlock(unref(Ev), { key: 0, "arrow-offset": y.arrowOffset }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"]) ]), _: 3 }, 8, ["role"])); } }); var Oh = J(Sh, [["__file", "tooltip.vue"]]); var ni = ke(Oh); var oi = Symbol("buttonGroupContextKey"); var Th = (e, t) => { mp({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, computed(() => e.type === "text")); const n = inject(oi, void 0), o = nv("button"), { form: r } = qs(), a = kr(computed(() => n == null ? void 0 : n.size)), s = Ws(), i = ref(), l = useSlots(), u = computed(() => e.type || (n == null ? void 0 : n.type) || ""), c = computed(() => { var f, p, m; return (m = (p = e.autoInsertSpace) != null ? p : (f = o.value) == null ? void 0 : f.autoInsertSpace) != null ? m : false; }), d = computed(() => e.tag === "button" ? { ariaDisabled: s.value || e.loading, disabled: s.value || e.loading, autofocus: e.autofocus, type: e.nativeType } : {}), v = computed(() => { var f; const p = (f = l.default) == null ? void 0 : f.call(l); if (c.value && (p == null ? void 0 : p.length) === 1) { const m = p[0]; if ((m == null ? void 0 : m.type) === Text) { const y = m.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(y.trim()); } } return false; }); return { _disabled: s, _size: a, _type: u, _ref: i, _props: d, shouldAddSpace: v, handleClick: (f) => { if (s.value || e.loading) { f.stopPropagation(); return; } e.nativeType === "reset" && (r == null || r.resetFields()), t("click", f); } }; }; var _h = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ]; var Eh = ["button", "submit", "reset"]; var tr = ee({ size: Gs, disabled: Boolean, type: { type: String, values: _h, default: "" }, icon: { type: Yt }, nativeType: { type: String, values: Eh, default: "button" }, loading: Boolean, loadingIcon: { type: Yt, default: () => ks }, plain: Boolean, text: Boolean, link: Boolean, bg: Boolean, autofocus: Boolean, round: Boolean, circle: Boolean, color: String, dark: Boolean, autoInsertSpace: { type: Boolean, default: void 0 }, tag: { type: D([String, Object]), default: "button" } }); var kh = { click: (e) => e instanceof MouseEvent }; function ae(e, t) { Ih(e) && (e = "100%"); var n = $h(e); return e = t === 360 ? e : Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(String(e * t), 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / parseFloat(String(t)) : e = e % t / parseFloat(String(t)), e); } function qn(e) { return Math.min(1, Math.max(0, e)); } function Ih(e) { return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1; } function $h(e) { return typeof e == "string" && e.indexOf("%") !== -1; } function ri(e) { return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e; } function Zn(e) { return e <= 1 ? "".concat(Number(e) * 100, "%") : e; } function Tt(e) { return e.length === 1 ? "0" + e : String(e); } function Ah(e, t, n) { return { r: ae(e, 255) * 255, g: ae(t, 255) * 255, b: ae(n, 255) * 255 }; } function Za(e, t, n) { e = ae(e, 255), t = ae(t, 255), n = ae(n, 255); var o = Math.max(e, t, n), r = Math.min(e, t, n), a = 0, s = 0, i = (o + r) / 2; if (o === r) s = 0, a = 0; else { var l = o - r; switch (s = i > 0.5 ? l / (2 - o - r) : l / (o + r), o) { case e: a = (t - n) / l + (t < n ? 6 : 0); break; case t: a = (n - e) / l + 2; break; case n: a = (e - t) / l + 4; break; } a /= 6; } return { h: a, s, l: i }; } function Ro(e, t, n) { return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * (6 * n) : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e; } function Ph(e, t, n) { var o, r, a; if (e = ae(e, 360), t = ae(t, 100), n = ae(n, 100), t === 0) r = n, a = n, o = n; else { var s = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - s; o = Ro(i, s, e + 1 / 3), r = Ro(i, s, e), a = Ro(i, s, e - 1 / 3); } return { r: o * 255, g: r * 255, b: a * 255 }; } function Ya(e, t, n) { e = ae(e, 255), t = ae(t, 255), n = ae(n, 255); var o = Math.max(e, t, n), r = Math.min(e, t, n), a = 0, s = o, i = o - r, l = o === 0 ? 0 : i / o; if (o === r) a = 0; else { switch (o) { case e: a = (t - n) / i + (t < n ? 6 : 0); break; case t: a = (n - e) / i + 2; break; case n: a = (e - t) / i + 4; break; } a /= 6; } return { h: a, s: l, v: s }; } function Lh(e, t, n) { e = ae(e, 360) * 6, t = ae(t, 100), n = ae(n, 100); var o = Math.floor(e), r = e - o, a = n * (1 - t), s = n * (1 - r * t), i = n * (1 - (1 - r) * t), l = o % 6, u = [n, s, a, a, i, n][l], c = [i, n, n, s, a, a][l], d = [a, a, i, n, n, s][l]; return { r: u * 255, g: c * 255, b: d * 255 }; } function Ja(e, t, n, o) { var r = [ Tt(Math.round(e).toString(16)), Tt(Math.round(t).toString(16)), Tt(Math.round(n).toString(16)) ]; return o && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join(""); } function Mh(e, t, n, o, r) { var a = [ Tt(Math.round(e).toString(16)), Tt(Math.round(t).toString(16)), Tt(Math.round(n).toString(16)), Tt(Rh(o)) ]; return r && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) && a[3].startsWith(a[3].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join(""); } function Rh(e) { return Math.round(parseFloat(e) * 255).toString(16); } function Xa(e) { return pe(e) / 255; } function pe(e) { return parseInt(e, 16); } function Nh(e) { return { r: e >> 16, g: (e & 65280) >> 8, b: e & 255 }; } var nr = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; function Bh(e) { var t = { r: 0, g: 0, b: 0 }, n = 1, o = null, r = null, a = null, s = false, i = false; return typeof e == "string" && (e = Hh(e)), typeof e == "object" && (We(e.r) && We(e.g) && We(e.b) ? (t = Ah(e.r, e.g, e.b), s = true, i = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : We(e.h) && We(e.s) && We(e.v) ? (o = Zn(e.s), r = Zn(e.v), t = Lh(e.h, o, r), s = true, i = "hsv") : We(e.h) && We(e.s) && We(e.l) && (o = Zn(e.s), a = Zn(e.l), t = Ph(e.h, o, a), s = true, i = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = ri(n), { ok: s, format: e.format || i, r: Math.min(255, Math.max(t.r, 0)), g: Math.min(255, Math.max(t.g, 0)), b: Math.min(255, Math.max(t.b, 0)), a: n }; } var Dh = "[-\\+]?\\d+%?"; var zh = "[-\\+]?\\d*\\.\\d+%?"; var gt = "(?:".concat(zh, ")|(?:").concat(Dh, ")"); var No = "[\\s|\\(]+(".concat(gt, ")[,|\\s]+(").concat(gt, ")[,|\\s]+(").concat(gt, ")\\s*\\)?"); var Bo = "[\\s|\\(]+(".concat(gt, ")[,|\\s]+(").concat(gt, ")[,|\\s]+(").concat(gt, ")[,|\\s]+(").concat(gt, ")\\s*\\)?"); var Oe = { CSS_UNIT: new RegExp(gt), rgb: new RegExp("rgb" + No), rgba: new RegExp("rgba" + Bo), hsl: new RegExp("hsl" + No), hsla: new RegExp("hsla" + Bo), hsv: new RegExp("hsv" + No), hsva: new RegExp("hsva" + Bo), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function Hh(e) { if (e = e.trim().toLowerCase(), e.length === 0) return false; var t = false; if (nr[e]) e = nr[e], t = true; else if (e === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var n = Oe.rgb.exec(e); return n ? { r: n[1], g: n[2], b: n[3] } : (n = Oe.rgba.exec(e), n ? { r: n[1], g: n[2], b: n[3], a: n[4] } : (n = Oe.hsl.exec(e), n ? { h: n[1], s: n[2], l: n[3] } : (n = Oe.hsla.exec(e), n ? { h: n[1], s: n[2], l: n[3], a: n[4] } : (n = Oe.hsv.exec(e), n ? { h: n[1], s: n[2], v: n[3] } : (n = Oe.hsva.exec(e), n ? { h: n[1], s: n[2], v: n[3], a: n[4] } : (n = Oe.hex8.exec(e), n ? { r: pe(n[1]), g: pe(n[2]), b: pe(n[3]), a: Xa(n[4]), format: t ? "name" : "hex8" } : (n = Oe.hex6.exec(e), n ? { r: pe(n[1]), g: pe(n[2]), b: pe(n[3]), format: t ? "name" : "hex" } : (n = Oe.hex4.exec(e), n ? { r: pe(n[1] + n[1]), g: pe(n[2] + n[2]), b: pe(n[3] + n[3]), a: Xa(n[4] + n[4]), format: t ? "name" : "hex8" } : (n = Oe.hex3.exec(e), n ? { r: pe(n[1] + n[1]), g: pe(n[2] + n[2]), b: pe(n[3] + n[3]), format: t ? "name" : "hex" } : false))))))))); } function We(e) { return !!Oe.CSS_UNIT.exec(String(e)); } var Vh = ( /** @class */ function() { function e(t, n) { t === void 0 && (t = ""), n === void 0 && (n = {}); var o; if (t instanceof e) return t; typeof t == "number" && (t = Nh(t)), this.originalInput = t; var r = Bh(t); this.originalInput = t, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (o = n.format) !== null && o !== void 0 ? o : r.format, this.gradientType = n.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok; } return e.prototype.isDark = function() { return this.getBrightness() < 128; }, e.prototype.isLight = function() { return !this.isDark(); }, e.prototype.getBrightness = function() { var t = this.toRgb(); return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3; }, e.prototype.getLuminance = function() { var t = this.toRgb(), n, o, r, a = t.r / 255, s = t.g / 255, i = t.b / 255; return a <= 0.03928 ? n = a / 12.92 : n = Math.pow((a + 0.055) / 1.055, 2.4), s <= 0.03928 ? o = s / 12.92 : o = Math.pow((s + 0.055) / 1.055, 2.4), i <= 0.03928 ? r = i / 12.92 : r = Math.pow((i + 0.055) / 1.055, 2.4), 0.2126 * n + 0.7152 * o + 0.0722 * r; }, e.prototype.getAlpha = function() { return this.a; }, e.prototype.setAlpha = function(t) { return this.a = ri(t), this.roundA = Math.round(100 * this.a) / 100, this; }, e.prototype.isMonochrome = function() { var t = this.toHsl().s; return t === 0; }, e.prototype.toHsv = function() { var t = Ya(this.r, this.g, this.b); return { h: t.h * 360, s: t.s, v: t.v, a: this.a }; }, e.prototype.toHsvString = function() { var t = Ya(this.r, this.g, this.b), n = Math.round(t.h * 360), o = Math.round(t.s * 100), r = Math.round(t.v * 100); return this.a === 1 ? "hsv(".concat(n, ", ").concat(o, "%, ").concat(r, "%)") : "hsva(".concat(n, ", ").concat(o, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, e.prototype.toHsl = function() { var t = Za(this.r, this.g, this.b); return { h: t.h * 360, s: t.s, l: t.l, a: this.a }; }, e.prototype.toHslString = function() { var t = Za(this.r, this.g, this.b), n = Math.round(t.h * 360), o = Math.round(t.s * 100), r = Math.round(t.l * 100); return this.a === 1 ? "hsl(".concat(n, ", ").concat(o, "%, ").concat(r, "%)") : "hsla(".concat(n, ", ").concat(o, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, e.prototype.toHex = function(t) { return t === void 0 && (t = false), Ja(this.r, this.g, this.b, t); }, e.prototype.toHexString = function(t) { return t === void 0 && (t = false), "#" + this.toHex(t); }, e.prototype.toHex8 = function(t) { return t === void 0 && (t = false), Mh(this.r, this.g, this.b, this.a, t); }, e.prototype.toHex8String = function(t) { return t === void 0 && (t = false), "#" + this.toHex8(t); }, e.prototype.toHexShortString = function(t) { return t === void 0 && (t = false), this.a === 1 ? this.toHexString(t) : this.toHex8String(t); }, e.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, e.prototype.toRgbString = function() { var t = Math.round(this.r), n = Math.round(this.g), o = Math.round(this.b); return this.a === 1 ? "rgb(".concat(t, ", ").concat(n, ", ").concat(o, ")") : "rgba(".concat(t, ", ").concat(n, ", ").concat(o, ", ").concat(this.roundA, ")"); }, e.prototype.toPercentageRgb = function() { var t = function(n) { return "".concat(Math.round(ae(n, 255) * 100), "%"); }; return { r: t(this.r), g: t(this.g), b: t(this.b), a: this.a }; }, e.prototype.toPercentageRgbString = function() { var t = function(n) { return Math.round(ae(n, 255) * 100); }; return this.a === 1 ? "rgb(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%)") : "rgba(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%, ").concat(this.roundA, ")"); }, e.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return false; for (var t = "#" + Ja(this.r, this.g, this.b, false), n = 0, o = Object.entries(nr); n < o.length; n++) { var r = o[n], a = r[0], s = r[1]; if (t === s) return a; } return false; }, e.prototype.toString = function(t) { var n = !!t; t = t ?? this.format; var o = false, r = this.a < 1 && this.a >= 0, a = !n && r && (t.startsWith("hex") || t === "name"); return a ? t === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (o = this.toRgbString()), t === "prgb" && (o = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (o = this.toHexString()), t === "hex3" && (o = this.toHexString(true)), t === "hex4" && (o = this.toHex8String(true)), t === "hex8" && (o = this.toHex8String()), t === "name" && (o = this.toName()), t === "hsl" && (o = this.toHslString()), t === "hsv" && (o = this.toHsvString()), o || this.toHexString()); }, e.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, e.prototype.clone = function() { return new e(this.toString()); }, e.prototype.lighten = function(t) { t === void 0 && (t = 10); var n = this.toHsl(); return n.l += t / 100, n.l = qn(n.l), new e(n); }, e.prototype.brighten = function(t) { t === void 0 && (t = 10); var n = this.toRgb(); return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), new e(n); }, e.prototype.darken = function(t) { t === void 0 && (t = 10); var n = this.toHsl(); return n.l -= t / 100, n.l = qn(n.l), new e(n); }, e.prototype.tint = function(t) { return t === void 0 && (t = 10), this.mix("white", t); }, e.prototype.shade = function(t) { return t === void 0 && (t = 10), this.mix("black", t); }, e.prototype.desaturate = function(t) { t === void 0 && (t = 10); var n = this.toHsl(); return n.s -= t / 100, n.s = qn(n.s), new e(n); }, e.prototype.saturate = function(t) { t === void 0 && (t = 10); var n = this.toHsl(); return n.s += t / 100, n.s = qn(n.s), new e(n); }, e.prototype.greyscale = function() { return this.desaturate(100); }, e.prototype.spin = function(t) { var n = this.toHsl(), o = (n.h + t) % 360; return n.h = o < 0 ? 360 + o : o, new e(n); }, e.prototype.mix = function(t, n) { n === void 0 && (n = 50); var o = this.toRgb(), r = new e(t).toRgb(), a = n / 100, s = { r: (r.r - o.r) * a + o.r, g: (r.g - o.g) * a + o.g, b: (r.b - o.b) * a + o.b, a: (r.a - o.a) * a + o.a }; return new e(s); }, e.prototype.analogous = function(t, n) { t === void 0 && (t = 6), n === void 0 && (n = 30); var o = this.toHsl(), r = 360 / n, a = [this]; for (o.h = (o.h - (r * t >> 1) + 720) % 360; --t; ) o.h = (o.h + r) % 360, a.push(new e(o)); return a; }, e.prototype.complement = function() { var t = this.toHsl(); return t.h = (t.h + 180) % 360, new e(t); }, e.prototype.monochromatic = function(t) { t === void 0 && (t = 6); for (var n = this.toHsv(), o = n.h, r = n.s, a = n.v, s = [], i = 1 / t; t--; ) s.push(new e({ h: o, s: r, v: a })), a = (a + i) % 1; return s; }, e.prototype.splitcomplement = function() { var t = this.toHsl(), n = t.h; return [ this, new e({ h: (n + 72) % 360, s: t.s, l: t.l }), new e({ h: (n + 216) % 360, s: t.s, l: t.l }) ]; }, e.prototype.onBackground = function(t) { var n = this.toRgb(), o = new e(t).toRgb(), r = n.a + o.a * (1 - n.a); return new e({ r: (n.r * n.a + o.r * o.a * (1 - n.a)) / r, g: (n.g * n.a + o.g * o.a * (1 - n.a)) / r, b: (n.b * n.a + o.b * o.a * (1 - n.a)) / r, a: r }); }, e.prototype.triad = function() { return this.polyad(3); }, e.prototype.tetrad = function() { return this.polyad(4); }, e.prototype.polyad = function(t) { for (var n = this.toHsl(), o = n.h, r = [this], a = 360 / t, s = 1; s < t; s++) r.push(new e({ h: (o + s * a) % 360, s: n.s, l: n.l })); return r; }, e.prototype.equals = function(t) { return this.toRgbString() === new e(t).toRgbString(); }, e; }() ); function ct(e, t = 20) { return e.mix("#141414", t).toString(); } function jh(e) { const t = Ws(), n = te("button"); return computed(() => { let o = {}, r = e.color; if (r) { const a = r.match(/var\((.*?)\)/); a && (r = window.getComputedStyle(window.document.documentElement).getPropertyValue(a[1])); const s = new Vh(r), i = e.dark ? s.tint(20).toString() : ct(s, 20); if (e.plain) o = n.cssVarBlock({ "bg-color": e.dark ? ct(s, 90) : s.tint(90).toString(), "text-color": r, "border-color": e.dark ? ct(s, 50) : s.tint(50).toString(), "hover-text-color": `var(${n.cssVarName("color-white")})`, "hover-bg-color": r, "hover-border-color": r, "active-bg-color": i, "active-text-color": `var(${n.cssVarName("color-white")})`, "active-border-color": i }), t.value && (o[n.cssVarBlockName("disabled-bg-color")] = e.dark ? ct(s, 90) : s.tint(90).toString(), o[n.cssVarBlockName("disabled-text-color")] = e.dark ? ct(s, 50) : s.tint(50).toString(), o[n.cssVarBlockName("disabled-border-color")] = e.dark ? ct(s, 80) : s.tint(80).toString()); else { const l = e.dark ? ct(s, 30) : s.tint(30).toString(), u = s.isDark() ? `var(${n.cssVarName("color-white")})` : `var(${n.cssVarName("color-black")})`; if (o = n.cssVarBlock({ "bg-color": r, "text-color": u, "border-color": r, "hover-bg-color": l, "hover-text-color": u, "hover-border-color": l, "active-bg-color": i, "active-border-color": i }), t.value) { const c = e.dark ? ct(s, 50) : s.tint(50).toString(); o[n.cssVarBlockName("disabled-bg-color")] = c, o[n.cssVarBlockName("disabled-text-color")] = e.dark ? "rgba(255, 255, 255, 0.5)" : `var(${n.cssVarName("color-white")})`, o[n.cssVarBlockName("disabled-border-color")] = c; } } } return o; }); } var Uh = defineComponent({ name: "ElButton" }); var Kh = defineComponent({ ...Uh, props: tr, emits: kh, setup(e, { expose: t, emit: n }) { const o = e, r = jh(o), a = te("button"), { _ref: s, _size: i, _type: l, _disabled: u, _props: c, shouldAddSpace: d, handleClick: v } = Th(o, n), g = computed(() => [ a.b(), a.m(l.value), a.m(i.value), a.is("disabled", u.value), a.is("loading", o.loading), a.is("plain", o.plain), a.is("round", o.round), a.is("circle", o.circle), a.is("text", o.text), a.is("link", o.link), a.is("has-bg", o.bg) ]); return t({ ref: s, size: i, type: l, disabled: u, shouldAddSpace: d }), (f, p) => (openBlock(), createBlock(resolveDynamicComponent(f.tag), mergeProps({ ref_key: "_ref", ref: s }, unref(c), { class: unref(g), style: unref(r), onClick: unref(v) }), { default: withCtx(() => [ f.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ f.$slots.loading ? renderSlot(f.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(nn), { key: 1, class: normalizeClass(unref(a).is("loading")) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(f.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : f.icon || f.$slots.icon ? (openBlock(), createBlock(unref(nn), { key: 1 }, { default: withCtx(() => [ f.icon ? (openBlock(), createBlock(resolveDynamicComponent(f.icon), { key: 0 })) : renderSlot(f.$slots, "icon", { key: 1 }) ]), _: 3 })) : createCommentVNode("v-if", true), f.$slots.default ? (openBlock(), createElementBlock("span", { key: 2, class: normalizeClass({ [unref(a).em("text", "expand")]: unref(d) }) }, [ renderSlot(f.$slots, "default") ], 2)) : createCommentVNode("v-if", true) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var Gh = J(Kh, [["__file", "button.vue"]]); var Wh = { size: tr.size, type: tr.type }; var qh = defineComponent({ name: "ElButtonGroup" }); var Zh = defineComponent({ ...qh, props: Wh, setup(e) { const t = e; provide(oi, reactive({ size: toRef(t, "size"), type: toRef(t, "type") })); const n = te("button"); return (o, r) => (openBlock(), createElementBlock("div", { class: normalizeClass(unref(n).b("group")) }, [ renderSlot(o.$slots, "default") ], 2)); } }); var ai = J(Zh, [["__file", "button-group.vue"]]); var Pn = ke(Gh, { ButtonGroup: ai }); vo(ai); var ft = /* @__PURE__ */ new Map(); if (se) { let e; document.addEventListener("mousedown", (t) => e = t), document.addEventListener("mouseup", (t) => { if (e) { for (const n of ft.values()) for (const { documentHandler: o } of n) o(t, e); e = void 0; } }); } function Qa(e, t) { let n = []; return Array.isArray(t.arg) ? n = t.arg : _t(t.arg) && n.push(t.arg), function(o, r) { const a = t.instance.popperRef, s = o.target, i = r == null ? void 0 : r.target, l = !t || !t.instance, u = !s || !i, c = e.contains(s) || e.contains(i), d = e === s, v = n.length && n.some((f) => f == null ? void 0 : f.contains(s)) || n.length && n.includes(i), g = a && (a.contains(s) || a.contains(i)); l || u || c || d || v || g || t.value(o, r); }; } var Yh = { beforeMount(e, t) { ft.has(e) || ft.set(e, []), ft.get(e).push({ documentHandler: Qa(e, t), bindingFn: t.value }); }, updated(e, t) { ft.has(e) || ft.set(e, []); const n = ft.get(e), o = n.findIndex((a) => a.bindingFn === t.oldValue), r = { documentHandler: Qa(e, t), bindingFn: t.value }; o >= 0 ? n.splice(o, 1, r) : n.push(r); }, unmounted(e) { ft.delete(e); } }; var or = ee({ type: { type: String, values: ["primary", "success", "info", "warning", "danger"], default: "primary" }, closable: Boolean, disableTransitions: Boolean, hit: Boolean, color: String, size: { type: String, values: $s }, effect: { type: String, values: ["dark", "light", "plain"], default: "light" }, round: Boolean }); var Jh = { close: (e) => e instanceof MouseEvent, click: (e) => e instanceof MouseEvent }; var Xh = defineComponent({ name: "ElTag" }); var Qh = defineComponent({ ...Xh, props: or, emits: Jh, setup(e, { emit: t }) { const n = e, o = kr(), r = te("tag"), a = computed(() => { const { type: u, hit: c, effect: d, closable: v, round: g } = n; return [ r.b(), r.is("closable", v), r.m(u || "primary"), r.m(o.value), r.m(d), r.is("hit", c), r.is("round", g) ]; }), s = (u) => { t("close", u); }, i = (u) => { t("click", u); }, l = (u) => { u.component.subTree.component.bum = null; }; return (u, c) => u.disableTransitions ? (openBlock(), createElementBlock("span", { key: 0, class: normalizeClass(unref(a)), style: normalizeStyle({ backgroundColor: u.color }), onClick: i }, [ createBaseVNode("span", { class: normalizeClass(unref(r).e("content")) }, [ renderSlot(u.$slots, "default") ], 2), u.closable ? (openBlock(), createBlock(unref(nn), { key: 0, class: normalizeClass(unref(r).e("close")), onClick: withModifiers(s, ["stop"]) }, { default: withCtx(() => [ createVNode(unref(Ca)) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true) ], 6)) : (openBlock(), createBlock(Transition, { key: 1, name: `${unref(r).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: l }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(unref(a)), style: normalizeStyle({ backgroundColor: u.color }), onClick: i }, [ createBaseVNode("span", { class: normalizeClass(unref(r).e("content")) }, [ renderSlot(u.$slots, "default") ], 2), u.closable ? (openBlock(), createBlock(unref(nn), { key: 0, class: normalizeClass(unref(r).e("close")), onClick: withModifiers(s, ["stop"]) }, { default: withCtx(() => [ createVNode(unref(Ca)) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true) ], 6) ]), _: 3 }, 8, ["name"])); } }); var eg = J(Qh, [["__file", "tag.vue"]]); var tg = ke(eg); var es = (e) => xe(e) || rn(e) || Ne(e); var ng = ee({ accordion: Boolean, modelValue: { type: D([Array, String, Number]), default: () => gp([]) } }); var og = { [ht]: es, [ho]: es }; var si = Symbol("collapseContextKey"); var rg = (e, t) => { const n = ref(Me(e.modelValue)), o = (a) => { n.value = a; const s = e.accordion ? n.value[0] : n.value; t(ht, s), t(ho, s); }, r = (a) => { if (e.accordion) o([n.value[0] === a ? "" : a]); else { const s = [...n.value], i = s.indexOf(a); i > -1 ? s.splice(i, 1) : s.push(a), o(s); } }; return watch(() => e.modelValue, () => n.value = Me(e.modelValue), { deep: true }), provide(si, { activeNames: n, handleItemClick: r }), { activeNames: n, setActiveNames: o }; }; var ag = () => { const e = te("collapse"); return { rootKls: computed(() => e.b()) }; }; var sg = defineComponent({ name: "ElCollapse" }); var ig = defineComponent({ ...sg, props: ng, emits: og, setup(e, { expose: t, emit: n }) { const o = e, { activeNames: r, setActiveNames: a } = rg(o, n), { rootKls: s } = ag(); return t({ activeNames: r, setActiveNames: a }), (i, l) => (openBlock(), createElementBlock("div", { class: normalizeClass(unref(s)) }, [ renderSlot(i.$slots, "default") ], 2)); } }); var lg = J(ig, [["__file", "collapse.vue"]]); var ug = defineComponent({ name: "ElCollapseTransition" }); var cg = defineComponent({ ...ug, setup(e) { const t = te("collapse-transition"), n = (r) => { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom; }, o = { beforeEnter(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.style.height && (r.dataset.elExistsHeight = r.style.height), r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0; }, enter(r) { requestAnimationFrame(() => { r.dataset.oldOverflow = r.style.overflow, r.dataset.elExistsHeight ? r.style.maxHeight = r.dataset.elExistsHeight : r.scrollHeight !== 0 ? r.style.maxHeight = `${r.scrollHeight}px` : r.style.maxHeight = 0, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom, r.style.overflow = "hidden"; }); }, afterEnter(r) { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow; }, enterCancelled(r) { n(r); }, beforeLeave(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.dataset.oldOverflow = r.style.overflow, r.style.maxHeight = `${r.scrollHeight}px`, r.style.overflow = "hidden"; }, leave(r) { r.scrollHeight !== 0 && (r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0); }, afterLeave(r) { n(r); }, leaveCancelled(r) { n(r); } }; return (r, a) => (openBlock(), createBlock(Transition, mergeProps({ name: unref(t).b() }, toHandlers(o)), { default: withCtx(() => [ renderSlot(r.$slots, "default") ]), _: 3 }, 16, ["name"])); } }); var dg = J(cg, [["__file", "collapse-transition.vue"]]); var fg = ke(dg); var pg = ee({ title: { type: String, default: "" }, name: { type: D([String, Number]), default: void 0 }, icon: { type: Yt, default: sp }, disabled: Boolean }); var vg = (e) => { const t = inject(si), { namespace: n } = te("collapse"), o = ref(false), r = ref(false), a = _r(), s = computed(() => a.current++), i = computed(() => { var v; return (v = e.name) != null ? v : `${n.value}-id-${a.prefix}-${unref(s)}`; }), l = computed(() => t == null ? void 0 : t.activeNames.value.includes(unref(i))); return { focusing: o, id: s, isActive: l, handleFocus: () => { setTimeout(() => { r.value ? r.value = false : o.value = true; }, 50); }, handleHeaderClick: () => { e.disabled || (t == null || t.handleItemClick(unref(i)), o.value = false, r.value = true); }, handleEnterClick: () => { t == null || t.handleItemClick(unref(i)); } }; }; var hg = (e, { focusing: t, isActive: n, id: o }) => { const r = te("collapse"), a = computed(() => [ r.b("item"), r.is("active", unref(n)), r.is("disabled", e.disabled) ]), s = computed(() => [ r.be("item", "header"), r.is("active", unref(n)), { focusing: unref(t) && !e.disabled } ]), i = computed(() => [ r.be("item", "arrow"), r.is("active", unref(n)) ]), l = computed(() => r.be("item", "wrap")), u = computed(() => r.be("item", "content")), c = computed(() => r.b(`content-${unref(o)}`)), d = computed(() => r.b(`head-${unref(o)}`)); return { arrowKls: i, headKls: s, rootKls: a, itemWrapperKls: l, itemContentKls: u, scopedContentId: c, scopedHeadId: d }; }; var gg = defineComponent({ name: "ElCollapseItem" }); var mg = defineComponent({ ...gg, props: pg, setup(e, { expose: t }) { const n = e, { focusing: o, id: r, isActive: a, handleFocus: s, handleHeaderClick: i, handleEnterClick: l } = vg(n), { arrowKls: u, headKls: c, rootKls: d, itemWrapperKls: v, itemContentKls: g, scopedContentId: f, scopedHeadId: p } = hg(n, { focusing: o, isActive: a, id: r }); return t({ isActive: a }), (m, y) => (openBlock(), createElementBlock("div", { class: normalizeClass(unref(d)) }, [ createBaseVNode("button", { id: unref(p), class: normalizeClass(unref(c)), "aria-expanded": unref(a), "aria-controls": unref(f), "aria-describedby": unref(f), tabindex: m.disabled ? -1 : 0, type: "button", onClick: unref(i), onKeydown: withKeys(withModifiers(unref(l), ["stop", "prevent"]), ["space", "enter"]), onFocus: unref(s), onBlur: (C) => o.value = false }, [ renderSlot(m.$slots, "title", {}, () => [ createTextVNode(toDisplayString(m.title), 1) ]), renderSlot(m.$slots, "icon", { isActive: unref(a) }, () => [ createVNode(unref(nn), { class: normalizeClass(unref(u)) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(m.icon))) ]), _: 1 }, 8, ["class"]) ]) ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]), createVNode(unref(fg), null, { default: withCtx(() => [ withDirectives(createBaseVNode("div", { id: unref(f), role: "region", class: normalizeClass(unref(v)), "aria-hidden": !unref(a), "aria-labelledby": unref(p) }, [ createBaseVNode("div", { class: normalizeClass(unref(g)) }, [ renderSlot(m.$slots, "default") ], 2) ], 10, ["id", "aria-hidden", "aria-labelledby"]), [ [vShow, unref(a)] ]) ]), _: 3 }) ], 2)); } }); var ii = J(mg, [["__file", "collapse-item.vue"]]); var li = ke(lg, { CollapseItem: ii }); var ui = vo(ii); var yg = defineComponent({ inheritAttrs: false }); function bg(e, t, n, o, r, a) { return renderSlot(e.$slots, "default"); } var wg = J(yg, [["render", bg], ["__file", "collection.vue"]]); var xg = defineComponent({ name: "ElCollectionItem", inheritAttrs: false }); function Fg(e, t, n, o, r, a) { return renderSlot(e.$slots, "default"); } var Cg = J(xg, [["render", Fg], ["__file", "collection-item.vue"]]); var Sg = "data-el-collection-item"; var Og = (e) => { const t = `El${e}Collection`, n = `${t}Item`, o = Symbol(t), r = Symbol(n), a = { ...wg, name: t, setup() { const i = ref(null), l = /* @__PURE__ */ new Map(); provide(o, { itemMap: l, getItems: () => { const c = unref(i); if (!c) return []; const d = Array.from(c.querySelectorAll(`[${Sg}]`)); return [...l.values()].sort((g, f) => d.indexOf(g.ref) - d.indexOf(f.ref)); }, collectionRef: i }); } }, s = { ...Cg, name: n, setup(i, { attrs: l }) { const u = ref(null), c = inject(o, void 0); provide(r, { collectionItemRef: u }), onMounted(() => { const d = unref(u); d && c.itemMap.set(d, { ref: d, ...l }); }), onBeforeUnmount(() => { const d = unref(u); c.itemMap.delete(d); }); } }; return { COLLECTION_INJECTION_KEY: o, COLLECTION_ITEM_INJECTION_KEY: r, ElCollection: a, ElCollectionItem: s }; }; var Do = ee({ trigger: kn.trigger, effect: { ...he.effect, default: "light" }, type: { type: D(String) }, placement: { type: D(String), default: "bottom" }, popperOptions: { type: D(Object), default: () => ({}) }, id: String, size: { type: String, default: "" }, splitButton: Boolean, hideOnClick: { type: Boolean, default: true }, loop: { type: Boolean, default: true }, showTimeout: { type: Number, default: 150 }, hideTimeout: { type: Number, default: 150 }, tabindex: { type: D([Number, String]), default: 0 }, maxHeight: { type: D([Number, String]), default: "" }, popperClass: { type: String, default: "" }, disabled: Boolean, role: { type: String, default: "menu" }, buttonProps: { type: D(Object) }, teleported: he.teleported }); ee({ command: { type: [Object, String, Number], default: () => ({}) }, disabled: Boolean, divided: Boolean, textValue: String, icon: { type: Yt } }); ee({ onKeydown: { type: D(Function) } }); Og("Dropdown"); var ci = Symbol("ElSelectGroup"); var xo = Symbol("ElSelect"); function Tg(e, t) { const n = inject(xo), o = inject(ci, { disabled: false }), r = computed(() => c(Me(n.props.modelValue), e.value)), a = computed(() => { var g; if (n.props.multiple) { const f = Me((g = n.props.modelValue) != null ? g : []); return !r.value && f.length >= n.props.multipleLimit && n.props.multipleLimit > 0; } else return false; }), s = computed(() => e.label || (Be(e.value) ? "" : e.value)), i = computed(() => e.value || e.label || ""), l = computed(() => e.disabled || t.groupDisabled || a.value), u = getCurrentInstance(), c = (g = [], f) => { if (Be(e.value)) { const p = n.props.valueKey; return g && g.some((m) => toRaw(Je(m, p)) === Je(f, p)); } else return g && g.includes(f); }, d = () => { !e.disabled && !o.disabled && (n.states.hoveringIndex = n.optionsArray.indexOf(u.proxy)); }, v = (g) => { const f = new RegExp(Qf(g), "i"); t.visible = f.test(s.value) || e.created; }; return watch(() => s.value, () => { !e.created && !n.props.remote && n.setSelected(); }), watch(() => e.value, (g, f) => { const { remote: p, valueKey: m } = n.props; if (g !== f && (n.onOptionDestroy(f, u.proxy), n.onOptionCreate(u.proxy)), !e.created && !p) { if (m && Be(g) && Be(f) && g[m] === f[m]) return; n.setSelected(); } }), watch(() => o.disabled, () => { t.groupDisabled = o.disabled; }, { immediate: true }), { select: n, currentLabel: s, currentValue: i, itemSelected: r, isDisabled: l, hoverItem: d, updateOption: v }; } var _g = defineComponent({ name: "ElOption", componentName: "ElOption", props: { value: { required: true, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(e) { const t = te("select"), n = yo(), o = computed(() => [ t.be("dropdown", "item"), t.is("disabled", unref(i)), t.is("selected", unref(s)), t.is("hovering", unref(v)) ]), r = reactive({ index: -1, groupDisabled: false, visible: true, hover: false }), { currentLabel: a, itemSelected: s, isDisabled: i, select: l, hoverItem: u, updateOption: c } = Tg(e, r), { visible: d, hover: v } = toRefs(r), g = getCurrentInstance().proxy; l.onOptionCreate(g), onBeforeUnmount(() => { const p = g.value, { selected: m } = l.states, C = (l.props.multiple ? m : [m]).some(($) => $.value === g.value); nextTick(() => { l.states.cachedOptions.get(p) === g && !C && l.states.cachedOptions.delete(p); }), l.onOptionDestroy(p, g); }); function f() { i.value || l.handleOptionSelect(g); } return { ns: t, id: n, containerKls: o, currentLabel: a, itemSelected: s, isDisabled: i, select: l, hoverItem: u, updateOption: c, visible: d, hover: v, selectOptionClick: f, states: r }; } }); function Eg(e, t, n, o, r, a) { return withDirectives((openBlock(), createElementBlock("li", { id: e.id, class: normalizeClass(e.containerKls), role: "option", "aria-disabled": e.isDisabled || void 0, "aria-selected": e.itemSelected, onMouseenter: e.hoverItem, onClick: withModifiers(e.selectOptionClick, ["stop"]) }, [ renderSlot(e.$slots, "default", {}, () => [ createBaseVNode("span", null, toDisplayString(e.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [vShow, e.visible] ]); } var Mr = J(_g, [["render", Eg], ["__file", "option.vue"]]); var kg = defineComponent({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const e = inject(xo), t = te("select"), n = computed(() => e.props.popperClass), o = computed(() => e.props.multiple), r = computed(() => e.props.fitInputWidth), a = ref(""); function s() { var i; a.value = `${(i = e.selectRef) == null ? void 0 : i.offsetWidth}px`; } return onMounted(() => { s(), pt(e.selectRef, s); }), { ns: t, minWidth: a, popperClass: n, isMultiple: o, isFitInputWidth: r }; } }); function Ig(e, t, n, o, r, a) { return openBlock(), createElementBlock("div", { class: normalizeClass([e.ns.b("dropdown"), e.ns.is("multiple", e.isMultiple), e.popperClass]), style: normalizeStyle({ [e.isFitInputWidth ? "width" : "minWidth"]: e.minWidth }) }, [ e.$slots.header ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(e.ns.be("dropdown", "header")) }, [ renderSlot(e.$slots, "header") ], 2)) : createCommentVNode("v-if", true), renderSlot(e.$slots, "default"), e.$slots.footer ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(e.ns.be("dropdown", "footer")) }, [ renderSlot(e.$slots, "footer") ], 2)) : createCommentVNode("v-if", true) ], 6); } var $g = J(kg, [["render", Ig], ["__file", "select-dropdown.vue"]]); var Ag = 11; var Pg = (e, t) => { const { t: n } = Cp(), o = yo(), r = te("select"), a = te("input"), s = reactive({ inputValue: "", options: /* @__PURE__ */ new Map(), cachedOptions: /* @__PURE__ */ new Map(), disabledOptions: /* @__PURE__ */ new Map(), optionValues: [], selected: [], selectionWidth: 0, calculatorWidth: 0, collapseItemWidth: 0, selectedLabel: "", hoveringIndex: -1, previousQuery: null, inputHovering: false, menuVisibleOnFocus: false, isBeforeHide: false }), i = ref(null), l = ref(null), u = ref(null), c = ref(null), d = ref(null), v = ref(null), g = ref(null), f = ref(null), p = ref(null), m = ref(null), y = ref(null), C = ref(null), { isComposing: $, handleCompositionStart: S, handleCompositionUpdate: x, handleCompositionEnd: O } = W0({ afterComposition: (b) => vn(b) }), { wrapperRef: E, isFocused: A } = G0(d, { beforeFocus() { return k.value; }, afterFocus() { e.automaticDropdown && !L.value && (L.value = true, s.menuVisibleOnFocus = true); }, beforeBlur(b) { var T, z; return ((T = u.value) == null ? void 0 : T.isFocusInsideContent(b)) || ((z = c.value) == null ? void 0 : z.isFocusInsideContent(b)); }, afterBlur() { L.value = false, s.menuVisibleOnFocus = false; } }), L = ref(false), H = ref(), { form: Z, formItem: K } = qs(), { inputId: X } = iv(e, { formItemContext: K }), { valueOnClear: be, isEmptyValue: re2 } = Q0(e), k = computed(() => e.disabled || (Z == null ? void 0 : Z.disabled)), q = computed(() => Ne(e.modelValue) ? e.modelValue.length > 0 : !re2(e.modelValue)), Ke = computed(() => e.clearable && !k.value && s.inputHovering && q.value), fe = computed(() => e.remote && e.filterable && !e.remoteShowSuffix ? "" : e.suffixIcon), Rt = computed(() => r.is("reverse", fe.value && L.value)), Nt = computed(() => (K == null ? void 0 : K.validateState) || ""), bt = computed(() => pp[Nt.value]), Bt = computed(() => e.remote ? 300 : 0), $e = computed(() => e.loading ? e.loadingText || n("el.select.loading") : e.remote && !s.inputValue && s.options.size === 0 ? false : e.filterable && s.inputValue && s.options.size > 0 && le.value === 0 ? e.noMatchText || n("el.select.noMatch") : s.options.size === 0 ? e.noDataText || n("el.select.noData") : null), le = computed(() => oe.value.filter((b) => b.visible).length), oe = computed(() => { const b = Array.from(s.options.values()), T = []; return s.optionValues.forEach((z) => { const Y = b.findIndex((ut) => ut.value === z); Y > -1 && T.push(b[Y]); }), T.length >= b.length ? T : b; }), wt = computed(() => Array.from(s.cachedOptions.values())), lt = computed(() => { const b = oe.value.filter((T) => !T.created).some((T) => T.currentLabel === s.inputValue); return e.filterable && e.allowCreate && s.inputValue !== "" && !b; }), Mn = () => { e.filterable && ue(e.filterMethod) || e.filterable && e.remote && ue(e.remoteMethod) || oe.value.forEach((b) => { var T; (T = b.updateOption) == null || T.call(b, s.inputValue); }); }, Rn = kr(), un = computed(() => ["small"].includes(Rn.value) ? "small" : "default"), Co = computed({ get() { return L.value && $e.value !== false; }, set(b) { L.value = b; } }), Nn = computed(() => { if (e.multiple && !bn(e.modelValue)) return Me(e.modelValue).length === 0 && !s.inputValue; const b = Ne(e.modelValue) ? e.modelValue[0] : e.modelValue; return e.filterable || bn(b) ? !s.inputValue : true; }), So = computed(() => { var b; const T = (b = e.placeholder) != null ? b : n("el.select.placeholder"); return e.multiple || !q.value ? T : s.selectedLabel; }), Oo = computed(() => Vo ? null : "mouseenter"); watch(() => e.modelValue, (b, T) => { e.multiple && e.filterable && !e.reserveKeyword && (s.inputValue = "", xt("")), Dt(), !Jo(b, T) && e.validateEvent && (K == null || K.validate("change").catch((z) => Ve(z))); }, { flush: "post", deep: true }), watch(() => L.value, (b) => { b ? xt(s.inputValue) : (s.inputValue = "", s.previousQuery = null, s.isBeforeHide = true), t("visible-change", b); }), watch(() => s.options.entries(), () => { var b; if (!se) return; const T = ((b = i.value) == null ? void 0 : b.querySelectorAll("input")) || []; (!e.filterable && !e.defaultFirstOption && !bn(e.modelValue) || !Array.from(T).includes(document.activeElement)) && Dt(), e.defaultFirstOption && (e.filterable || e.remote) && le.value && cn(); }, { flush: "post" }), watch(() => s.hoveringIndex, (b) => { xe(b) && b > -1 ? H.value = oe.value[b] || {} : H.value = {}, oe.value.forEach((T) => { T.hover = H.value === T; }); }), watchEffect(() => { s.isBeforeHide || Mn(); }); const xt = (b) => { s.previousQuery === b || $.value || (s.previousQuery = b, e.filterable && ue(e.filterMethod) ? e.filterMethod(b) : e.filterable && e.remote && ue(e.remoteMethod) && e.remoteMethod(b), e.defaultFirstOption && (e.filterable || e.remote) && le.value ? nextTick(cn) : nextTick(Ge)); }, cn = () => { const b = oe.value.filter((Y) => Y.visible && !Y.disabled && !Y.states.groupDisabled), T = b.find((Y) => Y.created), z = b[0]; s.hoveringIndex = Dr(oe.value, T || z); }, Dt = () => { if (e.multiple) s.selectedLabel = ""; else { const T = Ne(e.modelValue) ? e.modelValue[0] : e.modelValue, z = Bn(T); s.selectedLabel = z.currentLabel, s.selected = [z]; return; } const b = []; bn(e.modelValue) || Me(e.modelValue).forEach((T) => { b.push(Bn(T)); }), s.selected = b; }, Bn = (b) => { let T; const z = _o(b).toLowerCase() === "object", Y = _o(b).toLowerCase() === "null", ut = _o(b).toLowerCase() === "undefined"; for (let Ct = s.cachedOptions.size - 1; Ct >= 0; Ct--) { const Ae = wt.value[Ct]; if (z ? Je(Ae.value, e.valueKey) === Je(b, e.valueKey) : Ae.value === b) { T = { value: b, currentLabel: Ae.currentLabel, get isDisabled() { return Ae.isDisabled; } }; break; } } if (T) return T; const Ht = z ? b.label : !Y && !ut ? b : ""; return { value: b, currentLabel: Ht }; }, Ge = () => { s.hoveringIndex = oe.value.findIndex((b) => s.selected.some((T) => To(T) === To(b))); }, zt = () => { s.selectionWidth = l.value.getBoundingClientRect().width; }, dn = () => { s.calculatorWidth = v.value.getBoundingClientRect().width; }, Dn = () => { s.collapseItemWidth = y.value.getBoundingClientRect().width; }, Ft = () => { var b, T; (T = (b = u.value) == null ? void 0 : b.updatePopper) == null || T.call(b); }, fn = () => { var b, T; (T = (b = c.value) == null ? void 0 : b.updatePopper) == null || T.call(b); }, pn = () => { s.inputValue.length > 0 && !L.value && (L.value = true), xt(s.inputValue); }, vn = (b) => { if (s.inputValue = b.target.value, e.remote) hn(); else return pn(); }, hn = Kf(() => { pn(); }, Bt.value), gn = (b) => { Jo(e.modelValue, b) || t(ho, b); }, Zi = (b) => Gf(b, (T) => !s.disabledOptions.has(T)), Yi = (b) => { if (e.multiple && b.code !== Tn.delete && b.target.value.length <= 0) { const T = Me(e.modelValue).slice(), z = Zi(T); if (z < 0) return; const Y = T[z]; T.splice(z, 1), t(ht, T), gn(T), t("remove-tag", Y); } }, Ji = (b, T) => { const z = s.selected.indexOf(T); if (z > -1 && !k.value) { const Y = Me(e.modelValue).slice(); Y.splice(z, 1), t(ht, Y), gn(Y), t("remove-tag", T.value); } b.stopPropagation(), Hn(); }, Nr = (b) => { b.stopPropagation(); const T = e.multiple ? [] : be.value; if (e.multiple) for (const z of s.selected) z.isDisabled && T.push(z.value); t(ht, T), gn(T), s.hoveringIndex = -1, L.value = false, t("clear"), Hn(); }, Br = (b) => { var T; if (e.multiple) { const z = Me((T = e.modelValue) != null ? T : []).slice(), Y = Dr(z, b.value); Y > -1 ? z.splice(Y, 1) : (e.multipleLimit <= 0 || z.length < e.multipleLimit) && z.push(b.value), t(ht, z), gn(z), b.created && xt(""), e.filterable && !e.reserveKeyword && (s.inputValue = ""); } else t(ht, b.value), gn(b.value), L.value = false; Hn(), !L.value && nextTick(() => { zn(b); }); }, Dr = (b = [], T) => { if (!Be(T)) return b.indexOf(T); const z = e.valueKey; let Y = -1; return b.some((ut, Ht) => toRaw(Je(ut, z)) === Je(T, z) ? (Y = Ht, true) : false), Y; }, zn = (b) => { var T, z, Y, ut, Ht; const Vn = Ne(b) ? b[0] : b; let Ct = null; if (Vn != null && Vn.value) { const Ae = oe.value.filter((jr) => jr.value === Vn.value); Ae.length > 0 && (Ct = Ae[0].$el); } if (u.value && Ct) { const Ae = (ut = (Y = (z = (T = u.value) == null ? void 0 : T.popperRef) == null ? void 0 : z.contentRef) == null ? void 0 : Y.querySelector) == null ? void 0 : ut.call(Y, `.${r.be("dropdown", "wrap")}`); Ae && np(Ae, Ct); } (Ht = C.value) == null || Ht.handleScroll(); }, Xi = (b) => { s.options.set(b.value, b), s.cachedOptions.set(b.value, b), b.disabled && s.disabledOptions.set(b.value, b); }, Qi = (b, T) => { s.options.get(b) === T && s.options.delete(b); }, el = computed(() => { var b, T; return (T = (b = u.value) == null ? void 0 : b.popperRef) == null ? void 0 : T.contentRef; }), tl = () => { s.isBeforeHide = false, nextTick(() => zn(s.selected)); }, Hn = () => { var b; (b = d.value) == null || b.focus(); }, zr = () => { var b; (b = d.value) == null || b.blur(); }, nl = (b) => { Nr(b); }, ol = () => { L.value = false, A.value && zr(); }, rl = () => { s.inputValue.length > 0 ? s.inputValue = "" : L.value = false; }, Hr = () => { k.value || (Vo && (s.inputHovering = true), s.menuVisibleOnFocus ? s.menuVisibleOnFocus = false : L.value = !L.value); }, al = () => { L.value ? oe.value[s.hoveringIndex] && Br(oe.value[s.hoveringIndex]) : Hr(); }, To = (b) => Be(b.value) ? Je(b.value, e.valueKey) : b.value, sl = computed(() => oe.value.filter((b) => b.visible).every((b) => b.disabled)), il = computed(() => e.multiple ? e.collapseTags ? s.selected.slice(0, e.maxCollapseTags) : s.selected : []), ll = computed(() => e.multiple ? e.collapseTags ? s.selected.slice(e.maxCollapseTags) : [] : []), Vr = (b) => { if (!L.value) { L.value = true; return; } if (!(s.options.size === 0 || s.filteredOptionsCount === 0 || $.value) && !sl.value) { b === "next" ? (s.hoveringIndex++, s.hoveringIndex === s.options.size && (s.hoveringIndex = 0)) : b === "prev" && (s.hoveringIndex--, s.hoveringIndex < 0 && (s.hoveringIndex = s.options.size - 1)); const T = oe.value[s.hoveringIndex]; (T.disabled === true || T.states.groupDisabled === true || !T.visible) && Vr(b), nextTick(() => zn(H.value)); } }, ul = () => { if (!l.value) return 0; const b = window.getComputedStyle(l.value); return Number.parseFloat(b.gap || "6px"); }, cl = computed(() => { const b = ul(); return { maxWidth: `${y.value && e.maxCollapseTags === 1 ? s.selectionWidth - s.collapseItemWidth - b : s.selectionWidth}px` }; }), dl = computed(() => ({ maxWidth: `${s.selectionWidth}px` })), fl = computed(() => ({ width: `${Math.max(s.calculatorWidth, Ag)}px` })); return pt(l, zt), pt(v, dn), pt(p, Ft), pt(E, Ft), pt(m, fn), pt(y, Dn), onMounted(() => { Dt(); }), { inputId: X, contentId: o, nsSelect: r, nsInput: a, states: s, isFocused: A, expanded: L, optionsArray: oe, hoverOption: H, selectSize: Rn, filteredOptionsCount: le, resetCalculatorWidth: dn, updateTooltip: Ft, updateTagTooltip: fn, debouncedOnInputChange: hn, onInput: vn, deletePrevTag: Yi, deleteTag: Ji, deleteSelected: Nr, handleOptionSelect: Br, scrollToOption: zn, hasModelValue: q, shouldShowPlaceholder: Nn, currentPlaceholder: So, mouseEnterEventName: Oo, showClose: Ke, iconComponent: fe, iconReverse: Rt, validateState: Nt, validateIcon: bt, showNewOption: lt, updateOptions: Mn, collapseTagSize: un, setSelected: Dt, selectDisabled: k, emptyText: $e, handleCompositionStart: S, handleCompositionUpdate: x, handleCompositionEnd: O, onOptionCreate: Xi, onOptionDestroy: Qi, handleMenuEnter: tl, focus: Hn, blur: zr, handleClearClick: nl, handleClickOutside: ol, handleEsc: rl, toggleMenu: Hr, selectOption: al, getValueKey: To, navigateOptions: Vr, dropdownMenuVisible: Co, showTagList: il, collapseTagList: ll, tagStyle: cl, collapseTagStyle: dl, inputStyle: fl, popperRef: el, inputRef: d, tooltipRef: u, tagTooltipRef: c, calculatorRef: v, prefixRef: g, suffixRef: f, selectRef: i, wrapperRef: E, selectionRef: l, scrollbarRef: C, menuRef: p, tagMenuRef: m, collapseItemRef: y }; }; var Lg = defineComponent({ name: "ElOptions", setup(e, { slots: t }) { const n = inject(xo); let o = []; return () => { var r, a; const s = (r = t.default) == null ? void 0 : r.call(t), i = []; function l(u) { Ne(u) && u.forEach((c) => { var d, v, g, f; const p = (d = (c == null ? void 0 : c.type) || {}) == null ? void 0 : d.name; p === "ElOptionGroup" ? l(!rn(c.children) && !Ne(c.children) && ue((v = c.children) == null ? void 0 : v.default) ? (g = c.children) == null ? void 0 : g.default() : c.children) : p === "ElOption" ? i.push((f = c.props) == null ? void 0 : f.value) : Ne(c.children) && l(c.children); }); } return s.length && l((a = s[0]) == null ? void 0 : a.children), Jo(i, o) || (o = i, n && (n.states.optionValues = i)), s; }; } }); var Mg = ee({ name: String, id: String, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, autocomplete: { type: String, default: "off" }, automaticDropdown: Boolean, size: Gs, effect: { type: D(String), default: "light" }, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, popperClass: { type: String, default: "" }, popperOptions: { type: D(Object), default: () => ({}) }, remote: Boolean, loadingText: String, noMatchText: String, noDataText: String, remoteMethod: Function, filterMethod: Function, multiple: Boolean, multipleLimit: { type: Number, default: 0 }, placeholder: { type: String }, defaultFirstOption: Boolean, reserveKeyword: { type: Boolean, default: true }, valueKey: { type: String, default: "value" }, collapseTags: Boolean, collapseTagsTooltip: Boolean, maxCollapseTags: { type: Number, default: 1 }, teleported: he.teleported, persistent: { type: Boolean, default: true }, clearIcon: { type: Yt, default: Es }, fitInputWidth: Boolean, suffixIcon: { type: Yt, default: rp }, tagType: { ...or.type, default: "info" }, tagEffect: { ...or.effect, default: "light" }, validateEvent: { type: Boolean, default: true }, remoteShowSuffix: Boolean, placement: { type: D(String), values: go, default: "bottom-start" }, fallbackPlacements: { type: D(Array), default: ["bottom-start", "top-start", "right", "left"] }, appendTo: String, ...X0, ...bo(["ariaLabel"]) }); var ts = "ElSelect"; var Rg = defineComponent({ name: ts, componentName: ts, components: { ElSelectMenu: $g, ElOption: Mr, ElOptions: Lg, ElTag: tg, ElScrollbar: xv, ElTooltip: ni, ElIcon: nn }, directives: { ClickOutside: Yh }, props: Mg, emits: [ ht, ho, "remove-tag", "clear", "visible-change", "focus", "blur" ], setup(e, { emit: t }) { const n = computed(() => { const { modelValue: a, multiple: s } = e, i = s ? [] : void 0; return Ne(a) ? s ? a : i : s ? i : a; }), o = reactive({ ...toRefs(e), modelValue: n }), r = Pg(o, t); return provide(xo, reactive({ props: o, states: r.states, optionsArray: r.optionsArray, handleOptionSelect: r.handleOptionSelect, onOptionCreate: r.onOptionCreate, onOptionDestroy: r.onOptionDestroy, selectRef: r.selectRef, setSelected: r.setSelected })), { ...r, modelValue: n }; } }); function Ng(e, t, n, o, r, a) { const s = resolveComponent("el-tag"), i = resolveComponent("el-tooltip"), l = resolveComponent("el-icon"), u = resolveComponent("el-option"), c = resolveComponent("el-options"), d = resolveComponent("el-scrollbar"), v = resolveComponent("el-select-menu"), g = resolveDirective("click-outside"); return withDirectives((openBlock(), createElementBlock("div", { ref: "selectRef", class: normalizeClass([e.nsSelect.b(), e.nsSelect.m(e.selectSize)]), [toHandlerKey(e.mouseEnterEventName)]: (f) => e.states.inputHovering = true, onMouseleave: (f) => e.states.inputHovering = false }, [ createVNode(i, { ref: "tooltipRef", visible: e.dropdownMenuVisible, placement: e.placement, teleported: e.teleported, "popper-class": [e.nsSelect.e("popper"), e.popperClass], "popper-options": e.popperOptions, "fallback-placements": e.fallbackPlacements, effect: e.effect, pure: "", trigger: "click", transition: `${e.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": false, "gpu-acceleration": false, persistent: e.persistent, "append-to": e.appendTo, onBeforeShow: e.handleMenuEnter, onHide: (f) => e.states.isBeforeHide = false }, { default: withCtx(() => { var f; return [ createBaseVNode("div", { ref: "wrapperRef", class: normalizeClass([ e.nsSelect.e("wrapper"), e.nsSelect.is("focused", e.isFocused), e.nsSelect.is("hovering", e.states.inputHovering), e.nsSelect.is("filterable", e.filterable), e.nsSelect.is("disabled", e.selectDisabled) ]), onClick: withModifiers(e.toggleMenu, ["prevent"]) }, [ e.$slots.prefix ? (openBlock(), createElementBlock("div", { key: 0, ref: "prefixRef", class: normalizeClass(e.nsSelect.e("prefix")) }, [ renderSlot(e.$slots, "prefix") ], 2)) : createCommentVNode("v-if", true), createBaseVNode("div", { ref: "selectionRef", class: normalizeClass([ e.nsSelect.e("selection"), e.nsSelect.is("near", e.multiple && !e.$slots.prefix && !!e.states.selected.length) ]) }, [ e.multiple ? renderSlot(e.$slots, "tag", { key: 0 }, () => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.showTagList, (p) => (openBlock(), createElementBlock("div", { key: e.getValueKey(p), class: normalizeClass(e.nsSelect.e("selected-item")) }, [ createVNode(s, { closable: !e.selectDisabled && !p.isDisabled, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", style: normalizeStyle(e.tagStyle), onClose: (m) => e.deleteTag(m, p) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e.nsSelect.e("tags-text")) }, [ renderSlot(e.$slots, "label", { label: p.currentLabel, value: p.value }, () => [ createTextVNode(toDisplayString(p.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), e.collapseTags && e.states.selected.length > e.maxCollapseTags ? (openBlock(), createBlock(i, { key: 0, ref: "tagTooltipRef", disabled: e.dropdownMenuVisible || !e.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: e.effect, placement: "bottom", teleported: e.teleported }, { default: withCtx(() => [ createBaseVNode("div", { ref: "collapseItemRef", class: normalizeClass(e.nsSelect.e("selected-item")) }, [ createVNode(s, { closable: false, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", style: normalizeStyle(e.collapseTagStyle) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e.nsSelect.e("tags-text")) }, " + " + toDisplayString(e.states.selected.length - e.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: withCtx(() => [ createBaseVNode("div", { ref: "tagMenuRef", class: normalizeClass(e.nsSelect.e("selection")) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.collapseTagList, (p) => (openBlock(), createElementBlock("div", { key: e.getValueKey(p), class: normalizeClass(e.nsSelect.e("selected-item")) }, [ createVNode(s, { class: "in-tooltip", closable: !e.selectDisabled && !p.isDisabled, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", onClose: (m) => e.deleteTag(m, p) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e.nsSelect.e("tags-text")) }, [ renderSlot(e.$slots, "label", { label: p.currentLabel, value: p.value }, () => [ createTextVNode(toDisplayString(p.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true) ]) : createCommentVNode("v-if", true), e.selectDisabled ? createCommentVNode("v-if", true) : (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass([ e.nsSelect.e("selected-item"), e.nsSelect.e("input-wrapper"), e.nsSelect.is("hidden", !e.filterable) ]) }, [ withDirectives(createBaseVNode("input", { id: e.inputId, ref: "inputRef", "onUpdate:modelValue": (p) => e.states.inputValue = p, type: "text", name: e.name, class: normalizeClass([e.nsSelect.e("input"), e.nsSelect.is(e.selectSize)]), disabled: e.selectDisabled, autocomplete: e.autocomplete, style: normalizeStyle(e.inputStyle), role: "combobox", readonly: !e.filterable, spellcheck: "false", "aria-activedescendant": ((f = e.hoverOption) == null ? void 0 : f.id) || "", "aria-controls": e.contentId, "aria-expanded": e.dropdownMenuVisible, "aria-label": e.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ withKeys(withModifiers((p) => e.navigateOptions("next"), ["stop", "prevent"]), ["down"]), withKeys(withModifiers((p) => e.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), withKeys(withModifiers(e.handleEsc, ["stop", "prevent"]), ["esc"]), withKeys(withModifiers(e.selectOption, ["stop", "prevent"]), ["enter"]), withKeys(withModifiers(e.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: e.handleCompositionStart, onCompositionupdate: e.handleCompositionUpdate, onCompositionend: e.handleCompositionEnd, onInput: e.onInput, onClick: withModifiers(e.toggleMenu, ["stop"]) }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [ [vModelText, e.states.inputValue] ]), e.filterable ? (openBlock(), createElementBlock("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: normalizeClass(e.nsSelect.e("input-calculator")), textContent: toDisplayString(e.states.inputValue) }, null, 10, ["textContent"])) : createCommentVNode("v-if", true) ], 2)), e.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass([ e.nsSelect.e("selected-item"), e.nsSelect.e("placeholder"), e.nsSelect.is("transparent", !e.hasModelValue || e.expanded && !e.states.inputValue) ]) }, [ e.hasModelValue ? renderSlot(e.$slots, "label", { key: 0, label: e.currentPlaceholder, value: e.modelValue }, () => [ createBaseVNode("span", null, toDisplayString(e.currentPlaceholder), 1) ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(e.currentPlaceholder), 1)) ], 2)) : createCommentVNode("v-if", true) ], 2), createBaseVNode("div", { ref: "suffixRef", class: normalizeClass(e.nsSelect.e("suffix")) }, [ e.iconComponent && !e.showClose ? (openBlock(), createBlock(l, { key: 0, class: normalizeClass([e.nsSelect.e("caret"), e.nsSelect.e("icon"), e.iconReverse]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e.iconComponent))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true), e.showClose && e.clearIcon ? (openBlock(), createBlock(l, { key: 1, class: normalizeClass([ e.nsSelect.e("caret"), e.nsSelect.e("icon"), e.nsSelect.e("clear") ]), onClick: e.handleClearClick }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true), e.validateState && e.validateIcon ? (openBlock(), createBlock(l, { key: 2, class: normalizeClass([e.nsInput.e("icon"), e.nsInput.e("validateIcon")]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e.validateIcon))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 2) ], 10, ["onClick"]) ]; }), content: withCtx(() => [ createVNode(v, { ref: "menuRef" }, { default: withCtx(() => [ e.$slots.header ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(e.nsSelect.be("dropdown", "header")), onClick: withModifiers(() => { }, ["stop"]) }, [ renderSlot(e.$slots, "header") ], 10, ["onClick"])) : createCommentVNode("v-if", true), withDirectives(createVNode(d, { id: e.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": e.nsSelect.be("dropdown", "wrap"), "view-class": e.nsSelect.be("dropdown", "list"), class: normalizeClass([e.nsSelect.is("empty", e.filteredOptionsCount === 0)]), role: "listbox", "aria-label": e.ariaLabel, "aria-orientation": "vertical" }, { default: withCtx(() => [ e.showNewOption ? (openBlock(), createBlock(u, { key: 0, value: e.states.inputValue, created: true }, null, 8, ["value"])) : createCommentVNode("v-if", true), createVNode(c, null, { default: withCtx(() => [ renderSlot(e.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [vShow, e.states.options.size > 0 && !e.loading] ]), e.$slots.loading && e.loading ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(e.nsSelect.be("dropdown", "loading")) }, [ renderSlot(e.$slots, "loading") ], 2)) : e.loading || e.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(e.nsSelect.be("dropdown", "empty")) }, [ renderSlot(e.$slots, "empty", {}, () => [ createBaseVNode("span", null, toDisplayString(e.emptyText), 1) ]) ], 2)) : createCommentVNode("v-if", true), e.$slots.footer ? (openBlock(), createElementBlock("div", { key: 3, class: normalizeClass(e.nsSelect.be("dropdown", "footer")), onClick: withModifiers(() => { }, ["stop"]) }, [ renderSlot(e.$slots, "footer") ], 10, ["onClick"])) : createCommentVNode("v-if", true) ]), _: 3 }, 512) ]), _: 3 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"]) ], 16, ["onMouseleave"])), [ [g, e.handleClickOutside, e.popperRef] ]); } var Bg = J(Rg, [["render", Ng], ["__file", "select.vue"]]); var Dg = defineComponent({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(e) { const t = te("select"), n = ref(null), o = getCurrentInstance(), r = ref([]); provide(ci, reactive({ ...toRefs(e) })); const a = computed(() => r.value.some((u) => u.visible === true)), s = (u) => { var c, d; return ((c = u.type) == null ? void 0 : c.name) === "ElOption" && !!((d = u.component) != null && d.proxy); }, i = (u) => { const c = Me(u), d = []; return c.forEach((v) => { var g, f; s(v) ? d.push(v.component.proxy) : (g = v.children) != null && g.length ? d.push(...i(v.children)) : (f = v.component) != null && f.subTree && d.push(...i(v.component.subTree)); }), d; }, l = () => { r.value = i(o.subTree); }; return onMounted(() => { l(); }), Yl(n, l, { attributes: true, subtree: true, childList: true }), { groupRef: n, visible: a, ns: t }; } }); function zg(e, t, n, o, r, a) { return withDirectives((openBlock(), createElementBlock("ul", { ref: "groupRef", class: normalizeClass(e.ns.be("group", "wrap")) }, [ createBaseVNode("li", { class: normalizeClass(e.ns.be("group", "title")) }, toDisplayString(e.label), 3), createBaseVNode("li", null, [ createBaseVNode("ul", { class: normalizeClass(e.ns.b("group")) }, [ renderSlot(e.$slots, "default") ], 2) ]) ], 2)), [ [vShow, e.visible] ]); } var di = J(Dg, [["render", zg], ["__file", "option-group.vue"]]); var sn = ke(Bg, { Option: Mr, OptionGroup: di }); var ln = vo(Mr); vo(di); var Hg = ee({ trigger: kn.trigger, placement: Do.placement, disabled: kn.disabled, visible: he.visible, transition: he.transition, popperOptions: Do.popperOptions, tabindex: Do.tabindex, content: he.content, popperStyle: he.popperStyle, popperClass: he.popperClass, enterable: { ...he.enterable, default: true }, effect: { ...he.effect, default: "light" }, teleported: he.teleported, title: String, width: { type: [String, Number], default: 150 }, offset: { type: Number, default: void 0 }, showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 }, showArrow: { type: Boolean, default: true }, persistent: { type: Boolean, default: true }, "onUpdate:visible": { type: Function } }); var Vg = { "update:visible": (e) => mr(e), "before-enter": () => true, "before-leave": () => true, "after-enter": () => true, "after-leave": () => true }; var jg = "onUpdate:visible"; var Ug = defineComponent({ name: "ElPopover" }); var Kg = defineComponent({ ...Ug, props: Hg, emits: Vg, setup(e, { expose: t, emit: n }) { const o = e, r = computed(() => o[jg]), a = te("popover"), s = ref(), i = computed(() => { var m; return (m = unref(s)) == null ? void 0 : m.popperRef; }), l = computed(() => [ { width: to(o.width) }, o.popperStyle ]), u = computed(() => [a.b(), o.popperClass, { [a.m("plain")]: !!o.content }]), c = computed(() => o.transition === `${a.namespace.value}-fade-in-linear`), d = () => { var m; (m = s.value) == null || m.hide(); }, v = () => { n("before-enter"); }, g = () => { n("before-leave"); }, f = () => { n("after-enter"); }, p = () => { n("update:visible", false), n("after-leave"); }; return t({ popperRef: i, hide: d }), (m, y) => (openBlock(), createBlock(unref(ni), mergeProps({ ref_key: "tooltipRef", ref: s }, m.$attrs, { trigger: m.trigger, placement: m.placement, disabled: m.disabled, visible: m.visible, transition: m.transition, "popper-options": m.popperOptions, tabindex: m.tabindex, content: m.content, offset: m.offset, "show-after": m.showAfter, "hide-after": m.hideAfter, "auto-close": m.autoClose, "show-arrow": m.showArrow, "aria-label": m.title, effect: m.effect, enterable: m.enterable, "popper-class": unref(u), "popper-style": unref(l), teleported: m.teleported, persistent: m.persistent, "gpu-acceleration": unref(c), "onUpdate:visible": unref(r), onBeforeShow: v, onBeforeHide: g, onShow: f, onHide: p }), { content: withCtx(() => [ m.title ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(unref(a).e("title")), role: "title" }, toDisplayString(m.title), 3)) : createCommentVNode("v-if", true), renderSlot(m.$slots, "default", {}, () => [ createTextVNode(toDisplayString(m.content), 1) ]) ]), default: withCtx(() => [ m.$slots.reference ? renderSlot(m.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true) ]), _: 3 }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"])); } }); var Gg = J(Kg, [["__file", "popover.vue"]]); var ns = (e, t) => { const n = t.arg || t.value, o = n == null ? void 0 : n.popperRef; o && (o.triggerRef = e); }; var Wg = { mounted(e, t) { ns(e, t); }, updated(e, t) { ns(e, t); } }; var qg = "popover"; var Zg = vp(Wg, qg); var Rr = ke(Gg, { directive: Zg }); var fi = (e, t) => { const n = e.__vccOpts || e; for (const [o, r] of t) n[o] = r; return n; }; var Yg = ["xlink:href"]; var Jg = { __name: "SvgIcon", props: { /** * The svg icon to show. */ icon: { type: String, required: true }, /** * The option to spin the icon. */ spin: { type: Boolean, default: false } }, setup(e) { return (t, n) => (openBlock(), createElementBlock("svg", { class: normalizeClass(["map-icon", { "map-icon-spin": e.spin }]) }, [ createBaseVNode("use", { "xlink:href": `#${e.icon}` }, null, 8, Yg) ], 2)); } }; var Xg = fi(Jg, [["__scopeId", "data-v-e172d5ff"]]); var pi = ` 2horpanel ? `; var vi = ` 2vertpanel ? `; var hi = ` 3panel ? `; var gi = ` 4panel ? `; var mi = ` 2horpanel ? `; var yi = ` 2horpanel ? `; var bi = ` 4panel ? `; var wi = ` changeBckgd `; var xi = ` close no bk `; var Fi = ` close `; var Ci = ` closeFullScreen `; var Si = ` Comment `; var Oi = ` Connection `; var Ti = ` dock `; var _i = ` drawLine `; var Ei = ` drawPoint `; var ki = ` drawPolygon `; var Ii = ` drawTrash `; var $i = ` fitWindow `; var Ai = ` fullScreen `; var Pi = 'DataPortal-Icons'; var Li = ` magnifyingGlass `; var Mi = `Created by Wahyu Prihantorofrom the Noun Project`; var Ri = ` openMap `; var Ni = ` Artboard Copy 6 `; var Bi = ` permalink `; var Di = ` play `; var zi = ` resetZoom `; var Hi = ` singlepanel ? `; var Vi = ` tooltips ? `; var ji = ` undock `; var Ui = ` zoomIn `; var Ki = ` zoomOut `; var Gi = (e, t, n, o) => { const r = ["title", "desc", "defs", "style"], a = ["width", "height"], s = o || []; let i = document.createElement("div"); i.innerHTML = e, r.map((u) => { const c = i.querySelector(u); c && c.remove(); }), a.map((u) => { i.querySelector("svg").removeAttribute(u); }), o && s.map((u) => { Object.values(i.querySelectorAll(`[${u}]`)).map((c) => { c.removeAttribute(u); }); }); const l = i.innerHTML; return i = null, l; }; var Wi = (e) => [ // Remove XML stuffs and comments [/<\?xml[\s\S]*?>/gi, ""], [//gi, ""], [//gi, ""], // SVG XML -> HTML5 [/\<([A-Za-z]+)([^\>]*)\/\>/g, "<$1$2>"], // convert self-closing XML SVG nodes to explicitly closed HTML5 SVG nodes [/\s+/g, " "], // replace whitespace sequences with a single space [/\> \<"] // remove whitespace between tags ].reduce((t, n) => "".replace.apply(t, n), e).trim(); var Qg = true; var e1 = true; var t12 = ["fill"]; var rr = Object.assign({ "/assets/icons/2horpanel.svg": pi, "/assets/icons/2vertpanel.svg": vi, "/assets/icons/3panel.svg": hi, "/assets/icons/4panel.svg": gi, "/assets/icons/5panel.svg": mi, "/assets/icons/6panel.svg": yi, "/assets/icons/6panelVertical.svg": bi, "/assets/icons/changeBckgd.svg": wi, "/assets/icons/close-no-bk.svg": xi, "/assets/icons/close.svg": Fi, "/assets/icons/closeFullScreen.svg": Ci, "/assets/icons/comment.svg": Si, "/assets/icons/connection.svg": Oi, "/assets/icons/dock.svg": Ti, "/assets/icons/drawLine.svg": _i, "/assets/icons/drawPoint.svg": Ei, "/assets/icons/drawPolygon.svg": ki, "/assets/icons/drawTrash.svg": Ii, "/assets/icons/fitWindow.svg": $i, "/assets/icons/fullScreen.svg": Ai, "/assets/icons/help.svg": Pi, "/assets/icons/magnifyingGlass.svg": Li, "/assets/icons/noun-filter.svg": Mi, "/assets/icons/openMap.svg": Ri, "/assets/icons/pause.svg": Ni, "/assets/icons/permalink.svg": Bi, "/assets/icons/play.svg": Di, "/assets/icons/resetZoom.svg": zi, "/assets/icons/singlepanel.svg": Hi, "/assets/icons/tooltips.svg": Vi, "/assets/icons/undock.svg": ji, "/assets/icons/zoomIn.svg": Ui, "/assets/icons/zoomOut.svg": Ki }); var n1 = Object.keys(rr).map((e) => { const t = Gi(rr[e], Qg, e1, t12), n = e.replace(/^.+\/(\w+).svg$/, "$1"); return Wi(t).replace("", "symbol>"); }); n1.join(` `); var ar = Object.assign({ "/assets/icons/2horpanel.svg": pi, "/assets/icons/2vertpanel.svg": vi, "/assets/icons/3panel.svg": hi, "/assets/icons/4panel.svg": gi, "/assets/icons/5panel.svg": mi, "/assets/icons/6panel.svg": yi, "/assets/icons/6panelVertical.svg": bi, "/assets/icons/changeBckgd.svg": wi, "/assets/icons/close-no-bk.svg": xi, "/assets/icons/close.svg": Fi, "/assets/icons/closeFullScreen.svg": Ci, "/assets/icons/comment.svg": Si, "/assets/icons/connection.svg": Oi, "/assets/icons/dock.svg": Ti, "/assets/icons/drawLine.svg": _i, "/assets/icons/drawPoint.svg": Ei, "/assets/icons/drawPolygon.svg": ki, "/assets/icons/drawTrash.svg": Ii, "/assets/icons/fitWindow.svg": $i, "/assets/icons/fullScreen.svg": Ai, "/assets/icons/help.svg": Pi, "/assets/icons/magnifyingGlass.svg": Li, "/assets/icons/noun-filter.svg": Mi, "/assets/icons/openMap.svg": Ri, "/assets/icons/pause.svg": Ni, "/assets/icons/permalink.svg": Bi, "/assets/icons/play.svg": Di, "/assets/icons/resetZoom.svg": zi, "/assets/icons/singlepanel.svg": Hi, "/assets/icons/tooltips.svg": Vi, "/assets/icons/undock.svg": ji, "/assets/icons/zoomIn.svg": Ui, "/assets/icons/zoomOut.svg": Ki }); var o1 = Object.keys(ar).map((e) => { const t = Gi(ar[e]), n = e.replace(/^.+\/(\w+).svg$/, "$1"); return Wi(t).replace("", "symbol>"); }); var r1 = { name: "MapSvgSpriteColor", svgContext: ar, svgSprite: o1.join(` `) // concatenate all symbols into $options.svgSprite }; var a1 = ["innerHTML"]; function s1(e, t, n, o, r, a) { return openBlock(), createElementBlock("svg", { width: "0", height: "0", style: { display: "none" }, innerHTML: e.$options.svgSprite }, null, 8, a1); } var i1 = fi(r1, [["render", s1]]); var Fo = (e, t) => { const n = e.__vccOpts || e; for (const [o, r] of t) n[o] = r; return n; }; var l1 = { name: "PlotControls", components: { MapSvgSpriteColor: i1, MapSvgIcon: Xg, ElSelect: sn, ElOption: ln, ElCollapse: li, ElCollapseItem: ui, ElButton: Pn, ElPopover: Rr }, props: { parentElement: { type: Object, required: true }, controlsEnabled: { type: Boolean, required: true } }, data: function() { return { hoverVisibilities: [{ value: false }, { value: false }, { value: false }, { value: false }, { value: false }], zoomSelect: [ { value: "1", label: "100%" } ], selectZoom: "100%", zoom: 100, maxZoom: 800, zoomInDisabled: false, zoomOutDisabled: true }; }, methods: { // zoomIn: Find and click the plotly modebar 'zoom in' zoomIn: function() { this.zoom += 100, this.parentElement.element.querySelector('a[data-attr="zoom"][data-val="in"]').click(), this.setDisabledButtons(this.zoom), this.updateZoomSelect(this.zoom); }, // zoomOut: Find and click the plotly modebar 'zoom out' zoomOut: function() { this.zoom -= 100, this.parentElement.element.querySelector('a[data-attr="zoom"][data-val="out"]').click(), this.setDisabledButtons(this.zoom), this.updateZoomSelect(this.zoom); }, // setDisabledButtons(zoomLevel): Disable buttons once they hit max zoom setDisabledButtons(e) { e >= this.maxZoom ? this.zoomInDisabled = true : this.zoomInDisabled = false, e <= 0 ? this.zoomOutDisabled = true : this.zoomOutDisabled = false; }, resetView: function() { this.zoom = 100, this.parentElement.element.querySelector('a[data-attr="zoom"][data-val="reset"]').click(), this.setDisabledButtons(this.zoom), this.updateZoomSelect(this.zoom); }, percentToNum(e) { return Number(e.slice(0, -1)); }, selectZoomChange: function(e) { if (e === "100%") { this.resetView(); return; } let t = this.percentToNum(e), n = Math.round((t - this.zoom) / 100); for (let o = 0; o < Math.abs(n); o++) n > 0 ? this.zoomIn() : this.zoomOut(); this.updateZoomSelect(t); }, updateZoomSelect(e) { this.selectZoom = String(e) + "%"; }, createZoomPercentages: function() { this.zoomSelect = []; for (let e = 0; e <= this.maxZoom / 100; e++) this.zoomSelect.push({ value: e, label: (e + 1) * 100 + "%" }); }, setHelpMode: function(e) { e ? (this.inHelp = true, this.hoverVisibilities.forEach((t) => { t.value = true; })) : (this.inHelp = false, this.hoverVisibilities.forEach((t) => { t.value = false; })); }, showToolitip: function(e) { this.inHelp || (this.hoverVisibilities[e].value = true, this.tooltipWait = setTimeout(() => { this.hoverVisibilities[e].value = true; }, 1e3)); }, hideToolitip: function(e) { this.inHelp || (this.hoverVisibilities[e].value = false, clearInterval(this.tooltipWait)); }, handleWheel: function(e) { let t = Math.round(e.deltaY / 7); this.zoom = this.zoom - t, this.updateZoomSelect(this.zoom); } }, mounted: function() { this.createZoomPercentages(), setTimeout(() => { this.parentElement.element.addEventListener("wheel", this.handleWheel); }, 1e3); }, beforeUnmount: function() { this.parentElement.element.removeEventListener("wheel", this.handleWheel); } }; var u1 = { class: "container" }; function c1(e, t, n, o, r, a) { const s = resolveComponent("map-svg-sprite-color"), i = resolveComponent("map-svg-icon"), l = Rr, u = ln, c = sn; return openBlock(), createElementBlock("div", u1, [ createVNode(s), createBaseVNode("div", { ref: "zoomControls", class: normalizeClass([{ inactive: !n.controlsEnabled }, "bottom-right-control"]) }, [ createVNode(l, { modelValue: e.hoverVisibilities[0].value, "onUpdate:modelValue": t[3] || (t[3] = (d) => e.hoverVisibilities[0].value = d), content: "Zoom in", placement: "left", teleported: false, trigger: "manual", "popper-class": "plot-popper" }, { reference: withCtx(() => [ createVNode(i, { icon: "zoomIn", class: "icon-button zoomIn", onClick: t[0] || (t[0] = (d) => a.zoomIn()), onMouseover: t[1] || (t[1] = (d) => a.showToolitip(0)), onMouseout: t[2] || (t[2] = (d) => a.hideToolitip(0)) }) ]), _: 1 }, 8, ["modelValue"]), createVNode(l, { modelValue: e.hoverVisibilities[1].value, "onUpdate:modelValue": t[7] || (t[7] = (d) => e.hoverVisibilities[1].value = d), content: "Zoom out", placement: "top-end", teleported: false, trigger: "manual", "popper-class": "plot-popper popper-zoomout" }, { reference: withCtx(() => [ createVNode(i, { icon: "zoomOut", class: "icon-button zoomOut", onClick: t[4] || (t[4] = (d) => a.zoomOut()), onMouseover: t[5] || (t[5] = (d) => a.showToolitip(1)), onMouseout: t[6] || (t[6] = (d) => a.hideToolitip(1)) }) ]), _: 1 }, 8, ["modelValue"]), createVNode(c, { size: "small", modelValue: e.selectZoom, "onUpdate:modelValue": t[8] || (t[8] = (d) => e.selectZoom = d), placeholder: "100%", class: "zoomSelect", onChange: a.selectZoomChange }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.zoomSelect, (d) => (openBlock(), createBlock(u, { key: d.value, label: d.label, value: d.label }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue", "onChange"]), createVNode(l, { modelValue: e.hoverVisibilities[2].value, "onUpdate:modelValue": t[12] || (t[12] = (d) => e.hoverVisibilities[2].value = d), content: "Reset", placement: "top", teleported: false, trigger: "manual", "popper-class": "plot-popper" }, { reference: withCtx(() => [ createVNode(i, { icon: "resetZoom", class: "icon-button resetView", onClick: t[9] || (t[9] = (d) => a.resetView()), onMouseover: t[10] || (t[10] = (d) => a.showToolitip(2)), onMouseout: t[11] || (t[11] = (d) => a.hideToolitip(2)) }) ]), _: 1 }, 8, ["modelValue"]) ], 2) ]); } var Ln = Fo(l1, [["render", c1], ["__scopeId", "data-v-2ec1d0d2"]]); import_core.default.register([import_scatter.default, import_bar.default, import_heatmap.default]); var d1 = (e, t) => import_papaparse.default.parse(e, { download: true, complete: t }); var sr = { loadFile: d1 }; var qi = { components: { PlotControls: Ln }, props: { metadata: { type: Object, required: true }, sourceData: { type: Object, required: true }, plotLayout: { type: Object, required: true }, supplementalData: { type: Array, required: true }, version: { type: String, required: true }, selectorUi: { type: Boolean, default: true } }, data: function() { return { layout: { paper_bgcolor: "rgba(0,0,0,0)", plot_bgcolor: "rgba(0,0,0,0)", autosize: true, margin: { t: 25, l: 55, r: 55, b: 90, pad: 4 } }, loading: false, options: { responsive: true, scrollZoom: true } }; }, computed: { title() { return this.sourceData.url.split("\\").pop().split("/").pop().split(".")[0]; } } }; var f1 = { name: "TimeseriesPlot", components: { PlotControls: Ln, ElSelect: sn, ElButton: Pn, ElOption: ln }, mixins: [qi], data: function() { return { dataValues: markRaw([]), filterX: [], parsedData: null, time: markRaw([]), traceData: null, traceNames: [], xAxisLabel: "time" }; }, computed: { fullMetadata() { let e = JSON.parse(JSON.stringify(this.metadata)); return e["y-axes-columns"] || (e["y-axes-columns"] = []), e["x-axis-column"] || (e["x-axis-column"] = 0), e["no-header"] || (e["no-header"] = false), e["row-major"] || (e["row-major"] = false), e; } }, watch: { sourceData: function() { this.loadData(this.sourceData); } }, mounted: function() { this.loadData(this.sourceData); }, methods: { loadData(e) { e.url ? (this.loading = true, sr.loadFile(e.url, this.dataReady)) : import_core.default.react(this.$refs.plotlyplot, this.sourceData.data, this.plotLayout ? this.plotLayout : this.layout, this.options); }, dataReady(e) { const t = Date.now(); this.fullMetadata["no-header"] && sr.loadFile(this.supplementalData[0].url, this.headerDataReady), this.loading = false, this.parsedData = markRaw(e), this.findYaxesCols(), this.populateTime(), this.populateDataValues(), this.fullMetadata["no-header"] || (this.populateXaxisLabel(), this.populateTraceNames()), this.createPlot(this.time, this.xAxisLabel, this.dataValues, this.traceNames), console.log(Date.now() - t); }, headerDataReady(e) { this.traceData = markRaw(e), this.populateXaxisLabel(), this.populateTraceNames(), this.loading || this.createPlot(this.time, this.xAxisLabel, this.dataValues, this.traceNames); }, filterPlot() { let e = this.filterX; if (e.length === 0) { this.createPlot(this.time, this.xAxisLabel, this.dataValues, this.traceNames); return; } let t = []; for (let r of e) t.push(this.fullMetadata["y-axes-columns"][this.traceNames.indexOf(r)]); let n = this.parsedData.data; this.fullMetadata["no-header"] || (n = n.slice(1)); let o = []; for (let r of t) { const a = n.map((s) => s[r]); o.push(a); } this.createPlot(this.time, this.xAxisLabel, o, e); }, createPlot(e, t, n, o) { let r = []; for (let l = 0; l < n.length; l++) r.push({ type: "scatter", mode: "lines", name: o[l], x: e, y: n[l] }); let a = this.plotLayout ? this.plotLayout : this.layout, s = { title: { text: this.title }, xaxis: { title: { text: t } } }, i = { ...toRaw(a), ...s }; import_core.default.react(this.$refs.plotlyplot, r, i, this.options); }, findYaxesCols() { if (this.fullMetadata["y-axes-columns"].length === 0) { let e = Array(this.parsedData.data[0].length).keys(); e.shift(), e.shift(), this.fullMetadata["y-axes-columns"] = e; } }, populateXaxisLabel() { this.fullMetadata["no-header"] ? this.xAxisLabel = this.traceData.data[0][this.fullMetadata["x-axis-column"]] : this.xAxisLabel = this.parsedData.data[0][this.fullMetadata["x-axis-column"]]; }, populateTraceNames() { if (this.fullMetadata["no-header"]) { this.traceNames.splice(0, this.traceNames.length); for (let e of this.fullMetadata["y-axes-columns"]) this.traceNames.push(this.traceData.data[0][e]); this.$set(this.traceNames, 0, this.traceNames[0]); } else { this.traceNames = []; for (let e of this.fullMetadata["y-axes-columns"]) this.traceNames.push(this.parsedData.data[0][e]); } }, populateTime() { const e = this; let t = this.parsedData.data; this.fullMetadata["no-header"] || (t = t.slice(1)), this.time = markRaw(t.map(function(n) { return n[e.fullMetadata["x-axis-column"]]; })); }, populateDataValues() { let e = this.parsedData.data; this.fullMetadata["no-header"] || (e = e.slice(1)); let t = []; for (let n of this.fullMetadata["y-axes-columns"]) { const o = e.map((r) => r[n]); t.push(o); } this.dataValues = markRaw(t); } } }; var p1 = { ref: "plotContainer", class: "container" }; var v1 = { ref: "plotlyplot", class: "vue-plotly" }; function h1(e, t, n, o, r, a) { const s = ln, i = sn, l = Pn, u = Ln; return openBlock(), createElementBlock("div", p1, [ createBaseVNode("div", v1, null, 512), e.selectorUi ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(["chooser-container", { inactive: e.loading }]) }, [ createBaseVNode("span", null, [ createVNode(i, { ref: "selectBox", modelValue: e.filterX, "onUpdate:modelValue": t[0] || (t[0] = (c) => e.filterX = c), class: "channel-select", size: "large", multiple: "", filterable: "", "collapse-tags": "", "default-first-option": "", teleported: false, placeholder: "select" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.traceNames, (c) => (openBlock(), createBlock(s, { key: c, label: c, value: c }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"]) ]), createBaseVNode("span", null, [ createVNode(l, { class: "view-heatmap-button", onClick: a.filterPlot }, { default: withCtx(() => [ createTextVNode("Filter plot") ]), _: 1 }, 8, ["onClick"]) ]) ], 2)) : createCommentVNode("", true), createVNode(u, { ref: "controls", "parent-element": { element: e.$refs.plotContainer }, "controls-enabled": !e.loading }, null, 8, ["parent-element", "controls-enabled"]) ], 512); } var g1 = Fo(f1, [["render", h1], ["__scopeId", "data-v-ab61b52c"]]); var m1 = { name: "HeatmapPlot", components: { PlotControls: Ln, ElSelect: sn, ElOption: ln, ElCollapse: li, ElCollapseItem: ui, ElButton: Pn, ElPopover: Rr }, mixins: [qi], data: function() { return { columnHeaders: [], rowHeaders: [], dataValues: markRaw([]), filterX: [], filterY: [], loading: false, logScale: false, logDataValues: markRaw([]) }; }, computed: { fullMetadata() { let e = JSON.parse(JSON.stringify(this.metadata)); return e.columnHeaderSize || (e.columnHeaderSize = 1), e.columnHeaderIndex || (e.columnHeaderIndex = 0), e.rowHeaderSize || (e.rowHeaderSize = 1), e.rowHeaderIndex || (e.rowHeaderIndex = 0), e; }, logScaleEnabled() { return !!JSON.parse(JSON.stringify(this.metadata)).logScale; }, plotTitle() { return this.logScale ? this.title + " (Log scale)" : this.title; } }, watch: { sourceData: function() { this.loadData(this.sourceData); } }, mounted: function() { this.loadData(this.sourceData); }, methods: { loadData(e) { e.url ? (this.loading = true, sr.loadFile(e.url, this.dataReady)) : import_core.default.react(this.$refs.plotlyplot, this.sourceData.data, this.sourceData.layout ? this.sourceData.layout : this.layout, this.options); }, dataReady(e) { this.loading = false; const t = e; this.populateColumnHeaders(t), this.populateRowHeaders(t), this.populateDataValues(t), this.logScaleEnabled ? (this.logValues(), this.logScale = true, this.createPlot(this.columnHeaders, this.rowHeaders, this.logDataValues, "heatmap")) : this.createPlot(this.columnHeaders, this.rowHeaders, this.dataValues, "heatmap"); }, logValues() { this.dataValues.forEach((e, t) => { this.logDataValues.push([]), e.forEach((n) => { this.logDataValues[t].push(Math.log10(n)); }); }); }, logToggle() { this.logScale ? (this.logScale = false, this.createPlot(this.columnHeaders, this.rowHeaders, this.dataValues, "heatmap")) : (this.logScale = true, this.createPlot(this.columnHeaders, this.rowHeaders, this.logDataValues, "heatmap")); }, filterPlot() { let e = this.filterX, t = this.filterY; if (e.length === 0 && t.length === 0) { this.createPlot(this.columnHeaders, this.rowHeaders, this.dataValues, "heatmap"); return; } e.length === 0 && (e = this.columnHeaders), t.length === 0 && (t = this.rowHeaders); let n = []; for (let a of e) n.push(this.columnHeaders.indexOf(a)); let o = []; for (let a of t) o.push(this.rowHeaders.indexOf(a)); let r = []; for (let a of n) { const s = this.dataValues.map((l) => l[a]); let i = []; for (let l of o) i.push(s[l]); r.push(i); } r = r[0].map((a, s) => r.map((i) => i[s])), this.createPlot(e, t, r, "heatmap"); }, createPlot(e, t, n, o) { var r = [ { x: e, y: t, z: n, type: o } ]; const a = { title: { text: this.plotTitle } }; import_core.default.react(this.$refs.plotlyplot, r, { ...this.layout, ...a, ...this.plotLayout }, this.options); }, populateColumnHeaders(e) { let n = [...e.data[this.fullMetadata.columnHeaderIndex]]; this.columnHeaders = n.slice(this.fullMetadata.rowHeaderSize); }, populateRowHeaders(e) { const n = e.data.map((o) => o[this.fullMetadata.rowHeaderIndex]); this.rowHeaders = n.slice(this.fullMetadata.columnHeaderSize); }, populateDataValues(e) { const n = e.data.slice(this.fullMetadata.columnHeaderSize); this.dataValues = markRaw(n.map((o) => o.slice(this.fullMetadata.rowHeaderSize))); } } }; var y1 = { ref: "plotContainer", class: "container" }; var b1 = { ref: "plotlyplot", class: "vue-plotly" }; var w1 = { key: 0 }; function x1(e, t, n, o, r, a) { const s = ln, i = sn, l = Pn, u = Ln; return openBlock(), createElementBlock("div", y1, [ createBaseVNode("div", b1, null, 512), e.selectorUi ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(["chooser-container", { inactive: e.loading }]) }, [ createBaseVNode("span", null, [ createVNode(i, { modelValue: e.filterX, "onUpdate:modelValue": t[0] || (t[0] = (c) => e.filterX = c), class: "channel-select", multiple: "", filterable: "", "collapse-tags": "", "default-first-option": "", placeholder: "select" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.columnHeaders, (c) => (openBlock(), createBlock(s, { key: c, label: c, value: c }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"]) ]), createBaseVNode("span", null, [ createVNode(i, { modelValue: e.filterY, "onUpdate:modelValue": t[1] || (t[1] = (c) => e.filterY = c), class: "channel-select", multiple: "", filterable: "", "collapse-tags": "", "default-first-option": "", placeholder: "select" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e.rowHeaders, (c) => (openBlock(), createBlock(s, { key: c, label: c, value: c }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"]) ]), createBaseVNode("span", null, [ createVNode(l, { class: "view-heatmap-button", onClick: a.filterPlot }, { default: withCtx(() => [ createTextVNode("Filter plot") ]), _: 1 }, 8, ["onClick"]) ]), a.logScaleEnabled ? (openBlock(), createElementBlock("span", w1, [ createVNode(l, { class: "view-heatmap-button", onClick: a.logToggle }, { default: withCtx(() => [ createTextVNode("Toggle log") ]), _: 1 }, 8, ["onClick"]) ])) : createCommentVNode("", true) ], 2)) : createCommentVNode("", true), createVNode(u, { "parent-element": { element: e.$refs.plotContainer }, "controls-enabled": !e.loading }, null, 8, ["parent-element", "controls-enabled"]) ], 512); } var F1 = Fo(m1, [["render", x1], ["__scopeId", "data-v-e71fb8c3"]]); var C1 = ["1.2.0", "1.1.0"]; var S1 = { name: "PlotVuer", components: { TimeseriesPlot: g1, HeatmapPlot: F1 }, props: { /** * The object with `url` property * where the `url` is the source url to load the data. */ dataSource: { type: Object, required: true, default: () => { } }, /** * The metadata object * with `version`, `type`, and `attrs` properties. */ metadata: { type: Object, required: true, validator: function(e) { return C1.includes(e.version) && e.type === "plot"; } }, /** * The plotLayout for UI. */ plotLayout: { type: Object, /** * `{ * paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', autosize: true, margin: { t: 25, l: 55, r: 55, b: 90, pad: 4 }, loading: false, options: { responsive: true, scrollZoom: true } * }` */ default: () => ({ paper_bgcolor: "rgba(0,0,0,0)", plot_bgcolor: "rgba(0,0,0,0)", autosize: true, margin: { t: 25, l: 55, r: 55, b: 90, pad: 4 }, loading: false, options: { responsive: true, scrollZoom: true } }) }, /** * The supplemental data to load. */ supplementalData: { type: Array, default: () => [] }, /** * The option to choose helpMode. */ helpMode: { type: Boolean, default: false }, /** * The option to show the selector UI. */ selectorUi: { type: Boolean, default: true } }, computed: { plotType: function() { return this.metadata.attrs.style + "-plot"; }, layout: function() { return this.metadata ? this.metadata.attrs ? this.metadata.attrs.layout ? this.metadata.attrs.layout : this.plotLayout : this.plotLayout : this.plotLayout; } } }; var O1 = { class: "plotvuer_parent" }; function T1(e, t, n, o, r, a) { return openBlock(), createElementBlock("div", O1, [ a.plotType != "-plot" ? (openBlock(), createBlock(resolveDynamicComponent(a.plotType), { key: 0, sourceData: n.dataSource, plotLayout: a.layout, version: n.metadata.version, metadata: n.metadata.attrs, selectorUi: n.selectorUi, supplementalData: n.supplementalData }, null, 8, ["sourceData", "plotLayout", "version", "metadata", "selectorUi", "supplementalData"])) : createCommentVNode("", true) ]); } var P1 = Fo(S1, [["render", T1], ["__scopeId", "data-v-72189ced"]]); export { P1 }; /*! Bundled license information: native-promise-only/lib/npo.src.js: (*! Native Promise Only v0.8.1 (c) Kyle Simpson MIT License: http://getify.mit-license.org *) polybooljs/index.js: (* * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc * @license MIT * @preserve Project Home: https://github.com/voidqk/polybooljs *) papaparse/papaparse.min.js: (* @license Papa Parse v5.5.3 https://github.com/mholt/PapaParse License: MIT *) @abi-software/plotvuer/dist/plotvuer.js: (*! Element Plus Icons Vue v2.3.1 *) */ //# sourceMappingURL=chunk-HTVEDWAD.js.map